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