PadicoTM

Documentation

« back to PM2 home.

internal definitions for module Topology More...

#include <Padico/Puk.h>
#include <Padico/PadicoTM.h>
#include "Topology.h"
#include <netdb.h>
#include <linux/if.h>
#include <net/if_arp.h>
Include dependency graph for Topology-internals.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  topo_uuid_s
 Node UUID, in plain text (hex encoding) More...
 
struct  topo_address_s
 a network address used in bindings More...
 
struct  topo_service_s
 a service which running on a host More...
 
struct  topo_filter_s
 a filter rule, i.e a port number, and a policy More...
 
struct  topo_perf_s
 performance information about link, i.e estimated latency and bandwidth
More...
 
struct  topo_net_entity_s
 an entity that can be member of a network through a binding More...
 
struct  topo_property_s
 
struct  topo_binding_s
 a binding of an entity with a network (protocol level) More...
 
struct  topo_hostname_s
 
struct  topo_host_s
 a host, i.e. More...
 
struct  topo_node_s
 a node, i.e. More...
 
struct  topo_hwaddr_s
 a hardware address- identifies a host
More...
 
struct  na_network_type_s
 
struct  topo_network_s
 a network, containing entities with bindings More...
 
struct  topo_node_by_uuid_hash_entry_s
 stores an entry in the hashtable More...
 
struct  topo_node_by_uuid_hash_entry_block_lfstack_cell_s
 
struct  topo_node_by_uuid_hash_entry_block_lfstack_s
 
struct  topo_node_by_uuid_hash_entry_slice_lfstack_cell_s
 
struct  topo_node_by_uuid_hash_entry_slice_lfstack_s
 
struct  topo_node_by_uuid_hash_entry_allocator_s
 
struct  topo_node_by_uuid_hashtable_s
 
struct  topo_node_by_uuid_hashtable_enumerator_s
 
struct  topo_node_by_name_hash_entry_s
 stores an entry in the hashtable More...
 
struct  topo_node_by_name_hash_entry_block_lfstack_cell_s
 
struct  topo_node_by_name_hash_entry_block_lfstack_s
 
struct  topo_node_by_name_hash_entry_slice_lfstack_cell_s
 
struct  topo_node_by_name_hash_entry_slice_lfstack_s
 
struct  topo_node_by_name_hash_entry_allocator_s
 
struct  topo_node_by_name_hashtable_s
 
struct  topo_node_by_name_hashtable_enumerator_s
 
struct  topo_host_by_name_hash_entry_s
 stores an entry in the hashtable More...
 
struct  topo_host_by_name_hash_entry_block_lfstack_cell_s
 
struct  topo_host_by_name_hash_entry_block_lfstack_s
 
struct  topo_host_by_name_hash_entry_slice_lfstack_cell_s
 
struct  topo_host_by_name_hash_entry_slice_lfstack_s
 
struct  topo_host_by_name_hash_entry_allocator_s
 
struct  topo_host_by_name_hashtable_s
 
struct  topo_host_by_name_hashtable_enumerator_s
 
struct  padico_topology_s
 Shared structure to describes the "known world". More...
 

Macros

#define TOPO_HWADDR_PADDING   16
 storage size for hardware address- sockaddr_ll has 8 bytes
 
#define TOPO_HWADDR_NAMSIZ   16
 

Typedefs

typedef struct topo_net_entity_s topo_net_entity_t
 
typedef uint32_t(* topo_node_by_uuid_hash_hfunc_t) (const struct topo_uuid_s *key)
 
typedef int(* topo_node_by_uuid_hash_eqfunc_t) (const struct topo_uuid_s *key1, const struct topo_uuid_s *key2)
 
typedef void(* topo_node_by_uuid_hash_destructor_t) (const struct topo_uuid_s *key, padico_topo_node_t data)
 
typedef struct topo_node_by_uuid_hash_entry_block_lfstack_s topo_node_by_uuid_hash_entry_block_lfstack_t
 
typedef struct topo_node_by_uuid_hash_entry_slice_lfstack_s topo_node_by_uuid_hash_entry_slice_lfstack_t
 
typedef struct topo_node_by_uuid_hash_entry_allocator_s * topo_node_by_uuid_hash_entry_allocator_t
 
typedef struct topo_node_by_uuid_hashtable_s * topo_node_by_uuid_hashtable_t
 
typedef struct topo_node_by_uuid_hashtable_enumerator_s * topo_node_by_uuid_hashtable_enumerator_t
 
typedef uint32_t(* topo_node_by_name_hash_hfunc_t) (const char *key)
 
typedef int(* topo_node_by_name_hash_eqfunc_t) (const char *key1, const char *key2)
 
typedef void(* topo_node_by_name_hash_destructor_t) (const char *key, padico_topo_node_t data)
 
typedef struct topo_node_by_name_hash_entry_block_lfstack_s topo_node_by_name_hash_entry_block_lfstack_t
 
typedef struct topo_node_by_name_hash_entry_slice_lfstack_s topo_node_by_name_hash_entry_slice_lfstack_t
 
typedef struct topo_node_by_name_hash_entry_allocator_s * topo_node_by_name_hash_entry_allocator_t
 
typedef struct topo_node_by_name_hashtable_s * topo_node_by_name_hashtable_t
 
typedef struct topo_node_by_name_hashtable_enumerator_s * topo_node_by_name_hashtable_enumerator_t
 
typedef uint32_t(* topo_host_by_name_hash_hfunc_t) (const char *key)
 
typedef int(* topo_host_by_name_hash_eqfunc_t) (const char *key1, const char *key2)
 
typedef void(* topo_host_by_name_hash_destructor_t) (const char *key, padico_topo_host_t data)
 
typedef struct topo_host_by_name_hash_entry_block_lfstack_s topo_host_by_name_hash_entry_block_lfstack_t
 
typedef struct topo_host_by_name_hash_entry_slice_lfstack_s topo_host_by_name_hash_entry_slice_lfstack_t
 
typedef struct topo_host_by_name_hash_entry_allocator_s * topo_host_by_name_hash_entry_allocator_t
 
typedef struct topo_host_by_name_hashtable_s * topo_host_by_name_hashtable_t
 
typedef struct topo_host_by_name_hashtable_enumerator_s * topo_host_by_name_hashtable_enumerator_t
 

Enumerations

enum  topo_property_kind_t {
  TOPO_PROPERTY_ADDR , TOPO_PROPERTY_HWADDR , TOPO_PROPERTY_HOSTNAME , TOPO_PROPERTY_FILTER ,
  TOPO_PROPERTY_PERF , TOPO_PROPERTY_GW_ADDR , TOPO_PROPERTY_GW_HWADDR , TOPO_PROPERTY_GW_HOST ,
  TOPO_PROPERTY_SERVICE , TOPO_PROPERTY_ROUTE , TOPO_PROPERTY_INDEX , TOPO_PROPERTY_MISC
}
 

Functions

static int topo_uuid_eq (const struct topo_uuid_s *uuid1, const struct topo_uuid_s *uuid2)
 
static uint32_t topo_uuid_hash (const struct topo_uuid_s *uuid)
 
struct topo_node_by_uuid_hash_entry_block_lfstack_cell_s __attribute__ ((aligned(16)))
 
 __attribute__ ((unused)) static inline void topo_node_by_uuid_hash_entry_allocator_init_thread(struct topo_node_by_uuid_hash_entry_allocator_s *a
 explicit thread level
 
 if (!single) pthread_spin_unlock(&_stack -> _lock)
 
 if (_cell !=NULL)
 
 assert (slab_size > 0)
 
 topo_node_by_uuid_hash_entry_allocator_init_thread (a, slab_size,(1))
 
 if (block !=NULL) rblocks++
 
 while (block !=NULL)
 
 if (slice !=NULL)
 
 padico_free_func (slice, puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__))
 
 while (slice !=NULL)
 
 if (check &&(rblocks !=allocated_blocks)) do
 
 while (0)
 
 __attribute__ ((unused, nonnull)) static inline void topo_node_by_uuid_hashtable_init(topo_node_by_uuid_hashtable_t h)
 initialize a new hashtable
 
 assert (cell !=NULL)
 
puk_allocator_cell_clear & cell (struct topo_node_by_uuid_hash_entry_s)
 
static struct topo_node_by_uuid_hash_entry_s * topo_node_by_uuid_hash_entry_lookup (topo_node_by_uuid_hashtable_t h, const const struct topo_uuid_s *key)
 
static void topo_node_by_uuid_hash_entry_insert (topo_node_by_uuid_hashtable_t h, const struct topo_uuid_s *key, padico_topo_node_t data)
 
static int topo_node_by_uuid_hash_entry_oldprobe (topo_node_by_uuid_hashtable_t h, const const struct topo_uuid_s *key)
 
static void topo_node_by_uuid_hash_entry_rehash_row (topo_node_by_uuid_hashtable_t h, ssize_t z)
 
static void topo_node_by_uuid_hash_entry_rehash_n (topo_node_by_uuid_hashtable_t h, ssize_t n)
 
static void topo_node_by_uuid_hash_entry_rehash_flush (topo_node_by_uuid_hashtable_t h)
 
 if (source->key !=((const struct topo_uuid_s *) 0))
 
 __attribute__ ((unused, nonnull(1))) static inline void topo_node_by_uuid_hashtable_insert(topo_node_by_uuid_hashtable_t h
 insert an entry into a hashtable
 
 assert (key !=((const struct topo_uuid_s *) 0))
 
 if (e)
 
 return (e !=NULL)
 
 if (e !=NULL)
 
 if (data) *data
 
 if (h->table==NULL) return
 
 while (e &&(e->key !=((const struct topo_uuid_s *) 0)))
 
 while (topo_node_by_uuid_hash_entry_oldprobe(h, key))
 
 topo_node_by_uuid_hash_entry_rehash_flush (h)
 
 assert (e->h !=NULL)
 
 assert (e->h->oldtable==NULL)
 
 if (e->current &&e->current->next)
 
 if (e->i< e->h->size)
 
 topo_node_by_uuid_hashtable_remove (h, *key)
 
 topo_node_by_name_hash_entry_allocator_init_thread (a, slab_size,(1))
 
puk_allocator_cell_clear & cell (struct topo_node_by_name_hash_entry_s)
 
static struct topo_node_by_name_hash_entry_s * topo_node_by_name_hash_entry_lookup (topo_node_by_name_hashtable_t h, const const char *key)
 
static void topo_node_by_name_hash_entry_insert (topo_node_by_name_hashtable_t h, const char *key, padico_topo_node_t data)
 
static int topo_node_by_name_hash_entry_oldprobe (topo_node_by_name_hashtable_t h, const const char *key)
 
static void topo_node_by_name_hash_entry_rehash_row (topo_node_by_name_hashtable_t h, ssize_t z)
 
static void topo_node_by_name_hash_entry_rehash_n (topo_node_by_name_hashtable_t h, ssize_t n)
 
static void topo_node_by_name_hash_entry_rehash_flush (topo_node_by_name_hashtable_t h)
 
 while (e &&(e->key !=((const char *) 0)))
 
 while (topo_node_by_name_hash_entry_oldprobe(h, key))
 
 topo_node_by_name_hash_entry_rehash_flush (h)
 
 topo_node_by_name_hashtable_remove (h, *key)
 
 topo_host_by_name_hash_entry_allocator_init_thread (a, slab_size,(1))
 
puk_allocator_cell_clear & cell (struct topo_host_by_name_hash_entry_s)
 
static struct topo_host_by_name_hash_entry_s * topo_host_by_name_hash_entry_lookup (topo_host_by_name_hashtable_t h, const const char *key)
 
static void topo_host_by_name_hash_entry_insert (topo_host_by_name_hashtable_t h, const char *key, padico_topo_host_t data)
 
static int topo_host_by_name_hash_entry_oldprobe (topo_host_by_name_hashtable_t h, const const char *key)
 
static void topo_host_by_name_hash_entry_rehash_row (topo_host_by_name_hashtable_t h, ssize_t z)
 
static void topo_host_by_name_hash_entry_rehash_n (topo_host_by_name_hashtable_t h, ssize_t n)
 
static void topo_host_by_name_hash_entry_rehash_flush (topo_host_by_name_hashtable_t h)
 
 while (topo_host_by_name_hash_entry_oldprobe(h, key))
 
 topo_host_by_name_hash_entry_rehash_flush (h)
 
 topo_host_by_name_hashtable_remove (h, *key)
 
 __attribute__ ((visibility("internal"))) void topo_binding_bind_node(padico_topo_binding_t *_binding
 add a binding to a node; take ownership of binding
 
static padico_topo_hwaddr_t topo_hwaddr_getbyname (padico_topo_host_t host, const char *name)
 
static padico_topo_hwaddr_t topo_hwaddr_getbyindex (padico_topo_host_t host, int index)
 
static padico_topo_filter_policy_t topo_filter_policy_getbyname (const char *name)
 
static const char * topo_filter_policy_getname (padico_topo_filter_policy_t policy)
 
static int topo_filter_protocol_getnumber (const char *proto_name)
 frontend for getprotobyname(), working even in the absence of /etc/protocols
 
static const char * topo_filter_protocol_getname (int protocol)
 frontend for getprotobynumber(), working even in the absence of /etc/protocols
 
static const struct in_addr * topo_address_as_inaddr (padico_topo_address_t addr)
 
static padico_topo_binding_t topo_binding_create (padico_topo_network_t network)
 

Variables

typdef struct topo_hwaddr_vect_s * topo_hwaddr_vect_t
 
typdef struct topo_property_vect_s * topo_property_vect_t
 
typdef struct topo_hostname_vect_s * topo_hostname_vect_t
 
struct topo_node_by_uuid_hash_entry_block_lfstack_cell_s * _next = _stack->_head
 
struct topo_node_by_uuid_hash_entry_block_lfstack_s __attribute__
 
struct topo_node_by_uuid_hash_entry_block_lfstack_cell_s * _cell { topo_node_by_uuid_hash_entry_block_lfstack_push_ext(_stack, _cell, 0)
 
struct topo_node_by_uuid_hash_entry_block_lfstack_cell_s int single { if(!single) pthread_spin_lock(&_stack->_lock)
 
_stack _head = _cell
 
struct topo_node_by_uuid_hash_entry_block_lfstack_cell_s block [] = NULL
 
ssize_t slab_size = slab_size
 
topo_node_by_uuid_hash_entry_slice_lfstack_init & a
 
a new_slab = 0
 
 void
 
int check { int rblocks = 0
 
 do { block = topo_node_by_uuid_hash_entry_block_lfstack_pop_ext(&a->blocks, a->single)
 
int allocated_blocks = 0
 
struct topo_node_by_uuid_hash_entry_slice_lfstack_cell_s * slice = NULL
 
struct topo_node_by_uuid_hash_entry_s * b { struct topo_node_by_uuid_hash_entry_block_lfstack_cell_s*cell = (( struct topo_node_by_uuid_hash_entry_block_lfstack_cell_s *)((char*)(__typeof__ (&(( struct topo_node_by_uuid_hash_entry_block_lfstack_cell_s *)0)-> block ))( b )- ((size_t) &(( struct topo_node_by_uuid_hash_entry_block_lfstack_cell_s *)0)-> block )))
 
const const struct topo_uuid_s * key { if(h->oldtable) { const uint32_t z = (*( &topo_uuid_hash ))(key); const ssize_t index = puk_hash_to_index(z, h->oldsize); struct topo_node_by_uuid_hash_entry_s*e = h->oldtable + index; while(e && (e->key != (( const struct topo_uuid_s* )0) )) { if((*( &topo_uuid_eq ))(key, e->key)) { topo_node_by_uuid_hash_entry_rehash_row(h, index); topo_node_by_uuid_hash_entry_rehash_n(h, 16 ); return 1; } e = e->next; } } return 0
 
ssize_t z { assert(h->oldtable != NULL)
 
struct topo_node_by_uuid_hash_entry_s * source = h->oldtable + z
 
ssize_t n { if(h->oldtable) { ssize_t k; for(k = 0; k < n; k++) { topo_node_by_uuid_hash_entry_rehash_row(h, h->rehashed + k); if(h->rehashed + k == h->oldsize - 1) { (padico_free_func( h->oldtable , puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)); h->oldtable = NULL; h->rehashed = 0; return; } } h->rehashed += k; } } __attribute__((unused)) static inline void topo_node_by_uuid_hash_entry_insert( topo_node_by_uuid_hashtable_t h, const struct topo_uuid_s* key, padico_topo_node_t data) { const uint32_t z = (*( &topo_uuid_hash ))(key); assert(h->table != NULL); struct topo_node_by_uuid_hash_entry_s*e = h->table + puk_hash_to_index(z, h->size); if(e->key != (( const struct topo_uuid_s* )0) ) { while(e->next) { e = e->next; } e->next = topo_node_by_uuid_hash_entry_malloc(&h->entry_allocator); assert(e->next != NULL); e = e->next; } e->key = key; e->data = data; e->next = NULL; } __attribute__((unused)) static inline struct topo_node_by_uuid_hash_entry_s* topo_node_by_uuid_hash_entry_lookup( topo_node_by_uuid_hashtable_t h, const const struct topo_uuid_s* key) { if(h->table == NULL) return NULL; const uint32_t z = (*( &topo_uuid_hash ))(key); struct topo_node_by_uuid_hash_entry_s*e = NULL; do { e = h->table + puk_hash_to_index(z, h->size); while(e && (e->key != (( const struct topo_uuid_s* )0) )) { if((*( &topo_uuid_eq ))(key, e->key)) { return e; } e = e->next; } } while( topo_node_by_uuid_hash_entry_oldprobe(h, key)); return NULL; } __attribute__((unused)) static inline void topo_node_by_uuid_hash_entry_rehash_flush( topo_node_by_uuid_hashtable_t h) { if(h->oldtable) { topo_node_by_uuid_hash_entry_rehash_n(h, h->oldsize); } assert(h->oldtable == NULL); } __attribute__((unused)) static void topo_node_by_uuid_hash_rehash_trigger( topo_node_by_uuid_hashtable_t h) { static const ssize_t hash_primes[] = { 11, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, -1 }; assert(hash_primes[0] == 11 ); assert(h->oldtable == NULL); h->oldtable = h->table; h->oldsize = h->size; h->rehashed = 0; int i = 0; while(h->size >= hash_primes[i]) { i++; } h->size = hash_primes[i]; assert(h->size > 0); assert(h->size > h->oldsize); h->table = (struct topo_node_by_uuid_hash_entry_s*)(padico_malloc_func( h->size * sizeof(struct topo_node_by_uuid_hash_entry_s) , puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)); for(i = 0; i < h->size; i++) { h->table[i].key = (( const struct topo_uuid_s* )0) ; h->table[i].data = ( padico_topo_node_t )0; h->table[i].next = NULL; } topo_node_by_uuid_hash_entry_rehash_n(h, 16 ); }
 
const struct topo_uuid_s padico_topo_node_t data { topo_node_by_uuid_hash_entry_rehash_n(h, 16 )
 
struct topo_node_by_uuid_hash_entry_s * e = topo_node_by_uuid_hash_entry_lookup(h, key)
 
 else { if(h->load >= h->size * 3 / 4) { topo_node_by_uuid_hash_rehash_trigger(h); } topo_node_by_uuid_hash_entry_insert(h, key, data)
 
h load
 
const const struct topo_uuid_s const struct topo_uuid_s ** outkey
 
struct topo_node_by_uuid_hash_entry_s * prev = NULL
 
topo_node_by_uuid_hashtable_t h { assert(h != NULL)
 
e i = -1
 
e current = NULL
 
padico_topo_host_t host
 
padico_topo_host_t const char * uuid
 
padico_topo_host_t const char const char * boot_id
 
padico_topo_node_t node
 
padico_topo_binding_t b2
 
static const char * topo_filter_policy_names []
 

Detailed Description

internal definitions for module Topology

Definition in file Topology-internals.h.

Macro Definition Documentation

◆ TOPO_HWADDR_NAMSIZ

#define TOPO_HWADDR_NAMSIZ   16

Definition at line 57 of file Topology-internals.h.

◆ TOPO_HWADDR_PADDING

#define TOPO_HWADDR_PADDING   16

storage size for hardware address- sockaddr_ll has 8 bytes

Definition at line 51 of file Topology-internals.h.

Typedef Documentation

◆ topo_host_by_name_hash_destructor_t

typedef void(* topo_host_by_name_hash_destructor_t) (const char *key, padico_topo_host_t data)

Definition at line 268 of file Topology-internals.h.

◆ topo_host_by_name_hash_entry_allocator_t

◆ topo_host_by_name_hash_entry_block_lfstack_t

◆ topo_host_by_name_hash_entry_slice_lfstack_t

◆ topo_host_by_name_hash_eqfunc_t

typedef int(* topo_host_by_name_hash_eqfunc_t) (const char *key1, const char *key2)

Definition at line 268 of file Topology-internals.h.

◆ topo_host_by_name_hash_hfunc_t

typedef uint32_t(* topo_host_by_name_hash_hfunc_t) (const char *key)

Definition at line 268 of file Topology-internals.h.

◆ topo_host_by_name_hashtable_enumerator_t

◆ topo_host_by_name_hashtable_t

◆ topo_net_entity_t

◆ topo_node_by_name_hash_destructor_t

typedef void(* topo_node_by_name_hash_destructor_t) (const char *key, padico_topo_node_t data)

Definition at line 265 of file Topology-internals.h.

◆ topo_node_by_name_hash_entry_allocator_t

◆ topo_node_by_name_hash_entry_block_lfstack_t

◆ topo_node_by_name_hash_entry_slice_lfstack_t

◆ topo_node_by_name_hash_eqfunc_t

typedef int(* topo_node_by_name_hash_eqfunc_t) (const char *key1, const char *key2)

Definition at line 265 of file Topology-internals.h.

◆ topo_node_by_name_hash_hfunc_t

typedef uint32_t(* topo_node_by_name_hash_hfunc_t) (const char *key)

Definition at line 265 of file Topology-internals.h.

◆ topo_node_by_name_hashtable_enumerator_t

◆ topo_node_by_name_hashtable_t

◆ topo_node_by_uuid_hash_destructor_t

typedef void(* topo_node_by_uuid_hash_destructor_t) (const struct topo_uuid_s *key, padico_topo_node_t data)

Definition at line 262 of file Topology-internals.h.

◆ topo_node_by_uuid_hash_entry_allocator_t

◆ topo_node_by_uuid_hash_entry_block_lfstack_t

◆ topo_node_by_uuid_hash_entry_slice_lfstack_t

◆ topo_node_by_uuid_hash_eqfunc_t

typedef int(* topo_node_by_uuid_hash_eqfunc_t) (const struct topo_uuid_s *key1, const struct topo_uuid_s *key2)

Definition at line 262 of file Topology-internals.h.

◆ topo_node_by_uuid_hash_hfunc_t

typedef uint32_t(* topo_node_by_uuid_hash_hfunc_t) (const struct topo_uuid_s *key)

Definition at line 262 of file Topology-internals.h.

◆ topo_node_by_uuid_hashtable_enumerator_t

◆ topo_node_by_uuid_hashtable_t

Enumeration Type Documentation

◆ topo_property_kind_t

Enumerator
TOPO_PROPERTY_ADDR 

protocol address for the binding

TOPO_PROPERTY_HWADDR 

hardware address/iface

TOPO_PROPERTY_HOSTNAME 

name of the host on the network

TOPO_PROPERTY_FILTER 

filtering- TODO

TOPO_PROPERTY_PERF 

performance properties- TODO

TOPO_PROPERTY_GW_ADDR 

IPv4 address of the gateway.

TOPO_PROPERTY_GW_HWADDR 

hardware address of the gateway

TOPO_PROPERTY_GW_HOST 

gateway as a host

TOPO_PROPERTY_SERVICE 

service which run on a host

TOPO_PROPERTY_ROUTE 

describe a route between private networks

TOPO_PROPERTY_INDEX 

index of the board or port number

TOPO_PROPERTY_MISC 

arbitrary attribute (string), without semantics

Definition at line 117 of file Topology-internals.h.

Function Documentation

◆ __attribute__() [1/4]

◆ __attribute__() [2/4]

__attribute__ ( (unused, nonnull(1))  )

insert an entry into a hashtable

returns <key,value> associated with given key, outkey is set to NULL if key not found

probes whether an entry with given key exists in the hashtable

returns value associated with key, NULL if not found

◆ __attribute__() [3/4]

__attribute__ ( (unused, nonnull)  )

initialize a new hashtable

deallocate a hashtable

destroy a hashtable

Definition at line 262 of file Topology-internals.h.

◆ __attribute__() [4/4]

__attribute__ ( (visibility("internal"))  )

add a binding to a node; take ownership of binding

Init the parser.

Definition at line 37 of file ns-basic-common.c.

◆ assert() [1/5]

assert ( cell !  = NULL)

◆ assert() [2/5]

assert ( e->h !  = NULL)

◆ assert() [3/5]

assert ( e->h->  oldtable = =NULL)

◆ assert() [4/5]

assert ( key !  = ((const struct topo_uuid_s *) 0))

◆ assert() [5/5]

assert ( slab_size  ,
0   
)

Referenced by topo_address_as_inaddr().

◆ cell() [1/3]

◆ cell() [2/3]

◆ cell() [3/3]

◆ if() [1/12]

if ( !  single) & -> _lock)

◆ if() [2/12]

if ( _cell !  = NULL)

Definition at line 262 of file Topology-internals.h.

◆ if() [3/12]

if ( block !  = NULL)

◆ if() [4/12]

if ( check &&  rblocks !=allocated_blocks)

Definition at line 262 of file Topology-internals.h.

◆ if() [5/12]

if ( data  )

◆ if() [6/12]

if ( e !  = NULL)

Definition at line 262 of file Topology-internals.h.

◆ if() [7/12]

if ( e  )

Definition at line 262 of file Topology-internals.h.

◆ if() [8/12]

if ( e->current &&e->current->  next)

Definition at line 262 of file Topology-internals.h.

◆ if() [9/12]

if ( e->i< e->h->  size)

Definition at line 262 of file Topology-internals.h.

◆ if() [10/12]

if ( h->  table = =NULL)

◆ if() [11/12]

if ( slice !  = NULL)

Definition at line 262 of file Topology-internals.h.

◆ if() [12/12]

if ( source->key !  = (( const struct topo_uuid_s* )0))

Definition at line 262 of file Topology-internals.h.

◆ padico_free_func()

padico_free_func ( slice  ,
puk_mod_binary_get_profile()  ,
padico_module_self_name()  ,
__func__  ,
__FILE__  ,
__LINE__   
)

◆ return()

return ( e !  = NULL)

◆ topo_address_as_inaddr()

static const struct in_addr * topo_address_as_inaddr ( padico_topo_address_t  addr)
inlinestatic

◆ topo_binding_create()

◆ topo_filter_policy_getbyname()

static padico_topo_filter_policy_t topo_filter_policy_getbyname ( const char *  name)
inlinestatic

◆ topo_filter_policy_getname()

static const char * topo_filter_policy_getname ( padico_topo_filter_policy_t  policy)
inlinestatic

◆ topo_filter_protocol_getname()

static const char * topo_filter_protocol_getname ( int  protocol)
inlinestatic

frontend for getprotobynumber(), working even in the absence of /etc/protocols

Definition at line 387 of file Topology-internals.h.

References done, and p.

Referenced by topo_binding_serialize().

◆ topo_filter_protocol_getnumber()

static int topo_filter_protocol_getnumber ( const char *  proto_name)
inlinestatic

frontend for getprotobyname(), working even in the absence of /etc/protocols

Definition at line 367 of file Topology-internals.h.

References done, and p.

Referenced by topo_property_end_handler().

◆ topo_host_by_name_hash_entry_allocator_init_thread()

topo_host_by_name_hash_entry_allocator_init_thread ( a  ,
slab_size  ,
(1)   
)

◆ topo_host_by_name_hash_entry_insert()

static void topo_host_by_name_hash_entry_insert ( topo_host_by_name_hashtable_t  h,
const char *  key,
padico_topo_host_t  data 
)
inlinestatic

◆ topo_host_by_name_hash_entry_lookup()

static struct topo_host_by_name_hash_entry_s * topo_host_by_name_hash_entry_lookup ( topo_host_by_name_hashtable_t  h,
const const char *  key 
)
inlinestatic

◆ topo_host_by_name_hash_entry_oldprobe()

static int topo_host_by_name_hash_entry_oldprobe ( topo_host_by_name_hashtable_t  h,
const const char *  key 
)
inlinestatic

◆ topo_host_by_name_hash_entry_rehash_flush() [1/2]

topo_host_by_name_hash_entry_rehash_flush ( h  )

◆ topo_host_by_name_hash_entry_rehash_flush() [2/2]

static void topo_host_by_name_hash_entry_rehash_flush ( topo_host_by_name_hashtable_t  h)
inlinestatic

◆ topo_host_by_name_hash_entry_rehash_n()

static void topo_host_by_name_hash_entry_rehash_n ( topo_host_by_name_hashtable_t  h,
ssize_t  n 
)
inlinestatic

◆ topo_host_by_name_hash_entry_rehash_row()

static void topo_host_by_name_hash_entry_rehash_row ( topo_host_by_name_hashtable_t  h,
ssize_t  z 
)
inlinestatic

◆ topo_host_by_name_hashtable_remove()

topo_host_by_name_hashtable_remove ( h  ,
*  key 
)

◆ topo_hwaddr_getbyindex()

static padico_topo_hwaddr_t topo_hwaddr_getbyindex ( padico_topo_host_t  host,
int  index 
)
inlinestatic

Definition at line 320 of file Topology-internals.h.

References done, host, topo_host_s::hwaddrs, i, and NULL.

Referenced by topo_inet_route_detect().

◆ topo_hwaddr_getbyname()

static padico_topo_hwaddr_t topo_hwaddr_getbyname ( padico_topo_host_t  host,
const char *  name 
)
inlinestatic

◆ topo_node_by_name_hash_entry_allocator_init_thread()

topo_node_by_name_hash_entry_allocator_init_thread ( a  ,
slab_size  ,
(1)   
)

◆ topo_node_by_name_hash_entry_insert()

static void topo_node_by_name_hash_entry_insert ( topo_node_by_name_hashtable_t  h,
const char *  key,
padico_topo_node_t  data 
)
inlinestatic

◆ topo_node_by_name_hash_entry_lookup()

static struct topo_node_by_name_hash_entry_s * topo_node_by_name_hash_entry_lookup ( topo_node_by_name_hashtable_t  h,
const const char *  key 
)
inlinestatic

◆ topo_node_by_name_hash_entry_oldprobe()

static int topo_node_by_name_hash_entry_oldprobe ( topo_node_by_name_hashtable_t  h,
const const char *  key 
)
inlinestatic

◆ topo_node_by_name_hash_entry_rehash_flush() [1/2]

topo_node_by_name_hash_entry_rehash_flush ( h  )

◆ topo_node_by_name_hash_entry_rehash_flush() [2/2]

static void topo_node_by_name_hash_entry_rehash_flush ( topo_node_by_name_hashtable_t  h)
inlinestatic

◆ topo_node_by_name_hash_entry_rehash_n()

static void topo_node_by_name_hash_entry_rehash_n ( topo_node_by_name_hashtable_t  h,
ssize_t  n 
)
inlinestatic

◆ topo_node_by_name_hash_entry_rehash_row()

static void topo_node_by_name_hash_entry_rehash_row ( topo_node_by_name_hashtable_t  h,
ssize_t  z 
)
inlinestatic

◆ topo_node_by_name_hashtable_remove()

topo_node_by_name_hashtable_remove ( h  ,
*  key 
)

◆ topo_node_by_uuid_hash_entry_allocator_init_thread()

topo_node_by_uuid_hash_entry_allocator_init_thread ( a  ,
slab_size  ,
(1)   
)

◆ topo_node_by_uuid_hash_entry_insert()

static void topo_node_by_uuid_hash_entry_insert ( topo_node_by_uuid_hashtable_t  h,
const struct topo_uuid_s *  key,
padico_topo_node_t  data 
)
inlinestatic

◆ topo_node_by_uuid_hash_entry_lookup()

static struct topo_node_by_uuid_hash_entry_s * topo_node_by_uuid_hash_entry_lookup ( topo_node_by_uuid_hashtable_t  h,
const const struct topo_uuid_s *  key 
)
inlinestatic

◆ topo_node_by_uuid_hash_entry_oldprobe()

static int topo_node_by_uuid_hash_entry_oldprobe ( topo_node_by_uuid_hashtable_t  h,
const const struct topo_uuid_s *  key 
)
inlinestatic

◆ topo_node_by_uuid_hash_entry_rehash_flush() [1/2]

topo_node_by_uuid_hash_entry_rehash_flush ( h  )

◆ topo_node_by_uuid_hash_entry_rehash_flush() [2/2]

static void topo_node_by_uuid_hash_entry_rehash_flush ( topo_node_by_uuid_hashtable_t  h)
inlinestatic

◆ topo_node_by_uuid_hash_entry_rehash_n()

static void topo_node_by_uuid_hash_entry_rehash_n ( topo_node_by_uuid_hashtable_t  h,
ssize_t  n 
)
inlinestatic

◆ topo_node_by_uuid_hash_entry_rehash_row()

static void topo_node_by_uuid_hash_entry_rehash_row ( topo_node_by_uuid_hashtable_t  h,
ssize_t  z 
)
inlinestatic

◆ topo_node_by_uuid_hashtable_remove()

topo_node_by_uuid_hashtable_remove ( h  ,
*  key 
)

◆ topo_uuid_eq()

static int topo_uuid_eq ( const struct topo_uuid_s *  uuid1,
const struct topo_uuid_s *  uuid2 
)
inlinestatic

Definition at line 252 of file Topology-internals.h.

References done, and PADICO_TOPO_UUID_SIZE.

◆ topo_uuid_hash()

static uint32_t topo_uuid_hash ( const struct topo_uuid_s *  uuid)
inlinestatic

Definition at line 256 of file Topology-internals.h.

References done, PADICO_TOPO_UUID_SIZE, and uuid.

◆ while() [1/8]

while ( 0  )

◆ while() [2/8]

while ( block !  = NULL)

◆ while() [3/8]

while ( e &&  e->key !=((const char *) 0))

Definition at line 265 of file Topology-internals.h.

◆ while() [4/8]

while ( e &&  e->key !=((const struct topo_uuid_s *) 0))

Definition at line 262 of file Topology-internals.h.

◆ while() [5/8]

while ( slice !  = NULL)

◆ while() [6/8]

◆ while() [7/8]

◆ while() [8/8]

Variable Documentation

◆ __attribute__

◆ _cell

◆ _head

_stack _head = _cell

Definition at line 262 of file Topology-internals.h.

◆ _next

_cell _next = _stack->_head

Definition at line 262 of file Topology-internals.h.

◆ a

◆ allocated_blocks

int allocated_blocks = 0

Definition at line 262 of file Topology-internals.h.

◆ b

◆ b2

◆ block

◆ boot_id

◆ check

int check { int rblocks = 0

Definition at line 262 of file Topology-internals.h.

◆ current

e current = NULL

Definition at line 262 of file Topology-internals.h.

◆ data

◆ do

◆ e

◆ else

◆ h

e h { assert(h != NULL)

Definition at line 262 of file Topology-internals.h.

◆ host

Definition at line 294 of file Topology-internals.h.

Referenced by __attribute__(), control_bootstrap_init(), g5k_compute_networks(), g5k_compute_nodes(), ns_basic_assembly_host(), ns_basic_host_assembly(), ns_basic_host_start_handler(), ns_besteffort_getnetworks(), ns_besteffort_selector_2networks(), ns_besteffort_selector_host(), ns_node_in_entity(), nsbe_dijkstra_vertex_add(), nsdb_create_host(), padico_control_connector_connect(), padico_control_connector_new(), padico_na_topology_serialize(), padico_ns_host_selector(), padico_nsbe_rule_resolve(), padico_topo_gethosts(), padico_topo_getnodebyname(), padico_topo_host_add_name(), padico_topo_host_add_property(), padico_topo_host_add_service(), padico_topo_host_bind(), padico_topo_host_can_input(), padico_topo_host_can_output(), padico_topo_host_create(), padico_topo_host_getaddr(), padico_topo_host_getaddr2(), padico_topo_host_getbindings(), padico_topo_host_getbyin6addr(), padico_topo_host_getbyinaddr(), padico_topo_host_getname(), padico_topo_host_getname2(), padico_topo_host_getnetworks(), padico_topo_host_getnode(), padico_topo_host_getnodes(), padico_topo_host_getproperty(), padico_topo_host_getservice(), padico_topo_host_policy(), padico_topo_host_resolve_byin6addr(), padico_topo_host_resolve_byinaddr(), padico_topo_host_resolvebyname(), padico_topo_host_serialize(), padico_topo_hwaddr_add(), padico_topo_network_contains_host(), padico_topology_finalize(), router_update_end_handler(), secondary_connector_connect(), sfsnc_connect(), sfssh2_connect(), ssh2_control_bootstrap_connect(), sysio_control_bootstrap_connect(), topo_binding_bind_host(), topo_host_destroy(), topo_host_end_handler(), topo_host_from_hostent(), topo_host_lookup(), topo_host_start_handler(), topo_hwaddr_getbyindex(), topo_hwaddr_getbyname(), topo_node_create(), topo_node_start_handler(), vlink_resolver_resolve_host(), and vlink_resolver_resolve_node().

◆ i

◆ key

const char* * key { if(h->oldtable) { const uint32_t z = (*( &topo_uuid_hash ))(key); const ssize_t index = puk_hash_to_index(z, h->oldsize); struct topo_node_by_uuid_hash_entry_s*e = h->oldtable + index; while(e && (e->key != (( const struct topo_uuid_s* )0) )) { if((*( &topo_uuid_eq ))(key, e->key)) { topo_node_by_uuid_hash_entry_rehash_row(h, index); topo_node_by_uuid_hash_entry_rehash_n(h, 16 ); return 1; } e = e->next; } } return 0

Definition at line 262 of file Topology-internals.h.

◆ load

h load

Definition at line 262 of file Topology-internals.h.

◆ n

ssize_t n { if(h->oldtable) { ssize_t k; for(k = 0; k < n; k++) { topo_node_by_uuid_hash_entry_rehash_row(h, h->rehashed + k); if(h->rehashed + k == h->oldsize - 1) { (padico_free_func( h->oldtable , puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)); h->oldtable = NULL; h->rehashed = 0; return; } } h->rehashed += k; } } __attribute__((unused)) static inline void topo_node_by_uuid_hash_entry_insert( topo_node_by_uuid_hashtable_t h, const struct topo_uuid_s* key, padico_topo_node_t data) { const uint32_t z = (*( &topo_uuid_hash ))(key); assert(h->table != NULL); struct topo_node_by_uuid_hash_entry_s*e = h->table + puk_hash_to_index(z, h->size); if(e->key != (( const struct topo_uuid_s* )0) ) { while(e->next) { e = e->next; } e->next = topo_node_by_uuid_hash_entry_malloc(&h->entry_allocator); assert(e->next != NULL); e = e->next; } e->key = key; e->data = data; e->next = NULL; } __attribute__((unused)) static inline struct topo_node_by_uuid_hash_entry_s* topo_node_by_uuid_hash_entry_lookup( topo_node_by_uuid_hashtable_t h, const const struct topo_uuid_s* key) { if(h->table == NULL) return NULL; const uint32_t z = (*( &topo_uuid_hash ))(key); struct topo_node_by_uuid_hash_entry_s*e = NULL; do { e = h->table + puk_hash_to_index(z, h->size); while(e && (e->key != (( const struct topo_uuid_s* )0) )) { if((*( &topo_uuid_eq ))(key, e->key)) { return e; } e = e->next; } } while( topo_node_by_uuid_hash_entry_oldprobe(h, key)); return NULL; } __attribute__((unused)) static inline void topo_node_by_uuid_hash_entry_rehash_flush( topo_node_by_uuid_hashtable_t h) { if(h->oldtable) { topo_node_by_uuid_hash_entry_rehash_n(h, h->oldsize); } assert(h->oldtable == NULL); } __attribute__((unused)) static void topo_node_by_uuid_hash_rehash_trigger( topo_node_by_uuid_hashtable_t h) { static const ssize_t hash_primes[] = { 11, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, -1 }; assert(hash_primes[0] == 11 ); assert(h->oldtable == NULL); h->oldtable = h->table; h->oldsize = h->size; h->rehashed = 0; int i = 0; while(h->size >= hash_primes[i]) { i++; } h->size = hash_primes[i]; assert(h->size > 0); assert(h->size > h->oldsize); h->table = (struct topo_node_by_uuid_hash_entry_s*)(padico_malloc_func( h->size * sizeof(struct topo_node_by_uuid_hash_entry_s) , puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)); for(i = 0; i < h->size; i++) { h->table[i].key = (( const struct topo_uuid_s* )0) ; h->table[i].data = ( padico_topo_node_t )0; h->table[i].next = NULL; } topo_node_by_uuid_hash_entry_rehash_n(h, 16 ); }

Definition at line 262 of file Topology-internals.h.

◆ new_slab

a new_slab = 0

Definition at line 262 of file Topology-internals.h.

◆ node

Definition at line 302 of file Topology-internals.h.

◆ outkey

const const char const char* * outkey

Definition at line 262 of file Topology-internals.h.

◆ prev

prev = NULL

Definition at line 262 of file Topology-internals.h.

◆ single

a single { if(!single) pthread_spin_lock(&_stack->_lock)

Definition at line 262 of file Topology-internals.h.

◆ slab_size

a slab_size = slab_size

Definition at line 262 of file Topology-internals.h.

◆ slice

◆ source

struct topo_host_by_name_hash_entry_s* source = h->oldtable + z

Definition at line 262 of file Topology-internals.h.

◆ topo_filter_policy_names

const char* topo_filter_policy_names[]
static
Initial value:
=
{
[PADICO_TOPO_FILTER_BLOCK_IN] = "block-input",
[PADICO_TOPO_FILTER_BLOCK_OUT] = "block-output",
[PADICO_TOPO_FILTER_ALLOW_IN] = "allow-input",
[PADICO_TOPO_FILTER_ALLOW_OUT] = "allow-output",
}
return NULL
Definition Shm.h:88
@ PADICO_TOPO_FILTER_ALLOW_OUT
Definition Topology.h:114
@ _PADICO_TOPO_FILTER_MAX
Definition Topology.h:115
@ PADICO_TOPO_FILTER_BLOCK_OUT
Definition Topology.h:112
@ PADICO_TOPO_FILTER_BLOCK_IN
Definition Topology.h:111
@ PADICO_TOPO_FILTER_ALLOW_IN
Definition Topology.h:113
@ _PADICO_TOPO_FILTER_NONE
Definition Topology.h:110

Definition at line 334 of file Topology-internals.h.

Referenced by topo_filter_policy_getbyname(), and topo_filter_policy_getname().

◆ topo_hostname_vect_t

typdef struct topo_hostname_vect_s* topo_hostname_vect_t

Definition at line 198 of file Topology-internals.h.

◆ topo_hwaddr_vect_t

typdef struct topo_hwaddr_vect_s* topo_hwaddr_vect_t

Definition at line 48 of file Topology-internals.h.

◆ topo_property_vect_t

typdef struct topo_property_vect_s* topo_property_vect_t

Definition at line 183 of file Topology-internals.h.

◆ uuid

◆ void

void

Definition at line 262 of file Topology-internals.h.

◆ z

const uint32_t z { assert(h->oldtable != NULL)

Definition at line 262 of file Topology-internals.h.