libidav/resource.h

changeset 728
35a421f441d5
parent 609
dc3d70848c7c
child 747
efbd59642577
equal deleted inserted replaced
727:56e6b5ccbf11 728:35a421f441d5
28 28
29 #ifndef RESOURCE_H 29 #ifndef RESOURCE_H
30 #define RESOURCE_H 30 #define RESOURCE_H
31 31
32 #include "webdav.h" 32 #include "webdav.h"
33 #include "crypto.h"
33 #include <ucx/string.h> 34 #include <ucx/string.h>
34 35
35 #ifdef __cplusplus 36 #ifdef __cplusplus
36 extern "C" { 37 extern "C" {
37 #endif 38 #endif
71 * sha256 content hash 72 * sha256 content hash
72 */ 73 */
73 char hash[32]; 74 char hash[32];
74 }; 75 };
75 76
77 /*
78 * read wrapper with integrated hashing
79 */
80 typedef struct {
81 DAV_SHA_CTX *sha;
82 void *stream;
83 dav_read_func read;
84 dav_seek_func seek;
85 int error;
86 } HashStream;
87
88 struct DavInputStream {
89 DavResource *res;
90 CURLM *m;
91 CURL *c;
92 AESDecrypter *dec;
93 char *buffer;
94 size_t alloc;
95 size_t size;
96 size_t pos;
97 int eof;
98 };
99
100 struct DavOutputStream {
101 DavResource *res;
102 CURLM *m;
103 CURL *c;
104 AESEncrypter *enc;
105 HashStream *hstr;
106 const char *buffer;
107 size_t size;
108 size_t pos;
109 int eof;
110 };
111
76 DavResource* dav_resource_new_full(DavSession *sn, char *parent_path, char *name, char *href); 112 DavResource* dav_resource_new_full(DavSession *sn, char *parent_path, char *name, char *href);
77 113
78 void resource_free_properties(DavSession *sn, UcxMap *properties); 114 void resource_free_properties(DavSession *sn, UcxMap *properties);
79 115
80 void resource_set_href(DavResource *res, sstr_t href); 116 void resource_set_href(DavResource *res, sstr_t href);

mercurial