RTRlib
Loading...
Searching...
No Matches
rtr_mgr.h File Reference
#include "config.h"
#include "rtrlib/aspa/aspa.h"
#include "rtrlib/pfx/pfx.h"
#include "rtrlib/spki/spkitable.h"
#include "rtrlib/bgpsec/bgpsec.h"
#include <pthread.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  rtr_mgr_group
 A set of RTR sockets. More...
 
struct  rtr_mgr_config
 

Typedefs

typedef void(* rtr_mgr_status_fp) (const struct rtr_mgr_group *, enum rtr_mgr_status, const struct rtr_socket *, void *)
 

Enumerations

enum  rtr_mgr_status { RTR_MGR_CLOSED , RTR_MGR_CONNECTING , RTR_MGR_ESTABLISHED , RTR_MGR_ERROR }
 Status of a rtr_mgr_group. More...
 

Functions

int rtr_mgr_init (struct rtr_mgr_config **config_out, struct rtr_mgr_group groups[], const unsigned int groups_len, const rtr_mgr_status_fp status_fp, void *status_fp_data)
 Initializes a rtr_mgr_config.
 
int rtr_mgr_setup_sockets (struct rtr_mgr_config *config, 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)
 
int rtr_mgr_add_roa_support (struct rtr_mgr_config *config, const pfx_update_fp pfx_update_fp)
 Sets up ROA support.
 
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.
 
void rtr_mgr_free (struct rtr_mgr_config *config)
 Frees all resources that were allocated from the rtr_mgr.
 
int rtr_mgr_start (struct rtr_mgr_config *config)
 Establishes rtr_socket connections.
 
void rtr_mgr_stop (struct rtr_mgr_config *config)
 Terminates rtr_socket connections.
 
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_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.
 
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.
 
const char * rtr_mgr_status_to_str (enum rtr_mgr_status status)
 Converts a rtr_mgr_status to a String.
 
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.
 
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.
 
struct rtr_mgr_grouprtr_mgr_get_first_group (struct rtr_mgr_config *config)
 Returns the first, thus active group.
 
int rtr_mgr_for_each_group (struct rtr_mgr_config *config, void(*fp)(const struct rtr_mgr_group *group, void *data), void *data)
 
int rtr_mgr_add_aspa_support (struct rtr_mgr_config *config, const aspa_update_fp aspa_update_fp)
 Sets up ASPA support.
 
int rtr_mgr_add_spki_support (struct rtr_mgr_config *config, const spki_update_fp spki_update_fp)
 Sets up BGPSEC support.
 
int rtr_mgr_bgpsec_validate_as_path (const struct rtr_bgpsec *data, struct rtr_mgr_config *config)
 Validation function for AS path validation.
 
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.
 
int rtr_mgr_bgpsec_get_version (void)
 Returns the highest supported BGPsec version.
 
int rtr_mgr_bgpsec_has_algorithm_suite (uint8_t alg_suite)
 Check, if an algorithm suite is supported by RTRlib.
 
int rtr_mgr_bgpsec_get_algorithm_suites (const uint8_t **algs_arr)
 Returns pointer to a list that holds all supported algorithm suites.
 
void rtr_mgr_bgpsec_free_signatures (struct rtr_signature_seg *seg)
 Free a signature and any signatures that are pointed to.
 
struct rtr_secure_path_segrtr_mgr_bgpsec_new_secure_path_seg (uint8_t pcount, uint8_t flags, uint32_t asn)
 Return an allocated and initialized Secure Path Segment.
 
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_segrtr_mgr_bgpsec_new_signature_seg (uint8_t *ski, uint16_t sig_len, uint8_t *signature)
 Return an allocated and initialized Signature.
 
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.
 
struct rtr_bgpsecrtr_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.
 
void rtr_mgr_bgpsec_free (struct rtr_bgpsec *bgpsec)
 Free a rtr_bgpsec struct and any Secure Path and Signature Segments it holds.
 
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_secure_path_segrtr_mgr_bgpsec_pop_secure_path_seg (struct rtr_bgpsec *bgpsec)
 Retrieve a pointer to the last appended Secure Path Segment from a bgpsec struct.
 
struct rtr_signature_segrtr_mgr_bgpsec_pop_signature_seg (struct rtr_bgpsec *bgpsec)
 Retrieve a pointer to the last appended Signature Segment from a bgpsec struct.
 
void rtr_mgr_bgpsec_append_sec_path_seg (struct rtr_bgpsec *bgpsec, struct rtr_secure_path_seg *new_seg)
 
int rtr_mgr_bgpsec_append_sig_seg (struct rtr_bgpsec *bgpsec, struct rtr_signature_seg *new_seg)
 
struct rtr_bgpsec_nlrirtr_mgr_bgpsec_nlri_new (int nlri_len)
 
void rtr_mgr_bgpsec_nlri_free (struct rtr_bgpsec_nlri *nlri)
 
void rtr_mgr_bgpsec_add_spki_record (struct rtr_mgr_config *config, struct spki_record *record)