10#ifndef RTR_TRIE_PRIVATE
11#define RTR_TRIE_PRIVATE
18#define PFX_DBG1(a) lrtr_dbg("PFX: " a)
61 const uint8_t mask_len,
unsigned int *level);
78 const uint8_t mask_len,
unsigned int *level,
bool *found);
90 const unsigned int level);
uint32_t len
Definition rtr_pdus.h:4
The lrtr_ip_addr struct stores a IPv4 or IPv6 address in host byte order.
Definition ip.h:38
trie_node
Definition trie_private.h:29
uint8_t len
Definition trie_private.h:35
void * data
Definition trie_private.h:34
struct trie_node * parent
Definition trie_private.h:33
struct trie_node * lchild
Definition trie_private.h:32
struct trie_node * rchild
Definition trie_private.h:31
struct lrtr_ip_addr prefix
Definition trie_private.h:30
void trie_insert(struct trie_node *root, struct trie_node *new_node, const unsigned int level)
Inserts new_node in the tree.
int trie_get_children(const struct trie_node *root_node, struct trie_node ***array, unsigned int *len)
struct trie_node * trie_lookup(const struct trie_node *root_node, const struct lrtr_ip_addr *prefix, const uint8_t mask_len, unsigned int *level)
Searches for a matching node matching the passed ip prefix and prefix length.
bool trie_is_leaf(const struct trie_node *node)
Detects if a node is a leaf in the tree.
struct trie_node * trie_lookup_exact(struct trie_node *root_node, const struct lrtr_ip_addr *prefix, const uint8_t mask_len, unsigned int *level, bool *found)
Search for a node with the same prefix and prefix length.
struct trie_node * trie_remove(struct trie_node *root_node, const struct lrtr_ip_addr *prefix, const uint8_t mask_len, const unsigned int level)
Removes the node with the passed IP prefix and mask_len from the tree.