Blame


1 d65a88a2 2021-09-05 stsp /*
2 d65a88a2 2021-09-05 stsp * Copyright (c) 2021 Stefan Sperling <stsp@openbsd.org>
3 d65a88a2 2021-09-05 stsp *
4 d65a88a2 2021-09-05 stsp * Permission to use, copy, modify, and distribute this software for any
5 d65a88a2 2021-09-05 stsp * purpose with or without fee is hereby granted, provided that the above
6 d65a88a2 2021-09-05 stsp * copyright notice and this permission notice appear in all copies.
7 d65a88a2 2021-09-05 stsp *
8 d65a88a2 2021-09-05 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 d65a88a2 2021-09-05 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 d65a88a2 2021-09-05 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 d65a88a2 2021-09-05 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 d65a88a2 2021-09-05 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 d65a88a2 2021-09-05 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 d65a88a2 2021-09-05 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 d65a88a2 2021-09-05 stsp */
16 d65a88a2 2021-09-05 stsp
17 a5a30f30 2021-09-06 stsp /*
18 76b9ee43 2021-09-06 stsp * Apply any unveil(2) operations required to support the given protocol,
19 76b9ee43 2021-09-06 stsp * as obtained from the 'proto' output parameter of got_dial_parse_uri().
20 a5a30f30 2021-09-06 stsp * This function must be called during initialization of the main program
21 cbf435dd 2021-09-06 stsp * if got_fetch.h or got_send.h funcionality will be used.
22 a5a30f30 2021-09-06 stsp */
23 d65a88a2 2021-09-05 stsp const struct got_error *got_dial_apply_unveil(const char *proto);
24 a5a30f30 2021-09-06 stsp
25 a5a30f30 2021-09-06 stsp /*
26 a5a30f30 2021-09-06 stsp * Attempt to parse a URI into the following parts:
27 a5a30f30 2021-09-06 stsp * A protocol scheme, hostname, port number (as a string), path on server,
28 a5a30f30 2021-09-06 stsp * and a repository name. If the URI lacks some of this information return
29 a5a30f30 2021-09-06 stsp * default values where applicable.
30 a5a30f30 2021-09-06 stsp * The caller should dispose of the returned values with free(3).
31 a5a30f30 2021-09-06 stsp */
32 5e5da8c4 2021-09-05 stsp const struct got_error *got_dial_parse_uri(char **proto, char **host,
33 5e5da8c4 2021-09-05 stsp char **port, char **server_path, char **repo_name, const char *uri);