API cleanup for indetifying explicitly in automa's what we're searching (protocol or category)
Removed hyperscan support that is apperently unused
This commit is contained in:
@@ -818,12 +818,13 @@ extern "C" {
|
||||
u_int32_t daddr,
|
||||
ndpi_protocol *ret);
|
||||
int ndpi_match_custom_category(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
char *name, u_int name_len, u_int32_t *id);
|
||||
char *name, u_int name_len, ndpi_protocol_category_t *id);
|
||||
void ndpi_fill_protocol_category(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
ndpi_protocol *ret);
|
||||
int ndpi_get_custom_category_match(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
char *name_or_ip, u_int name_len, u_int32_t *id);
|
||||
char *name_or_ip, u_int name_len,
|
||||
ndpi_protocol_category_t *id);
|
||||
int ndpi_set_detection_preferences(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
ndpi_detection_preference pref,
|
||||
int value);
|
||||
@@ -846,16 +847,19 @@ extern "C" {
|
||||
void ndpi_lru_add_to_cache(struct ndpi_lru_cache *c, u_int32_t key, u_int16_t value);
|
||||
|
||||
/**
|
||||
* Add a string to match to an automata
|
||||
* Find a protocol id associated with a string automata
|
||||
*
|
||||
* @par The automata initialized with ndpi_init_automa();
|
||||
* @par The (sub)string to search
|
||||
* @par The (sub)string length
|
||||
* @par The id associated with the matched string or 0 id not found.
|
||||
* @par The protocol id associated with the matched string or 0 id not found.
|
||||
* @return 0 in case of match, or -1 if no match, or -2 if an error occurred.
|
||||
*
|
||||
*/
|
||||
int ndpi_match_string_id(void *_automa, char *string_to_match, u_int match_len, u_int32_t *id);
|
||||
int ndpi_match_string_protocol_id(void *_automa, char *string_to_match, u_int match_len,
|
||||
u_int16_t *protocol_id,
|
||||
ndpi_protocol_category_t *category,
|
||||
ndpi_protocol_breed_t *breed);
|
||||
|
||||
/* Utility functions to set ndpi malloc/free/print wrappers */
|
||||
void set_ndpi_malloc(void* (*__ndpi_malloc)(size_t size));
|
||||
|
||||
@@ -976,21 +976,6 @@ typedef struct ndpi_proto {
|
||||
/* Needed to have access to HAVE_* defines */
|
||||
#include "ndpi_config.h"
|
||||
|
||||
#ifdef HAVE_HYPERSCAN
|
||||
#include <hs/hs.h>
|
||||
|
||||
struct hs_list {
|
||||
char *expression;
|
||||
unsigned int id;
|
||||
struct hs_list *next;
|
||||
};
|
||||
|
||||
struct hs {
|
||||
hs_database_t *database;
|
||||
hs_scratch_t *scratch;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
#include <pcre.h>
|
||||
|
||||
@@ -1059,13 +1044,7 @@ struct ndpi_detection_module_struct {
|
||||
/* IMPORTANT: please update ndpi_finalize_initalization() whenever you add a new automa */
|
||||
|
||||
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 */
|
||||
u_int8_t categories_loaded;
|
||||
} custom_categories;
|
||||
@@ -1373,14 +1352,14 @@ struct ndpi_flow_struct {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *string_to_match, *string2_to_match, *pattern_to_match, *proto_name;
|
||||
char *string_to_match, *proto_name;
|
||||
int protocol_id;
|
||||
ndpi_protocol_category_t protocol_category;
|
||||
ndpi_protocol_breed_t protocol_breed;
|
||||
} ndpi_protocol_match;
|
||||
|
||||
typedef struct {
|
||||
char *string_to_match, *hyperscan_string_to_match;
|
||||
char *string_to_match;
|
||||
ndpi_protocol_category_t protocol_category;
|
||||
} ndpi_category_match;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user