Make sure downtime_depth is always at least 1 when starting
[nagios-reports-module.git] / hash.h
blob517ab7fd153df7166dadef46d9c646e4b9f8b498
1 #ifndef _HASH_H_
2 #define _HASH_H_
3 #include <stdio.h>
5 #define HASH_BUCKETS (1 << 10)
7 typedef struct hash_bucket {
8 const char *key;
9 const char *key2;
10 void *data;
11 struct hash_bucket *next;
12 } hash_bucket;
14 typedef struct hash_table {
15 hash_bucket **buckets;
16 size_t num_buckets;
17 size_t entries;
18 size_t max_entries;
19 } hash_table;
21 #define TABLE hash_table *table
22 extern hash_table *hash_init(size_t buckets);
23 extern void *hash_find(TABLE, const char *key);
24 extern void *hash_find2(TABLE, const char *k1, const char *k2);
25 extern int hash_add(TABLE, const char *key, void *data);
26 extern int hash_add2(TABLE, const char *k1, const char *k2, void *data);
27 extern int hash_add_unique(TABLE, const char *key, void *data);
28 extern void *hash_update(TABLE, const char *key, void *data);
29 extern void *hash_update2(TABLE, const char *k1, const char *k2, void *data);
30 extern void *hash_remove(TABLE, const char *key);
31 extern void *hash_remove2(TABLE, const char *k1, const char *k2);
32 extern void hash_remove_data(TABLE, const char *k1, const void *data);
33 extern void hash_remove_data2(TABLE, const char *k1, const char *k2, const void *data);
34 extern void hash_walk_data(TABLE, int (*walker)(void *data));
35 extern int hash_check_table(TABLE);
36 #endif /* HASH_H */