9 typedef void HASHFREE(void *);
10 typedef int HASHCMP(const void *, const void *);
11 typedef unsigned int HASHHASH(const void *, unsigned int);
12 typedef struct _hash_link hash_link
;
13 typedef struct _hash_table hash_table
;
25 unsigned int current_slot
;
30 SQUIDCEXTERN hash_table
*hash_create(HASHCMP
*, int, HASHHASH
*);
31 SQUIDCEXTERN
void hash_join(hash_table
*, hash_link
*);
32 SQUIDCEXTERN
void hash_remove_link(hash_table
*, hash_link
*);
33 SQUIDCEXTERN
int hashPrime(int n
);
34 SQUIDCEXTERN hash_link
*hash_lookup(hash_table
*, const void *);
35 SQUIDCEXTERN
void hash_first(hash_table
*);
36 SQUIDCEXTERN hash_link
*hash_next(hash_table
*);
37 SQUIDCEXTERN
void hash_last(hash_table
*);
38 SQUIDCEXTERN hash_link
*hash_get_bucket(hash_table
*, unsigned int);
39 SQUIDCEXTERN
void hashFreeMemory(hash_table
*);
40 SQUIDCEXTERN
void hashFreeItems(hash_table
*, HASHFREE
*);
41 SQUIDCEXTERN HASHHASH hash_string
;
42 SQUIDCEXTERN HASHHASH hash4
;
43 SQUIDCEXTERN
const char *hashKeyStr(hash_link
*);
46 * Here are some good prime number choices. It's important not to
47 * choose a prime number that is too close to exact powers of 2.
49 * HASH_SIZE 103 // prime number < 128
50 * HASH_SIZE 229 // prime number < 256
51 * HASH_SIZE 467 // prime number < 512
52 * HASH_SIZE 977 // prime number < 1024
53 * HASH_SIZE 1979 // prime number < 2048
54 * HASH_SIZE 4019 // prime number < 4096
55 * HASH_SIZE 6037 // prime number < 6144
56 * HASH_SIZE 7951 // prime number < 8192
57 * HASH_SIZE 12149 // prime number < 12288
58 * HASH_SIZE 16231 // prime number < 16384
59 * HASH_SIZE 33493 // prime number < 32768
60 * HASH_SIZE 65357 // prime number < 65536
62 #define DEFAULT_HASH_SIZE 7951 /* prime number < 8192 */
64 #endif /* SQUID_HASH_H */