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/mimeconf.h"
39 #include "../config/acl.h"
40 #include "../config/keyfile.h"
41 #include "../config/serverconfig.h"
42
43 #include "acldata.h"
44 #include "keyfile_auth.h"
45 #include "log.h"
46 #include "vfs.h"
47
48 #include "../webdav/webdav.h"
49
50 #include <cx/linked_list.h>
51 #include <cx/hash_map.h>
52 #include <cx/mempool.h>
53 #include <cx/string.h>
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 typedef struct mime_map MimeMap;
60
61 typedef struct WebdavRepository WebdavRepository;
62 typedef struct WebdavBackendInitData WebdavBackendInitData;
63
64 typedef struct CfgManager {
65 ServerConfig *serverconf;
66 ServerConfiguration *cfg;
67 } CfgManager;
68
69 struct ServerConfiguration {
70 pool_handle_t *pool;
71 CxAllocator *a;
72
73 ServerConfiguration *next;
74
75 CxMap *host_vs;
76 CxList *listeners;
77
78 CxMap *listeners2;
79
80 CxList *logfiles;
81 AccessLog *default_log;
82 CxMap *authdbs;
83 MimeMap *mimetypes;
84 CxMap *resources;
85 CxMap *dav;
86 cxmutstr tmp;
87 cxmutstr user;
88 uint32_t ref;
89 };
90
91 struct WebdavRepository {
92 VfsType *vfs;
93 void *vfsInitData;
94 CxList *davBackends;
95 cxmutstr object;
96 };
97
98 struct WebdavBackendInitData {
99 WebdavType *davType;
100 void *davInitData;
101 };
102
103 struct mime_map {
104 CxMap *map;
105 };
106
107 pool_handle_t* cfg_get_init_pool(
void);
108
109 char* cfg_config_file_path(
const char *file);
110
111 InitConfig* load_init_conf(
const char *file);
112 int apply_init_conf(InitConfig *cfg);
113 void free_init_conf(InitConfig *cfg);
114
115 void init_server_config_parser();
116
117 int cfg_handle_runtime(ServerConfiguration *cfg, ConfigNode *obj);
118
119 int cfg_handle_logfile(ServerConfiguration *cfg, ConfigNode *obj);
120
121 int cfg_handle_threadpool(ServerConfiguration *cfg, ConfigNode *obj);
122
123 int cfg_handle_eventhandler(ServerConfiguration *cfg, ConfigNode *obj);
124
125 int cfg_handle_resourcepool(ServerConfiguration *cfg, ConfigNode *obj);
126
127 int cfg_handle_accesslog(ServerConfiguration *cfg, ConfigNode *obj);
128
129 int cfg_handle_authdb(ServerConfiguration *cfg, ConfigNode *obj);
130
131 int cfg_handle_listener(ServerConfiguration *cfg, ConfigNode *obj);
132
133 int cfg_handle_vs(ServerConfiguration *cfg, ConfigNode *obj);
134
135 int cfg_handle_dav(ServerConfiguration *cfg, ConfigNode *obj);
136
137 ServerConfiguration* load_server_conf(CfgManager *mgr,
char *file);
138 ServerConfiguration* apply_server_conf(CfgManager *mgr);
139 int migrate_server_conf(ServerConfiguration *old_cfg, ServerConfiguration *new_cfg);
140
141 void cfg_ref(ServerConfiguration *cfg);
142 void cfg_unref(ServerConfiguration *cfg);
143
144 HTTPObjectConfig* objconf_load(ServerConfiguration *scfg, cxmutstr file);
145 int mime_conf_load(ServerConfiguration *cfg, cxmutstr file);
146
147 ACLData* acl_conf_load(ServerConfiguration *cfg,
const char *file);
148 ACLList* acl_config_convert(ServerConfiguration *cfg, ACLConfig *acl);
149 AuthDB* keyfile_load(ServerConfiguration *cfg, cxstring file);
150
151 pblock* config_obj2pblock(
pool_handle_t *pool, ConfigNode *obj);
152
153 #ifdef __cplusplus
154 }
155 #endif
156
157 #endif
158
159