24 RCSIDH(htrie_h,
"$Id: f0d3df737d3f196cb1eb6f175f34401d6f7ba9cc $")
30 #include <freeradius-devel/util/hash.h>
31 #include <freeradius-devel/util/rb.h>
32 #include <freeradius-devel/util/trie.h>
33 #include <freeradius-devel/util/types.h>
37 typedef void *(*fr_htrie_find_t)(
void *ht,
void const *
data);
43 typedef void *(*fr_htrie_remove_t)(
void *ht,
void const *
data);
122 return ht->funcs.replace(old, ht->store,
data);
uint32_t(* fr_hash_t)(void const *)
@ FR_HTRIE_RB
Data is stored in a rb tree.
@ FR_HTRIE_TRIE
Data is stored in a prefix trie.
@ FR_HTRIE_HASH
Data is stored in a hash.
@ FR_HTRIE_AUTO
Automatically choose the best type.
void *(* fr_htrie_remove_t)(void *ht, void const *data)
bool(* fr_htrie_insert_t)(void *ht, void const *data)
static fr_htrie_type_t fr_htrie_hint(fr_type_t type)
bool(* fr_htrie_delete_t)(void *ht, void const *data)
static void * fr_htrie_match(fr_htrie_t *ht, void const *data)
Match data in a htrie.
fr_htrie_find_t find
Absolute or prefix match.
static bool fr_htrie_insert(fr_htrie_t *ht, void const *data)
Insert data into a htrie.
void *(* fr_htrie_find_t)(void *ht, void const *data)
static int fr_htrie_num_elements(fr_htrie_t *ht)
Return the number of elements in the htrie.
void * store
What we're using to store node data.
fr_htrie_replace_t replace
Replace an existing item in store.
static bool fr_htrie_delete(fr_htrie_t *ht, void const *data)
Delete data from a htrie, freeing it if free_data cb was passed to fr_htrie_alloc.
fr_htrie_type_t type
type of the htrie
static int fr_htrie_replace(void **old, fr_htrie_t *ht, void const *data)
Replace data in a htrie, freeing previous data if free_data cb was passed to fr_htrie_alloc.
size_t fr_htrie_type_table_len
fr_htrie_t * fr_htrie_alloc(TALLOC_CTX *ctx, fr_htrie_type_t type, fr_hash_t hash_data, fr_cmp_t cmp_data, fr_trie_key_t get_key, fr_free_t free_data)
An abstraction over our internal hashes, rb trees, and prefix tries.
fr_table_num_sorted_t const fr_htrie_type_table[]
fr_htrie_delete_t delete
Remove (and possibly free) and item from the store.
static void * fr_htrie_remove(fr_htrie_t *ht, void const *data)
Remove data from a htrie without freeing it.
int(* fr_htrie_replace_t)(void **old, void *ht, void const *data)
static void * fr_htrie_find(fr_htrie_t *ht, void const *data)
Find data in a htrie.
fr_htrie_find_t match
exact prefix match
uint32_t(* fr_htrie_num_elements_t)(void *ht)
fr_htrie_funcs_t funcs
Function pointers for the various operations.
fr_htrie_remove_t remove
Remove an item from the store.
fr_htrie_num_elements_t num_elements
Number of elements currently in the store.
static char const * fr_htrie_type_to_str(fr_htrie_type_t type)
Return a static string containing the type name.
fr_htrie_insert_t insert
Insert a new item into the store.
Which functions are used for the different operations.
A hash/rb/prefix trie abstraction.
@ FR_TYPE_FLOAT32
Single precision floating point.
@ FR_TYPE_ETHERNET
48 Bit Mac-Address.
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_MAX
Number of defined data types.
@ FR_TYPE_NULL
Invalid (uninitialised) attribute type.
@ FR_TYPE_VALUE_BOX
A boxed value.
@ FR_TYPE_IFID
Interface ID.
@ FR_TYPE_OCTETS
Raw octets.
@ FR_TYPE_FLOAT64
Double precision floating point.
int8_t(* fr_cmp_t)(void const *a, void const *b)
void(* fr_free_t)(void *)
fr_aka_sim_id_type_t type
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
An element in a lexicographically sorted array of name to num mappings.
int(* fr_trie_key_t)(uint8_t **out, size_t *outlen, void const *data)
#define FR_TYPE_STRUCTURAL