hash / rb / patricia trees
More...
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/htrie.h>
#include <freeradius-devel/util/table.h>
Go to the source code of this file.
|
#define | FUNC(_prefix, _op) ._op = (fr_htrie_ ##_op ## _t) fr_##_prefix##_## _op |
|
hash / rb / patricia trees
- Copyright
- 2021 Network RADIUS SAS (legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com)
Definition in file htrie.c.
◆ FUNC
#define FUNC |
( |
|
_prefix, |
|
|
|
_op |
|
) |
| ._op = (fr_htrie_ ##_op ## _t) fr_##_prefix##_## _op |
◆ fr_htrie_alloc()
An abstraction over our internal hashes, rb trees, and prefix tries.
This is useful where the data type being inserted into the tree is user controlled, and so we need to pick the most efficient structure for a given data type dynamically at runtime.
- Parameters
-
[in] | ctx | to bind the htrie's lifetime to. |
[in] | type | One of:
- FR_HTRIE_HASH
- FR_HTRIE_RB
- FR_HTRIE_TRIE
|
[in] | hash_data | Used by FR_HTRIE_HASH to convert the data into a 32bit integer used for binning. |
[in] | cmp_data | Used to determine exact matched. |
[in] | get_key | Used by the prefix trie to extract a key from the data. |
[in] | free_data | The callback used to free the data if it is deleted or replaced. May be NULL in which case data will not be freed for these operations. |
- Returns
- A new htrie on success.
- NULL on failure, either missing functions or a memory allocation error.
Definition at line 92 of file htrie.c.
◆ default_funcs
Initial value:= {
FUNC(hash_table, insert),
FUNC(hash_table, replace),
FUNC(hash_table, remove),
FUNC(hash_table,
delete),
},
},
}
}
static fr_ring_buffer_t * rb
void * fr_hash_table_find(fr_hash_table_t *ht, void const *data)
#define FUNC(_prefix, _op)
@ 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.
void *(* fr_htrie_find_t)(void *ht, void const *data)
void * fr_rb_find(fr_rb_tree_t const *tree, void const *data)
void * fr_trie_match(fr_trie_t *ft, void const *data)
Definition at line 39 of file htrie.c.
◆ fr_htrie_type_table
Initial value:= {
}
#define L(_str)
Helper for initialising arrays of string literals.
@ FR_HTRIE_AUTO
Automatically choose the best type.
Definition at line 31 of file htrie.c.
◆ fr_htrie_type_table_len