Added HyperLogLog cardinality estimator API calls
/* Memory lifecycle */ int ndpi_hll_init(struct ndpi_hll *hll, u_int8_t bits); void ndpi_hll_destroy(struct ndpi_hll *hll); /* Add values */ void ndpi_hll_add(struct ndpi_hll *hll, const char *data, size_t data_len); void ndpi_hll_add_number(struct ndpi_hll *hll, u_int32_t value) ; /* Get cardinality estimation */ double ndpi_hll_count(struct ndpi_hll *hll);
This commit is contained in:
@@ -1043,6 +1043,22 @@ extern "C" {
|
||||
void ndpi_serialize_risk(ndpi_serializer *serializer, struct ndpi_flow_struct *flow);
|
||||
|
||||
const char* ndpi_risk2str(ndpi_risk_enum risk);
|
||||
|
||||
/* ******************************* */
|
||||
|
||||
/* HyperLogLog cardinality estimator */
|
||||
|
||||
/* Memory lifecycle */
|
||||
int ndpi_hll_init(struct ndpi_hll *hll, u_int8_t bits);
|
||||
void ndpi_hll_destroy(struct ndpi_hll *hll);
|
||||
|
||||
/* Add values */
|
||||
void ndpi_hll_add(struct ndpi_hll *hll, const char *data, size_t data_len);
|
||||
void ndpi_hll_add_number(struct ndpi_hll *hll, u_int32_t value) ;
|
||||
|
||||
/* Get cardinality estimation */
|
||||
double ndpi_hll_count(struct ndpi_hll *hll);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -349,6 +349,8 @@
|
||||
#define NDPI_CIPHER_WEAK 1
|
||||
#define NDPI_CIPHER_INSECURE 2
|
||||
|
||||
#define NDPI_OPTIMAL_HLL_NUM_BUCKETS 16
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <libkern/OSByteOrder.h>
|
||||
|
||||
@@ -1489,4 +1489,12 @@ struct ndpi_analyze_struct {
|
||||
|
||||
typedef struct ndpi_ptree ndpi_ptree_t;
|
||||
|
||||
/* **************************************** */
|
||||
|
||||
struct ndpi_hll {
|
||||
u_int8_t bits;
|
||||
size_t size;
|
||||
u_int8_t *registers;
|
||||
};
|
||||
|
||||
#endif /* __NDPI_TYPEDEFS_H__ */
|
||||
|
||||
Reference in New Issue
Block a user