From 50216991bd41f0cdfea599a76ace08ebd00501d3 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Thu, 10 May 2018 23:46:35 +0200 Subject: Improved hyperscan support and category definition --- src/include/ndpi_api.h | 6 +++--- src/include/ndpi_typedefs.h | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'src/include') 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; -- cgit v1.2.3