33 |
33 |
34 #include "../util/object.h" |
34 #include "../util/object.h" |
35 |
35 |
36 #include "../config/objconf.h" |
36 #include "../config/objconf.h" |
37 #include "../config/initconf.h" |
37 #include "../config/initconf.h" |
38 #include "../config/serverconf.h" |
|
39 #include "../config/mimeconf.h" |
38 #include "../config/mimeconf.h" |
40 #include "../config/acl.h" |
39 #include "../config/acl.h" |
41 #include "../config/keyfile.h" |
40 #include "../config/keyfile.h" |
|
41 #include "../config/serverconfig.h" |
42 |
42 |
43 #include "acldata.h" |
43 #include "acldata.h" |
44 #include "keyfile_auth.h" |
44 #include "keyfile_auth.h" |
45 #include "log.h" |
45 #include "log.h" |
|
46 #include "vfs.h" |
|
47 |
|
48 #include "../webdav/webdav.h" |
46 |
49 |
47 #include <ucx/list.h> |
50 #include <ucx/list.h> |
48 #include <ucx/map.h> |
51 #include <ucx/map.h> |
49 #include <ucx/mempool.h> |
52 #include <ucx/mempool.h> |
50 #include <ucx/string.h> |
53 #include <ucx/string.h> |
52 #ifdef __cplusplus |
55 #ifdef __cplusplus |
53 extern "C" { |
56 extern "C" { |
54 #endif |
57 #endif |
55 |
58 |
56 typedef struct mime_map MimeMap; |
59 typedef struct mime_map MimeMap; |
|
60 |
|
61 typedef struct WebdavRepository WebdavRepository; |
|
62 typedef struct WebdavBackendInitData WebdavBackendInitData; |
57 |
63 |
58 typedef struct _server_configuration { |
64 struct ServerConfiguration { |
59 pool_handle_t *pool; |
65 pool_handle_t *pool; |
|
66 UcxAllocator *a; |
|
67 |
60 UcxMap *host_vs; // map of all vservers. key is the host name |
68 UcxMap *host_vs; // map of all vservers. key is the host name |
61 UcxList *listeners; // list of all listeners |
69 UcxList *listeners; // list of all listeners |
62 UcxList *logfiles; |
70 UcxList *logfiles; |
63 AccessLog *default_log; |
71 AccessLog *default_log; |
64 UcxMap *authdbs; |
72 UcxMap *authdbs; |
65 MimeMap *mimetypes; |
73 MimeMap *mimetypes; |
|
74 UcxMap *resources; |
|
75 UcxMap *dav; |
66 sstr_t tmp; |
76 sstr_t tmp; |
67 sstr_t user; |
77 sstr_t user; |
68 uint32_t ref; // reference counter |
78 uint32_t ref; // reference counter |
69 } ServerConfiguration; |
79 }; |
70 |
80 |
|
81 struct WebdavRepository { |
|
82 VfsType *vfs; |
|
83 void *vfsInitData; |
|
84 UcxList *davBackends; // list of WebdavBackendInitData* |
|
85 sstr_t object; |
|
86 }; |
71 |
87 |
72 typedef struct ConfigFile ConfigFile; |
88 struct WebdavBackendInitData { |
73 |
89 WebdavType *davType; |
74 typedef int(*cfg_reload_f)(ConfigFile*,ServerConfiguration*); |
90 void *davInitData; |
75 |
|
76 struct ConfigFile { |
|
77 sstr_t file; |
|
78 time_t last_modified; |
|
79 cfg_reload_f reload; |
|
80 void *data; |
|
81 }; |
91 }; |
82 |
92 |
83 struct mime_map { |
93 struct mime_map { |
84 UcxMap *map; |
94 UcxMap *map; |
85 uint32_t ref; |
|
86 }; |
95 }; |
|
96 |
|
97 char* cfg_config_file_path(const char *file); |
87 |
98 |
88 int load_init_conf(char *file); |
99 int load_init_conf(char *file); |
89 |
100 |
90 void init_server_config_parser(); |
101 void init_server_config_parser(); |
91 |
102 |
92 int cfg_handle_runtime(ServerConfiguration *cfg, ServerConfigObject *obj); |
103 int cfg_handle_runtime(ServerConfiguration *cfg, ConfigNode *obj); |
93 |
104 |
94 int cfg_handle_logfile(ServerConfiguration *cfg, ServerConfigObject *obj); |
105 int cfg_handle_logfile(ServerConfiguration *cfg, ConfigNode *obj); |
95 |
106 |
96 int cfg_handle_threadpool(ServerConfiguration *cfg, ServerConfigObject *obj); |
107 int cfg_handle_threadpool(ServerConfiguration *cfg, ConfigNode *obj); |
97 |
108 |
98 int cfg_handle_eventhandler(ServerConfiguration *cfg, ServerConfigObject *obj); |
109 int cfg_handle_eventhandler(ServerConfiguration *cfg, ConfigNode *obj); |
99 |
110 |
100 int cfg_handle_accesslog(ServerConfiguration *cfg, ServerConfigObject *obj); |
111 int cfg_handle_resourcepool(ServerConfiguration *cfg, ConfigNode *obj); |
101 |
112 |
102 int cfg_handle_authdb(ServerConfiguration *cfg, ServerConfigObject *obj); |
113 int cfg_handle_accesslog(ServerConfiguration *cfg, ConfigNode *obj); |
103 |
114 |
104 int cfg_handle_listener(ServerConfiguration *cfg, ServerConfigObject *obj); |
115 int cfg_handle_authdb(ServerConfiguration *cfg, ConfigNode *obj); |
105 |
116 |
106 int cfg_handle_vs(ServerConfiguration *cfg, ServerConfigObject *obj); |
117 int cfg_handle_listener(ServerConfiguration *cfg, ConfigNode *obj); |
107 |
118 |
108 ServerConfiguration* load_server_conf(ServerConfiguration *old, char *file); |
119 int cfg_handle_vs(ServerConfiguration *cfg, ConfigNode *obj); |
|
120 |
|
121 int cfg_handle_dav(ServerConfiguration *cfg, ConfigNode *obj); |
|
122 |
|
123 ServerConfiguration* load_server_conf(char *file); |
109 void cfg_ref(ServerConfiguration *cfg); |
124 void cfg_ref(ServerConfiguration *cfg); |
110 void cfg_unref(ServerConfiguration *cfg); |
125 void cfg_unref(ServerConfiguration *cfg); |
111 |
126 |
|
127 HTTPObjectConfig* objconf_load(ServerConfiguration *scfg, sstr_t file); |
|
128 int mime_conf_load(ServerConfiguration *cfg, sstr_t file); |
112 |
129 |
113 int object_conf_reload(ConfigFile *file, ServerConfiguration *cfg); |
130 ACLData* acl_conf_load(ServerConfiguration *cfg, sstr_t file); |
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); |
131 ACLList* acl_config_convert(ServerConfiguration *cfg, ACLConfig *acl); |
122 int keyfile_reload(ConfigFile *file, ServerConfiguration *cfg); |
132 AuthDB* keyfile_load(ServerConfiguration *cfg, scstr_t file); |
123 |
133 |
124 sstr_t cfg_load_file(sstr_t file); |
134 pblock* config_obj2pblock(pool_handle_t *pool, ConfigNode *obj); |
125 |
135 |
126 #ifdef __cplusplus |
136 #ifdef __cplusplus |
127 } |
137 } |
128 #endif |
138 #endif |
129 |
139 |