blob: a489f2d47fe3ce7a883d2579e6a1cd6ee6bf0d56 (
plain) (
blame)
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
54
55
56
57
58
59
60
61
62
63
|
#ifndef GMNISRV_CONFIG
#define GMNISRV_CONFIG
#include <arpa/inet.h>
#include <openssl/x509.h>
#include <regex.h>
#include <stdbool.h>
struct gmnisrv_tls {
char *store;
char *organization;
SSL_CTX *ssl_ctx;
};
enum gmnisrv_routing {
ROUTE_PATH,
ROUTE_REGEX,
};
struct gmnisrv_route {
enum gmnisrv_routing routing;
char *spec;
union {
char *path;
regex_t *regex;
};
char *root;
char *index;
bool autoindex;
struct gmnisrv_route *next;
};
struct gmnisrv_host {
char *hostname;
X509 *x509;
EVP_PKEY *pkey;
struct gmnisrv_route *routes;
struct gmnisrv_host *next;
};
struct gmnisrv_bind {
char *name;
int family, port;
char addr[sizeof(struct in6_addr)];
struct gmnisrv_bind *next;
};
struct gmnisrv_config {
struct gmnisrv_tls tls;
struct gmnisrv_host *hosts;
struct gmnisrv_bind *binds;
};
int load_config(struct gmnisrv_config *conf, const char *path);
void config_finish(struct gmnisrv_config *conf);
struct gmnisrv_host *gmnisrv_config_get_host(
struct gmnisrv_config *conf, const char *hostname);
#endif
|