aboutsummaryrefslogtreecommitdiff
path: root/example/ndpiReader.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2022-04-26 14:42:06 +0200
committerLuca Deri <deri@ntop.org>2022-04-26 14:42:31 +0200
commita7c1152397cb3ce74692062a8e9152f71c3b7b00 (patch)
tree6f29e334ed4c5653b3d084a8979f5ea2a7c9a7e1 /example/ndpiReader.c
parente8d81123cca48cf1d36fd2dbb33068878c5eb8fa (diff)
Added ability to store custom category file in patricia tree
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r--example/ndpiReader.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 4dd3f3632..576f6a4f3 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -2218,9 +2218,17 @@ static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) {
if(_protoFilePath != NULL)
ndpi_load_protocols_file(ndpi_thread_info[thread_id].workflow->ndpi_struct, _protoFilePath);
- if(_customCategoryFilePath)
- ndpi_load_categories_file(ndpi_thread_info[thread_id].workflow->ndpi_struct, _customCategoryFilePath);
+ if(_customCategoryFilePath) {
+ char *label = strrchr(_customCategoryFilePath, '/');
+ if(label != NULL)
+ label = &label[1];
+ else
+ label = _customCategoryFilePath;
+
+ ndpi_load_categories_file(ndpi_thread_info[thread_id].workflow->ndpi_struct, _customCategoryFilePath, label);
+ }
+
if(_riskyDomainFilePath)
ndpi_load_risk_domain_file(ndpi_thread_info[thread_id].workflow->ndpi_struct, _riskyDomainFilePath);