RTRlib
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#include <pthread.h>
26#include <stdbool.h>
27#include <stdint.h>
28
29#include "rtrlib/lib/ip.h"
30
31struct pfx_table;
32
41struct pfx_record {
42 uint32_t asn;
43 struct lrtr_ip_addr prefix;
44 uint8_t min_len;
45 uint8_t max_len;
46 const struct rtr_socket *socket;
47};
48
55typedef void (*pfx_update_fp)(struct pfx_table *pfx_table, const struct pfx_record record, const bool added);
56
64struct pfx_table {
65 struct trie_node *ipv4;
66 struct trie_node *ipv6;
67 pfx_update_fp update_fp;
68 pthread_rwlock_t lock;
69};
70
71#endif
72/* @} */
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:55
The lrtr_ip_addr struct stores a IPv4 or IPv6 address in host byte order.
Definition: ip.h:38
pfx_record.
Definition: trie-pfx.h:41
pfx_table.
Definition: trie-pfx.h:64
A RTR socket.
Definition: rtr.h:109