Debian Codegraph @

src/import/pull-common.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "shared-forward.h"
5 #include "import-common.h"
6 #include "import-util.h"
7 #include "pull-job.h"
8
9 typedef struct CurlGlue CurlGlue;
10 typedef struct PullJob PullJob;
11
12 int pull_find_old_etags(
13 const char *url,
14 const char *root,
15 int dt,
16 const char *prefix,
17 const char *suffix,
18 char ***etags);
19
20 int pull_make_path(
21 const char *url,
22 const char *etag,
23 const char *image_root,
24 const char *prefix,
25 const char *suffix,
26 char **ret);
27
28 int pull_make_auxiliary_job(
29 PullJob **ret,
30 const char *url,
31 int (*strip_suffixes)(const char *name, char **ret),
32 const char *suffix,
33 ImportVerify verify,
34 CurlGlue *glue,
35 PullJobOpenDisk on_open_disk,
36 PullJobFinished on_finished,
37 void *userdata);
38 int pull_make_verification_jobs(
39 PullJob **ret_checksum_job,
40 PullJob **ret_signature_job,
41 ImportVerify verify,
42 const char *url,
43 CurlGlue *glue,
44 PullJobFinished on_finished,
45 void *userdata);
46
47 int pull_verify(
48 ImportVerify verify,
49 PullJob *main_job,
50 PullJob *checksum_job,
51 PullJob *signature_job,
52 PullJob *settings_job,
53 PullJob *roothash_job,
54 PullJob *roothash_signature_job,
55 PullJob *verity_job);
56
57 typedef enum VerificationStyle {
58 VERIFICATION_PER_FILE, /* SUSE-style ".sha256" files with detached gpg signature */
59 VERIFICATION_PER_DIRECTORY, /* Ubuntu-style SHA256SUM files with detached SHA256SUM.gpg signatures */
60 _VERIFICATION_STYLE_MAX,
61 _VERIFICATION_STYLE_INVALID = -EINVAL,
62 } VerificationStyle;
63
64 int verification_style_from_url(const char *url, VerificationStyle *ret);
65
66 typedef enum SignatureStyle {
67 SIGNATURE_GPG_PER_FILE, /* ".sha256" files with detached .gpg signature */
68 SIGNATURE_ASC_PER_FILE, /* SUSE-style ".sha256" files with detached .asc signature */
69 SIGNATURE_GPG_PER_DIRECTORY, /* Ubuntu-style SHA256SUM files with detached SHA256SUM.gpg signatures */
70 SIGNATURE_ASC_PER_DIRECTORY, /* SUSE-style SHA256SUM files with detached SHA256SUM.asc signatures */
71 _SIGNATURE_STYLE_MAX,
72 _SIGNATURE_STYLE_INVALID = -EINVAL,
73 } SignatureStyle;
74
75 int signature_style_from_url(const char *url, SignatureStyle *ret, char **ret_filename);
76
77 int pull_job_restart_with_sha256sum(PullJob *job, char **ret);
78 int pull_job_restart_with_signature(PullJob *job, char **ret);
79
80 bool pull_validate_local(const char *name, ImportFlags flags);
81
82 int pull_url_needs_checksum(const char *url);