diff options
Diffstat (limited to 'example')
-rw-r--r-- | example/ndpiReader.c | 19 | ||||
-rw-r--r-- | example/reader_util.c | 12 | ||||
-rw-r--r-- | example/reader_util.h | 8 |
3 files changed, 39 insertions, 0 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 0bbcd1e55..8ae077eb4 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -1961,6 +1961,25 @@ static void printFlow(u_int32_t id, struct ndpi_flow_info *flow, u_int16_t threa } break; + case INFO_SIP: + if (flow->sip.from[0] != '\0') + { + fprintf(out, "[SIP From: %s]", flow->sip.from); + } + if (flow->sip.from_imsi[0] != '\0') + { + fprintf(out, "[SIP From IMSI: %s]", flow->sip.from_imsi); + } + if (flow->sip.to[0] != '\0') + { + fprintf(out, "[SIP To: %s]", flow->sip.to); + } + if (flow->sip.to_imsi[0] != '\0') + { + fprintf(out, "[SIP To IMSI: %s]", flow->sip.to_imsi); + } + break; + case INFO_NATPMP: if (flow->natpmp.internal_port != 0 && flow->natpmp.ip[0] != '\0') { diff --git a/example/reader_util.c b/example/reader_util.c index 6ce02f001..7329c2e10 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1487,6 +1487,18 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl ndpi_snprintf(flow->info, sizeof(flow->info), "Username: %s", flow->ndpi_flow->protos.collectd.client_username); } + /* SIP */ + else if(is_ndpi_proto(flow, NDPI_PROTOCOL_SIP)) { + flow->info_type = INFO_SIP; + if(flow->ndpi_flow->protos.sip.from) + ndpi_snprintf(flow->sip.from, sizeof(flow->sip.from), "%s", flow->ndpi_flow->protos.sip.from); + if(flow->ndpi_flow->protos.sip.from_imsi[0] != '\0') + ndpi_snprintf(flow->sip.from_imsi, sizeof(flow->sip.from_imsi), "%s", flow->ndpi_flow->protos.sip.from_imsi); + if(flow->ndpi_flow->protos.sip.to) + ndpi_snprintf(flow->sip.to, sizeof(flow->sip.to), "%s", flow->ndpi_flow->protos.sip.to); + if(flow->ndpi_flow->protos.sip.to_imsi[0] != '\0') + ndpi_snprintf(flow->sip.to_imsi, sizeof(flow->sip.to_imsi), "%s", flow->ndpi_flow->protos.sip.to_imsi); + } /* TELNET */ else if(is_ndpi_proto(flow, NDPI_PROTOCOL_TELNET)) { if(flow->ndpi_flow->protos.telnet.username[0] != '\0') diff --git a/example/reader_util.h b/example/reader_util.h index 9a847cb13..41bea5ba0 100644 --- a/example/reader_util.h +++ b/example/reader_util.h @@ -170,6 +170,7 @@ enum info_type { INFO_TIVOCONNECT, INFO_FTP_IMAP_POP_SMTP, INFO_NATPMP, + INFO_SIP, }; typedef struct { @@ -262,6 +263,13 @@ typedef struct ndpi_flow_info { uint16_t external_port; char ip[16]; } natpmp; + + struct { + char from[256]; + char from_imsi[16]; + char to[256]; + char to_imsi[16]; + } sip; }; ndpi_serializer ndpi_flow_serializer; |