summaryrefslogtreecommitdiffstats
path: root/lib/include/net.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/include/net.h')
-rw-r--r--lib/include/net.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/include/net.h b/lib/include/net.h
index 5ee7fc6..610ed77 100644
--- a/lib/include/net.h
+++ b/lib/include/net.h
@@ -2,6 +2,7 @@
#define VL_NET_H_INCLUDED
#include "arena.h"
+#include "sha1.h"
enum {
/* The operation completed successfully */
@@ -61,4 +62,32 @@ int vl_net_ensure_verified(const char *url, const char *target_path, unsigned fl
* Returns NET_EIO if the downloaded file is not readable or could not be verified due to an I/O issue. */
int vl_net_verify(const char *target_path, unsigned flags, ...);
+enum {
+ /* The job hasn't been started yet. */
+ STATUS_WAITING = 0u,
+
+ /* The job is in flight. */
+ STATUS_RUNNING = 1u,
+
+ /* The job is finished without errors. */
+ STATUS_COMPLETE = 2u,
+
+ /* The job is finished with errors. */
+ STATUS_ERROR = 3u,
+
+ /* The job finished successfully, but the downloaded file failed integrity checks. */
+ STATUS_INTEGRITY = 4u
+};
+
+struct vl_download_job {
+ const char *url;
+ const char *opath;
+ size_t expect_len;
+ vl_sha1 expect_hash;
+ unsigned verify_flags;
+ unsigned status;
+};
+
+int vl_net_download_all(struct vl_download_job *jobs, size_t njobs, size_t simult);
+
#endif