@@ -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" ,
@@ -559,7 +559,7 @@ static void ndpiCheckIPMatch(char *testChar) {
559
559
memset (& detected_protocol , 0 , sizeof (ndpi_protocol ));
560
560
detected_protocol .proto .app_protocol = ndpi_map_ndpi_id_to_user_proto_id (ndpi_str , ret );
561
561
562
- ndpi_protocol2name (ndpi_str , detected_protocol , appBufStr ,
562
+ ndpi_protocol2name (ndpi_str , detected_protocol . proto , appBufStr ,
563
563
sizeof (appBufStr ));
564
564
565
565
printf ("Match Found for IP %s, port %d -> %s (%d)\n" ,
@@ -1776,11 +1776,11 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
1776
1776
);
1777
1777
1778
1778
fprintf (csv_fp , "%s|" ,
1779
- ndpi_protocol2id (flow -> detected_protocol , buf , sizeof (buf )));
1779
+ ndpi_protocol2id (flow -> detected_protocol . proto , buf , sizeof (buf )));
1780
1780
1781
1781
fprintf (csv_fp , "%s|%s|%s|%s|" ,
1782
1782
ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1783
- flow -> detected_protocol , buf , sizeof (buf )),
1783
+ flow -> detected_protocol . proto , buf , sizeof (buf )),
1784
1784
ndpi_stack2str (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1785
1785
& flow -> detected_protocol .protocol_stack , buf2 , sizeof (buf2 )),
1786
1786
ndpi_get_proto_name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
@@ -1919,7 +1919,7 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
1919
1919
flow -> detected_protocol .proto .master_protocol ,
1920
1920
flow -> detected_protocol .proto .app_protocol ,
1921
1921
ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1922
- flow -> detected_protocol , buf1 , sizeof (buf1 ))
1922
+ flow -> detected_protocol . proto , buf1 , sizeof (buf1 ))
1923
1923
);
1924
1924
}
1925
1925
}
@@ -1961,14 +1961,14 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
1961
1961
1962
1962
#ifdef NDPI_EXTENDED_SANITY_CHECKS
1963
1963
/* Be sure new stack logic is compatible with legacy code */
1964
- assert (ndpi_stack_get_upper_proto (& flow -> detected_protocol .protocol_stack ) == ndpi_get_upper_proto (flow -> detected_protocol ));
1965
- assert (ndpi_stack_get_lower_proto (& flow -> detected_protocol .protocol_stack ) == ndpi_get_lower_proto (flow -> detected_protocol ));
1964
+ assert (ndpi_stack_get_upper_proto (& flow -> detected_protocol .protocol_stack ) == ndpi_get_upper_proto (flow -> detected_protocol . proto ));
1965
+ assert (ndpi_stack_get_lower_proto (& flow -> detected_protocol .protocol_stack ) == ndpi_get_lower_proto (flow -> detected_protocol . proto ));
1966
1966
#endif
1967
1967
1968
1968
fprintf (out , "%s/%s][Stack: %s][IP: %u/%s]" ,
1969
- ndpi_protocol2id (flow -> detected_protocol , buf , sizeof (buf )),
1969
+ ndpi_protocol2id (flow -> detected_protocol . proto , buf , sizeof (buf )),
1970
1970
ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1971
- flow -> detected_protocol , buf1 , sizeof (buf1 )),
1971
+ flow -> detected_protocol . proto , buf1 , sizeof (buf1 )),
1972
1972
ndpi_stack2str (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
1973
1973
& flow -> detected_protocol .protocol_stack , buf2 , sizeof (buf2 )),
1974
1974
flow -> detected_protocol .protocol_by_ip ,
@@ -2002,7 +2002,7 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
2002
2002
2003
2003
fprintf (out , "[%s]" ,
2004
2004
ndpi_is_encrypted_proto (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2005
- flow -> detected_protocol ) ? "Encrypted" : "ClearText" );
2005
+ flow -> detected_protocol . proto ) ? "Encrypted" : "ClearText" );
2006
2006
2007
2007
fprintf (out , "[Confidence: %s]" , ndpi_confidence_get_name (flow -> confidence ));
2008
2008
@@ -2567,14 +2567,13 @@ static void node_proto_guess_walker(const void *node, ndpi_VISIT which, int dept
2567
2567
2568
2568
if ((which == ndpi_preorder ) || (which == ndpi_leaf )) { /* Avoid walking the same node multiple times */
2569
2569
if ((!flow -> detection_completed ) && flow -> ndpi_flow ) {
2570
- u_int8_t proto_guessed ;
2571
2570
2572
2571
malloc_size_stats = 1 ;
2573
2572
flow -> detected_protocol = ndpi_detection_giveup (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2574
- flow -> ndpi_flow , & proto_guessed );
2573
+ flow -> ndpi_flow );
2575
2574
malloc_size_stats = 0 ;
2576
2575
2577
- if (proto_guessed ) ndpi_thread_info [thread_id ].workflow -> stats .guessed_flow_protocols ++ ;
2576
+ if (flow -> ndpi_flow -> protocol_was_guessed ) ndpi_thread_info [thread_id ].workflow -> stats .guessed_flow_protocols ++ ;
2578
2577
}
2579
2578
2580
2579
process_ndpi_collected_info (ndpi_thread_info [thread_id ].workflow , flow );
@@ -2976,7 +2975,7 @@ static void port_stats_walker(const void *node, ndpi_VISIT which, int depth, voi
2976
2975
/* get app level protocol */
2977
2976
if (flow -> detected_protocol .proto .master_protocol ) {
2978
2977
ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2979
- flow -> detected_protocol , proto , sizeof (proto ));
2978
+ flow -> detected_protocol . proto , proto , sizeof (proto ));
2980
2979
} else {
2981
2980
strncpy (proto , ndpi_get_proto_name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2982
2981
flow -> detected_protocol .proto .app_protocol ),sizeof (proto ) - 1 );
@@ -3084,7 +3083,7 @@ static void dump_realtime_protocol(struct ndpi_workflow * workflow, struct ndpi_
3084
3083
snprintf (dstip , sizeof (dstip ), "[%s]" , flow -> dst_name ? flow -> dst_name : "" );
3085
3084
}
3086
3085
3087
- ndpi_protocol2name (workflow -> ndpi_struct , flow -> detected_protocol , app_name , sizeof (app_name ));
3086
+ ndpi_protocol2name (workflow -> ndpi_struct , flow -> detected_protocol . proto , app_name , sizeof (app_name ));
3088
3087
3089
3088
if (ret == 1 ) {
3090
3089
fprintf (out , "Detected Realtime protocol %s --> [%s] %s:%d <--> %s:%d app=%s <%s>\n" ,
@@ -3994,7 +3993,7 @@ static void printFlowsStats() {
3994
3993
fprintf (out , "\t%u\t%-10s\t%s:%u <-> %s:%u\t[" ,
3995
3994
i ,
3996
3995
ndpi_protocol2name (ndpi_thread_info [0 ].workflow -> ndpi_struct ,
3997
- all_flows [i ].flow -> detected_protocol , buf , sizeof (buf )),
3996
+ all_flows [i ].flow -> detected_protocol . proto , buf , sizeof (buf )),
3998
3997
all_flows [i ].flow -> src_name ? all_flows [i ].flow -> src_name : "" ,
3999
3998
ntohs (all_flows [i ].flow -> src_port ),
4000
3999
all_flows [i ].flow -> dst_name ? all_flows [i ].flow -> dst_name : "" ,
@@ -4942,7 +4941,7 @@ static void ndpi_process_packet(u_char *args,
4942
4941
}
4943
4942
trailer -> flow_risk_info [sizeof (trailer -> flow_risk_info ) - 1 ] = '\0' ;
4944
4943
trailer -> proto .master_protocol = htons (p .proto .master_protocol ), trailer -> proto .app_protocol = htons (p .proto .app_protocol );
4945
- ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct , p , trailer -> name , sizeof (trailer -> name ));
4944
+ ndpi_protocol2name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct , p . proto , trailer -> name , sizeof (trailer -> name ));
4946
4945
4947
4946
/* Metadata */
4948
4947
/* Metadata are (all) available in `flow` only after nDPI completed its work!
0 commit comments