#include "rtrlib/rtr/rtr.h"
#include <pthread.h>
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
|
int | rtr_init (struct rtr_socket *rtr_socket, struct tr_socket *tr_socket, struct pfx_table *pfx_table, struct spki_table *spki_table, struct aspa_table *aspa_table, const unsigned int refresh_interval, const unsigned int expire_interval, const unsigned int retry_interval, enum rtr_interval_mode iv_mode, rtr_connection_state_fp fp, void *fp_data_config, void *fp_data_group) |
| Initializes a rtr_socket.
|
|
int | rtr_start (struct rtr_socket *rtr_socket) |
| Starts the RTR protocol state machine in a pthread.
|
|
void | rtr_stop (struct rtr_socket *rtr_socket) |
| Stops the RTR connection and terminate the transport connection.
|
|
◆ RTR_DBG
#define RTR_DBG |
( |
|
fmt, |
|
|
|
... |
|
) |
| lrtr_dbg("RTR Socket: " fmt, ##__VA_ARGS__) |
◆ RTR_DBG1
#define RTR_DBG1 |
( |
|
a | ) |
lrtr_dbg("RTR Socket: " a) |
◆ rtr_interval_range
Enumerator |
---|
RTR_BELOW_INTERVAL_RANGE | |
RTR_INSIDE_INTERVAL_RANGE | |
RTR_ABOVE_INTERVAL_RANGE | |
◆ rtr_interval_type
Enumerator |
---|
RTR_INTERVAL_TYPE_EXPIRATION | |
RTR_INTERVAL_TYPE_REFRESH | |
RTR_INTERVAL_TYPE_RETRY | |
◆ rtr_init()
int rtr_init |
( |
struct rtr_socket * |
rtr_socket, |
|
|
struct tr_socket * |
tr_socket, |
|
|
struct pfx_table * |
pfx_table, |
|
|
struct spki_table * |
spki_table, |
|
|
struct aspa_table * |
aspa_table, |
|
|
const unsigned int |
refresh_interval, |
|
|
const unsigned int |
expire_interval, |
|
|
const unsigned int |
retry_interval, |
|
|
enum rtr_interval_mode |
iv_mode, |
|
|
rtr_connection_state_fp |
fp, |
|
|
void * |
fp_data_config, |
|
|
void * |
fp_data_group |
|
) |
| |
Initializes a rtr_socket.
- Parameters
-
[out] | rtr_socket | Pointer to the allocated rtr_socket that will be initialized. |
[in] | tr_socket | Pointer to a tr_socket that will be used for the transport connection. If NULL the tr_socket element of the rtr_socket won't be changed. |
[in] | pfx_table | pfx_table that stores the validation records obtained from the connected rtr server. |
[in] | spki_table | spki_table that stores the router keys obtained from the connected rtr server. |
[in] | refresh_interval | Interval in seconds between serial queries that are sent to the server. Must be >= 1 and <= 86400 (one day), recommended default is 3600s (one hour). |
[in] | expire_interval | Stored validation records will be deleted if cache was unable to refresh data for this period. The value should be twice the refresh_interval. The value must be >= 600 (ten minutes) and <= 172800 (two days). The recommended default is 7200s (two hours). |
[in] | retry_interval | This parameter tells the router how long to wait (in seconds) before retrying a failed Serial Query or Reset Query. The value must be >= 1s and <= 7200s (two hours). The recommended default is 600 seconds (ten minutes). |
[in] | iv_mode | The interval mode that controls how new interval values are applied. |
[in] | fp | A callback function that is executed when the state of the socket changes. |
[in] | fp_data_config | Parameter that is passed to the connection_state_fp callback. Expects rtr_mgr_config. |
[in] | fp_data_group | Parameter that is passed to the connection_state_fp callback. Expects rtr_mgr_group. |
- Returns
- RTR_INVALID_PARAM If the refresh_interval or the expire_interval is not valid.
-
RTR_SUCCESS On success.
◆ rtr_start()
Starts the RTR protocol state machine in a pthread.
Connection to the rtr_server will be established and the pfx_records will be synced.
- Parameters
-
- Returns
- RTR_ERROR On error.
-
RTR_SUCCESS On success.
◆ rtr_stop()
Stops the RTR connection and terminate the transport connection.
- Parameters
-
◆ RTR_EXPIRATION_DEFAULT
const uint32_t RTR_EXPIRATION_DEFAULT = 7200 |
|
static |
◆ RTR_EXPIRATION_MAX
const uint32_t RTR_EXPIRATION_MAX = 172800 |
|
static |
◆ RTR_EXPIRATION_MIN
const uint32_t RTR_EXPIRATION_MIN = 600 |
|
static |
◆ RTR_PROTOCOL_MAX_SUPPORTED_VERSION
const uint8_t RTR_PROTOCOL_MAX_SUPPORTED_VERSION = 2 |
|
static |
◆ RTR_PROTOCOL_MIN_SUPPORTED_VERSION
const uint8_t RTR_PROTOCOL_MIN_SUPPORTED_VERSION |
|
static |
◆ RTR_PROTOCOL_VERSION_0
const uint8_t RTR_PROTOCOL_VERSION_0 = 0 |
|
static |
◆ RTR_PROTOCOL_VERSION_1
const uint8_t RTR_PROTOCOL_VERSION_1 = 1 |
|
static |
◆ RTR_PROTOCOL_VERSION_2
const uint8_t RTR_PROTOCOL_VERSION_2 = 2 |
|
static |
◆ RTR_REFRESH_DEFAULT
const uint32_t RTR_REFRESH_DEFAULT = 3600 |
|
static |
◆ RTR_REFRESH_MAX
const uint32_t RTR_REFRESH_MAX = 86400 |
|
static |
◆ RTR_REFRESH_MIN
const uint32_t RTR_REFRESH_MIN = 1 |
|
static |
◆ RTR_RETRY_DEFAULT
const uint32_t RTR_RETRY_DEFAULT = 600 |
|
static |
◆ RTR_RETRY_MAX
const uint32_t RTR_RETRY_MAX = 7200 |
|
static |
◆ RTR_RETRY_MIN
const uint32_t RTR_RETRY_MIN = 1 |
|
static |