diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2022-01-30 19:18:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-30 19:18:12 +0100 |
commit | 5bb5bec477e1a10a404fd9228ddc0f5041b51123 (patch) | |
tree | 923e8b698416595cf18e853215394fe6c66c8e02 /src/include | |
parent | 1fdcddb33d105a45061da1ceaefcb6a00542322f (diff) |
Remove `struct ndpi_id_struct` (#1427)
Remove the last uses of `struct ndpi_id_struct`.
That code is not really used and it has not been updated for a very long
time: see #1279 for details.
Correlation among flows is achieved via LRU caches.
This change allows to further reduce memory consumption (see also
91bb77a8).
At nDPI 4.0 (more precisly, at a6b10cf, because memory stats
were wrong until that commit):
```
nDPI Memory statistics:
nDPI Memory (once): 221.15 KB
Flow Memory (per flow): 2.94 KB
```
Now:
```
nDPI Memory statistics:
nDPI Memory (once): 235.27 KB
Flow Memory (per flow): 688 B <--------
```
i.e. memory usage per flow has been reduced by 77%.
Close #1279
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ndpi_api.h.in | 22 | ||||
-rw-r--r-- | src/include/ndpi_typedefs.h | 50 |
2 files changed, 2 insertions, 70 deletions
diff --git a/src/include/ndpi_api.h.in b/src/include/ndpi_api.h.in index e0b813597..ed468f6d8 100644 --- a/src/include/ndpi_api.h.in +++ b/src/include/ndpi_api.h.in @@ -36,7 +36,6 @@ extern "C" { */ #define NDPI_API_VERSION @NDPI_API_VERSION@ -#define SIZEOF_ID_STRUCT ( sizeof(struct ndpi_id_struct) ) #define SIZEOF_FLOW_STRUCT ( sizeof(struct ndpi_flow_struct) ) #define NDPI_DETECTION_ONLY_IPV4 ( 1 << 0 ) @@ -76,15 +75,6 @@ extern "C" { /** - * Get the size of the id struct - * - * @return the size of the id struct - * - */ - 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 @@ -303,8 +293,6 @@ extern "C" { * @par packet = unsigned char pointer to the Layer 3 (IP header) * @par packetlen = the length of the packet * @par packet_time_ms = the current timestamp for the packet (expressed in msec) - * @par src = pointer to the source subscriber state machine - * @par dst = pointer to the destination subscriber state machine * @return void * */ @@ -312,9 +300,7 @@ extern "C" { struct ndpi_flow_struct *flow, const unsigned char *packet, const unsigned short packetlen, - const u_int64_t packet_time_ms, - struct ndpi_id_struct *src, - struct ndpi_id_struct *dst); + const u_int64_t packet_time_ms); /** * Processes one packet and returns the ID of the detected protocol. @@ -325,8 +311,6 @@ extern "C" { * @par packet = unsigned char pointer to the Layer 3 (IP header) * @par packetlen = the length of the packet * @par packet_time_ms = the current timestamp for the packet (expressed in msec) - * @par src = pointer to the source subscriber state machine - * @par dst = pointer to the destination subscriber state machine * @return the detected ID of the protocol * */ @@ -334,9 +318,7 @@ extern "C" { struct ndpi_flow_struct *flow, const unsigned char *packet, const unsigned short packetlen, - const u_int64_t packet_time_ms, - struct ndpi_id_struct *src, - struct ndpi_id_struct *dst); + const u_int64_t packet_time_ms); /** * Get the main protocol of the passed flows for the detected module * diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index bdbc622d5..c5e98ec78 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -530,52 +530,6 @@ struct ndpi_lru_cache { struct ndpi_lru_cache_entry *entries; }; -struct ndpi_id_struct { - /** - detected_protocol_bitmask: - access this bitmask to find out whether an id has used skype or not - if a flag is set here, it will not be reset - to compare this, use: - **/ - NDPI_PROTOCOL_BITMASK detected_protocol_bitmask; - - /* NDPI_PROTOCOL_IRC_MAXPORT % 2 must be 0 */ - /* NDPI_PROTOCOL_IRC */ -#define NDPI_PROTOCOL_IRC_MAXPORT 8 - u_int16_t irc_port[NDPI_PROTOCOL_IRC_MAXPORT]; - u_int32_t last_time_port_used[NDPI_PROTOCOL_IRC_MAXPORT]; - u_int32_t irc_ts; - - /* NDPI_PROTOCOL_GNUTELLA */ - u_int32_t gnutella_ts; - - /* NDPI_PROTOCOL_JABBER */ - u_int32_t jabber_stun_or_ft_ts; - - /* NDPI_PROTOCOL_DIRECTCONNECT */ - u_int32_t directconnect_last_safe_access_time; - - /* NDPI_PROTOCOL_DIRECTCONNECT */ - u_int16_t detected_directconnect_port; - u_int16_t detected_directconnect_udp_port; - u_int16_t detected_directconnect_ssl_port; - - /* NDPI_PROTOCOL_JABBER */ -#define JABBER_MAX_STUN_PORTS 6 - u_int16_t jabber_voice_stun_port[JABBER_MAX_STUN_PORTS]; - u_int16_t jabber_file_transfer_port[2]; - - /* NDPI_PROTOCOL_GNUTELLA */ - u_int16_t detected_gnutella_udp_port1; - u_int16_t detected_gnutella_udp_port2; - - /* NDPI_PROTOCOL_IRC */ - u_int8_t irc_number_of_port; - - /* NDPI_PROTOCOL_JABBER */ - u_int8_t jabber_voice_stun_used_ports; -}; - /* ************************************************** */ struct ndpi_flow_tcp_struct { @@ -850,7 +804,6 @@ typedef enum { NDPI_CONFIDENCE_UNKNOWN = 0, /* Unknown classification */ NDPI_CONFIDENCE_MATCH_BY_PORT, /* Classification obtained looking only at the L4 ports */ NDPI_CONFIDENCE_MATCH_BY_IP, /* Classification obtained looking only at the L3 addresses */ - NDPI_CONFIDENCE_DPI_SRC_DST_ID, /* Classification results based on ndpi_id_struct structures */ NDPI_CONFIDENCE_DPI_CACHE, /* Classification results based on same LRU cache (i.e. correlation among sessions) */ NDPI_CONFIDENCE_DPI, /* Deep packet inspection */ @@ -1399,9 +1352,6 @@ struct ndpi_flow_struct { /* NDPI_PROTOCOL_TINC */ u_int8_t tinc_state; struct tinc_cache_entry tinc_cache_entry; - - struct ndpi_id_struct *src; - struct ndpi_id_struct *dst; }; #define NDPI_PROTOCOL_DEFAULT_LEVEL 0 |