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 OPERATION_H
30 #define OPERATION_H
31
32 #include "../public/webdav.h"
33 #include <cx/list.h>
34 #include <cx/map.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 typedef int(*response_close_func)(WebdavOperation *, WebdavResource *);
41
42 typedef struct WebdavVFSOperation WebdavVFSOperation;
43
44 typedef struct WebdavCopy WebdavCopy;
45 typedef struct CopyResource CopyResource;
46
47 struct WebdavOperation {
48 WebdavBackend *dav;
49 Request *rq;
50 Session *sn;
51
52 WebdavProppatchRequest *proppatch;
53 WebdavPList *reqprops;
54 WebdavPropfindRequestList *requests;
55
56 WebdavResponse *response;
57
58 response_close_func response_close;
59
60 VFS_DIR parent;
61 struct stat *stat;
62 };
63
64 struct WebdavVFSOperation {
65 WebdavBackend *dav;
66 Request *rq;
67 Session *sn;
68
69 VFSContext *vfs;
70
71 char *path;
72 struct stat *stat;
73 int stat_errno;
74 };
75
76 struct WebdavCopy {
77 WebdavResponse response;
78 Session *sn;
79 Request *rq;
80 CopyResource *current;
81
82 char *src_href;
83 char *src_path;
84 char *dst_href;
85 char *dst_path;
86 };
87
88 struct CopyResource {
89 WebdavResource resource;
90 CxMap *properties;
91 };
92
93 enum WebdavVFSOpType {
94 WEBDAV_VFS_MKDIR =
0,
95 WEBDAV_VFS_DELETE
96 };
97
98 typedef enum WebdavVFSOpType WebdavVFSOpType;
99
100 typedef int(*vfs_op_func)(WebdavVFSRequest *, WSBool *);
101 typedef int(*vfs_op_finish_func)(WebdavVFSRequest *, WSBool);
102
103 typedef int(*vfs_op_child_func)(
104 VFSContext *,
105 const char *,
106 const char *,
107 VFSDir *,
108 struct stat *,
109 void *);
110
111
112
113
114 size_t webdav_num_backends(WebdavBackend *dav);
115
116 WebdavOperation* webdav_create_propfind_operation(
117 Session *sn,
118 Request *rq,
119 WebdavBackend *dav,
120 WebdavPList *reqprops,
121 WebdavPropfindRequestList *requests,
122 WebdavResponse *response);
123
124 int webdav_op_propfind_begin(
125 WebdavOperation *op,
126 const char *href,
127 VFS_DIR parent,
128 struct stat *s);
129
130 int webdav_op_propfind_children(
131 WebdavOperation *op,
132 VFSContext *vfs,
133 const char *href,
134 const char *path);
135
136 int webdav_op_propfiond_close_resource(
137 WebdavOperation *op,
138 WebdavResource *resource);
139
140 int webdav_op_propfind_finish(WebdavOperation *op);
141
142 WebdavOperation* webdav_create_proppatch_operation(
143 Session *sn,
144 Request *rq,
145 WebdavBackend *dav,
146 WebdavProppatchRequest *proppatch,
147 WebdavResponse *response);
148
149 int webdav_op_proppatch(
150 WebdavOperation *op,
151 const char *href,
152 const char *path);
153
154 int webdav_op_proppatch_close_resource(
155 WebdavOperation *op,
156 WebdavResource *resource);
157
158
159 WebdavVFSOperation* webdav_vfs_op(
160 Session *sn,
161 Request *rq,
162 WebdavBackend *dav,
163 WSBool precondition);
164
165 WebdavVFSOperation webdav_vfs_sub_op(
166 WebdavVFSOperation *op,
167 char *path,
168 struct stat *s);
169
170 int webdav_op_iterate_children(
171 VFSContext *vfs,
172 int depth,
173 const char *href,
174 const char *path,
175 vfs_op_child_func func,
176 void *userdata);
177
178 int webdav_vfs_stat(WebdavVFSOperation *op);
179
180 int webdav_vfs_op_do(WebdavVFSOperation *op, WebdavVFSOpType type);
181
182 int webdav_vfs_unlink(WebdavVFSOperation *op);
183
184
185 WebdavCopy* webdav_copy_create(
186 Session *sn,
187 Request *rq,
188 VFSContext *vfs,
189 char *from_href,
190 char *from_path,
191 char *to_href,
192 char *to_path);
193
194 #ifdef __cplusplus
195 }
196 #endif
197
198 #endif
199
200