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 /* IANA assigned */
18 #define GOT_DEFAULT_GIT_PORT 9418
19 #define GOT_DEFAULT_GIT_PORT_STR "9418"
21 /*
22 * Attempt to parse a URI into the following parts:
23 * A protocol scheme, hostname, port number (as a string), path on server,
24 * and a repository name. If the URI lacks some of this information return
25 * default values where applicable.
26 * The results of this function must be passed to other functions below.
27 * The caller should dispose of the returned values with free(3).
28 */
29 const struct got_error *got_fetch_parse_uri(char **, char **, char **,
30 char **, char **, const char *);
32 /*
33 * Attempt to open a connection to a server using the provided protocol
34 * scheme, hostname port number (as a string) and server-side path.
35 * If successful return an open file descriptor for the connection which can
36 * be passed to other functions below, and must be disposed of with close(2).
37 */
38 const struct got_error *got_fetch_connect(int *, const char *, const char *,
39 const char *, const char *);
41 /* A callback function which gets invoked with progress information to print. */
42 typedef const struct got_error *(*got_fetch_progress_cb)(void *,
43 const char *, off_t, int, int);
45 /*
46 * Attempt to fetch a packfile from a server. This pack file will contain
47 * objects which that are not yet contained in the provided repository.
48 * Return the hash of the packfile (in form of an object ID) and lists of
49 * references and symbolic references learned from the server.
50 */
51 const struct got_error *got_fetch_pack(struct got_object_id **,
52 struct got_pathlist_head *, struct got_pathlist_head *, int,
53 struct got_repository *, got_fetch_progress_cb, void *);