aboutsummaryrefslogtreecommitdiff
path: root/src/include
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/include
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/include')
-rw-r--r--src/include/ndpi_api.h19
-rw-r--r--src/include/ndpi_typedefs.h6
2 files changed, 22 insertions, 3 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h
index 0a420accb..eac4bcd25 100644
--- a/src/include/ndpi_api.h
+++ b/src/include/ndpi_api.h
@@ -1942,6 +1942,25 @@ extern "C" {
char *out, u_int out_len,
u_int8_t use_json);
+ /* ******************************* */
+
+ /**
+ * Set user data which can later retrieved with `ndpi_get_user_data()`.
+ *
+ * @par ndpi_str = the struct created for the protocol detection
+ * @par user_data = user data pointer you want to retrieve later with `ndpi_get_user_data()`
+ *
+ */
+ void ndpi_set_user_data(struct ndpi_detection_module_struct *ndpi_str, void *user_data);
+
+ /**
+ * Get user data which was previously set with `ndpi_set_user_data()`.
+ *
+ * @return the user data pointer
+ *
+ */
+ void *ndpi_get_user_data(struct ndpi_detection_module_struct *ndpi_str);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h
index d857899da..1cc55047c 100644
--- a/src/include/ndpi_typedefs.h
+++ b/src/include/ndpi_typedefs.h
@@ -221,8 +221,10 @@ typedef struct ndpi_protocol_bitmask_struct {
ndpi_ndpi_mask fds_bits[NDPI_NUM_FDS_BITS];
} ndpi_protocol_bitmask_struct_t;
+struct ndpi_detection_module_struct;
+
/* NDPI_DEBUG_FUNCTION_PTR (cast) */
-typedef void (*ndpi_debug_function_ptr) (u_int32_t protocol, void *module_struct,
+typedef void (*ndpi_debug_function_ptr) (u_int32_t protocol, struct ndpi_detection_module_struct *module_struct,
ndpi_log_level_t log_level, const char *file,
const char *func, unsigned line,
const char *format, ...);
@@ -1158,9 +1160,7 @@ struct ndpi_detection_module_struct {
u_int8_t skip_tls_blocks_until_change_cipher:1, enable_ja3_plus:1, _notused:6;
u_int8_t tls_certificate_expire_in_x_days;
-#ifdef NDPI_ENABLE_DEBUG_MESSAGES
void *user_data;
-#endif
char custom_category_labels[NUM_CUSTOM_CATEGORIES][CUSTOM_CATEGORY_LABEL_LEN];
/* callback function buffer */