aboutsummaryrefslogtreecommitdiffstats
path: root/src/trie.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-20 19:35:07 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-20 19:35:07 +0400
commit5c9372c4a8678c6856360891180b02c2fdf688ee (patch)
treebc67f5cb057c4784c67e691f76aa8a8f80a40e51 /src/trie.h
parent9bc06fea2eac12cc46028fcdd630d291a76b68ae (diff)
downloadrspamd-5c9372c4a8678c6856360891180b02c2fdf688ee.tar.gz
rspamd-5c9372c4a8678c6856360891180b02c2fdf688ee.zip
* Add start script for red hat compatible systems
Add descriptions for some rspamd API functions (no functional changes). --HG-- rename : linux/rspamd => linux/rspamd_debian.in
Diffstat (limited to 'src/trie.h')
-rw-r--r--src/trie.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/trie.h b/src/trie.h
index f87116275..ef01c3e4e 100644
--- a/src/trie.h
+++ b/src/trie.h
@@ -55,10 +55,32 @@ typedef struct rspamd_trie_s {
memory_pool_t *pool;
} rspamd_trie_t;
+/*
+ * Create a new suffix trie
+ */
rspamd_trie_t* rspamd_trie_create (gboolean icase);
+/*
+ * Insert a pattern into the trie
+ * @param trie suffix trie
+ * @param pattern text of element
+ * @param pattern_id id of element
+ */
void rspamd_trie_insert (rspamd_trie_t *trie, const gchar *pattern, gint pattern_id);
+
+/*
+ * Search for a text using suffix trie
+ * @param trie suffix trie
+ * @param buffer a text where to search for trie patterns
+ * @param buflen a length of text
+ * @param mached_id on a successfull search here would be stored id of pattern found
+ * @return Position in a text where pattern was found or NULL if no patterns were found
+ */
const gchar* rspamd_trie_lookup (rspamd_trie_t *trie, const gchar *buffer, gsize buflen, gint *matched_id);
+
+/*
+ * Deallocate suffix trie
+ */
void rspamd_trie_free (rspamd_trie_t *trie);
#endif /* TRIE_H_ */