Loading...
Searching...
No Matches
rtr.h
/*
* This file is part of RTRlib.
*
* This file is subject to the terms and conditions of the MIT license.
* See the file LICENSE in the top level directory for more details.
*
* Website: http://rtrlib.realmv6.org/
*/
#ifndef RTR_H
#define RTR_H
#include <pthread.h>
#include <stdbool.h>
#include <stdint.h>
enum rtr_rtvals { RTR_SUCCESS = 0, RTR_ERROR = -1, RTR_INVALID_PARAM = -2 };
enum rtr_interval_mode {
RTR_INTERVAL_MODE_IGNORE_ANY,
RTR_INTERVAL_MODE_ACCEPT_ANY,
RTR_INTERVAL_MODE_DEFAULT_MIN_MAX,
RTR_INTERVAL_MODE_IGNORE_ON_FAILURE
};
enum rtr_socket_state {
RTR_CONNECTING,
RTR_ESTABLISHED,
RTR_RESET,
RTR_SYNC,
RTR_FAST_RECONNECT,
RTR_ERROR_NO_DATA_AVAIL,
RTR_ERROR_NO_INCR_UPDATE_AVAIL,
RTR_ERROR_FATAL,
RTR_ERROR_TRANSPORT,
RTR_SHUTDOWN,
RTR_CLOSED,
};
struct rtr_socket;
typedef void (*rtr_connection_state_fp)(const struct rtr_socket *rtr_socket, const enum rtr_socket_state state,
void *connection_state_fp_param_config, void *connection_state_fp_param_group);
struct rtr_socket {
struct tr_socket *tr_socket;
unsigned int refresh_interval;
time_t last_update;
unsigned int expire_interval;
unsigned int retry_interval;
enum rtr_interval_mode iv_mode;
enum rtr_socket_state state;
uint32_t session_id;
bool request_session_id;
uint32_t serial_number;
struct pfx_table *pfx_table;
pthread_t thread_id;
rtr_connection_state_fp connection_state_fp;
void *connection_state_fp_param_config;
void *connection_state_fp_param_group;
unsigned int version;
bool has_received_pdus;
struct spki_table *spki_table;
bool is_resetting;
};
const char *rtr_state_to_str(enum rtr_socket_state state);
void rtr_set_interval_mode(struct rtr_socket *rtr_socket, enum rtr_interval_mode option);
enum rtr_interval_mode rtr_get_interval_mode(struct rtr_socket *rtr_socket);
#endif
rtr_interval_mode
rtr_interval_mode
These modes let the user configure how received intervals should be handled.
Definition rtr.h:28
rtr_socket_state
rtr_socket_state
States of the RTR socket.
Definition rtr.h:45
rtr_state_to_str
const char * rtr_state_to_str(enum rtr_socket_state state)
Converts a rtr_socket_state to a String.
rtr_connection_state_fp
void(* rtr_connection_state_fp)(const struct rtr_socket *rtr_socket, const enum rtr_socket_state state, void *connection_state_fp_param_config, void *connection_state_fp_param_group)
A function pointer that is called if the state of the rtr socket has changed.
Definition rtr.h:87
rtr_set_interval_mode
void rtr_set_interval_mode(struct rtr_socket *rtr_socket, enum rtr_interval_mode option)
Set the interval option to the desired one. It's either RTR_INTERVAL_MODE_IGNORE_ANY,...
rtr_get_interval_mode
enum rtr_interval_mode rtr_get_interval_mode(struct rtr_socket *rtr_socket)
Get the current interval mode.
RTR_INTERVAL_MODE_DEFAULT_MIN_MAX
@ RTR_INTERVAL_MODE_DEFAULT_MIN_MAX
Definition rtr.h:36
RTR_INTERVAL_MODE_IGNORE_ANY
@ RTR_INTERVAL_MODE_IGNORE_ANY
Definition rtr.h:30
RTR_INTERVAL_MODE_IGNORE_ON_FAILURE
@ RTR_INTERVAL_MODE_IGNORE_ON_FAILURE
Definition rtr.h:39
RTR_INTERVAL_MODE_ACCEPT_ANY
@ RTR_INTERVAL_MODE_ACCEPT_ANY
Definition rtr.h:33
RTR_RESET
@ RTR_RESET
Definition rtr.h:55
RTR_SYNC
@ RTR_SYNC
Definition rtr.h:58
RTR_ERROR_FATAL
@ RTR_ERROR_FATAL
Definition rtr.h:70
RTR_CONNECTING
@ RTR_CONNECTING
Definition rtr.h:47
RTR_FAST_RECONNECT
@ RTR_FAST_RECONNECT
Definition rtr.h:61
RTR_ERROR_NO_DATA_AVAIL
@ RTR_ERROR_NO_DATA_AVAIL
Definition rtr.h:64
RTR_ERROR_TRANSPORT
@ RTR_ERROR_TRANSPORT
Definition rtr.h:73
RTR_CLOSED
@ RTR_CLOSED
Definition rtr.h:79
RTR_ESTABLISHED
@ RTR_ESTABLISHED
Definition rtr.h:52
RTR_ERROR_NO_INCR_UPDATE_AVAIL
@ RTR_ERROR_NO_INCR_UPDATE_AVAIL
Definition rtr.h:67
RTR_SHUTDOWN
@ RTR_SHUTDOWN
Definition rtr.h:76
rtr_socket
A RTR socket.
Definition rtr.h:116