From a2acd092634d1cfc04e89c874d584a16ae54f3ea Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 21 Mar 2018 18:33:08 +0100 Subject: Added ndpi_get_api_version() API call to be used in applications that are dynamically linking with nDPI, to make sure the APIs are in sync --- src/include/ndpi_api.h | 6 ++++++ src/lib/ndpi_main.c | 4 ++++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index 25a7612f2..230885d6d 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -31,6 +31,11 @@ extern "C" { #endif + /* The #define below is used for apps that dynamically link with nDPI to make + sure that datastructures and in sync across versions + */ +#define NDPI_API_VERSION 1 + #define SIZEOF_ID_STRUCT (sizeof(struct ndpi_id_struct)) #define SIZEOF_FLOW_STRUCT (sizeof(struct ndpi_flow_struct)) @@ -739,6 +744,7 @@ extern "C" { void * ndpi_malloc(size_t size); void * ndpi_calloc(unsigned long count, size_t size); void ndpi_free(void *ptr); + u_int8_t ndpi_get_api_version(); #ifdef __cplusplus } #endif diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index ee698a75f..afb0f39e7 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -5234,3 +5234,7 @@ void NDPI_DUMP_BITMASK(NDPI_PROTOCOL_BITMASK a) { printf("\n"); } + +u_int8_t ndpi_get_api_version() { + return(NDPI_API_VERSION); +} -- cgit v1.2.3