Hidden ndpi_detection_module_struct definition

This commit is contained in:
Luca Deri
2018-05-14 22:58:14 +02:00
parent 529492e81f
commit 66b759ca69
9 changed files with 62 additions and 62 deletions
+9 -7
View File
@@ -378,29 +378,31 @@ int cmpFlows(const void *_a, const void *_b) {
void extcap_config() { void extcap_config() {
int i, argidx = 0; int i, argidx = 0;
struct ndpi_proto_sorter *protos; struct ndpi_proto_sorter *protos;
u_int ndpi_num_supported_protocols = ndpi_get_ndpi_num_supported_protocols(ndpi_info_mod);
ndpi_proto_defaults_t *proto_defaults = ndpi_get_proto_defaults(ndpi_info_mod);
/* -i <interface> */ /* -i <interface> */
printf("arg {number=%d}{call=-i}{display=Capture Interface}{type=string}" printf("arg {number=%d}{call=-i}{display=Capture Interface}{type=string}"
"{tooltip=The interface name}\n", argidx++); "{tooltip=The interface name}\n", argidx++);
printf("arg {number=%d}{call=-i}{display=Pcap File to Analyze}{type=fileselect}" printf("arg {number=%d}{call=-i}{display=Pcap File to Analyze}{type=fileselect}"
"{tooltip=The pcap file to analyze (if the interface is unspecified)}\n", argidx++); "{tooltip=The pcap file to analyze (if the interface is unspecified)}\n", argidx++);
protos = (struct ndpi_proto_sorter*)malloc(sizeof(struct ndpi_proto_sorter) * ndpi_info_mod->ndpi_num_supported_protocols); protos = (struct ndpi_proto_sorter*)malloc(sizeof(struct ndpi_proto_sorter) * ndpi_num_supported_protocols);
if(!protos) exit(0); if(!protos) exit(0);
for(i=0; i<(int) ndpi_info_mod->ndpi_num_supported_protocols; i++) { for(i=0; i<(int) ndpi_num_supported_protocols; i++) {
protos[i].id = i; protos[i].id = i;
snprintf(protos[i].name, sizeof(protos[i].name), "%s", ndpi_info_mod->proto_defaults[i].protoName); snprintf(protos[i].name, sizeof(protos[i].name), "%s", proto_defaults[i].protoName);
} }
qsort(protos, ndpi_info_mod->ndpi_num_supported_protocols, sizeof(struct ndpi_proto_sorter), cmpProto); qsort(protos, ndpi_num_supported_protocols, sizeof(struct ndpi_proto_sorter), cmpProto);
printf("arg {number=%d}{call=-9}{display=nDPI Protocol Filter}{type=selector}" printf("arg {number=%d}{call=-9}{display=nDPI Protocol Filter}{type=selector}"
"{tooltip=nDPI Protocol to be filtered}\n", argidx); "{tooltip=nDPI Protocol to be filtered}\n", argidx);
printf("value {arg=%d}{value=%d}{display=%s}\n", argidx, -1, "All Protocols (no nDPI filtering)"); printf("value {arg=%d}{value=%d}{display=%s}\n", argidx, -1, "All Protocols (no nDPI filtering)");
for(i=0; i<(int)ndpi_info_mod->ndpi_num_supported_protocols; i++) for(i=0; i<(int)ndpi_num_supported_protocols; i++)
printf("value {arg=%d}{value=%d}{display=%s (%d)}\n", argidx, protos[i].id, printf("value {arg=%d}{value=%d}{display=%s (%d)}\n", argidx, protos[i].id,
protos[i].name, protos[i].id); protos[i].name, protos[i].id);
@@ -1933,7 +1935,7 @@ static void printResults(u_int64_t tot_usec) {
if(!quiet_mode) { if(!quiet_mode) {
printf("\nnDPI Memory statistics:\n"); printf("\nnDPI Memory statistics:\n");
printf("\tnDPI Memory (once): %-13s\n", formatBytes(sizeof(struct ndpi_detection_module_struct), buf, sizeof(buf))); printf("\tnDPI Memory (once): %-13s\n", formatBytes(ndpi_get_ndpi_detection_module_size(), buf, sizeof(buf)));
printf("\tFlow Memory (per flow): %-13s\n", formatBytes(sizeof(struct ndpi_flow_struct), buf, sizeof(buf))); printf("\tFlow Memory (per flow): %-13s\n", formatBytes(sizeof(struct ndpi_flow_struct), buf, sizeof(buf)));
printf("\tActual Memory: %-13s\n", formatBytes(current_ndpi_memory, buf, sizeof(buf))); printf("\tActual Memory: %-13s\n", formatBytes(current_ndpi_memory, buf, sizeof(buf)));
printf("\tPeak Memory: %-13s\n", formatBytes(max_ndpi_memory, buf, sizeof(buf))); printf("\tPeak Memory: %-13s\n", formatBytes(max_ndpi_memory, buf, sizeof(buf)));
+8 -4
View File
@@ -113,14 +113,17 @@ static uint16_t ndpi_get_proto_id(struct ndpi_detection_module_struct *ndpi_mod,
uint16_t proto_id; uint16_t proto_id;
char *e; char *e;
unsigned long p = strtol(name,&e,0); unsigned long p = strtol(name,&e,0);
ndpi_proto_defaults_t *proto_defaults = ndpi_get_proto_defaults(ndpi_mod);
if(e && !*e) { if(e && !*e) {
if(p < NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS && if(p < NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS &&
ndpi_mod->proto_defaults[p].protoName) return (uint16_t)p; proto_defaults[p].protoName) return (uint16_t)p;
return NDPI_PROTOCOL_UNKNOWN; return NDPI_PROTOCOL_UNKNOWN;
} }
for(proto_id=NDPI_PROTOCOL_UNKNOWN; proto_id < NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS; proto_id++) { for(proto_id=NDPI_PROTOCOL_UNKNOWN; proto_id < NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS; proto_id++) {
if(ndpi_mod->proto_defaults[proto_id].protoName && if(proto_defaults[proto_id].protoName &&
!strcasecmp(ndpi_mod->proto_defaults[proto_id].protoName,name)) !strcasecmp(proto_defaults[proto_id].protoName,name))
return proto_id; return proto_id;
} }
return NDPI_PROTOCOL_UNKNOWN; return NDPI_PROTOCOL_UNKNOWN;
@@ -181,7 +184,8 @@ struct ndpi_workflow* ndpi_workflow_init(const struct ndpi_workflow_prefs * pref
NDPI_LOG(0, NULL, NDPI_LOG_ERROR, "global structure initialization failed\n"); NDPI_LOG(0, NULL, NDPI_LOG_ERROR, "global structure initialization failed\n");
exit(-1); exit(-1);
} }
module->ndpi_log_level = nDPI_LogLevel;
ndpi_set_log_level(module, nDPI_LogLevel);
if(_debug_protocols != NULL && ! _debug_protocols_ok) { if(_debug_protocols != NULL && ! _debug_protocols_ok) {
if(parse_debug_proto(module,_debug_protocols)) if(parse_debug_proto(module,_debug_protocols))
+4
View File
@@ -69,3 +69,7 @@ ndpi_fill_protocol_category
ndpi_load_hostname_category ndpi_load_hostname_category
ndpi_enable_loaded_categories ndpi_enable_loaded_categories
ndpi_set_detection_preferences ndpi_set_detection_preferences
ndpi_get_proto_defaults
ndpi_get_ndpi_num_supported_protocols
ndpi_get_ndpi_num_custom_protocols
ndpi_get_ndpi_detection_module_size
+13 -44
View File
@@ -58,7 +58,7 @@ extern "C" {
* else 0 * else 0
* *
*/ */
int check_punycode_string(char * buff , int len); int check_punycode_string(char *buff, int len);
/** /**
@@ -78,7 +78,6 @@ extern "C" {
*/ */
u_int32_t ndpi_detection_get_sizeof_ndpi_id_struct(void); u_int32_t ndpi_detection_get_sizeof_ndpi_id_struct(void);
/** /**
* nDPI personal allocation and free functions * nDPI personal allocation and free functions
**/ **/
@@ -115,7 +114,6 @@ extern "C" {
*/ */
char* ndpi_strncasestr(const char *s, const char *find, size_t slen); char* ndpi_strncasestr(const char *s, const char *find, size_t slen);
/** /**
* Returns the nDPI protocol id for IP-based protocol detection * Returns the nDPI protocol id for IP-based protocol detection
* *
@@ -128,7 +126,6 @@ extern "C" {
u_int16_t ndpi_network_ptree_match(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t ndpi_network_ptree_match(struct ndpi_detection_module_struct *ndpi_struct,
struct in_addr *pin); struct in_addr *pin);
/** /**
* Init single protocol match * Init single protocol match
* *
@@ -155,7 +152,6 @@ extern "C" {
*/ */
void ndpi_free_flow(struct ndpi_flow_struct *flow); void ndpi_free_flow(struct ndpi_flow_struct *flow);
/** /**
* Enables cache support. * Enables cache support.
* In nDPI is used for some protocol (i.e. Skype) * In nDPI is used for some protocol (i.e. Skype)
@@ -168,7 +164,6 @@ extern "C" {
void ndpi_enable_cache(struct ndpi_detection_module_struct *ndpi_mod, void ndpi_enable_cache(struct ndpi_detection_module_struct *ndpi_mod,
char* host, u_int port); char* host, u_int port);
/** /**
* Destroys the detection module * Destroys the detection module
* *
@@ -177,7 +172,6 @@ extern "C" {
*/ */
void ndpi_exit_detection_module(struct ndpi_detection_module_struct *ndpi_struct); void ndpi_exit_detection_module(struct ndpi_detection_module_struct *ndpi_struct);
/** /**
* Sets a single protocol bitmask * Sets a single protocol bitmask
* This function does not increment the index of the callback_buffer * This function does not increment the index of the callback_buffer
@@ -192,7 +186,8 @@ extern "C" {
* @par b_add_detection_bitmask = if set as "true" add the protocol bitmask to the detection bitmask * @par b_add_detection_bitmask = if set as "true" add the protocol bitmask to the detection bitmask
* *
*/ */
void ndpi_set_bitmask_protocol_detection(char *label, struct ndpi_detection_module_struct *ndpi_struct, void ndpi_set_bitmask_protocol_detection(char *label,
struct ndpi_detection_module_struct *ndpi_struct,
const NDPI_PROTOCOL_BITMASK *detection_bitmask, const NDPI_PROTOCOL_BITMASK *detection_bitmask,
const u_int32_t idx, const u_int32_t idx,
u_int16_t ndpi_protocol_id, u_int16_t ndpi_protocol_id,
@@ -202,7 +197,6 @@ extern "C" {
u_int8_t b_save_bitmask_unknow, u_int8_t b_save_bitmask_unknow,
u_int8_t b_add_detection_bitmask); u_int8_t b_add_detection_bitmask);
/** /**
* Sets the protocol bitmask2 * Sets the protocol bitmask2
* *
@@ -213,7 +207,6 @@ extern "C" {
void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *ndpi_struct, void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *ndpi_struct,
const NDPI_PROTOCOL_BITMASK * detection_bitmask); const NDPI_PROTOCOL_BITMASK * detection_bitmask);
/** /**
* Function to be called before we give up with detection for a given flow. * Function to be called before we give up with detection for a given flow.
* This function reduces the NDPI_UNKNOWN_PROTOCOL detection * This function reduces the NDPI_UNKNOWN_PROTOCOL detection
@@ -270,8 +263,6 @@ extern "C" {
const u_int64_t current_tick, const u_int64_t current_tick,
struct ndpi_id_struct *src, struct ndpi_id_struct *src,
struct ndpi_id_struct *dst); struct ndpi_id_struct *dst);
/** /**
* Get the main protocol of the passed flows for the detected module * Get the main protocol of the passed flows for the detected module
* *
@@ -283,8 +274,7 @@ extern "C" {
*/ */
u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow); struct ndpi_flow_struct *flow);
/** /**
* API call that is called internally by ndpi_detection_process_packet or by apps * API call that is called internally by ndpi_detection_process_packet or by apps
* that want to avoid calling ndpi_detection_process_packet as they have already * that want to avoid calling ndpi_detection_process_packet as they have already
@@ -316,7 +306,6 @@ extern "C" {
u_int8_t ndpi_detection_get_l4(const u_int8_t *l3, u_int16_t l3_len, const u_int8_t **l4_return, u_int16_t *l4_len_return, u_int8_t ndpi_detection_get_l4(const u_int8_t *l3, u_int16_t l3_len, const u_int8_t **l4_return, u_int16_t *l4_len_return,
u_int8_t *l4_protocol_return, u_int32_t flags); u_int8_t *l4_protocol_return, u_int32_t flags);
/** /**
* Search and return the protocol based on matched ports * Search and return the protocol based on matched ports
* *
@@ -333,8 +322,6 @@ extern "C" {
u_int16_t sport, u_int16_t sport,
u_int32_t dhost, u_int32_t dhost,
u_int16_t dport); u_int16_t dport);
/** /**
* Search and return the protocol guessed that is undetected * Search and return the protocol guessed that is undetected
* *
@@ -353,8 +340,6 @@ extern "C" {
u_int16_t sport, u_int16_t sport,
u_int32_t dhost, u_int32_t dhost,
u_int16_t dport); u_int16_t dport);
/** /**
* Check if the string passed match with a protocol * Check if the string passed match with a protocol
* *
@@ -369,8 +354,6 @@ extern "C" {
char *string_to_match, char *string_to_match,
u_int string_to_match_len, u_int string_to_match_len,
u_int8_t is_host_match); u_int8_t is_host_match);
/** /**
* Check if the host passed match with a protocol * Check if the host passed match with a protocol
* *
@@ -405,8 +388,6 @@ extern "C" {
char *string_to_match, char *string_to_match,
u_int string_to_match_len, u_int string_to_match_len,
u_int16_t master_protocol_id); u_int16_t master_protocol_id);
/** /**
* Exclude protocol from search * Exclude protocol from search
* *
@@ -419,8 +400,6 @@ extern "C" {
struct ndpi_flow_struct *flow, struct ndpi_flow_struct *flow,
u_int16_t master_protocol_id, u_int16_t master_protocol_id,
const char *_file, const char *_func,int _line); const char *_file, const char *_func,int _line);
/** /**
* Check if the string -bigram_to_match- match with a bigram of -automa- * Check if the string -bigram_to_match- match with a bigram of -automa-
* *
@@ -444,7 +423,8 @@ extern "C" {
* @return the buffer contains the master_protocol and protocol name * @return the buffer contains the master_protocol and protocol name
* *
*/ */
char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod, ndpi_protocol proto, char *buf, u_int buf_len); char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_protocol proto, char *buf, u_int buf_len);
/** /**
* Find out if a given category is custom/user-defined * Find out if a given category is custom/user-defined
@@ -543,7 +523,6 @@ extern "C" {
ndpi_protocol_breed_t ndpi_get_proto_breed(struct ndpi_detection_module_struct *ndpi_struct, ndpi_protocol_breed_t ndpi_get_proto_breed(struct ndpi_detection_module_struct *ndpi_struct,
u_int16_t proto); u_int16_t proto);
/** /**
* Return the string name of the protocol breed * Return the string name of the protocol breed
* *
@@ -555,7 +534,6 @@ extern "C" {
char* ndpi_get_proto_breed_name(struct ndpi_detection_module_struct *ndpi_struct, char* ndpi_get_proto_breed_name(struct ndpi_detection_module_struct *ndpi_struct,
ndpi_protocol_breed_t breed_id); ndpi_protocol_breed_t breed_id);
/** /**
* Return the ID of the protocol * Return the ID of the protocol
* *
@@ -566,7 +544,6 @@ extern "C" {
*/ */
int ndpi_get_protocol_id(struct ndpi_detection_module_struct *ndpi_mod, char *proto); int ndpi_get_protocol_id(struct ndpi_detection_module_struct *ndpi_mod, char *proto);
/** /**
* Return the ID of the category * Return the ID of the category
* *
@@ -577,7 +554,6 @@ extern "C" {
*/ */
int ndpi_get_category_id(struct ndpi_detection_module_struct *ndpi_mod, char *cat); int ndpi_get_category_id(struct ndpi_detection_module_struct *ndpi_mod, char *cat);
/** /**
* Write the list of the supported protocols * Write the list of the supported protocols
* *
@@ -585,7 +561,6 @@ extern "C" {
*/ */
void ndpi_dump_protocols(struct ndpi_detection_module_struct *mod); void ndpi_dump_protocols(struct ndpi_detection_module_struct *mod);
/** /**
* Read a file and load the protocols * Read a file and load the protocols
* *
@@ -604,7 +579,6 @@ extern "C" {
int ndpi_load_protocols_file(struct ndpi_detection_module_struct *ndpi_mod, int ndpi_load_protocols_file(struct ndpi_detection_module_struct *ndpi_mod,
char* path); char* path);
/** /**
* Get the total number of the supported protocols * Get the total number of the supported protocols
* *
@@ -614,7 +588,6 @@ extern "C" {
*/ */
u_int ndpi_get_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod); u_int ndpi_get_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod);
/** /**
* Get the nDPI version release * Get the nDPI version release
* *
@@ -623,7 +596,6 @@ extern "C" {
*/ */
char* ndpi_revision(void); char* ndpi_revision(void);
/** /**
* Set the automa for the protocol search * Set the automa for the protocol search
* *
@@ -634,7 +606,6 @@ extern "C" {
void ndpi_set_automa(struct ndpi_detection_module_struct *ndpi_struct, void ndpi_set_automa(struct ndpi_detection_module_struct *ndpi_struct,
void* automa); void* automa);
#ifdef NDPI_PROTOCOL_HTTP #ifdef NDPI_PROTOCOL_HTTP
/** /**
* Retrieve information for HTTP flows * Retrieve information for HTTP flows
@@ -647,7 +618,6 @@ extern "C" {
ndpi_http_method ndpi_get_http_method(struct ndpi_detection_module_struct *ndpi_mod, ndpi_http_method ndpi_get_http_method(struct ndpi_detection_module_struct *ndpi_mod,
struct ndpi_flow_struct *flow); struct ndpi_flow_struct *flow);
/** /**
* Get the HTTP url * Get the HTTP url
* *
@@ -659,7 +629,6 @@ extern "C" {
char* ndpi_get_http_url(struct ndpi_detection_module_struct *ndpi_mod, char* ndpi_get_http_url(struct ndpi_detection_module_struct *ndpi_mod,
struct ndpi_flow_struct *flow); struct ndpi_flow_struct *flow);
/** /**
* Get the HTTP content-type * Get the HTTP content-type
* *
@@ -672,7 +641,6 @@ extern "C" {
struct ndpi_flow_struct *flow); struct ndpi_flow_struct *flow);
#endif #endif
#ifdef NDPI_PROTOCOL_TOR #ifdef NDPI_PROTOCOL_TOR
/** /**
* Check if the flow could be detected as TOR protocol * Check if the flow could be detected as TOR protocol
@@ -697,7 +665,6 @@ extern "C" {
*/ */
void* ndpi_init_automa(void); void* ndpi_init_automa(void);
/** /**
* Free Aho-Corasick automata allocated with ndpi_init_automa(); * Free Aho-Corasick automata allocated with ndpi_init_automa();
* *
@@ -706,7 +673,6 @@ extern "C" {
*/ */
void ndpi_free_automa(void *_automa); void ndpi_free_automa(void *_automa);
/** /**
* Add a string to match to an automata * Add a string to match to an automata
* *
@@ -718,7 +684,6 @@ extern "C" {
*/ */
int ndpi_add_string_value_to_automa(void *_automa, char *str, unsigned long num); int ndpi_add_string_value_to_automa(void *_automa, char *str, unsigned long num);
/** /**
* Add a string to match to an automata. Same as ndpi_add_string_value_to_automa() with num set to 1 * Add a string to match to an automata. Same as ndpi_add_string_value_to_automa() with num set to 1
* *
@@ -729,7 +694,6 @@ extern "C" {
*/ */
int ndpi_add_string_to_automa(void *_automa, char *str); int ndpi_add_string_to_automa(void *_automa, char *str);
/** /**
* Finalize the automa (necessary before start searching) * Finalize the automa (necessary before start searching)
* *
@@ -738,7 +702,6 @@ extern "C" {
*/ */
void ndpi_finalize_automa(void *_automa); void ndpi_finalize_automa(void *_automa);
/** /**
* Add a string to match to an automata * Add a string to match to an automata
* *
@@ -758,9 +721,15 @@ extern "C" {
struct ndpi_flow_struct *flow, struct ndpi_flow_struct *flow,
ndpi_protocol *ret); ndpi_protocol *ret);
int ndpi_set_detection_preferences(struct ndpi_detection_module_struct *ndpi_mod, int ndpi_set_detection_preferences(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_detection_preference pref, ndpi_detection_preference pref,
int value); int value);
ndpi_proto_defaults_t* ndpi_get_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod);
u_int ndpi_get_ndpi_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod);
u_int ndpi_get_ndpi_num_custom_protocols(struct ndpi_detection_module_struct *ndpi_mod);
u_int ndpi_get_ndpi_detection_module_size();
void ndpi_set_log_level(struct ndpi_detection_module_struct *ndpi_mod, u_int l);
/** /**
* Add a string to match to an automata * Add a string to match to an automata
* *
-1
View File
@@ -61,7 +61,6 @@ extern "C" {
u_int64_t ndpi_bytestream_dec_or_hex_to_number64(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read); u_int64_t ndpi_bytestream_dec_or_hex_to_number64(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
u_int32_t ndpi_bytestream_to_ipv4(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read); u_int32_t ndpi_bytestream_to_ipv4(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
void ndpi_set_detected_protocol(struct ndpi_detection_module_struct *ndpi_struct, void ndpi_set_detected_protocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow, struct ndpi_flow_struct *flow,
u_int16_t upper_detected_protocol, u_int16_t upper_detected_protocol,
+6 -4
View File
@@ -61,10 +61,10 @@ typedef struct ndpi_protocol_bitmask_struct {
/* NDPI_DEBUG_FUNCTION_PTR (cast) */ /* NDPI_DEBUG_FUNCTION_PTR (cast) */
typedef void (*ndpi_debug_function_ptr) (u_int32_t protocol, void *module_struct, typedef void (*ndpi_debug_function_ptr) (u_int32_t protocol, void *module_struct,
ndpi_log_level_t log_level, const char *file, const char *func, unsigned line, ndpi_log_level_t log_level, const char *file,
const char *func, unsigned line,
const char *format, ...); const char *format, ...);
/* ************************************************************ */ /* ************************************************************ */
/* ******************* NDPI NETWORKS HEADERS ****************** */ /* ******************* NDPI NETWORKS HEADERS ****************** */
/* ************************************************************ */ /* ************************************************************ */
@@ -709,7 +709,8 @@ struct ndpi_packet_struct {
struct ndpi_int_one_line_struct http_x_session_type; struct ndpi_int_one_line_struct http_x_session_type;
struct ndpi_int_one_line_struct server_line; struct ndpi_int_one_line_struct server_line;
struct ndpi_int_one_line_struct http_method; struct ndpi_int_one_line_struct http_method;
struct ndpi_int_one_line_struct http_response; /* the first "word" in this pointer is the response code in the packet (200, etc) */ struct ndpi_int_one_line_struct http_response; /* the first "word" in this pointer is the
response code in the packet (200, etc) */
u_int8_t http_num_headers; /* number of found (valid) header lines in HTTP request or response */ u_int8_t http_num_headers; /* number of found (valid) header lines in HTTP request or response */
u_int16_t l3_packet_len; u_int16_t l3_packet_len;
@@ -744,7 +745,6 @@ struct ndpi_subprotocol_conf_struct {
void (*func) (struct ndpi_detection_module_struct *, char *attr, char *value, int protocol_id); void (*func) (struct ndpi_detection_module_struct *, char *attr, char *value, int protocol_id);
}; };
typedef struct { typedef struct {
u_int16_t port_low, port_high; u_int16_t port_low, port_high;
} ndpi_port_range; } ndpi_port_range;
@@ -843,6 +843,7 @@ struct hs_list {
}; };
#endif #endif
#ifdef NDPI_LIB_COMPILATION
struct ndpi_detection_module_struct { struct ndpi_detection_module_struct {
NDPI_PROTOCOL_BITMASK detection_bitmask; NDPI_PROTOCOL_BITMASK detection_bitmask;
NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask; NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask;
@@ -965,6 +966,7 @@ struct ndpi_detection_module_struct {
void *hyperscan; /* Intel Hyperscan */ void *hyperscan; /* Intel Hyperscan */
}; };
#endif
struct ndpi_flow_struct { struct ndpi_flow_struct {
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_SIZE]; u_int16_t detected_protocol_stack[NDPI_PROTOCOL_SIZE];
+1 -1
View File
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libndpi.la lib_LTLIBRARIES = libndpi.la
CFLAGS += -fPIC -DPIC # --coverage CFLAGS += -fPIC -DPIC -DNDPI_LIB_COMPILATION # --coverage
libndpi_la_CPPFLAGS = -I$(top_srcdir)/src/include/ -I$(top_srcdir)/src/lib/third_party/include/ @HS_INC@ libndpi_la_CPPFLAGS = -I$(top_srcdir)/src/include/ -I$(top_srcdir)/src/lib/third_party/include/ @HS_INC@
libndpi_la_LDFLAGS = -version-info 1:0:0 -export-symbols $(top_srcdir)/libndpi.sym libndpi_la_LDFLAGS = -version-info 1:0:0 -export-symbols $(top_srcdir)/libndpi.sym
+1 -1
View File
@@ -5,7 +5,7 @@
# cd src/lib # cd src/lib
# make -f Makefile.simple # make -f Makefile.simple
# #
CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION
RANLIB=ranlib RANLIB=ranlib
OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) ndpi_main.o OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) ndpi_main.o
+20
View File
@@ -5655,3 +5655,23 @@ void NDPI_DUMP_BITMASK(NDPI_PROTOCOL_BITMASK a) {
u_int8_t ndpi_get_api_version() { u_int8_t ndpi_get_api_version() {
return(NDPI_API_VERSION); return(NDPI_API_VERSION);
} }
ndpi_proto_defaults_t* ndpi_get_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod) {
return(ndpi_mod->proto_defaults);
}
u_int ndpi_get_ndpi_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod) {
return(ndpi_mod->ndpi_num_supported_protocols);
}
u_int ndpi_get_ndpi_num_custom_protocols(struct ndpi_detection_module_struct *ndpi_mod) {
return(ndpi_mod->ndpi_num_custom_protocols);
}
u_int ndpi_get_ndpi_detection_module_size() {
return(sizeof(struct ndpi_detection_module_struct));
}
void ndpi_set_log_level(struct ndpi_detection_module_struct *ndpi_mod, u_int l) {
ndpi_mod->ndpi_log_level = l;
}