RTRlib
 All Data Structures Functions Typedefs Enumerations Enumerator Groups Pages
lpfst.h
1 /*
2  * This file is part of RTRlib.
3  *
4  * RTRlib is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or (at your
7  * option) any later version.
8  *
9  * RTRlib is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12  * License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with RTRlib; see the file COPYING.LESSER.
16  *
17  * INET group, Hamburg University of Applied Sciences,
18  * CST group, Freie Universitaet Berlin
19  * Website: http://rpki.realmv6.org/
20  */
21 
22 #ifndef RTR_LPFST
23 #define RTR_LPFST
24 #include <inttypes.h>
25 #include "rtrlib/lib/ip.h"
26 
36 struct lpfst_node {
37  struct ip_addr prefix;
38  uint8_t len;
39  struct lpfst_node *rchild;
40  struct lpfst_node *lchild;
41  struct lpfst_node *parent;
42  void *data;
43 };
44 
51 void lpfst_insert(struct lpfst_node *root, struct lpfst_node *new_node, const unsigned int level);
52 
62 struct lpfst_node *lpfst_lookup(const struct lpfst_node *root_node, const struct ip_addr *prefix, const uint8_t mask_len, unsigned int *level);
63 
75 struct lpfst_node *lpfst_lookup_exact(struct lpfst_node *root_node, const struct ip_addr *prefix, const uint8_t mask_len, unsigned int *level, bool *found);
76 
86 struct lpfst_node *lpfst_remove(struct lpfst_node *root_node, const struct ip_addr *prefix, const uint8_t mask_len, const unsigned int level);
87 
94 int lpfst_is_leaf(const struct lpfst_node *node);
95 
96 int lpfst_get_children(const struct lpfst_node *root_node, struct lpfst_node ***array, unsigned int *len);
97 #endif
The ip_addr struct stores a IPv4 or IPv6 address in host byte order.
Definition: ip.h:44
lpfst_node
Definition: lpfst.h:36