From a7c1152397cb3ce74692062a8e9152f71c3b7b00 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Tue, 26 Apr 2022 14:42:06 +0200 Subject: Added ability to store custom category file in patricia tree --- example/ndpiReader.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'example/ndpiReader.c') 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); -- cgit v1.2.3