aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.h
diff options
context:
space:
mode:
authorNardi Ivan <nardi.ivan@gmail.com>2020-06-14 14:42:39 +0200
committerNardi Ivan <nardi.ivan@gmail.com>2020-06-26 12:04:02 +0200
commit56d87186f7e6d7dba042961be86d1b4b5ae9f2e3 (patch)
treec12eead682a860ff118c08296bd03361143eca34 /example/reader_util.h
parentebfb5e7f01e4c0ab6bd8eb411165cb002443b891 (diff)
Fix compilation with --enable-debug-messages flag
NDPI_LOG* macros dereference ndpi_detection_module_struct object which is private to ndpi library (via NDPI_LIB_COMPILATION define). So we can't use them outside the library itself, i.e. in ndpiReader code Therefore, in files in example/, convert all (rare) uses of NDPI_LOG* macros to a new very simple macro, private to ndpiReader program. If necessary, such macro may be improved. According to a comment in ndpi_define.h, each dissector must define its own NDPI_CURRENT_PROTO macro before including ndpi_api.h file
Diffstat (limited to 'example/reader_util.h')
-rw-r--r--example/reader_util.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/example/reader_util.h b/example/reader_util.h
index 8298e2ef8..facce0114 100644
--- a/example/reader_util.h
+++ b/example/reader_util.h
@@ -336,4 +336,15 @@ float ndpi_flow_get_byte_count_entropy(const uint32_t byte_count[256], unsigned
extern int nDPI_LogLevel;
+/* TODO: conditional compilation? */
+#if 1
+ #define LOG(log_level, args...) \
+ { \
+ if(log_level <= nDPI_LogLevel) \
+ printf(args); \
+ }
+#else
+ #define LOG(...) {}
+#endif
+
#endif