RTRlib
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
trie-pfx.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 
23 #ifndef RTR_TRIE_PFX
24 #define RTR_TRIE_PFX
25 
26 #include "rtrlib/lib/ip.h"
27 
28 #include <pthread.h>
29 #include <stdbool.h>
30 #include <stdint.h>
31 
32 struct pfx_table;
33 
42 struct pfx_record {
43  uint32_t asn;
44  struct lrtr_ip_addr prefix;
45  uint8_t min_len;
46  uint8_t max_len;
47  const struct rtr_socket *socket;
48 };
49 
56 typedef void (*pfx_update_fp)(struct pfx_table *pfx_table, const struct pfx_record record, const bool added);
57 
65 struct pfx_table {
66  struct trie_node *ipv4;
67  struct trie_node *ipv6;
68  pfx_update_fp update_fp;
69  pthread_rwlock_t lock;
70 };
71 
72 #endif
73 
void(* pfx_update_fp)(struct pfx_table *pfx_table, const struct pfx_record record, const bool added)
A function pointer that is called if an record was added to the pfx_table or was removed from the pfx...
Definition: trie-pfx.h:56
pfx_table.
Definition: trie-pfx.h:65
The lrtr_ip_addr struct stores a IPv4 or IPv6 address in host byte order.
Definition: ip.h:38
A RTR socket.
Definition: rtr.h:116
pfx_record.
Definition: trie-pfx.h:42