aboutsummaryrefslogtreecommitdiffstats
path: root/src/radix.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-06-29 19:32:31 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-06-29 19:32:31 +0400
commit025f2000d515244e085cd82ac089d7f0271fc531 (patch)
tree1ce03cdd34717418194aaf5fdee6584ad241cc1c /src/radix.h
parent21a2da8ea3da88fe2e54785189c0a328fcab4a2a (diff)
downloadrspamd-025f2000d515244e085cd82ac089d7f0271fc531.tar.gz
rspamd-025f2000d515244e085cd82ac089d7f0271fc531.zip
* Add views support (not completely tested yet)
Diffstat (limited to 'src/radix.h')
-rw-r--r--src/radix.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/radix.h b/src/radix.h
new file mode 100644
index 000000000..46c6adb05
--- /dev/null
+++ b/src/radix.h
@@ -0,0 +1,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