1#ifndef LIBNAGIOS_DKHASH_H_INCLUDED
2#define LIBNAGIOS_DKHASH_H_INCLUDED
18#define DKHASH_WALK_REMOVE 1
19#define DKHASH_WALK_STOP 2
23#define DKHASH_EDUPE (-EPERM)
24#define DKHASH_EPERM (-EPERM)
25#define DKHASH_EINVAL (-EINVAL)
26#define DKHASH_ENOMEM (-ENOMEM)
void * dkhash_remove(dkhash_table *t, const char *k1, const char *k2)
Remove data from the hash table Note that this does not free() the pointer to the data stored in the ...
int dkhash_insert(dkhash_table *t, const char *k1, const char *k2, void *data)
Insert a new entry into the hash table.
unsigned int dkhash_collisions(dkhash_table *t)
Get number of collisions in hash table Many collisions is a sign of a too small hash table or poor ha...
struct dkhash_table dkhash_table
opaque type
Definition dkhash.h:30
unsigned int dkhash_num_entries_removed(dkhash_table *t)
Get number of removed items from hash table.
dkhash_table * dkhash_create(unsigned int size)
Create a dual-keyed hash-table of the given size Note that it's generally useful to make the table 25...
void dkhash_walk_data(dkhash_table *t, int(*walker)(void *data))
Call a function once for each item in the hash-table The callback function can return DKHASH_WALK_{RE...
unsigned int dkhash_num_entries(dkhash_table *t)
Get number of items in the hash table.
unsigned int dkhash_num_entries_max(dkhash_table *t)
Get max number of items stored in the hash table.
unsigned int dkhash_num_entries_added(dkhash_table *t)
Get number of entries added to hash table Note that some of them may have been removed.
int dkhash_destroy(dkhash_table *t)
Destroy a dual-keyed hash table.
unsigned int dkhash_table_size(dkhash_table *t)
Get actual table size (in number of buckets)
void * dkhash_get(dkhash_table *t, const char *k1, const char *k2)
Fetch the data associated with a particular key.