The Netsukuku Project  0.0.9
An Alternative routing method
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
gmap.h File Reference
#include "llist.c"
#include "map.h"
Include dependency graph for gmap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  map_gnode
 
struct  quadro_group
 
struct  ext_map_hdr
 
struct  ext_rnode
 
struct  ext_rnode_cache
 

Macros

#define GMAP_ME   MAP_ME /*1*/
 
#define GMAP_VOID   MAP_VOID /*(1<<1)*/
 
#define GMAP_HGNODE
 
#define GMAP_FULL   (1<<3) /*The gnode is full!! aaahh, run away!*/
 
#define MAP_GNODE_PACK_SZ   (MAP_NODE_PACK_SZ+sizeof(u_char)*2+sizeof(int))
 
#define ZERO_LEVEL   1
 
#define UNITY_LEVEL   1
 
#define EXTRA_LEVELS   (ZERO_LEVEL + UNITY_LEVEL)
 
#define _EL(level)   ((level)-1)
 
#define _NL(level)   ((level)+1)
 
#define IPV4_LEVELS   (2+EXTRA_LEVELS)
 
#define IPV6_LEVELS   (14+EXTRA_LEVELS)
 
#define MAX_LEVELS   IPV6_LEVELS
 
#define GET_LEVELS(family)   ({ (family)==AF_INET ? IPV4_LEVELS : IPV6_LEVELS; })
 
#define FAMILY_LVLS   (GET_LEVELS(my_family))
 
#define NODES_PER_LEVEL(lvl)   ((1<<(MAXGROUPNODE_BITS*(lvl))))
 
#define QUADRO_GROUP_PACK_SZ
 
#define QUADG_IPSTART   1
 
#define QUADG_GID   (1<<1)
 
#define QUADG_GNODE   (1<<2)
 
#define EXT_MAP_BLOCK_SZ(ext_map_sz, rblock_sz)   (sizeof(struct ext_map_hdr)+(ext_map_sz)+(rblock_sz))
 

Typedefs

typedef struct ext_rnode_cache ext_rnode_cache
 

Functions

int get_groups (int family, int lvl)
 
int is_group_invalid (int *gids, int gid, int lvl, int family)
 
int pos_from_gnode (map_gnode *gnode, map_gnode *map)
 
map_gnodegnode_from_pos (int pos, map_gnode *map)
 
void rnodetoip (u_int mapstart, u_int maprnode, inet_prefix ipstart, inet_prefix *ret)
 
const char * rnode_to_ipstr (u_int mapstart, u_int maprnode, inet_prefix ipstart)
 
int iptogid (inet_prefix *ip, int level)
 
void iptogids (inet_prefix *ip, int *gid, int levels)
 
void gidtoipstart (int *gid, u_char total_levels, u_char levels, int family, inet_prefix *ip)
 
void iptoquadg (inet_prefix ip, map_gnode **ext_map, quadro_group *qg, char flags)
 
void quadg_setflags (quadro_group *qg, char flags)
 
void quadg_free (quadro_group *qg)
 
void quadg_destroy (quadro_group *qg)
 
void gnode_inc_seeds (quadro_group *qg, int level)
 
void gnode_dec_seeds (quadro_group *qg, int level)
 
void pack_quadro_group (quadro_group *qg, char *pack)
 
void unpack_quadro_group (quadro_group *qg, char *pack)
 
int free_gids (quadro_group *qg, int level, map_gnode **ext_map, map_node *int_map)
 
int void_gids (quadro_group *qg, int level, map_gnode **ext_map, map_node *int_map)
 
int random_ip (inet_prefix *ipstart, int final_level, int final_gid, int total_levels, map_gnode **ext_map, int only_free_gnode, inet_prefix *new_ip, int my_family)
 
void gnodetoip (quadro_group *quadg, int gnodeid, u_char level, inet_prefix *ip)
 
int gids_cmp (int *gids_a, int *gids_b, int lvl, int max_lvl)
 
int quadg_gids_cmp (quadro_group a, quadro_group b, int lvl)
 
int ip_gids_cmp (inet_prefix a, inet_prefix b, int lvl)
 
ext_rnode_cacheerc_find (ext_rnode_cache *erc, ext_rnode *e_rnode)
 
void e_rnode_del (ext_rnode_cache **erc_head, u_int *counter, ext_rnode_cache *erc)
 
void e_rnode_add (ext_rnode_cache **erc, ext_rnode *e_rnode, int rnode_pos, u_int *counter)
 
ext_rnode_cachee_rnode_init (u_int *counter)
 
void e_rnode_free (ext_rnode_cache **erc, u_int *counter)
 
ext_rnode_cachee_rnode_find (ext_rnode_cache *erc, quadro_group *qg, int level)
 
void erc_update_rnodepos (ext_rnode_cache *erc, map_node *root_node, int old_rnode_pos)
 
void erc_reorder_rnodepos (ext_rnode_cache **erc, u_int *erc_counter, map_node *root_node)
 
ext_rnode_cacheerc_find_gnode (ext_rnode_cache *erc, map_gnode *gnode, u_char level)
 
map_gnodeinit_gmap (int groups)
 
void reset_gmap (map_gnode *gmap, int groups)
 
map_gnode ** init_extmap (u_char levels, int groups)
 
void free_extmap (map_gnode **ext_map, u_char levels, int groups)
 
void reset_extmap (map_gnode **ext_map, u_char levels, int groups)
 
int g_rnode_find (map_gnode *gnode, map_gnode *n)
 
int extmap_find_level (map_gnode **ext_map, map_gnode *gnode, u_char max_level)
 
void gmap_node_del (map_gnode *gnode)
 
int merge_ext_maps (map_gnode **base, map_gnode **new, quadro_group base_root, quadro_group new_root)
 
int verify_ext_map_hdr (struct ext_map_hdr *emap_hdr, quadro_group *quadg)
 
void free_extmap_rblock (map_rnode **rblock, u_char levels)
 
void pack_map_gnode (map_gnode *gnode, char *pack)
 
void unpack_map_gnode (map_gnode *gnode, char *pack)
 
char * pack_extmap (map_gnode **ext_map, int maxgroupnode, quadro_group *quadg, size_t *pack_sz)
 
map_gnode ** unpack_extmap (char *package, quadro_group *quadg)
 
int save_extmap (map_gnode **ext_map, int maxgroupnode, quadro_group *quadg, char *file)
 
map_gnode ** load_extmap (char *file, quadro_group *quadg)
 

Variables

static const int_info map_gnode_iinfo
 
static const int_info quadro_group_iinfo
 
struct ext_map_hdr _PACKED_
 
static const int_info ext_map_hdr_iinfo
 

Macro Definition Documentation

#define _EL (   level)    ((level)-1)
#define _NL (   level)    ((level)+1)
#define EXT_MAP_BLOCK_SZ (   ext_map_sz,
  rblock_sz 
)    (sizeof(struct ext_map_hdr)+(ext_map_sz)+(rblock_sz))
#define EXTRA_LEVELS   (ZERO_LEVEL + UNITY_LEVEL)
#define FAMILY_LVLS   (GET_LEVELS(my_family))
#define GET_LEVELS (   family)    ({ (family)==AF_INET ? IPV4_LEVELS : IPV6_LEVELS; })
#define GMAP_FULL   (1<<3) /*The gnode is full!! aaahh, run away!*/
#define GMAP_HGNODE
Value:
(1<<2) /*Hooked Gnode. We already hooked at
this gnode */
#define GMAP_ME   MAP_ME /*1*/
#define GMAP_VOID   MAP_VOID /*(1<<1)*/
#define IPV4_LEVELS   (2+EXTRA_LEVELS)
#define IPV6_LEVELS   (14+EXTRA_LEVELS)
#define MAP_GNODE_PACK_SZ   (MAP_NODE_PACK_SZ+sizeof(u_char)*2+sizeof(int))
#define MAX_LEVELS   IPV6_LEVELS
#define NODES_PER_LEVEL (   lvl)    ((1<<(MAXGROUPNODE_BITS*(lvl))))
#define QUADG_GID   (1<<1)
#define QUADG_GNODE   (1<<2)
#define QUADG_IPSTART   1
#define QUADRO_GROUP_PACK_SZ
Value:
(sizeof(u_char) + sizeof(int)*MAX_LEVELS + \
#define MAX_LEVELS
Definition: gmap.h:107
#define INET_PREFIX_PACK_SZ
Definition: inet.h:90
#define UNITY_LEVEL   1
#define ZERO_LEVEL   1

Typedef Documentation

Function Documentation

void e_rnode_add ( ext_rnode_cache **  erc,
ext_rnode e_rnode,
int  rnode_pos,
u_int *  counter 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void e_rnode_del ( ext_rnode_cache **  erc_head,
u_int *  counter,
ext_rnode_cache erc 
)

Here is the caller graph for this function:

ext_rnode_cache* e_rnode_find ( ext_rnode_cache erc,
quadro_group qg,
int  level 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void e_rnode_free ( ext_rnode_cache **  erc,
u_int *  counter 
)

Here is the caller graph for this function:

ext_rnode_cache* e_rnode_init ( u_int *  counter)

Here is the caller graph for this function:

ext_rnode_cache* erc_find ( ext_rnode_cache erc,
ext_rnode e_rnode 
)

Here is the caller graph for this function:

ext_rnode_cache* erc_find_gnode ( ext_rnode_cache erc,
map_gnode gnode,
u_char  level 
)

Here is the caller graph for this function:

void erc_reorder_rnodepos ( ext_rnode_cache **  erc,
u_int *  erc_counter,
map_node root_node 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void erc_update_rnodepos ( ext_rnode_cache erc,
map_node root_node,
int  old_rnode_pos 
)

Here is the caller graph for this function:

int extmap_find_level ( map_gnode **  ext_map,
map_gnode gnode,
u_char  max_level 
)

Here is the caller graph for this function:

void free_extmap ( map_gnode **  ext_map,
u_char  levels,
int  groups 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void free_extmap_rblock ( map_rnode **  rblock,
u_char  levels 
)

Here is the caller graph for this function:

int free_gids ( quadro_group qg,
int  level,
map_gnode **  ext_map,
map_node int_map 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int g_rnode_find ( map_gnode gnode,
map_gnode n 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int get_groups ( int  family,
int  lvl 
)
inline

Here is the caller graph for this function:

int gids_cmp ( int *  gids_a,
int *  gids_b,
int  lvl,
int  max_lvl 
)

Here is the caller graph for this function:

void gidtoipstart ( int *  gid,
u_char  total_levels,
u_char  levels,
int  family,
inet_prefix ip 
)

Here is the caller graph for this function:

void gmap_node_del ( map_gnode gnode)

Here is the call graph for this function:

Here is the caller graph for this function:

void gnode_dec_seeds ( quadro_group qg,
int  level 
)

Here is the caller graph for this function:

map_gnode* gnode_from_pos ( int  pos,
map_gnode map 
)

Here is the caller graph for this function:

void gnode_inc_seeds ( quadro_group qg,
int  level 
)

Here is the caller graph for this function:

void gnodetoip ( quadro_group quadg,
int  gnodeid,
u_char  level,
inet_prefix ip 
)

Here is the call graph for this function:

Here is the caller graph for this function:

map_gnode** init_extmap ( u_char  levels,
int  groups 
)

Here is the call graph for this function:

Here is the caller graph for this function:

map_gnode* init_gmap ( int  groups)

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_gids_cmp ( inet_prefix  a,
inet_prefix  b,
int  lvl 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int iptogid ( inet_prefix ip,
int  level 
)

Here is the caller graph for this function:

void iptogids ( inet_prefix ip,
int *  gid,
int  levels 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void iptoquadg ( inet_prefix  ip,
map_gnode **  ext_map,
quadro_group qg,
char  flags 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int is_group_invalid ( int *  gids,
int  gid,
int  lvl,
int  family 
)

Here is the caller graph for this function:

map_gnode** load_extmap ( char *  file,
quadro_group quadg 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int merge_ext_maps ( map_gnode **  base,
map_gnode **  new,
quadro_group  base_root,
quadro_group  new_root 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char* pack_extmap ( map_gnode **  ext_map,
int  maxgroupnode,
quadro_group quadg,
size_t *  pack_sz 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void pack_map_gnode ( map_gnode gnode,
char *  pack 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void pack_quadro_group ( quadro_group qg,
char *  pack 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int pos_from_gnode ( map_gnode gnode,
map_gnode map 
)

Here is the caller graph for this function:

void quadg_destroy ( quadro_group qg)

Here is the call graph for this function:

void quadg_free ( quadro_group qg)

Here is the caller graph for this function:

int quadg_gids_cmp ( quadro_group  a,
quadro_group  b,
int  lvl 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void quadg_setflags ( quadro_group qg,
char  flags 
)

Here is the caller graph for this function:

int random_ip ( inet_prefix ipstart,
int  final_level,
int  final_gid,
int  total_levels,
map_gnode **  ext_map,
int  only_free_gnode,
inet_prefix new_ip,
int  my_family 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void reset_extmap ( map_gnode **  ext_map,
u_char  levels,
int  groups 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void reset_gmap ( map_gnode gmap,
int  groups 
)

Here is the call graph for this function:

Here is the caller graph for this function:

const char* rnode_to_ipstr ( u_int  mapstart,
u_int  maprnode,
inet_prefix  ipstart 
)

Here is the call graph for this function:

void rnodetoip ( u_int  mapstart,
u_int  maprnode,
inet_prefix  ipstart,
inet_prefix ret 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int save_extmap ( map_gnode **  ext_map,
int  maxgroupnode,
quadro_group quadg,
char *  file 
)

Here is the call graph for this function:

Here is the caller graph for this function:

map_gnode** unpack_extmap ( char *  package,
quadro_group quadg 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void unpack_map_gnode ( map_gnode gnode,
char *  pack 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void unpack_quadro_group ( quadro_group qg,
char *  pack 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int verify_ext_map_hdr ( struct ext_map_hdr emap_hdr,
quadro_group quadg 
)

Here is the caller graph for this function:

int void_gids ( quadro_group qg,
int  level,
map_gnode **  ext_map,
map_node int_map 
)

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const int_info ext_map_hdr_iinfo
static
Initial value:
= { 3,
{ 1 , 1 , 1 },
{ (sizeof(u_char) + sizeof(int)* (14+ ( 1 + 1 ) ) + + (sizeof(u_char) + sizeof(u_short) + sizeof(u_char) + ( 4 *sizeof(int)) ) * (14+ ( 1 + 1 ) ) ) ,
(sizeof(u_char) + sizeof(int)* (14+ ( 1 + 1 ) ) + + (sizeof(u_char) + sizeof(u_short) + sizeof(u_char) + ( 4 *sizeof(int)) ) * (14+ ( 1 + 1 ) ) ) +sizeof(size_t),
(sizeof(u_char) + sizeof(int)* (14+ ( 1 + 1 ) ) + + (sizeof(u_char) + sizeof(u_short) + sizeof(u_char) + ( 4 *sizeof(int)) ) * (14+ ( 1 + 1 ) ) ) +(sizeof(size_t)*( (14+ ( 1 + 1 ) ) +1)) },
{ 1, (14+ ( 1 + 1 ) ) , 1 }
}
const int_info map_gnode_iinfo
static
Initial value:
= { 1,
{ 1 },
{ (sizeof(u_short)*2 + sizeof(u_int)) +sizeof(u_char)*2 },
{ 1 }
}
const int_info quadro_group_iinfo
static
Initial value:
= { 1,
{ 1 },
{ sizeof(u_char) },
{ (14+ ( 1 + 1 ) ) }
}