@@ -805,6 +805,51 @@ struct ndpi_lru_cache {
805
805
/* ************************************************** */
806
806
807
807
struct ndpi_flow_tcp_struct {
808
+ /* TCP sequence number */
809
+ u_int32_t next_tcp_seq_nr [2 ];
810
+ u_int16_t last_tcp_pkt_payload_len ;
811
+
812
+ /* Part of the TCP header */
813
+ u_int8_t cli2srv_tcp_flags , srv2cli_tcp_flags ;
814
+ u_int32_t seen_syn :1 , seen_syn_ack :1 , seen_ack :1 ;
815
+
816
+ /* NDPI_PROTOCOL_IRC */
817
+ u_int32_t irc_3a_counter :3 ;
818
+
819
+ /* NDPI_PROTOCOL_USENET */
820
+ u_int32_t usenet_stage :2 ;
821
+
822
+ /* NDPI_PROTOCOL_HTTP */
823
+ u_int32_t http_stage :3 ;
824
+ u_int32_t http_asymmetric_stage :2 ;
825
+
826
+ /* NDPI_PROTOCOL_GNUTELLA */
827
+ u_int32_t gnutella_stage :2 ; // 0 - 2
828
+
829
+ /* NDPI_PROTOCOL_SSH */
830
+ u_int32_t ssh_stage :3 ;
831
+
832
+ /* NDPI_PROTOCOL_VNC */
833
+ u_int32_t vnc_stage :2 ; // 0 - 3
834
+
835
+ /* NDPI_PROTOCOL_TELNET */
836
+ u_int32_t telnet_stage :2 ; // 0 - 2
837
+
838
+ /* NDPI_PROTOCOL_RADMIN */
839
+ u_int32_t radmin_stage :1 ;
840
+
841
+ /* NDPI_PROTOCOL_FTP_CONTROL */
842
+ u_int32_t ftp_control_stage :2 ;
843
+
844
+ /* NDPI_PROTOCOL_SOAP */
845
+ u_int32_t soap_stage :1 ;
846
+
847
+ /* NDPI_PROTOCOL_SOCKS */
848
+ u_int32_t socks5_stage :2 , socks4_stage :2 ;
849
+
850
+ /* NDPI_PROTOCOL_Z3950 */
851
+ u_int32_t z3950_stage :2 ;
852
+
808
853
/* NDPI_PROTOCOL_MAIL_SMTP */
809
854
/* NDPI_PROTOCOL_MAIL_POP */
810
855
/* NDPI_PROTOCOL_MAIL_IMAP */
@@ -815,6 +860,9 @@ struct ndpi_flow_tcp_struct {
815
860
char username [32 ], password [16 ];
816
861
} ftp_imap_pop_smtp ;
817
862
863
+ /* NDPI_PROTOCOL_LOTUS_NOTES */
864
+ u_int8_t lotus_notes_packet_id ;
865
+
818
866
/* NDPI_PROTOCOL_MAIL_SMTP */
819
867
u_int16_t smtp_command_bitmask ;
820
868
@@ -830,31 +878,11 @@ struct ndpi_flow_tcp_struct {
830
878
/* NDPI_PROTOCOL_GNUTELLA */
831
879
u_int8_t gnutella_msg_id [3 ];
832
880
833
- /* NDPI_PROTOCOL_IRC */
834
- u_int32_t irc_3a_counter :3 ;
835
-
836
- /* NDPI_PROTOCOL_USENET */
837
- u_int32_t usenet_stage :2 ;
838
-
839
- /* NDPI_PROTOCOL_HTTP */
840
- u_int32_t http_stage :3 ;
841
- u_int32_t http_asymmetric_stage :2 ;
842
-
843
- /* NDPI_PROTOCOL_GNUTELLA */
844
- u_int32_t gnutella_stage :2 ; // 0 - 2
845
-
846
- /* NDPI_PROTOCOL_SSH */
847
- u_int32_t ssh_stage :3 ;
848
-
849
- /* NDPI_PROTOCOL_VNC */
850
- u_int32_t vnc_stage :2 ; // 0 - 3
851
-
852
- /* NDPI_PROTOCOL_TELNET */
853
- u_int32_t telnet_stage :2 ; // 0 - 2
881
+ /* NDPI_PROTOCOL_NEST_LOG_SINK */
882
+ u_int8_t nest_log_sink_matches ;
854
883
855
- /* NDPI_PROTOCOL_RTMP */
856
- u_int32_t rtmp_stage :2 ;
857
- u_int16_t rtmp_client_buffer_len ;
884
+ /* NDPI_PROTOCOL_MEMCACHED */
885
+ u_int8_t memcached_matches ;
858
886
859
887
struct {
860
888
/* NDPI_PROTOCOL_TLS */
@@ -863,12 +891,16 @@ struct ndpi_flow_tcp_struct {
863
891
int16_t tls_application_blocks_len [NDPI_MAX_NUM_TLS_APPL_BLOCKS ]; /* + = src->dst, - = dst->src */
864
892
} tls ;
865
893
894
+ /* NDPI_PROTOCOL_ZMQ */
895
+ u_char prev_zmq_pkt [10 ];
896
+ u_int8_t prev_zmq_pkt_len ;
897
+
898
+ /* NDPI_PROTOCOL_RTMP */
899
+ u_int16_t rtmp_client_buffer_len ;
900
+ u_int32_t rtmp_stage :2 ;
901
+
866
902
/* NDPI_PROTOCOL_POSTGRES */
867
903
u_int32_t postgres_stage :3 ;
868
-
869
- /* Part of the TCP header. */
870
- u_int32_t seen_syn :1 , seen_syn_ack :1 , seen_ack :1 , __notused :29 ;
871
- u_int8_t cli2srv_tcp_flags , srv2cli_tcp_flags ;
872
904
873
905
/* NDPI_PROTOCOL_ICECAST */
874
906
u_int32_t icecast_stage :1 ;
@@ -884,25 +916,6 @@ struct ndpi_flow_tcp_struct {
884
916
885
917
/* NDPI_PROTOCOL_MAIL_IMAP */
886
918
u_int32_t mail_imap_stage :3 , mail_imap_starttls :2 ;
887
-
888
- /* NDPI_PROTOCOL_SOAP */
889
- u_int32_t soap_stage :1 ;
890
-
891
- /* NDPI_PROTOCOL_LOTUS_NOTES */
892
- u_int8_t lotus_notes_packet_id ;
893
-
894
- /* NDPI_PROTOCOL_ZMQ */
895
- u_int8_t prev_zmq_pkt_len ;
896
- u_char prev_zmq_pkt [10 ];
897
-
898
- /* NDPI_PROTOCOL_MEMCACHED */
899
- u_int8_t memcached_matches ;
900
-
901
- /* NDPI_PROTOCOL_NEST_LOG_SINK */
902
- u_int8_t nest_log_sink_matches ;
903
-
904
- /* NDPI_PROTOCOL_RADMIN */
905
- u_int32_t radmin_stage :1 ;
906
919
};
907
920
908
921
/* ************************************************** */
@@ -928,27 +941,33 @@ struct ndpi_flow_udp_struct {
928
941
/* NDPI_PROTOCOL_ZOOM */
929
942
u_int32_t zoom_p2p :1 ;
930
943
931
- /* NDPI_PROTOCOL_EPICGAMES */
932
- u_int32_t epicgames_stage :1 ;
933
- u_int32_t epicgames_word ;
934
-
935
944
/* NDPI_PROTOCOL_RAKNET */
936
945
u_int32_t raknet_custom :1 ;
937
946
938
- /* NDPI_PROTOCOL_EAQ */
939
- u_int8_t eaq_pkt_id ;
940
- u_int32_t eaq_sequence ;
947
+ /* NDPI_PROTOCOL_MUMBLE */
948
+ u_int32_t mumble_stage :1 ;
949
+
950
+ /* NDPI_PROTOCOL_EPICGAMES */
951
+ u_int32_t epicgames_stage :1 ;
952
+ u_int32_t epicgames_word ;
941
953
942
954
/* NDPI_PROTOCOL_RX */
943
955
u_int32_t rx_conn_epoch ;
944
956
u_int32_t rx_conn_id ;
945
957
958
+ /* NDPI_PROTOCOL_WIREGUARD */
959
+ u_int32_t wireguard_peer_index [2 ];
960
+ u_int8_t wireguard_stage ;
961
+
946
962
/* NDPI_PROTOCOL_MEMCACHED */
947
963
u_int8_t memcached_matches ;
948
964
949
- /* NDPI_PROTOCOL_WIREGUARD */
950
- u_int8_t wireguard_stage ;
951
- u_int32_t wireguard_peer_index [2 ];
965
+ /* NDPI_PROTOCOL_EAQ */
966
+ u_int8_t eaq_pkt_id ;
967
+ u_int32_t eaq_sequence ;
968
+
969
+ /* NDPI_PROTOCOL_MUMBLE */
970
+ u_int64_t mumble_ident ;
952
971
953
972
/* NDPI_PROTOCOL_QUIC */
954
973
u_int8_t * quic_reasm_buf ;
@@ -975,9 +994,6 @@ struct ndpi_flow_udp_struct {
975
994
u_int16_t tftp_data_num ;
976
995
u_int16_t tftp_ack_num ;
977
996
978
- /* NDPI_PROTOCOL_MUMBLE */
979
- u_int8_t mumble_stage :1 ;
980
- u_int64_t mumble_ident ;
981
997
};
982
998
983
999
/* ************************************************** */
@@ -1272,7 +1288,7 @@ struct ndpi_flow_struct {
1272
1288
u_int16_t guessed_protocol_id ; /* Classification by-port. Set with the first pkt and never updated */
1273
1289
u_int16_t guessed_protocol_id_by_ip ; /* Classification by-ip. Set with the first pkt and never updated */
1274
1290
u_int16_t fast_callback_protocol_id ; /* Partial/incomplete classification. Used internally as first callback when iterating all the protocols */
1275
- u_int16_t guessed_category , guessed_header_category ;
1291
+ u_int16_t guessed_header_category ;
1276
1292
u_int8_t l4_proto , protocol_id_already_guessed :1 , fail_with_unknown :1 ,
1277
1293
init_finished :1 , client_packet_direction :1 , packet_direction :1 , is_ipv6 :1 , first_pkt_fully_encrypted :1 , skip_entropy_check : 1 ;
1278
1294
u_int8_t monitoring :1 , _pad :7 ;
@@ -1282,13 +1298,6 @@ struct ndpi_flow_struct {
1282
1298
1283
1299
/* First Packet Classification info */
1284
1300
struct ndpi_fpc_info fpc ;
1285
-
1286
- /*
1287
- if ndpi_struct->direction_detect_disable == 1
1288
- tcp sequence number connection tracking
1289
- */
1290
- u_int32_t next_tcp_seq_nr [2 ];
1291
- u_int16_t last_tcp_pkt_payload_len ;
1292
1301
1293
1302
/* Flow addresses (useful for LRU lookups in ndpi_detection_giveup())
1294
1303
and ports. All in *network* byte order.
@@ -1310,6 +1319,15 @@ struct ndpi_flow_struct {
1310
1319
1311
1320
u_int64_t last_packet_time_ms ;
1312
1321
1322
+ ndpi_protocol_category_t category ;
1323
+
1324
+ /* Counters with only packets with L5 data (ie no TCP SYN, pure ACKs, ...) */
1325
+ u_int16_t packet_counter ;
1326
+ u_int16_t packet_direction_counter [2 ];
1327
+ /* Counters with all packets even those without payload */
1328
+ u_int16_t all_packets_counter ;
1329
+ u_int16_t packet_direction_complete_counter [2 ];
1330
+
1313
1331
/*
1314
1332
the tcp / udp / other l4 value union
1315
1333
used to reduce the number of bytes for tcp or udp protocol states
@@ -1548,17 +1566,6 @@ struct ndpi_flow_struct {
1548
1566
/* protocols which have marked a connection as this connection cannot be protocol XXX, multiple u_int64_t */
1549
1567
NDPI_PROTOCOL_BITMASK excluded_protocol_bitmask ;
1550
1568
1551
- ndpi_protocol_category_t category ;
1552
-
1553
- /* Only packets with L5 data (ie no TCP SYN, pure ACKs, ...) */
1554
- u_int16_t packet_counter ; // can be 0 - 65000
1555
- u_int16_t packet_direction_counter [2 ];
1556
- u_int8_t packet_direction_with_payload_observed [2 ]; /* 0 = no packet with payload observed, 1 = at least one packet with payload observed */
1557
-
1558
- /* All packets even those without payload */
1559
- u_int16_t all_packets_counter ;
1560
- u_int16_t packet_direction_complete_counter [2 ]; // can be 0 - 65000
1561
-
1562
1569
/* NDPI_PROTOCOL_BITTORRENT */
1563
1570
u_int8_t bittorrent_stage ; // can be 0 - 255
1564
1571
u_int8_t bt_check_performed : 1 ;
@@ -1569,18 +1576,9 @@ struct ndpi_flow_struct {
1569
1576
/* NDPI_PROTOCOL_ZATTOO */
1570
1577
u_int8_t zattoo_stage :3 ;
1571
1578
1572
- /* NDPI_PROTOCOL_SOCKS */
1573
- u_int8_t socks5_stage :2 , socks4_stage :2 ; // 0 - 3
1574
-
1575
- /* NDPI_PROTOCOL_FTP_CONTROL */
1576
- u_int8_t ftp_control_stage :2 ;
1577
-
1578
1579
/* NDPI_PROTOCOL_STARCRAFT */
1579
1580
u_int8_t starcraft_udp_stage : 3 ; // 0-7
1580
1581
1581
- /* NDPI_PROTOCOL_Z3950 */
1582
- u_int8_t z3950_stage : 2 ; // 0-3
1583
-
1584
1582
/* NDPI_PROTOCOL_OOKLA */
1585
1583
u_int8_t ookla_stage : 1 ;
1586
1584
0 commit comments