diff options
author | Luca <deri@ntop.org> | 2018-09-17 17:57:47 +0200 |
---|---|---|
committer | Luca <deri@ntop.org> | 2018-09-17 17:57:47 +0200 |
commit | 8689d3293ab7b09b84395d5351f7f3901db78653 (patch) | |
tree | f2cdc480f32dbc6d654a7365ef09212321edd7a1 /src/lib | |
parent | 51fdd12d235e6c81eb0b48ec7acd4aeb02c3a3c2 (diff) |
Added ndpi_protocol2id() API call
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ndpi_main.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index b904bbefc..dcf146538 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -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) |