26 #define GMAP_ME MAP_ME
27 #define GMAP_VOID MAP_VOID
28 #define GMAP_HGNODE (1<<2)
30 #define GMAP_FULL (1<<3)
60 #define MAP_GNODE_PACK_SZ (MAP_NODE_PACK_SZ+sizeof(u_char)*2+sizeof(int))
82 #define EXTRA_LEVELS (ZERO_LEVEL + UNITY_LEVEL)
84 #define _EL(level) ((level)-1)
86 #define _NL(level) ((level)+1)
103 #define IPV4_LEVELS (2+EXTRA_LEVELS)
105 #define IPV6_LEVELS (14+EXTRA_LEVELS)
107 #define MAX_LEVELS IPV6_LEVELS
109 #define GET_LEVELS(family) \
111 if((family) != AF_INET && (family) != AF_INET6) \
112 fatal("GET_LEVELS: family not specified!"); \
113 (family) == AF_INET ? IPV4_LEVELS : IPV6_LEVELS; \
116 #define GET_LEVELS(family) ({ (family)==AF_INET ? IPV4_LEVELS : IPV6_LEVELS; })
119 #define FAMILY_LVLS (GET_LEVELS(my_family))
123 #define NODES_PER_LEVEL(lvl) ((1<<(MAXGROUPNODE_BITS*(lvl))))
145 #define QUADRO_GROUP_PACK_SZ (sizeof(u_char) + sizeof(int)*MAX_LEVELS + \
146 + INET_PREFIX_PACK_SZ * MAX_LEVELS)
149 #define QUADG_IPSTART 1
150 #define QUADG_GID (1<<1)
151 #define QUADG_GNODE (1<<2)
181 #define EXT_MAP_BLOCK_SZ(ext_map_sz, rblock_sz) (sizeof(struct ext_map_hdr)+(ext_map_sz)+(rblock_sz))
232 int total_levels,
map_gnode **ext_map,
int only_free_gnode,
235 int gids_cmp(
int *gids_a,
int *gids_b,
int lvl,
int max_lvl);
void reset_gmap(map_gnode *gmap, int groups)
Definition: gmap.c:926
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)
Definition: gmap.c:531
void erc_update_rnodepos(ext_rnode_cache *erc, map_node *root_node, int old_rnode_pos)
Definition: gmap.c:779
map_node node
Definition: gmap.h:188
void unpack_quadro_group(quadro_group *qg, char *pack)
Definition: gmap.c:350
int iptogid(inet_prefix *ip, int level)
Definition: gmap.c:159
void gmap_node_del(map_gnode *gnode)
Definition: gmap.c:1023
static const int_info quadro_group_iinfo
Definition: gmap.h:140
u_char levels
Definition: gmap.h:128
char * pack_extmap(map_gnode **ext_map, int maxgroupnode, quadro_group *quadg, size_t *pack_sz)
Definition: gmap.c:1320
#define QUADRO_GROUP_PACK_SZ
Definition: gmap.h:145
map_gnode ** init_extmap(u_char levels, int groups)
Definition: gmap.c:941
void pack_quadro_group(quadro_group *qg, char *pack)
Definition: gmap.c:323
int free_gids(quadro_group *qg, int level, map_gnode **ext_map, map_node *int_map)
Definition: gmap.c:496
void quadg_setflags(quadro_group *qg, char flags)
Definition: gmap.c:264
void erc_reorder_rnodepos(ext_rnode_cache **erc, u_int *erc_counter, map_node *root_node)
Definition: gmap.c:812
int merge_ext_maps(map_gnode **base, map_gnode **new, quadro_group base_root, quadro_group new_root)
Definition: gmap.c:1113
int ip_gids_cmp(inet_prefix a, inet_prefix b, int lvl)
Definition: gmap.c:709
quadro_group quadg
Definition: gmap.h:189
int is_group_invalid(int *gids, int gid, int lvl, int family)
Definition: gmap.c:45
ext_rnode_cache * erc_find(ext_rnode_cache *erc, ext_rnode *e_rnode)
Definition: gmap.c:842
u_char flags
Definition: gmap.h:47
map_gnode * gnode_from_pos(int pos, map_gnode *map)
Definition: gmap.c:119
void gidtoipstart(int *gid, u_char total_levels, u_char levels, int family, inet_prefix *ip)
Definition: gmap.c:203
#define MAX_LEVELS
Definition: gmap.h:107
void unpack_map_gnode(map_gnode *gnode, char *pack)
Definition: gmap.c:1291
void free_extmap_rblock(map_rnode **rblock, u_char levels)
Definition: gmap.c:1248
void rnodetoip(u_int mapstart, u_int maprnode, inet_prefix ipstart, inet_prefix *ret)
Definition: gmap.c:130
int get_groups(int family, int lvl)
Definition: gmap.c:34
void e_rnode_add(ext_rnode_cache **erc, ext_rnode *e_rnode, int rnode_pos, u_int *counter)
Definition: gmap.c:745
int gids_cmp(int *gids_a, int *gids_b, int lvl, int max_lvl)
Definition: gmap.c:679
int extmap_find_level(map_gnode **ext_map, map_gnode *gnode, u_char max_level)
Definition: gmap.c:1006
size_t ext_map_sz
Definition: gmap.h:158
void gnode_inc_seeds(quadro_group *qg, int level)
Definition: gmap.c:291
u_char seeds
Definition: gmap.h:48
struct ext_map_hdr _PACKED_
int pos_from_gnode(map_gnode *gnode, map_gnode *map)
Definition: gmap.c:109
void gnodetoip(quadro_group *quadg, int gnodeid, u_char level, inet_prefix *ip)
Definition: gmap.c:656
size_t total_rblock_sz
Definition: gmap.h:163
map_gnode ** unpack_extmap(char *package, quadro_group *quadg)
Definition: gmap.c:1382
void pack_map_gnode(map_gnode *gnode, char *pack)
Definition: gmap.c:1264
const char * rnode_to_ipstr(u_int mapstart, u_int maprnode, inet_prefix ipstart)
Definition: gmap.c:144
int rnode_pos
Definition: gmap.h:201
int save_extmap(map_gnode **ext_map, int maxgroupnode, quadro_group *quadg, char *file)
Definition: gmap.c:1433
ext_rnode_cache * erc_find_gnode(ext_rnode_cache *erc, map_gnode *gnode, u_char level)
Definition: gmap.c:888
char quadg[(sizeof(u_char)+sizeof(int)*(14+(1+1))++(sizeof(u_char)+sizeof(u_short)+sizeof(u_char)+(4 *sizeof(int)))*(14+(1+1)))]
Definition: gmap.h:156
#define ZERO_LEVEL
Definition: gmap.h:80
map_node * int_map
Definition: qspn-empiric.h:122
ext_rnode * e
Definition: gmap.h:200
void iptoquadg(inet_prefix ip, map_gnode **ext_map, quadro_group *qg, char flags)
Definition: gmap.c:237
int verify_ext_map_hdr(struct ext_map_hdr *emap_hdr, quadro_group *quadg)
Definition: gmap.c:1229
int my_family
Definition: inet.h:141
static const int_info ext_map_hdr_iinfo
Definition: gmap.h:168
map_gnode * init_gmap(int groups)
Definition: gmap.c:910
void gnode_dec_seeds(quadro_group *qg, int level)
Definition: gmap.c:307
ext_rnode_cache * e_rnode_init(u_int *counter)
Definition: gmap.c:724
size_t rblock_sz[(14+(1+1))]
Definition: gmap.h:162
int void_gids(quadro_group *qg, int level, map_gnode **ext_map, map_node *int_map)
Definition: gmap.c:508
#define INT_INFO
Definition: endianness.h:90
void reset_extmap(map_gnode **ext_map, u_char levels, int groups)
Definition: gmap.c:983
map_gnode ** load_extmap(char *file, quadro_group *quadg)
Definition: gmap.c:1456
int quadg_gids_cmp(quadro_group a, quadro_group b, int lvl)
Definition: gmap.c:696
void quadg_free(quadro_group *qg)
Definition: gmap.c:274
static const int_info map_gnode_iinfo
Definition: gmap.h:55
#define LLIST_HDR(_struct)
Definition: llist.c:44
int family
Definition: if.c:34
int flags
Definition: if.c:39
void free_extmap(map_gnode **ext_map, u_char levels, int groups)
Definition: gmap.c:962
#define MAP_NODE_PACK_SZ
Definition: map.h:142
void quadg_destroy(quadro_group *qg)
Definition: gmap.c:279
ext_rnode_cache * e_rnode_find(ext_rnode_cache *erc, quadro_group *qg, int level)
Definition: gmap.c:867
#define INT_TYPE_32BIT
Definition: endianness.h:35
void iptogids(inet_prefix *ip, int *gid, int levels)
Definition: gmap.c:185
int g_rnode_find(map_gnode *gnode, map_gnode *n)
Definition: gmap.c:995
void e_rnode_free(ext_rnode_cache **erc, u_int *counter)
Definition: gmap.c:730
map_node g
Definition: gmap.h:45
void e_rnode_del(ext_rnode_cache **erc_head, u_int *counter, ext_rnode_cache *erc)
Definition: gmap.c:756
u_int gcount
Definition: gmap.h:51