The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Structures and prototypes for resizable hash tables. More...
#include <freeradius-devel/util/misc.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | fr_hash_iter_s |
Stores the state of the current iteration operation. More... | |
Macros | |
#define | fr_hash_table_alloc(_ctx, _hash_node, _cmp_node, _free_node) _fr_hash_table_alloc(_ctx, NULL, _hash_node, _cmp_node, _free_node) |
#define | fr_hash_table_talloc_alloc(_ctx, _type, _hash_node, _cmp_node, _free_node) _fr_hash_table_alloc(_ctx, #_type, _hash_node, _cmp_node, _free_node) |
Typedefs | |
typedef struct fr_hash_entry_s | fr_hash_entry_t |
typedef struct fr_hash_iter_s | fr_hash_iter_t |
Stores the state of the current iteration operation. More... | |
typedef uint32_t(* | fr_hash_t) (void const *) |
typedef struct fr_hash_table_s | fr_hash_table_t |
typedef int(* | fr_hash_table_walk_t) (void *data, void *uctx) |
Structures and prototypes for resizable hash tables.
Definition in file hash.h.
struct fr_hash_iter_s |
#define fr_hash_table_alloc | ( | _ctx, | |
_hash_node, | |||
_cmp_node, | |||
_free_node | |||
) | _fr_hash_table_alloc(_ctx, NULL, _hash_node, _cmp_node, _free_node) |
#define fr_hash_table_talloc_alloc | ( | _ctx, | |
_type, | |||
_hash_node, | |||
_cmp_node, | |||
_free_node | |||
) | _fr_hash_table_alloc(_ctx, #_type, _hash_node, _cmp_node, _free_node) |
typedef struct fr_hash_entry_s fr_hash_entry_t |
typedef struct fr_hash_iter_s fr_hash_iter_t |
Stores the state of the current iteration operation.
typedef struct fr_hash_table_s fr_hash_table_t |
fr_hash_table_t* _fr_hash_table_alloc | ( | TALLOC_CTX * | ctx, |
char const * | type, | ||
fr_hash_t | hash_node, | ||
fr_cmp_t | cmp_node, | ||
fr_free_t | free_node | ||
) |
uint32_t fr_hash_case_string | ( | char const * | p | ) |
uint32_t fr_hash_string | ( | char const * | p | ) |
bool fr_hash_table_delete | ( | fr_hash_table_t * | ht, |
void const * | data | ||
) |
void fr_hash_table_fill | ( | fr_hash_table_t * | ht | ) |
Ensure all buckets are filled.
This must be called if the table will be read by multiple threads without synchronisation. Synchronisation is still required for updates.
[in] | ht | to fill. |
Definition at line 719 of file hash.c.
void* fr_hash_table_find | ( | fr_hash_table_t * | ht, |
void const * | data | ||
) |
void* fr_hash_table_find_by_key | ( | fr_hash_table_t * | ht, |
uint32_t | key, | ||
void const * | data | ||
) |
int fr_hash_table_flatten | ( | TALLOC_CTX * | ctx, |
void ** | out[], | ||
fr_hash_table_t * | ht | ||
) |
Copy all entries out of a hash table into an array.
[in] | ctx | to allocate array in. |
[in] | out | array of hash table entries. |
[in] | ht | to flatter. |
Definition at line 695 of file hash.c.
bool fr_hash_table_insert | ( | fr_hash_table_t * | ht, |
void const * | data | ||
) |
void* fr_hash_table_iter_init | ( | fr_hash_table_t * | ht, |
fr_hash_iter_t * | iter | ||
) |
Initialise an iterator.
[in] | ht | to iterate over. |
[out] | iter | to initialise. |
Definition at line 678 of file hash.c.
void* fr_hash_table_iter_next | ( | fr_hash_table_t * | ht, |
fr_hash_iter_t * | iter | ||
) |
Iterate over entries in a hash table.
[in] | ht | to iterate over. |
[in] | iter | Pointer to an iterator struct, used to maintain state between calls. |
Definition at line 626 of file hash.c.
uint32_t fr_hash_table_num_elements | ( | fr_hash_table_t * | ht | ) |
void* fr_hash_table_remove | ( | fr_hash_table_t * | ht, |
void const * | data | ||
) |
int fr_hash_table_replace | ( | void ** | old, |
fr_hash_table_t * | ht, | ||
void const * | data | ||
) |
void fr_hash_table_verify | ( | fr_hash_table_t * | ht | ) |