Blob


1 /*
2 * Copyright (c) 2018, 2019 Ori Bernstein <ori@openbsd.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
17 #define GOT_FETCH_DEFAULT_REMOTE_NAME "origin"
19 /*
20 * Attempt to parse a URI into the following parts:
21 * A protocol scheme, hostname, port number (as a string), path on server,
22 * and a repository name. If the URI lacks some of this information return
23 * default values where applicable.
24 * The results of this function must be passed to other functions below.
25 * The caller should dispose of the returned values with free(3).
26 */
27 const struct got_error *got_fetch_parse_uri(char **, char **, char **,
28 char **, char **, const char *);
30 /*
31 * Attempt to open a connection to a server using the provided protocol
32 * scheme, hostname port number (as a string) and server-side path.
33 * A verbosity level can be specified; it currently controls the amount
34 * of -v options passed to ssh(1). If the level is -1 ssh(1) will be run
35 * with the -q option.
36 *
37 * If successful return an open file descriptor for the connection which can
38 * be passed to other functions below, and must be disposed of with close(2).
39 *
40 * If an ssh(1) process was started return its PID as well, in which case
41 * the caller should eventually send SIGTERM to the procress and wait for
42 * the process to exit with waitpid(2). Otherwise, return PID -1.
43 */
44 const struct got_error *got_fetch_connect(pid_t *, int *, const char *,
45 const char *, const char *, const char *, int);
47 /* A callback function which gets invoked with progress information to print. */
48 typedef const struct got_error *(*got_fetch_progress_cb)(void *,
49 const char *, off_t, int, int, int, int);
51 /*
52 * Attempt to fetch a packfile from a server. This pack file will contain
53 * objects which that are not yet contained in the provided repository.
54 * Return the hash of the packfile (in form of an object ID) and lists of
55 * references and symbolic references learned from the server.
56 */
57 const struct got_error *got_fetch_pack(struct got_object_id **,
58 struct got_pathlist_head *, struct got_pathlist_head *, const char *,
59 int, int, struct got_pathlist_head *, struct got_pathlist_head *,
60 int, int, int, struct got_repository *, got_fetch_progress_cb, void *);