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

Go to the source code of this file.

Data Structures

struct  map_rnode
 
struct  map_node
 
struct  int_map_hdr
 

Macros

#define MAXGROUPNODE_BITS   8 /* 2^MAXGROUPNODE_BITS == MAXGROUPNODE */
 
#define MAXGROUPNODE   (1<<MAXGROUPNODE_BITS)
 
#define MAXROUTES   20
 
#define MAXLINKS   MAXROUTES
 
#define MAP_ME   1 /*The root_node, in other words, me ;)*/
 
#define MAP_VOID   (1<<1) /*It indicates a non existent node*/
 
#define MAP_HNODE
 
#define MAP_BNODE
 
#define MAP_ERNODE   (1<<4) /*It is an External Rnode*/
 
#define MAP_GNODE   (1<<5) /*It is a gnode*/
 
#define MAP_RNODE   (1<<6) /*If a node has this set, it is one of the rnodes*/
 
#define MAP_UPDATE
 
#define QSPN_CLOSED
 
#define QSPN_OPENED   (1<<9) /*It puts a link in a QSPN_OPEN state*/
 
#define QSPN_OLD
 
#define QSPN_STARTER
 
#define QSPN_OPENER
 
#define MAP_IGW   (1<<13) /*This node is an Internet gateway*/
 
#define MAP_RNODE_PACK_SZ   (sizeof(int *)+sizeof(u_int))
 
#define MAP_NODE_PACK_SZ   (sizeof(u_short)*2 + sizeof(u_int))
 
#define MAXRNODEBLOCK   (MAXLINKS * MAXGROUPNODE * sizeof(map_rnode))
 
#define MAXRNODEBLOCK_PACK_SZ   (MAXLINKS * MAXGROUPNODE * MAP_RNODE_PACK_SZ)
 
#define INTMAP_END(mapstart)   ((sizeof(map_node)*MAXGROUPNODE)+(mapstart))
 
#define INT_MAP_BLOCK_SZ(int_map_sz, rblock_sz)   (sizeof(struct int_map_hdr)+(int_map_sz)+(rblock_sz))
 

Functions

int pos_from_node (map_node *node, map_node *map)
 
map_nodenode_from_pos (int pos, map_node *map)
 
void postoip (u_int map_pos, inet_prefix ipstart, inet_prefix *ret)
 
void maptoip (u_int mapstart, u_int mapoff, inet_prefix ipstart, inet_prefix *ret)
 
int iptomap (u_int mapstart, inet_prefix ip, inet_prefix ipstart, map_node **ret)
 
map_nodeinit_map (size_t len)
 
void free_map (map_node *map, size_t count)
 
void map_node_del (map_node *node)
 
void reset_int_map (map_node *map, int maxgroupnode)
 
map_rnodernode_insert (map_rnode *buf, size_t pos, map_rnode *new)
 
map_rnodemap_rnode_insert (map_node *node, size_t pos, map_rnode *new)
 
map_rnodernode_add (map_node *node, map_rnode *new)
 
void rnode_swap (map_rnode *one, map_rnode *two)
 
void rnode_del (map_node *node, size_t pos)
 
void rnode_destroy (map_node *node)
 
int rnode_find (map_node *node, void *n)
 
int rnode_trtt_compar (const void *a, const void *b)
 
void rnode_trtt_order (map_node *node)
 
void map_routes_order (map_node *map)
 
u_int get_route_trtt (map_node *node, u_short route)
 
void rnode_set_trtt (map_node *node)
 
void rnode_recurse_trtt (map_rnode *rnode, int route, struct timeval *trtt)
 
void node_recurse_trtt (map_node *node)
 
void map_set_trtt (map_node *map)
 
map_nodeget_gw_node (map_node *node, u_short route)
 
int merge_maps (map_node *base, map_node *new, map_node *base_root, map_node *new_root)
 
int mod_rnode_addr (map_rnode *node, int *map_start, int *new_start)
 
int get_rnode_block (int *map, map_node *node, map_rnode *rblock, int rstart)
 
map_rnodemap_get_rblock (map_node *map, int *addr_map, int maxgroupnode, int *count)
 
int store_rnode_block (int *map, map_node *node, map_rnode *rblock, int rstart)
 
int map_store_rblock (map_node *map, int *addr_map, int maxgroupnode, map_rnode *rblock)
 
int verify_int_map_hdr (struct int_map_hdr *imap_hdr, int maxgroupnode, int maxrnodeblock)
 
void pack_map_node (map_node *node, char *pack)
 
void unpack_map_node (map_node *node, char *pack)
 
char * pack_map (map_node *map, int *addr_map, int maxgroupnode, map_node *root_node, size_t *pack_sz)
 
map_nodeunpack_map (char *pack, int *addr_map, map_node **new_root, int maxgroupnode, int maxrnodeblock)
 
int save_map (map_node *map, map_node *root_node, char *file)
 
map_nodeload_map (char *file, map_node **new_root)
 

Variables

static const int_info map_rnode_iinfo
 
static const int_info map_node_iinfo
 
struct int_map_hdr _PACKED_
 
static const int_info int_map_hdr_iinfo
 

Macro Definition Documentation

#define INT_MAP_BLOCK_SZ (   int_map_sz,
  rblock_sz 
)    (sizeof(struct int_map_hdr)+(int_map_sz)+(rblock_sz))
#define INTMAP_END (   mapstart)    ((sizeof(map_node)*MAXGROUPNODE)+(mapstart))
#define MAP_BNODE
Value:
(1<<3) /*The node is a border_node. If this
flag is set to a root_node, this means
that we are a bnode at the root_node's
level*/
#define MAP_ERNODE   (1<<4) /*It is an External Rnode*/
#define MAP_GNODE   (1<<5) /*It is a gnode*/
#define MAP_HNODE
Value:
(1<<2) /*Hooking node. The node is currently
hooking*/
#define MAP_IGW   (1<<13) /*This node is an Internet gateway*/
#define MAP_ME   1 /*The root_node, in other words, me ;)*/
#define MAP_NODE_PACK_SZ   (sizeof(u_short)*2 + sizeof(u_int))
#define MAP_RNODE   (1<<6) /*If a node has this set, it is one of the rnodes*/
#define MAP_RNODE_PACK_SZ   (sizeof(int *)+sizeof(u_int))
#define MAP_UPDATE
Value:
(1<<7) /*If it is set, the corresponding route
in the krnl will be updated*/
#define MAP_VOID   (1<<1) /*It indicates a non existent node*/
#define MAXGROUPNODE   (1<<MAXGROUPNODE_BITS)
#define MAXGROUPNODE_BITS   8 /* 2^MAXGROUPNODE_BITS == MAXGROUPNODE */
#define MAXLINKS   MAXROUTES
#define MAXRNODEBLOCK   (MAXLINKS * MAXGROUPNODE * sizeof(map_rnode))
#define MAXRNODEBLOCK_PACK_SZ   (MAXLINKS * MAXGROUPNODE * MAP_RNODE_PACK_SZ)
#define MAXROUTES   20
#define QSPN_CLOSED
Value:
(1<<8) /*This flag is set only to the rnodes,
it puts a link in a QSPN_CLOSED state*/
#define QSPN_OLD
Value:
(1<<10) /*If a node isn't updated by the current
qspn_round it is marked with QSPN_ROUND.
If in the next qspn_round the same node
isn't updated it is removed from the map.*/
#define QSPN_OPENED   (1<<9) /*It puts a link in a QSPN_OPEN state*/
#define QSPN_OPENER
Value:
(1<<12) /*If the root_node sent a new qspn_open
it is a qspn_opener*/
#define QSPN_STARTER
Value:
(1<<11) /*The root node is marked with this flag
if it is a qspn_starter*/

Function Documentation

void free_map ( map_node map,
size_t  count 
)

Here is the caller graph for this function:

map_node* get_gw_node ( map_node node,
u_short  route 
)
int get_rnode_block ( int *  map,
map_node node,
map_rnode rblock,
int  rstart 
)

Here is the call graph for this function:

Here is the caller graph for this function:

u_int get_route_trtt ( map_node node,
u_short  route 
)

Here is the caller graph for this function:

map_node* init_map ( size_t  len)

Here is the call graph for this function:

Here is the caller graph for this function:

int iptomap ( u_int  mapstart,
inet_prefix  ip,
inet_prefix  ipstart,
map_node **  ret 
)

Here is the call graph for this function:

Here is the caller graph for this function:

map_node* load_map ( char *  file,
map_node **  new_root 
)

Here is the call graph for this function:

Here is the caller graph for this function:

map_rnode* map_get_rblock ( map_node map,
int *  addr_map,
int  maxgroupnode,
int *  count 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void map_node_del ( map_node node)

Here is the call graph for this function:

Here is the caller graph for this function:

map_rnode* map_rnode_insert ( map_node node,
size_t  pos,
map_rnode new 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void map_routes_order ( map_node map)

Here is the call graph for this function:

void map_set_trtt ( map_node map)
int map_store_rblock ( map_node map,
int *  addr_map,
int  maxgroupnode,
map_rnode rblock 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void maptoip ( u_int  mapstart,
u_int  mapoff,
inet_prefix  ipstart,
inet_prefix ret 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int merge_maps ( map_node base,
map_node new,
map_node base_root,
map_node new_root 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int mod_rnode_addr ( map_rnode node,
int *  map_start,
int *  new_start 
)

Here is the caller graph for this function:

map_node* node_from_pos ( int  pos,
map_node map 
)

Here is the caller graph for this function:

void node_recurse_trtt ( map_node node)
char* pack_map ( map_node map,
int *  addr_map,
int  maxgroupnode,
map_node root_node,
size_t *  pack_sz 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void pack_map_node ( map_node node,
char *  pack 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int pos_from_node ( map_node node,
map_node map 
)

Here is the caller graph for this function:

void postoip ( u_int  map_pos,
inet_prefix  ipstart,
inet_prefix ret 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void reset_int_map ( map_node map,
int  maxgroupnode 
)

Here is the call graph for this function:

Here is the caller graph for this function:

map_rnode* rnode_add ( map_node node,
map_rnode new 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void rnode_del ( map_node node,
size_t  pos 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void rnode_destroy ( map_node node)

Here is the caller graph for this function:

int rnode_find ( map_node node,
void *  n 
)

Here is the caller graph for this function:

map_rnode* rnode_insert ( map_rnode buf,
size_t  pos,
map_rnode new 
)

Here is the caller graph for this function:

void rnode_recurse_trtt ( map_rnode rnode,
int  route,
struct timeval *  trtt 
)
void rnode_set_trtt ( map_node node)
void rnode_swap ( map_rnode one,
map_rnode two 
)

Here is the caller graph for this function:

int rnode_trtt_compar ( const void *  a,
const void *  b 
)

Here is the caller graph for this function:

void rnode_trtt_order ( map_node node)

Here is the call graph for this function:

Here is the caller graph for this function:

int save_map ( map_node map,
map_node root_node,
char *  file 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int store_rnode_block ( int *  map,
map_node node,
map_rnode rblock,
int  rstart 
)

Here is the call graph for this function:

Here is the caller graph for this function:

map_node* unpack_map ( char *  pack,
int *  addr_map,
map_node **  new_root,
int  maxgroupnode,
int  maxrnodeblock 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void unpack_map_node ( map_node node,
char *  pack 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int verify_int_map_hdr ( struct int_map_hdr imap_hdr,
int  maxgroupnode,
int  maxrnodeblock 
)

Here is the caller graph for this function:

Variable Documentation

const int_info int_map_hdr_iinfo
static
Initial value:
= { 2,
{ 1 , 1 },
{ sizeof(char), sizeof(char)+sizeof(size_t) },
{ 1, 1 }
}
const int_info map_node_iinfo
static
Initial value:
= { 3,
{ (1<<1) , 1 , (1<<1) },
{ 0, sizeof(short), sizeof(short)+sizeof(int) },
{ 1, 1, 1 }
}
const int_info map_rnode_iinfo
static
Initial value:
= { 2,
{ 1 , 1 },
{ 0, sizeof(int) },
{ 1, 1 }
}