#ifndef CONF_H
#define CONF_H
#include <inttypes.h>
#include "../util/object.h"
#include "../config/objconf.h"
#include "../config/initconf.h"
#include "../config/serverconf.h"
#include "../config/mimeconf.h"
#include "../config/acl.h"
#include "../config/keyfile.h"
#include "acldata.h"
#include "keyfile_auth.h"
#include "log.h"
#include <ucx/list.h>
#include <ucx/map.h>
#include <ucx/mempool.h>
#include <ucx/string.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct mime_map MimeMap;
typedef struct _server_configuration {
pool_handle_t *pool;
UcxMap *host_vs;
UcxList *listeners;
UcxList *logfiles;
AccessLog *default_log;
UcxMap *authdbs;
MimeMap *mimetypes;
sstr_t tmp;
sstr_t user;
uint32_t ref;
} ServerConfiguration;
typedef struct ConfigFile ConfigFile;
typedef int(*cfg_reload_f)(ConfigFile*,ServerConfiguration*);
struct ConfigFile {
sstr_t file;
time_t last_modified;
cfg_reload_f reload;
void *data;
};
struct mime_map {
UcxMap *map;
uint32_t ref;
};
int load_init_conf(
char *file);
void init_server_config_parser();
int cfg_handle_runtime(ServerConfiguration *cfg, ServerConfigObject *obj);
int cfg_handle_logfile(ServerConfiguration *cfg, ServerConfigObject *obj);
int cfg_handle_threadpool(ServerConfiguration *cfg, ServerConfigObject *obj);
int cfg_handle_eventhandler(ServerConfiguration *cfg, ServerConfigObject *obj);
int cfg_handle_accesslog(ServerConfiguration *cfg, ServerConfigObject *obj);
int cfg_handle_authdb(ServerConfiguration *cfg, ServerConfigObject *obj);
int cfg_handle_listener(ServerConfiguration *cfg, ServerConfigObject *obj);
int cfg_handle_vs(ServerConfiguration *cfg, ServerConfigObject *obj);
ServerConfiguration* load_server_conf(ServerConfiguration *old,
char *file);
void cfg_ref(ServerConfiguration *cfg);
void cfg_unref(ServerConfiguration *cfg);
int object_conf_reload(ConfigFile *file, ServerConfiguration *cfg);
void object_conf_ref(HTTPObjectConfig *conf);
void object_conf_unref(HTTPObjectConfig *conf);
HTTPObjectConfig* load_obj_conf(
char *file);
int mime_conf_reload(ConfigFile *file, ServerConfiguration *cfg);
void mime_conf_ref(MimeMap *conf);
void mime_conf_unref(MimeMap *conf);
int acl_conf_reload(ConfigFile *file, ServerConfiguration *cfg);
ACLList* acl_config_convert(ServerConfiguration *cfg, ACLConfig *acl);
int keyfile_reload(ConfigFile *file, ServerConfiguration *cfg);
sstr_t cfg_load_file(
sstr_t file);
#ifdef __cplusplus
}
#endif
#endif