--- a/src/server/daemon/config.h Sat Jan 28 16:01:07 2012 +0100 +++ b/src/server/daemon/config.h Mon Feb 13 13:49:49 2012 +0100 @@ -45,6 +45,7 @@ extern "C" { #endif + typedef struct _server_configuration { pool_handle_t *pool; UcxMap *host_vs; // map of all vservers. key is the host name @@ -55,66 +56,36 @@ sstr_t user; } ServerConfiguration; -/* - * Handles an object in the server.conf - * An object looks like <ObjectName> ... directives ... </ObjectName> - * The parser executes the handlers process_directive function for each - * directive in the object - */ -typedef struct _server_conf_handler ServerConfigHandler; + +typedef struct ConfigFile ConfigFile; + +typedef int(*cfg_reload_f)(ConfigFile*,ServerConfiguration*); -typedef void(*cfg_handler_init_f)(ServerConfigHandler*, ServerConfiguration*); -typedef void*(*cfg_element_start_f)( - ServerConfigHandler*, - ServerConfiguration*); -typedef int(*cfg_process_directive_f)( - ServerConfigHandler*, - ServerConfiguration*, - ConfigDirective*, - void*); /* element object created in element_start */ +struct ConfigFile { + sstr_t file; + time_t last_modified; + cfg_reload_f reload; + void *data; +}; -struct _server_conf_handler { - cfg_handler_init_f init; - cfg_element_start_f element_start; - cfg_process_directive_f process_directive; - cfg_process_directive_f element_end; -}; void load_init_conf(char *file); void init_server_config_parser(); -ServerConfiguration* load_server_conf(char *file); +int cfg_handle_runtime(ServerConfiguration *cfg, ServerConfigObject *obj); -int handle_runtime_directive( - ServerConfigHandler *h, - ServerConfiguration *conf, - ConfigDirective *dir, - void *data); +int cfg_handle_logfile(ServerConfiguration *cfg, ServerConfigObject *obj); + +int cfg_handle_authdb(ServerConfiguration *cfg, ServerConfigObject *obj); -void* handle_listener_start(ServerConfigHandler *h, ServerConfiguration *cfg); -int handle_listener_directive( - ServerConfigHandler *h, - ServerConfiguration *conf, - ConfigDirective *dir, - void *data); -int handle_listener_end( - ServerConfigHandler *h, - ServerConfiguration *conf, - ConfigDirective *dir, - void *data); +int cfg_handle_listener(ServerConfiguration *cfg, ServerConfigObject *obj); + +int cfg_handle_vs(ServerConfiguration *cfg, ServerConfigObject *obj); -void* handle_vserver_start(ServerConfigHandler *h, ServerConfiguration *cfg); -int handle_vserver_directive( - ServerConfigHandler *h, - ServerConfiguration *conf, - ConfigDirective *dir, - void *data); -int handle_vserver_end( - ServerConfigHandler *h, - ServerConfiguration *conf, - ConfigDirective *dir, - void *data); +ServerConfiguration* load_server_conf(ServerConfiguration *old, char *file); + +int object_conf_reload(ConfigFile *file, ServerConfiguration *cfg); HTTPObjectConfig* load_obj_conf(char *file);