]> git.proxmox.com Git - libgit2.git/blame - src/pkt.h
Merge pull request #444 from carlosmn/fetch-fixes
[libgit2.git] / src / pkt.h
CommitLineData
f7fc68df 1/*
bb742ede 2 * Copyright (C) 2009-2011 the libgit2 contributors
f7fc68df 3 *
bb742ede
VM
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
f7fc68df
CMN
6 */
7
bdd18829
VM
8#ifndef INCLUDE_pkt_h__
9#define INCLUDE_pkt_h__
10
11#include "common.h"
0437d991 12#include "transport.h"
f7fc68df
CMN
13#include "git2/net.h"
14
15enum git_pkt_type {
16 GIT_PKT_CMD,
17 GIT_PKT_FLUSH,
b31803f3 18 GIT_PKT_REF,
f7fc68df 19 GIT_PKT_HAVE,
7e1a94db 20 GIT_PKT_ACK,
da290220
CMN
21 GIT_PKT_NAK,
22 GIT_PKT_PACK,
b76f7522 23 GIT_PKT_COMMENT,
7e1a94db
CMN
24};
25
26/* Used for multi-ack */
27enum git_ack_status {
28 GIT_ACK_NONE,
29 GIT_ACK_CONTINUE,
30 GIT_ACK_COMMON,
31 GIT_ACK_READY
f7fc68df
CMN
32};
33
34/* This would be a flush pkt */
f6e4a98a 35typedef struct {
f7fc68df 36 enum git_pkt_type type;
f6e4a98a 37} git_pkt;
f7fc68df
CMN
38
39struct git_pkt_cmd {
40 enum git_pkt_type type;
41 char *cmd;
42 char *path;
43 char *host;
44};
45
46/* This is a pkt-line with some info in it */
f6e4a98a 47typedef struct {
f7fc68df
CMN
48 enum git_pkt_type type;
49 git_remote_head head;
8b9e8de5 50 char *capabilities;
f6e4a98a 51} git_pkt_ref;
6a9597c5 52
7e1a94db
CMN
53/* Useful later */
54typedef struct {
55 enum git_pkt_type type;
56 git_oid oid;
57 enum git_ack_status status;
58} git_pkt_ack;
59
b76f7522
CMN
60typedef struct {
61 enum git_pkt_type type;
62 char comment[GIT_FLEX_ARRAY];
63} git_pkt_comment;
64
cbf742ac 65int git_pkt_parse_line(git_pkt **head, const char *line, const char **out, size_t len);
4e913309 66int git_pkt_send_flush(int s);
da290220 67int git_pkt_send_done(int s);
0437d991 68int git_pkt_send_wants(git_headarray *refs, git_transport_caps *caps, int fd);
7e1a94db 69int git_pkt_send_have(git_oid *oid, int fd);
be9fe679 70void git_pkt_free(git_pkt *pkt);
bdd18829
VM
71
72#endif