All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
hash.c File Reference
#include <freeradius-devel/libradius.h>
+ Include dependency graph for hash.c:

Go to the source code of this file.

Data Structures

struct  fr_hash_entry_t
 
struct  fr_hash_table_t
 

Macros

#define FNV_MAGIC_INIT   (0x811c9dc5)
 
#define FNV_MAGIC_PRIME   (0x01000193)
 
#define FR_HASH_NUM_BUCKETS   (64)
 
#define GROW_FACTOR   (2)
 

Typedefs

typedef struct fr_hash_entry_t fr_hash_entry_t
 

Functions

static int _fr_hash_table_free (fr_hash_table_t *ht)
 
uint32_t fr_hash (void const *data, size_t size)
 
uint32_t fr_hash_string (char const *p)
 
fr_hash_table_tfr_hash_table_create (TALLOC_CTX *ctx, fr_hash_table_hash_t hashNode, fr_hash_table_cmp_t cmpNode, fr_hash_table_free_t freeNode)
 
int fr_hash_table_delete (fr_hash_table_t *ht, void const *data)
 
static fr_hash_entry_tfr_hash_table_find (fr_hash_table_t *ht, void const *data)
 
void * fr_hash_table_finddata (fr_hash_table_t *ht, void const *data)
 
static void fr_hash_table_fixup (fr_hash_table_t *ht, uint32_t entry)
 
void fr_hash_table_free (fr_hash_table_t *ht)
 
static void fr_hash_table_grow (fr_hash_table_t *ht)
 
int fr_hash_table_insert (fr_hash_table_t *ht, void const *data)
 
int fr_hash_table_num_elements (fr_hash_table_t *ht)
 
int fr_hash_table_replace (fr_hash_table_t *ht, void const *data)
 
int fr_hash_table_walk (fr_hash_table_t *ht, fr_hash_table_walk_t callback, void *context)
 
void * fr_hash_table_yank (fr_hash_table_t *ht, void const *data)
 
uint32_t fr_hash_update (void const *data, size_t size, uint32_t hash)
 
static int list_delete (fr_hash_table_t *ht, fr_hash_entry_t **head, fr_hash_entry_t *node)
 
static fr_hash_entry_tlist_find (fr_hash_table_t *ht, fr_hash_entry_t *head, uint32_t reversed, void const *data)
 
static int list_insert (fr_hash_table_t *ht, fr_hash_entry_t **head, fr_hash_entry_t *node)
 
static uint32_t parent_of (uint32_t key)
 
static uint32_t reverse (uint32_t key)
 

Variables

static uint8_t parent_byte [256]
 
static const uint8_t reversed_byte [256]
 

Data Structure Documentation

struct fr_hash_entry_t

Definition at line 43 of file hash.c.

+ Collaboration diagram for fr_hash_entry_t:
Data Fields
void const * data
uint32_t key
struct fr_hash_entry_t * next
uint32_t reversed
struct fr_hash_table_t

Definition at line 51 of file hash.c.

+ Collaboration diagram for fr_hash_table_t:
Data Fields
fr_hash_entry_t ** buckets
fr_hash_table_cmp_t cmp
fr_hash_table_free_t free
fr_hash_table_hash_t hash
int mask
int next_grow
fr_hash_entry_t null
int num_buckets
int num_elements

Macro Definition Documentation

#define FNV_MAGIC_INIT   (0x811c9dc5)

Definition at line 716 of file hash.c.

#define FNV_MAGIC_PRIME   (0x01000193)

Definition at line 717 of file hash.c.

#define FR_HASH_NUM_BUCKETS   (64)

Definition at line 41 of file hash.c.

#define GROW_FACTOR   (2)

Definition at line 376 of file hash.c.

Typedef Documentation

Function Documentation

static int _fr_hash_table_free ( fr_hash_table_t ht)
static

Definition at line 251 of file hash.c.

+ Here is the caller graph for this function:

uint32_t fr_hash ( void const *  data,
size_t  size 
)

Definition at line 727 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t fr_hash_string ( char const *  p)

Definition at line 778 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

fr_hash_table_t* fr_hash_table_create ( TALLOC_CTX *  ctx,
fr_hash_table_hash_t  hashNode,
fr_hash_table_cmp_t  cmpNode,
fr_hash_table_free_t  freeNode 
)

Definition at line 279 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int fr_hash_table_delete ( fr_hash_table_t ht,
void const *  data 
)

Definition at line 546 of file hash.c.

+ Here is the call graph for this function:

static fr_hash_entry_t* fr_hash_table_find ( fr_hash_table_t ht,
void const *  data 
)
static

Definition at line 452 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* fr_hash_table_finddata ( fr_hash_table_t ht,
void const *  data 
)

Definition at line 496 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void fr_hash_table_fixup ( fr_hash_table_t ht,
uint32_t  entry 
)
static

Definition at line 331 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fr_hash_table_free ( fr_hash_table_t ht)

Definition at line 562 of file hash.c.

+ Here is the caller graph for this function:

static void fr_hash_table_grow ( fr_hash_table_t ht)
static

Definition at line 381 of file hash.c.

+ Here is the caller graph for this function:

int fr_hash_table_insert ( fr_hash_table_t ht,
void const *  data 
)

Definition at line 405 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int fr_hash_table_num_elements ( fr_hash_table_t ht)

Definition at line 598 of file hash.c.

+ Here is the caller graph for this function:

int fr_hash_table_replace ( fr_hash_table_t ht,
void const *  data 
)

Definition at line 473 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int fr_hash_table_walk ( fr_hash_table_t ht,
fr_hash_table_walk_t  callback,
void *  context 
)

Definition at line 609 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* fr_hash_table_yank ( fr_hash_table_t ht,
void const *  data 
)

Definition at line 514 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t fr_hash_update ( void const *  data,
size_t  size,
uint32_t  hash 
)

Definition at line 761 of file hash.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int list_delete ( fr_hash_table_t ht,
fr_hash_entry_t **  head,
fr_hash_entry_t node 
)
static

Definition at line 234 of file hash.c.

+ Here is the caller graph for this function:

static fr_hash_entry_t* list_find ( fr_hash_table_t ht,
fr_hash_entry_t head,
uint32_t  reversed,
void const *  data 
)
static

Definition at line 177 of file hash.c.

+ Here is the caller graph for this function:

static int list_insert ( fr_hash_table_t ht,
fr_hash_entry_t **  head,
fr_hash_entry_t node 
)
static

Definition at line 203 of file hash.c.

+ Here is the caller graph for this function:

static uint32_t parent_of ( uint32_t  key)
static

Definition at line 162 of file hash.c.

+ Here is the caller graph for this function:

static uint32_t reverse ( uint32_t  key)
static

Definition at line 151 of file hash.c.

+ Here is the caller graph for this function:

Variable Documentation

uint8_t parent_byte[256]
static

Definition at line 112 of file hash.c.

const uint8_t reversed_byte[256]
static

Definition at line 73 of file hash.c.