aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2017-02-13 01:29:25 +0100
committerLuca Deri <deri@ntop.org>2017-02-13 01:29:25 +0100
commite2cfc96577be5fe97cd5ce63ac30b23cbfadce84 (patch)
treeb5a0dda703c5e6b5407d81e542b2d46b179578f7 /example
parentb16769ddbe0f20000b52fa86b7a1d6a966705c28 (diff)
Improvements for exporting info in MDNS and UBNTAC2 protocols
Added test pcap file for UBNTAC2
Diffstat (limited to 'example')
-rw-r--r--example/ndpiReader.c2
-rw-r--r--example/ndpi_util.c6
-rw-r--r--example/ndpi_util.h1
3 files changed, 7 insertions, 2 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 4bf786aa8..72b495912 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -387,7 +387,7 @@ static void printFlow(u_int16_t thread_id, struct ndpi_flow_info *flow) {
flow->packets, (long long unsigned int) flow->bytes);
if(flow->host_server_name[0] != '\0') fprintf(out, "[Host: %s]", flow->host_server_name);
-
+ if(flow->info[0] != '\0') fprintf(out, "[%s]", flow->info);
if(flow->ssh_ssl.client_info[0] != '\0') fprintf(out, "[client: %s]", flow->ssh_ssl.client_info);
if(flow->ssh_ssl.server_info[0] != '\0') fprintf(out, "[server: %s]", flow->ssh_ssl.server_info);
diff --git a/example/ndpi_util.c b/example/ndpi_util.c
index d5cb27d5a..3397d8a92 100644
--- a/example/ndpi_util.c
+++ b/example/ndpi_util.c
@@ -516,8 +516,12 @@ static unsigned int packet_processing(struct ndpi_workflow * workflow,
}
if(n == 0) flow->bittorent_hash[0] = '\0';
+ } else if(flow->detected_protocol.protocol == NDPI_PROTOCOL_MDNS) {
+ snprintf(flow->info, sizeof(flow->info), "%s", flow->ndpi_flow->protos.mdns.answer);
+ } else if(flow->detected_protocol.protocol == NDPI_PROTOCOL_UBNTAC2) {
+ snprintf(flow->info, sizeof(flow->info), "%s", flow->ndpi_flow->protos.ubntac2.version);
}
-
+
if((proto == IPPROTO_TCP) && (flow->detected_protocol.protocol != NDPI_PROTOCOL_DNS)) {
if(flow->detected_protocol.protocol == NDPI_PROTOCOL_SSH) {
snprintf(flow->ssh_ssl.client_info, sizeof(flow->ssh_ssl.client_info), "%s",
diff --git a/example/ndpi_util.h b/example/ndpi_util.h
index 171ab8e95..6ff17bac2 100644
--- a/example/ndpi_util.h
+++ b/example/ndpi_util.h
@@ -58,6 +58,7 @@ typedef struct ndpi_flow_info {
// result only, not used for flow identification
ndpi_protocol detected_protocol;
+ char info[96];
char host_server_name[192];
char bittorent_hash[41];