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