aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/radix.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-15 10:45:19 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-15 10:46:40 +0100
commit34b343ece7bc2c8cb868223b8c0a447c279a2f24 (patch)
treeb304b789533acb504974d24e6e2a5541c357415a /src/libutil/radix.h
parent780facbdcd112e742510d33c40d929760a363af6 (diff)
downloadrspamd-34b343ece7bc2c8cb868223b8c0a447c279a2f24.tar.gz
rspamd-34b343ece7bc2c8cb868223b8c0a447c279a2f24.zip
Implement new path-compressed radix trie.
- The performance benefit over the old algorithm is about 10 times. - Memory usage is significantly lower as well. - Now radix trie can accept any IPv4/IPv6 values
Diffstat (limited to 'src/libutil/radix.h')
-rw-r--r--src/libutil/radix.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libutil/radix.h b/src/libutil/radix.h
index 5b014355e..3ecb52eba 100644
--- a/src/libutil/radix.h
+++ b/src/libutil/radix.h
@@ -9,6 +9,13 @@
typedef struct radix_node_s radix_node_t;
typedef struct radix_tree_s radix_tree_t;
+typedef struct radix_tree_compressed radix_compressed_t;
+
+enum radix_insert_type {
+ RADIX_INSERT,
+ RADIX_ADD,
+ RADIX_REPLACE
+};
typedef gboolean (*radix_tree_traverse_func)(guint32 key, guint32 mask,
uintptr_t value, void *user_data);
@@ -86,4 +93,15 @@ void radix32tree_traverse (radix_tree_t *tree,
*/
void radix_tree_free (radix_tree_t *tree);
+uintptr_t
+radix_insert_compressed (radix_compressed_t * tree,
+ guint8 *key, gsize keylen,
+ gsize masklen,
+ uintptr_t value);
+
+uintptr_t radix_find_compressed (radix_compressed_t * tree, guint8 *key,
+ gsize keylen);
+
+radix_compressed_t *radix_tree_create_compressed (void);
+
#endif