From 2016dceaa9cfc65ee80ee7e433331390f4263744 Mon Sep 17 00:00:00 2001 From: bigfoot547 Date: Mon, 12 Jan 2026 16:30:37 -0600 Subject: download jobs --- lib/include/net.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lib/include/net.h') 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 -- cgit v1.2.3-70-g09d2