RTRlib
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
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 
24 enum 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 
78 struct rtr_socket;
79 
83 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);
84 
109 struct rtr_socket {
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 
138 const char *rtr_state_to_str(enum rtr_socket_state state);
139 
146 void rtr_set_interval_mode(struct rtr_socket *rtr_socket, enum rtr_interval_mode option);
147 
153 enum rtr_interval_mode rtr_get_interval_mode(struct rtr_socket *rtr_socket);
154 #endif
155 /* @} */
A transport socket datastructure.
Definition: transport.h:95
Definition: rtr.h:48
Definition: rtr.h:69
Definition: rtr.h:66
Definition: rtr.h:72
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
enum rtr_interval_mode rtr_get_interval_mode(struct rtr_socket *rtr_socket)
Get the current 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&#39;s either RTR_INTERVAL_MODE_IGNORE_ANY, RTR_INTERVAL_MODE_APPLY_ANY, RTR_INTERVAL_MODE_DEFAULT_MIN_MAX or RTR_INTERVAL_MODE_IGNORE_ON_FAILURE.
Definition: rtr.h:54
Definition: rtr.h:60
rtr_interval_mode
These modes let the user configure how received intervals should be handled.
Definition: rtr.h:33
Definition: rtr.h:45
rtr_socket_state
States of the RTR socket.
Definition: rtr.h:43
A RTR socket.
Definition: rtr.h:109
Definition: rtr.h:51
Definition: rtr.h:57
Definition: rtr.h:75
Definition: rtr.h:63
const char * rtr_state_to_str(enum rtr_socket_state state)
Converts a rtr_socket_state to a String.