From f89f25c1182a22fbe891fa0fc87ad7ed3e1440b5 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Thu, 13 Feb 2020 15:20:47 +0100 Subject: Added ndpi_is_protocol_detected() API call --- src/include/ndpi_api.h | 3 +++ src/lib/ndpi_utils.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index 342a24ae7..c069b811d 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -982,6 +982,9 @@ extern "C" { void ndpi_data_print_window_values(struct ndpi_analyze_struct *s); /* debug */ ndpi_url_risk ndpi_validate_url(char *url); + + u_int8_t ndpi_is_protocol_detected(struct ndpi_detection_module_struct *ndpi_str, + ndpi_protocol proto); #ifdef __cplusplus } #endif diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 99571b2c6..1f57da19f 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -1379,3 +1379,14 @@ ndpi_url_risk ndpi_validate_url(char *url) { return(rc); } +/* ******************************************************************** */ + +u_int8_t ndpi_is_protocol_detected(struct ndpi_detection_module_struct *ndpi_str, + ndpi_protocol proto) { + if((proto.master_protocol != NDPI_PROTOCOL_UNKNOWN) + || (proto.app_protocol != NDPI_PROTOCOL_UNKNOWN) + || (proto.category != NDPI_PROTOCOL_CATEGORY_UNSPECIFIED)) + return(1); + else + return(0); +} -- cgit v1.2.3