@@ -460,7 +460,7 @@ void ndpiCheckHostStringMatch(char *testChar) {
460
460
detected_protocol .proto .master_protocol = 0 ;
461
461
detected_protocol .category = match .protocol_category ;
462
462
463
- ndpi_protocol2name (ndpi_str , detected_protocol , appBufStr ,
463
+ ndpi_protocol2name (ndpi_str , detected_protocol . proto , appBufStr ,
464
464
sizeof (appBufStr ));
465
465
466
466
printf ("Match Found for string [%s] -> P(%d) B(%d) C(%d) => %s %s %s\n" ,
@@ -544,7 +544,7 @@ static void ndpiCheckIPMatch(char *testChar) {
544
544
memset (& detected_protocol , 0 , sizeof (ndpi_protocol ));
545
545
detected_protocol .proto .app_protocol = ndpi_map_ndpi_id_to_user_proto_id (ndpi_str , ret );
546
546
547
- ndpi_protocol2name (ndpi_str , detected_protocol , appBufStr ,
547
+ ndpi_protocol2name (ndpi_str , detected_protocol . proto , appBufStr ,
548
548
sizeof (appBufStr ));
549
549
550
550
printf ("Match Found for IP %s, port %d -> %s (%d)\n" ,
@@ -1761,11 +1761,11 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
1761
1761
);
1762
1762
1763
1763
fprintf (csv_fp , "%s|" ,
1764
- ndpi_protocol2id (flow -> detected_protocol , buf , sizeof (buf )));
1764
+ ndpi_protocol2id (flow -> detected_protocol . proto , buf , sizeof (buf )));
1765
1765
1766
1766
fprintf (csv_fp , "%s|%s|%s|%s|" ,
1767
1767
ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1768
- flow -> detected_protocol , buf , sizeof (buf )),
1768
+ flow -> detected_protocol . proto , buf , sizeof (buf )),
1769
1769
ndpi_stack2str (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1770
1770
& flow -> detected_protocol .protocol_stack , buf2 , sizeof (buf2 )),
1771
1771
ndpi_get_proto_name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
@@ -1904,7 +1904,7 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
1904
1904
flow -> detected_protocol .proto .master_protocol ,
1905
1905
flow -> detected_protocol .proto .app_protocol ,
1906
1906
ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1907
- flow -> detected_protocol , buf1 , sizeof (buf1 ))
1907
+ flow -> detected_protocol . proto , buf1 , sizeof (buf1 ))
1908
1908
);
1909
1909
}
1910
1910
}
@@ -1946,14 +1946,14 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
1946
1946
1947
1947
#ifdef NDPI_EXTENDED_SANITY_CHECKS
1948
1948
/* Be sure new stack logic is compatible with legacy code */
1949
- assert (ndpi_stack_get_upper_proto (& flow -> detected_protocol .protocol_stack ) == ndpi_get_upper_proto (flow -> detected_protocol ));
1950
- assert (ndpi_stack_get_lower_proto (& flow -> detected_protocol .protocol_stack ) == ndpi_get_lower_proto (flow -> detected_protocol ));
1949
+ assert (ndpi_stack_get_upper_proto (& flow -> detected_protocol .protocol_stack ) == ndpi_get_upper_proto (flow -> detected_protocol . proto ));
1950
+ assert (ndpi_stack_get_lower_proto (& flow -> detected_protocol .protocol_stack ) == ndpi_get_lower_proto (flow -> detected_protocol . proto ));
1951
1951
#endif
1952
1952
1953
1953
fprintf (out , "%s/%s][Stack: %s][IP: %u/%s]" ,
1954
- ndpi_protocol2id (flow -> detected_protocol , buf , sizeof (buf )),
1954
+ ndpi_protocol2id (flow -> detected_protocol . proto , buf , sizeof (buf )),
1955
1955
ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1956
- flow -> detected_protocol , buf1 , sizeof (buf1 )),
1956
+ flow -> detected_protocol . proto , buf1 , sizeof (buf1 )),
1957
1957
ndpi_stack2str (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1958
1958
& flow -> detected_protocol .protocol_stack , buf2 , sizeof (buf2 )),
1959
1959
flow -> detected_protocol .protocol_by_ip ,
@@ -1987,7 +1987,7 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
1987
1987
1988
1988
fprintf (out , "[%s]" ,
1989
1989
ndpi_is_encrypted_proto (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1990
- flow -> detected_protocol ) ? "Encrypted" : "ClearText" );
1990
+ flow -> detected_protocol . proto ) ? "Encrypted" : "ClearText" );
1991
1991
1992
1992
fprintf (out , "[Confidence: %s]" , ndpi_confidence_get_name (flow -> confidence ));
1993
1993
@@ -2026,7 +2026,7 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
2026
2026
(unsigned int )flow -> detected_protocol .category );
2027
2027
2028
2028
breed = ndpi_get_proto_breed (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2029
- ndpi_get_upper_proto (flow -> detected_protocol ));
2029
+ ndpi_get_upper_proto (flow -> detected_protocol . proto ));
2030
2030
fprintf (out , "[Breed: %s]" , ndpi_get_proto_breed_name (breed ));
2031
2031
2032
2032
fprintf (out , "[%u pkts/%llu bytes " , flow -> src2dst_packets , (long long unsigned int ) flow -> src2dst_bytes );
@@ -2552,14 +2552,13 @@ static void node_proto_guess_walker(const void *node, ndpi_VISIT which, int dept
2552
2552
2553
2553
if ((which == ndpi_preorder ) || (which == ndpi_leaf )) { /* Avoid walking the same node multiple times */
2554
2554
if ((!flow -> detection_completed ) && flow -> ndpi_flow ) {
2555
- u_int8_t proto_guessed ;
2556
2555
2557
2556
malloc_size_stats = 1 ;
2558
2557
flow -> detected_protocol = ndpi_detection_giveup (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2559
- flow -> ndpi_flow , & proto_guessed );
2558
+ flow -> ndpi_flow );
2560
2559
malloc_size_stats = 0 ;
2561
2560
2562
- if (proto_guessed ) ndpi_thread_info [thread_id ].workflow -> stats .guessed_flow_protocols ++ ;
2561
+ if (flow -> ndpi_flow -> protocol_was_guessed ) ndpi_thread_info [thread_id ].workflow -> stats .guessed_flow_protocols ++ ;
2563
2562
}
2564
2563
2565
2564
process_ndpi_collected_info (ndpi_thread_info [thread_id ].workflow , flow );
@@ -2957,7 +2956,7 @@ static void port_stats_walker(const void *node, ndpi_VISIT which, int depth, voi
2957
2956
/* get app level protocol */
2958
2957
if (flow -> detected_protocol .proto .master_protocol ) {
2959
2958
ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2960
- flow -> detected_protocol , proto , sizeof (proto ));
2959
+ flow -> detected_protocol . proto , proto , sizeof (proto ));
2961
2960
} else {
2962
2961
strncpy (proto , ndpi_get_proto_name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2963
2962
flow -> detected_protocol .proto .app_protocol ),sizeof (proto ) - 1 );
@@ -3065,7 +3064,7 @@ static void dump_realtime_protocol(struct ndpi_workflow * workflow, struct ndpi_
3065
3064
snprintf (dstip , sizeof (dstip ), "[%s]" , flow -> dst_name ? flow -> dst_name : "" );
3066
3065
}
3067
3066
3068
- ndpi_protocol2name (workflow -> ndpi_struct , flow -> detected_protocol , app_name , sizeof (app_name ));
3067
+ ndpi_protocol2name (workflow -> ndpi_struct , flow -> detected_protocol . proto , app_name , sizeof (app_name ));
3069
3068
3070
3069
if (ret == 1 ) {
3071
3070
fprintf (out , "Detected Realtime protocol %s --> [%s] %s:%d <--> %s:%d app=%s <%s>\n" ,
@@ -3975,7 +3974,7 @@ static void printFlowsStats() {
3975
3974
fprintf (out , "\t%u\t%-10s\t%s:%u <-> %s:%u\t[" ,
3976
3975
i ,
3977
3976
ndpi_protocol2name (ndpi_thread_info [0 ].workflow -> ndpi_struct ,
3978
- all_flows [i ].flow -> detected_protocol , buf , sizeof (buf )),
3977
+ all_flows [i ].flow -> detected_protocol . proto , buf , sizeof (buf )),
3979
3978
all_flows [i ].flow -> src_name ? all_flows [i ].flow -> src_name : "" ,
3980
3979
ntohs (all_flows [i ].flow -> src_port ),
3981
3980
all_flows [i ].flow -> dst_name ? all_flows [i ].flow -> dst_name : "" ,
@@ -4921,7 +4920,7 @@ static void ndpi_process_packet(u_char *args,
4921
4920
}
4922
4921
trailer -> flow_risk_info [sizeof (trailer -> flow_risk_info ) - 1 ] = '\0' ;
4923
4922
trailer -> proto .master_protocol = htons (p .proto .master_protocol ), trailer -> proto .app_protocol = htons (p .proto .app_protocol );
4924
- ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct , p , trailer -> name , sizeof (trailer -> name ));
4923
+ ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct , p . proto , trailer -> name , sizeof (trailer -> name ));
4925
4924
4926
4925
/* Metadata */
4927
4926
/* Metadata are (all) available in `flow` only after nDPI completed its work!
0 commit comments