diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ndpi_api.h | 23 | ||||
-rw-r--r-- | src/include/ndpi_define.h.in | 4 | ||||
-rw-r--r-- | src/include/ndpi_private.h | 11 | ||||
-rw-r--r-- | src/include/ndpi_typedefs.h | 17 |
4 files changed, 28 insertions, 27 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index 60d0ea3e3..c06319aef 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -273,29 +273,6 @@ extern "C" { void ndpi_exit_detection_module(struct ndpi_detection_module_struct *ndpi_struct); /** - * Sets a single protocol bitmask - * This function does not increment the index of the callback_buffer - * - * @par label = string for the protocol name - * @par ndpi_struct = the detection module - * @par idx = the index of the callback_buffer - * @par func = function pointer of the protocol search - * @par ndpi_selection_bitmask = the protocol selected bitmask - * @par b_save_bitmask_unknow = if set as "true" save the detection bitmask as unknow - * @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, - const u_int32_t idx, - u_int16_t ndpi_protocol_id, - void (*func) (struct ndpi_detection_module_struct *, - struct ndpi_flow_struct *flow), - const NDPI_SELECTION_BITMASK_PROTOCOL_SIZE ndpi_selection_bitmask, - u_int8_t b_save_bitmask_unknow, - u_int8_t b_add_detection_bitmask); - - /** * Sets the protocol bitmask2 * * @par ndpi_struct = the detection module diff --git a/src/include/ndpi_define.h.in b/src/include/ndpi_define.h.in index 66ef9a5d4..be439cbc3 100644 --- a/src/include/ndpi_define.h.in +++ b/src/include/ndpi_define.h.in @@ -139,6 +139,10 @@ #define NDPI_ISSET_BIT(num, n) (num & (1ULL << ( n ))) #define NDPI_ZERO_BIT(num) num = 0 +#define NDPI_DISSECTOR_BITMASK ndpi_dissector_bitmask_struct_t +#define NDPI_DISSECTOR_BITMASK_IS_SET(p, n) NDPI_ISSET(&(p), (n)) +#define NDPI_DISSECTOR_BITMASK_SET(p, n) NDPI_SET(&(p), (n) & NDPI_NUM_BITS_MASK) + /* this is a very very tricky macro *g*, * the compiler will remove all shifts here if the protocol is static... */ diff --git a/src/include/ndpi_private.h b/src/include/ndpi_private.h index a1d8179d1..df14bd8e9 100644 --- a/src/include/ndpi_private.h +++ b/src/include/ndpi_private.h @@ -58,7 +58,6 @@ struct call_function_struct { void (*func) (struct ndpi_detection_module_struct *, struct ndpi_flow_struct *flow); NDPI_SELECTION_BITMASK_PROTOCOL_SIZE ndpi_selection_bitmask; u_int16_t ndpi_protocol_id; - u_int8_t detection_feature; }; struct subprotocol_conf_struct { @@ -608,6 +607,16 @@ struct ndpi_detection_module_struct { /* Generic */ +void ndpi_set_bitmask_protocol_detection(char *label, + struct ndpi_detection_module_struct *ndpi_struct, + const u_int32_t idx, + u_int16_t ndpi_protocol_id, + void (*func) (struct ndpi_detection_module_struct *, + struct ndpi_flow_struct *flow), + const NDPI_SELECTION_BITMASK_PROTOCOL_SIZE ndpi_selection_bitmask, + u_int8_t b_save_bitmask_unknow, + u_int8_t b_add_detection_bitmask); + char *strptime(const char *s, const char *format, struct tm *tm); u_int8_t iph_is_valid_and_not_fragmented(const struct ndpi_iphdr *iph, const u_int16_t ipsize); diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 3d40a15a9..6abe3b713 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -272,6 +272,18 @@ typedef struct ndpi_protocol_bitmask_struct { ndpi_ndpi_mask fds_bits[NDPI_NUM_FDS_BITS]; } ndpi_protocol_bitmask_struct_t; + +#define NDPI_MAX_NUM_DISSECTORS 288 /* Multiple of 32, i.e. 8 * sizeof(ndpi_ndpi_mask) */ +#ifdef NDPI_CFFI_PREPROCESSING +#undef NDPI_NUM_FDS_BITS +#define NDPI_NUM_FDS_BITS_DISSECTORS 9 +#else +#define NDPI_NUM_FDS_BITS_DISSECTORS NDPI_MAX_NUM_DISSECTORS / (8 * sizeof(ndpi_ndpi_mask)) +#endif +typedef struct ndpi_dissector_bitmask_struct { + ndpi_ndpi_mask fds_bits[NDPI_NUM_FDS_BITS_DISSECTORS]; +} ndpi_dissector_bitmask_struct_t; + struct ndpi_detection_module_struct; /* NDPI_DEBUG_FUNCTION_PTR (cast) */ @@ -1191,7 +1203,7 @@ typedef struct ndpi_proto_defaults { u_int8_t isClearTextProto:1, isAppProtocol:1, _notused:6; u_int16_t *subprotocols; u_int32_t subprotocol_count; - u_int16_t protoId, protoIdx; + u_int16_t protoId, dissector_idx; u_int16_t tcp_default_ports[MAX_DEFAULT_PORTS], udp_default_ports[MAX_DEFAULT_PORTS]; ndpi_protocol_breed_t protoBreed; ndpi_protocol_qoe_category_t qoeCategory; @@ -1630,8 +1642,7 @@ struct ndpi_flow_struct { /* **Packet** metadata for flows where monitoring is enabled. It is reset after each packet! */ struct ndpi_metadata_monitoring *monit; - /* protocols which have marked a connection as this connection cannot be protocol XXX, multiple u_int64_t */ - NDPI_PROTOCOL_BITMASK excluded_protocol_bitmask; + NDPI_DISSECTOR_BITMASK excluded_dissectors_bitmask; /* NDPI_PROTOCOL_BITTORRENT */ u_int8_t bittorrent_stage; // can be 0 - 255 |