aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.c
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2024-10-19 19:44:00 +0200
committerGitHub <noreply@github.com>2024-10-19 19:44:00 +0200
commit51556113a3bf6ef58a7a2744678da7b2d20e2888 (patch)
tree99210abb5677d18602798b5897d703db27164a7d /example/reader_util.c
parent6dc4533c3cc0786c740f91cedab74e54623349b2 (diff)
ndpiReader: add some statistics about monitoring (#2602)
Diffstat (limited to 'example/reader_util.c')
-rw-r--r--example/reader_util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/example/reader_util.c b/example/reader_util.c
index ffa724800..10445f214 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -1173,6 +1173,13 @@ static void process_ndpi_monitoring_info(struct ndpi_flow_info *flow) {
if(!flow->ndpi_flow || !flow->ndpi_flow->monit)
return;
+ if(flow->monitoring_state == 0 &&
+ flow->ndpi_flow->monitoring) {
+ /* We just moved to monitoring state */
+ flow->monitoring_state = 1;
+ flow->num_packets_before_monitoring = flow->ndpi_flow->packet_direction_complete_counter[0] + flow->ndpi_flow->packet_direction_complete_counter[1];
+ }
+
/* In theory, we should check only for STUN.
However since we sometimes might not have STUN in protocol classification
(because we have only two protocols in flow->ndpi_flow->detected_protocol_stack[])