hash.h File Reference

Go to the source code of this file.


class  hash_link
class  hash_table


#define DEFAULT_HASH_SIZE   7951 /* prime number < 8192 */


typedef void HASHFREE (void *)
typedef int HASHCMP (const void *, const void *)
typedef unsigned int HASHHASH (const void *, unsigned int)


SQUIDCEXTERN hash_tablehash_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_linkhash_lookup (hash_table *, const void *)
SQUIDCEXTERN void hash_first (hash_table *)
SQUIDCEXTERN hash_linkhash_next (hash_table *)
SQUIDCEXTERN void hash_last (hash_table *)
SQUIDCEXTERN hash_linkhash_get_bucket (hash_table *, unsigned int)
SQUIDCEXTERN void hashFreeMemory (hash_table *)
SQUIDCEXTERN void hashFreeItems (hash_table *, HASHFREE *)
SQUIDCEXTERN const char * hashKeyStr (hash_link *)



Macro Definition Documentation

#define DEFAULT_HASH_SIZE   7951 /* prime number < 8192 */

Definition at line 66 of file hash.h.

Referenced by hash_create().

Typedef Documentation

typedef int HASHCMP(const void *, const void *)

Definition at line 13 of file hash.h.

typedef void HASHFREE(void *)

Definition at line 12 of file hash.h.

typedef unsigned int HASHHASH(const void *, unsigned int)

Definition at line 14 of file hash.h.

Function Documentation

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 109 of file hash.cc.

Referenced by authenticateDigestNonceSetup(), cacheCreate(), cacheIndexCreate(), clientdbInit(), externalAclInit(), fqdncache_init(), Dns::Init(), Store::Disks::init(), Ident::Init(), ipcache_init(), LeakFinder::LeakFinder(), main(), netdbInit(), PconnPool::PconnPool(), and read_passwd_file().

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 248 of file hash.cc.

Referenced by clientdbGC(), and Store::LocalSearch::copyBucket().

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 132 of file hash.cc.

Referenced by external_acl::add(), LeakFinder::addSome(), authenticateDigestNonceNew(), cacheIndexScan(), cacheStore(), clientdbAdd(), do_open(), fqdncacheAddEntry(), StoreEntry::hashInsert(), idnsStartQuery(), ipcacheAddEntry(), netdbHashInsert(), netdbHostInsert(), PconnPool::push(), read_passwd_file(), and Ident::Start().

SQUIDCEXTERN void hash_last ( hash_table hid)

hash_last - resets hash traversal state to NULL

Definition at line 208 of file hash.cc.

References assert, hash_table::current_slot, hash_table::next, and NULL.

Referenced by client_entry().

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 224 of file hash.cc.

Referenced by authDigestNoncePurge(), authenticateDigestNonceDelete(), cacheDestroy(), cacheIndexDestroy(), cacheIndexScan(), cachePurge(), clientdbGC(), do_close(), external_acl_cache_delete(), fqdncacheRelease(), LeakFinder::freeSome(), StoreEntry::hashDelete(), idnsCallback(), ipcacheRelease(), netdbHashDelete(), netdbHostDelete(), Ident::IdentStateData::swanSong(), and PconnPool::unlinkList().

SQUIDCEXTERN int hashPrime ( int  n)

Definition at line 297 of file hash.cc.

References hash_primes, i, log(), and min().

Referenced by externalAclInit(), fqdncache_init(), Ident::Init(), ipcache_init(), and netdbInit().

Variable Documentation

Definition at line 46 of file hash.h.

Referenced by externalAclInit(), fqdncache_init(), Ident::Init(), ipcache_init(), and main().






Web Site Translations