dav/main.h

changeset 355
5da2cf15eb44
parent 338
c7f3fe4abdb2
child 364
3769ba002fd1
--- a/dav/main.h	Mon Dec 18 11:56:11 2017 +0100
+++ b/dav/main.h	Mon Dec 18 16:24:32 2017 +0100
@@ -29,6 +29,7 @@
 #ifndef MAIN_H
 #define	MAIN_H
 
+#include <time.h>
 #include <curl/curl.h>
 #include "optparser.h"
 #include <libidav/webdav.h>
@@ -45,12 +46,26 @@
     char        *path;
 } GetResource;
 
+typedef struct {
+    FILE        *out;
+    int         isstdout;
+    int64_t     total;
+    int64_t     cur;
+    int64_t     last_res_cur;
+    int64_t     last_res_total;
+    DavResource *last_resource;
+    time_t      ts;
+} Progress;
+
 typedef int(*getfunc)(Repository *, GetResource *, CmdArgs *, void *);
     
 void print_usage(char *cmd);
 char* password_input(char *prompt);
 int request_auth(Repository *repo, DavSession *sn, CmdArgs *args);
 
+int update_progress(DavResource *res, int64_t total, int64_t now, Progress *p);
+void download_progress(DavResource *res, int64_t total, int64_t now, void *data);
+
 int cmd_list(CmdArgs *args);
 void ls_print_list_elm(DavResource *res, char *parent, CmdArgs *args);
 void ls_print_elm(DavResource *res, char *parent, CmdArgs *args);

mercurial