forked from libgit2/libgit2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkt.h
66 lines (56 loc) · 1.29 KB
/
pkt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Copyright (C) 2009-2011 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_pkt_h__
#define INCLUDE_pkt_h__
#include "common.h"
#include "transport.h"
#include "git2/net.h"
enum git_pkt_type {
GIT_PKT_CMD,
GIT_PKT_FLUSH,
GIT_PKT_REF,
GIT_PKT_HAVE,
GIT_PKT_ACK,
GIT_PKT_NAK,
GIT_PKT_PACK,
};
/* Used for multi-ack */
enum git_ack_status {
GIT_ACK_NONE,
GIT_ACK_CONTINUE,
GIT_ACK_COMMON,
GIT_ACK_READY
};
/* This would be a flush pkt */
typedef struct {
enum git_pkt_type type;
} git_pkt;
struct git_pkt_cmd {
enum git_pkt_type type;
char *cmd;
char *path;
char *host;
};
/* This is a pkt-line with some info in it */
typedef struct {
enum git_pkt_type type;
git_remote_head head;
char *capabilities;
} git_pkt_ref;
/* Useful later */
typedef struct {
enum git_pkt_type type;
git_oid oid;
enum git_ack_status status;
} git_pkt_ack;
int git_pkt_parse_line(git_pkt **head, const char *line, const char **out, size_t len);
int git_pkt_send_flush(int s);
int git_pkt_send_done(int s);
int git_pkt_send_wants(git_headarray *refs, git_transport_caps *caps, int fd);
int git_pkt_send_have(git_oid *oid, int fd);
void git_pkt_free(git_pkt *pkt);
#endif