diff options
Diffstat (limited to 'src/include/ndpi_api.h.in')
-rw-r--r-- | src/include/ndpi_api.h.in | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/src/include/ndpi_api.h.in b/src/include/ndpi_api.h.in index 36d592b8d..ed1016aea 100644 --- a/src/include/ndpi_api.h.in +++ b/src/include/ndpi_api.h.in @@ -1693,10 +1693,52 @@ extern "C" { /* ******************************* */ - ndpi_str_hash* ndpi_hash_alloc(u_int32_t max_num_entries); - void ndpi_hash_free(ndpi_str_hash *h); - int ndpi_hash_find_entry(ndpi_str_hash *h, char *key, u_int key_len, u_int8_t *value); - int ndpi_hash_add_entry(ndpi_str_hash *h, char *key, u_int8_t key_len, u_int8_t value); + /** + * Initialize the hashmap. + * + * @par h = pointer to the hash map [in, out] + * + * @return 0 on success, 1 otherwise + * + */ + int ndpi_hash_init(ndpi_str_hash **h); + + /** + * Free the hashmap. + * + * @par h = pointer to the hash map [in, out] + * @par cleanup_func = pointer to a optional callback function + * called for each element in the hashmap [in] + * + */ + void ndpi_hash_free(ndpi_str_hash **h, void (*cleanup_func)(ndpi_str_hash *h)); + + /** + * Search for an entry in the hashmap. + * + * @par h = pointer to the hash map [in] + * @par key = character string (no '\0' required) [in] + * @par key_len = length of the character string @key [in] + * @par value = pointer to a pointer to the value, which contains a + * previously added hash entry [in, out] + * + * @return 0 if an entry with that key was found, 1 otherwise + * + */ + int ndpi_hash_find_entry(ndpi_str_hash *h, char *key, u_int key_len, void **value); + + /** + * Add an entry to the hashmap. + * + * @par h = pointer to the hash map [in, out] + * @par key = character string (no '\0' required) [in] + * @par key_len = length of the character string @key [in] + * @par value = pointer to the value to add [in] + * + * @return 0 if the entry was added, 1 otherwise + * + */ + int ndpi_hash_add_entry(ndpi_str_hash **h, char *key, u_int8_t key_len, void *value); /* ******************************* */ |