RTRlib
|
The pfx_table is an abstract data structure to organize the validated prefix origin data received from an RPKI-RTR cache server. More...
Modules | |
Trie | |
An implementation of a pfx_table data structure using a shortest prefix first tree (trie) for storing pfx_records. | |
Typedefs | |
typedef 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. | |
Enumerations | |
enum | pfx_rtvals { PFX_SUCCESS = 0 , PFX_ERROR = -1 , PFX_DUPLICATE_RECORD = -2 , PFX_RECORD_NOT_FOUND = -3 } |
Possible return values for pfx_ functions. More... | |
enum | pfxv_state { BGP_PFXV_STATE_VALID , BGP_PFXV_STATE_NOT_FOUND , BGP_PFXV_STATE_INVALID } |
Validation states returned from pfx_validate_origin. More... | |
Functions | |
void | pfx_table_init (struct pfx_table *pfx_table, pfx_update_fp update_fp) |
Initializes the pfx_table struct. | |
void | pfx_table_free (struct pfx_table *pfx_table) |
Frees all memory associated with the pfx_table. | |
int | pfx_table_add (struct pfx_table *pfx_table, const struct pfx_record *pfx_record) |
Adds a pfx_record to a pfx_table. | |
int | pfx_table_remove (struct pfx_table *pfx_table, const struct pfx_record *pfx_record) |
Removes a pfx_record from a pfx_table. | |
int | pfx_table_src_remove (struct pfx_table *pfx_table, const struct rtr_socket *socket) |
Removes all entries in the pfx_table that match the passed socket_id value from a pfx_table. | |
int | pfx_table_validate (struct pfx_table *pfx_table, 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. | |
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. | |
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. | |
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. | |
void | pfx_table_free_without_notify (struct pfx_table *pfx_table) |
Frees all memory associated with the pfx_table without calling the update callback. | |
void | pfx_table_swap (struct pfx_table *a, struct pfx_table *b) |
Swap root nodes of the argument tables. | |
int | pfx_table_copy_except_socket (struct pfx_table *src_table, struct pfx_table *dst_table, const struct rtr_socket *socket) |
Copy content of src_table into dst_table . | |
void | pfx_table_notify_diff (struct pfx_table *new_table, struct pfx_table *old_table, const struct rtr_socket *socket) |
Notify client about changes between to pfx tables regarding one specific socket. | |
The pfx_table is an abstract data structure to organize the validated prefix origin data received from an RPKI-RTR cache server.
typedef void(* pfx_for_each_fp) (const struct pfx_record *pfx_record, void *data) |
#include <rtrlib/pfx/pfx.h>
A function pointer that is called for each record in the pfx_table.
pfx_record | |
data | forwarded data which the user has passed to pfx_table_for_each_ipv4_record() or pfx_table_for_each_ipv6_record() |
enum pfx_rtvals |
#include <rtrlib/pfx/pfx.h>
Possible return values for pfx_ functions.
Enumerator | |
---|---|
PFX_SUCCESS | Operation was successful. |
PFX_ERROR | Error occurred. |
PFX_DUPLICATE_RECORD | The supplied pfx_record already exists in the pfx_table. |
PFX_RECORD_NOT_FOUND | pfx_record wasn't found in the pfx_table. |
enum pfxv_state |
#include <rtrlib/pfx/pfx.h>
Validation states returned from pfx_validate_origin.
Enumerator | |
---|---|
BGP_PFXV_STATE_VALID | A valid certificate for the pfx_record exists. |
BGP_PFXV_STATE_NOT_FOUND | No certificate for the route exists. |
BGP_PFXV_STATE_INVALID | One or more records that match the input prefix exists in the pfx_table but the prefix max_len or ASN doesn't match. |
int pfx_table_add | ( | struct pfx_table * | pfx_table, |
const struct pfx_record * | pfx_record | ||
) |
#include <rtrlib/pfx/pfx.h>
Adds a pfx_record to a pfx_table.
[in] | pfx_table | pfx_table to use. |
[in] | pfx_record | pfx_record that will be added. |
int pfx_table_copy_except_socket | ( | struct pfx_table * | src_table, |
struct pfx_table * | dst_table, | ||
const struct rtr_socket * | socket | ||
) |
#include <rtrlib/pfx/pfx_private.h>
Copy content of src_table
into dst_table
.
dst must be empty and initialized
[in] | src_table | Source table |
[out] | dst_table | Destination table |
[in] | socket | socket which prefixes should not be copied |
void pfx_table_for_each_ipv4_record | ( | struct pfx_table * | pfx_table, |
pfx_for_each_fp | fp, | ||
void * | data | ||
) |
#include <rtrlib/pfx/pfx.h>
Iterates over all IPv4 records in the pfx_table.
For every pfx_record the function fp is called. The pfx_record and the data pointer is passed to the fp.
[in] | pfx_table | |
[in] | fp | A pointer to a callback function with the signature pfx_for_each_fp . |
[in] | data | This parameter is forwarded to the callback function. |
void pfx_table_for_each_ipv6_record | ( | struct pfx_table * | pfx_table, |
pfx_for_each_fp | fp, | ||
void * | data | ||
) |
#include <rtrlib/pfx/pfx.h>
Iterates over all IPv6 records in the pfx_table.
For every pfx_record the function fp is called. The pfx_record and the data pointer is passed to the fp.
[in] | pfx_table | |
[in] | fp | A pointer to a callback function with the signature pfx_for_each_fp . |
[in] | data | This parameter is forwarded to the callback function. |
void pfx_table_free | ( | struct pfx_table * | pfx_table | ) |
#include <rtrlib/pfx/pfx.h>
Frees all memory associated with the pfx_table.
void pfx_table_free_without_notify | ( | struct pfx_table * | pfx_table | ) |
#include <rtrlib/pfx/pfx_private.h>
Frees all memory associated with the pfx_table without calling the update callback.
void pfx_table_init | ( | struct pfx_table * | pfx_table, |
pfx_update_fp | update_fp | ||
) |
#include <rtrlib/pfx/pfx.h>
Initializes the pfx_table struct.
void pfx_table_notify_diff | ( | struct pfx_table * | new_table, |
struct pfx_table * | old_table, | ||
const struct rtr_socket * | socket | ||
) |
#include <rtrlib/pfx/pfx_private.h>
Notify client about changes between to pfx tables regarding one specific socket.
old_table will be modified it should be freed after calling this function
[in] | new_table | |
[in] | old_table | |
[in] | socket | socket which prefixes should be diffed |
int pfx_table_remove | ( | struct pfx_table * | pfx_table, |
const struct pfx_record * | pfx_record | ||
) |
#include <rtrlib/pfx/pfx.h>
Removes a pfx_record from a pfx_table.
[in] | pfx_table | pfx_table to use. |
[in] | pfx_record | Record that will be removed. |
int pfx_table_src_remove | ( | struct pfx_table * | pfx_table, |
const struct rtr_socket * | socket | ||
) |
#include <rtrlib/pfx/pfx.h>
Removes all entries in the pfx_table that match the passed socket_id value from a pfx_table.
#include <rtrlib/pfx/pfx_private.h>
Swap root nodes of the argument tables.
[in,out] | a | First table |
[in,out] | b | second table |
int pfx_table_validate | ( | struct pfx_table * | pfx_table, |
const uint32_t | asn, | ||
const struct lrtr_ip_addr * | prefix, | ||
const uint8_t | mask_len, | ||
enum pfxv_state * | result | ||
) |
#include <rtrlib/pfx/pfx.h>
Validates the origin of a BGP-Route.
[in] | pfx_table | pfx_table to use. |
[in] | asn | Autonomous system number of the Origin-AS of the route. |
[in] | prefix | Announced network Prefix. |
[in] | mask_len | Length of the network mask of the announced prefix. |
[out] | result | Result of the validation. |
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 | ||
) |
#include <rtrlib/pfx/pfx.h>
Validates the origin of a BGP-Route and returns a list of pfx_record that decided the result.
[in] | pfx_table | pfx_table to use. |
[out] | reason | Pointer to a memory area that will be used as array of pfx_records. The memory area will be overwritten. Reason must point to NULL or an allocated memory area. |
[out] | reason_len | Size of the array reason. |
[in] | asn | Autonomous system number of the Origin-AS of the route. |
[in] | prefix | Announced network Prefix |
[in] | mask_len | Length of the network mask of the announced prefix |
[out] | result | Result of the validation. |