1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2017 Red Hat, Inc. (www.redhat.com)
4  *
5  * This library is free software: you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
12  * for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #if !defined (__LIBEDATASERVER_H_INSIDE__) && !defined (LIBEDATASERVER_COMPILATION)
19 #error "Only <libedataserver/libedataserver.h> should be included directly."
20 #endif
21 
22 #ifndef E_WEBDAV_SESSION_H
23 #define E_WEBDAV_SESSION_H
24 
25 #include <glib.h>
26 #include <libxml/xpath.h>
27 
28 #include <libedataserver/e-data-server-util.h>
29 #include <libedataserver/e-soup-session.h>
30 #include <libedataserver/e-source.h>
31 #include <libedataserver/e-xml-document.h>
32 
33 /* Standard GObject macros */
34 #define E_TYPE_WEBDAV_SESSION \
35 	(e_webdav_session_get_type ())
36 #define E_WEBDAV_SESSION(obj) \
37 	(G_TYPE_CHECK_INSTANCE_CAST \
38 	((obj), E_TYPE_WEBDAV_SESSION, EWebDAVSession))
39 #define E_WEBDAV_SESSION_CLASS(cls) \
40 	(G_TYPE_CHECK_CLASS_CAST \
41 	((cls), E_TYPE_WEBDAV_SESSION, EWebDAVSessionClass))
42 #define E_IS_WEBDAV_SESSION(obj) \
43 	(G_TYPE_CHECK_INSTANCE_TYPE \
44 	((obj), E_TYPE_WEBDAV_SESSION))
45 #define E_IS_WEBDAV_SESSION_CLASS(cls) \
46 	(G_TYPE_CHECK_CLASS_TYPE \
47 	((cls), E_TYPE_WEBDAV_SESSION))
48 #define E_WEBDAV_SESSION_GET_CLASS(obj) \
49 	(G_TYPE_INSTANCE_GET_CLASS \
50 	((obj), E_TYPE_WEBDAV_SESSION, EWebDAVSessionClass))
51 
52 G_BEGIN_DECLS
53 
54 #define E_WEBDAV_CAPABILITY_CLASS_1			"1"
55 #define E_WEBDAV_CAPABILITY_CLASS_2			"2"
56 #define E_WEBDAV_CAPABILITY_CLASS_3			"3"
57 #define E_WEBDAV_CAPABILITY_ACCESS_CONTROL		"access-control"
58 #define E_WEBDAV_CAPABILITY_BIND			"bind"
59 #define E_WEBDAV_CAPABILITY_EXTENDED_MKCOL		"extended-mkcol"
60 #define E_WEBDAV_CAPABILITY_ADDRESSBOOK			"addressbook"
61 #define E_WEBDAV_CAPABILITY_CALENDAR_ACCESS		"calendar-access"
62 #define E_WEBDAV_CAPABILITY_CALENDAR_SCHEDULE		"calendar-schedule"
63 #define E_WEBDAV_CAPABILITY_CALENDAR_AUTO_SCHEDULE	"calendar-auto-schedule"
64 #define E_WEBDAV_CAPABILITY_CALENDAR_PROXY		"calendar-proxy"
65 
66 #define E_WEBDAV_DEPTH_THIS			"0"
67 #define E_WEBDAV_DEPTH_THIS_AND_CHILDREN	"1"
68 #define E_WEBDAV_DEPTH_INFINITY			"infinity"
69 
70 #define E_WEBDAV_CONTENT_TYPE_XML		"application/xml; charset=\"utf-8\""
71 #define E_WEBDAV_CONTENT_TYPE_CALENDAR		"text/calendar; charset=\"utf-8\""
72 #define E_WEBDAV_CONTENT_TYPE_VCARD		"text/vcard; charset=\"utf-8\""
73 
74 #define E_WEBDAV_NS_DAV				"DAV:"
75 #define E_WEBDAV_NS_CALDAV			"urn:ietf:params:xml:ns:caldav"
76 #define E_WEBDAV_NS_CARDDAV			"urn:ietf:params:xml:ns:carddav"
77 #define E_WEBDAV_NS_CALENDARSERVER		"http://calendarserver.org/ns/"
78 #define E_WEBDAV_NS_ICAL			"http://apple.com/ns/ical/"
79 
80 typedef struct _EWebDAVSession EWebDAVSession;
81 typedef struct _EWebDAVSessionClass EWebDAVSessionClass;
82 typedef struct _EWebDAVSessionPrivate EWebDAVSessionPrivate;
83 
84 typedef enum {
85 	E_WEBDAV_RESOURCE_KIND_UNKNOWN,
86 	E_WEBDAV_RESOURCE_KIND_ADDRESSBOOK,
87 	E_WEBDAV_RESOURCE_KIND_CALENDAR,
88 	E_WEBDAV_RESOURCE_KIND_PRINCIPAL,
89 	E_WEBDAV_RESOURCE_KIND_COLLECTION,
90 	E_WEBDAV_RESOURCE_KIND_RESOURCE,
91 	E_WEBDAV_RESOURCE_KIND_SUBSCRIBED_ICALENDAR,
92 	E_WEBDAV_RESOURCE_KIND_WEBDAV_NOTES
93 } EWebDAVResourceKind;
94 
95 typedef enum {
96 	E_WEBDAV_RESOURCE_SUPPORTS_NONE		= 0,
97 	E_WEBDAV_RESOURCE_SUPPORTS_CONTACTS	= 1 << 0,
98 	E_WEBDAV_RESOURCE_SUPPORTS_EVENTS	= 1 << 1,
99 	E_WEBDAV_RESOURCE_SUPPORTS_MEMOS	= 1 << 2,
100 	E_WEBDAV_RESOURCE_SUPPORTS_TASKS	= 1 << 3,
101 	E_WEBDAV_RESOURCE_SUPPORTS_FREEBUSY	= 1 << 4,
102 	E_WEBDAV_RESOURCE_SUPPORTS_TIMEZONE	= 1 << 5,
103 	E_WEBDAV_RESOURCE_SUPPORTS_WEBDAV_NOTES	= 1 << 6,
104 	E_WEBDAV_RESOURCE_SUPPORTS_LAST		= E_WEBDAV_RESOURCE_SUPPORTS_WEBDAV_NOTES
105 } EWebDAVResourceSupports;
106 
107 typedef struct _EWebDAVResource {
108 	EWebDAVResourceKind kind;
109 	guint32 supports;
110 	gchar *href;
111 	gchar *etag;
112 	gchar *display_name;
113 	gchar *content_type;
114 	gsize content_length;
115 	glong creation_date;
116 	glong last_modified;
117 	gchar *description;
118 	gchar *color;
119 	guint order; /* (guint) -1, if unknown */
120 } EWebDAVResource;
121 
122 GType		e_webdav_resource_get_type		(void) G_GNUC_CONST;
123 EWebDAVResource *
124 		e_webdav_resource_new			(EWebDAVResourceKind kind,
125 							 guint32 supports,
126 							 const gchar *href,
127 							 const gchar *etag,
128 							 const gchar *display_name,
129 							 const gchar *content_type,
130 							 gsize content_length,
131 							 glong creation_date,
132 							 glong last_modified,
133 							 const gchar *description,
134 							 const gchar *color,
135 							 guint order);
136 EWebDAVResource *
137 		e_webdav_resource_copy			(const EWebDAVResource *src);
138 void		e_webdav_resource_free			(gpointer ptr /* EWebDAVResource * */);
139 
140 typedef enum {
141 	E_WEBDAV_LIST_ALL		= 0x00FFFFFF,
142 	E_WEBDAV_LIST_NONE		= 0,
143 	E_WEBDAV_LIST_SUPPORTS		= 1 << 0,
144 	E_WEBDAV_LIST_ETAG		= 1 << 1,
145 	E_WEBDAV_LIST_DISPLAY_NAME	= 1 << 2,
146 	E_WEBDAV_LIST_CONTENT_TYPE	= 1 << 3,
147 	E_WEBDAV_LIST_CONTENT_LENGTH	= 1 << 4,
148 	E_WEBDAV_LIST_CREATION_DATE	= 1 << 5,
149 	E_WEBDAV_LIST_LAST_MODIFIED	= 1 << 6,
150 	E_WEBDAV_LIST_DESCRIPTION	= 1 << 7,
151 	E_WEBDAV_LIST_COLOR		= 1 << 8,
152 	E_WEBDAV_LIST_ORDER		= 1 << 9,
153 	E_WEBDAV_LIST_ONLY_CALENDAR	= 1 << 28,
154 	E_WEBDAV_LIST_ONLY_ADDRESSBOOK	= 1 << 29
155 } EWebDAVListFlags;
156 
157 /**
158  * EWebDAVPropstatTraverseFunc:
159  * @webdav: an #EWebDAVSession
160  * @prop_node: an #xmlNode
161  * @request_uri: a #SoupURI, containing the request URI, maybe redirected by the server
162  * @href: (nullable): a full URI to which the property belongs, or %NULL, when not found
163  * @status_code: an HTTP status code for this property
164  * @user_data: user data, as passed to e_webdav_session_propfind_sync()
165  *
166  * A callback function for e_webdav_session_propfind_sync(),
167  * e_webdav_session_report_sync() and other XML response with DAV:propstat
168  * elements traversal functions.
169  *
170  * The @prop_node points to the actual property (prop) node and it can be examined
171  * with e_xml_find_child(), e_xml_find_children_nodes() and other provided XML helper functions.
172  *
173  * Returns: %TRUE to continue traversal of the returned response, %FALSE otherwise.
174  *
175  * Since: 3.26
176  **/
177 typedef gboolean (* EWebDAVPropstatTraverseFunc)	(EWebDAVSession *webdav,
178 							 xmlNode *prop_node,
179 							 const SoupURI *request_uri,
180 							 const gchar *href,
181 							 guint status_code,
182 							 gpointer user_data);
183 
184 typedef enum {
185 	E_WEBDAV_PROPERTY_SET,
186 	E_WEBDAV_PROPERTY_REMOVE
187 } EWebDAVPropertyChangeKind;
188 
189 typedef struct _EWebDAVPropertyChange {
190 	EWebDAVPropertyChangeKind kind;
191 	gchar *ns_uri;
192 	gchar *name;
193 	gchar *value;
194 } EWebDAVPropertyChange;
195 
196 GType		e_webdav_property_change_get_type	(void) G_GNUC_CONST;
197 EWebDAVPropertyChange *
198 		e_webdav_property_change_new_set	(const gchar *ns_uri,
199 							 const gchar *name,
200 							 const gchar *value);
201 EWebDAVPropertyChange *
202 		e_webdav_property_change_new_remove	(const gchar *ns_uri,
203 							 const gchar *name);
204 EWebDAVPropertyChange *
205 		e_webdav_property_change_copy		(const EWebDAVPropertyChange *src);
206 void		e_webdav_property_change_free		(gpointer ptr); /* EWebDAVPropertyChange * */
207 
208 typedef enum {
209 	E_WEBDAV_LOCK_EXCLUSIVE,
210 	E_WEBDAV_LOCK_SHARED
211 } EWebDAVLockScope;
212 
213 #define E_WEBDAV_COLLATION_ASCII_NUMERIC_SUFFIX "ascii-numeric"
214 #define E_WEBDAV_COLLATION_ASCII_NUMERIC "i;" E_WEBDAV_COLLATION_ASCII_NUMERIC_SUFFIX
215 
216 #define E_WEBDAV_COLLATION_ASCII_CASEMAP_SUFFIX "ascii-casemap"
217 #define E_WEBDAV_COLLATION_ASCII_CASEMAP "i;" E_WEBDAV_COLLATION_ASCII_CASEMAP_SUFFIX
218 
219 #define E_WEBDAV_COLLATION_OCTET_SUFFIX "octet"
220 #define E_WEBDAV_COLLATION_OCTET "i;" E_WEBDAV_COLLATION_OCTET_SUFFIX
221 
222 #define E_WEBDAV_COLLATION_UNICODE_CASEMAP_SUFFIX "unicode-casemap"
223 #define E_WEBDAV_COLLATION_UNICODE_CASEMAP "i;" E_WEBDAV_COLLATION_UNICODE_CASEMAP_SUFFIX
224 
225 typedef enum {
226 	E_WEBDAV_PRIVILEGE_KIND_UNKNOWN = 0,
227 	E_WEBDAV_PRIVILEGE_KIND_ABSTRACT,
228 	E_WEBDAV_PRIVILEGE_KIND_AGGREGATE,
229 	E_WEBDAV_PRIVILEGE_KIND_COMMON
230 } EWebDAVPrivilegeKind;
231 
232 typedef enum {
233 	E_WEBDAV_PRIVILEGE_HINT_UNKNOWN = 0,
234 	E_WEBDAV_PRIVILEGE_HINT_READ,
235 	E_WEBDAV_PRIVILEGE_HINT_WRITE,
236 	E_WEBDAV_PRIVILEGE_HINT_WRITE_PROPERTIES,
237 	E_WEBDAV_PRIVILEGE_HINT_WRITE_CONTENT,
238 	E_WEBDAV_PRIVILEGE_HINT_UNLOCK,
239 	E_WEBDAV_PRIVILEGE_HINT_READ_ACL,
240 	E_WEBDAV_PRIVILEGE_HINT_WRITE_ACL,
241 	E_WEBDAV_PRIVILEGE_HINT_READ_CURRENT_USER_PRIVILEGE_SET,
242 	E_WEBDAV_PRIVILEGE_HINT_BIND,
243 	E_WEBDAV_PRIVILEGE_HINT_UNBIND,
244 	E_WEBDAV_PRIVILEGE_HINT_ALL,
245 	E_WEBDAV_PRIVILEGE_HINT_CALDAV_READ_FREE_BUSY
246 } EWebDAVPrivilegeHint;
247 
248 typedef struct _EWebDAVPrivilege {
249 	gchar *ns_uri;
250 	gchar *name;
251 	gchar *description;
252 	EWebDAVPrivilegeKind kind;
253 	EWebDAVPrivilegeHint hint;
254 } EWebDAVPrivilege;
255 
256 GType		e_webdav_privilege_get_type		(void) G_GNUC_CONST;
257 EWebDAVPrivilege *
258 		e_webdav_privilege_new			(const gchar *ns_uri,
259 							 const gchar *name,
260 							 const gchar *description,
261 							 EWebDAVPrivilegeKind kind,
262 							 EWebDAVPrivilegeHint hint);
263 EWebDAVPrivilege *
264 		e_webdav_privilege_copy			(const EWebDAVPrivilege *src);
265 void		e_webdav_privilege_free			(gpointer ptr); /* EWebDAVPrivilege * */
266 
267 typedef enum {
268 	E_WEBDAV_ACE_PRINCIPAL_UNKNOWN = 0,
269 	E_WEBDAV_ACE_PRINCIPAL_HREF,
270 	E_WEBDAV_ACE_PRINCIPAL_ALL,
271 	E_WEBDAV_ACE_PRINCIPAL_AUTHENTICATED,
272 	E_WEBDAV_ACE_PRINCIPAL_UNAUTHENTICATED,
273 	E_WEBDAV_ACE_PRINCIPAL_PROPERTY,
274 	E_WEBDAV_ACE_PRINCIPAL_SELF,
275 	E_WEBDAV_ACE_PRINCIPAL_OWNER /* special-case, 'property' with only 'DAV:owner' child */
276 } EWebDAVACEPrincipalKind;
277 
278 typedef enum {
279 	E_WEBDAV_ACE_FLAG_UNKNOWN	= 0,
280 	E_WEBDAV_ACE_FLAG_GRANT		= 1 << 0,
281 	E_WEBDAV_ACE_FLAG_DENY		= 1 << 1,
282 	E_WEBDAV_ACE_FLAG_INVERT	= 1 << 2,
283 	E_WEBDAV_ACE_FLAG_PROTECTED	= 1 << 3,
284 	E_WEBDAV_ACE_FLAG_INHERITED	= 1 << 4
285 } EWebDAVACEFlag;
286 
287 typedef struct _EWebDAVAccessControlEntry {
288 	EWebDAVACEPrincipalKind principal_kind;
289 	gchar *principal_href; /* valid only if principal_kind is E_WEBDAV_ACE_PRINCIPAL_HREF */
290 	guint32 flags; /* bit-or of EWebDAVACEFlag */
291 	gchar *inherited_href; /* valid only if flags contain E_WEBDAV_ACE_INHERITED */
292 	GSList *privileges; /* EWebDAVPrivilege * */
293 } EWebDAVAccessControlEntry;
294 
295 GType		e_webdav_access_control_entry_get_type	(void) G_GNUC_CONST;
296 EWebDAVAccessControlEntry *
297 		e_webdav_access_control_entry_new	(EWebDAVACEPrincipalKind principal_kind,
298 							 const gchar *principal_href,
299 							 guint32 flags, /* bit-or of EWebDAVACEFlag */
300 							 const gchar *inherited_href);
301 EWebDAVAccessControlEntry *
302 		e_webdav_access_control_entry_copy	(const EWebDAVAccessControlEntry *src);
303 void		e_webdav_access_control_entry_free	(gpointer ptr); /* EWebDAVAccessControlEntry * */
304 void		e_webdav_access_control_entry_append_privilege
305 							(EWebDAVAccessControlEntry *ace,
306 							 EWebDAVPrivilege *privilege);
307 GSList *	e_webdav_access_control_entry_get_privileges
308 							(EWebDAVAccessControlEntry *ace); /* EWebDAVPrivilege * */
309 
310 typedef enum {
311 	E_WEBDAV_ACL_RESTRICTION_NONE			= 0,
312 	E_WEBDAV_ACL_RESTRICTION_GRANT_ONLY		= 1 << 0,
313 	E_WEBDAV_ACL_RESTRICTION_NO_INVERT		= 1 << 1,
314 	E_WEBDAV_ACL_RESTRICTION_DENY_BEFORE_GRANT	= 1 << 2,
315 	E_WEBDAV_ACL_RESTRICTION_REQUIRED_PRINCIPAL	= 1 << 3
316 } EWebDAVACLRestrictions;
317 
318 /**
319  * EWebDAVSession:
320  *
321  * Contains only private data that should be read and manipulated using the
322  * functions below.
323  *
324  * Since: 3.26
325  **/
326 struct _EWebDAVSession {
327 	/*< private >*/
328 	ESoupSession parent;
329 	EWebDAVSessionPrivate *priv;
330 };
331 
332 struct _EWebDAVSessionClass {
333 	ESoupSessionClass parent_class;
334 
335 	/* Padding for future expansion */
336 	gpointer reserved[10];
337 };
338 
339 GType		e_webdav_session_get_type		(void) G_GNUC_CONST;
340 
341 EWebDAVSession *e_webdav_session_new			(ESource *source);
342 const gchar *	e_webdav_session_get_last_dav_error_code(EWebDAVSession *webdav);
343 gboolean	e_webdav_session_get_last_dav_error_is_permission
344 							(EWebDAVSession *webdav);
345 SoupRequestHTTP *
346 		e_webdav_session_new_request		(EWebDAVSession *webdav,
347 							 const gchar *method,
348 							 const gchar *uri,
349 							 GError **error);
350 gboolean	e_webdav_session_replace_with_detailed_error
351 							(EWebDAVSession *webdav,
352 							 SoupRequestHTTP *request,
353 							 const GByteArray *response_data,
354 							 gboolean ignore_multistatus,
355 							 const gchar *prefix,
356 							 GError **inout_error);
357 gchar *		e_webdav_session_ensure_full_uri	(EWebDAVSession *webdav,
358 							 const SoupURI *request_uri,
359 							 const gchar *href);
360 gboolean	e_webdav_session_options_sync		(EWebDAVSession *webdav,
361 							 const gchar *uri,
362 							 GHashTable **out_capabilities,
363 							 GHashTable **out_allows,
364 							 GCancellable *cancellable,
365 							 GError **error);
366 gboolean	e_webdav_session_post_sync		(EWebDAVSession *webdav,
367 							 const gchar *uri,
368 							 const gchar *data,
369 							 gsize data_length,
370 							 gchar **out_content_type,
371 							 GByteArray **out_content,
372 							 GCancellable *cancellable,
373 							 GError **error);
374 gboolean	e_webdav_session_post_with_content_type_sync
375 							(EWebDAVSession *webdav,
376 							 const gchar *uri,
377 							 const gchar *data,
378 							 gsize data_length,
379 							 const gchar *in_content_type,
380 							 gchar **out_content_type,
381 							 GByteArray **out_content,
382 							 GCancellable *cancellable,
383 							 GError **error);
384 gboolean	e_webdav_session_propfind_sync		(EWebDAVSession *webdav,
385 							 const gchar *uri,
386 							 const gchar *depth,
387 							 const EXmlDocument *xml,
388 							 EWebDAVPropstatTraverseFunc func,
389 							 gpointer func_user_data,
390 							 GCancellable *cancellable,
391 							 GError **error);
392 gboolean	e_webdav_session_proppatch_sync		(EWebDAVSession *webdav,
393 							 const gchar *uri,
394 							 const EXmlDocument *xml,
395 							 GCancellable *cancellable,
396 							 GError **error);
397 gboolean	e_webdav_session_report_sync		(EWebDAVSession *webdav,
398 							 const gchar *uri,
399 							 const gchar *depth,
400 							 const EXmlDocument *xml,
401 							 EWebDAVPropstatTraverseFunc func,
402 							 gpointer func_user_data,
403 							 gchar **out_content_type,
404 							 GByteArray **out_content,
405 							 GCancellable *cancellable,
406 							 GError **error);
407 gboolean	e_webdav_session_mkcol_sync		(EWebDAVSession *webdav,
408 							 const gchar *uri,
409 							 GCancellable *cancellable,
410 							 GError **error);
411 gboolean	e_webdav_session_mkcol_addressbook_sync	(EWebDAVSession *webdav,
412 							 const gchar *uri,
413 							 const gchar *display_name,
414 							 const gchar *description,
415 							 GCancellable *cancellable,
416 							 GError **error);
417 gboolean	e_webdav_session_mkcalendar_sync	(EWebDAVSession *webdav,
418 							 const gchar *uri,
419 							 const gchar *display_name,
420 							 const gchar *description,
421 							 const gchar *color,
422 							 guint32 supports, /* bit-or of EWebDAVResourceSupports */
423 							 GCancellable *cancellable,
424 							 GError **error);
425 gboolean	e_webdav_session_get_sync		(EWebDAVSession *webdav,
426 							 const gchar *uri,
427 							 gchar **out_href,
428 							 gchar **out_etag,
429 							 GOutputStream *out_stream,
430 							 GCancellable *cancellable,
431 							 GError **error);
432 gboolean	e_webdav_session_get_data_sync		(EWebDAVSession *webdav,
433 							 const gchar *uri,
434 							 gchar **out_href,
435 							 gchar **out_etag,
436 							 gchar **out_bytes,
437 							 gsize *out_length,
438 							 GCancellable *cancellable,
439 							 GError **error);
440 gboolean	e_webdav_session_put_sync		(EWebDAVSession *webdav,
441 							 const gchar *uri,
442 							 const gchar *etag,
443 							 const gchar *content_type,
444 							 GInputStream *stream,
445 							 gchar **out_href,
446 							 gchar **out_etag,
447 							 GCancellable *cancellable,
448 							 GError **error);
449 gboolean	e_webdav_session_put_data_sync		(EWebDAVSession *webdav,
450 							 const gchar *uri,
451 							 const gchar *etag,
452 							 const gchar *content_type,
453 							 const gchar *bytes,
454 							 gsize length,
455 							 gchar **out_href,
456 							 gchar **out_etag,
457 							 GCancellable *cancellable,
458 							 GError **error);
459 gboolean	e_webdav_session_delete_sync		(EWebDAVSession *webdav,
460 							 const gchar *uri,
461 							 const gchar *depth,
462 							 const gchar *etag,
463 							 GCancellable *cancellable,
464 							 GError **error);
465 gboolean	e_webdav_session_copy_sync		(EWebDAVSession *webdav,
466 							 const gchar *source_uri,
467 							 const gchar *destination_uri,
468 							 const gchar *depth,
469 							 gboolean can_overwrite,
470 							 GCancellable *cancellable,
471 							 GError **error);
472 gboolean	e_webdav_session_move_sync		(EWebDAVSession *webdav,
473 							 const gchar *source_uri,
474 							 const gchar *destination_uri,
475 							 gboolean can_overwrite,
476 							 GCancellable *cancellable,
477 							 GError **error);
478 gboolean	e_webdav_session_lock_sync		(EWebDAVSession *webdav,
479 							 const gchar *uri,
480 							 const gchar *depth,
481 							 gint32 lock_timeout,
482 							 const EXmlDocument *xml,
483 							 gchar **out_lock_token,
484 							 xmlDoc **out_xml_response,
485 							 GCancellable *cancellable,
486 							 GError **error);
487 gboolean	e_webdav_session_refresh_lock_sync	(EWebDAVSession *webdav,
488 							 const gchar *uri,
489 							 const gchar *lock_token,
490 							 gint32 lock_timeout,
491 							 GCancellable *cancellable,
492 							 GError **error);
493 gboolean	e_webdav_session_unlock_sync		(EWebDAVSession *webdav,
494 							 const gchar *uri,
495 							 const gchar *lock_token,
496 							 GCancellable *cancellable,
497 							 GError **error);
498 gboolean	e_webdav_session_traverse_multistatus_response
499 							(EWebDAVSession *webdav,
500 							 const SoupMessage *message,
501 							 const GByteArray *xml_data,
502 							 EWebDAVPropstatTraverseFunc func,
503 							 gpointer func_user_data,
504 							 GError **error);
505 gboolean	e_webdav_session_traverse_mkcol_response
506 							(EWebDAVSession *webdav,
507 							 const SoupMessage *message,
508 							 const GByteArray *xml_data,
509 							 EWebDAVPropstatTraverseFunc func,
510 							 gpointer func_user_data,
511 							 GError **error);
512 gboolean	e_webdav_session_traverse_mkcalendar_response
513 							(EWebDAVSession *webdav,
514 							 const SoupMessage *message,
515 							 const GByteArray *xml_data,
516 							 EWebDAVPropstatTraverseFunc func,
517 							 gpointer func_user_data,
518 							 GError **error);
519 gboolean	e_webdav_session_getctag_sync		(EWebDAVSession *webdav,
520 							 const gchar *uri,
521 							 gchar **out_ctag,
522 							 GCancellable *cancellable,
523 							 GError **error);
524 gboolean	e_webdav_session_list_sync		(EWebDAVSession *webdav,
525 							 const gchar *uri,
526 							 const gchar *depth,
527 							 guint32 flags, /* bit-or of EWebDAVListFlags */
528 							 GSList **out_resources, /* EWebDAVResource * */
529 							 GCancellable *cancellable,
530 							 GError **error);
531 gboolean	e_webdav_session_update_properties_sync	(EWebDAVSession *webdav,
532 							 const gchar *uri,
533 							 const GSList *changes, /* EWebDAVPropertyChange * */
534 							 GCancellable *cancellable,
535 							 GError **error);
536 gboolean	e_webdav_session_lock_resource_sync	(EWebDAVSession *webdav,
537 							 const gchar *uri,
538 							 EWebDAVLockScope lock_scope,
539 							 gint32 lock_timeout,
540 							 const gchar *owner,
541 							 gchar **out_lock_token,
542 							 GCancellable *cancellable,
543 							 GError **error);
544 gboolean	e_webdav_session_acl_sync		(EWebDAVSession *webdav,
545 							 const gchar *uri,
546 							 const EXmlDocument *xml,
547 							 GCancellable *cancellable,
548 							 GError **error);
549 gboolean	e_webdav_session_get_supported_privilege_set_sync
550 							(EWebDAVSession *webdav,
551 							 const gchar *uri,
552 							 GNode **out_privileges, /* EWebDAVPrivilege * */
553 							 GCancellable *cancellable,
554 							 GError **error);
555 gboolean	e_webdav_session_get_current_user_privilege_set_sync
556 							(EWebDAVSession *webdav,
557 							 const gchar *uri,
558 							 GSList **out_privileges, /* EWebDAVPrivilege * */
559 							 GCancellable *cancellable,
560 							 GError **error);
561 gboolean	e_webdav_session_get_acl_sync		(EWebDAVSession *webdav,
562 							 const gchar *uri,
563 							 GSList **out_entries, /* EWebDAVAccessControlEntry * */
564 							 GCancellable *cancellable,
565 							 GError **error);
566 gboolean	e_webdav_session_get_acl_restrictions_sync
567 							(EWebDAVSession *webdav,
568 							 const gchar *uri,
569 							 guint32 *out_restrictions, /* bit-or of EWebDAVACLRestrictions */
570 							 EWebDAVACEPrincipalKind *out_principal_kind,
571 							 GSList **out_principal_hrefs, /* gchar * */
572 							 GCancellable *cancellable,
573 							 GError **error);
574 gboolean	e_webdav_session_get_principal_collection_set_sync
575 							(EWebDAVSession *webdav,
576 							 const gchar *uri,
577 							 GSList **out_principal_hrefs, /* gchar * */
578 							 GCancellable *cancellable,
579 							 GError **error);
580 gboolean	e_webdav_session_set_acl_sync		(EWebDAVSession *webdav,
581 							 const gchar *uri,
582 							 const GSList *entries, /* EWebDAVAccessControlEntry * */
583 							 GCancellable *cancellable,
584 							 GError **error);
585 gboolean	e_webdav_session_principal_property_search_sync
586 							(EWebDAVSession *webdav,
587 							 const gchar *uri,
588 							 gboolean apply_to_principal_collection_set,
589 							 const gchar *match_ns_uri,
590 							 const gchar *match_property,
591 							 const gchar *match_value,
592 							 GSList **out_principals, /* EWebDAVResource * */
593 							 GCancellable *cancellable,
594 							 GError **error);
595 gchar *		e_webdav_session_util_maybe_dequote	(gchar *text);
596 void		e_webdav_session_util_free_privileges	(GNode *privileges); /* EWebDAVPrivilege * */
597 gboolean	e_webdav_session_util_item_href_equal	(const gchar *href1,
598 							 const gchar *href2);
599 
600 G_END_DECLS
601 
602 #endif /* E_WEBDAV_SESSION_H */
603