38#include "rtrlib/pfx/pfx.h"
39#include "rtrlib/spki/spkitable.h"
40#ifdef RTRLIB_BGPSEC_ENABLED
41#include "rtrlib/bgpsec/bgpsec.h"
73 unsigned int sockets_len;
80struct tommy_list_wrapper;
83struct rtr_mgr_config {
84 struct tommy_list_wrapper *groups;
86 pthread_rwlock_t mutex;
87 rtr_mgr_status_fp status_fp;
90 struct spki_table *spki_table;
132 const unsigned int refresh_interval,
const unsigned int expire_interval,
134 const rtr_mgr_status_fp status_fp,
void *status_fp_data);
213 const uint8_t mask_len,
enum pfxv_state *result);
226 unsigned int *result_count);
263int rtr_mgr_for_each_group(
struct rtr_mgr_config *config,
void (*fp)(
const struct rtr_mgr_group *group,
void *data),
273#ifdef RTRLIB_BGPSEC_ENABLED
417void rtr_mgr_bgpsec_add_spki_record(
struct rtr_mgr_config *config,
struct spki_record *record);
int rtr_mgr_bgpsec_generate_signature(const struct rtr_bgpsec *data, uint8_t *private_key, struct rtr_signature_seg **new_signature)
Signing function for a BGPsec_PATH.
struct rtr_bgpsec * rtr_mgr_bgpsec_new(uint8_t alg, uint8_t safi, uint16_t afi, uint32_t my_as, uint32_t target_as, struct rtr_bgpsec_nlri *nlri)
Initializes and returns a pointer to a rtr_bgpsec struct.
int rtr_mgr_bgpsec_prepend_sig_seg(struct rtr_bgpsec *bgpsec, struct rtr_signature_seg *new_seg)
Prepend a given Signature Segment to rtr_bgpsec::sigs. All fields of the new_seg must be filled.
int rtr_mgr_bgpsec_has_algorithm_suite(uint8_t alg_suite)
Check, if an algorithm suite is supported by RTRlib.
void rtr_mgr_bgpsec_free(struct rtr_bgpsec *bgpsec)
Free a rtr_bgpsec struct and any Secure Path and Signature Segments it holds.
int rtr_mgr_bgpsec_get_algorithm_suites(const uint8_t **algs_arr)
Returns pointer to a list that holds all supported algorithm suites.
int rtr_mgr_bgpsec_get_version(void)
Returns the highest supported BGPsec version.
void rtr_mgr_free_secure_path(struct rtr_secure_path_seg *seg)
Free a Secure Path Segment and any segments that are pointed to by rtr_secure_path_seg::next.
struct rtr_signature_seg * rtr_mgr_bgpsec_pop_signature_seg(struct rtr_bgpsec *bgpsec)
Retrieve a pointer to the last appended Signature Segment from a bgpsec struct.
struct rtr_secure_path_seg * rtr_mgr_bgpsec_pop_secure_path_seg(struct rtr_bgpsec *bgpsec)
Retrieve a pointer to the last appended Secure Path Segment from a bgpsec struct.
void rtr_mgr_bgpsec_prepend_sec_path_seg(struct rtr_bgpsec *bgpsec, struct rtr_secure_path_seg *new_seg)
Prepend a given Secure Path Segment to rtr_bgpsec::path.
struct rtr_signature_seg * rtr_mgr_bgpsec_new_signature_seg(uint8_t *ski, uint16_t sig_len, uint8_t *signature)
Return an allocated and initialized Signature.
struct rtr_secure_path_seg * rtr_mgr_bgpsec_new_secure_path_seg(uint8_t pcount, uint8_t flags, uint32_t asn)
Return an allocated and initialized Secure Path Segment.
uint8_t * signature
Definition bgpsec.h:93
int rtr_mgr_bgpsec_validate_as_path(const struct rtr_bgpsec *data, struct rtr_mgr_config *config)
Validation function for AS path validation.
void rtr_mgr_bgpsec_free_signatures(struct rtr_signature_seg *seg)
Free a signature and any signatures that are pointed to.
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:65
pfxv_state
Validation states returned from pfx_validate_origin.
Definition pfx.h:46
void rtr_mgr_free(struct rtr_mgr_config *config)
Frees all resources that were allocated from the rtr_mgr.
bool rtr_mgr_conf_in_sync(struct rtr_mgr_config *config)
Check if rtr_mgr_group is fully synchronized with at least one group.
int rtr_mgr_add_group(struct rtr_mgr_config *config, const struct rtr_mgr_group *group)
Adds a new rtr_mgr_group to the linked list of a initialized config.
int rtr_mgr_remove_group(struct rtr_mgr_config *config, unsigned int preference)
Removes an existing rtr_mgr_group from the linked list of config.
struct rtr_mgr_group * rtr_mgr_get_first_group(struct rtr_mgr_config *config)
Returns the first, thus active group.
rtr_mgr_status
Status of a rtr_mgr_group.
Definition rtr_mgr.h:50
int rtr_mgr_get_spki(struct rtr_mgr_config *config, const uint32_t asn, uint8_t *ski, struct spki_record **result, unsigned int *result_count)
Returns all SPKI records which match the given ASN and SKI.
void rtr_mgr_for_each_ipv6_record(struct rtr_mgr_config *config, pfx_for_each_fp fp, void *data)
Iterates over all IPv6 records in the pfx_table.
void rtr_mgr_stop(struct rtr_mgr_config *config)
Terminates rtr_socket connections.
int rtr_mgr_start(struct rtr_mgr_config *config)
Establishes rtr_socket connections.
int rtr_mgr_validate(struct rtr_mgr_config *config, 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.
void rtr_mgr_for_each_ipv4_record(struct rtr_mgr_config *config, pfx_for_each_fp fp, void *data)
Iterates over all IPv4 records in the pfx_table.
int rtr_mgr_init(struct rtr_mgr_config **config_out, struct rtr_mgr_group groups[], const unsigned int groups_len, const unsigned int refresh_interval, const unsigned int expire_interval, const unsigned int retry_interval, const pfx_update_fp update_fp, const spki_update_fp spki_update_fp, const rtr_mgr_status_fp status_fp, void *status_fp_data)
Initializes a rtr_mgr_config.
const char * rtr_mgr_status_to_str(enum rtr_mgr_status status)
Converts a rtr_mgr_status to a String.
@ RTR_MGR_ERROR
Definition rtr_mgr.h:58
@ RTR_MGR_ESTABLISHED
Definition rtr_mgr.h:56
@ RTR_MGR_CONNECTING
Definition rtr_mgr.h:54
@ RTR_MGR_CLOSED
Definition rtr_mgr.h:52
void(* spki_update_fp)(struct spki_table *spki_table, const struct spki_record record, const bool added)
A function pointer that is called if an record was added to the spki_table or was removed from the sp...
Definition spkitable.h:52
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
The lrtr_ip_addr struct stores a IPv4 or IPv6 address in host byte order.
Definition ip.h:38
pfx_table.
Definition trie-pfx.h:65
This struct contains the Network Layer Reachability Information (NLRI). The NLRI consists of a prefix...
Definition bgpsec.h:105
The data that is passed to the rtr_mgr_bgpsec_validate_as_path function.
Definition bgpsec.h:125
A set of RTR sockets.
Definition rtr_mgr.h:71
A single Secure Path Segment.
Definition bgpsec.h:73
A single Signature Segment.
Definition bgpsec.h:88
A RTR socket.
Definition rtr.h:116
spki_record.
Definition spkitable.h:38