|
| bool | rtr_mgr_conf_in_sync (struct rtr_mgr_config *config) |
| |
| void | rtr_mgr_for_each_ipv4_record (struct rtr_mgr_config *config, pfx_for_each_fp fp, void *data) |
| |
| void | rtr_mgr_for_each_ipv6_record (struct rtr_mgr_config *config, pfx_for_each_fp fp, void *data) |
| |
| void | rtr_mgr_free (struct rtr_mgr_config *config) |
| |
| 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) |
| |
| struct rtr_mgr_config * | rtr_mgr_init (struct rtr_mgr_group groups[], const unsigned int groups_len, const unsigned int refresh_interval, const unsigned int expire_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) |
| |
| int | rtr_mgr_start (struct rtr_mgr_config *config) |
| |
| const char * | rtr_mgr_status_to_str (enum rtr_mgr_status status) |
| |
| void | rtr_mgr_stop (struct rtr_mgr_config *config) |
| |
| int | rtr_mgr_validate (struct rtr_mgr_config *config, const uint32_t asn, const struct ip_addr *prefix, const uint8_t mask_len, enum pfxv_state *result) |
| |
The RTR connection manager is initialized with one or multiple groups of rtr_sockets. Each group is configured with a preference value and contains a set of rtr_socket "RTR sockets. It connects to all sockets of the group with the lowest preference value.
In case of failures, the connection manager establishes connections to RTR servers of another group with the next lowest preference value (see the IETF draft-ietf-sidr-rpki-rtr for details about error handling).
Type alias pfx_for_each_fp for function signature:
Status of a rtr_mgr_group.
| Enumerator |
|---|
| RTR_MGR_CLOSED |
RTR sockets are disconnected
|
| RTR_MGR_CONNECTING |
RTR sockets trying to establish a connection.
|
| RTR_MGR_ESTABLISHED |
All RTR sockets of the group are synchronized with the rtr servers.
|
| RTR_MGR_ERROR |
Error occured on at least one RTR socket.
|
| bool rtr_mgr_conf_in_sync |
( |
struct rtr_mgr_config * |
config | ) |
|
Detects if the rtr_mgr_group is fully synchronized with at least one group.
- Parameters
-
| [in] | config | The rtr_mgr_config. |
- Returns
- true If the pfx_table stores non-outdated pfx_records from at least one socket group.
-
false If the pfx_table isn't fully synchronized with at least one group.
| 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.
For every pfx_record the function fp is called. The pfx_record and the data pointer is passed to the fp.
- Parameters
-
| [in] | config | rtr_mgr_config |
| [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 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.
For every pfx_record the function fp is called. The pfx_record and the data pointer is passed to the fp.
- Parameters
-
| [in] | config | rtr_mgr_config |
| [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 rtr_mgr_free |
( |
struct rtr_mgr_config * |
config | ) |
|
Frees all resources that were allocated from the rtr_mgr. rtr_mgr_stop(..) must be called before, to shutdown all RTR socket connections.
- Parameters
-
| [in] | config | rtr_mgr_config. |
References pfx_table_free(), and spki_table_free().
| 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 |
|
) |
| |
|
inline |
Returns all SPKI records which match the given ASN and SKI.
- Parameters
-
| [in] | config | |
| [in] | asn | Autonomous system number of the Origin-AS. |
| [in] | ski | the SKI to search for. |
| [out] | result | a array of all matching spki_records |
| [out] | result_count | number of returned spki_records |
- Returns
- SPKI_SUCCESS On success.
-
SPKI_ERROR If an error occurred.
References spki_table_get_all().
| struct rtr_mgr_config* rtr_mgr_init |
( |
struct rtr_mgr_group |
groups[], |
|
|
const unsigned int |
groups_len, |
|
|
const unsigned int |
refresh_interval, |
|
|
const unsigned int |
expire_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.
- Parameters
-
| [in] | groups | Array of rtr_mgr_group. Every RTR socket in an rtr_mgr_group must be assoziated with an initialized transport socket. A Transport socket is only allowed to be associated with one rtr socket. The preference values must be unique in the group array. More than one rtr_mgr_group with the same preference value isn't allowed. |
| [in] | groups_len | Number of elements in the groups array. |
| [in] | refresh_interval | Interval in seconds between serial queries that are sent to the server. Must be <= 3600. If 0 is specified the refresh_interval is set to 300 seconds. |
| [in] | expire_interval | Time period in seconds. Received pfx_records are deleted if the client was unable to refresh data for this time period. If 0 is specified, the expire_interval will be half the refresh_interval. The default value is twice the refresh_interval. |
| [in] | update_fp | A Pointer to a pfx_update_fp callback, that is executed for every added and removed pfx_record. |
| [in] | spki_update_fp | A Pointer to a spki_update_fp callback, that is executed for every added and removed spki_record. |
| [in] | status_fp | Pointer to a function that is called if the connection status from one of the socket groups is changed. |
| [in] | status_fp_data | Pointer to a memory area that is passed to the status_fp function. Memory area can be freely used to pass user-defined data to the status_fp callback. |
- Returns
- !NULL On success
-
NULL On error
References pfx_table_init(), rtr_init(), RTR_MGR_CLOSED, and spki_table_init().
| int rtr_mgr_start |
( |
struct rtr_mgr_config * |
config | ) |
|
Establishes the connection with the rtr_sockets of the group with the lowest preference value and handles errors as defined in the RPKI-RTR protocol.
- Parameters
-
| [in] | config | Pointer to an initialized rtr_mgr_config. |
- Returns
- RTR_SUCCESS On success
-
RTR_ERROR On error
Converts a rtr_mgr_status to a String.
- Parameters
-
| [in] | status | state to convert to a string. |
- Returns
- NULL If status isn't a valid rtr_mgr_status.
-
!=NULL The rtr_rtr_mgr_status as String.
| void rtr_mgr_stop |
( |
struct rtr_mgr_config * |
config | ) |
|
Terminates all rtr_socket connections that are defined in the config. All pfx_records received from these sockets will be purged.
- Parameters
-
| [in] | config | The rtr_mgr_config struct |
References rtr_stop().
| int rtr_mgr_validate |
( |
struct rtr_mgr_config * |
config, |
|
|
const uint32_t |
asn, |
|
|
const struct ip_addr * |
prefix, |
|
|
const uint8_t |
mask_len, |
|
|
enum pfxv_state * |
result |
|
) |
| |
|
inline |
Validates the origin of a BGP-Route.
- Parameters
-
| [in] | config | |
| [in] | asn | Autonomous system number of the Origin-AS of the prefix. |
| [in] | prefix | Announced network prefix |
| [in] | mask_len | Length of the network mask of the announced prefix |
| [out] | result | Outcome of the validation. |
- Returns
- PFX_SUCCESS On success.
-
PFX_ERROR If an error occurred.
References pfx_table_validate().