From 6c3d162cd6d3f884b634397d63cea180b1e8f721 Mon Sep 17 00:00:00 2001 From: Toni Date: Tue, 9 Jan 2024 00:39:59 +0100 Subject: Add realtime protocol output to `ndpiReader`. (#2197) * support for using a new flow callback invoked before the flow memory is free'd * minor fixes 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 59a5f69ec..06cb6fab6 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