libidav/resource.h

changeset 728
35a421f441d5
parent 609
dc3d70848c7c
child 747
efbd59642577
--- a/libidav/resource.h	Fri Jun 04 18:24:39 2021 +0200
+++ b/libidav/resource.h	Fri Jun 04 18:24:55 2021 +0200
@@ -30,6 +30,7 @@
 #define	RESOURCE_H
 
 #include "webdav.h"
+#include "crypto.h"
 #include <ucx/string.h>
 
 #ifdef	__cplusplus
@@ -73,6 +74,41 @@
     char hash[32];
 };
 
+/*
+ * read wrapper with integrated hashing
+ */
+typedef struct {
+    DAV_SHA_CTX *sha;
+    void *stream;
+    dav_read_func read;
+    dav_seek_func seek;
+    int error;
+} HashStream;
+
+struct DavInputStream {
+    DavResource *res;
+    CURLM *m;
+    CURL *c;
+    AESDecrypter *dec;
+    char *buffer;
+    size_t alloc;
+    size_t size;
+    size_t pos;
+    int eof;
+};
+
+struct DavOutputStream {
+    DavResource *res;
+    CURLM *m;
+    CURL *c;
+    AESEncrypter *enc;
+    HashStream *hstr;
+    const char *buffer;
+    size_t size;
+    size_t pos;
+    int eof;
+};
+
 DavResource* dav_resource_new_full(DavSession *sn, char *parent_path, char *name, char *href);
 
 void resource_free_properties(DavSession *sn, UcxMap *properties);

mercurial