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 #ifndef CONF_H
30 #define CONF_H
31
32 #include <inttypes.h>
33
34 #include "../util/object.h"
35
36 #include "../config/objconf.h"
37 #include "../config/initconf.h"
38 #include "../config/serverconf.h"
39 #include "../config/mimeconf.h"
40 #include "../config/acl.h"
41 #include "../config/keyfile.h"
42
43 #include "acldata.h"
44 #include "keyfile_auth.h"
45 #include "log.h"
46
47 #include <ucx/list.h>
48 #include <ucx/map.h>
49 #include <ucx/mempool.h>
50 #include <ucx/string.h>
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 typedef struct mime_map MimeMap;
57
58 typedef struct _server_configuration {
59 pool_handle_t *pool;
60 UcxMap *host_vs;
61 UcxList *listeners;
62 UcxList *logfiles;
63 AccessLog *default_log;
64 UcxMap *authdbs;
65 MimeMap *mimetypes;
66 sstr_t tmp;
67 sstr_t user;
68 uint32_t ref;
69 } ServerConfiguration;
70
71
72 typedef struct ConfigFile ConfigFile;
73
74 typedef int(*cfg_reload_f)(ConfigFile*,ServerConfiguration*);
75
76 struct ConfigFile {
77 sstr_t file;
78 time_t last_modified;
79 cfg_reload_f reload;
80 void *data;
81 };
82
83 struct mime_map {
84 UcxMap *map;
85 uint32_t ref;
86 };
87
88 int load_init_conf(
char *file);
89
90 void init_server_config_parser();
91
92 int cfg_handle_runtime(ServerConfiguration *cfg, ServerConfigObject *obj);
93
94 int cfg_handle_logfile(ServerConfiguration *cfg, ServerConfigObject *obj);
95
96 int cfg_handle_threadpool(ServerConfiguration *cfg, ServerConfigObject *obj);
97
98 int cfg_handle_eventhandler(ServerConfiguration *cfg, ServerConfigObject *obj);
99
100 int cfg_handle_accesslog(ServerConfiguration *cfg, ServerConfigObject *obj);
101
102 int cfg_handle_authdb(ServerConfiguration *cfg, ServerConfigObject *obj);
103
104 int cfg_handle_listener(ServerConfiguration *cfg, ServerConfigObject *obj);
105
106 int cfg_handle_vs(ServerConfiguration *cfg, ServerConfigObject *obj);
107
108 ServerConfiguration* load_server_conf(ServerConfiguration *old,
char *file);
109 void cfg_ref(ServerConfiguration *cfg);
110 void cfg_unref(ServerConfiguration *cfg);
111
112
113 int object_conf_reload(ConfigFile *file, ServerConfiguration *cfg);
114 void object_conf_ref(HTTPObjectConfig *conf);
115 void object_conf_unref(HTTPObjectConfig *conf);
116 HTTPObjectConfig* load_obj_conf(
char *file);
117 int mime_conf_reload(ConfigFile *file, ServerConfiguration *cfg);
118 void mime_conf_ref(MimeMap *conf);
119 void mime_conf_unref(MimeMap *conf);
120 int acl_conf_reload(ConfigFile *file, ServerConfiguration *cfg);
121 ACLList* acl_config_convert(ServerConfiguration *cfg, ACLConfig *acl);
122 int keyfile_reload(ConfigFile *file, ServerConfiguration *cfg);
123
124 sstr_t cfg_load_file(
sstr_t file);
125
126 #ifdef __cplusplus
127 }
128 #endif
129
130 #endif
131
132