1/* $FreeBSD$ */
2
3#ifndef HASHTABLE_H
4#define HASHTABLE_H 1
5
6#include <sys/types.h>
7
8#define HASH_OK         0
9#define HASH_UPDATED    1
10#define HASH_FAIL       2
11#define HASH_FULL       3
12#define HASH_NOTFOUND   4
13
14#define HASHSTEP(x,c) (((x << 5) + x) + (c))
15
16typedef struct {
17  void *key;
18  void *value;
19} hashtable_entry;
20
21typedef struct {
22  size_t key_size;
23  size_t table_size;
24  size_t usage;
25  size_t value_size;
26  hashtable_entry **entries;
27} hashtable;
28
29void hashtable_free(hashtable *);
30int hashtable_get(hashtable *, const void *, void *);
31hashtable *hashtable_init(size_t, size_t, size_t);
32int hashtable_put(hashtable *, const void *, const void *);
33int hashtable_remove(hashtable *, const void *);
34
35#endif	/* HASHTABLE.H */
36