diff options
author | Luca Deri <lucaderi@users.noreply.github.com> | 2020-02-26 08:05:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-26 08:05:45 +0100 |
commit | a55c410202169d54857c9a736fe365e4ad5657a7 (patch) | |
tree | c2c81c9a64271500bb72c6443c5cc4bd8cf25305 /src | |
parent | f07a3294471de26c83ed9915ad71f8e57e19a854 (diff) | |
parent | dcb6fde0c98ca0965b1362dcd94cc5c90b8e5c15 (diff) |
Merge pull request #848 from aouinizied/dev
nDPI 3.2 support in python cffi bindings
Diffstat (limited to 'src')
-rw-r--r-- | src/include/ndpi_api.h | 19 | ||||
-rw-r--r-- | src/include/ndpi_typedefs.h | 19 | ||||
-rw-r--r-- | src/lib/ndpi_main.c | 8 |
3 files changed, 29 insertions, 17 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index e52993243..366bec80c 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -78,6 +78,25 @@ extern "C" { */ u_int32_t ndpi_detection_get_sizeof_ndpi_id_struct(void); + + /** + * Get the size of the flow tcp struct + * + * @return the size of the flow tcp struct + * + */ + u_int32_t ndpi_detection_get_sizeof_ndpi_flow_tcp_struct(void); + + + /** + * Get the size of the flow udp struct + * + * @return the size of the flow udp struct + * + */ + u_int32_t ndpi_detection_get_sizeof_ndpi_flow_udp_struct(void); + + /** * nDPI personal allocation and free functions **/ diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 98b8ccf8e..56fd44d89 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -712,11 +712,7 @@ struct ndpi_flow_tcp_struct { /* NDPI_PROTOCOL_NEST_LOG_SINK */ u_int8_t nest_log_sink_matches; -} -#ifndef WIN32 - __attribute__ ((__packed__)) -#endif - ; +}; /* ************************************************** */ @@ -771,11 +767,7 @@ struct ndpi_flow_udp_struct { /* NDPI_PROTOCOL_WIREGUARD */ u_int8_t wireguard_stage; u_int32_t wireguard_peer_index[2]; -} -#ifndef WIN32 - __attribute__ ((__packed__)) -#endif - ; +}; /* ************************************************** */ @@ -799,10 +791,6 @@ struct ndpi_packet_struct { u_int16_t detected_protocol_stack[NDPI_PROTOCOL_SIZE]; u_int8_t detected_subprotocol_stack[NDPI_PROTOCOL_SIZE]; - -#ifndef WIN32 - __attribute__ ((__packed__)) -#endif u_int16_t protocol_stack_info; struct ndpi_int_one_line_struct line[NDPI_MAX_PARSE_LINES_PER_PACKET]; @@ -1145,9 +1133,6 @@ typedef enum { struct ndpi_flow_struct { u_int16_t detected_protocol_stack[NDPI_PROTOCOL_SIZE]; -#ifndef WIN32 - __attribute__ ((__packed__)) -#endif u_int16_t protocol_stack_info; /* init parameter, internal used to set up timestamp,... */ diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index af6811b25..21491c5e7 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -165,6 +165,14 @@ u_int32_t ndpi_detection_get_sizeof_ndpi_id_struct(void) { return(sizeof(struct /* *********************************************************************************** */ +u_int32_t ndpi_detection_get_sizeof_ndpi_flow_tcp_struct(void) { return(sizeof(struct ndpi_flow_tcp_struct)); } + +/* *********************************************************************************** */ + +u_int32_t ndpi_detection_get_sizeof_ndpi_flow_udp_struct(void) { return(sizeof(struct ndpi_flow_udp_struct)); } + +/* *********************************************************************************** */ + char * ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_str, u_int id) { return((id >= ndpi_str->ndpi_num_supported_protocols) ? NULL : ndpi_str->proto_defaults[id].protoName); } |