aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2024-12-11 15:28:00 +0100
committerGitHub <noreply@github.com>2024-12-11 15:28:00 +0100
commit803410542e77023545a89627918adb9d601fa774 (patch)
tree3dc2839d2213213653949641329534f18acef41b /example
parent6f82e485dc7a2e0f88078ee9f9ad48855dff50a6 (diff)
STUN/RTP: improve metadata extraction (#2641)
Diffstat (limited to 'example')
-rw-r--r--example/ndpiReader.c4
-rw-r--r--example/reader_util.c3
-rw-r--r--example/reader_util.h1
3 files changed, 8 insertions, 0 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index d5bc9f382..08e0023f2 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -2095,6 +2095,10 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
print_ndpi_address_port_list_file(out, "Rsp Origin IP/Port", &flow->stun.response_origin);
print_ndpi_address_port_list_file(out, "Other IP/Port", &flow->stun.other_address);
+ /* These counters make sense only if the flow entered the monitor state */
+ if(flow->num_packets_before_monitoring > 0)
+ fprintf(out, "[RTP packets: %d/%d]", flow->stun.rtp_counters[0], flow->stun.rtp_counters[1]);
+
if(flow->http.url[0] != '\0') {
ndpi_risk_enum risk = ndpi_validate_url(flow->http.url);
diff --git a/example/reader_util.c b/example/reader_util.c
index c22290025..6400d2260 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -1199,6 +1199,9 @@ static void process_ndpi_monitoring_info(struct ndpi_flow_info *flow) {
add_to_address_port_list(&flow->stun.relayed_address, &flow->ndpi_flow->monit->protos.dtls_stun_rtp.relayed_address);
add_to_address_port_list(&flow->stun.response_origin, &flow->ndpi_flow->monit->protos.dtls_stun_rtp.response_origin);
flow->multimedia_flow_types |= flow->ndpi_flow->flow_multimedia_types;
+
+ flow->stun.rtp_counters[0] = flow->ndpi_flow->stun.rtp_counters[0];
+ flow->stun.rtp_counters[1] = flow->ndpi_flow->stun.rtp_counters[1];
}
}
diff --git a/example/reader_util.h b/example/reader_util.h
index 5b0e36cde..6a44ae022 100644
--- a/example/reader_util.h
+++ b/example/reader_util.h
@@ -323,6 +323,7 @@ typedef struct ndpi_flow_info {
struct {
ndpi_address_port_list mapped_address, peer_address,
relayed_address, response_origin, other_address;
+ u_int16_t rtp_counters[2];
} stun;
struct {