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 82ebf666 2020-03-18 stsp /* IANA assigned */
18 82ebf666 2020-03-18 stsp #define GOT_DEFAULT_GIT_PORT 9418
19 82ebf666 2020-03-18 stsp #define GOT_DEFAULT_GIT_PORT_STR "9418"
20 82ebf666 2020-03-18 stsp
21 ee448f5f 2020-03-18 stsp #ifndef GOT_FETCH_PATH_SSH
22 ee448f5f 2020-03-18 stsp #define GOT_FETCH_PATH_SSH "/usr/bin/ssh"
23 ee448f5f 2020-03-18 stsp #endif
24 ee448f5f 2020-03-18 stsp
25 7ebc0570 2020-03-18 stsp #define GOT_FETCH_DEFAULT_REMOTE_NAME "origin"
26 7ebc0570 2020-03-18 stsp
27 a78567c6 2020-03-18 stsp /*
28 a78567c6 2020-03-18 stsp * Attempt to parse a URI into the following parts:
29 a78567c6 2020-03-18 stsp * A protocol scheme, hostname, port number (as a string), path on server,
30 a78567c6 2020-03-18 stsp * and a repository name. If the URI lacks some of this information return
31 a78567c6 2020-03-18 stsp * default values where applicable.
32 a78567c6 2020-03-18 stsp * The results of this function must be passed to other functions below.
33 a78567c6 2020-03-18 stsp * The caller should dispose of the returned values with free(3).
34 a78567c6 2020-03-18 stsp */
35 82ebf666 2020-03-18 stsp const struct got_error *got_fetch_parse_uri(char **, char **, char **,
36 82ebf666 2020-03-18 stsp char **, char **, const char *);
37 d9b4d0c0 2020-03-18 stsp
38 a78567c6 2020-03-18 stsp /*
39 a78567c6 2020-03-18 stsp * Attempt to open a connection to a server using the provided protocol
40 a78567c6 2020-03-18 stsp * scheme, hostname port number (as a string) and server-side path.
41 68999b92 2020-03-18 stsp * A verbosity level can be specified; it currently controls the amount
42 68999b92 2020-03-18 stsp * of -v options passed to ssh(1). If the level is -1 ssh(1) will be run
43 68999b92 2020-03-18 stsp * with the -q option.
44 a78567c6 2020-03-18 stsp * If successful return an open file descriptor for the connection which can
45 a78567c6 2020-03-18 stsp * be passed to other functions below, and must be disposed of with close(2).
46 a78567c6 2020-03-18 stsp */
47 20eb36d0 2020-03-18 stsp const struct got_error *got_fetch_connect(int *, const char *, const char *,
48 68999b92 2020-03-18 stsp const char *, const char *, int);
49 20eb36d0 2020-03-18 stsp
50 531c3985 2020-03-18 stsp /* A callback function which gets invoked with progress information to print. */
51 531c3985 2020-03-18 stsp typedef const struct got_error *(*got_fetch_progress_cb)(void *,
52 668a20f6 2020-03-18 stsp const char *, off_t, int, int, int, int);
53 531c3985 2020-03-18 stsp
54 a78567c6 2020-03-18 stsp /*
55 a78567c6 2020-03-18 stsp * Attempt to fetch a packfile from a server. This pack file will contain
56 a78567c6 2020-03-18 stsp * objects which that are not yet contained in the provided repository.
57 a78567c6 2020-03-18 stsp * Return the hash of the packfile (in form of an object ID) and lists of
58 a78567c6 2020-03-18 stsp * references and symbolic references learned from the server.
59 a78567c6 2020-03-18 stsp */
60 07e52fce 2020-03-18 stsp const struct got_error *got_fetch_pack(struct got_object_id **,
61 20eb36d0 2020-03-18 stsp struct got_pathlist_head *, struct got_pathlist_head *, int,
62 531c3985 2020-03-18 stsp struct got_repository *, got_fetch_progress_cb, void *);