Reworked categories handling

Removed GenericProtocol and replaced with categories
Removed ndpi_pref_enable_category_substring_match option: substring matching is now default
This commit is contained in:
Luca Deri
2019-09-29 21:46:41 +02:00
parent 016d568c2b
commit f2a5bbef17
15 changed files with 1301 additions and 1314 deletions
+13 -14
View File
@@ -383,13 +383,12 @@ extern "C" {
* @return the ID of the matched subprotocol
*
*/
int ndpi_match_host_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow,
char *string_to_match,
u_int string_to_match_len,
ndpi_protocol_match_result *ret_match,
u_int16_t master_protocol_id);
u_int16_t ndpi_match_host_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow,
char *string_to_match,
u_int string_to_match_len,
ndpi_protocol_match_result *ret_match,
u_int16_t master_protocol_id);
/**
* Check if the string content passed match with a protocol
@@ -403,12 +402,12 @@ extern "C" {
* @return the ID of the matched subprotocol
*
*/
int ndpi_match_content_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow,
char *string_to_match,
u_int string_to_match_len,
ndpi_protocol_match_result *ret_match,
u_int16_t master_protocol_id);
u_int16_t ndpi_match_content_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow,
char *string_to_match,
u_int string_to_match_len,
ndpi_protocol_match_result *ret_match,
u_int16_t master_protocol_id);
/**
* Exclude protocol from search
*
@@ -755,7 +754,7 @@ extern "C" {
u_int32_t daddr,
ndpi_protocol *ret);
int ndpi_match_custom_category(struct ndpi_detection_module_struct *ndpi_struct,
char *name, unsigned long *id);
char *name, unsigned long *id);
void ndpi_fill_protocol_category(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow,
ndpi_protocol *ret);
+1 -1
View File
@@ -171,7 +171,7 @@ typedef enum {
NDPI_PROTOCOL_LASTFM = 134,
NDPI_PROTOCOL_WAZE = 135,
NDPI_PROTOCOL_YOUTUBE_UPLOAD = 136, /* Upload files to youtube */
NDPI_PROTOCOL_GENERIC = 137, /* Generic protocol used for category matching */
NDPI_PROTOCOL_FREE_137 = 137, /* Free */
NDPI_PROTOCOL_CHECKMK = 138,
NDPI_PROTOCOL_AJP = 139, /* Leonn Paiva <leonn.paiva@gmail.com> */
NDPI_PROTOCOL_APPLE = 140,
+10 -8
View File
@@ -919,11 +919,10 @@ typedef enum {
} ndpi_protocol_category_t;
typedef enum {
ndpi_pref_http_dont_dissect_response = 0,
ndpi_pref_dns_dont_dissect_response,
ndpi_pref_direction_detect_disable,
ndpi_pref_disable_metadata_export,
ndpi_pref_enable_category_substring_match
ndpi_pref_http_dont_dissect_response = 0,
ndpi_pref_dns_dont_dissect_response,
ndpi_pref_direction_detect_disable,
ndpi_pref_disable_metadata_export,
} ndpi_detection_preference;
/* ntop extensions */
@@ -1048,7 +1047,6 @@ struct ndpi_detection_module_struct {
#else
ndpi_automa hostnames, hostnames_shadow;
#endif
void *hostnames_hash;
void *ipAddresses, *ipAddresses_shadow; /* Patricia */
u_int8_t categories_loaded;
} custom_categories;
@@ -1102,8 +1100,7 @@ struct ndpi_detection_module_struct {
u_int8_t http_dont_dissect_response:1, dns_dont_dissect_response:1,
direction_detect_disable:1, /* disable internal detection of packet direction */
disable_metadata_export:1, /* No metadata is exported */
enable_category_substring_match:1 /* Default is perfect match */
disable_metadata_export:1 /* No metadata is exported */
;
void *hyperscan; /* Intel Hyperscan */
@@ -1337,6 +1334,11 @@ typedef struct {
ndpi_protocol_breed_t protocol_breed;
} ndpi_protocol_match;
typedef struct {
char *string_to_match, *hyperscan_string_to_match;
ndpi_protocol_category_t protocol_category;
} ndpi_category_match;
typedef struct {
u_int32_t network;
u_int8_t cidr;