PadicoTM

Documentation

« back to PM2 home.

Topology description API. More...

#include <Padico/Puk.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <errno.h>
#include <netinet/tcp.h>
Include dependency graph for Topology.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  padico_address_kind_t
 
struct  sockaddr_pa
 
struct  padico_vaddr_s
 

Macros

#define PADICO_LAST_MODULE_NAME   Topology
 
#define PADICO_TOPO_UUID_SIZE   32
 
#define PADICO_TOPO_FILTER_MASK_IN   (PADICO_TOPO_FILTER_BLOCK_IN | PADICO_TOPO_FILTER_ALLOW_IN)
 
#define PADICO_TOPO_FILTER_MASK_OUT   (PADICO_TOPO_FILTER_BLOCK_OUT | PADICO_TOPO_FILTER_ALLOW_OUT)
 
#define PADICO_TOPO_FILTER_MASK_BLOCK   (PADICO_TOPO_FILTER_BLOCK_IN | PADICO_TOPO_FILTER_BLOCK_OUT)
 
#define PADICO_TOPO_FILTER_MASK_ALLOW   (PADICO_TOPO_FILTER_ALLOW_IN | PADICO_TOPO_FILTER_ALLOW_AOUT)
 
#define PORT_ANY   0
 
#define padico_topo_nodename()   padico_topo_node_getname(padico_topo_getlocalnode())
 
#define padico_topo_nodealias()   padico_topo_node_getalias(padico_topo_getlocalnode())
 
#define padico_topo_getlocalhost()   padico_topo_node_gethost(padico_topo_getlocalnode())
 
#define padico_topo_hostname()   padico_topo_host_getname(padico_topo_getlocalhost())
 
#define padico_topo_session()   padico_topo_node_getsession(padico_topo_getlocalnode())
 
#define padico_na_size()   padico_topo_network_size(padico_topo_session_getnetwork(padico_topo_session()))
 
#define padico_na_rank()   padico_topo_session_getrank(padico_topo_session(), padico_topo_getlocalnode())
 
#define AF_PADICO
 
#define PF_PADICO   AF_PADICO
 
#define AF_PADICO_MAGIC(B1, B2, B3, B4)    (((padico_address_kind_t){ .bytes = { B1, B2, B3, B4 } }).integer)
 
#define AF_PADICO_MAKE(I)    ((padico_address_kind_t){ .integer = (I) })
 
#define AF_PADICO_REVERSE(I)    ((AF_PADICO_MAKE(I)).bytes)
 
#define AF_PADICO_INET   AF_PADICO_MAGIC('I', 'N', 'E', 'T')
 
#define AF_PADICO_UNIX   AF_PADICO_MAGIC('U', 'N', 'I', 'X')
 
#define AF_PADICO_AUTO   AF_PADICO_MAGIC('A', 'U', 'T', 'O')
 
#define AF_PADICO_PAYLOAD   64
 
#define padico_sockaddr_payload(TYPE, ADDRESS)
 
#define padico_sockaddr_magic(ADDRESS)
 

Typedefs

typedef const struct topo_uuid_s * padico_topo_uuid_t
 
typedef struct topo_host_s * padico_topo_host_t
 
typedef struct topo_node_s * padico_topo_node_t
 
typedef struct topo_network_s * padico_topo_network_t
 
typedef struct topo_binding_s * padico_topo_binding_t
 
typedef const struct topo_hwaddr_s * padico_topo_hwaddr_t
 
typedef const struct topo_address_s * padico_topo_address_t
 
typedef struct topo_filter_s * padico_topo_filter_t
 
typedef struct topo_service_s * padico_topo_service_t
 
typedef struct padico_vaddr_s * padico_vaddr_t
 

Enumerations

enum  padico_topo_binding_scope_t { PADICO_TOPO_SCOPE_NONE = 0x00 , PADICO_TOPO_SCOPE_NODE = 0x01 , PADICO_TOPO_SCOPE_HOST = 0x02 , PADICO_TOPO_SCOPE_ALL = 0xFF }
 
enum  padico_topo_addr_visibility_t {
  PADICO_TOPO_ADDR_VISIBILITY_NONE = 0 , PADICO_TOPO_ADDR_VISIBILITY_LOOPBACK = 1 , PADICO_TOPO_ADDR_VISIBILITY_LINKLOCAL = 2 , PADICO_TOPO_ADDR_VISIBILITY_PRIVATE = 3 ,
  PADICO_TOPO_ADDR_VISIBILITY_PUBLIC = 4
}
 
enum  padico_topo_filter_policy_t {
  _PADICO_TOPO_FILTER_NONE = 0x00 , PADICO_TOPO_FILTER_BLOCK_IN = 0x01 , PADICO_TOPO_FILTER_BLOCK_OUT = 0x02 , PADICO_TOPO_FILTER_ALLOW_IN = 0x04 ,
  PADICO_TOPO_FILTER_ALLOW_OUT = 0x08 , _PADICO_TOPO_FILTER_MAX
}
 

Functions

padico_topo_host_t padico_topo_host_create (const char *hostname)
 Create new host.
 
void padico_topo_host_add_name (padico_topo_host_t host, const char *name, int resolvable)
 Add a name to a host;.
 
void padico_topo_host_add_service (padico_topo_host_t host, const char *service_name, uint16_t service_port)
 Add a service to a host.
 
void padico_topo_host_add_property (padico_topo_host_t host, const char *label, const char *name)
 Add a property to a host.
 
padico_topo_host_t padico_topo_host_resolve_byinaddr (const struct in_addr *addr)
 Get a host description record from an inet address (create if it didn't exist)
 
padico_topo_host_t padico_topo_host_getbyinaddr (const struct in_addr *addr)
 Get a host from an inet address (return NULL if host doesn't exist).
 
padico_topo_host_t padico_topo_host_resolve_byin6addr (const struct in6_addr *addr)
 Get a host description record from an inet6 address (create if it didn't exist)
 
padico_topo_host_t padico_topo_host_getbyin6addr (const struct in6_addr *addr)
 Get a host from an inet6 address (return NULL if host doesn't exist).
 
padico_topo_host_t padico_topo_host_resolvebyname (const char *hostname)
 Get a host description record (lookup in cache, create if it didn't exist)
 
const char * padico_topo_host_getname (padico_topo_host_t host)
 Get the canonical name of a host.
 
const char * padico_topo_host_getname2 (padico_topo_host_t host, padico_topo_network_t network)
 Get the canonical name of a host on a network.
 
const struct in_addr * padico_topo_host_getaddr (padico_topo_host_t host)
 Get the canonical IP address of a host.
 
const struct in_addr * padico_topo_host_getaddr2 (padico_topo_host_t host, padico_topo_network_t network)
 Get the canonical IP address of a host on a network.
 
padico_topo_binding_vect_t padico_topo_host_getbindings (padico_topo_host_t host, padico_topo_network_t network)
 Get the bindings of a host on a network.
 
padico_topo_node_vect_t padico_topo_host_getnodes (padico_topo_host_t host)
 Get the nodes on a host.
 
void padico_topo_host_getnetworks (padico_topo_host_t host, padico_topo_network_vect_t networks)
 Get the networks a host is connected to.
 
int padico_topo_host_getservice (padico_topo_host_t host, char *service_name)
 Get the service port of the service on a host.
 
const char * padico_topo_host_getproperty (padico_topo_host_t host, const char *label)
 Get property on a host.
 
int padico_topo_host_can_output (padico_topo_host_t host, padico_topo_network_t network, uint16_t port, int protocol)
 Verify if the port is filtered output between host and network.
 
int padico_topo_host_can_input (padico_topo_host_t host, padico_topo_network_t network, uint16_t port, int protocol)
 Verify if the port is filtered input between host and network.
 
int padico_topo_network_can_input (padico_topo_network_t subnet, padico_topo_network_t network, uint16_t port, int protocol)
 
int padico_topo_network_can_output (padico_topo_network_t subnet, padico_topo_network_t network, uint16_t port, int protocol)
 
padico_topo_binding_t padico_topo_host_bind (padico_topo_host_t host, padico_topo_network_t network, const void *address)
 Declare a new binding for a host.
 
padico_topo_host_vect_t padico_topo_gethosts ()
 Get known hosts.
 
static padico_topo_node_t padico_topo_host_getnode (padico_topo_host_t host)
 Get the first node of a host.
 
padico_topo_node_t padico_topo_getnodebyname (const char *nodename)
 node lookup, by node name
 
padico_topo_node_t padico_topo_getnodebyuuid (padico_topo_uuid_t uuid)
 node lookup, by UUID
 
padico_topo_uuid_t padico_topo_node_getuuid (padico_topo_node_t node)
 Get the UUID of a node.
 
const char * padico_topo_node_getname (padico_topo_node_t node)
 Get the canonical name of a node.
 
padico_topo_host_t padico_topo_node_gethost (padico_topo_node_t node)
 Get the host hosting a node.
 
padico_topo_address_t padico_topo_node_getaddress (padico_topo_node_t node, padico_topo_network_t network)
 Get the address of the node in the given network.
 
const char * padico_topo_node_getsession (padico_topo_node_t node)
 Get the boot session ID.
 
void padico_topo_node_getnetworks (padico_topo_node_t node, padico_topo_network_vect_t networks)
 Get the networks a node is connected to.
 
void padico_topo_node_disconnect (padico_topo_node_t node)
 Remove a disconnected node from topology.
 
padico_topo_binding_t padico_topo_node_bind (padico_topo_node_t node, padico_topo_network_t network, const void *address)
 Declare a new binding for a node.
 
padico_topo_network_t padico_topo_network_create (const char *id, padico_topo_binding_scope_t scope, size_t addr_size, int family)
 
padico_topo_network_t padico_topo_network_getbyid (const char *network_id)
 
padico_topo_network_vect_t padico_topo_networks_getbyfamily (int family)
 Get networks of a given address family (e.g.
 
int padico_topo_network_contains_node (padico_topo_network_t network, padico_topo_node_t node)
 tests whether the given node belong to the network
 
const char * padico_topo_network_getname (padico_topo_network_t network)
 
int padico_topo_network_size (padico_topo_network_t network)
 
padico_topo_host_t padico_topo_network_gethostbyaddr (padico_topo_network_t, const void *)
 Get a host description record from an address.
 
padico_topo_node_t padico_topo_network_getnodebyaddr (padico_topo_network_t network, const void *addr)
 Get a node descriptor from an address.
 
void padico_topo_network_gethosts (padico_topo_network_t n, padico_topo_host_vect_t hosts)
 
void padico_topo_network_get_common_host (padico_topo_network_t n1, padico_topo_network_t n2, padico_topo_host_vect_t hosts)
 
void padico_topo_network_set_perf (padico_topo_network_t n, int latency_nsec, int bandwidth_kbps)
 
void padico_topo_network_get_perf (padico_topo_network_t n, int *latency_nsec, int *bandwidth_kbps)
 
padico_string_t padico_topo_host_serialize (padico_topo_host_t host)
 
padico_string_t padico_topo_node_serialize (padico_topo_node_t node)
 
padico_string_t padico_topo_network_serialize (padico_topo_network_t net)
 
padico_string_t padico_na_topology_serialize (padico_topo_binding_scope_t scope)
 
const void * padico_topo_address_getbytes (padico_topo_address_t address)
 
padico_topo_node_t padico_topo_getlocalnode (void)
 
static padico_topo_network_t padico_topo_session_getnetwork (const char *session_id)
 
static padico_topo_node_t padico_topo_session_getnodebyrank (const char *session_id, int rank)
 
static int padico_topo_session_getrank (const char *session_id, padico_topo_node_t node)
 
padico_topo_hwaddr_t padico_topo_hwaddr_create (const char *name, int index, int type, size_t len, const void *addr)
 
void padico_topo_hwaddr_get (padico_topo_hwaddr_t hwaddr, const char **name, int *index, int *type, size_t *len, const void **addr)
 
void padico_topo_hwaddr_add (padico_topo_host_t host, padico_topo_hwaddr_t *_hwaddr)
 
void padico_topo_hwaddr_destroy (padico_topo_hwaddr_t hwaddr)
 
void padico_topo_binding_add_addr (padico_topo_binding_t binding, const void *addr)
 
void padico_topo_binding_add_index (padico_topo_binding_t binding, int64_t index)
 
void padico_topo_binding_add_hwaddr (padico_topo_binding_t binding, padico_topo_hwaddr_t hwaddr)
 
void padico_topo_binding_add_gw_addr (padico_topo_binding_t binding, struct in_addr *inaddr)
 
void padico_topo_binding_add_hostname (padico_topo_binding_t binding, const char *name)
 
void padico_topo_binding_add_route (padico_topo_binding_t binding, padico_topo_network_t dest, const void *gwaddr)
 
void padico_topo_binding_add_filter (padico_topo_binding_t binding, padico_topo_filter_policy_t policy, uint16_t port, int protocol)
 
void padico_topo_binding_add_perf (padico_topo_binding_t binding, int latency, int bandwidth)
 
void padico_topo_binding_get_perf (padico_topo_binding_t binding, int *latency_nsec, int *bandwidth_kbps)
 
padico_topo_hwaddr_t padico_topo_binding_gethwaddr (padico_topo_binding_t binding)
 
int padico_topo_binding_get_index (padico_topo_binding_t binding, int64_t *index)
 
padico_topo_addr_visibility_t padico_topo_inet_visibility (in_addr_t _inaddr)
 
padico_topo_addr_visibility_t padico_topo_inet6_visibility (const struct in6_addr *in6addr)
 
void padico_sockaddr_init (struct sockaddr_pa *addr, socklen_t *addrlen, int magic)
 
int padico_sockaddr_check (const struct sockaddr_pa *addr, int magic)
 
padico_string_t padico_vaddr_marshall (const struct padico_vaddr_s *)
 
padico_vaddr_t padico_vaddr_unmarshall (const char *)
 
static padico_vaddr_t padico_vaddr_new (struct sockaddr *addr, socklen_t addrlen, int proto)
 
static void padico_vaddr_delete (padico_vaddr_t vaddr)
 

Variables

static const struct puk_mod_dep_cell_s puk_mod_dep_Topology = { .mod_name = "Topology", .link = & puk_mod_dep_0 }
 
typdef struct padico_topo_node_vect_s * padico_topo_node_vect_t
 
typdef struct padico_topo_network_vect_s * padico_topo_network_vect_t
 
typdef struct padico_topo_host_vect_s * padico_topo_host_vect_t
 
typdef struct padico_topo_binding_vect_s * padico_topo_binding_vect_t
 

Detailed Description

Topology description API.

Definition in file Topology.h.

Macro Definition Documentation

◆ PADICO_LAST_MODULE_NAME

#define PADICO_LAST_MODULE_NAME   Topology

Definition at line 45 of file Topology.h.

Variable Documentation

◆ puk_mod_dep_Topology

const struct puk_mod_dep_cell_s puk_mod_dep_Topology = { .mod_name = "Topology", .link = & puk_mod_dep_0 }
static

Definition at line 43 of file Topology.h.