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
This commit is contained in:
@@ -3142,6 +3142,11 @@ int main(int argc, char **argv) {
|
|||||||
#endif
|
#endif
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if(ndpi_get_api_version() != NDPI_API_VERSION) {
|
||||||
|
printf("nDPI Library version mismatch: please make sure this code and the nDPI library are in sync\n");
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
automataUnitTest();
|
automataUnitTest();
|
||||||
|
|
||||||
ndpi_info_mod = ndpi_init_detection_module();
|
ndpi_info_mod = ndpi_init_detection_module();
|
||||||
|
|||||||
@@ -61,3 +61,4 @@ ndpi_category_get_name
|
|||||||
ndpi_is_custom_category
|
ndpi_is_custom_category
|
||||||
ndpi_is_subprotocol_informative
|
ndpi_is_subprotocol_informative
|
||||||
ndpi_set_proto_category
|
ndpi_set_proto_category
|
||||||
|
ndpi_get_api_version
|
||||||
@@ -31,6 +31,11 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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_ID_STRUCT (sizeof(struct ndpi_id_struct))
|
||||||
#define SIZEOF_FLOW_STRUCT (sizeof(struct ndpi_flow_struct))
|
#define SIZEOF_FLOW_STRUCT (sizeof(struct ndpi_flow_struct))
|
||||||
|
|
||||||
@@ -739,6 +744,7 @@ extern "C" {
|
|||||||
void * ndpi_malloc(size_t size);
|
void * ndpi_malloc(size_t size);
|
||||||
void * ndpi_calloc(unsigned long count, size_t size);
|
void * ndpi_calloc(unsigned long count, size_t size);
|
||||||
void ndpi_free(void *ptr);
|
void ndpi_free(void *ptr);
|
||||||
|
u_int8_t ndpi_get_api_version();
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5234,3 +5234,7 @@ void NDPI_DUMP_BITMASK(NDPI_PROTOCOL_BITMASK a) {
|
|||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u_int8_t ndpi_get_api_version() {
|
||||||
|
return(NDPI_API_VERSION);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user