From 6298ecc2718a74a7e5c92e57af464d97c3a60bf9 Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 5 Nov 2019 08:21:31 +0000 Subject: Added tunnelling decapsulation --- src/include/ndpi_api.h | 1 + src/include/ndpi_typedefs.h | 7 +++++++ src/lib/ndpi_utils.c | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+) (limited to 'src') diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index a1c33b36e..b049755ab 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -818,6 +818,7 @@ extern "C" { struct ndpi_flow_struct *flow); u_int8_t ndpi_is_safe_ssl_cipher(u_int32_t cipher); const char* ndpi_cipher2str(u_int32_t cipher); + const char* ndpi_tunnel2str(ndpi_packet_tunnel tt); u_int16_t ndpi_guess_host_protocol_id(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); int ndpi_has_human_readeable_string(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 04e439221..1e71ee89e 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -42,6 +42,13 @@ typedef enum { ndpi_l4_proto_tcp_and_udp, } ndpi_l4_proto_info; +typedef enum { + ndpi_no_tunnel = 0, + ndpi_gtp_tunnel, + ndpi_capwap_tunnel, + ndpi_tzsp_tunnel, +} ndpi_packet_tunnel; + /* NDPI_VISIT */ typedef enum { ndpi_preorder, diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index f11f074cd..091cac927 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -1072,3 +1072,25 @@ int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct, } /* ********************************** */ + +const char* ndpi_tunnel2str(ndpi_packet_tunnel tt) { + switch(tt) { + case ndpi_no_tunnel: + return("No-Tunnel"); + break; + + case ndpi_gtp_tunnel: + return("GTP"); + break; + + case ndpi_capwap_tunnel: + return("CAPWAP"); + break; + + case ndpi_tzsp_tunnel: + return("TZSP"); + break; + } +} + +/* ********************************** */ -- cgit v1.2.3