![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Path-compressed prefix tries. More...
#include <freeradius-devel/build.h>#include <freeradius-devel/missing.h>#include <freeradius-devel/util/talloc.h>#include <stdbool.h>#include <stdint.h>#include <stdio.h>
Include dependency graph for trie.h:Go to the source code of this file.
Typedefs | |
| typedef int(* | fr_trie_key_t) (uint8_t **out, size_t *outlen, void const *data) |
| typedef struct fr_trie_s | fr_trie_t |
| typedef int(* | fr_trie_walk_t) (uint8_t const *key, size_t keylen, void *data, void *uctx) |
| Walk over a trie. | |
Functions | |
| fr_trie_t * | fr_trie_alloc (TALLOC_CTX *ctx, fr_trie_key_t get_key, fr_free_t free_node) |
| Allocate a trie. | |
| bool | fr_trie_delete (fr_trie_t *ft, void const *data) |
| Remove node and free data (if a free function was specified) | |
| void * | fr_trie_find (fr_trie_t *ft, void const *data) |
| Find an element in the trie, returning the data. | |
| bool | fr_trie_insert (fr_trie_t *ft, void const *data) |
| Insert data into a trie. | |
| int | fr_trie_insert_by_key (fr_trie_t *ft, void const *key, size_t keylen, void const *data) |
| Insert a key and user ctx into a trie. | |
| void * | fr_trie_lookup_by_key (fr_trie_t const *ft, void const *key, size_t keylen) |
| Lookup a key in a trie and return user ctx, if any. | |
| void * | fr_trie_match (fr_trie_t *ft, void const *data) |
| Match an element exactly in the trie, returning the data. | |
| void * | fr_trie_match_by_key (fr_trie_t const *ft, void const *key, size_t keylen) |
| Match a key and length in a trie and return user ctx, if any. | |
| unsigned int | fr_trie_num_elements (fr_trie_t *ft) |
| void * | fr_trie_remove (fr_trie_t *ft, void const *data) |
| Remove an entry, without freeing the data. | |
| void * | fr_trie_remove_by_key (fr_trie_t *ft, void const *key, size_t keylen) |
| Remove a key and return the associated user ctx. | |
| int | fr_trie_replace (void **old, fr_trie_t *ft, void const *data)) |
| Replace old data with new data, OR insert if there is no old. | |
| int | fr_trie_walk (fr_trie_t *ft, void *ctx, fr_trie_walk_t callback)) |
Path-compressed prefix tries.
Definition in file trie.h.
| fr_trie_t * fr_trie_alloc | ( | TALLOC_CTX * | ctx, |
| fr_trie_key_t | get_key, | ||
| fr_free_t | free_data | ||
| ) |
Allocate a trie.
| ctx | The talloc ctx. |
| get_key | The "get key from object" function. |
| free_data | Callback to free data. |
Definition at line 741 of file trie.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void * fr_trie_find | ( | fr_trie_t * | ft, |
| void const * | data | ||
| ) |
Insert a key and user ctx into a trie.
| ft | the trie |
| key | the key |
| keylen | key length in bits |
| data | user ctx information to associated with the key |
Definition at line 1875 of file trie.c.
Here is the call graph for this function:
Here is the caller graph for this function:Lookup a key in a trie and return user ctx, if any.
The key may be LONGER than entries in the trie. In which case the closest match is returned.
| ft | the trie |
| key | the key bytes |
| keylen | length in bits of the key |
Definition at line 1262 of file trie.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void * fr_trie_match | ( | fr_trie_t * | ft, |
| void const * | data | ||
| ) |
Match a key and length in a trie and return user ctx, if any.
Only the exact match is returned.
| ft | the trie |
| key | the key bytes |
| keylen | length in bits of the key |
Definition at line 1286 of file trie.c.
Here is the call graph for this function:
Here is the caller graph for this function:| unsigned int fr_trie_num_elements | ( | fr_trie_t * | ft | ) |
| void * fr_trie_remove | ( | fr_trie_t * | ft, |
| void const * | data | ||
| ) |
Remove a key and return the associated user ctx.
The key must match EXACTLY. This is not a prefix match.
| ft | the trie |
| key | the key |
| keylen | key length in bits |
Definition at line 2154 of file trie.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int fr_trie_replace | ( | void ** | old, |
| fr_trie_t * | ft, | ||
| void const * | data | ||
| ) |
Replace old data with new data, OR insert if there is no old.
| [out] | old | data that was replaced. If this argument is not NULL, then the old data will not be freed, even if a free function is configured. |
| [in] | ft | to insert data into. |
| [in] | data | to replace. |
Definition at line 2727 of file trie.c.
Here is the call graph for this function:| int fr_trie_walk | ( | fr_trie_t * | ft, |
| void * | ctx, | ||
| fr_trie_walk_t | callback | ||
| ) |
1.9.8