From c590dc49551b32f12ebb4850e13a99cacbf90366 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Tue, 20 May 2025 23:14:59 +0200 Subject: Added new APi calls - ndpi_is_master_only_protocol() - ndpi_normalize_protocol() These two APi calls are used to normalize mater/app nDPI protocols --- src/include/ndpi_api.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/include/ndpi_api.h') diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index c06319aef..812f4d9b7 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -2392,6 +2392,25 @@ extern "C" { u_int32_t ndpi_cache_address_restore(struct ndpi_detection_module_struct *ndpi_struct, char *path, u_int32_t epoch_now); u_int32_t ndpi_cache_address_flush_expired(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t epoch_now); + /* Protocol normalization functions */ + /** + * Checks if the specified protocol identifier can be placed only on the master_protocol field of ndpi_master_app_protocol + * @param ndpi_str nDPI detection module + * @param proto_id nDPI protocol identifier + * @return true if proto_id cannot be used s app_protocol but only on master_protocol, false is it can be used on both fields + */ + bool ndpi_is_master_only_protocol(struct ndpi_detection_module_struct *ndpi_str, u_int16_t proto_id); + + /** + * Normalizes the ndpi_master_app_protocol by reworking values of the specified proto, placing the master/app protocols + * in the corresponding protocol fields + * @param ndpi_str nDPI detection module + * @param proto_id nDPI protocol identifier + * @return true if the protocok has been modified/normalized, false if proto has not been modified + */ + bool ndpi_normalize_protocol(struct ndpi_detection_module_struct *ndpi_str, + ndpi_master_app_protocol *proto); + /* ******************************* */ const char *ndpi_lru_cache_idx_to_name(lru_cache_type idx); -- cgit v1.2.3