Grid topology directory. More...
#include <Padico/Puk.h>#include <Padico/Module.h>#include <Padico/PM2.h>#include <Padico/PadicoTM.h>#include "Topology-internals.h"#include <string.h>#include <unistd.h>#include <netdb.h>#include <netinet/in.h>#include <arpa/inet.h>#include <sys/un.h>#include <sys/socket.h>#include <sys/types.h>#include <sys/stat.h>#include <pwd.h>#include <resolv.h>#include <dirent.h>#include <poll.h>#include <ifaddrs.h>#include <netpacket/packet.h>#include <sys/ioctl.h>#include <linux/netlink.h>#include <linux/rtnetlink.h>#include <linux/sockios.h>#include <linux/ethtool.h>#include <linux/if.h>
Go to the source code of this file.
Macros | |
| #define | BUFSIZE 512 |
Detailed Description
Grid topology directory.
Definition in file topology.c.
Macro Definition Documentation
◆ BUFSIZE
| #define BUFSIZE 512 |
Function Documentation
◆ __attribute__()
| __attribute__ | ( | (visibility("internal")) | ) |
◆ na_bindings_vect_contains_network()
|
inlinestatic |
Definition at line 2249 of file topology.c.
References b, done, and network.
Referenced by padico_topo_network_contains_host(), and padico_topo_network_contains_node().
◆ na_network_getentity_byaddr()
|
static |
Definition at line 2268 of file topology.c.
References topo_address_s::_addr_storage, topo_network_s::addr_size, b, topo_network_s::bindings, done, e, network, and NULL.
Referenced by padico_topo_network_gethostbyaddr(), and padico_topo_network_getnodebyaddr().
◆ padico_module_attr_autodetect_getvalue()
|
inlinestatic |
Definition at line 82 of file topology.c.
Referenced by topo_device_detect().
◆ padico_module_attr_autodetect_setvalue()
|
inlinestatic |
Definition at line 82 of file topology.c.
◆ padico_module_attr_disable_dns_getvalue()
|
inlinestatic |
Definition at line 80 of file topology.c.
Referenced by padico_topo_host_add_name(), and topo_gethostbyaddr().
◆ padico_module_attr_disable_dns_setvalue()
|
inlinestatic |
Definition at line 80 of file topology.c.
◆ padico_module_attr_disable_ipv6_getvalue()
|
inlinestatic |
Definition at line 81 of file topology.c.
Referenced by topo_gethostbyaddr(), and topo_gethostbyname2().
◆ padico_module_attr_disable_ipv6_setvalue()
|
inlinestatic |
Definition at line 81 of file topology.c.
◆ padico_module_attr_finalizer__autodetect()
Definition at line 82 of file topology.c.
◆ padico_module_attr_finalizer__disable_dns()
Definition at line 80 of file topology.c.
◆ padico_module_attr_finalizer__disable_ipv6()
Definition at line 81 of file topology.c.
◆ padico_module_attr_initializer__autodetect()
Definition at line 82 of file topology.c.
◆ padico_module_attr_initializer__disable_dns()
Definition at line 80 of file topology.c.
◆ padico_module_attr_initializer__disable_ipv6()
Definition at line 81 of file topology.c.
◆ padico_module_create_initializer__Topology()
Definition at line 78 of file topology.c.
◆ padico_topo_binding_add_gw_hwaddr()
| void padico_topo_binding_add_gw_hwaddr | ( | padico_topo_binding_t | binding, |
| padico_topo_hwaddr_t | hwaddr | ||
| ) |
Definition at line 232 of file topology.c.
References done, topo_property_s::hwaddr, topo_binding_s::props, and TOPO_PROPERTY_GW_HWADDR.
Referenced by topo_inet_route_detect().
◆ padico_topo_host_policy()
|
static |
Definition at line 2069 of file topology.c.
References b, topo_host_s::bindings, topo_property_s::content, done, topo_network_s::family, topo_property_s::filter, topo_property_s::FILTER, topo_net_entity_s::host, host, topo_net_entity_s::kind, network, topo_net_entity_s::network, topo_binding_s::network, NULL, p, PADICO_TOPO_FILTER_ALLOW_IN, PADICO_TOPO_FILTER_ALLOW_OUT, PADICO_TOPO_FILTER_MASK_IN, PADICO_TOPO_FILTER_MASK_OUT, topo_filter_s::policy, port, PORT_ANY, topo_binding_s::props, TOPO_PROPERTY_FILTER, and topo_network_s::uplink.
Referenced by padico_topo_host_can_input(), padico_topo_host_can_output(), padico_topo_network_can_input(), and padico_topo_network_can_output().
◆ padico_topo_network_contains_host()
| int padico_topo_network_contains_host | ( | padico_topo_network_t | network, |
| padico_topo_host_t | host | ||
| ) |
Definition at line 2263 of file topology.c.
References topo_host_s::bindings, host, na_bindings_vect_contains_network(), and network.
◆ padico_topo_network_inet_info()
|
inlinestatic |
Definition at line 2241 of file topology.c.
References done, network, and topo_network_s::network_id.
Referenced by topo_host_from_hostent().
◆ padico_topology_finalize()
Definition at line 378 of file topology.c.
References done, host, padico_topology_s::host_table, padico_topology_s::hostsbyname, na_topology, name, padico_topology_s::networks, node, padico_topology_s::node_table, padico_topology_s::nodesbyname, topo_host_destroy(), topo_network_destroy(), topo_node_destroy(), and uuid.
◆ padico_topology_init()
Definition at line 364 of file topology.c.
References done, padico_topology_s::host_table, padico_topology_s::hostsbyname, padico_topology_s::inet, padico_topology_s::inet6, na_topology, padico_topology_s::networks, padico_topology_s::node_table, padico_topology_s::nodesbyname, padico_topo_network_create(), PADICO_TOPO_SCOPE_HOST, and topology_populate().
◆ topo_addr_visibility_name()
|
static |
inet address visibility pretty print
Definition at line 1228 of file topology.c.
References PADICO_TOPO_ADDR_VISIBILITY_LINKLOCAL, PADICO_TOPO_ADDR_VISIBILITY_LOOPBACK, PADICO_TOPO_ADDR_VISIBILITY_NONE, PADICO_TOPO_ADDR_VISIBILITY_PRIVATE, PADICO_TOPO_ADDR_VISIBILITY_PUBLIC, and v.
Referenced by topo_inet_addr_detect_getifaddrs(), and topo_inet_addr_detect_netlink().
◆ topo_binding_bind_host()
| void topo_binding_bind_host | ( | padico_topo_binding_t * | _binding, |
| padico_topo_host_t | host | ||
| ) |
Definition at line 1747 of file topology.c.
References assert(), b, topo_host_s::bindings, done, topo_binding_s::entity, topo_net_entity_s::host, host, topo_property_s::hwaddr, topo_net_entity_s::kind, topo_binding_s::network, NULL, p, PADICO_TOPO_SCOPE_HOST, topo_binding_s::props, topo_network_s::scope, topo_binding_merge(), topo_hwaddr_getbyname(), and TOPO_PROPERTY_HWADDR.
Referenced by padico_topo_host_bind(), and topo_host_end_handler().
◆ topo_binding_bind_node()
| void topo_binding_bind_node | ( | padico_topo_binding_t * | _binding, |
| padico_topo_node_t | node | ||
| ) |
Definition at line 1783 of file topology.c.
References assert(), b, topo_node_s::bindings, done, topo_binding_s::entity, topo_net_entity_s::kind, topo_binding_s::network, node, topo_net_entity_s::node, NULL, PADICO_TOPO_SCOPE_NODE, topo_network_s::scope, and topo_binding_merge().
Referenced by padico_topo_node_bind(), and topo_node_end_handler().
◆ topo_binding_destroy()
| void topo_binding_destroy | ( | struct topo_binding_s * | binding | ) |
Definition at line 1626 of file topology.c.
References done, p, topo_binding_s::props, and topo_property_destroy().
Referenced by padico_topo_node_disconnect(), topo_host_destroy(), topo_network_destroy(), and topo_node_destroy().
◆ topo_binding_merge()
| void topo_binding_merge | ( | padico_topo_binding_t | binding, |
| padico_topo_binding_t | b2 | ||
| ) |
merge properties from b2 into 'binding', then destroy b2
Definition at line 1658 of file topology.c.
References topo_network_s::addr_size, assert(), b, b2, topo_network_s::bindings, done, topo_binding_s::network, NULL, p, topo_binding_s::props, TOPO_PROPERTY_ADDR, topo_property_destroy(), TOPO_PROPERTY_FILTER, TOPO_PROPERTY_GW_ADDR, TOPO_PROPERTY_GW_HOST, TOPO_PROPERTY_GW_HWADDR, TOPO_PROPERTY_HOSTNAME, TOPO_PROPERTY_HWADDR, TOPO_PROPERTY_INDEX, TOPO_PROPERTY_MISC, TOPO_PROPERTY_PERF, TOPO_PROPERTY_ROUTE, and TOPO_PROPERTY_SERVICE.
Referenced by topo_binding_bind_host(), topo_binding_bind_node(), and topo_network_end_handler().
◆ topo_detect_link_perf()
|
static |
Definition at line 480 of file topology.c.
References b, done, topo_hwaddr_s::name, padico_topo_binding_add_perf(), and rc.
Referenced by topo_inet_addr_detect_getifaddrs().
◆ topo_device_detect()
Definition at line 1068 of file topology.c.
References done, NULL, padico_module_attr_autodetect_getvalue(), rc, and s.
Referenced by topology_populate().
◆ topo_gethostbyaddr()
|
static |
frontend to gethostbyaddr
Definition at line 412 of file topology.c.
References done, len, NULL, padico_module_attr_disable_dns_getvalue(), and padico_module_attr_disable_ipv6_getvalue().
Referenced by padico_topo_host_resolvebyname(), and topo_inet_addr_detect_getifaddrs().
◆ topo_gethostbyname2()
frontend to gethostbyname2 to manage TRY_AGAIN error
Definition at line 438 of file topology.c.
References done, name, NULL, and padico_module_attr_disable_ipv6_getvalue().
Referenced by padico_topo_host_resolvebyname(), topo_host_from_hostent(), and topology_populate().
◆ topo_host_destroy()
|
static |
Definition at line 1478 of file topology.c.
References topo_host_s::bindings, done, h, topo_host_s::hnames, host, topo_host_s::hostname, topo_host_s::hwaddrs, i, n, topo_host_s::nodes, p, topo_host_s::props, topo_binding_destroy(), and topo_property_destroy().
Referenced by padico_topology_finalize().
◆ topo_host_from_hostent()
|
static |
Create a new host from host entry.
Definition at line 2571 of file topology.c.
References topo_property_s::addr, assert(), b, done, host, topo_host_s::hostname, padico_topology_s::inet, padico_topology_s::inet6, na_topology, NULL, p, PADICO_TOPO_ADDR_VISIBILITY_PRIVATE, PADICO_TOPO_ADDR_VISIBILITY_PUBLIC, padico_topo_getlocalhost, padico_topo_host_add_name(), padico_topo_host_bind(), padico_topo_host_create(), padico_topo_inet_visibility(), padico_topo_network_inet_info(), topo_gethostbyname2(), topo_host_lookup(), topo_host_ping(), TOPO_PROPERTY_GW_ADDR, and v.
Referenced by padico_topo_host_resolvebyname().
◆ topo_host_lookup()
| padico_topo_host_t topo_host_lookup | ( | const char * | hostname | ) |
Definition at line 1510 of file topology.c.
References done, host, padico_topology_s::hostsbyname, na_topology, and padico_topo_getlocalhost.
Referenced by padico_topo_getnodebyname(), padico_topo_host_resolvebyname(), topo_host_from_hostent(), and topo_host_start_handler().
◆ topo_host_ping()
try to ping a host to detect whether it is reachable.
make a UDP ping, like tracepath, so as to run as non-root.
Definition at line 2482 of file topology.c.
References buffer, BUFSIZE, done, fd, p, PUK_ABI_FSYS_WRAP, rc, and socklen_t.
Referenced by topo_host_from_hostent().
◆ topo_hwaddr_type_name()
MAC address type pretty print.
Definition at line 1248 of file topology.c.
Referenced by topo_inet_addr_detect_getifaddrs().
◆ topo_inet_addr_detect()
|
static |
Definition at line 829 of file topology.c.
References done, rc, topo_inet_addr_detect_getifaddrs(), topo_inet_addr_detect_netlink(), and topo_inet_addr_detect_siocgifconf().
Referenced by topology_populate().
◆ topo_inet_addr_detect_getifaddrs()
|
static |
detect network interfaces using Linux getifaddrs, if available
Definition at line 503 of file topology.c.
References done, i, padico_topology_s::inet, padico_topology_s::inet6, na_topology, network, NULL, PADICO_TOPO_ADDR_VISIBILITY_LINKLOCAL, PADICO_TOPO_ADDR_VISIBILITY_LOOPBACK, PADICO_TOPO_ADDR_VISIBILITY_NONE, PADICO_TOPO_ADDR_VISIBILITY_PRIVATE, PADICO_TOPO_ADDR_VISIBILITY_PUBLIC, padico_topo_binding_add_hostname(), padico_topo_binding_add_hwaddr(), padico_topo_host_add_name(), padico_topo_host_bind(), padico_topo_hwaddr_add(), padico_topo_hwaddr_create(), padico_topo_inet6_visibility(), padico_topo_inet_visibility(), padico_topo_network_create(), padico_topo_network_getbyid(), PADICO_TOPO_SCOPE_HOST, rc, topo_addr_visibility_name(), topo_detect_link_perf(), topo_gethostbyaddr(), topo_hwaddr_getbyname(), topo_hwaddr_type_name(), and v.
Referenced by topo_inet_addr_detect().
◆ topo_inet_addr_detect_netlink()
|
static |
detect network interfaces using netlink socket
< netlink header
Definition at line 685 of file topology.c.
References done, fd, padico_topology_s::inet, na_topology, p, PADICO_TOPO_ADDR_VISIBILITY_LINKLOCAL, PADICO_TOPO_ADDR_VISIBILITY_LOOPBACK, PADICO_TOPO_ADDR_VISIBILITY_NONE, PADICO_TOPO_ADDR_VISIBILITY_PRIVATE, PADICO_TOPO_ADDR_VISIBILITY_PUBLIC, padico_topo_host_bind(), padico_topo_inet_visibility(), peer, PUK_ABI_FSYS_WRAP, rc, recv, req, topo_addr_visibility_name(), and v.
Referenced by topo_inet_addr_detect().
◆ topo_inet_addr_detect_siocgifconf()
|
static |
detect network interfaces using netdevice ioctl
Definition at line 649 of file topology.c.
References __puk_abi_wrap__errno, done, i, PUK_ABI_FSYS_WRAP, rc, and sockfd.
Referenced by topo_inet_addr_detect().
◆ topo_inet_route_detect()
|
static |
< netlink header
< rtnetlink request
Definition at line 843 of file topology.c.
References b, done, topo_binding_s::entity, topo_network_s::family, fd, padico_topology_s::inet, topo_net_entity_s::kind, na_topology, topo_hwaddr_s::name, network, topo_net_entity_s::network, topo_binding_s::network, NULL, p, PADICO_TOPO_ADDR_VISIBILITY_PRIVATE, padico_topo_binding_add_filter(), padico_topo_binding_add_gw_addr(), padico_topo_binding_add_gw_hwaddr(), padico_topo_binding_add_route(), PADICO_TOPO_FILTER_BLOCK_IN, padico_topo_hwaddr_create(), padico_topo_hwaddr_destroy(), padico_topo_inet_visibility(), padico_topo_network_create(), padico_topo_network_getbyid(), PADICO_TOPO_SCOPE_HOST, peer, PORT_ANY, topo_binding_s::props, PUK_ABI_FSYS_WRAP, rc, recv, req, sockfd, topo_binding_create(), topo_hwaddr_getbyindex(), TOPO_HWADDR_NAMSIZ, TOPO_PROPERTY_HWADDR, and topo_network_s::uplink.
Referenced by topology_populate().
◆ topo_inet_service_detect()
|
static |
Definition at line 1031 of file topology.c.
References done, local_addr, padico_topo_host_add_service(), rc, remote_addr, and timeout.
Referenced by topology_populate().
◆ topo_network_destroy()
|
static |
Definition at line 1875 of file topology.c.
References topo_network_s::bindings, done, network, topo_network_s::network_id, topo_binding_destroy(), and topo_network_s::uplink.
Referenced by padico_topology_finalize().
◆ topo_node_create()
| padico_topo_node_t topo_node_create | ( | const char * | name, |
| padico_topo_host_t | host, | ||
| const char * | uuid, | ||
| const char * | boot_id | ||
| ) |
Create a new node, either locally or received as XML description.
Definition at line 1812 of file topology.c.
References assert(), topo_node_s::bindings, topo_node_s::boot_id, boot_id, topo_uuid_s::bytes, topo_node_s::canonical_nodename, done, topo_node_s::host, host, na_topology, name, node, padico_topology_s::node_table, topo_host_s::nodes, padico_topology_s::nodesbyname, NULL, padico_topo_getnodebyuuid(), PADICO_TOPO_UUID_SIZE, topo_node_s::uuid, uuid, and topo_uuid_s::zero.
Referenced by topo_node_start_handler(), and topology_populate().
◆ topo_node_destroy()
| void topo_node_destroy | ( | padico_topo_node_t | node | ) |
Definition at line 1840 of file topology.c.
References topo_node_s::bindings, topo_node_s::boot_id, topo_node_s::canonical_nodename, done, i, node, and topo_binding_destroy().
Referenced by padico_topology_finalize().
◆ topo_property_destroy()
| void topo_property_destroy | ( | struct topo_property_s * | prop | ) |
Definition at line 1637 of file topology.c.
References done, TOPO_PROPERTY_HOSTNAME, TOPO_PROPERTY_HWADDR, and TOPO_PROPERTY_MISC.
Referenced by topo_binding_destroy(), topo_binding_end_handler(), topo_binding_merge(), topo_host_destroy(), and topo_host_end_handler().
◆ topology_get()
| struct padico_topology_s * topology_get | ( | void | ) |
Definition at line 86 of file topology.c.
References na_topology.
Referenced by padico_na_topology_serialize().
◆ topology_populate()
Definition at line 1286 of file topology.c.
References boot_id, done, i, padico_topology_s::local_node, na_topology, NULL, padico_topo_host_add_name(), padico_topo_host_add_property(), padico_topo_host_create(), padico_topo_network_create(), padico_topo_node_bind(), padico_topo_node_getname(), PADICO_TOPO_SCOPE_NODE, PADICO_TOPO_UUID_SIZE, pid, rank, topo_device_detect(), topo_gethostbyname2(), topo_inet_addr_detect(), topo_inet_route_detect(), topo_inet_service_detect(), topo_node_create(), and uuid.
Referenced by padico_topology_init().
Variable Documentation
◆ na_topology
|
static |
Definition at line 84 of file topology.c.
Referenced by padico_topo_gethosts(), padico_topo_getlocalnode(), padico_topo_getnodebyname(), padico_topo_getnodebyuuid(), padico_topo_host_add_name(), padico_topo_host_create(), padico_topo_host_getaddr(), padico_topo_host_resolvebyname(), padico_topo_network_create(), padico_topo_network_getbyid(), padico_topo_networks_getbyfamily(), padico_topology_finalize(), padico_topology_init(), topo_host_from_hostent(), topo_host_lookup(), topo_inet_addr_detect_getifaddrs(), topo_inet_addr_detect_netlink(), topo_inet_route_detect(), topo_node_create(), topology_get(), and topology_populate().
◆ padico_mod_binary__Topology
| struct puk_mod_binary_s padico_mod_binary__Topology = { .name = "Topology", .funcs = &padico_mod_funcs__Topology , .mod = NULL, .profile = { .total_mem = 0, .max_mem = 0, .num_malloc = 0, .num_free = 0 } , .auto_deps = & puk_mod_dep_0 , .n_deps = sizeof((char*[]){ 0, }) / sizeof(char*), .deps = { NULL, } } |
Definition at line 78 of file topology.c.
◆ padico_mod_funcs__Topology
|
static |
Definition at line 78 of file topology.c.
◆ padico_module_opt_autodetect
|
static |
Definition at line 82 of file topology.c.
◆ padico_module_opt_disable_dns
|
static |
Definition at line 80 of file topology.c.
◆ padico_module_opt_disable_ipv6
|
static |
Definition at line 81 of file topology.c.