portable: release 0.90
[got-portable.git] / include / got_fetch.h
blobd14b5f1032910d954b7d663f20e1d8e0b04b216c
1 /*
2 * Copyright (c) 2018, 2019 Ori Bernstein <ori@openbsd.org>
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.
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.
17 #define GOT_FETCH_DEFAULT_REMOTE_NAME "origin"
20 * Attempt to open a connection to a server using the provided protocol
21 * scheme, hostname port number (as a string) and server-side path.
22 * A verbosity level can be specified; it currently controls the amount
23 * of -v options passed to ssh(1). If the level is -1 ssh(1) will be run
24 * with the -q option.
26 * If successful return an open file descriptor for the connection which can
27 * be passed to other functions below, and must be disposed of with close(2).
29 * If an ssh(1) process was started return its PID as well, in which case
30 * the caller should eventually send SIGTERM to the procress and wait for
31 * the process to exit with waitpid(2). Otherwise, return PID -1.
33 const struct got_error *got_fetch_connect(pid_t *, int *, const char *,
34 const char *, const char *, const char *, int);
36 /* A callback function which gets invoked with progress information to print. */
37 typedef const struct got_error *(*got_fetch_progress_cb)(void *,
38 const char *, off_t, int, int, int, int);
41 * Attempt to fetch a packfile from a server. This pack file will contain
42 * objects which that are not yet contained in the provided repository.
43 * Return the hash of the packfile (in form of an object ID) and lists of
44 * references and symbolic references learned from the server.
46 const struct got_error *got_fetch_pack(struct got_object_id **,
47 struct got_pathlist_head *, struct got_pathlist_head *, const char *,
48 int, int, struct got_pathlist_head *, struct got_pathlist_head *,
49 int, int, int, struct got_repository *, const char *, const char *,
50 int, got_fetch_progress_cb, void *);