@@ -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 );
@@ -2549,14 +2549,13 @@ static void node_proto_guess_walker(const void *node, ndpi_VISIT which, int dept
2549
2549
2550
2550
if ((which == ndpi_preorder ) || (which == ndpi_leaf )) { /* Avoid walking the same node multiple times */
2551
2551
if ((!flow -> detection_completed ) && flow -> ndpi_flow ) {
2552
- u_int8_t proto_guessed ;
2553
2552
2554
2553
malloc_size_stats = 1 ;
2555
2554
flow -> detected_protocol = ndpi_detection_giveup (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2556
- flow -> ndpi_flow , & proto_guessed );
2555
+ flow -> ndpi_flow );
2557
2556
malloc_size_stats = 0 ;
2558
2557
2559
- if (proto_guessed ) ndpi_thread_info [thread_id ].workflow -> stats .guessed_flow_protocols ++ ;
2558
+ if (flow -> ndpi_flow -> protocol_was_guessed ) ndpi_thread_info [thread_id ].workflow -> stats .guessed_flow_protocols ++ ;
2560
2559
}
2561
2560
2562
2561
process_ndpi_collected_info (ndpi_thread_info [thread_id ].workflow , flow );
@@ -2954,7 +2953,7 @@ static void port_stats_walker(const void *node, ndpi_VISIT which, int depth, voi
2954
2953
/* get app level protocol */
2955
2954
if (flow -> detected_protocol .proto .master_protocol ) {
2956
2955
ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2957
- flow -> detected_protocol , proto , sizeof (proto ));
2956
+ flow -> detected_protocol . proto , proto , sizeof (proto ));
2958
2957
} else {
2959
2958
strncpy (proto , ndpi_get_proto_name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2960
2959
flow -> detected_protocol .proto .app_protocol ),sizeof (proto ) - 1 );
@@ -3062,7 +3061,7 @@ static void dump_realtime_protocol(struct ndpi_workflow * workflow, struct ndpi_
3062
3061
snprintf (dstip , sizeof (dstip ), "[%s]" , flow -> dst_name ? flow -> dst_name : "" );
3063
3062
}
3064
3063
3065
- ndpi_protocol2name (workflow -> ndpi_struct , flow -> detected_protocol , app_name , sizeof (app_name ));
3064
+ ndpi_protocol2name (workflow -> ndpi_struct , flow -> detected_protocol . proto , app_name , sizeof (app_name ));
3066
3065
3067
3066
if (ret == 1 ) {
3068
3067
fprintf (out , "Detected Realtime protocol %s --> [%s] %s:%d <--> %s:%d app=%s <%s>\n" ,
@@ -3972,7 +3971,7 @@ static void printFlowsStats() {
3972
3971
fprintf (out , "\t%u\t%-10s\t%s:%u <-> %s:%u\t[" ,
3973
3972
i ,
3974
3973
ndpi_protocol2name (ndpi_thread_info [0 ].workflow -> ndpi_struct ,
3975
- all_flows [i ].flow -> detected_protocol , buf , sizeof (buf )),
3974
+ all_flows [i ].flow -> detected_protocol . proto , buf , sizeof (buf )),
3976
3975
all_flows [i ].flow -> src_name ? all_flows [i ].flow -> src_name : "" ,
3977
3976
ntohs (all_flows [i ].flow -> src_port ),
3978
3977
all_flows [i ].flow -> dst_name ? all_flows [i ].flow -> dst_name : "" ,
@@ -4918,7 +4917,7 @@ static void ndpi_process_packet(u_char *args,
4918
4917
}
4919
4918
trailer -> flow_risk_info [sizeof (trailer -> flow_risk_info ) - 1 ] = '\0' ;
4920
4919
trailer -> proto .master_protocol = htons (p .proto .master_protocol ), trailer -> proto .app_protocol = htons (p .proto .app_protocol );
4921
- ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct , p , trailer -> name , sizeof (trailer -> name ));
4920
+ ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct , p . proto , trailer -> name , sizeof (trailer -> name ));
4922
4921
4923
4922
/* Metadata */
4924
4923
/* Metadata are (all) available in `flow` only after nDPI completed its work!
0 commit comments