@@ -460,7 +460,7 @@ void ndpiCheckHostStringMatch(char *testChar) {
460460 detected_protocol .proto .master_protocol = 0 ;
461461 detected_protocol .category = match .protocol_category ;
462462
463- ndpi_protocol2name (ndpi_str , detected_protocol , appBufStr ,
463+ ndpi_protocol2name (ndpi_str , detected_protocol . proto , appBufStr ,
464464 sizeof (appBufStr ));
465465
466466 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) {
544544 memset (& detected_protocol , 0 , sizeof (ndpi_protocol ));
545545 detected_protocol .proto .app_protocol = ndpi_map_ndpi_id_to_user_proto_id (ndpi_str , ret );
546546
547- ndpi_protocol2name (ndpi_str , detected_protocol , appBufStr ,
547+ ndpi_protocol2name (ndpi_str , detected_protocol . proto , appBufStr ,
548548 sizeof (appBufStr ));
549549
550550 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
17611761 );
17621762
17631763 fprintf (csv_fp , "%s|" ,
1764- ndpi_protocol2id (flow -> detected_protocol , buf , sizeof (buf )));
1764+ ndpi_protocol2id (flow -> detected_protocol . proto , buf , sizeof (buf )));
17651765
17661766 fprintf (csv_fp , "%s|%s|%s|%s|" ,
17671767 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 )),
17691769 ndpi_stack2str (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
17701770 & flow -> detected_protocol .protocol_stack , buf2 , sizeof (buf2 )),
17711771 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
19041904 flow -> detected_protocol .proto .master_protocol ,
19051905 flow -> detected_protocol .proto .app_protocol ,
19061906 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 ))
19081908 );
19091909 }
19101910 }
@@ -1946,14 +1946,14 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
19461946
19471947#ifdef NDPI_EXTENDED_SANITY_CHECKS
19481948 /* 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 ));
19511951#endif
19521952
19531953 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 )),
19551955 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 )),
19571957 ndpi_stack2str (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
19581958 & flow -> detected_protocol .protocol_stack , buf2 , sizeof (buf2 )),
19591959 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
19871987
19881988 fprintf (out , "[%s]" ,
19891989 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" );
19911991
19921992 fprintf (out , "[Confidence: %s]" , ndpi_confidence_get_name (flow -> confidence ));
19931993
@@ -2026,7 +2026,7 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
20262026 (unsigned int )flow -> detected_protocol .category );
20272027
20282028 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 ));
20302030 fprintf (out , "[Breed: %s]" , ndpi_get_proto_breed_name (breed ));
20312031
20322032 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
25492549
25502550 if ((which == ndpi_preorder ) || (which == ndpi_leaf )) { /* Avoid walking the same node multiple times */
25512551 if ((!flow -> detection_completed ) && flow -> ndpi_flow ) {
2552- u_int8_t proto_guessed ;
25532552
25542553 malloc_size_stats = 1 ;
25552554 flow -> detected_protocol = ndpi_detection_giveup (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
2556- flow -> ndpi_flow , & proto_guessed );
2555+ flow -> ndpi_flow );
25572556 malloc_size_stats = 0 ;
25582557
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 ++ ;
25602559 }
25612560
25622561 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
29542953 /* get app level protocol */
29552954 if (flow -> detected_protocol .proto .master_protocol ) {
29562955 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 ));
29582957 } else {
29592958 strncpy (proto , ndpi_get_proto_name (ndpi_thread_info [thread_id ].workflow -> ndpi_struct ,
29602959 flow -> detected_protocol .proto .app_protocol ),sizeof (proto ) - 1 );
@@ -3062,7 +3061,7 @@ static void dump_realtime_protocol(struct ndpi_workflow * workflow, struct ndpi_
30623061 snprintf (dstip , sizeof (dstip ), "[%s]" , flow -> dst_name ? flow -> dst_name : "" );
30633062 }
30643063
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 ));
30663065
30673066 if (ret == 1 ) {
30683067 fprintf (out , "Detected Realtime protocol %s --> [%s] %s:%d <--> %s:%d app=%s <%s>\n" ,
@@ -3972,7 +3971,7 @@ static void printFlowsStats() {
39723971 fprintf (out , "\t%u\t%-10s\t%s:%u <-> %s:%u\t[" ,
39733972 i ,
39743973 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 )),
39763975 all_flows [i ].flow -> src_name ? all_flows [i ].flow -> src_name : "" ,
39773976 ntohs (all_flows [i ].flow -> src_port ),
39783977 all_flows [i ].flow -> dst_name ? all_flows [i ].flow -> dst_name : "" ,
@@ -4918,7 +4917,7 @@ static void ndpi_process_packet(u_char *args,
49184917 }
49194918 trailer -> flow_risk_info [sizeof (trailer -> flow_risk_info ) - 1 ] = '\0' ;
49204919 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 ));
49224921
49234922 /* Metadata */
49244923 /* Metadata are (all) available in `flow` only after nDPI completed its work!
0 commit comments