diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/ndpi_api.h | 14 | ||||
-rw-r--r-- | src/include/ndpi_typedefs.h | 12 | ||||
-rw-r--r-- | src/lib/ndpi_domain_classify.c | 3 |
3 files changed, 27 insertions, 2 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index fa7f77f33..fc3b5354c 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -2078,6 +2078,20 @@ extern "C" { /* ******************************* */ + /* + Similar to ndpi_filter but based on binary search and with the + ability to store a category per value (as ndpi_domain_classify) + */ + ndpi_binary_bitmap* ndpi_binary_bitmap_alloc(); + bool ndpi_binary_bitmap_set(ndpi_binary_bitmap *b, u_int32_t value, u_int8_t category); + bool ndpi_binary_bitmap_compress(ndpi_binary_bitmap *b); + bool ndpi_binary_bitmap_isset(ndpi_binary_bitmap *b, u_int32_t value, u_int8_t *out_category); + void ndpi_binary_bitmap_free(ndpi_binary_bitmap *b); + u_int32_t ndpi_binary_bitmap_size(ndpi_binary_bitmap *b); + u_int32_t ndpi_binary_bitmap_cardinality(ndpi_binary_bitmap *b); + + /* ******************************* */ + char* ndpi_get_flow_risk_info(struct ndpi_flow_struct *flow, char *out, u_int out_len, u_int8_t use_json); diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index bece570cc..1106f7768 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -2033,6 +2033,18 @@ typedef void ndpi_filter; #define MAX_NUM_NDPI_DOMAIN_CLASSIFICATIONS 16 +PACK_ON +struct ndpi_binary_bitmap_entry { + u_int32_t value; + u_int8_t category; +} PACK_OFF; + +typedef struct { + u_int32_t num_allocated_entries, num_used_entries; + struct ndpi_binary_bitmap_entry *entries; + bool is_compressed; +} ndpi_binary_bitmap; + /* **************************************** */ #endif /* __NDPI_TYPEDEFS_H__ */ diff --git a/src/lib/ndpi_domain_classify.c b/src/lib/ndpi_domain_classify.c index df82cdabb..b0cf06d72 100644 --- a/src/lib/ndpi_domain_classify.c +++ b/src/lib/ndpi_domain_classify.c @@ -32,8 +32,6 @@ #include "ndpi_config.h" #include "ndpi_api.h" -#include "ndpi_includes.h" -#include "ndpi_encryption.h" typedef struct { ndpi_bitmap *bitmap[NUM_DOMAIN_BITMAPS]; @@ -410,3 +408,4 @@ u_int16_t ndpi_domain_classify_contains(ndpi_domain_classify *_s, return(0); } + |