Blame


1 257add31 2020-09-09 stsp /*
2 4d5ee956 2022-07-02 jrick * Copyright (c) 2022 Josh Rickmar <jrick@zettaport.com>
3 cfd92333 2021-08-27 tracey * Copyright (c) 2020, 2021 Tracey Emery <tracey@openbsd.org>
4 257add31 2020-09-09 stsp * Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
5 257add31 2020-09-09 stsp *
6 257add31 2020-09-09 stsp * Permission to use, copy, modify, and distribute this software for any
7 257add31 2020-09-09 stsp * purpose with or without fee is hereby granted, provided that the above
8 257add31 2020-09-09 stsp * copyright notice and this permission notice appear in all copies.
9 257add31 2020-09-09 stsp *
10 257add31 2020-09-09 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 257add31 2020-09-09 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 257add31 2020-09-09 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 257add31 2020-09-09 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 257add31 2020-09-09 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 257add31 2020-09-09 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 257add31 2020-09-09 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 257add31 2020-09-09 stsp */
18 257add31 2020-09-09 stsp
19 aaf30ee7 2021-08-29 stsp /*
20 aaf30ee7 2021-08-29 stsp * We maintain two different structures for fetch and send configuration
21 aaf30ee7 2021-08-29 stsp * settings in case they diverge in the future.
22 aaf30ee7 2021-08-29 stsp */
23 aaf30ee7 2021-08-29 stsp struct fetch_config {
24 aaf30ee7 2021-08-29 stsp char *repository;
25 aaf30ee7 2021-08-29 stsp char *server;
26 aaf30ee7 2021-08-29 stsp char *protocol;
27 aaf30ee7 2021-08-29 stsp int port;
28 aaf30ee7 2021-08-29 stsp struct node_branch *branch;
29 cfd92333 2021-08-27 tracey };
30 aaf30ee7 2021-08-29 stsp struct send_config {
31 aaf30ee7 2021-08-29 stsp char *repository;
32 aaf30ee7 2021-08-29 stsp char *server;
33 aaf30ee7 2021-08-29 stsp char *protocol;
34 aaf30ee7 2021-08-29 stsp int port;
35 aaf30ee7 2021-08-29 stsp struct node_branch *branch;
36 cfd92333 2021-08-27 tracey };
37 cfd92333 2021-08-27 tracey
38 b8adfa55 2020-09-25 stsp struct node_branch {
39 b8adfa55 2020-09-25 stsp char *branch_name;
40 b8adfa55 2020-09-25 stsp struct node_branch *next;
41 b8adfa55 2020-09-25 stsp struct node_branch *tail;
42 b8adfa55 2020-09-25 stsp };
43 b8adfa55 2020-09-25 stsp
44 99495ddb 2021-01-10 stsp struct node_ref {
45 99495ddb 2021-01-10 stsp char *ref_name;
46 99495ddb 2021-01-10 stsp struct node_ref *next;
47 99495ddb 2021-01-10 stsp struct node_ref *tail;
48 99495ddb 2021-01-10 stsp };
49 99495ddb 2021-01-10 stsp
50 257add31 2020-09-09 stsp struct gotconfig_remote_repo {
51 257add31 2020-09-09 stsp TAILQ_ENTRY(gotconfig_remote_repo) entry;
52 257add31 2020-09-09 stsp char *name;
53 257add31 2020-09-09 stsp char *repository;
54 257add31 2020-09-09 stsp char *server;
55 257add31 2020-09-09 stsp char *protocol;
56 257add31 2020-09-09 stsp int port;
57 257add31 2020-09-09 stsp int mirror_references;
58 0c8b29c5 2021-01-05 stsp int fetch_all_branches;
59 b8adfa55 2020-09-25 stsp struct node_branch *branch;
60 6480c871 2021-08-30 stsp struct node_ref *fetch_ref;
61 aaf30ee7 2021-08-29 stsp struct fetch_config *fetch_config;
62 aaf30ee7 2021-08-29 stsp struct send_config *send_config;
63 257add31 2020-09-09 stsp };
64 257add31 2020-09-09 stsp TAILQ_HEAD(gotconfig_remote_repo_list, gotconfig_remote_repo);
65 257add31 2020-09-09 stsp
66 257add31 2020-09-09 stsp struct gotconfig {
67 257add31 2020-09-09 stsp char *author;
68 257add31 2020-09-09 stsp struct gotconfig_remote_repo_list remotes;
69 257add31 2020-09-09 stsp int nremotes;
70 4d5ee956 2022-07-02 jrick char *allowed_signers_file;
71 4d5ee956 2022-07-02 jrick char *revoked_signers_file;
72 d68f2c0e 2022-07-05 jrick char *signer_id;
73 257add31 2020-09-09 stsp };
74 257add31 2020-09-09 stsp
75 257add31 2020-09-09 stsp /*
76 257add31 2020-09-09 stsp * Parse individual gotconfig repository files
77 257add31 2020-09-09 stsp */
78 257add31 2020-09-09 stsp const struct got_error *gotconfig_parse(struct gotconfig **, const char *,
79 257add31 2020-09-09 stsp int *);
80 257add31 2020-09-09 stsp void gotconfig_free(struct gotconfig *);