2020-09-23 11:19:29 -04:00
|
|
|
#ifndef GMNISRV_CONFIG
|
|
|
|
#define GMNISRV_CONFIG
|
|
|
|
#include <arpa/inet.h>
|
2020-09-24 17:51:29 -04:00
|
|
|
#include <openssl/x509.h>
|
2020-09-23 11:19:29 -04:00
|
|
|
|
|
|
|
struct gmnisrv_tls {
|
|
|
|
char *store;
|
|
|
|
char *organization;
|
|
|
|
char *email;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gmnisrv_host {
|
|
|
|
char *hostname;
|
|
|
|
char *root;
|
2020-09-24 17:51:29 -04:00
|
|
|
SSL_CTX *ssl_ctx;
|
2020-09-23 11:19:29 -04:00
|
|
|
struct gmnisrv_host *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gmnisrv_bind {
|
2020-09-23 12:40:28 -04:00
|
|
|
char *name;
|
2020-09-23 11:33:05 -04:00
|
|
|
int family, port;
|
2020-09-23 11:19:29 -04:00
|
|
|
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);
|
2020-09-23 12:40:28 -04:00
|
|
|
void config_finish(struct gmnisrv_config *conf);
|
2020-09-23 11:19:29 -04:00
|
|
|
|
|
|
|
struct gmnisrv_host *gmnisrv_config_get_host(
|
2020-09-23 14:19:28 -04:00
|
|
|
struct gmnisrv_config *conf, const char *hostname);
|
2020-09-23 11:19:29 -04:00
|
|
|
|
|
|
|
#endif
|