]> git.ipfire.org Git - thirdparty/squid.git/blob - test-suite/hash.h
Merged from trunk
[thirdparty/squid.git] / test-suite / hash.h
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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
9 #define DEFAULT_HASH_SIZE 7951
10 extern "C" {
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 *);
18
19 typedef struct _hash_link hash_link;
20
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;
31
32 extern int hash_links_allocated;
33 /* AYJ: defined by globals.h */
34 //extern int store_hash_buckets; /* 0 */
35 //extern hash_table *store_table; /* NULL */
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;
51
52 }
53