Added ndpi_protocol2id() API call

This commit is contained in:
Luca
2018-09-17 17:57:47 +02:00
parent 51fdd12d23
commit 8689d3293a
2 changed files with 31 additions and 0 deletions
+17
View File
@@ -5363,6 +5363,23 @@ ndpi_protocol ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct
/* ****************************************************** */
char* ndpi_protocol2id(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_protocol proto, char *buf, u_int buf_len) {
if((proto.master_protocol != NDPI_PROTOCOL_UNKNOWN)
&& (proto.master_protocol != proto.app_protocol)) {
if(proto.app_protocol != NDPI_PROTOCOL_UNKNOWN)
snprintf(buf, buf_len, "%u.%u",
proto.master_protocol, proto.app_protocol);
else
snprintf(buf, buf_len, "%u", proto.master_protocol);
} else
snprintf(buf, buf_len, "%u", proto.app_protocol);
return(buf);
}
/* ****************************************************** */
char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_protocol proto, char *buf, u_int buf_len) {
if((proto.master_protocol != NDPI_PROTOCOL_UNKNOWN)