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>
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. More... | |
Functions | |
fr_trie_t * | fr_trie_alloc (TALLOC_CTX *ctx, fr_trie_key_t get_key, fr_free_t free_node) |
Allocate a trie. More... | |
bool | fr_trie_delete (fr_trie_t *ft, void const *data) |
void * | fr_trie_find (fr_trie_t *ft, void const *data) |
bool | fr_trie_insert (fr_trie_t *ft, void const *data) |
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. More... | |
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. More... | |
void * | fr_trie_match (fr_trie_t *ft, void const *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. More... | |
unsigned int | fr_trie_num_elements (fr_trie_t *ft) |
void * | fr_trie_remove (fr_trie_t *ft, void const *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. More... | |
int | fr_trie_replace (void **old, fr_trie_t *ft, void const *data)) |
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.
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.
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.
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.
unsigned int fr_trie_num_elements | ( | fr_trie_t * | ft | ) |
void* fr_trie_remove | ( | fr_trie_t * | ft, |
void const * | data | ||
) |
int fr_trie_replace | ( | void ** | old, |
fr_trie_t * | ft, | ||
void const * | data | ||
) |
int fr_trie_walk | ( | fr_trie_t * | ft, |
void * | ctx, | ||
fr_trie_walk_t | callback | ||
) |