libidav/webdav.h

changeset 40
a95ee94b9204
parent 39
3e55bed345f9
child 42
6518b035a9df
equal deleted inserted replaced
39:3e55bed345f9 40:a95ee94b9204
46 typedef struct DavSession DavSession; 46 typedef struct DavSession DavSession;
47 typedef struct DavResource DavResource; 47 typedef struct DavResource DavResource;
48 typedef struct DavRequest DavRequest; 48 typedef struct DavRequest DavRequest;
49 typedef struct DavNamespace DavNamespace; 49 typedef struct DavNamespace DavNamespace;
50 typedef struct DavProperty DavProperty; 50 typedef struct DavProperty DavProperty;
51 typedef struct DavKey DavKey;
51 52
52 #include "davql.h" 53 #include "davql.h"
53 54
54 typedef size_t(*dav_read_func)(void*, size_t, size_t, void*); 55 typedef size_t(*dav_read_func)(void*, size_t, size_t, void*);
55 typedef size_t(*dav_write_func)(const void*, size_t, size_t, void*); 56 typedef size_t(*dav_write_func)(const void*, size_t, size_t, void*);
63 DAV_METHOD_NOT_ALLOWED, 64 DAV_METHOD_NOT_ALLOWED,
64 DAV_CONFLICT 65 DAV_CONFLICT
65 }; 66 };
66 67
67 typedef enum DavError DavError; 68 typedef enum DavError DavError;
69
70 #define DAV_SESSION_ENCRYPT_FILE 0x0001
71 #define DAV_SESSION_ENCRYPT_NAME 0x0002
72 #define DAV_SESSION_DECRYPT_PATH 0x0004
73
68 74
69 struct DavNamespace { 75 struct DavNamespace {
70 char *prefix; 76 char *prefix;
71 char *name; 77 char *name;
72 }; 78 };
91 struct DavSession { 97 struct DavSession {
92 DavContext *context; 98 DavContext *context;
93 CURL *handle; 99 CURL *handle;
94 char *base_url; 100 char *base_url;
95 UcxMempool *mp; 101 UcxMempool *mp;
96 UcxAllocator *allocator; 102 DavKey *key;
97 uint32_t flags; 103 uint32_t flags;
98 DavError error; 104 DavError error;
99 const char *errorstr; 105 const char *errorstr;
100 }; 106 };
101 107
102 struct DavContext { 108 struct DavContext {
103 UcxMap *namespaces; 109 UcxMap *namespaces;
110 UcxMap *keys;
104 UcxList *sessions; 111 UcxList *sessions;
105 DavProxy *http_proxy; 112 DavProxy *http_proxy;
106 DavProxy *https_proxy; 113 DavProxy *https_proxy;
107 }; 114 };
108 115
117 DavNamespace *ns; 124 DavNamespace *ns;
118 char *name; 125 char *name;
119 char *value; 126 char *value;
120 }; 127 };
121 128
129 #define DAV_KEY_AES128 0
130 #define DAV_KEY_AES256 1
131 #define DAV_KEY_PASSWORD 2
132
133 struct DavKey {
134 char *name;
135 int type;
136 void *data;
137 size_t length;
138 };
139
122 DavContext* dav_context_new(); 140 DavContext* dav_context_new();
123 void dav_context_destroy(DavContext *ctx); 141 void dav_context_destroy(DavContext *ctx);
142
143 void dav_context_add_key(DavContext *context, DavKey *key);
144 DavKey* dav_context_get_key(DavContext *context, char *name);
145
124 int dav_add_namespace(DavContext *context, char *prefix, char *ns); 146 int dav_add_namespace(DavContext *context, char *prefix, char *ns);
125 DavNamespace* dav_get_namespace(DavContext *context, char *prefix); 147 DavNamespace* dav_get_namespace(DavContext *context, char *prefix);
126 148
127 DavSession* dav_session_new(DavContext *context, char *base_url); 149 DavSession* dav_session_new(DavContext *context, char *base_url);
128 DavSession* dav_session_new_auth( 150 DavSession* dav_session_new_auth(
140 void* dav_session_realloc(DavSession *sn, void *ptr, size_t size); 162 void* dav_session_realloc(DavSession *sn, void *ptr, size_t size);
141 void dav_session_free(DavSession *sn, void *ptr); 163 void dav_session_free(DavSession *sn, void *ptr);
142 164
143 165
144 DavResource* dav_get(DavSession *sn, char *path, char *properties); 166 DavResource* dav_get(DavSession *sn, char *path, char *properties);
145 DavResource* dav_get2(DavSession *sn, DavGetQuery *query); 167
168 DavResource* dav_query_get(DavSession *sn, DavGetQuery *query);
146 169
147 UcxList* parse_properties_string(DavContext *context, sstr_t str); 170 UcxList* parse_properties_string(DavContext *context, sstr_t str);
148 171
149 DavResource* dav_query(DavSession *sn, char *query, ...); 172 DavResource* dav_query(DavSession *sn, char *query, ...);
150 173

mercurial