Improved hyperscan support and category definition

This commit is contained in:
Luca Deri
2018-05-10 23:46:35 +02:00
parent 3707553906
commit 50216991bd
7 changed files with 283 additions and 77 deletions
+3 -3
View File
@@ -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
+14
View File
@@ -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;