config: move debug/log configuration to the new API

This commit is contained in:
Nardi Ivan
2024-01-18 10:21:24 +01:00
committed by Ivan Nardi
parent c704be1a20
commit 6c85f10cd5
18 changed files with 106 additions and 104 deletions
-18
View File
@@ -448,15 +448,11 @@ int parse_proto_name_list(char *str, NDPI_PROTOCOL_BITMASK *bitmask, int inverte
/* ***************************************************** */
extern char *_debug_protocols;
struct ndpi_workflow* ndpi_workflow_init(const struct ndpi_workflow_prefs * prefs,
pcap_t * pcap_handle, int do_init_flows_root,
ndpi_serialization_format serialization_format) {
struct ndpi_detection_module_struct * module;
struct ndpi_workflow * workflow;
static NDPI_PROTOCOL_BITMASK debug_bitmask;
static int _debug_protocols_ok = 0;
/* On some fuzzers we don't want to use these memory allocators, but some custom ones */
#ifndef DISABLE_CUSTOM_ALLOCATOR_ON_READERUTILS
@@ -485,20 +481,6 @@ struct ndpi_workflow* ndpi_workflow_init(const struct ndpi_workflow_prefs * pref
ndpi_set_user_data(module, workflow);
ndpi_set_log_level(module, nDPI_LogLevel);
if(_debug_protocols != NULL && ! _debug_protocols_ok) {
NDPI_BITMASK_RESET(debug_bitmask);
if(parse_proto_name_list(_debug_protocols, &debug_bitmask, 0)) {
ndpi_exit_detection_module(module);
ndpi_free(workflow);
return NULL;
}
_debug_protocols_ok = 1;
}
if(_debug_protocols_ok)
ndpi_set_debug_bitmask(module, debug_bitmask);
if(do_init_flows_root) {
workflow->ndpi_flows_root = ndpi_calloc(workflow->prefs.num_roots, sizeof(void *));
if(!workflow->ndpi_flows_root) {