From fc7b070030cc33029fc16a71ecd6bbe140bd105c Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Fri, 9 Dec 2022 14:26:53 +0100 Subject: Added RTP stream type in flow metadata --- example/ndpiReader.c | 26 ++++++++++++++++++++++++++ example/reader_util.c | 6 +++++- example/reader_util.h | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-) (limited to 'example') diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 326197ee3..b384e4b5a 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -1527,6 +1527,32 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa } } break; + + case INFO_RTP: + if(flow->rtp.stream_type != rtp_unknown) { + const char *what; + + switch(flow->rtp.stream_type) { + case rtp_audio: + what = "audio"; + break; + + case rtp_video: + what = "video"; + break; + + case rtp_audio_video: + what = "audio/video"; + break; + + default: + what = NULL; + break; + } + + if(what) + fprintf(out, "[RTP Stream Type: %s]", what); + } } if(flow->ssh_tls.advertised_alpns) diff --git a/example/reader_util.c b/example/reader_util.c index 276215eff..5b85c4784 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1228,8 +1228,12 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl ndpi_snprintf(flow->http.request_content_type, sizeof(flow->http.request_content_type), "%s", flow->ndpi_flow->http.request_content_type ? flow->ndpi_flow->http.request_content_type : ""); } } + /* RTP */ + else if(is_ndpi_proto(flow, NDPI_PROTOCOL_RTP)) { + flow->info_type = INFO_RTP; + flow->rtp.stream_type = flow->ndpi_flow->protos.rtp.stream_type; /* COLLECTD */ - else if(is_ndpi_proto(flow, NDPI_PROTOCOL_COLLECTD)) { + } else if(is_ndpi_proto(flow, NDPI_PROTOCOL_COLLECTD)) { flow->info_type = INFO_GENERIC; if(flow->ndpi_flow->protos.collectd.client_username[0] != '\0') ndpi_snprintf(flow->info, sizeof(flow->info), "Username: %s", diff --git a/example/reader_util.h b/example/reader_util.h index 675b00bdf..3140a71bf 100644 --- a/example/reader_util.h +++ b/example/reader_util.h @@ -166,6 +166,7 @@ enum info_type { INFO_TIVOCONNECT, INFO_FTP_IMAP_POP_SMTP, INFO_NATPMP, + INFO_RTP }; // flow tracking @@ -274,6 +275,10 @@ typedef struct ndpi_flow_info { ndpi_cipher_weakness client_unsafe_cipher, server_unsafe_cipher; } ssh_tls; + struct { + enum ndpi_rtp_stream_type stream_type; + } rtp; + struct { char url[256], request_content_type[64], content_type[64], user_agent[256], server[128]; u_int response_status_code; -- cgit v1.2.3