aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/ndpiReader.c26
-rw-r--r--example/reader_util.c12
-rw-r--r--example/reader_util.h7
3 files changed, 45 insertions, 0 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 930220801..f4c0f427a 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -1462,6 +1462,25 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa
}
break;
+ case INFO_SOFTETHER:
+ if (flow->softether.ip[0] != '\0')
+ {
+ fprintf(out, "[Client IP: %s]", flow->softether.ip);
+ }
+ if (flow->softether.port[0] != '\0')
+ {
+ fprintf(out, "[Client Port: %s]", flow->softether.port);
+ }
+ if (flow->softether.hostname[0] != '\0')
+ {
+ fprintf(out, "[Hostname: %s]", flow->softether.hostname);
+ }
+ if (flow->softether.fqdn[0] != '\0')
+ {
+ fprintf(out, "[FQDN: %s]", flow->softether.fqdn);
+ }
+ break;
+
case INFO_FTP_IMAP_POP_SMTP:
if (flow->ftp_imap_pop_smtp.username[0] != '\0')
{
@@ -1888,6 +1907,13 @@ static void printFlowSerialized(u_int16_t thread_id,
}
break;
+ case INFO_SOFTETHER:
+ ndpi_serialize_string_string(serializer, "client_ip", flow->softether.ip);
+ ndpi_serialize_string_string(serializer, "client_port", flow->softether.port);
+ ndpi_serialize_string_string(serializer, "hostname", flow->softether.hostname);
+ ndpi_serialize_string_string(serializer, "fqdn", flow->softether.fqdn);
+ break;
+
case INFO_FTP_IMAP_POP_SMTP:
ndpi_serialize_string_string(serializer, "username",
flow->ftp_imap_pop_smtp.username);
diff --git a/example/reader_util.c b/example/reader_util.c
index dfeeb8672..48f522cbf 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -1080,6 +1080,18 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
flow->bittorent_hash[j] = '\0';
}
}
+ /* SOFTETHER */
+ else if(is_ndpi_proto(flow, NDPI_PROTOCOL_SOFTETHER) && !is_ndpi_proto(flow, NDPI_PROTOCOL_HTTP)) {
+ flow->info_type = INFO_SOFTETHER;
+ ndpi_snprintf(flow->softether.ip, sizeof(flow->softether.ip), "%s",
+ flow->ndpi_flow->protos.softether.ip);
+ ndpi_snprintf(flow->softether.port, sizeof(flow->softether.port), "%s",
+ flow->ndpi_flow->protos.softether.port);
+ ndpi_snprintf(flow->softether.hostname, sizeof(flow->softether.hostname), "%s",
+ flow->ndpi_flow->protos.softether.hostname);
+ ndpi_snprintf(flow->softether.fqdn, sizeof(flow->softether.fqdn), "%s",
+ flow->ndpi_flow->protos.softether.fqdn);
+ }
/* DNS */
else if(is_ndpi_proto(flow, NDPI_PROTOCOL_DNS)) {
if(flow->ndpi_flow->protos.dns.rsp_type == 0x1)
diff --git a/example/reader_util.h b/example/reader_util.h
index e73df42b2..e61167837 100644
--- a/example/reader_util.h
+++ b/example/reader_util.h
@@ -162,6 +162,7 @@ enum info_type {
INFO_INVALID = 0,
INFO_GENERIC,
INFO_KERBEROS,
+ INFO_SOFTETHER,
INFO_FTP_IMAP_POP_SMTP,
INFO_TLS_QUIC_ALPN_VERSION,
INFO_TLS_QUIC_ALPN_ONLY,
@@ -227,6 +228,12 @@ typedef struct ndpi_flow_info {
char hostname[85];
char username[86];
} kerberos;
+ struct {
+ char ip[16];
+ char port[6];
+ char hostname[48];
+ char fqdn[48];
+ } softether;
};
char flow_extra_info[16];