Skip to content

Commit 2e7b75a

Browse files
authored
STUN/RTP: extend extracted metadata (#2798)
1 parent 9283ebc commit 2e7b75a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/include/ndpi_typedefs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,7 @@ struct ndpi_flow_struct {
14171417
u_int8_t num_xor_relayed_addresses, num_xor_mapped_addresses;
14181418
u_int8_t num_non_stun_pkt, non_stun_pkt_len[2];
14191419
u_int16_t rtp_counters[2];
1420+
u_int32_t t_start, t_end;
14201421
} stun;
14211422

14221423
struct {

src/lib/protocols/stun.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,13 @@ static int stun_search_again(struct ndpi_detection_module_struct *ndpi_struct,
973973
/* TODO: store RTP information in 'struct rtp_info' */
974974
NDPI_LOG_INFO(ndpi_struct, "Found RTP over STUN\n");
975975

976+
if(flow->stun.t_start != 0) {
977+
flow->stun.t_end = ndpi_get_current_time(flow);
978+
} else if(flow->stun.rtp_counters[0] != 0 && flow->stun.rtp_counters[1] != 0) {
979+
flow->stun.t_start = ndpi_get_current_time(flow);
980+
flow->stun.t_end = ndpi_get_current_time(flow);
981+
}
982+
976983
rtp_get_stream_type(packet->payload[1] & 0x7F, &flow->flow_multimedia_types, flow->detected_protocol_stack[0]);
977984

978985
if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_RTP &&

0 commit comments

Comments
 (0)