aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2018-05-10 23:46:35 +0200
committerLuca Deri <deri@ntop.org>2018-05-10 23:46:35 +0200
commit50216991bd41f0cdfea599a76ace08ebd00501d3 (patch)
tree6e7ba56f8f8b093f61577d2f61af5542748ecff9 /src/include
parent3707553906027000fd189f93d131b68f8d886d54 (diff)
Improved hyperscan support and category definition
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ndpi_api.h6
-rw-r--r--src/include/ndpi_typedefs.h14
2 files changed, 17 insertions, 3 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h
index 2cf5d3436..9b75d7bd4 100644
--- a/src/include/ndpi_api.h
+++ b/src/include/ndpi_api.h
@@ -751,9 +751,9 @@ extern "C" {
void ndpi_load_ip_category(struct ndpi_detection_module_struct *ndpi_struct,
char *ip_address_and_mask, ndpi_protocol_category_t category);
- void ndpi_load_hostname_category(struct ndpi_detection_module_struct *ndpi_struct,
- char *name, ndpi_protocol_category_t category);
- void ndpi_enable_loaded_categories(struct ndpi_detection_module_struct *ndpi_struct);
+ int ndpi_load_hostname_category(struct ndpi_detection_module_struct *ndpi_struct,
+ char *name, ndpi_protocol_category_t category);
+ int ndpi_enable_loaded_categories(struct ndpi_detection_module_struct *ndpi_struct);
/**
* Add a string to match to an automata
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h
index 99531356d..af444e410 100644
--- a/src/include/ndpi_typedefs.h
+++ b/src/include/ndpi_typedefs.h
@@ -828,6 +828,14 @@ typedef struct ndpi_proto {
#define NUM_CUSTOM_CATEGORIES 5
#define CUSTOM_CATEGORY_LABEL_LEN 32
+#ifdef HAVE_HYPERSCAN
+struct hs_list {
+ char *expression;
+ unsigned int id;
+ struct hs_list *next;
+};
+#endif
+
struct ndpi_detection_module_struct {
NDPI_PROTOCOL_BITMASK detection_bitmask;
NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask;
@@ -886,7 +894,13 @@ struct ndpi_detection_module_struct {
bigrams_automa, impossible_bigrams_automa; /* TOR */
struct {
+#ifdef HAVE_HYPERSCAN
+ struct hs *hostnames;
+ unsigned int num_to_load;
+ struct hs_list *to_load;
+#else
ndpi_automa hostnames, hostnames_shadow;
+#endif
void *ipAddresses, *ipAddresses_shadow; /* Patricia */
} custom_categories;