RTRlib
 All Data Structures Functions Typedefs Enumerations Enumerator Groups Pages
lpfst.h
1 /*
2  * This file is part of RTRlib.
3  *
4  * This file is subject to the terms and conditions of the MIT license.
5  * See the file LICENSE in the top level directory for more details.
6  *
7  * Website: http://rtrlib.realmv6.org/
8 */
9 
10 #ifndef RTR_LPFST
11 #define RTR_LPFST
12 #include <inttypes.h>
13 #include "rtrlib/lib/ip.h"
14 
24 struct lpfst_node {
25  struct lrtr_ip_addr prefix;
26  uint8_t len;
27  struct lpfst_node *rchild;
28  struct lpfst_node *lchild;
29  struct lpfst_node *parent;
30  void *data;
31 };
32 
39 void lpfst_insert(struct lpfst_node *root, struct lpfst_node *new_node, const unsigned int level);
40 
50 struct lpfst_node *lpfst_lookup(const struct lpfst_node *root_node, const struct lrtr_ip_addr *prefix, const uint8_t mask_len, unsigned int *level);
51 
63 struct lpfst_node *lpfst_lookup_exact(struct lpfst_node *root_node, const struct lrtr_ip_addr *prefix, const uint8_t mask_len, unsigned int *level, bool *found);
64 
74 struct lpfst_node *lpfst_remove(struct lpfst_node *root_node, const struct lrtr_ip_addr *prefix, const uint8_t mask_len, const unsigned int level);
75 
82 int lpfst_is_leaf(const struct lpfst_node *node);
83 
84 int lpfst_get_children(const struct lpfst_node *root_node, struct lpfst_node ***array, unsigned int *len);
85 #endif
lpfst_node
Definition: lpfst.h:24
The lrtr_ip_addr struct stores a IPv4 or IPv6 address in host byte order.
Definition: ip.h:32