RTRlib
rtr.h
1/*
2 * This file is part of RTRlib.
3 *
4 * This file is subject to the terms and conditions of the MIT license.
5 * See the file LICENSE in the top level directory for more details.
6 *
7 * Website: http://rtrlib.realmv6.org/
8 */
9
10
18#ifndef RTR_H
19#define RTR_H
20#include <pthread.h>
21#include <stdbool.h>
22#include <stdint.h>
23
24enum rtr_rtvals {
25 RTR_SUCCESS = 0,
26 RTR_ERROR = -1,
27 RTR_INVALID_PARAM = -2
28};
29
34 RTR_INTERVAL_MODE_IGNORE_ANY, /*< Ignore appliance of interval values at all. */
35 RTR_INTERVAL_MODE_ACCEPT_ANY, /*< Accept any interval values, even if outside of range. */
36 RTR_INTERVAL_MODE_DEFAULT_MIN_MAX, /*< If interval value is outside of range, apply min (if below range) or max (if above range). */
37 RTR_INTERVAL_MODE_IGNORE_ON_FAILURE /*< Ignore any interval values that are outside of range. */
38};
39
46
49
52
55
58
61
64
67
70
73
76};
77
78struct rtr_socket;
79
83typedef 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);
84
110 struct tr_socket *tr_socket;
111 unsigned int refresh_interval;
112 time_t last_update;
113 unsigned int expire_interval;
114 unsigned int retry_interval;
115 enum rtr_interval_mode iv_mode;
116 enum rtr_socket_state state;
117 uint32_t session_id;
118 bool request_session_id;
119 uint32_t serial_number;
120 struct pfx_table *pfx_table;
121 pthread_t thread_id;
122 rtr_connection_state_fp connection_state_fp;
123 void *connection_state_fp_param_config;
124 void *connection_state_fp_param_group;
125 unsigned int version;
126 bool has_received_pdus;
127 struct spki_table *spki_table;
128 bool is_resetting;
129};
130
131
138const char *rtr_state_to_str(enum rtr_socket_state state);
139
147
154#endif
155/* @} */
rtr_interval_mode
These modes let the user configure how received intervals should be handled.
Definition: rtr.h:33
rtr_socket_state
States of the RTR socket.
Definition: rtr.h:43
const char * rtr_state_to_str(enum rtr_socket_state state)
Converts a rtr_socket_state to a String.
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:83
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,...
enum rtr_interval_mode rtr_get_interval_mode(struct rtr_socket *rtr_socket)
Get the current interval mode.
@ RTR_RESET
Definition: rtr.h:51
@ RTR_SYNC
Definition: rtr.h:54
@ RTR_ERROR_FATAL
Definition: rtr.h:66
@ RTR_CONNECTING
Definition: rtr.h:45
@ RTR_FAST_RECONNECT
Definition: rtr.h:57
@ RTR_ERROR_NO_DATA_AVAIL
Definition: rtr.h:60
@ RTR_ERROR_TRANSPORT
Definition: rtr.h:69
@ RTR_CLOSED
Definition: rtr.h:75
@ RTR_ESTABLISHED
Definition: rtr.h:48
@ RTR_ERROR_NO_INCR_UPDATE_AVAIL
Definition: rtr.h:63
@ RTR_SHUTDOWN
Definition: rtr.h:72
A RTR socket.
Definition: rtr.h:109
A transport socket datastructure.
Definition: transport.h:95