From 709e460c896861f413baa5189d46b15ba06c2673 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sun, 3 Dec 2023 09:03:56 +0100 Subject: Add realtime protocol output to `ndpiReader`. * support for using a new flow callback invoked before the flow memory is free'd * minor fixes * Win32 gmtime fix Signed-off-by: Toni Uhlig --- example/reader_util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'example/reader_util.h') diff --git a/example/reader_util.h b/example/reader_util.h index 9c55355e6..b0e6a88c1 100644 --- a/example/reader_util.h +++ b/example/reader_util.h @@ -374,6 +374,9 @@ typedef struct ndpi_workflow { struct ndpi_workflow_prefs prefs; struct ndpi_stats stats; + ndpi_workflow_callback_ptr flow_callback; + void * flow_callback_userdata; + /* outside referencies */ pcap_t *pcap_handle; @@ -408,6 +411,13 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, const u_char *packet, ndpi_risk *flow_risk); + +/* Flow callback for completed flows, before the flow memory will be freed. */ +static inline void ndpi_workflow_set_flow_callback(struct ndpi_workflow * workflow, ndpi_workflow_callback_ptr callback, void * userdata) { + workflow->flow_callback = callback; + workflow->flow_callback_userdata = userdata; +} + int ndpi_is_datalink_supported(int datalink_type); /* compare two nodes in workflow */ -- cgit v1.2.3