2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4 * Copyright 2018 Olaf Wintermann. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
41 typedef struct PropfindParser PropfindParser;
42 typedef struct ResponseTag ResponseTag;
43 typedef struct LockDiscovery LockDiscovery;
45 struct PropfindParser {
58 struct LockDiscovery {
63 int dav_buffer_seek(UcxBuffer *b, curl_off_t offset, int origin);
65 CURLcode do_propfind_request(
70 CURLcode do_proppatch_request(
76 CURLcode do_put_request(
81 dav_read_func read_func,
82 dav_seek_func seek_func,
85 UcxBuffer* create_allprop_propfind_request(void);
86 UcxBuffer* create_cryptoprop_propfind_request(void);
87 UcxBuffer* create_propfind_request(DavSession *sn, UcxList *properties, char *rootelm, DavBool nocrypt);
88 UcxBuffer* create_basic_propfind_request(void);
90 PropfindParser* create_propfind_parser(UcxBuffer *response, char *url);
91 void destroy_propfind_parser(PropfindParser *parser);
92 int get_propfind_response(PropfindParser *parser, ResponseTag *result);
93 void cleanup_response(ResponseTag *result);
95 int hrefeq(DavSession *sn, char *href1, char *href2);
96 DavResource* response2resource(DavSession *sn, ResponseTag *response, char *parent_path);
97 void add_properties(DavResource *res, ResponseTag *response);
99 DavResource* parse_propfind_response(DavSession *sn, DavResource *root, UcxBuffer *response);
100 int parse_response_tag(DavResource *resource, xmlNode *node);
101 void set_davprops(DavResource *res);
104 * parses the content of a resourcetype element
105 * returns 1 if the resourcetype is a collection, 0 otherwise
107 int parse_resource_type(xmlNode *node);
109 UcxBuffer* create_proppatch_request(DavResourceData *data);
110 UcxBuffer* create_crypto_proppatch_request(DavSession *sn, DavKey *key, const char *name, const char *hash);
112 CURLcode do_delete_request(DavSession *sn, char *lock, UcxBuffer *response);
114 CURLcode do_mkcol_request(DavSession *sn, char *lock);
116 CURLcode do_head_request(DavSession *sn);
118 CURLcode do_copy_move_request(DavSession *sn, char *dest, char *lock, DavBool copy, DavBool override);
120 UcxBuffer* create_lock_request(void);
121 int parse_lock_response(DavSession *sn, UcxBuffer *response, LockDiscovery *lock);
122 CURLcode do_lock_request(DavSession *sn, UcxBuffer *request, UcxBuffer *response, time_t timeout);
123 CURLcode do_unlock_request(DavSession *sn, char *locktoken);
125 CURLcode do_simple_request(DavSession *sn, char *method, char *locktoken);
127 CURLcode do_report_request(DavSession *sn, UcxBuffer *request, UcxBuffer *response);
133 #endif /* METHODS_H */