diff options
author | Toni <matzeton@googlemail.com> | 2021-03-23 11:46:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-23 11:46:12 +0100 |
commit | b04040768323a7666bcf588f2323054082883d75 (patch) | |
tree | a3368d0b9386d3ffdb5a6e8ca8ba4032e76da606 /python | |
parent | 0cae9bf4a4fe16c988c0ec16c4c3894f3597f40c (diff) |
Refactored nDPI subprotocol handling and aimini protocol detection. (#1156)
* Refactored and merged callback buffer routines for non-udp-tcp / udp / tcp / tcp-wo-payload.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
* Try to detect one subprotocol if a detected protocol can have one.
* This adds a performance overhead due to much more protocol detection routine calls.
See #1148 for more information.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
* Refactor subprotocol handling (1/2).
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
* Refactor subprotocol handling (2/2).
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
* Prevent some code duplication by using macros for ndpi_int_one_line_struct string comparision.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
* Refactored aimini HTTP detection parts (somehow related to #1148).
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
* Added aimini client/server test pcap.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
* Removed master protocol as it was only used for STUN and via also removed API function ndpi_get_protocol_id_master_proto
* Adjusted Python code to conform to the changes made during the refactoring process.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'python')
-rw-r--r-- | python/ndpi.py | 5 | ||||
-rw-r--r-- | python/ndpi_typestruct.py | 6 |
2 files changed, 4 insertions, 7 deletions
diff --git a/python/ndpi.py b/python/ndpi.py index c545e7998..f8b2c0a6a 100644 --- a/python/ndpi.py +++ b/python/ndpi.py @@ -716,7 +716,6 @@ struct ndpi_packet_struct { uint64_t current_time_ms; uint16_t detected_protocol_stack[2]; - uint8_t detected_subprotocol_stack[2]; uint16_t protocol_stack_info; struct ndpi_int_one_line_struct line[64]; @@ -870,9 +869,9 @@ typedef enum { typedef struct ndpi_proto_defaults { char *protoName; ndpi_protocol_category_t protoCategory; - uint8_t can_have_a_subprotocol; + u_int16_t * subprotocols; + size_t subprotocol_count; uint16_t protoId, protoIdx; - uint16_t master_tcp_protoId[2], master_udp_protoId[2]; /* The main protocols on which this sub-protocol sits on */ uint16_t tcp_default_ports[5], udp_default_ports[5]; ndpi_protocol_breed_t protoBreed; void (*func) (struct ndpi_detection_module_struct *, struct ndpi_flow_struct *flow); diff --git a/python/ndpi_typestruct.py b/python/ndpi_typestruct.py index 743f52ed2..b983a660c 100644 --- a/python/ndpi_typestruct.py +++ b/python/ndpi_typestruct.py @@ -94,11 +94,10 @@ class NDPIProtoDefaultsT(Structure): _fields_ = [ ("protoName", c_char_p), ("protoCategory", c_uint), - ("can_have_a_subprotocol", c_uint8), + ("subprotocols", c_uint16_p), + ("subprotocol_count", c_uint32), ("protoId", c_uint16), ("protoIdx", c_uint16), - ("master_tcp_protoId", c_uint16 * 2), - ("master_udp_protoId", c_uint16 * 2), ("protoBreed", c_uint), ("func", CFUNCTYPE(None, POINTER(NDPIDetectionModuleStruct), POINTER(NDPIFlowStruct))), ] @@ -653,7 +652,6 @@ class NDPIUdpHdr(Structure): class NDPIPacketStructStack(Structure): _pack_ = 1 _fields_ = [ - ('detected_subprotocol_stack', c_uint8 * ndpi.ndpi_wrap_ndpi_procol_size()), ('protocol_stack_info', c_uint16) ] |