blob: 8858dbcb232f6fe0da2dd7ce549b3944a3d77e4a [file] [log] [blame]
James Kuszmaul82f6c042021-01-17 11:30:16 -08001/**
2 * @file re_hash.h Interface to hashmap table
3 *
4 * Copyright (C) 2010 Creytiv.com
5 */
6
7
8struct hash;
9struct pl;
10
11
12int hash_alloc(struct hash **hp, uint32_t bsize);
13void hash_append(struct hash *h, uint32_t key, struct le *le, void *data);
14void hash_unlink(struct le *le);
15struct le *hash_lookup(const struct hash *h, uint32_t key, list_apply_h *ah,
16 void *arg);
17struct le *hash_apply(const struct hash *h, list_apply_h *ah, void *arg);
18struct list *hash_list(const struct hash *h, uint32_t key);
19uint32_t hash_bsize(const struct hash *h);
20void hash_flush(struct hash *h);
21void hash_clear(struct hash *h);
22uint32_t hash_valid_size(uint32_t size);
23
24
25/* Hash functions */
26uint32_t hash_joaat(const uint8_t *key, size_t len);
27uint32_t hash_joaat_ci(const char *str, size_t len);
28uint32_t hash_joaat_str(const char *str);
29uint32_t hash_joaat_str_ci(const char *str);
30uint32_t hash_joaat_pl(const struct pl *pl);
31uint32_t hash_joaat_pl_ci(const struct pl *pl);
32uint32_t hash_fast(const char *k, size_t len);
33uint32_t hash_fast_str(const char *str);