The Netsukuku Project
0.0.9
An Alternative routing method
|
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_gnode * | gnode_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_cache * | erc_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_cache * | e_rnode_init (u_int *counter) |
void | e_rnode_free (ext_rnode_cache **erc, u_int *counter) |
ext_rnode_cache * | e_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_cache * | erc_find_gnode (ext_rnode_cache *erc, map_gnode *gnode, u_char level) |
map_gnode * | init_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 |
#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 |
#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 |
#define UNITY_LEVEL 1 |
#define ZERO_LEVEL 1 |
typedef struct ext_rnode_cache ext_rnode_cache |
void e_rnode_add | ( | ext_rnode_cache ** | erc, |
ext_rnode * | e_rnode, | ||
int | rnode_pos, | ||
u_int * | counter | ||
) |
void e_rnode_del | ( | ext_rnode_cache ** | erc_head, |
u_int * | counter, | ||
ext_rnode_cache * | erc | ||
) |
ext_rnode_cache* e_rnode_find | ( | ext_rnode_cache * | erc, |
quadro_group * | qg, | ||
int | level | ||
) |
void e_rnode_free | ( | ext_rnode_cache ** | erc, |
u_int * | counter | ||
) |
ext_rnode_cache* e_rnode_init | ( | u_int * | counter | ) |
ext_rnode_cache* erc_find | ( | ext_rnode_cache * | erc, |
ext_rnode * | e_rnode | ||
) |
ext_rnode_cache* erc_find_gnode | ( | ext_rnode_cache * | erc, |
map_gnode * | gnode, | ||
u_char | level | ||
) |
void erc_reorder_rnodepos | ( | ext_rnode_cache ** | erc, |
u_int * | erc_counter, | ||
map_node * | root_node | ||
) |
void erc_update_rnodepos | ( | ext_rnode_cache * | erc, |
map_node * | root_node, | ||
int | old_rnode_pos | ||
) |
void free_extmap | ( | map_gnode ** | ext_map, |
u_char | levels, | ||
int | groups | ||
) |
void free_extmap_rblock | ( | map_rnode ** | rblock, |
u_char | levels | ||
) |
int free_gids | ( | quadro_group * | qg, |
int | level, | ||
map_gnode ** | ext_map, | ||
map_node * | int_map | ||
) |
|
inline |
int gids_cmp | ( | int * | gids_a, |
int * | gids_b, | ||
int | lvl, | ||
int | max_lvl | ||
) |
void gidtoipstart | ( | int * | gid, |
u_char | total_levels, | ||
u_char | levels, | ||
int | family, | ||
inet_prefix * | ip | ||
) |
void gmap_node_del | ( | map_gnode * | gnode | ) |
void gnode_dec_seeds | ( | quadro_group * | qg, |
int | level | ||
) |
void gnode_inc_seeds | ( | quadro_group * | qg, |
int | level | ||
) |
void gnodetoip | ( | quadro_group * | quadg, |
int | gnodeid, | ||
u_char | level, | ||
inet_prefix * | ip | ||
) |
map_gnode** init_extmap | ( | u_char | levels, |
int | groups | ||
) |
map_gnode* init_gmap | ( | int | groups | ) |
int ip_gids_cmp | ( | inet_prefix | a, |
inet_prefix | b, | ||
int | lvl | ||
) |
int iptogid | ( | inet_prefix * | ip, |
int | level | ||
) |
void iptogids | ( | inet_prefix * | ip, |
int * | gid, | ||
int | levels | ||
) |
void iptoquadg | ( | inet_prefix | ip, |
map_gnode ** | ext_map, | ||
quadro_group * | qg, | ||
char | flags | ||
) |
int is_group_invalid | ( | int * | gids, |
int | gid, | ||
int | lvl, | ||
int | family | ||
) |
map_gnode** load_extmap | ( | char * | file, |
quadro_group * | quadg | ||
) |
int merge_ext_maps | ( | map_gnode ** | base, |
map_gnode ** | new, | ||
quadro_group | base_root, | ||
quadro_group | new_root | ||
) |
char* pack_extmap | ( | map_gnode ** | ext_map, |
int | maxgroupnode, | ||
quadro_group * | quadg, | ||
size_t * | pack_sz | ||
) |
void pack_map_gnode | ( | map_gnode * | gnode, |
char * | pack | ||
) |
void pack_quadro_group | ( | quadro_group * | qg, |
char * | pack | ||
) |
void quadg_destroy | ( | quadro_group * | qg | ) |
void quadg_free | ( | quadro_group * | qg | ) |
int quadg_gids_cmp | ( | quadro_group | a, |
quadro_group | b, | ||
int | lvl | ||
) |
void quadg_setflags | ( | quadro_group * | qg, |
char | flags | ||
) |
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 reset_extmap | ( | map_gnode ** | ext_map, |
u_char | levels, | ||
int | groups | ||
) |
void reset_gmap | ( | map_gnode * | gmap, |
int | groups | ||
) |
const char* rnode_to_ipstr | ( | u_int | mapstart, |
u_int | maprnode, | ||
inet_prefix | ipstart | ||
) |
void rnodetoip | ( | u_int | mapstart, |
u_int | maprnode, | ||
inet_prefix | ipstart, | ||
inet_prefix * | ret | ||
) |
int save_extmap | ( | map_gnode ** | ext_map, |
int | maxgroupnode, | ||
quadro_group * | quadg, | ||
char * | file | ||
) |
map_gnode** unpack_extmap | ( | char * | package, |
quadro_group * | quadg | ||
) |
void unpack_map_gnode | ( | map_gnode * | gnode, |
char * | pack | ||
) |
void unpack_quadro_group | ( | quadro_group * | qg, |
char * | pack | ||
) |
int verify_ext_map_hdr | ( | struct ext_map_hdr * | emap_hdr, |
quadro_group * | quadg | ||
) |
int void_gids | ( | quadro_group * | qg, |
int | level, | ||
map_gnode ** | ext_map, | ||
map_node * | int_map | ||
) |
struct ext_map_hdr _PACKED_ |
|
static |
|
static |
|
static |