aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorMark Jeffery <dandare100@users.noreply.github.com>2024-06-10 19:45:19 +0200
committerGitHub <noreply@github.com>2024-06-10 19:45:19 +0200
commit312dc424bdf93f6680562e7f925e782c766383e6 (patch)
tree7e475a798557cbc42d209e94bbc22859c14f66c7 /example
parentaee2c81f76842c6968e98f343adb46082eb3fb85 (diff)
Added NDPI_PROTOCOL_NTOP assert and removed percentage comparison (#2460)
Close #2413
Diffstat (limited to 'example')
-rw-r--r--example/ndpiReader.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index d07fdd0b0..1cccd2fbd 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -5950,6 +5950,7 @@ void domainSearchUnitTest() {
char *domain = "ntop.org";
u_int16_t class_id;
struct ndpi_detection_module_struct *ndpi_str = ndpi_init_detection_module(NULL);
+ u_int8_t trace = 0;
assert(ndpi_str);
assert(sc);
@@ -5957,6 +5958,7 @@ void domainSearchUnitTest() {
ndpi_domain_classify_add(ndpi_str, sc, NDPI_PROTOCOL_NTOP, ".ntop.org");
ndpi_domain_classify_add(ndpi_str, sc, NDPI_PROTOCOL_NTOP, domain);
assert(ndpi_domain_classify_hostname(ndpi_str, sc, &class_id, domain));
+ assert(class_id == NDPI_PROTOCOL_NTOP);
ndpi_domain_classify_add(ndpi_str, sc, NDPI_PROTOCOL_CATEGORY_GAMBLING, "123vc.club");
assert(ndpi_domain_classify_hostname(ndpi_str, sc, &class_id, "123vc.club"));
@@ -5966,16 +5968,9 @@ void domainSearchUnitTest() {
assert(ndpi_domain_classify_hostname(ndpi_str, sc, &class_id, "blog.ntop.org"));
assert(class_id == NDPI_PROTOCOL_NTOP);
-#ifdef DEBUG_TRACE
- struct stat st;
-
- if(stat(fname, &st) == 0) {
- u_int32_t s = ndpi_domain_classify_size(ndpi_str, sc);
-
- printf("Size: %u [%.1f %% of the original filename size]\n",
- s, (float)(s * 100) / (float)st.st_size);
- }
-#endif
+ u_int32_t s = ndpi_domain_classify_size(sc);
+ if(trace) printf("ndpi_domain_classify size: %u \n",s);
+
ndpi_domain_classify_free(sc);
ndpi_exit_detection_module(ndpi_str);