diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ndpi_api.h | 14 | ||||
-rw-r--r-- | src/include/ndpi_typedefs.h | 6 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index 258c09ae8..ce124bbf6 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -1747,7 +1747,8 @@ extern "C" { /* ******************************* */ u_int32_t ndpi_crc32(const void* data, size_t n_bytes); - + u_int32_t ndpi_nearest_power_of_two(u_int32_t x); + /* ******************************* */ int ndpi_des_init(struct ndpi_des_struct *des, double alpha, double beta, float significance); @@ -1793,7 +1794,7 @@ extern "C" { /* ******************************* */ - /* HyperLogLog cardinality estimator */ + /* HyperLogLog cardinality estimator [count unique items] */ /* Memory lifecycle */ int ndpi_hll_init(struct ndpi_hll *hll, u_int8_t bits); @@ -1809,6 +1810,15 @@ extern "C" { /* ******************************* */ + /* Count-Min Sketch [count how many times a value has been observed] */ + + struct ndpi_cm_sketch *ndpi_cm_sketch_init(u_int16_t depth); + void ndpi_cm_sketch_add(struct ndpi_cm_sketch *sketch, u_int32_t element); + u_int32_t ndpi_cm_sketch_count(struct ndpi_cm_sketch *sketch, u_int32_t element); + void ndpi_cm_sketch_destroy(struct ndpi_cm_sketch *sketch); + + /* ******************************* */ + int ndpi_init_bin(struct ndpi_bin *b, enum ndpi_bin_family f, u_int16_t num_bins); void ndpi_free_bin(struct ndpi_bin *b); struct ndpi_bin* ndpi_clone_bin(struct ndpi_bin *b); diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index e3a649892..373a704da 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -1897,6 +1897,12 @@ struct ndpi_hll { u_int8_t *registers; }; +struct ndpi_cm_sketch { + u_int16_t num_hashes; /* depth: Number of hash tables */ + u_int32_t num_hash_buckets; /* Number pf nuckets of each hash */ + u_int32_t *tables; +}; + /* **************************************** */ enum ndpi_bin_family { |