RTRlib
Loading...
Searching...
No Matches
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
17#ifndef RTR_H
18#define RTR_H
19#include <pthread.h>
20#include <stdbool.h>
21#include <stdint.h>
22
23enum rtr_rtvals { RTR_SUCCESS = 0, RTR_ERROR = -1, RTR_INVALID_PARAM = -2 };
24
41
81
82struct rtr_socket;
83
87typedef void (*rtr_connection_state_fp)(const struct rtr_socket *rtr_socket, const enum rtr_socket_state state,
88 void *connection_state_fp_param_config, void *connection_state_fp_param_group);
89
117 struct tr_socket *tr_socket;
118 unsigned int refresh_interval;
119 time_t last_update;
120 unsigned int expire_interval;
121 unsigned int retry_interval;
122 enum rtr_interval_mode iv_mode;
123 enum rtr_socket_state state;
124 uint32_t session_id;
125 bool request_session_id;
126 uint32_t serial_number;
127 struct pfx_table *pfx_table;
128 pthread_t thread_id;
129 rtr_connection_state_fp connection_state_fp;
130 void *connection_state_fp_param_config;
131 void *connection_state_fp_param_group;
132 unsigned int version;
133 bool has_received_pdus;
134 struct spki_table *spki_table;
135 bool is_resetting;
136};
137
144const char *rtr_state_to_str(enum rtr_socket_state state);
145
153
160#endif
rtr_interval_mode
These modes let the user configure how received intervals should be handled.
Definition rtr.h:28
rtr_socket_state
States of the RTR socket.
Definition rtr.h:45
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:87
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_INTERVAL_MODE_DEFAULT_MIN_MAX
Definition rtr.h:36
@ RTR_INTERVAL_MODE_IGNORE_ANY
Definition rtr.h:30
@ RTR_INTERVAL_MODE_IGNORE_ON_FAILURE
Definition rtr.h:39
@ RTR_INTERVAL_MODE_ACCEPT_ANY
Definition rtr.h:33
@ RTR_RESET
Definition rtr.h:55
@ RTR_SYNC
Definition rtr.h:58
@ RTR_ERROR_FATAL
Definition rtr.h:70
@ RTR_CONNECTING
Definition rtr.h:47
@ RTR_FAST_RECONNECT
Definition rtr.h:61
@ RTR_ERROR_NO_DATA_AVAIL
Definition rtr.h:64
@ RTR_ERROR_TRANSPORT
Definition rtr.h:73
@ RTR_CLOSED
Definition rtr.h:79
@ RTR_ESTABLISHED
Definition rtr.h:52
@ RTR_ERROR_NO_INCR_UPDATE_AVAIL
Definition rtr.h:67
@ RTR_SHUTDOWN
Definition rtr.h:76
pfx_table.
Definition trie-pfx.h:65
A RTR socket.
Definition rtr.h:116
A transport socket datastructure.
Definition transport.h:102