-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitmap_v4.h
72 lines (53 loc) · 2.21 KB
/
bitmap_v4.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef __BITMAP_v4_H__
#define __BITMAP_v4_H__
#include <stdint.h>
#include "bitmap.h"
#include "mb_node.h"
#include "mm.h"
#define LENGTH 32
#define LEVEL ((LENGTH/STRIDE) + 1)
#define UPDATE_LEVEL ((LENGTH/STRIDE) + 1)
#define BATCH 32
int bitmap_traverse_branch(struct mb_node *node,
uint32_t ip, int cidr,
traverse_func func,
void *user_data);
int bitmap_insert_prefix(
struct mb_node *node,
struct mm *m,
uint32_t ip, int cidr,
void *nhi);
int bitmap_delete_prefix(struct mb_node *n, struct mm *m,
uint32_t ip, int cidr, void (*destroy_nhi)(void *nhi));
void *bitmap_do_search_lazy(struct mb_node *n, uint32_t ip);
void *bitmap_do_search(struct mb_node *n, uint32_t ip);
uint8_t bitmap_detect_overlap(struct mb_node *n,
uint32_t ip,
uint8_t cidr, void **nhi_over);
uint8_t bitmap_detect_overlap_generic(struct mb_node *n,
uint32_t ip, uint8_t cidr,
uint32_t bits_limit, void **nhi_over);
void bitmap_print_all_prefix(struct mb_node *n,
void (*print_next_hop)(void *nhi));
int bitmap_prefix_exist(struct mb_node *n,
uint32_t ip, uint8_t cidr);
void bitmap_destroy_trie(struct mb_node *n,
struct mm *m, void (*destroy_nhi)(void *nhi));
void bitmap_do_search_lazy_batch(struct mb_node *n[BATCH],
uint32_t ip[BATCH], void *ret[BATCH], int cnt);
void bitmap_mb_node_iter(struct mb_node *node, uint32_t ip, uint32_t left_bits,
uint32_t cur_cidr, void (*trie_traverse_func)(uint32_t ip, uint32_t cidr, void *nhi, void *user),
void *userdata);
int bitmap_compact(struct mb_node *root, struct mm *m, struct mb_node **compact);
int bitmap_copy_branch(struct mb_node *node,
struct mm *m,
uint32_t ip, int cidr, struct copy_stash *stash);
int bitmap_insert_prefix_read_copy(struct mb_node *root,
struct mm *m, uint32_t ip, int cidr, void *nhi,
struct copy_stash *stash);
int bitmap_delete_prefix_read_copy(struct mb_node *root,
struct mm *m, uint32_t ip, int cidr, \
void (*destroy_nhi)(void *nhi), \
struct copy_stash *stash);
void bitmap_rcu_after_update(struct copy_stash *stash);
#endif