RTRlib
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
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 
17 #ifndef RTR_PFX_H
18 #define RTR_PFX_H
19 
20 #include <inttypes.h>
21 
22 #include "rtrlib/lib/ip.h"
23 
24 
25 
26 
30 enum pfx_rtvals {
33 
35  PFX_ERROR = -1,
36 
39 
42 };
43 
44 struct pfx_table;
45 
49 enum pfxv_state {
52 
55 
58 };
59 
60 
69 struct pfx_record {
70  uint32_t asn;
71  struct lrtr_ip_addr prefix;
72  uint8_t min_len;
73  uint8_t max_len;
74  const struct rtr_socket *socket;
75 };
76 
83 typedef void (*pfx_update_fp)(struct pfx_table *pfx_table, const struct pfx_record record, const bool added);
84 
91 typedef void (*pfx_for_each_fp)(const struct pfx_record *pfx_record, void *data);
92 
93 
106 int pfx_table_validate_r(struct pfx_table *pfx_table, struct pfx_record **reason, unsigned int *reason_len, const uint32_t asn, const struct lrtr_ip_addr *prefix, const uint8_t mask_len, enum pfxv_state *result);
107 
116 void pfx_table_for_each_ipv4_record(struct pfx_table *pfx_table, pfx_for_each_fp fp, void *data);
117 
126 void pfx_table_for_each_ipv6_record(struct pfx_table *pfx_table, pfx_for_each_fp fp, void *data);
127 
128 #endif
129 /* @} */
One or more records that match the input prefix exists in the pfx_table but the prefix max_len or ASN...
Definition: pfx.h:57
void pfx_table_for_each_ipv4_record(struct pfx_table *pfx_table, pfx_for_each_fp fp, void *data)
Iterates over all IPv4 records in the pfx_table.
Definition: pfx.h:51
pfx_rtvals
Possible return values for pfx_ functions.
Definition: pfx.h:30
Definition: pfx.h:35
void(* pfx_for_each_fp)(const struct pfx_record *pfx_record, void *data)
A function pointer that is called for each record in the pfx_table.
Definition: pfx.h:91
Definition: pfx.h:32
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: pfx.h:83
Definition: pfx.h:41
Definition: pfx.h:38
pfxv_state
Validation states returned from pfx_validate_origin.
Definition: pfx.h:49
int pfx_table_validate_r(struct pfx_table *pfx_table, struct pfx_record **reason, unsigned int *reason_len, const uint32_t asn, const struct lrtr_ip_addr *prefix, const uint8_t mask_len, enum pfxv_state *result)
Validates the origin of a BGP-Route and returns a list of pfx_record that decided the result...
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:109
void pfx_table_for_each_ipv6_record(struct pfx_table *pfx_table, pfx_for_each_fp fp, void *data)
Iterates over all IPv6 records in the pfx_table.
pfx_record.
Definition: pfx.h:69
No certificate for the route exists.
Definition: pfx.h:54