ISC DHCP  4.4.1
A reference DHCPv4 and DHCPv6 implementation
hash.h File Reference

Go to the source code of this file.

Data Structures

struct  hashed_object_t
 
struct  hash_bucket
 
struct  hash_table
 
struct  named_hash
 

Macros

#define DEFAULT_HASH_SIZE   9973
 
#define KEY_HASH_SIZE   1009
 
#define HASH_FUNCTIONS_DECL(name, bufarg, type, hashtype)
 
#define HASH_FUNCTIONS(name, bufarg, type, hashtype, ref, deref, hasher)
 

Typedefs

typedef isc_result_t(* hash_foreach_func) (const void *, unsigned, void *)
 
typedef int(* hash_reference) (hashed_object_t **, hashed_object_t *, const char *, int)
 
typedef int(* hash_dereference) (hashed_object_t **, const char *, int)
 
typedef int(* hash_comparator_t) (const void *, const void *, size_t)
 

Functions

void relinquish_hash_bucket_hunks (void)
 
int new_hash_table (struct hash_table **, unsigned, const char *, int)
 
void free_hash_table (struct hash_table **, const char *, int)
 
struct hash_bucketnew_hash_bucket (const char *, int)
 
void free_hash_bucket (struct hash_bucket *, const char *, int)
 
int new_hash (struct hash_table **, hash_reference, hash_dereference, unsigned, unsigned(*do_hash)(const void *, unsigned, unsigned), const char *, int)
 
unsigned do_string_hash (const void *, unsigned, unsigned)
 
unsigned do_case_hash (const void *, unsigned, unsigned)
 
unsigned do_id_hash (const void *, unsigned, unsigned)
 
unsigned do_number_hash (const void *, unsigned, unsigned)
 
unsigned do_ip4_hash (const void *, unsigned, unsigned)
 
unsigned char * hash_report (struct hash_table *)
 
void add_hash (struct hash_table *, const void *, unsigned, hashed_object_t *, const char *, int)
 
void delete_hash_entry (struct hash_table *, const void *, unsigned, const char *, int)
 
int hash_lookup (hashed_object_t **, struct hash_table *, const void *, unsigned, const char *, int)
 
int hash_foreach (struct hash_table *, hash_foreach_func)
 
int casecmp (const void *s, const void *t, size_t len)
 

Macro Definition Documentation

◆ DEFAULT_HASH_SIZE

#define DEFAULT_HASH_SIZE   9973

Definition at line 33 of file hash.h.

◆ HASH_FUNCTIONS

#define HASH_FUNCTIONS (   name,
  bufarg,
  type,
  hashtype,
  ref,
  deref,
  hasher 
)

Definition at line 89 of file hash.h.

◆ HASH_FUNCTIONS_DECL

#define HASH_FUNCTIONS_DECL (   name,
  bufarg,
  type,
  hashtype 
)
Value:
void name##_hash_add (hashtype *, bufarg, unsigned, type *, \
const char *, int); \
void name##_hash_delete (hashtype *, bufarg, unsigned, \
const char *, int); \
int name##_hash_lookup (type **, hashtype *, bufarg, unsigned, \
const char *, int); \
unsigned char * name##_hash_report(hashtype *); \
int name##_hash_foreach (hashtype *, hash_foreach_func); \
int name##_new_hash (hashtype **, unsigned, const char *, int); \
void name##_free_hash_table (hashtype **, const char *, int);
const char * name
Definition: tree.h:47
isc_result_t(* hash_foreach_func)(const void *, unsigned, void *)
Definition: hash.h:45

Definition at line 76 of file hash.h.

◆ KEY_HASH_SIZE

#define KEY_HASH_SIZE   1009

Definition at line 37 of file hash.h.

Typedef Documentation

◆ hash_comparator_t

typedef int(* hash_comparator_t) (const void *, const void *, size_t)

Definition at line 57 of file hash.h.

◆ hash_dereference

typedef int(* hash_dereference) (hashed_object_t **, const char *, int)

Definition at line 48 of file hash.h.

◆ hash_foreach_func

typedef isc_result_t(* hash_foreach_func) (const void *, unsigned, void *)

Definition at line 45 of file hash.h.

◆ hash_reference

typedef int(* hash_reference) (hashed_object_t **, hashed_object_t *, const char *, int)

Definition at line 46 of file hash.h.

Function Documentation

◆ add_hash()

void add_hash ( struct hash_table ,
const void *  ,
unsigned  ,
hashed_object_t ,
const char *  ,
int   
)

Definition at line 396 of file hash.c.

◆ casecmp()

int casecmp ( const void *  s,
const void *  t,
size_t  len 
)

Definition at line 534 of file hash.c.

◆ delete_hash_entry()

void delete_hash_entry ( struct hash_table ,
const void *  ,
unsigned  ,
const char *  ,
int   
)

Definition at line 432 of file hash.c.

◆ do_case_hash()

unsigned do_case_hash ( const void *  ,
unsigned  ,
unsigned   
)

Definition at line 240 of file hash.c.

◆ do_id_hash()

unsigned do_id_hash ( const void *  ,
unsigned  ,
unsigned   
)

Definition at line 290 of file hash.c.

◆ do_ip4_hash()

unsigned do_ip4_hash ( const void *  ,
unsigned  ,
unsigned   
)

Definition at line 332 of file hash.c.

◆ do_number_hash()

unsigned do_number_hash ( const void *  ,
unsigned  ,
unsigned   
)

Definition at line 324 of file hash.c.

◆ do_string_hash()

unsigned do_string_hash ( const void *  ,
unsigned  ,
unsigned   
)

Definition at line 266 of file hash.c.

◆ free_hash_bucket()

void free_hash_bucket ( struct hash_bucket ,
const char *  ,
int   
)

Definition at line 193 of file hash.c.

◆ free_hash_table()

void free_hash_table ( struct hash_table **  ,
const char *  ,
int   
)

Definition at line 98 of file hash.c.

◆ hash_foreach()

int hash_foreach ( struct hash_table ,
hash_foreach_func   
)

Definition at line 511 of file hash.c.

◆ hash_lookup()

int hash_lookup ( hashed_object_t **  ,
struct hash_table ,
const void *  ,
unsigned  ,
const char *  ,
int   
)

Definition at line 474 of file hash.c.

◆ hash_report()

unsigned char* hash_report ( struct hash_table )

Definition at line 344 of file hash.c.

◆ new_hash()

int new_hash ( struct hash_table **  ,
hash_reference  ,
hash_dereference  ,
unsigned  ,
unsigned(*)(const void *, unsigned, unsigned)  do_hash,
const char *  ,
int   
)

Definition at line 212 of file hash.c.

◆ new_hash_bucket()

struct hash_bucket* new_hash_bucket ( const char *  ,
int   
)

◆ new_hash_table()

int new_hash_table ( struct hash_table **  ,
unsigned  ,
const char *  ,
int   
)

Definition at line 55 of file hash.c.

◆ relinquish_hash_bucket_hunks()

void relinquish_hash_bucket_hunks ( void  )