Go to the source code of this file.
Classes | |
class | hash_link |
class | hash_table |
Macros | |
#define | DEFAULT_HASH_SIZE 7951 /* prime number < 8192 */ |
Typedefs | |
typedef void | HASHFREE(void *) |
typedef int | HASHCMP(const void *, const void *) |
typedef unsigned int | HASHHASH(const void *, unsigned int) |
Functions | |
SQUIDCEXTERN hash_table * | hash_create (HASHCMP *, int, HASHHASH *) |
SQUIDCEXTERN void | hash_join (hash_table *, hash_link *) |
SQUIDCEXTERN void | hash_remove_link (hash_table *, hash_link *) |
SQUIDCEXTERN int | hashPrime (int n) |
SQUIDCEXTERN hash_link * | hash_lookup (hash_table *, const void *) |
SQUIDCEXTERN void | hash_first (hash_table *) |
SQUIDCEXTERN hash_link * | hash_next (hash_table *) |
SQUIDCEXTERN void | hash_last (hash_table *) |
SQUIDCEXTERN hash_link * | hash_get_bucket (hash_table *, unsigned int) |
SQUIDCEXTERN void | hashFreeMemory (hash_table *) |
SQUIDCEXTERN void | hashFreeItems (hash_table *, HASHFREE *) |
SQUIDCEXTERN const char * | hashKeyStr (const hash_link *) |
Variables | |
SQUIDCEXTERN HASHHASH | hash_string |
SQUIDCEXTERN HASHHASH | hash4 |
Macro Definition Documentation
◆ DEFAULT_HASH_SIZE
Typedef Documentation
◆ HASHCMP
◆ HASHFREE
◆ HASHHASH
Function Documentation
◆ hash_create()
SQUIDCEXTERN hash_table * hash_create | ( | HASHCMP * | cmp_func, |
int | hash_sz, | ||
HASHHASH * | hash_func | ||
) |
hash_create - creates a new hash table, uses the cmp_func to compare keys. Returns the identification for the hash table; otherwise returns a negative number on error.
Definition at line 108 of file hash.cc.
References hash_table::buckets, hash_table::cmp, hash_table::current_slot, DEFAULT_HASH_SIZE, hash_table::hash, int, hash_table::next, hash_table::size, and xcalloc().
Referenced by PconnPool::PconnPool(), authenticateDigestNonceSetup(), cacheCreate(), clientdbInit(), externalAclInit(), fqdncache_init(), Store::Disks::init(), Dns::Init(), ipcache_init(), main(), netdbInit(), read_passwd_file(), and Ident::Start().
◆ hash_first()
SQUIDCEXTERN void hash_first | ( | hash_table * | hid | ) |
hash_first - initializes the hash table for the hash_next() function.
Definition at line 172 of file hash.cc.
References assert, hash_table::buckets, hash_table::current_slot, hash_next_bucket(), and hash_table::next.
Referenced by authenticateDigestNonceCacheCleanup(), authenticateDigestNonceShutdown(), cacheDestroy(), cacheResetDigest(), client_entry(), clientdbDump(), PconnPool::closeN(), PconnPool::dumpHash(), fqdnStats(), hashFreeItems(), netdbBinaryExchange(), netdbDump(), netdbPurgeLRU(), and netdbSaveState().
◆ hash_get_bucket()
SQUIDCEXTERN hash_link * hash_get_bucket | ( | hash_table * | hid, |
unsigned int | bucket | ||
) |
hash_get_bucket - returns the head item of the bucket in the hash table 'hid'. Otherwise, returns NULL on error.
Definition at line 244 of file hash.cc.
References hash_table::buckets, and hash_table::size.
Referenced by clientdbGC(), and Store::LocalSearch::copyBucket().
◆ hash_join()
SQUIDCEXTERN void hash_join | ( | hash_table * | hid, |
hash_link * | lnk | ||
) |
hash_join - joins a hash_link under its key lnk->key into the hash table 'hid'.
It does not copy any data into the hash table, only links pointers.
Definition at line 131 of file hash.cc.
References hash_table::buckets, hash_table::count, hash_table::hash, hash_link::key, hash_link::next, and hash_table::size.
Referenced by external_acl::add(), authenticateDigestNonceNew(), cacheStore(), clientdbAdd(), do_open(), fqdncacheAddEntry(), StoreEntry::hashInsert(), idnsStartQuery(), ipcacheAddEntry(), netdbHashInsert(), netdbHostInsert(), PconnPool::push(), read_passwd_file(), and Ident::Start().
◆ hash_last()
SQUIDCEXTERN void hash_last | ( | hash_table * | hid | ) |
hash_last - resets hash traversal state to NULL
Definition at line 204 of file hash.cc.
References assert, hash_table::current_slot, and hash_table::next.
Referenced by client_entry().
◆ hash_lookup()
SQUIDCEXTERN hash_link * hash_lookup | ( | hash_table * | hid, |
const void * | k | ||
) |
hash_lookup - locates the item under the key 'k' in the hash table 'hid'. Returns a pointer to the hash bucket on success; otherwise returns NULL.
Definition at line 146 of file hash.cc.
References assert, hash_table::buckets, hash_table::cmp, hash_table::hash, hash_link::next, and hash_table::size.
Referenced by aclMatchExternal(), authenticateDigestNonceFindNonce(), cachePurge(), cacheQueryPeer(), cacheStore(), clientdbCutoffDenied(), clientdbEstablished(), clientdbGetInfo(), clientdbUpdate(), do_close(), do_read(), do_write(), external_acl_cache_add(), Store::Controller::findCallbackXXX(), StoreEntry::forcePublicKey(), fqdncache_get(), fqdncacheAddEntry(), GetPassword(), idnsCachedLookup(), ipcache_get(), ipcacheAddEntry(), netdbHashDelete(), netdbHashInsert(), netdbHostInsert(), netdbLookupAddr(), netdbLookupHost(), netdbSendPing(), Store::Controller::peekAtLocal(), PconnPool::popStored(), PconnPool::push(), StoreEntry::setPrivateKey(), snmp_meshCtblFn(), and Ident::Start().
◆ hash_next()
SQUIDCEXTERN hash_link * hash_next | ( | hash_table * | hid | ) |
hash_next - returns the next item in the hash table 'hid'. Otherwise, returns NULL on error or end of list.
MUST call hash_first() before hash_next().
Definition at line 188 of file hash.cc.
References hash_next_bucket(), hash_link::next, and hash_table::next.
Referenced by authenticateDigestNonceCacheCleanup(), authenticateDigestNonceShutdown(), cacheDestroy(), cacheResetDigest(), client_entry(), clientdbDump(), PconnPool::closeN(), PconnPool::dumpHash(), fqdnStats(), hashFreeItems(), netdbBinaryExchange(), netdbDump(), netdbPurgeLRU(), and netdbSaveState().
◆ hash_remove_link()
SQUIDCEXTERN void hash_remove_link | ( | hash_table * | hid, |
hash_link * | hl | ||
) |
hash_remove_link - deletes the given hash_link node from the hash table 'hid'. Does not free the item, only removes it from the list.
An assertion is triggered if the hash_link is not found in the list.
Definition at line 220 of file hash.cc.
References assert, hash_table::buckets, hash_table::count, hash_table::hash, hash_next_bucket(), hash_link::key, hash_link::next, hash_table::next, and hash_table::size.
Referenced by Ident::IdentStateData::~IdentStateData(), authDigestNoncePurge(), cacheDestroy(), cachePurge(), clientdbGC(), do_close(), external_acl_cache_delete(), fqdncacheRelease(), StoreEntry::hashDelete(), idnsCallback(), ipcacheRelease(), netdbHashDelete(), netdbHostDelete(), and PconnPool::unlinkList().
◆ hashFreeItems()
SQUIDCEXTERN void hashFreeItems | ( | hash_table * | hid, |
HASHFREE * | free_func | ||
) |
Definition at line 252 of file hash.cc.
References hash_table::count, hash_first(), hash_next(), xcalloc(), and xfree.
Referenced by Store::Controller::~Controller(), PconnPool::~PconnPool(), and read_passwd_file().
◆ hashFreeMemory()
SQUIDCEXTERN void hashFreeMemory | ( | hash_table * | hid | ) |
Definition at line 268 of file hash.cc.
References hash_table::buckets, and xfree.
Referenced by Store::Controller::~Controller(), external_acl::~external_acl(), PconnPool::~PconnPool(), and cacheDestroy().
◆ hashKeyStr()
SQUIDCEXTERN const char * hashKeyStr | ( | const hash_link * | hl | ) |
return the key of a hash_link as a const string
Definition at line 313 of file hash.cc.
References hash_link::key.
Referenced by client_entry(), clientdbDump(), IdleConnList::closeN(), fqdncacheRelease(), fqdnStats(), ipcache_nbgethostbyname_(), ipcacheStatPrint(), netdbDump(), netdbSaveState(), PconnPool::popStored(), PconnPool::push(), and IdleConnList::removeAt().
◆ hashPrime()
SQUIDCEXTERN int hashPrime | ( | int | n | ) |
Definition at line 293 of file hash.cc.
References hash_primes, log(), and min().
Referenced by externalAclInit(), fqdncache_init(), ipcache_init(), netdbInit(), and Ident::Start().
Variable Documentation
◆ hash4
SQUIDCEXTERN HASHHASH hash4 |
Definition at line 46 of file hash.h.
Referenced by externalAclInit(), fqdncache_init(), ipcache_init(), and Ident::Start().
◆ hash_string
SQUIDCEXTERN HASHHASH hash_string |
Definition at line 45 of file hash.h.
Referenced by PconnPool::PconnPool(), authenticateDigestNonceSetup(), clientdbInit(), Dns::Init(), netdbInit(), and read_passwd_file().