]>
Commit | Line | Data |
---|---|---|
4e0938ef | 1 | /* |
5b74111a | 2 | * Copyright (C) 1996-2018 The Squid Software Foundation and contributors |
4e0938ef AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
468ae12b | 9 | #define DEFAULT_HASH_SIZE 7951 |
e1381638 | 10 | extern "C" { |
26ac0430 AJ |
11 | typedef unsigned int HASHHASH(const void *, unsigned int); |
12 | struct _hash_link { | |
13 | char *key; | |
14 | struct _hash_link *next; | |
15 | void *item; | |
16 | }; | |
17 | typedef int HASHCMP(const void *, const void *); | |
14c63c25 | 18 | |
26ac0430 | 19 | typedef struct _hash_link hash_link; |
14c63c25 | 20 | |
26ac0430 AJ |
21 | struct _hash_table { |
22 | int valid; | |
23 | hash_link **buckets; | |
24 | HASHCMP *cmp; | |
25 | HASHHASH *hash; | |
26 | unsigned int size; | |
27 | unsigned int current_slot; | |
28 | hash_link *current_ptr; | |
29 | }; | |
30 | typedef struct _hash_table hash_table; | |
14c63c25 | 31 | |
26ac0430 AJ |
32 | extern int hash_links_allocated; |
33 | /* AYJ: defined by globals.h */ | |
f53969cc SM |
34 | //extern int store_hash_buckets; /* 0 */ |
35 | //extern hash_table *store_table; /* NULL */ | |
26ac0430 AJ |
36 | extern hash_table *hash_create(HASHCMP *, int, HASHHASH *); |
37 | extern void hash_insert(hash_table *, const char *, void *); | |
38 | extern int hash_delete(hash_table *, const char *); | |
39 | int hash_delete_link(hash_table *, hash_link *); | |
40 | int hash_unlink(hash_table *, hash_link *, int); | |
41 | void hash_join(hash_table *, hash_link *); | |
42 | int hash_remove_link(hash_table *, hash_link *); | |
43 | hash_link *hash_lookup(hash_table *, const void *); | |
44 | hash_link *hash_first(hash_table *); | |
45 | hash_link *hash_next(hash_table *); | |
46 | hash_link *hash_get_bucket(hash_table *, unsigned int); | |
47 | void hashFreeMemory(hash_table *); | |
48 | HASHHASH hash_string; | |
49 | HASHHASH hash_url; | |
50 | HASHHASH hash4; | |
e9505fad | 51 | |
52 | } | |
f53969cc | 53 |