-
Notifications
You must be signed in to change notification settings - Fork 0
/
messages.proto
57 lines (49 loc) · 1.02 KB
/
messages.proto
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
syntax = "proto3";
option go_package = "fserver-udp/proto";
/* Header byte */
enum Verb {
REQUEST = 0;
RESPONSE = 1;
CONFIRMATION = 2;
}
/* Possible confirmation status */
enum Result {
OK = 0;
FILE_NOT_FOUND = 1;
INVALID_PACKET_FORMAT = 2;
ERROR_CHECK_SUM = 3;
PACKET_MISS = 4;
INVALID_TOKEN = 5;
VALID_CHECKSUM = 6;
}
/*
request file message, client must send
0 -> REQUEST
[0, protobuf data encoded]
@param file_path file absolute path
*/
message RequestFile {
string file_path = 1;
}
/*
file chunk message, server must send after a request
1 -> RESPONSE
[1, protobuf data encoded]
@param chunk 128 bytes file chunk
@param token chunk hash identifier
*/
message FileChunk {
bytes chunk = 1;
string token = 2;
}
/*
confirmation message, basic server and client verification
2 -> CONFIRMATION
[2, protobuf data encoded]
@param result confirmation status
@param token token chunk identifier, checksum if result = 6
*/
message Confirmation {
Result result = 1;
string token = 2;
}