1
0
mirror of https://git.sr.ht/~sircmpwn/gmnisrv synced 2024-06-08 17:30:43 +00:00
gmnisrv/include/config.h
2020-09-26 16:41:11 -04:00

45 lines
798 B
C

#ifndef GMNISRV_CONFIG
#define GMNISRV_CONFIG
#include <arpa/inet.h>
#include <openssl/x509.h>
#include <stdbool.h>
struct gmnisrv_tls {
char *store;
char *organization;
SSL_CTX *ssl_ctx;
};
struct gmnisrv_host {
char *hostname;
char *root;
char *index;
bool autoindex;
X509 *x509;
EVP_PKEY *pkey;
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