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 METHODS_H
30 #define METHODS_H
31
32 #include "webdav.h"
33 #include "resource.h"
34
35 #include <cx/list.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 typedef struct PropfindParser PropfindParser;
42 typedef struct ResponseTag ResponseTag;
43 typedef struct LockDiscovery LockDiscovery;
44
45 struct PropfindParser {
46 xmlDoc *document;
47 xmlNode *current;
48 };
49
50 struct ResponseTag {
51 const char *href;
52 int iscollection;
53 CxList *properties;
54 const char *crypto_name;
55 const char *crypto_key;
56 };
57
58 struct LockDiscovery {
59 char *timeout;
60 char *locktoken;
61 };
62
63 int dav_buffer_seek(CxBuffer *b,
curl_off_t offset,
int origin);
64
65 CURLcode do_propfind_request(
66 DavSession *sn,
67 CxBuffer *request,
68 CxBuffer *response);
69
70 CURLcode do_proppatch_request(
71 DavSession *sn,
72 char *lock,
73 CxBuffer *request,
74 CxBuffer *response);
75
76 CURLcode do_put_request(
77 DavSession *sn,
78 char *lock,
79 DavBool create,
80 void *data,
81 dav_read_func read_func,
82 dav_seek_func seek_func,
83 size_t length);
84
85 CxBuffer* create_allprop_propfind_request(
void);
86 CxBuffer* create_cryptoprop_propfind_request(
void);
87 CxBuffer* create_propfind_request(DavSession *sn, CxList *properties,
char *rootelm, DavBool nocrypt);
88 CxBuffer* create_basic_propfind_request(
void);
89
90 PropfindParser* create_propfind_parser(CxBuffer *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);
94
95 int hrefeq(DavSession *sn,
const char *href1,
const char *href2);
96 DavResource* response2resource(DavSession *sn, ResponseTag *response,
char *parent_path);
97 void add_properties(DavResource *res, ResponseTag *response);
98
99 DavResource* parse_propfind_response(DavSession *sn, DavResource *root, CxBuffer *response);
100 int parse_response_tag(DavResource *resource, xmlNode *node);
101 void set_davprops(DavResource *res);
102
103
104
105
106
107 int parse_resource_type(xmlNode *node);
108
109 CxBuffer* create_proppatch_request(DavResourceData *data);
110 CxBuffer* create_crypto_proppatch_request(DavSession *sn, DavKey *key,
const char *name,
const char *hash);
111
112 CURLcode do_delete_request(DavSession *sn,
char *lock, CxBuffer *response);
113
114 CURLcode do_mkcol_request(DavSession *sn,
char *lock);
115
116 CURLcode do_head_request(DavSession *sn);
117
118 CURLcode do_copy_move_request(DavSession *sn,
char *dest,
char *lock, DavBool copy, DavBool override);
119
120 CxBuffer* create_lock_request(
void);
121 int parse_lock_response(DavSession *sn, CxBuffer *response, LockDiscovery *lock);
122 CURLcode do_lock_request(DavSession *sn, CxBuffer *request, CxBuffer *response,
time_t timeout);
123 CURLcode do_unlock_request(DavSession *sn,
char *locktoken);
124
125 CURLcode do_simple_request(DavSession *sn,
char *method,
char *locktoken);
126
127 CURLcode do_report_request(DavSession *sn, CxBuffer *request, CxBuffer *response);
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif
134
135