aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r--src/lib/ndpi_utils.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c
index 0bade89f5..bbe42bd21 100644
--- a/src/lib/ndpi_utils.c
+++ b/src/lib/ndpi_utils.c
@@ -831,6 +831,38 @@ const char* ndpi_get_flow_info(struct ndpi_flow_struct const * const flow,
/* ********************************** */
+char *ndpi_multimedia_flowtype2str(char *buf, int buf_len, u_int8_t m_types)
+{
+ int rc, len = 0;
+
+ if(buf == NULL || buf_len <= 1)
+ return NULL;
+
+ buf[0] = '\0';
+
+ if(m_types == ndpi_multimedia_unknown_flow) {
+ rc = ndpi_snprintf(buf + len, buf_len - len, "Unknown", len > 0 ? ", " : "");
+ if(rc > 0 && len + rc < buf_len) len += rc; else return NULL;
+ }
+
+ if(m_types & ndpi_multimedia_audio_flow) {
+ rc = ndpi_snprintf(buf + len, buf_len - len, "%sAudio", len > 0 ? ", " : "");
+ if(rc > 0 && len + rc < buf_len) len += rc; else return NULL;
+ }
+ if(m_types & ndpi_multimedia_video_flow) {
+ rc = ndpi_snprintf(buf + len, buf_len - len, "%sVideo", len > 0 ? ", " : "");
+ if(rc > 0 && len + rc < buf_len) len += rc; else return NULL;
+ }
+ if(m_types & ndpi_multimedia_screen_sharing_flow) {
+ rc = ndpi_snprintf(buf + len, buf_len - len, "%sScreen Sharing", len > 0 ? ", " : "");
+ if(rc > 0 && len + rc < buf_len) len += rc; else return NULL;
+ }
+
+ return buf;
+}
+
+/* ********************************** */
+
char* ndpi_ssl_version2str(char *buf, int buf_len,
u_int16_t version, u_int8_t *unknown_tls_version) {
if(unknown_tls_version)
@@ -1260,6 +1292,7 @@ int ndpi_dpi2json(struct ndpi_detection_module_struct *ndpi_struct,
char buf[64];
char const *host_server_name;
char quic_version[16];
+ char content[64] = {0};
u_int i;
if(flow == NULL) return(-1);
@@ -1274,6 +1307,10 @@ int ndpi_dpi2json(struct ndpi_detection_module_struct *ndpi_struct,
ndpi_serialize_string_string(serializer, "domainame", ndpi_get_host_domain(ndpi_struct, host_server_name));
}
+ if(flow->flow_multimedia_types != ndpi_multimedia_unknown_flow) {
+ ndpi_serialize_string_string(serializer, "stream_content", ndpi_multimedia_flowtype2str(content, sizeof(content), flow->flow_multimedia_types));
+ }
+
switch(l7_protocol.proto.master_protocol ? l7_protocol.proto.master_protocol : l7_protocol.proto.app_protocol) {
case NDPI_PROTOCOL_IP_ICMP:
if(flow->entropy > 0.0f) {