diff options
Diffstat (limited to 'example')
-rw-r--r-- | example/ndpiReader.c | 14 | ||||
-rw-r--r-- | example/protos.txt | 15 |
2 files changed, 19 insertions, 10 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index ecb2a7477..5685cda9a 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -609,6 +609,10 @@ static void help(u_int long_help) { struct ndpi_detection_module_struct *ndpi_info_mod = ndpi_init_detection_module(); NDPI_BITMASK_SET_ALL(all); ndpi_set_protocol_detection_bitmask2(ndpi_info_mod, &all); + + if(_protoFilePath != NULL) + ndpi_load_protocols_file(ndpi_info_mod, _protoFilePath); + ndpi_finalize_initialization(ndpi_info_mod); printf("\nProtocols configuration parameters:\n"); @@ -635,8 +639,8 @@ static void help(u_int long_help) { sizeof(((struct ndpi_flow_struct *)0)->protos)); printf("\n\nnDPI supported protocols:\n"); - printf("%3s %-22s %-10s %-8s %-12s %s\n", - "Id", "Protocol", "Layer_4", "Nw_Proto", "Breed", "Category"); + printf("%3s %8s %-22s %-10s %-8s %-12s %s\n", + "Id", "Userd-id", "Protocol", "Layer_4", "Nw_Proto", "Breed", "Category"); num_threads = 1; ndpi_dump_protocols(ndpi_info_mod, stdout); @@ -4126,7 +4130,8 @@ static void printResults(u_int64_t processing_time_usec, u_int64_t setup_time_us if(!quiet_mode) printf("\n\nDetected protocols:\n"); for(i = 0; i <= ndpi_get_num_supported_protocols(ndpi_thread_info[0].workflow->ndpi_struct); i++) { - ndpi_protocol_breed_t breed = ndpi_get_proto_breed(ndpi_thread_info[0].workflow->ndpi_struct, i); + ndpi_protocol_breed_t breed = ndpi_get_proto_breed(ndpi_thread_info[0].workflow->ndpi_struct, + ndpi_map_ndpi_id_to_user_proto_id(ndpi_thread_info[0].workflow->ndpi_struct, i)); if(cumulative_stats.protocol_counter[i] > 0) { breed_stats_bytes[breed] += (long long unsigned int)cumulative_stats.protocol_counter_bytes[i]; @@ -4135,7 +4140,8 @@ static void printResults(u_int64_t processing_time_usec, u_int64_t setup_time_us if(results_file) fprintf(results_file, "%s\t%llu\t%llu\t%u\n", - ndpi_get_proto_name(ndpi_thread_info[0].workflow->ndpi_struct, i), + ndpi_get_proto_name(ndpi_thread_info[0].workflow->ndpi_struct, + ndpi_map_ndpi_id_to_user_proto_id(ndpi_thread_info[0].workflow->ndpi_struct, i)), (long long unsigned int)cumulative_stats.protocol_counter[i], (long long unsigned int)cumulative_stats.protocol_counter_bytes[i], cumulative_stats.protocol_flows[i]); diff --git a/example/protos.txt b/example/protos.txt index d8cde5022..3020cc094 100644 --- a/example/protos.txt +++ b/example/protos.txt @@ -50,15 +50,18 @@ ip:213.75.170.11/32:443@CustomProtocol ip:8.248.73.247:443@AmazonPrime ip:54.80.47.130@AmazonPrime +#You can specify a protocol Id. In that case you probably want to avoid conflict with internal ids. +#You can use any number up to 65535 + ip:3.3.3.3:443@CustomProtocolA ip:3.3.3.3:444@CustomProtocolB -ip:3.3.3.3:446@CustomProtocolC=400 +ip:3.3.3.3:446@CustomProtocolC=800 -ipv6:[3ffe:507:0:1:200:86ff:fe05:80da]@CustomProtocolD -ipv6:[247f:855b:5e16:3caf::]/64:100@CustomProtocolE -ipv6:[247f:855b:5e16:3caf::]/64@CustomProtocolF -ipv6:[fe80::76ac:b9ff:fe6c:c124]:12717@CustomProtocolG -ipv6:[fe80::76ac:b9ff:fe6c:c124]:12718@CustomProtocolH +ipv6:[3ffe:507:0:1:200:86ff:fe05:80da]@CustomProtocolD=1024 +ipv6:[247f:855b:5e16:3caf::]/64:100@CustomProtocolE=2048 +ipv6:[247f:855b:5e16:3caf::]/64@CustomProtocolF=2049 +ipv6:[fe80::76ac:b9ff:fe6c:c124]:12717@CustomProtocolG=2050 +ipv6:[fe80::76ac:b9ff:fe6c:c124]:12718@CustomProtocolH=65535 # # You can use symbolic IP addreses if you want |