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 
17 #ifndef RTR_H
18 #define RTR_H
19 #include <pthread.h>
20 #include <stdbool.h>
21 #include <stdint.h>
22 
23 enum rtr_rtvals { RTR_SUCCESS = 0, RTR_ERROR = -1, RTR_INVALID_PARAM = -2 };
24 
31 
34 
37 
40 };
41 
48 
53 
56 
59 
62 
65 
68 
71 
74 
77 
80 };
81 
82 struct rtr_socket;
83 
87 typedef 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 
116 struct rtr_socket {
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 
144 const char *rtr_state_to_str(enum rtr_socket_state state);
145 
152 void rtr_set_interval_mode(struct rtr_socket *rtr_socket, enum rtr_interval_mode option);
153 
159 enum rtr_interval_mode rtr_get_interval_mode(struct rtr_socket *rtr_socket);
160 #endif
161 
A transport socket datastructure.
Definition: transport.h:102
Definition: rtr.h:52
Definition: rtr.h:73
Definition: rtr.h:70
Definition: rtr.h:76
pfx_table.
Definition: trie-pfx.h:65
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:30
Definition: rtr.h:58
Definition: rtr.h:64
rtr_interval_mode
These modes let the user configure how received intervals should be handled.
Definition: rtr.h:28
Definition: rtr.h:47
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_socket_state
States of the RTR socket.
Definition: rtr.h:45
A RTR socket.
Definition: rtr.h:116
Definition: rtr.h:55
Definition: rtr.h:61
Definition: rtr.h:79
Definition: rtr.h:33
Definition: rtr.h:67
const char * rtr_state_to_str(enum rtr_socket_state state)
Converts a rtr_socket_state to a String.