adding hash type, changed tls configs to hash
[libradsec.git] / hash.h
1 /*
2  * Copyright (C) 2008 Stig Venaas <venaas@uninett.no>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  */
8
9 #include <stdint.h>
10
11 struct hash {
12     struct list *hashlist;
13     pthread_mutex_t mutex;
14 };
15
16 /* allocates and initialises hash structure; returns NULL if malloc fails */
17 struct hash *hash_create();
18
19 /* frees all memory associated with the hash */
20 void hash_destroy(struct hash *hash);
21
22 /* insert entry in hash; returns 1 if ok, 0 if malloc fails */
23 int hash_insert(struct hash *hash, void *key, uint32_t keylen, void *data);
24
25 /* reads entry from hash */
26 void *hash_read(struct hash *hash, void *key, uint32_t keylen);