Blame


1 bd3d9e54 2021-09-05 stsp /*
2 bd3d9e54 2021-09-05 stsp * Copyright (c) 2019 Ori Bernstein <ori@openbsd.org>
3 bd3d9e54 2021-09-05 stsp * Copyright (c) 2021 Stefan Sperling <stsp@openbsd.org>
4 bd3d9e54 2021-09-05 stsp *
5 bd3d9e54 2021-09-05 stsp * Permission to use, copy, modify, and distribute this software for any
6 bd3d9e54 2021-09-05 stsp * purpose with or without fee is hereby granted, provided that the above
7 bd3d9e54 2021-09-05 stsp * copyright notice and this permission notice appear in all copies.
8 bd3d9e54 2021-09-05 stsp *
9 bd3d9e54 2021-09-05 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 bd3d9e54 2021-09-05 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 bd3d9e54 2021-09-05 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 bd3d9e54 2021-09-05 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 bd3d9e54 2021-09-05 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 bd3d9e54 2021-09-05 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 bd3d9e54 2021-09-05 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 bd3d9e54 2021-09-05 stsp */
17 bd3d9e54 2021-09-05 stsp
18 bd3d9e54 2021-09-05 stsp #define GOT_CAPA_AGENT "agent"
19 bd3d9e54 2021-09-05 stsp #define GOT_CAPA_OFS_DELTA "ofs-delta"
20 bd3d9e54 2021-09-05 stsp #define GOT_CAPA_SIDE_BAND_64K "side-band-64k"
21 bd3d9e54 2021-09-05 stsp #define GOT_CAPA_REPORT_STATUS "report-status"
22 bd3d9e54 2021-09-05 stsp #define GOT_CAPA_DELETE_REFS "delete-refs"
23 13b2bc37 2022-10-23 stsp #define GOT_CAPA_NO_THIN "no-thin"
24 bd3d9e54 2021-09-05 stsp
25 bd3d9e54 2021-09-05 stsp #define GOT_SIDEBAND_PACKFILE_DATA 1
26 bd3d9e54 2021-09-05 stsp #define GOT_SIDEBAND_PROGRESS_INFO 2
27 bd3d9e54 2021-09-05 stsp #define GOT_SIDEBAND_ERROR_INFO 3
28 bd3d9e54 2021-09-05 stsp
29 13b2bc37 2022-10-23 stsp #define GOT_SIDEBAND_64K_PACKFILE_DATA_MAX (GOT_PKT_MAX - 17)
30 13b2bc37 2022-10-23 stsp
31 bd3d9e54 2021-09-05 stsp struct got_capability {
32 bd3d9e54 2021-09-05 stsp const char *key;
33 bd3d9e54 2021-09-05 stsp const char *value;
34 bd3d9e54 2021-09-05 stsp };
35 bd3d9e54 2021-09-05 stsp
36 bd3d9e54 2021-09-05 stsp struct got_pathlist_head;
37 bd3d9e54 2021-09-05 stsp
38 bd3d9e54 2021-09-05 stsp const struct got_error *got_gitproto_parse_refline(char **id_str,
39 bd3d9e54 2021-09-05 stsp char **refname, char **server_capabilities, char *line, int len);
40 13b2bc37 2022-10-23 stsp const struct got_error *got_gitproto_parse_want_line(char **id_str,
41 13b2bc37 2022-10-23 stsp char **capabilities, char *line, int len);
42 13b2bc37 2022-10-23 stsp const struct got_error *got_gitproto_parse_have_line(char **id_str,
43 13b2bc37 2022-10-23 stsp char *line, int len);
44 13b2bc37 2022-10-23 stsp const struct got_error *got_gitproto_parse_ref_update_line(char **old_id_str,
45 13b2bc37 2022-10-23 stsp char **new_id_str, char **refname, char **client_capabilities,
46 13b2bc37 2022-10-23 stsp char *line, size_t len);
47 bd3d9e54 2021-09-05 stsp const struct got_error *got_gitproto_match_capabilities(
48 bd3d9e54 2021-09-05 stsp char **common_capabilities,
49 13b2bc37 2022-10-23 stsp struct got_pathlist_head *symrefs, char *capabilities,
50 bd3d9e54 2021-09-05 stsp const struct got_capability my_capabilities[], size_t ncapa);
51 13b2bc37 2022-10-23 stsp const struct got_error *got_gitproto_append_capabilities(size_t *capalen,
52 13b2bc37 2022-10-23 stsp char *buf, size_t offset, size_t bufsize,
53 13b2bc37 2022-10-23 stsp const struct got_capability my_capabilities[], size_t ncapa);
54 13b2bc37 2022-10-23 stsp const struct got_error *got_gitproto_split_capabilities_str(
55 13b2bc37 2022-10-23 stsp struct got_capability **capabilities, size_t *ncapabilities,
56 13b2bc37 2022-10-23 stsp char *capabilities_str);