Added ndpi_binary_bitmap datastruture
It is similar to ndpi_filter but based on binary search and with the ability to store a category per value (as ndpi_domain_classify)
This commit is contained in:
@@ -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* ndpi_get_flow_risk_info(struct ndpi_flow_struct *flow,
|
||||||
char *out, u_int out_len,
|
char *out, u_int out_len,
|
||||||
u_int8_t use_json);
|
u_int8_t use_json);
|
||||||
|
|||||||
@@ -2033,6 +2033,18 @@ typedef void ndpi_filter;
|
|||||||
|
|
||||||
#define MAX_NUM_NDPI_DOMAIN_CLASSIFICATIONS 16
|
#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__ */
|
#endif /* __NDPI_TYPEDEFS_H__ */
|
||||||
|
|||||||
@@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
#include "ndpi_config.h"
|
#include "ndpi_config.h"
|
||||||
#include "ndpi_api.h"
|
#include "ndpi_api.h"
|
||||||
#include "ndpi_includes.h"
|
|
||||||
#include "ndpi_encryption.h"
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ndpi_bitmap *bitmap[NUM_DOMAIN_BITMAPS];
|
ndpi_bitmap *bitmap[NUM_DOMAIN_BITMAPS];
|
||||||
@@ -410,3 +408,4 @@ u_int16_t ndpi_domain_classify_contains(ndpi_domain_classify *_s,
|
|||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user