From 5a0f60908671932b6a316f3894cbd6218e77e68c Mon Sep 17 00:00:00 2001 From: Zied Aouini Date: Fri, 21 Feb 2020 15:49:46 +0100 Subject: Add ndpi_flow_tcp_struct and ndpi_flow_udp_struct api calls. --- src/include/ndpi_api.h | 19 +++++++++++++++++++ src/lib/ndpi_main.c | 8 ++++++++ 2 files changed, 27 insertions(+) (limited to 'src') diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index e52993243..d4e940bde 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 struct + * + * @return the size of the flow struct + * + */ + u_int32_t ndpi_detection_get_sizeof_ndpi_flow_tcp_struct(void); + + + /** + * Get the size of the flow struct + * + * @return the size of the flow struct + * + */ + u_int32_t ndpi_detection_get_sizeof_ndpi_flow_udp_struct(void); + + /** * nDPI personal allocation and free functions **/ 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); } -- cgit v1.2.3 From 40896d3d447a919cd2183a0ccd5751d1fc4ad4af Mon Sep 17 00:00:00 2001 From: Zied Aouini Date: Fri, 21 Feb 2020 15:51:17 +0100 Subject: Fix docstrings. --- src/include/ndpi_api.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index d4e940bde..366bec80c 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -80,18 +80,18 @@ extern "C" { /** - * Get the size of the flow struct + * Get the size of the flow tcp struct * - * @return the size of the flow 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 struct + * Get the size of the flow udp struct * - * @return the size of the flow struct + * @return the size of the flow udp struct * */ u_int32_t ndpi_detection_get_sizeof_ndpi_flow_udp_struct(void); -- cgit v1.2.3 From e67604a583d1b1b228dd174d3d3b44bf2f9edc5c Mon Sep 17 00:00:00 2001 From: Zied Aouini Date: Fri, 21 Feb 2020 16:37:36 +0100 Subject: Remove trailing alignment directives. --- src/include/ndpi_typedefs.h | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'src') 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,... */ -- cgit v1.2.3