blob: d14e870be8e17f423e4979c702add913b2268e02 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#ifndef HYBBX_WEBSOCKET_H
#define HYBBX_WEBSOCKET_H
#include "hybbx/limits.h"
#include "hybbx/types.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Default WebSocket listen port (behind TLS reverse proxy). */
#define HYBBX_WEBSOCKET_DEFAULT_PORT 4591u
/** Default simultaneous WebSocket client connections. */
#define HYBBX_WEBSOCKET_DEFAULT_MAX_CONNECTIONS 10u
#define HYBBX_WEBSOCKET_BIND_V4_MAX 64
#define HYBBX_WEBSOCKET_BIND_V6_MAX 64
#define HYBBX_WEBSOCKET_PATH_MAX 128
#define HYBBX_WEBSOCKET_DEFAULT_BIND_V4 "127.0.0.1"
#define HYBBX_WEBSOCKET_DEFAULT_BIND_V6 "::1"
#define HYBBX_WEBSOCKET_DEFAULT_PATH "/hybbx"
#define HYBBX_WEBSOCKET_DEFAULT_CERT_DIR "keys"
/** Filenames inside @c cert_dir (auto-generated on first start when TLS). */
#define HYBBX_WS_TLS_CERT_FILENAME "hybbx_ws.crt"
#define HYBBX_WS_TLS_KEY_FILENAME "hybbx_ws.key"
/** Self-signed WebSocket TLS certificate validity (days). */
#define HYBBX_WS_TLS_CERT_VALID_DAYS 1825u
typedef struct hybbx_websocket_config {
char bind_v4[HYBBX_WEBSOCKET_BIND_V4_MAX];
char bind_v6[HYBBX_WEBSOCKET_BIND_V6_MAX];
char path[HYBBX_WEBSOCKET_PATH_MAX];
char cert_dir[HYBBX_PATH_MAX];
unsigned int port;
unsigned int max_connections;
int ipv4;
int ipv6;
} hybbx_websocket_config_t;
void hybbx_websocket_config_defaults(hybbx_websocket_config_t *config);
hybbx_result_t hybbx_websocket_config_parse(const char *config,
hybbx_websocket_config_t *out);
#ifdef __cplusplus
}
#endif
#endif /* HYBBX_WEBSOCKET_H */
|