From b868b0d0ed289c0a748833af591cb457c937b923 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Tue, 30 Jan 2024 08:51:56 +0100 Subject: Provide a u64 wrapper for `ndpi_set_config()` Signed-off-by: Toni Uhlig --- src/lib/ndpi_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/lib/ndpi_main.c') diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index c3309e714..ab2470aaa 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -10825,6 +10825,21 @@ ndpi_cfg_error ndpi_set_config(struct ndpi_detection_module_struct *ndpi_str, return NDPI_CFG_NOT_FOUND; } +ndpi_cfg_error ndpi_set_config_u64(struct ndpi_detection_module_struct *ndpi_str, + const char *proto, const char *param, uint64_t value) +{ + char value_str[21]; + int value_len; + + value_len = ndpi_snprintf(value_str, sizeof(value_str), "%llu", (unsigned long long int)value); + if (value_len <= 0 || value_len >= (int)sizeof(value_str)) + { + return NDPI_CFG_INVALID_PARAM; + } + + return ndpi_set_config(ndpi_str, proto, param, value_str); +} + char *ndpi_get_config(struct ndpi_detection_module_struct *ndpi_str, const char *proto, const char *param, char *buf, int buf_len) { -- cgit v1.2.3