Blame


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