aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorToni <matzeton@googlemail.com>2023-05-30 08:27:37 +0200
committerGitHub <noreply@github.com>2023-05-30 08:27:37 +0200
commit04f5c5196e790db8b8cc39e42c8645fb7f3dd141 (patch)
tree4b2054672b65e8e8975a2354c7eedda785ba980d /src/lib
parent552c9b3cc6fbffc5767086c1594b2b8f6598365c (diff)
Changed logging callback function sig. (#2000)
* make user data available for any build config Signed-off-by: lns <matzeton@googlemail.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ndpi_main.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 7a5de852f..b37ae40ab 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -2863,9 +2863,7 @@ struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs
ndpi_str->max_packets_to_process = NDPI_DEFAULT_MAX_NUM_PKTS_PER_FLOW_TO_DISSECT;
NDPI_BITMASK_SET_ALL(ndpi_str->detection_bitmask);
-#ifdef NDPI_ENABLE_DEBUG_MESSAGES
ndpi_str->user_data = NULL;
-#endif
ndpi_str->tcp_max_retransmission_window_size = NDPI_DEFAULT_MAX_TCP_RETRANSMISSION_WINDOW_SIZE;
ndpi_str->tls_certificate_expire_in_x_days = 30; /* NDPI_TLS_CERTIFICATE_ABOUT_TO_EXPIRE flow risk */
@@ -9801,3 +9799,20 @@ u_int32_t ndpi_get_protocol_aggressiveness(struct ndpi_detection_module_struct *
return -1;
}
}
+
+/* ******************************************************************** */
+
+void ndpi_set_user_data(struct ndpi_detection_module_struct *ndpi_str, void *user_data)
+{
+ if (ndpi_str->user_data != NULL)
+ {
+ NDPI_LOG_ERR(ndpi_str, "%s", "User data is already set. Overwriting.")
+ }
+
+ ndpi_str->user_data = user_data;
+}
+
+void *ndpi_get_user_data(struct ndpi_detection_module_struct *ndpi_str)
+{
+ return ndpi_str->user_data;
+}