Librasta & Libsci
A C implementation of the RaSTA protocol stack
config.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef __cplusplus
4 extern "C" { // only need to export C interface if
5  // used by C++ source code
6 #endif
7 
8 #include <stdbool.h>
9 #include <stddef.h>
10 #include <stdint.h>
11 
12 #ifdef ENABLE_OPAQUE
13 
14 #include <opaque.h>
15 
16 #endif
17 
18 #define CONFIG_BUFFER_LENGTH 10000
19 
22 #ifdef ENABLE_OPAQUE
23  KEY_EXCHANGE_MODE_OPAQUE
24 #endif
25 };
26 
27 #define KEX_PSK_MAX 128
28 
42 
43 #ifdef ENABLE_OPAQUE
44  bool has_psk_record;
45  uint8_t psk_record[OPAQUE_USER_RECORD_LEN];
46 #endif
47 };
48 
49 /* Any 32-bit or wider unsigned integer data type will do */
50 typedef unsigned int MD4_u32plus;
51 
55 typedef enum {
69 
73 typedef enum {
87 
91 typedef struct rasta_config_sending {
92  unsigned int t_max;
93  unsigned int t_h;
99  unsigned short mwa;
100  unsigned short send_max;
101  unsigned int max_packet;
102  unsigned int diag_window;
103  unsigned int sr_hash_key;
106 
110 typedef struct rasta_config_receive {
111  unsigned int max_recvqueue_size;
112  unsigned int max_recv_msg_size;
114 
121 
125 typedef struct rasta_ip_data {
126  char ip[16];
127  int port;
129 
135  unsigned int count;
136 };
137 
141 struct crc_options {
145  unsigned short width;
146  /*
147  * the crc polynom without msb
148  */
149  unsigned long polynom;
153  unsigned long initial;
157  unsigned long initial_optimized;
161  int refin;
165  int refout;
169  unsigned long final_xor;
170 
174  unsigned long crc_mask;
178  unsigned long crc_high_bit;
179 
180  /*
181  * 1 if the crc lookup table has been generated, 0 otherwise
182  */
187  unsigned long table[256];
188 };
189 
193 typedef struct rasta_config_redundancy {
195  struct crc_options crc_type;
196  unsigned int t_seq;
198  unsigned int n_deferqueue_size;
200 
204 typedef struct rasta_config_general {
205  unsigned long rasta_network;
206  unsigned long rasta_id;
207  unsigned long rasta_id_remote;
209 
210 // max length of CN in ASN.1
211 #define MAX_DOMAIN_LENGTH 64
212 
216 typedef struct rasta_config_tls {
224  char *cert_path;
228  char *key_path;
238 
242 typedef struct rasta_config_info {
244 
246  char (*accepted_versions)[5];
247 
279  struct RastaConfigKex kex;
281 
282 typedef struct rasta_connection_config {
288 
292 typedef enum {
309  LOG_LEVEL_NONE = 0
311 
315 typedef enum {
327  LOGGER_TYPE_BOTH = 2
329 
330 #ifdef __cplusplus
331 }
332 #endif
KEY_EXCHANGE_MODE
Definition: config.h:20
@ KEY_EXCHANGE_MODE_NONE
Definition: config.h:21
struct rasta_config_retransmission rasta_config_retransmission
struct rasta_config_general rasta_config_general
struct rasta_connection_config rasta_connection_config
struct rasta_config_redundancy rasta_config_redundancy
unsigned int MD4_u32plus
Definition: config.h:50
#define MAX_DOMAIN_LENGTH
Definition: config.h:211
struct rasta_config_receive rasta_config_receive
struct rasta_config_info rasta_config_info
struct rasta_config_tls rasta_config_tls
struct rasta_ip_data rasta_ip_data
logger_type
Definition: config.h:315
@ LOGGER_TYPE_CONSOLE
Definition: config.h:319
@ LOGGER_TYPE_BOTH
Definition: config.h:327
@ LOGGER_TYPE_FILE
Definition: config.h:323
rasta_hash_algorithm
Definition: config.h:73
@ RASTA_ALGO_BLAKE2B
Definition: config.h:81
@ RASTA_ALGO_MD4
Definition: config.h:77
@ RASTA_ALGO_SIPHASH_2_4
Definition: config.h:85
log_level
Definition: config.h:292
@ LOG_LEVEL_DEBUG
Definition: config.h:296
@ LOG_LEVEL_ERROR
Definition: config.h:304
@ LOG_LEVEL_NONE
Definition: config.h:309
@ LOG_LEVEL_INFO
Definition: config.h:300
struct rasta_config_sending rasta_config_sending
rasta_checksum_type
Definition: config.h:55
@ RASTA_CHECKSUM_8B
Definition: config.h:63
@ RASTA_CHECKSUM_NONE
Definition: config.h:59
@ RASTA_CHECKSUM_16B
Definition: config.h:67
#define KEX_PSK_MAX
Definition: config.h:27
Definition: config.h:29
char psk[128]
Definition: config.h:37
enum KEY_EXCHANGE_MODE mode
Definition: config.h:33
uint64_t rekeying_interval_ms
Definition: config.h:41
Definition: config.h:133
rasta_ip_data * data
Definition: config.h:134
unsigned int count
Definition: config.h:135
Definition: config.h:141
unsigned long initial_optimized
Definition: config.h:157
unsigned long initial
Definition: config.h:153
int refin
Definition: config.h:161
unsigned long table[256]
Definition: config.h:187
int is_table_generated
Definition: config.h:183
unsigned long crc_high_bit
Definition: config.h:178
unsigned short width
Definition: config.h:145
unsigned long final_xor
Definition: config.h:169
int refout
Definition: config.h:165
unsigned long crc_mask
Definition: config.h:174
unsigned long polynom
Definition: config.h:149
Definition: config.h:204
unsigned long rasta_id_remote
Definition: config.h:207
unsigned long rasta_id
Definition: config.h:206
unsigned long rasta_network
Definition: config.h:205
Definition: config.h:242
rasta_config_redundancy redundancy
Definition: config.h:263
char(* accepted_versions)[5]
Definition: config.h:246
rasta_config_redundancy redundancy_remote
Definition: config.h:264
rasta_config_sending sending
Definition: config.h:251
uint32_t initial_sequence_number
Definition: config.h:243
size_t accepted_version_count
Definition: config.h:245
rasta_config_tls tls
Definition: config.h:274
rasta_config_receive receive
Definition: config.h:255
rasta_config_retransmission retransmission
Definition: config.h:259
struct RastaConfigKex kex
Definition: config.h:279
rasta_config_general general
Definition: config.h:269
Definition: config.h:110
unsigned int max_recvqueue_size
Definition: config.h:111
unsigned int max_recv_msg_size
Definition: config.h:112
Definition: config.h:193
unsigned int t_seq
Definition: config.h:196
struct RastaConfigRedundancyConnections connections
Definition: config.h:194
int n_diagnose
Definition: config.h:197
struct crc_options crc_type
Definition: config.h:195
unsigned int n_deferqueue_size
Definition: config.h:198
Definition: config.h:118
unsigned int max_retransmission_queue_size
Definition: config.h:119
Definition: config.h:91
rasta_hash_algorithm sr_hash_algorithm
Definition: config.h:104
unsigned int max_packet
Definition: config.h:101
rasta_checksum_type md4_type
Definition: config.h:94
unsigned int t_max
Definition: config.h:92
unsigned int sr_hash_key
Definition: config.h:103
unsigned short send_max
Definition: config.h:100
MD4_u32plus md4_c
Definition: config.h:97
MD4_u32plus md4_b
Definition: config.h:96
unsigned short mwa
Definition: config.h:99
MD4_u32plus md4_d
Definition: config.h:98
MD4_u32plus md4_a
Definition: config.h:95
unsigned int t_h
Definition: config.h:93
unsigned int diag_window
Definition: config.h:102
Definition: config.h:216
char * cert_path
Definition: config.h:224
char * key_path
Definition: config.h:228
char * peer_tls_cert_path
Definition: config.h:236
char tls_hostname[64]
Definition: config.h:232
char * ca_cert_path
Definition: config.h:220
Definition: config.h:282
rasta_config_info * config
Definition: config.h:286
Definition: config.h:125
char ip[16]
Definition: config.h:126
int port
Definition: config.h:127