aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2016-05-07 18:45:18 +0200
committerLuca Deri <deri@ntop.org>2016-05-07 18:45:18 +0200
commit18901ca4d68d0c6ab4e56d3eaebf7ed5fb05264b (patch)
tree45b2dc2edd12fd90d586bc0dce768d379633f205 /src/include
parentd5f77e92f7887ffc192c7df0ebb5a7bf93f37e41 (diff)
Added wrappers for substring-search
ndpi_init_automa() ndpi_free_automa() ndpi_add_string_to_automa() ndpi_finalize_automa() ndpi_match_string() set_ndpi_malloc() set_ndpi_free()
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ndpi_api.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h
index a07c96e63..113aa0ea2 100644
--- a/src/include/ndpi_api.h
+++ b/src/include/ndpi_api.h
@@ -544,6 +544,62 @@ extern "C" {
struct ndpi_flow_struct *flow, char *certificate);
#endif
+ /* Wrappers functions */
+ /**
+ * Init Aho-Corasick automata
+ *
+ * @return The requested automata, or NULL if an error occurred
+ *
+ */
+ void* ndpi_init_automa();
+
+
+ /**
+ * Free Aho-Corasick automata allocated with ndpi_init_automa();
+ *
+ * @par The automata initialized with ndpi_init_automa();
+ * @return The requested automata, or NULL if an error occurred
+ *
+ */
+ void ndpi_free_automa(void *_automa);
+
+
+ /**
+ * Add a string to match to an automata
+ *
+ * @par The automata initialized with ndpi_init_automa();
+ * @par The (sub)string to search
+ * @return 0 in case of no error, or -1 if an error occurred.
+ *
+ */
+ int ndpi_add_string_to_automa(void *_automa, char *str);
+
+
+ /**
+ * Finalize the automa (necessary before start searching)
+ *
+ * @par The automata initialized with ndpi_init_automa();
+ *
+ */
+ void ndpi_finalize_automa(void *_automa);
+
+
+ /**
+ * Add a string to match to an automata
+ *
+ * @par The automata initialized with ndpi_init_automa();
+ * @par The (sub)string to search
+ * @return 0 in case of match, or -1 if no match, or -2 if an error occurred.
+ *
+ */
+ int ndpi_match_string(void *_automa, char *string_to_match);
+
+
+
+ /* Utility functions to set ndpi malloc/free wrappers */
+ void set_ndpi_malloc(void* (*__ndpi_malloc)(size_t size));
+ void set_ndpi_free(void (*__ndpi_free)(void *ptr));
+
#ifdef __cplusplus
}
#endif