blob: 46c6adb05b33ed985924823b09d933f119e393eb (
plain)
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
|
#ifndef RADIX_H
#define RADIX_H
#include "config.h"
#include "mem_pool.h"
#define RADIX_NO_VALUE (unsigned char)-1
typedef struct radix_node_s radix_node_t;
struct radix_node_s {
radix_node_t *right;
radix_node_t *left;
radix_node_t *parent;
unsigned char value;
};
typedef struct {
radix_node_t *root;
size_t size;
memory_pool_t *pool;
} radix_tree_t;
radix_tree_t *radix_tree_create ();
int radix32tree_insert (radix_tree_t *tree, uint32_t key, uint32_t mask, unsigned char value);
int radix32tree_delete (radix_tree_t *tree, uint32_t key, uint32_t mask);
unsigned char radix32tree_find (radix_tree_t *tree, uint32_t key);
void radix_tree_free (radix_tree_t *tree);
#endif
|