diff options
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r-- | example/ndpiReader.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index b24e61091..7a13b90e2 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -414,7 +414,8 @@ static void help(u_int long_help) { #endif if(long_help) { - printf("\n\nSupported protocols:\n"); + printf("\n\nnDPI supported protocols:\n"); + printf("%3s %-22s %-12s %s\n", "Id", "Protocol", "Breed", "Category"); num_threads = 1; ndpi_dump_protocols(ndpi_info_mod); } @@ -1896,14 +1897,16 @@ static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) { int fields[4]; - if(verbose) printf("[Category] Loading %s\t%s\n", name, category); + if(verbose && !quiet_mode) printf("[Category] Loading %s\t%s\n", name, category); if(sscanf(name, "%d.%d.%d.%d", &fields[0], &fields[1], &fields[2], &fields[3]) == 4) ndpi_load_ip_category(ndpi_thread_info[thread_id].workflow->ndpi_struct, name, (ndpi_protocol_category_t)atoi(category)); - else + else { + /* TODO free the strdup */ ndpi_load_hostname_category(ndpi_thread_info[thread_id].workflow->ndpi_struct, - name, (ndpi_protocol_category_t)atoi(category)); + strdup(name), (ndpi_protocol_category_t)atoi(category)); + } } } } @@ -3459,8 +3462,7 @@ void automataUnitTest() { assert(ndpi_add_string_to_automa(automa, "hello") == 0); assert(ndpi_add_string_to_automa(automa, "world") == 0); ndpi_finalize_automa(automa); - assert(ndpi_match_string(automa, "This is the wonderful world of nDPI") == 0); - + assert(ndpi_match_string(automa, "This is the wonderful world of nDPI") == 1); ndpi_free_automa(automa); } |