From 276adfdf44b9b0924b6ae4415d9023e887ec31da Mon Sep 17 00:00:00 2001 From: Nardi Ivan Date: Sun, 5 Nov 2023 15:22:00 +0100 Subject: [PATCH] Have a clear distinction between public and private/internal API 1) Public API/headers in `src/include/` [as it has always been] 2) Private API/headers in `src/lib/` Try to keep the "ndpi_" prefix only for the public functions --- fuzz/Makefile.am | 8 +- fuzz/fuzz_is_stun.c | 3 +- fuzz/fuzz_quic_get_crypto_data.c | 17 +- fuzz/fuzz_tls_certificate.c | 6 +- python/ndpi/ndpi_build.py | 5 +- src/include/ndpi_typedefs.h | 276 ------------------- src/lib/Makefile.in | 2 +- src/lib/ndpi_geoip.c | 1 + src/lib/ndpi_main.c | 104 ++++--- src/lib/ndpi_private.h | 359 +++++++++++++++++++++++++ src/lib/ndpi_utils.c | 1 + src/lib/protocols/activision.c | 1 + src/lib/protocols/afp.c | 1 + src/lib/protocols/ajp.c | 1 + src/lib/protocols/alicloud.c | 1 + src/lib/protocols/amazon_video.c | 1 + src/lib/protocols/among_us.c | 1 + src/lib/protocols/amqp.c | 1 + src/lib/protocols/apple_push.c | 1 + src/lib/protocols/armagetron.c | 1 + src/lib/protocols/avast.c | 1 + src/lib/protocols/avast_securedns.c | 1 + src/lib/protocols/bacnet.c | 1 + src/lib/protocols/bgp.c | 1 + src/lib/protocols/bitcoin.c | 1 + src/lib/protocols/bittorrent.c | 5 +- src/lib/protocols/bjnp.c | 1 + src/lib/protocols/can.c | 1 + src/lib/protocols/capwap.c | 1 + src/lib/protocols/cassandra.c | 1 + src/lib/protocols/checkmk.c | 1 + src/lib/protocols/ciscovpn.c | 1 + src/lib/protocols/citrix.c | 1 + src/lib/protocols/coap.c | 1 + src/lib/protocols/collectd.c | 1 + src/lib/protocols/corba.c | 1 + src/lib/protocols/cpha.c | 1 + src/lib/protocols/crossfire.c | 1 + src/lib/protocols/crynet.c | 1 + src/lib/protocols/csgo.c | 1 + src/lib/protocols/dcerpc.c | 1 + src/lib/protocols/dhcp.c | 1 + src/lib/protocols/dhcpv6.c | 1 + src/lib/protocols/diameter.c | 1 + src/lib/protocols/discord.c | 1 + src/lib/protocols/dnp3.c | 1 + src/lib/protocols/dns.c | 5 +- src/lib/protocols/dnscrypt.c | 1 + src/lib/protocols/dofus.c | 1 + src/lib/protocols/drda.c | 1 + src/lib/protocols/dropbox.c | 1 + src/lib/protocols/eaq.c | 1 + src/lib/protocols/edonkey.c | 1 + src/lib/protocols/elastic_search.c | 1 + src/lib/protocols/epicgames.c | 1 + src/lib/protocols/ethereum.c | 1 + src/lib/protocols/ethernet_ip.c | 1 + src/lib/protocols/fastcgi.c | 1 + src/lib/protocols/fix.c | 1 + src/lib/protocols/ftp_control.c | 5 +- src/lib/protocols/ftp_data.c | 1 + src/lib/protocols/genshin_impact.c | 1 + src/lib/protocols/git.c | 1 + src/lib/protocols/gnutella.c | 1 + src/lib/protocols/gtp.c | 1 + src/lib/protocols/guildwars.c | 1 + src/lib/protocols/h323.c | 1 + src/lib/protocols/halflife2_and_mods.c | 1 + src/lib/protocols/haproxy.c | 1 + src/lib/protocols/hots.c | 1 + src/lib/protocols/hpvirtgrp.c | 1 + src/lib/protocols/hsrp.c | 1 + src/lib/protocols/http.c | 4 +- src/lib/protocols/http2.c | 1 + src/lib/protocols/i3d.c | 1 + src/lib/protocols/iax.c | 1 + src/lib/protocols/icecast.c | 8 +- src/lib/protocols/iec60870-5-104.c | 1 + src/lib/protocols/imo.c | 1 + src/lib/protocols/ipp.c | 1 + src/lib/protocols/ipsec.c | 1 + src/lib/protocols/irc.c | 1 + src/lib/protocols/jabber.c | 1 + src/lib/protocols/kakaotalk_voice.c | 1 + src/lib/protocols/kerberos.c | 1 + src/lib/protocols/kismet.c | 1 + src/lib/protocols/kontiki.c | 1 + src/lib/protocols/ldap.c | 1 + src/lib/protocols/line.c | 3 +- src/lib/protocols/lisp.c | 1 + src/lib/protocols/lotus_notes.c | 1 + src/lib/protocols/mail_imap.c | 4 +- src/lib/protocols/mail_pop.c | 4 +- src/lib/protocols/mail_smtp.c | 3 +- src/lib/protocols/maplestory.c | 1 + src/lib/protocols/megaco.c | 1 + src/lib/protocols/memcached.c | 1 + src/lib/protocols/merakicloud.c | 1 + src/lib/protocols/mgcp.c | 1 + src/lib/protocols/mining.c | 1 + src/lib/protocols/modbus.c | 1 + src/lib/protocols/mongodb.c | 1 + src/lib/protocols/mpegdash.c | 1 + src/lib/protocols/mpegts.c | 1 + src/lib/protocols/mqtt.c | 1 + src/lib/protocols/mssql_tds.c | 1 + src/lib/protocols/munin.c | 1 + src/lib/protocols/mysql.c | 1 + src/lib/protocols/natpmp.c | 1 + src/lib/protocols/nats.c | 1 + src/lib/protocols/nest_log_sink.c | 1 + src/lib/protocols/netbios.c | 1 + src/lib/protocols/netflow.c | 1 + src/lib/protocols/nfs.c | 1 + src/lib/protocols/nintendo.c | 1 + src/lib/protocols/noe.c | 1 + src/lib/protocols/non_tcp_udp.c | 1 + src/lib/protocols/ntp.c | 1 + src/lib/protocols/oicq.c | 1 + src/lib/protocols/ookla.c | 1 + src/lib/protocols/openvpn.c | 1 + src/lib/protocols/oracle.c | 1 + src/lib/protocols/postgres.c | 1 + src/lib/protocols/ppstream.c | 1 + src/lib/protocols/pptp.c | 1 + src/lib/protocols/protobuf.c | 1 + src/lib/protocols/qq.c | 1 + src/lib/protocols/quic.c | 9 +- src/lib/protocols/radius.c | 1 + src/lib/protocols/raknet.c | 1 + src/lib/protocols/rdp.c | 1 + src/lib/protocols/redis_net.c | 1 + src/lib/protocols/riotgames.c | 1 + src/lib/protocols/rmcp.c | 1 + src/lib/protocols/rsh.c | 1 + src/lib/protocols/rsync.c | 1 + src/lib/protocols/rtcp.c | 1 + src/lib/protocols/rtmp.c | 1 + src/lib/protocols/rtp.c | 1 + src/lib/protocols/rtsp.c | 1 + src/lib/protocols/rx.c | 1 + src/lib/protocols/s7comm.c | 1 + src/lib/protocols/sd_rtn.c | 1 + src/lib/protocols/sflow.c | 1 + src/lib/protocols/sip.c | 1 + src/lib/protocols/skinny.c | 1 + src/lib/protocols/skype.c | 1 + src/lib/protocols/slp.c | 1 + src/lib/protocols/smb.c | 1 + src/lib/protocols/smpp.c | 1 + src/lib/protocols/snmp_proto.c | 1 + src/lib/protocols/soap.c | 1 + src/lib/protocols/socks45.c | 1 + src/lib/protocols/softether.c | 1 + src/lib/protocols/someip.c | 1 + src/lib/protocols/source_engine.c | 1 + src/lib/protocols/spotify.c | 1 + src/lib/protocols/ssdp.c | 1 + src/lib/protocols/ssh.c | 1 + src/lib/protocols/starcraft.c | 1 + src/lib/protocols/steam.c | 1 + src/lib/protocols/stun.c | 8 +- src/lib/protocols/syncthing.c | 1 + src/lib/protocols/syslog.c | 1 + src/lib/protocols/tailscale.c | 1 + src/lib/protocols/tcp_udp.c | 1 + src/lib/protocols/teamspeak.c | 1 + src/lib/protocols/teamviewer.c | 1 + src/lib/protocols/telegram.c | 1 + src/lib/protocols/telnet.c | 1 + src/lib/protocols/teredo.c | 1 + src/lib/protocols/tftp.c | 1 + src/lib/protocols/threema.c | 1 + src/lib/protocols/thrift.c | 1 + src/lib/protocols/tinc.c | 1 + src/lib/protocols/tivoconnect.c | 1 + src/lib/protocols/tls.c | 14 +- src/lib/protocols/tocaboca.c | 1 + src/lib/protocols/tplink_shp.c | 1 + src/lib/protocols/tuya_lp.c | 1 + src/lib/protocols/tvuplayer.c | 1 + src/lib/protocols/ubntac2.c | 1 + src/lib/protocols/ultrasurf.c | 1 + src/lib/protocols/usenet.c | 1 + src/lib/protocols/vhua.c | 1 + src/lib/protocols/viber.c | 1 + src/lib/protocols/vmware.c | 1 + src/lib/protocols/vnc.c | 1 + src/lib/protocols/vxlan.c | 1 + src/lib/protocols/warcraft3.c | 1 + src/lib/protocols/websocket.c | 1 + src/lib/protocols/whatsapp.c | 1 + src/lib/protocols/whoisdas.c | 1 + src/lib/protocols/wireguard.c | 1 + src/lib/protocols/world_of_kung_fu.c | 1 + src/lib/protocols/world_of_warcraft.c | 1 + src/lib/protocols/wsd.c | 1 + src/lib/protocols/xbox.c | 1 + src/lib/protocols/xdmcp.c | 1 + src/lib/protocols/xiaomi.c | 1 + src/lib/protocols/z3950.c | 1 + src/lib/protocols/zabbix.c | 1 + src/lib/protocols/zattoo.c | 1 + src/lib/protocols/zeromq.c | 1 + windows/nDPI.vcxproj | 7 +- windows/nDPI.vcxproj.filters | 3 +- 206 files changed, 621 insertions(+), 424 deletions(-) create mode 100644 src/lib/ndpi_private.h diff --git a/fuzz/Makefile.am b/fuzz/Makefile.am index 2cb21cc21cc..3e4cb087f45 100644 --- a/fuzz/Makefile.am +++ b/fuzz/Makefile.am @@ -65,7 +65,7 @@ fuzz_ndpi_reader_payload_analyzer_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTO $(fuzz_ndpi_reader_payload_analyzer_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@ fuzz_quic_get_crypto_data_SOURCES = fuzz_quic_get_crypto_data.c fuzz_common_code.c -fuzz_quic_get_crypto_data_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS) +fuzz_quic_get_crypto_data_CFLAGS = -I../src/lib/ @NDPI_CFLAGS@ $(CXXFLAGS) -DNDPI_LIB_COMPILATION fuzz_quic_get_crypto_data_LDADD = ../src/lib/libndpi.a $(ADDITIONAL_LIBS) fuzz_quic_get_crypto_data_LDFLAGS = $(LIBS) if HAS_FUZZLDFLAGS @@ -387,7 +387,7 @@ fuzz_binaryfusefilter_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(fuzz_binaryfusefilter_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@ fuzz_tls_certificate_SOURCES = fuzz_tls_certificate.c fuzz_common_code.c -fuzz_tls_certificate_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS) +fuzz_tls_certificate_CFLAGS = -I../src/lib/ @NDPI_CFLAGS@ $(CXXFLAGS) -DNDPI_LIB_COMPILATION fuzz_tls_certificate_LDADD = ../src/lib/libndpi.a $(ADDITIONAL_LIBS) fuzz_tls_certificate_LDFLAGS = $(LIBS) if HAS_FUZZLDFLAGS @@ -413,7 +413,7 @@ fuzz_dga_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(fuzz_dga_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@ fuzz_is_stun_udp_SOURCES = fuzz_is_stun.c fuzz_common_code.c -fuzz_is_stun_udp_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS) +fuzz_is_stun_udp_CFLAGS = -I../src/lib/ @NDPI_CFLAGS@ $(CXXFLAGS) -DNDPI_LIB_COMPILATION fuzz_is_stun_udp_LDADD = ../src/lib/libndpi.a $(ADDITIONAL_LIBS) fuzz_is_stun_udp_LDFLAGS = $(LIBS) if HAS_FUZZLDFLAGS @@ -426,7 +426,7 @@ fuzz_is_stun_udp_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(fuzz_is_stun_udp_LDFLAGS) @NDPI_LDFLAGS@ $(LDFLAGS) -o $@ fuzz_is_stun_tcp_SOURCES = fuzz_is_stun.c fuzz_common_code.c -fuzz_is_stun_tcp_CFLAGS = @NDPI_CFLAGS@ $(CXXFLAGS) -DSTUN_TCP +fuzz_is_stun_tcp_CFLAGS = -I../src/lib/ @NDPI_CFLAGS@ $(CXXFLAGS) -DNDPI_LIB_COMPILATION -DSTUN_TCP fuzz_is_stun_tcp_LDADD = ../src/lib/libndpi.a $(ADDITIONAL_LIBS) fuzz_is_stun_tcp_LDFLAGS = $(LIBS) if HAS_FUZZLDFLAGS diff --git a/fuzz/fuzz_is_stun.c b/fuzz/fuzz_is_stun.c index b8b80c09715..1b1eb2639b7 100644 --- a/fuzz/fuzz_is_stun.c +++ b/fuzz/fuzz_is_stun.c @@ -1,6 +1,5 @@ -#define NDPI_LIB_COMPILATION - #include "ndpi_api.h" +#include "ndpi_private.h" #include "fuzz_common_code.h" static struct ndpi_detection_module_struct *ndpi_struct = NULL; diff --git a/fuzz/fuzz_quic_get_crypto_data.c b/fuzz/fuzz_quic_get_crypto_data.c index 7c783799b86..86a2ec32fff 100644 --- a/fuzz/fuzz_quic_get_crypto_data.c +++ b/fuzz/fuzz_quic_get_crypto_data.c @@ -1,4 +1,5 @@ #include "ndpi_api.h" +#include "ndpi_private.h" #include "fuzz_common_code.h" #include @@ -7,20 +8,6 @@ struct ndpi_detection_module_struct *ndpi_info_mod = NULL; struct ndpi_flow_struct *flow = NULL; -extern const uint8_t *get_crypto_data(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow, - u_int8_t *clear_payload, uint32_t clear_payload_len, - uint64_t *crypto_data_len); -extern void process_tls(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow, - const u_int8_t *crypto_data, uint32_t crypto_data_len, - uint32_t version); -extern void process_chlo(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow, - const u_int8_t *crypto_data, uint32_t crypto_data_len); -extern int is_version_with_tls(uint32_t version); - - int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { const u_int8_t *crypto_data; uint64_t crypto_data_len; @@ -56,7 +43,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { if(!is_version_with_tls(version)) { process_chlo(ndpi_info_mod, flow, crypto_data, crypto_data_len); } else { - process_tls(ndpi_info_mod, flow, crypto_data, crypto_data_len, version); + process_tls(ndpi_info_mod, flow, crypto_data, crypto_data_len); } } diff --git a/fuzz/fuzz_tls_certificate.c b/fuzz/fuzz_tls_certificate.c index bcbdd0e6069..0843a30fe2e 100644 --- a/fuzz/fuzz_tls_certificate.c +++ b/fuzz/fuzz_tls_certificate.c @@ -1,14 +1,10 @@ -#define NDPI_LIB_COMPILATION - #include "ndpi_api.h" +#include "ndpi_private.h" #include "fuzz_common_code.h" #include #include -extern void processCertificateElements(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow, - u_int16_t p_offset, u_int16_t certificate_len); struct ndpi_tcphdr tcph; struct ndpi_iphdr iph; struct ndpi_ipv6hdr iphv6; diff --git a/python/ndpi/ndpi_build.py b/python/ndpi/ndpi_build.py index ba1d68a63c8..84c1e04e47a 100644 --- a/python/ndpi/ndpi_build.py +++ b/python/ndpi/ndpi_build.py @@ -91,9 +91,6 @@ ).stdout.decode('utf-8', errors='ignore') -NDPI_MODULE_STRUCT_CDEF = NDPI_CDEF.split("//CFFI.NDPI_MODULE_STRUCT")[1] - - NDPI_PACKED = subprocess.run(["gcc", "-DNDPI_LIB_COMPILATION", "-DNDPI_CFFI_PREPROCESSING", "-E", "-x", "c", "-P", "-C", @@ -104,7 +101,7 @@ NDPI_PACKED_STRUCTURES = NDPI_PACKED.split("//CFFI.NDPI_PACKED_STRUCTURES")[1] -NDPI_SOURCE = NDPI_INCLUDES + NDPI_MODULE_STRUCT_CDEF + NDPI_HELPERS +NDPI_SOURCE = NDPI_INCLUDES + NDPI_HELPERS ffi_builder.set_source("_ndpi", diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 26fcf0be394..68e0365b479 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -942,45 +942,9 @@ struct ndpi_flow_udp_struct { /* ************************************************** */ -#define LINE_EQUALS(ndpi_int_one_line_struct, string_to_compare) \ - ((ndpi_int_one_line_struct).len == strlen(string_to_compare) && \ - LINE_CMP(ndpi_int_one_line_struct, string_to_compare, strlen(string_to_compare)) == 1) - -#define LINE_STARTS(ndpi_int_one_line_struct, string_to_compare) \ - ((ndpi_int_one_line_struct).len >= strlen(string_to_compare) && \ - LINE_CMP(ndpi_int_one_line_struct, string_to_compare, strlen(string_to_compare)) == 1) - -#define LINE_ENDS(ndpi_int_one_line_struct, string_to_compare) \ - ((ndpi_int_one_line_struct).len >= strlen(string_to_compare) && \ - memcmp((ndpi_int_one_line_struct).ptr + \ - ((ndpi_int_one_line_struct).len - strlen(string_to_compare)), \ - string_to_compare, strlen(string_to_compare)) == 0) - -#define LINE_CMP(ndpi_int_one_line_struct, string_to_compare, string_to_compare_length) \ - ((ndpi_int_one_line_struct).ptr != NULL && \ - memcmp((ndpi_int_one_line_struct).ptr, string_to_compare, string_to_compare_length) == 0) - -struct ndpi_int_one_line_struct { - const u_int8_t *ptr; - u_int16_t len; -}; - struct ndpi_detection_module_struct; struct ndpi_flow_struct; -struct ndpi_call_function_struct { - NDPI_PROTOCOL_BITMASK detection_bitmask; - NDPI_PROTOCOL_BITMASK excluded_protocol_bitmask; - void (*func) (struct ndpi_detection_module_struct *, struct ndpi_flow_struct *flow); - NDPI_SELECTION_BITMASK_PROTOCOL_SIZE ndpi_selection_bitmask; - u_int16_t ndpi_protocol_id; - u_int8_t detection_feature; -}; - -struct ndpi_subprotocol_conf_struct { - void (*func) (struct ndpi_detection_module_struct *, char *attr, char *value, int protocol_id); -}; - typedef struct { u_int16_t port_low, port_high; } ndpi_port_range; @@ -1130,11 +1094,6 @@ typedef struct ndpi_proto_defaults { void (*func) (struct ndpi_detection_module_struct *, struct ndpi_flow_struct *flow); } ndpi_proto_defaults_t; -typedef struct ndpi_default_ports_tree_node { - ndpi_proto_defaults_t *proto; - u_int8_t customUserProto; - u_int16_t default_port; -} ndpi_default_ports_tree_node_t; typedef struct _ndpi_automa { void *ac_automa; /* Real type is AC_AUTOMATA_t */ @@ -1183,241 +1142,6 @@ typedef struct { } classes[MAX_NUM_NDPI_DOMAIN_CLASSIFICATIONS]; } ndpi_domain_classify; -#ifdef NDPI_LIB_COMPILATION - -/* Needed to have access to HAVE_* defines */ -#ifndef _NDPI_CONFIG_H_ -#include "ndpi_config.h" -#define _NDPI_CONFIG_H_ -#endif - -/* PLEASE DO NOT REMOVE OR CHANGE THE ORDER OF WHAT IS DELIMITED BY CFFI.NDPI_MODULE_STRUCT FLAG AS IT IS USED FOR - PYTHON BINDINGS AUTO GENERATION */ -//CFFI.NDPI_MODULE_STRUCT - -typedef struct ndpi_list_struct { - char *value; - struct ndpi_list_struct *next; -} ndpi_list; - -#ifdef HAVE_NBPF -typedef struct { - void *tree; /* cast to nbpf_filter* */ - u_int16_t l7_protocol; -} nbpf_filter; -#endif - -struct ndpi_packet_struct { - const struct ndpi_iphdr *iph; - const struct ndpi_ipv6hdr *iphv6; - const struct ndpi_tcphdr *tcp; - const struct ndpi_udphdr *udp; - const u_int8_t *generic_l4_ptr; /* is set only for non tcp-udp traffic */ - const u_int8_t *payload; - - u_int64_t current_time_ms; - - struct ndpi_int_one_line_struct line[NDPI_MAX_PARSE_LINES_PER_PACKET]; - /* HTTP headers */ - struct ndpi_int_one_line_struct host_line; - struct ndpi_int_one_line_struct forwarded_line; - struct ndpi_int_one_line_struct referer_line; - struct ndpi_int_one_line_struct content_line; - struct ndpi_int_one_line_struct content_disposition_line; - struct ndpi_int_one_line_struct accept_line; - struct ndpi_int_one_line_struct authorization_line; - struct ndpi_int_one_line_struct user_agent_line; - struct ndpi_int_one_line_struct http_url_name; - struct ndpi_int_one_line_struct http_encoding; - struct ndpi_int_one_line_struct http_transfer_encoding; - struct ndpi_int_one_line_struct http_contentlen; - struct ndpi_int_one_line_struct http_cookie; - struct ndpi_int_one_line_struct http_origin; - struct ndpi_int_one_line_struct http_x_session_type; - struct ndpi_int_one_line_struct server_line; - struct ndpi_int_one_line_struct http_method; - struct ndpi_int_one_line_struct http_response; /* the first "word" in this pointer is the - response code in the packet (200, etc) */ - u_int8_t http_num_headers; /* number of found (valid) header lines in HTTP request or response */ - - u_int16_t l3_packet_len; - u_int16_t payload_packet_len; - u_int16_t parsed_lines; - u_int16_t empty_line_position; - u_int8_t tcp_retransmission; - - u_int8_t packet_lines_parsed_complete:1, - packet_direction:1, empty_line_position_set:1, http_check_content:1, pad:4; -}; - -struct ndpi_detection_module_struct { - NDPI_PROTOCOL_BITMASK detection_bitmask; - - u_int64_t current_ts; - u_int16_t max_packets_to_process; - u_int16_t num_tls_blocks_to_follow; - u_int8_t skip_tls_blocks_until_change_cipher:1, enable_ja3_plus:1, _notused:6; - u_int8_t tls_certificate_expire_in_x_days; - - void *user_data; - char custom_category_labels[NUM_CUSTOM_CATEGORIES][CUSTOM_CATEGORY_LABEL_LEN]; - - /* callback function buffer */ - struct ndpi_call_function_struct *callback_buffer; - struct ndpi_call_function_struct *callback_buffer_tcp_no_payload; - struct ndpi_call_function_struct *callback_buffer_tcp_payload; - struct ndpi_call_function_struct *callback_buffer_udp; - struct ndpi_call_function_struct *callback_buffer_non_tcp_udp; - u_int32_t callback_buffer_size; - u_int32_t callback_buffer_size_tcp_no_payload; - u_int32_t callback_buffer_size_tcp_payload; - u_int32_t callback_buffer_size_udp; - u_int32_t callback_buffer_size_non_tcp_udp; - - ndpi_default_ports_tree_node_t *tcpRoot, *udpRoot; - - ndpi_log_level_t ndpi_log_level; /* default error */ - -#ifdef NDPI_ENABLE_DEBUG_MESSAGES - /* debug callback, only set when debug is used */ - ndpi_debug_function_ptr ndpi_debug_printf; - const char *ndpi_debug_print_file; - const char *ndpi_debug_print_function; - u_int32_t ndpi_debug_print_line; - NDPI_PROTOCOL_BITMASK debug_bitmask; -#endif - - /* misc parameters */ - u_int32_t tcp_max_retransmission_window_size; - - /* subprotocol registration handler */ - struct ndpi_subprotocol_conf_struct subprotocol_conf[NDPI_MAX_SUPPORTED_PROTOCOLS + 1]; - - u_int ndpi_num_supported_protocols; - u_int ndpi_num_custom_protocols; - - int ac_automa_finalized; - /* HTTP/DNS/HTTPS/QUIC host matching */ - ndpi_automa host_automa, /* Used for DNS/HTTPS */ - risky_domain_automa, tls_cert_subject_automa, - host_risk_mask_automa, common_alpns_automa; - /* IMPORTANT: please, whenever you add a new automa: - * update ndpi_finalize_initialization() - * update automa_type above - */ - - ndpi_str_hash *malicious_ja3_hashmap, *malicious_sha1_hashmap; - - ndpi_list *trusted_issuer_dn; - - /* Patricia trees */ - ndpi_patricia_tree_t *ip_risk_mask_ptree; - ndpi_patricia_tree_t *ip_risk_mask_ptree6; - ndpi_patricia_tree_t *ip_risk_ptree; - ndpi_patricia_tree_t *ip_risk_ptree6; - ndpi_patricia_tree_t *protocols_ptree; /* IP-based protocol detection */ - ndpi_patricia_tree_t *protocols_ptree6; - - /* *** If you add a new Patricia tree, please update ptree_type above! *** */ - - struct { -#ifdef USE_LEGACY_AHO_CORASICK - ndpi_automa hostnames, hostnames_shadow; -#else - ndpi_domain_classify *sc_hostnames, *sc_hostnames_shadow; -#endif - void *ipAddresses, *ipAddresses_shadow; /* Patricia */ - void *ipAddresses6, *ipAddresses6_shadow; /* Patricia IPv6*/ - u_int8_t categories_loaded; - } custom_categories; - - u_int8_t ip_version_limit; - - /* NDPI_PROTOCOL_TINC */ - struct cache *tinc_cache; - - /* NDPI_PROTOCOL_OOKLA */ - struct ndpi_lru_cache *ookla_cache; - u_int32_t ookla_cache_num_entries; - u_int32_t ookla_cache_ttl; - - /* NDPI_PROTOCOL_BITTORRENT */ - struct ndpi_lru_cache *bittorrent_cache; - u_int32_t bittorrent_cache_num_entries; - u_int32_t bittorrent_cache_ttl; - - /* NDPI_PROTOCOL_ZOOM */ - struct ndpi_lru_cache *zoom_cache; - u_int32_t zoom_cache_num_entries; - u_int32_t zoom_cache_ttl; - - /* NDPI_PROTOCOL_STUN and subprotocols */ - struct ndpi_lru_cache *stun_cache; - u_int32_t stun_cache_num_entries; - u_int32_t stun_cache_ttl; - struct ndpi_lru_cache *stun_zoom_cache; - u_int32_t stun_zoom_cache_num_entries; - u_int32_t stun_zoom_cache_ttl; - - /* NDPI_PROTOCOL_TLS and subprotocols */ - struct ndpi_lru_cache *tls_cert_cache; - u_int32_t tls_cert_cache_num_entries; - int32_t tls_cert_cache_ttl; - - /* NDPI_PROTOCOL_MINING and subprotocols */ - struct ndpi_lru_cache *mining_cache; - u_int32_t mining_cache_num_entries; - u_int32_t mining_cache_ttl; - - /* NDPI_PROTOCOL_MSTEAMS */ - struct ndpi_lru_cache *msteams_cache; - u_int32_t msteams_cache_num_entries; - u_int32_t msteams_cache_ttl; - - /* *** If you add a new LRU cache, please update lru_cache_type above! *** */ - - int opportunistic_tls_smtp_enabled; - int opportunistic_tls_imap_enabled; - int opportunistic_tls_pop_enabled; - int opportunistic_tls_ftp_enabled; - int opportunistic_tls_stun_enabled; - - u_int32_t monitoring_stun_pkts_to_process; - u_int32_t monitoring_stun_flags; - - u_int32_t aggressiveness_ookla; - - int tcp_ack_paylod_heuristic; - int fully_encrypted_based_on_first_pkt_heuristic; - - u_int16_t ndpi_to_user_proto_id[NDPI_MAX_NUM_CUSTOM_PROTOCOLS]; /* custom protocolId mapping */ - ndpi_proto_defaults_t proto_defaults[NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS]; - - u_int8_t direction_detect_disable:1, /* disable internal detection of packet direction */ _pad:7; - -#ifdef CUSTOM_NDPI_PROTOCOLS - #include "../../../nDPI-custom/custom_ndpi_typedefs.h" -#endif - - /* GeoIP */ - void *mmdb_city, *mmdb_as; - u_int8_t mmdb_city_loaded, mmdb_as_loaded; - - /* Current packet */ - struct ndpi_packet_struct packet; - const struct ndpi_flow_input_info *input_info; - -#ifdef HAVE_NBPF - u_int8_t num_nbpf_custom_proto; - nbpf_filter nbpf_custom_proto[MAX_NBPF_CUSTOM_PROTO]; -#endif - - u_int16_t max_payload_track_len; -}; - -#endif /* NDPI_LIB_COMPILATION */ -//CFFI.NDPI_MODULE_STRUCT - typedef enum { ndpi_cipher_safe = NDPI_CIPHER_SAFE, ndpi_cipher_weak = NDPI_CIPHER_WEAK, diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index 4cfb6283e94..918547ad08c 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -22,7 +22,7 @@ LDFLAGS += @NDPI_LDFLAGS@ LIBS = @ADDITIONAL_LIBS@ @LIBS@ @GPROF_LIBS@ OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) $(patsubst third_party/src/hll/%.c, third_party/src/hll/%.o, $(wildcard third_party/src/hll/*.c)) $(patsubst ./%.c, ./%.o, $(wildcard ./*.c)) -HEADERS = $(wildcard ../include/*.h) $(wildcard ../include/*.h) +HEADERS = $(wildcard ../include/*.h) $(wildcard *.h) NDPI_VERSION_MAJOR = @NDPI_MAJOR@ NDPI_LIB_STATIC = libndpi.a NDPI_LIB_SHARED_BASE = libndpi.so diff --git a/src/lib/ndpi_geoip.c b/src/lib/ndpi_geoip.c index c3308b48bba..599eaf6e0fc 100644 --- a/src/lib/ndpi_geoip.c +++ b/src/lib/ndpi_geoip.c @@ -27,6 +27,7 @@ #include #include "ndpi_api.h" +#include "ndpi_private.h" #include "ndpi_config.h" #ifdef HAVE_MAXMINDDB diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index eaffe2056cb..c7110c802ef 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -33,6 +33,7 @@ #include "ndpi_config.h" #include "ndpi_api.h" +#include "ndpi_private.h" #include "ahocorasick.h" #include "libcache.h" @@ -208,21 +209,10 @@ _Static_assert(sizeof(ndpi_known_risks) / sizeof(ndpi_risk_info) == NDPI_MAX_RIS /* ****************************************** */ -extern void ndpi_unset_risk(struct ndpi_detection_module_struct *ndpi_str, - struct ndpi_flow_struct *flow, ndpi_risk_enum r); -extern u_int32_t make_mining_key(struct ndpi_flow_struct *flow); -extern u_int32_t make_bittorrent_host_key(struct ndpi_flow_struct *flow, int client, int offset); -extern u_int32_t make_bittorrent_peers_key(struct ndpi_flow_struct *flow); -extern int stun_search_into_zoom_cache(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); -extern void ookla_add_to_cache(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); -extern int ookla_search_into_cache(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); - /* Forward */ static int addDefaultPort(struct ndpi_detection_module_struct *ndpi_str, ndpi_port_range *range, ndpi_proto_defaults_t *def, - u_int8_t customUserProto, ndpi_default_ports_tree_node_t **root, + u_int8_t customUserProto, default_ports_tree_node_t **root, const char *_func, int _line); static void ndpi_reset_packet_line_info(struct ndpi_packet_struct *packet); @@ -623,9 +613,9 @@ void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_str, /* ******************************************************************** */ -static int ndpi_default_ports_tree_node_t_cmp(const void *a, const void *b) { - ndpi_default_ports_tree_node_t *fa = (ndpi_default_ports_tree_node_t *) a; - ndpi_default_ports_tree_node_t *fb = (ndpi_default_ports_tree_node_t *) b; +static int default_ports_tree_node_t_cmp(const void *a, const void *b) { + default_ports_tree_node_t *fa = (default_ports_tree_node_t *) a; + default_ports_tree_node_t *fb = (default_ports_tree_node_t *) b; //printf("[NDPI] %s(%d, %d)\n", __FUNCTION__, fa->default_port, fb->default_port); @@ -638,15 +628,15 @@ static int addDefaultPort(struct ndpi_detection_module_struct *ndpi_str, ndpi_port_range *range, ndpi_proto_defaults_t *def, u_int8_t customUserProto, - ndpi_default_ports_tree_node_t **root, + default_ports_tree_node_t **root, const char *_func, int _line) { u_int32_t port; for(port = range->port_low; port <= range->port_high; port++) { - ndpi_default_ports_tree_node_t *node = - (ndpi_default_ports_tree_node_t *) ndpi_malloc(sizeof(ndpi_default_ports_tree_node_t)); - ndpi_default_ports_tree_node_t *ret; + default_ports_tree_node_t *node = + (default_ports_tree_node_t *) ndpi_malloc(sizeof(default_ports_tree_node_t)); + default_ports_tree_node_t *ret; if(!node) { NDPI_LOG_ERR(ndpi_str, "%s:%d not enough memory\n", _func, _line); @@ -654,9 +644,9 @@ static int addDefaultPort(struct ndpi_detection_module_struct *ndpi_str, } node->proto = def, node->default_port = port, node->customUserProto = customUserProto; - ret = (ndpi_default_ports_tree_node_t *) ndpi_tsearch(node, - (void *) root, - ndpi_default_ports_tree_node_t_cmp); /* Add it to the tree */ + ret = (default_ports_tree_node_t *) ndpi_tsearch(node, + (void *) root, + default_ports_tree_node_t_cmp); /* Add it to the tree */ if(ret == NULL) { NDPI_LOG_DBG(ndpi_str, "[NDPI] %s:%d error searching for port %u\n", _func, _line, port); @@ -3912,25 +3902,25 @@ void ndpi_exit_detection_module(struct ndpi_detection_module_struct *ndpi_str) { /* ****************************************************** */ -static ndpi_default_ports_tree_node_t *ndpi_get_guessed_protocol_id(struct ndpi_detection_module_struct *ndpi_str, - u_int8_t proto, u_int16_t sport, u_int16_t dport) { - ndpi_default_ports_tree_node_t node; +static default_ports_tree_node_t *ndpi_get_guessed_protocol_id(struct ndpi_detection_module_struct *ndpi_str, + u_int8_t proto, u_int16_t sport, u_int16_t dport) { + default_ports_tree_node_t node; if(sport && dport) { const void *ret; node.default_port = dport; /* Check server port first */ ret = ndpi_tfind(&node, (proto == IPPROTO_TCP) ? (void *) &ndpi_str->tcpRoot : (void *) &ndpi_str->udpRoot, - ndpi_default_ports_tree_node_t_cmp); + default_ports_tree_node_t_cmp); if(ret == NULL) { node.default_port = sport; ret = ndpi_tfind(&node, (proto == IPPROTO_TCP) ? (void *) &ndpi_str->tcpRoot : (void *) &ndpi_str->udpRoot, - ndpi_default_ports_tree_node_t_cmp); + default_ports_tree_node_t_cmp); } if(ret) - return(*(ndpi_default_ports_tree_node_t **) ret); + return(*(default_ports_tree_node_t **) ret); } return(NULL); @@ -3962,7 +3952,7 @@ u_int16_t ndpi_guess_protocol_id(struct ndpi_detection_module_struct *ndpi_str, *user_defined_proto = 0; /* Default */ if(sport && dport) { - ndpi_default_ports_tree_node_t *found = ndpi_get_guessed_protocol_id(ndpi_str, proto, sport, dport); + default_ports_tree_node_t *found = ndpi_get_guessed_protocol_id(ndpi_str, proto, sport, dport); if(found != NULL) { u_int16_t guessed_proto = found->proto->protoId; @@ -4977,12 +4967,12 @@ void ndpi_set_bitmask_protocol_detection(char *label, struct ndpi_detection_modu static int ndpi_callback_init(struct ndpi_detection_module_struct *ndpi_str) { NDPI_PROTOCOL_BITMASK *detection_bitmask = &ndpi_str->detection_bitmask; - struct ndpi_call_function_struct *all_cb = NULL; + struct call_function_struct *all_cb = NULL; u_int32_t a = 0; if(ndpi_str->callback_buffer) return 0; - ndpi_str->callback_buffer = ndpi_calloc(NDPI_MAX_SUPPORTED_PROTOCOLS+1,sizeof(struct ndpi_call_function_struct)); + ndpi_str->callback_buffer = ndpi_calloc(NDPI_MAX_SUPPORTED_PROTOCOLS+1,sizeof(struct call_function_struct)); if(!ndpi_str->callback_buffer) return 1; /* set this here to zero to be interrupt safe */ @@ -5575,9 +5565,9 @@ static int ndpi_callback_init(struct ndpi_detection_module_struct *ndpi_str) { ndpi_str->callback_buffer_size = a; /* Resize callback_buffer */ - all_cb = ndpi_calloc(a+1,sizeof(struct ndpi_call_function_struct)); + all_cb = ndpi_calloc(a+1,sizeof(struct call_function_struct)); if(all_cb) { - memcpy((char *)all_cb,(char *)ndpi_str->callback_buffer, (a+1) * sizeof(struct ndpi_call_function_struct)); + memcpy((char *)all_cb,(char *)ndpi_str->callback_buffer, (a+1) * sizeof(struct call_function_struct)); ndpi_free(ndpi_str->callback_buffer); ndpi_str->callback_buffer = all_cb; } @@ -5589,7 +5579,7 @@ static int ndpi_callback_init(struct ndpi_detection_module_struct *ndpi_str) { ndpi_str->callback_buffer_size_tcp_no_payload + ndpi_str->callback_buffer_size_udp + ndpi_str->callback_buffer_size_non_tcp_udp, - sizeof(struct ndpi_call_function_struct)); + sizeof(struct call_function_struct)); if(!all_cb) return 1; ndpi_str->callback_buffer_tcp_payload = all_cb; @@ -5665,7 +5655,7 @@ static void ndpi_enabled_callbacks_init(struct ndpi_detection_module_struct *ndp NDPI_LOG_DBG2(ndpi_str, "callback_buffer_tcp_payload, adding buffer %u as entry %u\n", a, ndpi_str->callback_buffer_size_tcp_payload); memcpy(&ndpi_str->callback_buffer_tcp_payload[ndpi_str->callback_buffer_size_tcp_payload], - &ndpi_str->callback_buffer[a], sizeof(struct ndpi_call_function_struct)); + &ndpi_str->callback_buffer[a], sizeof(struct call_function_struct)); } ndpi_str->callback_buffer_size_tcp_payload++; } @@ -5676,7 +5666,7 @@ static void ndpi_enabled_callbacks_init(struct ndpi_detection_module_struct *ndp NDPI_LOG_DBG2(ndpi_str, "\tcallback_buffer_tcp_no_payload, additional adding buffer %u to no_payload process\n", a); memcpy(&ndpi_str->callback_buffer_tcp_no_payload[ndpi_str->callback_buffer_size_tcp_no_payload], - &ndpi_str->callback_buffer[a], sizeof(struct ndpi_call_function_struct)); + &ndpi_str->callback_buffer[a], sizeof(struct call_function_struct)); } ndpi_str->callback_buffer_size_tcp_no_payload++; } @@ -5689,7 +5679,7 @@ static void ndpi_enabled_callbacks_init(struct ndpi_detection_module_struct *ndp NDPI_LOG_DBG2(ndpi_str, "callback_buffer_size_udp: adding buffer : %u\n", a); memcpy(&ndpi_str->callback_buffer_udp[ndpi_str->callback_buffer_size_udp], &ndpi_str->callback_buffer[a], - sizeof(struct ndpi_call_function_struct)); + sizeof(struct call_function_struct)); } ndpi_str->callback_buffer_size_udp++; } @@ -5702,7 +5692,7 @@ static void ndpi_enabled_callbacks_init(struct ndpi_detection_module_struct *ndp NDPI_LOG_DBG2(ndpi_str, "callback_buffer_non_tcp_udp: adding buffer : %u\n", a); memcpy(&ndpi_str->callback_buffer_non_tcp_udp[ndpi_str->callback_buffer_size_non_tcp_udp], - &ndpi_str->callback_buffer[a], sizeof(struct ndpi_call_function_struct)); + &ndpi_str->callback_buffer[a], sizeof(struct call_function_struct)); } ndpi_str->callback_buffer_size_non_tcp_udp++; } @@ -5787,7 +5777,7 @@ int ndpi_handle_ipv6_extension_headers(u_int16_t l3len, const u_int8_t **l4ptr, /* ******************************************************************** */ /* Used by dns.c */ -u_int8_t ndpi_iph_is_valid_and_not_fragmented(const struct ndpi_iphdr *iph, const u_int16_t ipsize) { +u_int8_t iph_is_valid_and_not_fragmented(const struct ndpi_iphdr *iph, const u_int16_t ipsize) { /* returned value: 0: fragmented @@ -5855,7 +5845,7 @@ static u_int8_t ndpi_detection_get_l4_internal(struct ndpi_detection_module_stru } /* 0: fragmented; 1: not fragmented */ - if(iph != NULL && ndpi_iph_is_valid_and_not_fragmented(iph, l3_len)) { + if(iph != NULL && iph_is_valid_and_not_fragmented(iph, l3_len)) { u_int16_t len = ndpi_min(ntohs(iph->tot_len), l3_len); u_int16_t hlen = (iph->ihl * 4); @@ -6228,16 +6218,16 @@ static int fully_enc_heuristic(struct ndpi_detection_module_struct *ndpi_str, /* ************************************************ */ -int ndpi_current_pkt_from_client_to_server(const struct ndpi_detection_module_struct *ndpi_str, - const struct ndpi_flow_struct *flow) +int current_pkt_from_client_to_server(const struct ndpi_detection_module_struct *ndpi_str, + const struct ndpi_flow_struct *flow) { return ndpi_str->packet.packet_direction == flow->client_packet_direction; } /* ******************************************************************** */ -int ndpi_current_pkt_from_server_to_client(const struct ndpi_detection_module_struct *ndpi_str, - const struct ndpi_flow_struct *flow) +int current_pkt_from_server_to_client(const struct ndpi_detection_module_struct *ndpi_str, + const struct ndpi_flow_struct *flow) { return ndpi_str->packet.packet_direction != flow->client_packet_direction; } @@ -6447,7 +6437,7 @@ void ndpi_connection_tracking(struct ndpi_detection_module_struct *ndpi_str, } } - if(ndpi_current_pkt_from_client_to_server(ndpi_str, flow)) { + if(current_pkt_from_client_to_server(ndpi_str, flow)) { if(flow->is_ipv6 == 0) { flow->c_address.v4 = packet->iph->saddr; flow->s_address.v4 = packet->iph->daddr; @@ -6546,7 +6536,7 @@ static u_int32_t check_ndpi_subprotocols(struct ndpi_detection_module_struct * c static u_int32_t check_ndpi_detection_func(struct ndpi_detection_module_struct * const ndpi_str, struct ndpi_flow_struct * const flow, NDPI_SELECTION_BITMASK_PROTOCOL_SIZE const ndpi_selection_packet, - struct ndpi_call_function_struct const * const callback_buffer, + struct call_function_struct const * const callback_buffer, uint32_t callback_buffer_size, int is_tcp_without_payload) { @@ -6956,11 +6946,11 @@ u_int32_t ndpi_ip_port_hash_funct(u_int32_t ip, u_int16_t port) { /* #define BITTORRENT_CACHE_DEBUG */ -int ndpi_search_into_bittorrent_cache(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow) { +int search_into_bittorrent_cache(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow) { #ifdef BITTORRENT_CACHE_DEBUG - printf("[%s:%u] ndpi_search_into_bittorrent_cache(%u, %u) [bt_check_performed=%d]\n", + printf("[%s:%u] search_into_bittorrent_cache(%u, %u) [bt_check_performed=%d]\n", __FILE__, __LINE__, ntohs(flow->c_port), ntohs(flow->s_port), flow->bt_check_performed); #endif @@ -7109,7 +7099,7 @@ ndpi_protocol ndpi_detection_giveup(struct ndpi_detection_module_struct *ndpi_st /* Does it looks like BitTorrent? */ if(ret.app_protocol == NDPI_PROTOCOL_UNKNOWN && - ndpi_search_into_bittorrent_cache(ndpi_str, flow)) { + search_into_bittorrent_cache(ndpi_str, flow)) { ndpi_set_detected_protocol(ndpi_str, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI_PARTIAL_CACHE); ret.app_protocol = flow->detected_protocol_stack[0]; } @@ -7572,7 +7562,7 @@ static int ndpi_is_ntop_protocol(ndpi_protocol *ret) { static int ndpi_check_protocol_port_mismatch_exceptions(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow, - ndpi_default_ports_tree_node_t *expected_proto, + default_ports_tree_node_t *expected_proto, ndpi_protocol *returned_proto) { /* For TLS (and other protocols) it is not simple to guess the exact protocol so before @@ -7816,7 +7806,7 @@ static ndpi_protocol ndpi_internal_detection_process_packet(struct ndpi_detectio if((!flow->risk_checked) && ((ret.master_protocol != NDPI_PROTOCOL_UNKNOWN) || (ret.app_protocol != NDPI_PROTOCOL_UNKNOWN)) ) { - ndpi_default_ports_tree_node_t *found; + default_ports_tree_node_t *found; u_int16_t *default_ports; if(packet->udp) @@ -7855,8 +7845,8 @@ static ndpi_protocol ndpi_internal_detection_process_packet(struct ndpi_detectio } /* for */ if(!found) { - ndpi_default_ports_tree_node_t *r = ndpi_get_guessed_protocol_id(ndpi_str, packet->udp ? IPPROTO_UDP : IPPROTO_TCP, - ntohs(flow->c_port), ntohs(flow->s_port)); + default_ports_tree_node_t *r = ndpi_get_guessed_protocol_id(ndpi_str, packet->udp ? IPPROTO_UDP : IPPROTO_TCP, + ntohs(flow->c_port), ntohs(flow->s_port)); if((r == NULL) || ((r->proto->protoId != ret.app_protocol) && (r->proto->protoId != ret.master_protocol))) { @@ -7904,8 +7894,8 @@ static ndpi_protocol ndpi_internal_detection_process_packet(struct ndpi_detectio } if(!found) { - ndpi_default_ports_tree_node_t *r = ndpi_get_guessed_protocol_id(ndpi_str, packet->udp ? IPPROTO_UDP : IPPROTO_TCP, - ntohs(flow->c_port), ntohs(flow->s_port)); + default_ports_tree_node_t *r = ndpi_get_guessed_protocol_id(ndpi_str, packet->udp ? IPPROTO_UDP : IPPROTO_TCP, + ntohs(flow->c_port), ntohs(flow->s_port)); if((r == NULL) || ((r->proto->protoId != ret.app_protocol) && (r->proto->protoId != ret.master_protocol))) @@ -8783,7 +8773,7 @@ static ndpi_protocol ndpi_internal_guess_undetected_protocol(struct ndpi_detecti } if(ret.app_protocol == NDPI_PROTOCOL_UNKNOWN && - ndpi_search_into_bittorrent_cache(ndpi_str, flow)) { + search_into_bittorrent_cache(ndpi_str, flow)) { /* This looks like BitTorrent */ ret.app_protocol = NDPI_PROTOCOL_BITTORRENT; } diff --git a/src/lib/ndpi_private.h b/src/lib/ndpi_private.h new file mode 100644 index 00000000000..58260e6a1f5 --- /dev/null +++ b/src/lib/ndpi_private.h @@ -0,0 +1,359 @@ +#ifndef __NDPI_PRIVATE_H__ +#define __NDPI_PRIVATE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Not sure if we still need it.. keep it for the time being */ +#ifdef NDPI_LIB_COMPILATION + +/* Needed to have access to HAVE_* defines */ +#ifndef _NDPI_CONFIG_H_ +#include "ndpi_config.h" +#define _NDPI_CONFIG_H_ +#endif + +struct call_function_struct { + NDPI_PROTOCOL_BITMASK detection_bitmask; + NDPI_PROTOCOL_BITMASK excluded_protocol_bitmask; + void (*func) (struct ndpi_detection_module_struct *, struct ndpi_flow_struct *flow); + NDPI_SELECTION_BITMASK_PROTOCOL_SIZE ndpi_selection_bitmask; + u_int16_t ndpi_protocol_id; + u_int8_t detection_feature; +}; + +struct subprotocol_conf_struct { + void (*func) (struct ndpi_detection_module_struct *, char *attr, char *value, int protocol_id); +}; + +typedef struct default_ports_tree_node { + ndpi_proto_defaults_t *proto; + u_int8_t customUserProto; + u_int16_t default_port; +} default_ports_tree_node_t; + + +#define LINE_EQUALS(ndpi_int_one_line_struct, string_to_compare) \ + ((ndpi_int_one_line_struct).len == strlen(string_to_compare) && \ + LINE_CMP(ndpi_int_one_line_struct, string_to_compare, strlen(string_to_compare)) == 1) + +#define LINE_STARTS(ndpi_int_one_line_struct, string_to_compare) \ + ((ndpi_int_one_line_struct).len >= strlen(string_to_compare) && \ + LINE_CMP(ndpi_int_one_line_struct, string_to_compare, strlen(string_to_compare)) == 1) + +#define LINE_ENDS(ndpi_int_one_line_struct, string_to_compare) \ + ((ndpi_int_one_line_struct).len >= strlen(string_to_compare) && \ + memcmp((ndpi_int_one_line_struct).ptr + \ + ((ndpi_int_one_line_struct).len - strlen(string_to_compare)), \ + string_to_compare, strlen(string_to_compare)) == 0) + +#define LINE_CMP(ndpi_int_one_line_struct, string_to_compare, string_to_compare_length) \ + ((ndpi_int_one_line_struct).ptr != NULL && \ + memcmp((ndpi_int_one_line_struct).ptr, string_to_compare, string_to_compare_length) == 0) + +struct ndpi_int_one_line_struct { + const u_int8_t *ptr; + u_int16_t len; +}; + +struct ndpi_packet_struct { + const struct ndpi_iphdr *iph; + const struct ndpi_ipv6hdr *iphv6; + const struct ndpi_tcphdr *tcp; + const struct ndpi_udphdr *udp; + const u_int8_t *generic_l4_ptr; /* is set only for non tcp-udp traffic */ + const u_int8_t *payload; + + u_int64_t current_time_ms; + + struct ndpi_int_one_line_struct line[NDPI_MAX_PARSE_LINES_PER_PACKET]; + /* HTTP headers */ + struct ndpi_int_one_line_struct host_line; + struct ndpi_int_one_line_struct forwarded_line; + struct ndpi_int_one_line_struct referer_line; + struct ndpi_int_one_line_struct content_line; + struct ndpi_int_one_line_struct content_disposition_line; + struct ndpi_int_one_line_struct accept_line; + struct ndpi_int_one_line_struct authorization_line; + struct ndpi_int_one_line_struct user_agent_line; + struct ndpi_int_one_line_struct http_url_name; + struct ndpi_int_one_line_struct http_encoding; + struct ndpi_int_one_line_struct http_transfer_encoding; + struct ndpi_int_one_line_struct http_contentlen; + struct ndpi_int_one_line_struct http_cookie; + struct ndpi_int_one_line_struct http_origin; + struct ndpi_int_one_line_struct http_x_session_type; + struct ndpi_int_one_line_struct server_line; + struct ndpi_int_one_line_struct http_method; + struct ndpi_int_one_line_struct http_response; /* the first "word" in this pointer is the + response code in the packet (200, etc) */ + u_int8_t http_num_headers; /* number of found (valid) header lines in HTTP request or response */ + + u_int16_t l3_packet_len; + u_int16_t payload_packet_len; + u_int16_t parsed_lines; + u_int16_t empty_line_position; + u_int8_t tcp_retransmission; + + u_int8_t packet_lines_parsed_complete:1, + packet_direction:1, empty_line_position_set:1, http_check_content:1, pad:4; +}; + +typedef struct ndpi_list_struct { + char *value; + struct ndpi_list_struct *next; +} ndpi_list; + +#ifdef HAVE_NBPF +typedef struct { + void *tree; /* cast to nbpf_filter* */ + u_int16_t l7_protocol; +} nbpf_filter; +#endif + +struct ndpi_detection_module_struct { + NDPI_PROTOCOL_BITMASK detection_bitmask; + + u_int64_t current_ts; + u_int16_t max_packets_to_process; + u_int16_t num_tls_blocks_to_follow; + u_int8_t skip_tls_blocks_until_change_cipher:1, enable_ja3_plus:1, _notused:6; + u_int8_t tls_certificate_expire_in_x_days; + + void *user_data; + char custom_category_labels[NUM_CUSTOM_CATEGORIES][CUSTOM_CATEGORY_LABEL_LEN]; + + /* callback function buffer */ + struct call_function_struct *callback_buffer; + struct call_function_struct *callback_buffer_tcp_no_payload; + struct call_function_struct *callback_buffer_tcp_payload; + struct call_function_struct *callback_buffer_udp; + struct call_function_struct *callback_buffer_non_tcp_udp; + u_int32_t callback_buffer_size; + u_int32_t callback_buffer_size_tcp_no_payload; + u_int32_t callback_buffer_size_tcp_payload; + u_int32_t callback_buffer_size_udp; + u_int32_t callback_buffer_size_non_tcp_udp; + + default_ports_tree_node_t *tcpRoot, *udpRoot; + + ndpi_log_level_t ndpi_log_level; /* default error */ + +#ifdef NDPI_ENABLE_DEBUG_MESSAGES + /* debug callback, only set when debug is used */ + ndpi_debug_function_ptr ndpi_debug_printf; + const char *ndpi_debug_print_file; + const char *ndpi_debug_print_function; + u_int32_t ndpi_debug_print_line; + NDPI_PROTOCOL_BITMASK debug_bitmask; +#endif + + /* misc parameters */ + u_int32_t tcp_max_retransmission_window_size; + + /* subprotocol registration handler */ + struct subprotocol_conf_struct subprotocol_conf[NDPI_MAX_SUPPORTED_PROTOCOLS + 1]; + + u_int ndpi_num_supported_protocols; + u_int ndpi_num_custom_protocols; + + int ac_automa_finalized; + /* HTTP/DNS/HTTPS/QUIC host matching */ + ndpi_automa host_automa, /* Used for DNS/HTTPS */ + risky_domain_automa, tls_cert_subject_automa, + host_risk_mask_automa, common_alpns_automa; + /* IMPORTANT: please, whenever you add a new automa: + * update ndpi_finalize_initialization() + * update automa_type above + */ + + ndpi_str_hash *malicious_ja3_hashmap, *malicious_sha1_hashmap; + + ndpi_list *trusted_issuer_dn; + + /* Patricia trees */ + ndpi_patricia_tree_t *ip_risk_mask_ptree; + ndpi_patricia_tree_t *ip_risk_mask_ptree6; + ndpi_patricia_tree_t *ip_risk_ptree; + ndpi_patricia_tree_t *ip_risk_ptree6; + ndpi_patricia_tree_t *protocols_ptree; /* IP-based protocol detection */ + ndpi_patricia_tree_t *protocols_ptree6; + + /* *** If you add a new Patricia tree, please update ptree_type above! *** */ + + struct { +#ifdef USE_LEGACY_AHO_CORASICK + ndpi_automa hostnames, hostnames_shadow; +#else + ndpi_domain_classify *sc_hostnames, *sc_hostnames_shadow; +#endif + void *ipAddresses, *ipAddresses_shadow; /* Patricia */ + void *ipAddresses6, *ipAddresses6_shadow; /* Patricia IPv6*/ + u_int8_t categories_loaded; + } custom_categories; + + u_int8_t ip_version_limit; + + /* NDPI_PROTOCOL_TINC */ + struct cache *tinc_cache; + + /* NDPI_PROTOCOL_OOKLA */ + struct ndpi_lru_cache *ookla_cache; + u_int32_t ookla_cache_num_entries; + u_int32_t ookla_cache_ttl; + + /* NDPI_PROTOCOL_BITTORRENT */ + struct ndpi_lru_cache *bittorrent_cache; + u_int32_t bittorrent_cache_num_entries; + u_int32_t bittorrent_cache_ttl; + + /* NDPI_PROTOCOL_ZOOM */ + struct ndpi_lru_cache *zoom_cache; + u_int32_t zoom_cache_num_entries; + u_int32_t zoom_cache_ttl; + + /* NDPI_PROTOCOL_STUN and subprotocols */ + struct ndpi_lru_cache *stun_cache; + u_int32_t stun_cache_num_entries; + u_int32_t stun_cache_ttl; + struct ndpi_lru_cache *stun_zoom_cache; + u_int32_t stun_zoom_cache_num_entries; + u_int32_t stun_zoom_cache_ttl; + + /* NDPI_PROTOCOL_TLS and subprotocols */ + struct ndpi_lru_cache *tls_cert_cache; + u_int32_t tls_cert_cache_num_entries; + int32_t tls_cert_cache_ttl; + + /* NDPI_PROTOCOL_MINING and subprotocols */ + struct ndpi_lru_cache *mining_cache; + u_int32_t mining_cache_num_entries; + u_int32_t mining_cache_ttl; + + /* NDPI_PROTOCOL_MSTEAMS */ + struct ndpi_lru_cache *msteams_cache; + u_int32_t msteams_cache_num_entries; + u_int32_t msteams_cache_ttl; + + /* *** If you add a new LRU cache, please update lru_cache_type above! *** */ + + int opportunistic_tls_smtp_enabled; + int opportunistic_tls_imap_enabled; + int opportunistic_tls_pop_enabled; + int opportunistic_tls_ftp_enabled; + int opportunistic_tls_stun_enabled; + + u_int32_t monitoring_stun_pkts_to_process; + u_int32_t monitoring_stun_flags; + + u_int32_t aggressiveness_ookla; + + int tcp_ack_paylod_heuristic; + int fully_encrypted_based_on_first_pkt_heuristic; + + u_int16_t ndpi_to_user_proto_id[NDPI_MAX_NUM_CUSTOM_PROTOCOLS]; /* custom protocolId mapping */ + ndpi_proto_defaults_t proto_defaults[NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS]; + + u_int8_t direction_detect_disable:1, /* disable internal detection of packet direction */ _pad:7; + +#ifdef CUSTOM_NDPI_PROTOCOLS + #include "../../../nDPI-custom/custom_ndpi_typedefs.h" +#endif + + /* GeoIP */ + void *mmdb_city, *mmdb_as; + u_int8_t mmdb_city_loaded, mmdb_as_loaded; + + /* Current packet */ + struct ndpi_packet_struct packet; + const struct ndpi_flow_input_info *input_info; + +#ifdef HAVE_NBPF + u_int8_t num_nbpf_custom_proto; + nbpf_filter nbpf_custom_proto[MAX_NBPF_CUSTOM_PROTO]; +#endif + + u_int16_t max_payload_track_len; +}; + + + + + + +/* Generic */ + +char *strptime(const char *s, const char *format, struct tm *tm); + +u_int8_t iph_is_valid_and_not_fragmented(const struct ndpi_iphdr *iph, const u_int16_t ipsize); + +int current_pkt_from_client_to_server(const struct ndpi_detection_module_struct *ndpi_str, const struct ndpi_flow_struct *flow); +int current_pkt_from_server_to_client(const struct ndpi_detection_module_struct *ndpi_str, const struct ndpi_flow_struct *flow); + +/* TLS */ +int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow, uint32_t quic_version); +void processCertificateElements(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow, + u_int16_t p_offset, u_int16_t certificate_len); +void switch_to_tls(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow); +int is_dtls(const u_int8_t *buf, u_int32_t buf_len, u_int32_t *block_len); +void switch_extra_dissection_to_tls(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow); + +/* HTTP */ +void http_process_user_agent(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow, + const u_int8_t *ua_ptr, u_int16_t ua_ptr_len); + +/* OOKLA */ +int ookla_search_into_cache(struct ndpi_detection_module_struct* ndpi_struct, + struct ndpi_flow_struct* flow); +void ookla_add_to_cache(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow); + +/* QUIC */ +int quic_len(const uint8_t *buf, uint64_t *value); +int quic_len_buffer_still_required(uint8_t value); +int is_version_with_var_int_transport_params(uint32_t version); +int is_version_with_tls(uint32_t version); +void process_chlo(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow, + const u_int8_t *crypto_data, uint32_t crypto_data_len); +void process_tls(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow, + const u_int8_t *crypto_data, uint32_t crypto_data_len); +const uint8_t *get_crypto_data(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow, + u_int8_t *clear_payload, uint32_t clear_payload_len, + uint64_t *crypto_data_len); + +/* RTP */ +int is_valid_rtp_payload_type(uint8_t type); +int is_rtp_or_rtcp(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow); +u_int8_t rtp_get_stream_type(u_int8_t payloadType, ndpi_multimedia_flow_type *s_type); + +/* Bittorrent */ +u_int32_t make_bittorrent_host_key(struct ndpi_flow_struct *flow, int client, int offset); +u_int32_t make_bittorrent_peers_key(struct ndpi_flow_struct *flow); +int search_into_bittorrent_cache(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow); + + +/* Mining */ +u_int32_t make_mining_key(struct ndpi_flow_struct *flow); + +/* Stun */ +int stun_search_into_zoom_cache(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); + + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index b41ec6706dd..041f9226ed2 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -34,6 +34,7 @@ #include "ndpi_api.h" #include "ndpi_includes.h" #include "ndpi_encryption.h" +#include "ndpi_private.h" #include "ahocorasick.h" #include "libcache.h" diff --git a/src/lib/protocols/activision.c b/src/lib/protocols/activision.c index 22acd4694c5..ac24ee80fc6 100644 --- a/src/lib/protocols/activision.c +++ b/src/lib/protocols/activision.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ACTIVISION #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_activision_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/afp.c b/src/lib/protocols/afp.c index 685c8a1034d..5b420f422b8 100644 --- a/src/lib/protocols/afp.c +++ b/src/lib/protocols/afp.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AFP #include "ndpi_api.h" +#include "ndpi_private.h" struct afpHeader { u_int8_t flags, command; diff --git a/src/lib/protocols/ajp.c b/src/lib/protocols/ajp.c index c25b9580338..3d2317fb2dc 100644 --- a/src/lib/protocols/ajp.c +++ b/src/lib/protocols/ajp.c @@ -25,6 +25,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AJP #include "ndpi_api.h" +#include "ndpi_private.h" enum ajp_direction { AJP_SERVER_TO_CONTAINER = 0x1234, diff --git a/src/lib/protocols/alicloud.c b/src/lib/protocols/alicloud.c index 3966e75879a..9ec87f3ecd1 100644 --- a/src/lib/protocols/alicloud.c +++ b/src/lib/protocols/alicloud.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ALICLOUD #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_alicloud_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/amazon_video.c b/src/lib/protocols/amazon_video.c index 62bcd834a69..bbb446eb349 100644 --- a/src/lib/protocols/amazon_video.c +++ b/src/lib/protocols/amazon_video.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AMAZON_VIDEO #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_check_amazon_video(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/among_us.c b/src/lib/protocols/among_us.c index f1e143e8130..9cc90ac3888 100644 --- a/src/lib/protocols/among_us.c +++ b/src/lib/protocols/among_us.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AMONG_US #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_among_us_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/amqp.c b/src/lib/protocols/amqp.c index 2998cb35767..61c8f02a946 100644 --- a/src/lib/protocols/amqp.c +++ b/src/lib/protocols/amqp.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AMQP #include "ndpi_api.h" +#include "ndpi_private.h" PACK_ON diff --git a/src/lib/protocols/apple_push.c b/src/lib/protocols/apple_push.c index f44d457b420..6cc233f6143 100644 --- a/src/lib/protocols/apple_push.c +++ b/src/lib/protocols/apple_push.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_APPLE_PUSH #include "ndpi_api.h" +#include "ndpi_private.h" static int is_apple_push_addr(const struct ndpi_packet_struct *packet) { diff --git a/src/lib/protocols/armagetron.c b/src/lib/protocols/armagetron.c index b021862bc46..d9cdd1b200f 100644 --- a/src/lib/protocols/armagetron.c +++ b/src/lib/protocols/armagetron.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ARMAGETRON #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_armagetron_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/avast.c b/src/lib/protocols/avast.c index e133f8cf22f..388538deaab 100644 --- a/src/lib/protocols/avast.c +++ b/src/lib/protocols/avast.c @@ -24,6 +24,7 @@ #include #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_avast_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/avast_securedns.c b/src/lib/protocols/avast_securedns.c index 5eb9a430f30..c42a3973698 100644 --- a/src/lib/protocols/avast_securedns.c +++ b/src/lib/protocols/avast_securedns.c @@ -24,6 +24,7 @@ #include #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_avast_securedns_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/bacnet.c b/src/lib/protocols/bacnet.c index 907320e4f51..b79455d1ee5 100644 --- a/src/lib/protocols/bacnet.c +++ b/src/lib/protocols/bacnet.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BACNET #include "ndpi_api.h" +#include "ndpi_private.h" // BVLC (BACnet Virtual Link Control) Annex is part of BVLL (BACnet Virtual Link Layer). // See: https://www.ashrae.org/file%20library/technical%20resources/standards%20and%20guidelines/standards%20addenda/135-1995_addendum-a.pdf diff --git a/src/lib/protocols/bgp.c b/src/lib/protocols/bgp.c index dbc8e5fcc85..956eef48ded 100644 --- a/src/lib/protocols/bgp.c +++ b/src/lib/protocols/bgp.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BGP #include "ndpi_api.h" +#include "ndpi_private.h" /* this detection also works asymmetrically */ diff --git a/src/lib/protocols/bitcoin.c b/src/lib/protocols/bitcoin.c index 2154e912a9d..e7ac4cffb37 100644 --- a/src/lib/protocols/bitcoin.c +++ b/src/lib/protocols/bitcoin.c @@ -23,6 +23,7 @@ #include "ndpi_protocol_ids.h" #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BITCOIN #include "ndpi_api.h" +#include "ndpi_private.h" /*https://en.bitcoin.it/wiki/Protocol_documentation*/ #define MAIN_NET_MAGIC 0xF9BEB4D9 diff --git a/src/lib/protocols/bittorrent.c b/src/lib/protocols/bittorrent.c index 9e195691bbb..b3838a8ddf4 100644 --- a/src/lib/protocols/bittorrent.c +++ b/src/lib/protocols/bittorrent.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BITTORRENT #include "ndpi_api.h" +#include "ndpi_private.h" #define BITTORRENT_PROTO_STRING "BitTorrent protocol" @@ -40,8 +41,6 @@ struct ndpi_utp_hdr { u_int16_t sequence_nr, ack_nr; }; -extern int ndpi_search_into_bittorrent_cache(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); /* Forward declaration */ static void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, @@ -467,7 +466,7 @@ static u_int8_t is_port(u_int16_t a, u_int16_t b, u_int16_t what) { static void ndpi_skip_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, struct ndpi_packet_struct *packet) { - if(ndpi_search_into_bittorrent_cache(ndpi_struct, flow)) + if(search_into_bittorrent_cache(ndpi_struct, flow)) ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1, 0, NDPI_CONFIDENCE_DPI_CACHE); else NDPI_EXCLUDE_PROTO(ndpi_struct, flow); diff --git a/src/lib/protocols/bjnp.c b/src/lib/protocols/bjnp.c index 97370ca9232..bf7e24b75ba 100644 --- a/src/lib/protocols/bjnp.c +++ b/src/lib/protocols/bjnp.c @@ -3,6 +3,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BJNP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_bjnp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, diff --git a/src/lib/protocols/can.c b/src/lib/protocols/can.c index 618464f70bf..fc12866a8f1 100644 --- a/src/lib/protocols/can.c +++ b/src/lib/protocols/can.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CAN #include "ndpi_api.h" +#include "ndpi_private.h" PACK_ON struct can_hdr { diff --git a/src/lib/protocols/capwap.c b/src/lib/protocols/capwap.c index 11a39492132..e42a3b6bee8 100644 --- a/src/lib/protocols/capwap.c +++ b/src/lib/protocols/capwap.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CAPWAP #include "ndpi_api.h" +#include "ndpi_private.h" #define NDPI_CAPWAP_CONTROL_PORT 5246 #define NDPI_CAPWAP_DATA_PORT 5247 diff --git a/src/lib/protocols/cassandra.c b/src/lib/protocols/cassandra.c index 56c536bb1a0..9a066f26f0d 100644 --- a/src/lib/protocols/cassandra.c +++ b/src/lib/protocols/cassandra.c @@ -24,6 +24,7 @@ #include "ndpi_protocol_ids.h" #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CASSANDRA #include "ndpi_api.h" +#include "ndpi_private.h" #define CASSANDRA_HEADER_LEN 9 #define CASSANDRA_MAX_BODY_SIZE 268435456 //256MB (256 * 1024^2) diff --git a/src/lib/protocols/checkmk.c b/src/lib/protocols/checkmk.c index 60aeefb43d2..c70e2a478ae 100644 --- a/src/lib/protocols/checkmk.c +++ b/src/lib/protocols/checkmk.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CHECKMK #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_checkmk_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/ciscovpn.c b/src/lib/protocols/ciscovpn.c index d3a63579d6b..e5bfd6a2237 100644 --- a/src/lib/protocols/ciscovpn.c +++ b/src/lib/protocols/ciscovpn.c @@ -25,6 +25,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CISCOVPN #include "ndpi_api.h" +#include "ndpi_private.h" /* ****************************************************************** */ diff --git a/src/lib/protocols/citrix.c b/src/lib/protocols/citrix.c index 9bfe58e6370..0db341f0245 100644 --- a/src/lib/protocols/citrix.c +++ b/src/lib/protocols/citrix.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CITRIX #include "ndpi_api.h" +#include "ndpi_private.h" /* ************************************ */ diff --git a/src/lib/protocols/coap.c b/src/lib/protocols/coap.c index 8935aa22a8c..bf6e0692400 100644 --- a/src/lib/protocols/coap.c +++ b/src/lib/protocols/coap.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_COAP #include "ndpi_api.h" +#include "ndpi_private.h" #define CON 0 diff --git a/src/lib/protocols/collectd.c b/src/lib/protocols/collectd.c index 990ff610820..500b9a3f338 100644 --- a/src/lib/protocols/collectd.c +++ b/src/lib/protocols/collectd.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_COLLECTD #include "ndpi_api.h" +#include "ndpi_private.h" #define COLLECTD_MIN_BLOCKS_REQUIRED 3 #define COLLECTD_MAX_BLOCKS_TO_DISSECT 5 diff --git a/src/lib/protocols/corba.c b/src/lib/protocols/corba.c index f22905ea48b..aaf3563e610 100644 --- a/src/lib/protocols/corba.c +++ b/src/lib/protocols/corba.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CORBA #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_corba_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/cpha.c b/src/lib/protocols/cpha.c index 97bad4262b2..b2967413fd4 100644 --- a/src/lib/protocols/cpha.c +++ b/src/lib/protocols/cpha.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CPHA #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_cpha(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/crossfire.c b/src/lib/protocols/crossfire.c index 28cb3e5ca7a..547db2e8bb2 100644 --- a/src/lib/protocols/crossfire.c +++ b/src/lib/protocols/crossfire.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CROSSFIRE #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_crossfire_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/crynet.c b/src/lib/protocols/crynet.c index b018f07241b..21cbe760732 100644 --- a/src/lib/protocols/crynet.c +++ b/src/lib/protocols/crynet.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CRYNET #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_crynet_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/csgo.c b/src/lib/protocols/csgo.c index 80002fc0a34..d1a11950a0d 100644 --- a/src/lib/protocols/csgo.c +++ b/src/lib/protocols/csgo.c @@ -25,6 +25,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CSGO #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_csgo(struct ndpi_detection_module_struct* ndpi_struct, struct ndpi_flow_struct* flow) { struct ndpi_packet_struct* packet = &ndpi_struct->packet; diff --git a/src/lib/protocols/dcerpc.c b/src/lib/protocols/dcerpc.c index 688123ce51d..14736f03305 100644 --- a/src/lib/protocols/dcerpc.c +++ b/src/lib/protocols/dcerpc.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RPC #include "ndpi_api.h" +#include "ndpi_private.h" #include static void ndpi_int_dcerpc_add_connection(struct ndpi_detection_module_struct diff --git a/src/lib/protocols/dhcp.c b/src/lib/protocols/dhcp.c index a3971a5212f..820b5716430 100644 --- a/src/lib/protocols/dhcp.c +++ b/src/lib/protocols/dhcp.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DHCP #include "ndpi_api.h" +#include "ndpi_private.h" /* freeradius/src/lib/dhcp.c */ #define DHCP_CHADDR_LEN 6 diff --git a/src/lib/protocols/dhcpv6.c b/src/lib/protocols/dhcpv6.c index 9d1e1f1a8a0..6afcd7a8ce6 100644 --- a/src/lib/protocols/dhcpv6.c +++ b/src/lib/protocols/dhcpv6.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DHCPV6 #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_dhcpv6_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/diameter.c b/src/lib/protocols/diameter.c index 82426a4848b..0d9a8382bcd 100644 --- a/src/lib/protocols/diameter.c +++ b/src/lib/protocols/diameter.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DIAMETER #include "ndpi_api.h" +#include "ndpi_private.h" // Header Flags possibile values diff --git a/src/lib/protocols/discord.c b/src/lib/protocols/discord.c index e3e59a7e460..5256910dbc8 100644 --- a/src/lib/protocols/discord.c +++ b/src/lib/protocols/discord.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DISCORD #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_discord_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/dnp3.c b/src/lib/protocols/dnp3.c index 9361d8bfd06..99d23dad73d 100644 --- a/src/lib/protocols/dnp3.c +++ b/src/lib/protocols/dnp3.c @@ -23,6 +23,7 @@ #include "ndpi_protocol_ids.h" #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DNP3 #include "ndpi_api.h" +#include "ndpi_private.h" /* https://www.ixiacom.com/company/blog/scada-distributed-network-protocol-dnp3 diff --git a/src/lib/protocols/dns.c b/src/lib/protocols/dns.c index b518ba0f2b6..9a220024e6e 100644 --- a/src/lib/protocols/dns.c +++ b/src/lib/protocols/dns.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DNS #include "ndpi_api.h" +#include "ndpi_private.h" #define FLAGS_MASK 0x8000 @@ -37,8 +38,6 @@ #define PKT_LEN_ALERT 512 -/* ndpi_main.c */ -extern u_int8_t ndpi_iph_is_valid_and_not_fragmented(const struct ndpi_iphdr *iph, const u_int16_t ipsize); static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); @@ -869,7 +868,7 @@ static void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, st /* 0: fragmented; 1: not fragmented */ if((flags & 0x20) - || (ndpi_iph_is_valid_and_not_fragmented(packet->iph, packet->l3_packet_len) == 0)) { + || (iph_is_valid_and_not_fragmented(packet->iph, packet->l3_packet_len) == 0)) { ndpi_set_risk(ndpi_struct, flow, NDPI_DNS_FRAGMENTED, NULL); } } else if(packet->iphv6 != NULL) { diff --git a/src/lib/protocols/dnscrypt.c b/src/lib/protocols/dnscrypt.c index 69b827f3d6b..c4e28323d7c 100644 --- a/src/lib/protocols/dnscrypt.c +++ b/src/lib/protocols/dnscrypt.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DNSCRYPT #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_dnscrypt_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/dofus.c b/src/lib/protocols/dofus.c index 5357fc96fd4..37dbb231041 100644 --- a/src/lib/protocols/dofus.c +++ b/src/lib/protocols/dofus.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DOFUS #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_dofus_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/drda.c b/src/lib/protocols/drda.c index dd39afdc6be..a3b1a414377 100644 --- a/src/lib/protocols/drda.c +++ b/src/lib/protocols/drda.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DRDA #include "ndpi_api.h" +#include "ndpi_private.h" struct ndpi_drda_hdr { u_int16_t length; diff --git a/src/lib/protocols/dropbox.c b/src/lib/protocols/dropbox.c index 27d2daf8bd4..eed06d4d518 100644 --- a/src/lib/protocols/dropbox.c +++ b/src/lib/protocols/dropbox.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DROPBOX #include "ndpi_api.h" +#include "ndpi_private.h" #define DB_LSP_PORT 17500 diff --git a/src/lib/protocols/eaq.c b/src/lib/protocols/eaq.c index ff97641ec75..b0c191fe8e0 100644 --- a/src/lib/protocols/eaq.c +++ b/src/lib/protocols/eaq.c @@ -30,6 +30,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_EAQ #include "ndpi_api.h" +#include "ndpi_private.h" #define EAQ_DEFAULT_PORT 6000 #define EAQ_DEFAULT_SIZE 16 diff --git a/src/lib/protocols/edonkey.c b/src/lib/protocols/edonkey.c index bd870afb3ce..389ca587d54 100644 --- a/src/lib/protocols/edonkey.c +++ b/src/lib/protocols/edonkey.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_EDONKEY #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_edonkey_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/elastic_search.c b/src/lib/protocols/elastic_search.c index f29b3fb4b60..c1de3c86b6f 100644 --- a/src/lib/protocols/elastic_search.c +++ b/src/lib/protocols/elastic_search.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ELASTICSEARCH #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_elasticsearch_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/epicgames.c b/src/lib/protocols/epicgames.c index ea30783fd24..040806740bc 100644 --- a/src/lib/protocols/epicgames.c +++ b/src/lib/protocols/epicgames.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_EPICGAMES #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_epicgames_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/ethereum.c b/src/lib/protocols/ethereum.c index db7c0cb88de..bf9da6bfb5b 100644 --- a/src/lib/protocols/ethereum.c +++ b/src/lib/protocols/ethereum.c @@ -23,6 +23,7 @@ #include "ndpi_protocol_ids.h" #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ETHEREUM #include "ndpi_api.h" +#include "ndpi_private.h" /* ************************************************************************** */ diff --git a/src/lib/protocols/ethernet_ip.c b/src/lib/protocols/ethernet_ip.c index 45ca056986c..9a968ee9434 100644 --- a/src/lib/protocols/ethernet_ip.c +++ b/src/lib/protocols/ethernet_ip.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ETHERNET_IP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_ethernet_ip_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/fastcgi.c b/src/lib/protocols/fastcgi.c index f5b4eb0b11e..e36311a8e25 100644 --- a/src/lib/protocols/fastcgi.c +++ b/src/lib/protocols/fastcgi.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FASTCGI #include "ndpi_api.h" +#include "ndpi_private.h" /* Reference: http://www.mit.edu/~yandros/doc/specs/fcgi-spec.html */ diff --git a/src/lib/protocols/fix.c b/src/lib/protocols/fix.c index 0d0e71331a5..f0fed33608c 100644 --- a/src/lib/protocols/fix.c +++ b/src/lib/protocols/fix.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FIX #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_fix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/ftp_control.c b/src/lib/protocols/ftp_control.c index 86e6491c2ec..40378a4c664 100644 --- a/src/lib/protocols/ftp_control.c +++ b/src/lib/protocols/ftp_control.c @@ -26,13 +26,10 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FTP_CONTROL #include "ndpi_api.h" +#include "ndpi_private.h" // #define FTP_DEBUG -extern void switch_extra_dissection_to_tls(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); - -/* *************************************************************** */ static void ndpi_int_ftp_control_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/ftp_data.c b/src/lib/protocols/ftp_data.c index ef924c5fa17..567669e3d25 100644 --- a/src/lib/protocols/ftp_data.c +++ b/src/lib/protocols/ftp_data.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FTP_DATA #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_ftp_data_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FTP_DATA, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI); diff --git a/src/lib/protocols/genshin_impact.c b/src/lib/protocols/genshin_impact.c index e837747a4ca..abe15afb571 100644 --- a/src/lib/protocols/genshin_impact.c +++ b/src/lib/protocols/genshin_impact.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GENSHIN_IMPACT #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_genshin_impact_add_connection( diff --git a/src/lib/protocols/git.c b/src/lib/protocols/git.c index 06038febd08..a4db11363c9 100644 --- a/src/lib/protocols/git.c +++ b/src/lib/protocols/git.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GIT #include "ndpi_api.h" +#include "ndpi_private.h" #define GIT_PORT 9418 diff --git a/src/lib/protocols/gnutella.c b/src/lib/protocols/gnutella.c index 65415fcbb2e..94e1dc2ef41 100644 --- a/src/lib/protocols/gnutella.c +++ b/src/lib/protocols/gnutella.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GNUTELLA #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_gnutella_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/gtp.c b/src/lib/protocols/gtp.c index a226d9ebf1c..b26247a9c5b 100644 --- a/src/lib/protocols/gtp.c +++ b/src/lib/protocols/gtp.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GTP #include "ndpi_api.h" +#include "ndpi_private.h" /* This code handles: GTP-U (port 2152), GTP-C (v1 and v2; port 2123) and GTP-PRIME diff --git a/src/lib/protocols/guildwars.c b/src/lib/protocols/guildwars.c index 86ca00a6d2d..202c425bdd0 100644 --- a/src/lib/protocols/guildwars.c +++ b/src/lib/protocols/guildwars.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GUILDWARS #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_guildwars_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/h323.c b/src/lib/protocols/h323.c index d0e4e8a20cf..d7041dfc0f2 100644 --- a/src/lib/protocols/h323.c +++ b/src/lib/protocols/h323.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_H323 #include "ndpi_api.h" +#include "ndpi_private.h" struct tpkt { diff --git a/src/lib/protocols/halflife2_and_mods.c b/src/lib/protocols/halflife2_and_mods.c index b4c91dd1930..e18434a95b0 100644 --- a/src/lib/protocols/halflife2_and_mods.c +++ b/src/lib/protocols/halflife2_and_mods.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HALFLIFE2 #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_halflife2_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/haproxy.c b/src/lib/protocols/haproxy.c index 8354df9dbe0..8ceabf9ebe1 100644 --- a/src/lib/protocols/haproxy.c +++ b/src/lib/protocols/haproxy.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HAPROXY #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_haproxy_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/hots.c b/src/lib/protocols/hots.c index ac11f273bb6..38420ce3a65 100644 --- a/src/lib/protocols/hots.c +++ b/src/lib/protocols/hots.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HOTS #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_hots_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/hpvirtgrp.c b/src/lib/protocols/hpvirtgrp.c index df2da5faacf..3e8e03ccc26 100644 --- a/src/lib/protocols/hpvirtgrp.c +++ b/src/lib/protocols/hpvirtgrp.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HPVIRTGRP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_hpvirtgrp_add_connection( diff --git a/src/lib/protocols/hsrp.c b/src/lib/protocols/hsrp.c index 3f177ebfbd0..de980344c3e 100644 --- a/src/lib/protocols/hsrp.c +++ b/src/lib/protocols/hsrp.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HSRP #include "ndpi_api.h" +#include "ndpi_private.h" #define HSRP_PORT 1985 #define HSRP_PORT_V6 2029 diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index 2828202dd43..ee0c6159177 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HTTP #include "ndpi_api.h" +#include "ndpi_private.h" static const char* binary_file_mimes_e[] = { "exe", NULL }; static const char* binary_file_mimes_j[] = { "java-vm", NULL }; @@ -46,9 +47,6 @@ static const char* binary_file_ext[] = { NULL }; -extern void ookla_add_to_cache(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); - static void ndpi_search_http_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); static void ndpi_check_http_header(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/http2.c b/src/lib/protocols/http2.c index cca341965e5..cde354a1eba 100644 --- a/src/lib/protocols/http2.c +++ b/src/lib/protocols/http2.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HTTP2 #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_http2_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/i3d.c b/src/lib/protocols/i3d.c index ba292c3d731..c0cd8e44722 100644 --- a/src/lib/protocols/i3d.c +++ b/src/lib/protocols/i3d.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_I3D #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_i3d_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/iax.c b/src/lib/protocols/iax.c index d988fe772fe..45204229c6a 100644 --- a/src/lib/protocols/iax.c +++ b/src/lib/protocols/iax.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IAX #include "ndpi_api.h" +#include "ndpi_private.h" #define NDPI_IAX_MAX_INFORMATION_ELEMENTS 15 diff --git a/src/lib/protocols/icecast.c b/src/lib/protocols/icecast.c index d7baa261c36..b910e262851 100644 --- a/src/lib/protocols/icecast.c +++ b/src/lib/protocols/icecast.c @@ -27,9 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ICECAST #include "ndpi_api.h" - -extern int ndpi_current_pkt_from_client_to_server(const struct ndpi_detection_module_struct *ndpi_str, const struct ndpi_flow_struct *flow); -extern int ndpi_current_pkt_from_server_to_client(const struct ndpi_detection_module_struct *ndpi_str, const struct ndpi_flow_struct *flow); +#include "ndpi_private.h" static void ndpi_int_icecast_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { @@ -63,12 +61,12 @@ static void ndpi_search_icecast_tcp(struct ndpi_detection_module_struct *ndpi_st } } - if(ndpi_current_pkt_from_client_to_server(ndpi_struct, flow) + if(current_pkt_from_client_to_server(ndpi_struct, flow) && (flow->packet_counter < 10)) { return; } - if(ndpi_current_pkt_from_server_to_client(ndpi_struct, flow)) { + if(current_pkt_from_server_to_client(ndpi_struct, flow)) { /* server answer, now test Server for Icecast */ ndpi_parse_packet_line_info(ndpi_struct, flow); diff --git a/src/lib/protocols/iec60870-5-104.c b/src/lib/protocols/iec60870-5-104.c index e03ea18d355..ed28313b28b 100644 --- a/src/lib/protocols/iec60870-5-104.c +++ b/src/lib/protocols/iec60870-5-104.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IEC60870 #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_iec60870_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/imo.c b/src/lib/protocols/imo.c index d73d8a6e1d9..68cb9fb1b57 100644 --- a/src/lib/protocols/imo.c +++ b/src/lib/protocols/imo.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IMO #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_imo_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/ipp.c b/src/lib/protocols/ipp.c index 5ff17c75680..13d10bed2a4 100644 --- a/src/lib/protocols/ipp.c +++ b/src/lib/protocols/ipp.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IPP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_ipp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/ipsec.c b/src/lib/protocols/ipsec.c index 1e49d6ef4de..fdd08cb6f5e 100644 --- a/src/lib/protocols/ipsec.c +++ b/src/lib/protocols/ipsec.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IPSEC #include "ndpi_api.h" +#include "ndpi_private.h" enum isakmp_type { ISAKMP_INVALID = 0, diff --git a/src/lib/protocols/irc.c b/src/lib/protocols/irc.c index db73553e281..354e27fd14f 100644 --- a/src/lib/protocols/irc.c +++ b/src/lib/protocols/irc.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IRC #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_irc_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, ndpi_confidence_t confidence) { diff --git a/src/lib/protocols/jabber.c b/src/lib/protocols/jabber.c index 770bfe9e948..552d2618f6a 100644 --- a/src/lib/protocols/jabber.c +++ b/src/lib/protocols/jabber.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_JABBER #include "ndpi_api.h" +#include "ndpi_private.h" struct jabber_string { char *string; diff --git a/src/lib/protocols/kakaotalk_voice.c b/src/lib/protocols/kakaotalk_voice.c index dde13cde7d8..1913fe1569c 100644 --- a/src/lib/protocols/kakaotalk_voice.c +++ b/src/lib/protocols/kakaotalk_voice.c @@ -29,6 +29,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KAKAOTALK_VOICE #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/kerberos.c b/src/lib/protocols/kerberos.c index 9d5794ba507..1939a2e327c 100644 --- a/src/lib/protocols/kerberos.c +++ b/src/lib/protocols/kerberos.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KERBEROS #include "ndpi_api.h" +#include "ndpi_private.h" /* #define KERBEROS_DEBUG 1 */ diff --git a/src/lib/protocols/kismet.c b/src/lib/protocols/kismet.c index 4d4f3dae49f..9c292de541f 100644 --- a/src/lib/protocols/kismet.c +++ b/src/lib/protocols/kismet.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KISMET #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_kismet_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/kontiki.c b/src/lib/protocols/kontiki.c index 2186bde4051..5da07acc0e5 100644 --- a/src/lib/protocols/kontiki.c +++ b/src/lib/protocols/kontiki.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KONTIKI #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_kontiki_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/ldap.c b/src/lib/protocols/ldap.c index a7c64807eb1..36f4c5686d5 100644 --- a/src/lib/protocols/ldap.c +++ b/src/lib/protocols/ldap.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_LDAP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_ldap_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/line.c b/src/lib/protocols/line.c index 4ad24984485..0de5e856ed2 100644 --- a/src/lib/protocols/line.c +++ b/src/lib/protocols/line.c @@ -24,8 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_LINE_CALL #include "ndpi_api.h" - -extern int is_valid_rtp_payload_type(uint8_t type); +#include "ndpi_private.h" static void ndpi_int_line_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/lisp.c b/src/lib/protocols/lisp.c index 780a9cd9ce3..a124d6aee9e 100644 --- a/src/lib/protocols/lisp.c +++ b/src/lib/protocols/lisp.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_LISP #include "ndpi_api.h" +#include "ndpi_private.h" #define LISP_PORT 4341 /* Only UDP */ #define LISP_PORT1 4342 /* TCP and UDP */ diff --git a/src/lib/protocols/lotus_notes.c b/src/lib/protocols/lotus_notes.c index 5b6a7921978..bb2ca18ad88 100644 --- a/src/lib/protocols/lotus_notes.c +++ b/src/lib/protocols/lotus_notes.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_LOTUS_NOTES #include "ndpi_api.h" +#include "ndpi_private.h" /* ************************************ */ diff --git a/src/lib/protocols/mail_imap.c b/src/lib/protocols/mail_imap.c index d864c4f3670..a9eeaf64f86 100644 --- a/src/lib/protocols/mail_imap.c +++ b/src/lib/protocols/mail_imap.c @@ -27,12 +27,10 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAIL_IMAP #include "ndpi_api.h" +#include "ndpi_private.h" /* #define IMAP_DEBUG 1*/ -extern void switch_extra_dissection_to_tls(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); - static void ndpi_int_mail_imap_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int16_t protocol) { flow->guessed_protocol_id = NDPI_PROTOCOL_UNKNOWN; /* Avoid IMAPS to be used s sub-protocol */ diff --git a/src/lib/protocols/mail_pop.c b/src/lib/protocols/mail_pop.c index 0a1e7d8ee18..045ff1c7c70 100644 --- a/src/lib/protocols/mail_pop.c +++ b/src/lib/protocols/mail_pop.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAIL_POP #include "ndpi_api.h" +#include "ndpi_private.h" #define POP_BIT_AUTH 0x0001 @@ -43,9 +44,6 @@ #define POP_BIT_STLS 0x0400 -extern void switch_extra_dissection_to_tls(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); - static void ndpi_int_mail_pop_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int16_t protocol) { diff --git a/src/lib/protocols/mail_smtp.c b/src/lib/protocols/mail_smtp.c index 95e24c86c46..980ebb8c982 100644 --- a/src/lib/protocols/mail_smtp.c +++ b/src/lib/protocols/mail_smtp.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAIL_SMTP #include "ndpi_api.h" +#include "ndpi_private.h" #define SMTP_BIT_220 0x01 @@ -48,8 +49,6 @@ /* #define SMTP_DEBUG 1 */ -extern void switch_extra_dissection_to_tls(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); static void ndpi_int_mail_smtp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/maplestory.c b/src/lib/protocols/maplestory.c index f47002b9893..aa53700826e 100644 --- a/src/lib/protocols/maplestory.c +++ b/src/lib/protocols/maplestory.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAPLESTORY #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_maplestory_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/megaco.c b/src/lib/protocols/megaco.c index 615382055d6..98d2d8e97f5 100644 --- a/src/lib/protocols/megaco.c +++ b/src/lib/protocols/megaco.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MEGACO #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_megaco(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/memcached.c b/src/lib/protocols/memcached.c index 5984ae896ea..0210a028a90 100644 --- a/src/lib/protocols/memcached.c +++ b/src/lib/protocols/memcached.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MEMCACHED #include "ndpi_api.h" +#include "ndpi_private.h" #define MCDC_SET "set " #define MCDC_SET_LEN (sizeof(MCDC_SET) - 1) diff --git a/src/lib/protocols/merakicloud.c b/src/lib/protocols/merakicloud.c index 40fc1b5af11..5a0f0991f1c 100644 --- a/src/lib/protocols/merakicloud.c +++ b/src/lib/protocols/merakicloud.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MERAKI_CLOUD #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_merakicloud_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/mgcp.c b/src/lib/protocols/mgcp.c index 876325bd33f..02963e9cdbc 100644 --- a/src/lib/protocols/mgcp.c +++ b/src/lib/protocols/mgcp.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MGCP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_mgcp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/mining.c b/src/lib/protocols/mining.c index 060d20b74ba..9e4c8754dd4 100644 --- a/src/lib/protocols/mining.c +++ b/src/lib/protocols/mining.c @@ -23,6 +23,7 @@ #include "ndpi_protocol_ids.h" #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MINING #include "ndpi_api.h" +#include "ndpi_private.h" /* ************************************************************************** */ diff --git a/src/lib/protocols/modbus.c b/src/lib/protocols/modbus.c index 083740d9f01..8eb0f8dae51 100644 --- a/src/lib/protocols/modbus.c +++ b/src/lib/protocols/modbus.c @@ -26,6 +26,7 @@ #include "ndpi_protocol_ids.h" #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MODBUS #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_modbus_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/mongodb.c b/src/lib/protocols/mongodb.c index 1bf77fd5710..38cac162251 100644 --- a/src/lib/protocols/mongodb.c +++ b/src/lib/protocols/mongodb.c @@ -25,6 +25,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MONGODB #include "ndpi_api.h" +#include "ndpi_private.h" /* https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/ */ diff --git a/src/lib/protocols/mpegdash.c b/src/lib/protocols/mpegdash.c index c94e607822f..ee09dfefc27 100644 --- a/src/lib/protocols/mpegdash.c +++ b/src/lib/protocols/mpegdash.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MPEGDASH #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_mpegdash_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/mpegts.c b/src/lib/protocols/mpegts.c index 82d8fe95d3e..27aa6d63d1d 100644 --- a/src/lib/protocols/mpegts.c +++ b/src/lib/protocols/mpegts.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MPEGTS #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_mpegts(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/mqtt.c b/src/lib/protocols/mqtt.c index 8338bfa90ae..b6eff8c4c0b 100644 --- a/src/lib/protocols/mqtt.c +++ b/src/lib/protocols/mqtt.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MQTT #include "ndpi_api.h" +#include "ndpi_private.h" /** diff --git a/src/lib/protocols/mssql_tds.c b/src/lib/protocols/mssql_tds.c index c48646f240b..38efe578df6 100644 --- a/src/lib/protocols/mssql_tds.c +++ b/src/lib/protocols/mssql_tds.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MSSQL_TDS #include "ndpi_api.h" +#include "ndpi_private.h" struct tds_packet_header { diff --git a/src/lib/protocols/munin.c b/src/lib/protocols/munin.c index e3fcf5bc0c0..47e9d6698ca 100644 --- a/src/lib/protocols/munin.c +++ b/src/lib/protocols/munin.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MUNIN #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_munin_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/mysql.c b/src/lib/protocols/mysql.c index 1a0402ca15b..c3e04ef8bb0 100644 --- a/src/lib/protocols/mysql.c +++ b/src/lib/protocols/mysql.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MYSQL #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_mysql_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { struct ndpi_packet_struct *packet = &ndpi_struct->packet; diff --git a/src/lib/protocols/natpmp.c b/src/lib/protocols/natpmp.c index bfc91886e3d..4c259c91c1c 100644 --- a/src/lib/protocols/natpmp.c +++ b/src/lib/protocols/natpmp.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_NATPMP #include "ndpi_api.h" +#include "ndpi_private.h" #define NATPMP_PORT 5351 diff --git a/src/lib/protocols/nats.c b/src/lib/protocols/nats.c index da44e5d87a7..d7bb79bef0e 100644 --- a/src/lib/protocols/nats.c +++ b/src/lib/protocols/nats.c @@ -22,6 +22,7 @@ #include "ndpi_protocol_ids.h" #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_NATS #include "ndpi_api.h" +#include "ndpi_private.h" static const char* commands[] = { diff --git a/src/lib/protocols/nest_log_sink.c b/src/lib/protocols/nest_log_sink.c index fd216ce7242..d2a3f62d00d 100644 --- a/src/lib/protocols/nest_log_sink.c +++ b/src/lib/protocols/nest_log_sink.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_NEST_LOG_SINK #include "ndpi_api.h" +#include "ndpi_private.h" #define NEST_LOG_SINK_PORT 11095 #define NEST_LOG_SINK_MIN_LEN 8 diff --git a/src/lib/protocols/netbios.c b/src/lib/protocols/netbios.c index a84333d5f3f..286d909e5ec 100644 --- a/src/lib/protocols/netbios.c +++ b/src/lib/protocols/netbios.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_NETBIOS #include "ndpi_api.h" +#include "ndpi_private.h" /* ****************************************************************** */ diff --git a/src/lib/protocols/netflow.c b/src/lib/protocols/netflow.c index 97b8cef991c..ccb5b2762ff 100644 --- a/src/lib/protocols/netflow.c +++ b/src/lib/protocols/netflow.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_NETFLOW #include "ndpi_api.h" +#include "ndpi_private.h" #ifdef WIN32 diff --git a/src/lib/protocols/nfs.c b/src/lib/protocols/nfs.c index 55db41f5439..5fe9f78c347 100644 --- a/src/lib/protocols/nfs.c +++ b/src/lib/protocols/nfs.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_NFS #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_nfs_add_connection(struct ndpi_detection_module_struct diff --git a/src/lib/protocols/nintendo.c b/src/lib/protocols/nintendo.c index 18b961986ac..29cf1bbbf6d 100644 --- a/src/lib/protocols/nintendo.c +++ b/src/lib/protocols/nintendo.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_NINTENDO #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_nintendo_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, diff --git a/src/lib/protocols/noe.c b/src/lib/protocols/noe.c index f72ddf8b2d3..37bfb8c7157 100644 --- a/src/lib/protocols/noe.c +++ b/src/lib/protocols/noe.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_NOE #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_noe_add_connection(struct ndpi_detection_module_struct diff --git a/src/lib/protocols/non_tcp_udp.c b/src/lib/protocols/non_tcp_udp.c index 62ef9b02b8e..1aa993eb5d1 100644 --- a/src/lib/protocols/non_tcp_udp.c +++ b/src/lib/protocols/non_tcp_udp.c @@ -26,6 +26,7 @@ #include "ndpi_protocol_ids.h" #include "ndpi_api.h" +#include "ndpi_private.h" #define set_protocol_and_bmask(nprot) \ { \ diff --git a/src/lib/protocols/ntp.c b/src/lib/protocols/ntp.c index 7737bfa0e0d..8e08b391ac8 100644 --- a/src/lib/protocols/ntp.c +++ b/src/lib/protocols/ntp.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_NTP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_ntp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/oicq.c b/src/lib/protocols/oicq.c index 6a1dd489470..50585fe9edb 100644 --- a/src/lib/protocols/oicq.c +++ b/src/lib/protocols/oicq.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_OICQ #include "ndpi_api.h" +#include "ndpi_private.h" PACK_ON struct oicq_hdr { diff --git a/src/lib/protocols/ookla.c b/src/lib/protocols/ookla.c index d7764e630fa..b5391234b74 100644 --- a/src/lib/protocols/ookla.c +++ b/src/lib/protocols/ookla.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_OOKLA #include "ndpi_api.h" +#include "ndpi_private.h" /* #define DEBUG_OOKLA_LRU */ diff --git a/src/lib/protocols/openvpn.c b/src/lib/protocols/openvpn.c index 1154f9afff7..127214ea118 100644 --- a/src/lib/protocols/openvpn.c +++ b/src/lib/protocols/openvpn.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_OPENVPN #include "ndpi_api.h" +#include "ndpi_private.h" /* * OpenVPN TCP / UDP Detection - 128/160 hmac diff --git a/src/lib/protocols/oracle.c b/src/lib/protocols/oracle.c index 96012b31c5b..95f5d91613a 100644 --- a/src/lib/protocols/oracle.c +++ b/src/lib/protocols/oracle.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ORACLE #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_oracle_add_connection(struct ndpi_detection_module_struct diff --git a/src/lib/protocols/postgres.c b/src/lib/protocols/postgres.c index 3bc51d96d5a..56e2158626a 100644 --- a/src/lib/protocols/postgres.c +++ b/src/lib/protocols/postgres.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_POSTGRES #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_postgres_add_connection(struct ndpi_detection_module_struct diff --git a/src/lib/protocols/ppstream.c b/src/lib/protocols/ppstream.c index dad801ff47f..83f3648a916 100644 --- a/src/lib/protocols/ppstream.c +++ b/src/lib/protocols/ppstream.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_PPSTREAM #include "ndpi_api.h" +#include "ndpi_private.h" #define PPS_PORT 17788 diff --git a/src/lib/protocols/pptp.c b/src/lib/protocols/pptp.c index 6cc41bd444a..8951d091ebb 100644 --- a/src/lib/protocols/pptp.c +++ b/src/lib/protocols/pptp.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_PPTP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_pptp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/protobuf.c b/src/lib/protocols/protobuf.c index fe477833662..2ba63670d93 100644 --- a/src/lib/protocols/protobuf.c +++ b/src/lib/protocols/protobuf.c @@ -32,6 +32,7 @@ #define PROTOBUF_MAX_PACKETS 8 #include "ndpi_api.h" +#include "ndpi_private.h" enum protobuf_type { PT_INVALID = -1, diff --git a/src/lib/protocols/qq.c b/src/lib/protocols/qq.c index c091457a2a2..3a903987467 100644 --- a/src/lib/protocols/qq.c +++ b/src/lib/protocols/qq.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_QQ #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_qq_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/quic.c b/src/lib/protocols/quic.c index 4b9474d7acf..183d2e5244b 100644 --- a/src/lib/protocols/quic.c +++ b/src/lib/protocols/quic.c @@ -25,6 +25,8 @@ #include "ndpi_protocol_ids.h" #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_QUIC #include "ndpi_api.h" +#include "ndpi_private.h" + #ifdef USE_HOST_LIBGCRYPT #include @@ -43,13 +45,6 @@ * https://www.rfc-editor.org/rfc/rfc9369.txt [v2] */ -extern int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow, uint32_t quic_version); -extern int http_process_user_agent(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow, - const u_int8_t *ua_ptr, u_int16_t ua_ptr_len); -extern int is_valid_rtp_payload_type(uint8_t type); - /* Versions */ #define V_2 0x6b3343cf #define V_1 0x00000001 diff --git a/src/lib/protocols/radius.c b/src/lib/protocols/radius.c index 0c48bb19c0d..97a6c14c909 100644 --- a/src/lib/protocols/radius.c +++ b/src/lib/protocols/radius.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RADIUS #include "ndpi_api.h" +#include "ndpi_private.h" #define RADIUS_PORT 1812 #define RADIUS_PORT_ACC 1813 diff --git a/src/lib/protocols/raknet.c b/src/lib/protocols/raknet.c index e134f36680f..c7b52ad3847 100644 --- a/src/lib/protocols/raknet.c +++ b/src/lib/protocols/raknet.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RAKNET #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_raknet_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/rdp.c b/src/lib/protocols/rdp.c index 363f486283e..305c1c27ffd 100644 --- a/src/lib/protocols/rdp.c +++ b/src/lib/protocols/rdp.c @@ -30,6 +30,7 @@ #define RDP_PORT 3389 #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_rdp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/redis_net.c b/src/lib/protocols/redis_net.c index 17c43db0460..a25d72f0c5c 100644 --- a/src/lib/protocols/redis_net.c +++ b/src/lib/protocols/redis_net.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_REDIS #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_redis_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/riotgames.c b/src/lib/protocols/riotgames.c index 370b29f93ce..df20618d4ad 100644 --- a/src/lib/protocols/riotgames.c +++ b/src/lib/protocols/riotgames.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RIOTGAMES #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_riotgames_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/rmcp.c b/src/lib/protocols/rmcp.c index 442179beafb..19402e5ba5a 100644 --- a/src/lib/protocols/rmcp.c +++ b/src/lib/protocols/rmcp.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RMCP #include "ndpi_api.h" +#include "ndpi_private.h" PACK_ON struct rmcp_header { diff --git a/src/lib/protocols/rsh.c b/src/lib/protocols/rsh.c index f1ce95a84d8..6addb740462 100644 --- a/src/lib/protocols/rsh.c +++ b/src/lib/protocols/rsh.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RSH #include "ndpi_api.h" +#include "ndpi_private.h" #define RSH_DEFAULT_PORT 514 diff --git a/src/lib/protocols/rsync.c b/src/lib/protocols/rsync.c index 0daf25510bd..b2ab8e681a9 100644 --- a/src/lib/protocols/rsync.c +++ b/src/lib/protocols/rsync.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RSYNC #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_rsync_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/rtcp.c b/src/lib/protocols/rtcp.c index 9e22ad4524e..25910a60215 100644 --- a/src/lib/protocols/rtcp.c +++ b/src/lib/protocols/rtcp.c @@ -9,6 +9,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RTCP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_rtcp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/rtmp.c b/src/lib/protocols/rtmp.c index 914e1bef872..c3799248df6 100644 --- a/src/lib/protocols/rtmp.c +++ b/src/lib/protocols/rtmp.c @@ -29,6 +29,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RTMP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_rtmp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/rtp.c b/src/lib/protocols/rtp.c index 1cc112be472..078550c5b3a 100644 --- a/src/lib/protocols/rtp.c +++ b/src/lib/protocols/rtp.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RTP #include "ndpi_api.h" +#include "ndpi_private.h" #define RTP_MIN_HEADER 12 #define RTCP_MIN_HEADER 8 diff --git a/src/lib/protocols/rtsp.c b/src/lib/protocols/rtsp.c index 9b43d525973..014553b5b74 100644 --- a/src/lib/protocols/rtsp.c +++ b/src/lib/protocols/rtsp.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RTSP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_rtsp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/rx.c b/src/lib/protocols/rx.c index 3a2c9580a5a..dcb040534d7 100644 --- a/src/lib/protocols/rx.c +++ b/src/lib/protocols/rx.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_RX #include "ndpi_api.h" +#include "ndpi_private.h" /* See http://web.mit.edu/kolya/afs/rx/rx-spec for protocol description. */ diff --git a/src/lib/protocols/s7comm.c b/src/lib/protocols/s7comm.c index c7488b10427..ce3d4721878 100644 --- a/src/lib/protocols/s7comm.c +++ b/src/lib/protocols/s7comm.c @@ -23,6 +23,7 @@ #include "ndpi_protocol_ids.h" #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_S7COMM #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_s7comm_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/sd_rtn.c b/src/lib/protocols/sd_rtn.c index 212ac6e4224..92e95b77a76 100644 --- a/src/lib/protocols/sd_rtn.c +++ b/src/lib/protocols/sd_rtn.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SD_RTN #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_sd_rtn_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/sflow.c b/src/lib/protocols/sflow.c index a2d704f7fa1..d731f214689 100644 --- a/src/lib/protocols/sflow.c +++ b/src/lib/protocols/sflow.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SFLOW #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_sflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/sip.c b/src/lib/protocols/sip.c index 0b06c2dac93..dd6b2a3465f 100644 --- a/src/lib/protocols/sip.c +++ b/src/lib/protocols/sip.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SIP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_sip_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, diff --git a/src/lib/protocols/skinny.c b/src/lib/protocols/skinny.c index c7c516d2ac4..b011684c7bb 100644 --- a/src/lib/protocols/skinny.c +++ b/src/lib/protocols/skinny.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SKINNY #include "ndpi_api.h" +#include "ndpi_private.h" /* Reference: Wiresahrk: epan/dissectors/packet-skinny.c */ diff --git a/src/lib/protocols/skype.c b/src/lib/protocols/skype.c index cfe102f9978..e1a5583fff9 100644 --- a/src/lib/protocols/skype.c +++ b/src/lib/protocols/skype.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SKYPE_TEAMS #include "ndpi_api.h" +#include "ndpi_private.h" static int is_port(u_int16_t a, u_int16_t b, u_int16_t c) { return(((a == c) || (b == c)) ? 1 : 0); diff --git a/src/lib/protocols/slp.c b/src/lib/protocols/slp.c index 02ee71f16db..81c1cabd963 100644 --- a/src/lib/protocols/slp.c +++ b/src/lib/protocols/slp.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SERVICE_LOCATION #include "ndpi_api.h" +#include "ndpi_private.h" PACK_ON struct slp_hdr_v1 { diff --git a/src/lib/protocols/smb.c b/src/lib/protocols/smb.c index 25cb2ee675a..ead48f0a099 100644 --- a/src/lib/protocols/smb.c +++ b/src/lib/protocols/smb.c @@ -23,6 +23,7 @@ #include "ndpi_protocol_ids.h" #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SMBV23 #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_smb_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/smpp.c b/src/lib/protocols/smpp.c index 16628e7094b..a0f865f3d9a 100644 --- a/src/lib/protocols/smpp.c +++ b/src/lib/protocols/smpp.c @@ -25,6 +25,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SMPP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_smpp_add_connection(struct ndpi_detection_module_struct* ndpi_struct, diff --git a/src/lib/protocols/snmp_proto.c b/src/lib/protocols/snmp_proto.c index f4678afceef..66e415db30d 100644 --- a/src/lib/protocols/snmp_proto.c +++ b/src/lib/protocols/snmp_proto.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SNMP #include "ndpi_api.h" +#include "ndpi_private.h" /* #define SNMP_DEBUG */ diff --git a/src/lib/protocols/soap.c b/src/lib/protocols/soap.c index 18e636b57ce..96b1ead7162 100644 --- a/src/lib/protocols/soap.c +++ b/src/lib/protocols/soap.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SOAP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_soap_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/socks45.c b/src/lib/protocols/socks45.c index 6cdac93d15c..742e0a6e665 100644 --- a/src/lib/protocols/socks45.c +++ b/src/lib/protocols/socks45.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SOCKS #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_socks_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/softether.c b/src/lib/protocols/softether.c index 3c90b0da988..d0ad8b49274 100644 --- a/src/lib/protocols/softether.c +++ b/src/lib/protocols/softether.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SOFTETHER #include "ndpi_api.h" +#include "ndpi_private.h" enum softether_value_type { VALUE_INT = 0u, diff --git a/src/lib/protocols/someip.c b/src/lib/protocols/someip.c index a256c82fb58..c2e4ee3306c 100644 --- a/src/lib/protocols/someip.c +++ b/src/lib/protocols/someip.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SOMEIP #include "ndpi_api.h" +#include "ndpi_private.h" enum SOMEIP_MESSAGE_TYPES { SOMEIP_REQUEST = 0x00, diff --git a/src/lib/protocols/source_engine.c b/src/lib/protocols/source_engine.c index 5d6aa539922..8d92f537eea 100644 --- a/src/lib/protocols/source_engine.c +++ b/src/lib/protocols/source_engine.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SOURCE_ENGINE #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_source_engine_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/spotify.c b/src/lib/protocols/spotify.c index b2739424578..4bb9ce452b1 100644 --- a/src/lib/protocols/spotify.c +++ b/src/lib/protocols/spotify.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SPOTIFY #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_spotify_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/ssdp.c b/src/lib/protocols/ssdp.c index 5d832367a6f..cede17d858c 100644 --- a/src/lib/protocols/ssdp.c +++ b/src/lib/protocols/ssdp.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SSDP #include "ndpi_api.h" +#include "ndpi_private.h" static void ssdp_parse_lines(struct ndpi_detection_module_struct diff --git a/src/lib/protocols/ssh.c b/src/lib/protocols/ssh.c index 5e65f1d82fa..d950ede95c7 100644 --- a/src/lib/protocols/ssh.c +++ b/src/lib/protocols/ssh.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SSH #include "ndpi_api.h" +#include "ndpi_private.h" #include "ndpi_md5.h" #include diff --git a/src/lib/protocols/starcraft.c b/src/lib/protocols/starcraft.c index b947e433e22..8cf59bbbfc5 100644 --- a/src/lib/protocols/starcraft.c +++ b/src/lib/protocols/starcraft.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_STARCRAFT #include "ndpi_api.h" +#include "ndpi_private.h" /* Sender or receiver are one of the known login portals? */ diff --git a/src/lib/protocols/steam.c b/src/lib/protocols/steam.c index f582384798f..4f5b883084e 100644 --- a/src/lib/protocols/steam.c +++ b/src/lib/protocols/steam.c @@ -29,6 +29,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_STEAM #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_steam_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI); diff --git a/src/lib/protocols/stun.c b/src/lib/protocols/stun.c index 0f3810b8107..7cff65530b8 100644 --- a/src/lib/protocols/stun.c +++ b/src/lib/protocols/stun.c @@ -26,19 +26,13 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_STUN #include "ndpi_api.h" +#include "ndpi_private.h" // #define DEBUG_LRU 1 // #define DEBUG_ZOOM_LRU 1 #define STUN_HDR_LEN 20 /* STUN message header length, Classic-STUN (RFC 3489) and STUN (RFC 8489) both */ -extern void switch_to_tls(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); -extern int is_rtp_or_rtcp(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); -extern u_int8_t rtp_get_stream_type(u_int8_t payloadType, ndpi_multimedia_flow_type *s_type); -extern int is_dtls(const u_int8_t *buf, u_int32_t buf_len, u_int32_t *block_len); - static u_int32_t get_stun_lru_key(struct ndpi_flow_struct *flow, u_int8_t rev); static u_int32_t get_stun_lru_key_raw4(u_int32_t ip, u_int16_t port); static void ndpi_int_stun_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/syncthing.c b/src/lib/protocols/syncthing.c index cdfc756c65b..93039d9be34 100644 --- a/src/lib/protocols/syncthing.c +++ b/src/lib/protocols/syncthing.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SYNCTHING #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_syncthing_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/syslog.c b/src/lib/protocols/syslog.c index 640ce21d8ab..ec349c519c1 100644 --- a/src/lib/protocols/syslog.c +++ b/src/lib/protocols/syslog.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_SYSLOG #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_syslog_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/tailscale.c b/src/lib/protocols/tailscale.c index ca866d5abfc..41de2f7cb7a 100644 --- a/src/lib/protocols/tailscale.c +++ b/src/lib/protocols/tailscale.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TAILSCALE #include "ndpi_api.h" +#include "ndpi_private.h" /* https://github.com/tailscale/tailscale/blob/main/disco/disco.go * https://tailscale.com/kb/1082/firewall-ports/ diff --git a/src/lib/protocols/tcp_udp.c b/src/lib/protocols/tcp_udp.c index 473260adf5e..f6194c2f7ec 100644 --- a/src/lib/protocols/tcp_udp.c +++ b/src/lib/protocols/tcp_udp.c @@ -20,6 +20,7 @@ #include "ndpi_api.h" +#include "ndpi_private.h" u_int ndpi_search_tcp_or_udp_raw(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/teamspeak.c b/src/lib/protocols/teamspeak.c index 9184e16e58b..60fb466e0de 100644 --- a/src/lib/protocols/teamspeak.c +++ b/src/lib/protocols/teamspeak.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TEAMSPEAK #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_teamspeak_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/teamviewer.c b/src/lib/protocols/teamviewer.c index b9030d2fd09..4c0df2e6116 100644 --- a/src/lib/protocols/teamviewer.c +++ b/src/lib/protocols/teamviewer.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TEAMVIEWER #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_teamview_add_connection(struct ndpi_detection_module_struct diff --git a/src/lib/protocols/telegram.c b/src/lib/protocols/telegram.c index bab1d33365b..6d457d45f39 100644 --- a/src/lib/protocols/telegram.c +++ b/src/lib/protocols/telegram.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TELEGRAM #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_telegram_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/telnet.c b/src/lib/protocols/telnet.c index a4dd107c63c..d543c6efac2 100644 --- a/src/lib/protocols/telnet.c +++ b/src/lib/protocols/telnet.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TELNET #include "ndpi_api.h" +#include "ndpi_private.h" /* #define TELNET_DEBUG 1 */ diff --git a/src/lib/protocols/teredo.c b/src/lib/protocols/teredo.c index f1d1f07affd..9ecdff7d215 100644 --- a/src/lib/protocols/teredo.c +++ b/src/lib/protocols/teredo.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TEREDO #include "ndpi_api.h" +#include "ndpi_private.h" /* https://en.wikipedia.org/wiki/Teredo_tunneling */ static void ndpi_search_teredo(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/tftp.c b/src/lib/protocols/tftp.c index 9c8d9b6d38e..b44746f455b 100644 --- a/src/lib/protocols/tftp.c +++ b/src/lib/protocols/tftp.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TFTP #include "ndpi_api.h" +#include "ndpi_private.h" /* see: https://datatracker.ietf.org/doc/html/rfc1350 */ diff --git a/src/lib/protocols/threema.c b/src/lib/protocols/threema.c index eca410ad418..14d25396193 100644 --- a/src/lib/protocols/threema.c +++ b/src/lib/protocols/threema.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_THREEMA #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_threema_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, diff --git a/src/lib/protocols/thrift.c b/src/lib/protocols/thrift.c index 92f00378103..1e1749b9f42 100644 --- a/src/lib/protocols/thrift.c +++ b/src/lib/protocols/thrift.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_APACHE_THRIFT #include "ndpi_api.h" +#include "ndpi_private.h" #include diff --git a/src/lib/protocols/tinc.c b/src/lib/protocols/tinc.c index 1451be68c5c..0e12d6270ee 100644 --- a/src/lib/protocols/tinc.c +++ b/src/lib/protocols/tinc.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TINC #include "ndpi_api.h" +#include "ndpi_private.h" #include "libcache.h" PACK_ON struct tinc_cache_entry { diff --git a/src/lib/protocols/tivoconnect.c b/src/lib/protocols/tivoconnect.c index de0b78c2567..4bfd041e9d3 100644 --- a/src/lib/protocols/tivoconnect.c +++ b/src/lib/protocols/tivoconnect.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TIVOCONNECT #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_tivoconnect_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c index 09e10858ee3..44c36cb6dc9 100644 --- a/src/lib/protocols/tls.c +++ b/src/lib/protocols/tls.c @@ -26,21 +26,11 @@ #include "ndpi_md5.h" #include "ndpi_sha1.h" #include "ndpi_encryption.h" +#include "ndpi_private.h" + -extern char *strptime(const char *s, const char *format, struct tm *tm); -extern int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow, uint32_t quic_version); static void ndpi_search_tls_wrapper(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); -extern int http_process_user_agent(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow, - const u_int8_t *ua_ptr, u_int16_t ua_ptr_len); -extern int ookla_search_into_cache(struct ndpi_detection_module_struct* ndpi_struct, - struct ndpi_flow_struct* flow); -/* QUIC/GQUIC stuff */ -extern int quic_len(const uint8_t *buf, uint64_t *value); -extern int quic_len_buffer_still_required(uint8_t value); -extern int is_version_with_var_int_transport_params(uint32_t version); // #define DEBUG_TLS_MEMORY 1 // #define DEBUG_TLS 1 diff --git a/src/lib/protocols/tocaboca.c b/src/lib/protocols/tocaboca.c index 2de13f8f256..cf5c39af5af 100644 --- a/src/lib/protocols/tocaboca.c +++ b/src/lib/protocols/tocaboca.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TOCA_BOCA #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_toca_boca_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/tplink_shp.c b/src/lib/protocols/tplink_shp.c index 6b75754ddc3..c4b68f71b97 100644 --- a/src/lib/protocols/tplink_shp.c +++ b/src/lib/protocols/tplink_shp.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TPLINK_SHP #include "ndpi_api.h" +#include "ndpi_private.h" #define _TPLSHP_MIN_LEN 2 #define _TPLSHP_TCP_LEN_HDR 4 diff --git a/src/lib/protocols/tuya_lp.c b/src/lib/protocols/tuya_lp.c index c62f979cc72..d8488aa528d 100644 --- a/src/lib/protocols/tuya_lp.c +++ b/src/lib/protocols/tuya_lp.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TUYA_LP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_tuya_lp_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/tvuplayer.c b/src/lib/protocols/tvuplayer.c index 4ea58edca5a..d400a86fc23 100644 --- a/src/lib/protocols/tvuplayer.c +++ b/src/lib/protocols/tvuplayer.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_TVUPLAYER #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_tvuplayer_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow/* , */ diff --git a/src/lib/protocols/ubntac2.c b/src/lib/protocols/ubntac2.c index 48674ee5b1c..2b56c5aee24 100644 --- a/src/lib/protocols/ubntac2.c +++ b/src/lib/protocols/ubntac2.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_UBNTAC2 #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_ubntac2_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/ultrasurf.c b/src/lib/protocols/ultrasurf.c index be878ca149a..05ba727643c 100644 --- a/src/lib/protocols/ultrasurf.c +++ b/src/lib/protocols/ultrasurf.c @@ -24,6 +24,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ULTRASURF #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_ultrasurf_add_connection(struct ndpi_detection_module_struct * const ndpi_struct, struct ndpi_flow_struct * const flow) diff --git a/src/lib/protocols/usenet.c b/src/lib/protocols/usenet.c index 7d1280ef8c0..467ed1b4f9a 100644 --- a/src/lib/protocols/usenet.c +++ b/src/lib/protocols/usenet.c @@ -28,6 +28,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_USENET #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_usenet_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/vhua.c b/src/lib/protocols/vhua.c index e37bbb0218f..c6af0740632 100644 --- a/src/lib/protocols/vhua.c +++ b/src/lib/protocols/vhua.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_VHUA #include "ndpi_api.h" +#include "ndpi_private.h" /* http://www.vhua.com diff --git a/src/lib/protocols/viber.c b/src/lib/protocols/viber.c index 08d42426baf..ae0689ce1ae 100644 --- a/src/lib/protocols/viber.c +++ b/src/lib/protocols/viber.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_VIBER #include "ndpi_api.h" +#include "ndpi_private.h" static void viber_add_connection(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/vmware.c b/src/lib/protocols/vmware.c index e6602197f6f..31433e5e160 100644 --- a/src/lib/protocols/vmware.c +++ b/src/lib/protocols/vmware.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_VMWARE #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_vmware(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/vnc.c b/src/lib/protocols/vnc.c index b3d327215db..52c64422486 100644 --- a/src/lib/protocols/vnc.c +++ b/src/lib/protocols/vnc.c @@ -25,6 +25,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_VNC #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_vnc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { diff --git a/src/lib/protocols/vxlan.c b/src/lib/protocols/vxlan.c index 41303081281..04b3b3fbc6c 100644 --- a/src/lib/protocols/vxlan.c +++ b/src/lib/protocols/vxlan.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_VXLAN #include "ndpi_api.h" +#include "ndpi_private.h" /* This code handles VXLAN as per RFC 7348 */ diff --git a/src/lib/protocols/warcraft3.c b/src/lib/protocols/warcraft3.c index 98888dbadf8..768c3da743f 100644 --- a/src/lib/protocols/warcraft3.c +++ b/src/lib/protocols/warcraft3.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_WARCRAFT3 #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_warcraft3_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/websocket.c b/src/lib/protocols/websocket.c index 93e1fc7b88b..b4cb3d1e37c 100644 --- a/src/lib/protocols/websocket.c +++ b/src/lib/protocols/websocket.c @@ -25,6 +25,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_WEBSOCKET #include "ndpi_api.h" +#include "ndpi_private.h" enum websocket_opcode { diff --git a/src/lib/protocols/whatsapp.c b/src/lib/protocols/whatsapp.c index 0803ea8a028..0458025e9a5 100644 --- a/src/lib/protocols/whatsapp.c +++ b/src/lib/protocols/whatsapp.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_WHATSAPP #include "ndpi_api.h" +#include "ndpi_private.h" #define WA_SEQ(seq) { .sequence_size = NDPI_ARRAY_LENGTH(seq) - 1 /* '\0' */, \ .sequence = seq } diff --git a/src/lib/protocols/whoisdas.c b/src/lib/protocols/whoisdas.c index 942a73cc621..8a5f7795118 100644 --- a/src/lib/protocols/whoisdas.c +++ b/src/lib/protocols/whoisdas.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_WHOIS_DAS #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_search_whois_das(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/wireguard.c b/src/lib/protocols/wireguard.c index 5356a3fd86c..16ef5aca4fc 100644 --- a/src/lib/protocols/wireguard.c +++ b/src/lib/protocols/wireguard.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_WIREGUARD #include "ndpi_api.h" +#include "ndpi_private.h" /* * See https://www.wireguard.com/protocol/ for protocol reference. diff --git a/src/lib/protocols/world_of_kung_fu.c b/src/lib/protocols/world_of_kung_fu.c index 999bcae7c68..dc867ea5e1b 100644 --- a/src/lib/protocols/world_of_kung_fu.c +++ b/src/lib/protocols/world_of_kung_fu.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_WORLD_OF_KUNG_FU #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_world_of_kung_fu_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/world_of_warcraft.c b/src/lib/protocols/world_of_warcraft.c index f41ef9c6740..6c0ab8ee4d4 100644 --- a/src/lib/protocols/world_of_warcraft.c +++ b/src/lib/protocols/world_of_warcraft.c @@ -26,6 +26,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_WORLDOFWARCRAFT #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_worldofwarcraft_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow/* , */ diff --git a/src/lib/protocols/wsd.c b/src/lib/protocols/wsd.c index 1cf623abfaa..a15ff10d042 100644 --- a/src/lib/protocols/wsd.c +++ b/src/lib/protocols/wsd.c @@ -25,6 +25,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_WSD #include "ndpi_api.h" +#include "ndpi_private.h" #define WSD_PORT 3702 diff --git a/src/lib/protocols/xbox.c b/src/lib/protocols/xbox.c index c701b0edb5d..e88cf39db5f 100644 --- a/src/lib/protocols/xbox.c +++ b/src/lib/protocols/xbox.c @@ -25,6 +25,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_XBOX #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_xbox_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) diff --git a/src/lib/protocols/xdmcp.c b/src/lib/protocols/xdmcp.c index 1840b95d719..f90877a38b2 100644 --- a/src/lib/protocols/xdmcp.c +++ b/src/lib/protocols/xdmcp.c @@ -27,6 +27,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_XDMCP #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_xdmcp_add_connection(struct ndpi_detection_module_struct diff --git a/src/lib/protocols/xiaomi.c b/src/lib/protocols/xiaomi.c index 1cdd793776d..77e55ab4ab1 100644 --- a/src/lib/protocols/xiaomi.c +++ b/src/lib/protocols/xiaomi.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_XIAOMI #include "ndpi_api.h" +#include "ndpi_private.h" static void xiaomi_dissect_metadata(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/protocols/z3950.c b/src/lib/protocols/z3950.c index 279d8bf9111..1d1028f4e8d 100644 --- a/src/lib/protocols/z3950.c +++ b/src/lib/protocols/z3950.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_Z3950 #include "ndpi_api.h" +#include "ndpi_private.h" /* https://github.com/wireshark/wireshark/blob/master/epan/dissectors/asn1/z3950/z3950.asn */ diff --git a/src/lib/protocols/zabbix.c b/src/lib/protocols/zabbix.c index 52840292712..0eb776307cd 100644 --- a/src/lib/protocols/zabbix.c +++ b/src/lib/protocols/zabbix.c @@ -23,6 +23,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ZABBIX #include "ndpi_api.h" +#include "ndpi_private.h" /* *************************************************** */ diff --git a/src/lib/protocols/zattoo.c b/src/lib/protocols/zattoo.c index cf67a82c5c1..66743aeec37 100644 --- a/src/lib/protocols/zattoo.c +++ b/src/lib/protocols/zattoo.c @@ -25,6 +25,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ZATTOO #include "ndpi_api.h" +#include "ndpi_private.h" #if !defined(WIN32) static inline diff --git a/src/lib/protocols/zeromq.c b/src/lib/protocols/zeromq.c index 124bd4cc700..d8277f453cc 100644 --- a/src/lib/protocols/zeromq.c +++ b/src/lib/protocols/zeromq.c @@ -22,6 +22,7 @@ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ZMQ #include "ndpi_api.h" +#include "ndpi_private.h" static void ndpi_int_zmq_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_ZMQ, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI); diff --git a/windows/nDPI.vcxproj b/windows/nDPI.vcxproj index e2a5259400b..6841029fa69 100644 --- a/windows/nDPI.vcxproj +++ b/windows/nDPI.vcxproj @@ -63,7 +63,7 @@ Disabled - $(ProjectDir)src\;$(ProjectDir)src\lib\;$(ProjectDir)..\src\lib\protocols\;$(ProjectDir)..\src\include\;$(ProjectDir)..\;$(ProjectDir)..\src\lib\third_party\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)src\;$(ProjectDir)src\lib\;$(ProjectDir)..\src\lib\;$(ProjectDir)..\src\include\;$(ProjectDir)..\;$(ProjectDir)..\src\lib\third_party\include\;%(AdditionalIncludeDirectories) NDPI_LIB_COMPILATION;WIN32;_WIN64;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) Default MultiThreadedDebugDLL @@ -91,7 +91,7 @@ Disabled - $(ProjectDir)src\;$(ProjectDir)src\lib\;$(ProjectDir)..\src\lib\protocols\;$(ProjectDir)..\src\include\;$(ProjectDir)..\;$(ProjectDir)..\src\lib\third_party\include\;$(ProjectDir)..\windows\WpdPack\Include\;%(AdditionalIncludeDirectories) + $(ProjectDir)src\;$(ProjectDir)src\lib\;$(ProjectDir)..\src\lib\;$(ProjectDir)..\src\include\;$(ProjectDir)..\;$(ProjectDir)..\src\lib\third_party\include\;$(ProjectDir)..\windows\WpdPack\Include\;%(AdditionalIncludeDirectories) PTW32_STATIC_LIB;STATIC_GETOPT;NDPI_LIB_COMPILATION;HAVE_STRUCT_TIMESPEC;WIN32;_WIN64;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) Default MultiThreadedDebugDLL @@ -219,7 +219,6 @@ - @@ -358,7 +357,6 @@ - @@ -381,6 +379,7 @@ + true diff --git a/windows/nDPI.vcxproj.filters b/windows/nDPI.vcxproj.filters index 42c98425f89..6a94a223e7d 100644 --- a/windows/nDPI.vcxproj.filters +++ b/windows/nDPI.vcxproj.filters @@ -7,7 +7,6 @@ - @@ -242,7 +241,6 @@ - @@ -260,6 +258,7 @@ + third_party