-
Notifications
You must be signed in to change notification settings - Fork 5
/
PICA_proto.h
162 lines (118 loc) · 4.37 KB
/
PICA_proto.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
(c) Copyright 2012 - 2018 Anton Sviridenko
https://picapica.im
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* Protocol definitions */
#ifndef PICA_PROTO_H
#define PICA_PROTO_H
#define PICA_PROTO_VER_HIGH 0
#define PICA_PROTO_VER_LOW 5
#define PICA_C2CPROTO_VER_HIGH 0
#define PICA_C2CPROTO_VER_LOW 1
#define PICA_PROTO_CLIENT_VER_STRING PICA_STRINGIFY2(PICA_C2CPROTO_VER_HIGH, PICA_C2CPROTO_VER_LOW)
#define PICA_PROTO_VER_STRING PICA_STRINGIFY2(PICA_PROTO_VER_HIGH, PICA_PROTO_VER_LOW)
#define PICA_STRINGIFY2(H, L) PICA_STRINGIFY(H, L)
#define PICA_STRINGIFY(H, L) #H#L
#define PICA_PROTO_INITREQ 0xCA
#define PICA_PROTO_INITRESPOK 0x01
#define PICA_PROTO_VERDIFFER 0x02
#define PICA_PROTO_CONNREQOUTG 0x03
#define PICA_PROTO_CONNREQINC 0x04
#define PICA_PROTO_NOTFOUND 0x05
#define PICA_PROTO_CONNALLOW 0x06
#define PICA_PROTO_FOUND 0x07
#define PICA_PROTO_CONNDENY 0x08
#define PICA_PROTO_CLNODELISTREQ 0x09
#define PICA_PROTO_CLNODELIST 0x0A
#define PICA_PROTO_CONNID 0x20
#define PICA_PROTO_C2CCONNREQ 0xCC
#define PICA_PROTO_DIRECTC2C_ADDRLIST 0x0B
#define PICA_PROTO_DIRECTC2C_IPV4 0xA0
#define PICA_PROTO_DIRECTC2C_IPV6 0xA1
#define PICA_PROTO_DIRECTC2C_DNS 0xA2
#define PICA_PROTO_DIRECTC2C_FAILED 0x0C
#define PICA_PROTO_DIRECTC2C_SWITCH 0x0D
#define PICA_PROTO_MULTILOGIN 0x0E
#define PICA_PROTO_MSGUTF8 0x30
#define PICA_PROTO_MSGOK 0x40
#define PICA_PROTO_SENDFILEREQUEST 0x50
#define PICA_PROTO_ACCEPTEDFILE 0x51
#define PICA_PROTO_DENIEDFILE 0x52
#define PICA_PROTO_FILEFRAGMENT 0x53
#define PICA_PROTO_FILECONTROL 0x54
#define PICA_PROTO_FILECONTROL_VOID 0
#define PICA_PROTO_FILECONTROL_PAUSE 1
#define PICA_PROTO_FILECONTROL_RESUME 2
#define PICA_PROTO_FILECONTROL_CANCEL 3
#define PICA_PROTO_FILECONTROL_IOERROR 4
#define PICA_PROTO_PINGREQ 0x68
#define PICA_PROTO_PINGREP 0x69
#define PICA_PROTO_NODECONNREQ 0xCB
#define PICA_PROTO_NEWNODE_IPV4 0xA0
#define PICA_PROTO_NEWNODE_IPV6 0xA1
#define PICA_PROTO_NEWNODE_DNS 0xA2
#define PICA_PROTO_NODELIST 0xA4
#define PICA_PROTO_NODELISTREQ 0x90
#define PICA_PROTO_SEARCH 0xA5
#define PICA_PROTO_N2NFOUND 0xA8
#define PICA_PROTO_N2NFOUNDCACHE 0xA9
#define PICA_PROTO_N2NCONNREQOUTG 0xAA
#define PICA_PROTO_N2NALLOW 0xAB
#define PICA_PROTO_N2NNOTFOUND 0xB8
#define PICA_PROTO_N2NMSG 0xD0
//size
#define PICA_PROTO_INITREQ_SIZE 4
#define PICA_PROTO_INITRESPOK_SIZE 4
#define PICA_PROTO_VERDIFFER_SIZE 4
#define PICA_PROTO_CONNREQOUTG_SIZE 30
#define PICA_PROTO_CONNREQINC_SIZE 30
#define PICA_PROTO_NOTFOUND_SIZE 30
#define PICA_PROTO_CONNALLOW_SIZE 30
#define PICA_PROTO_FOUND_SIZE 30
#define PICA_PROTO_CONNDENY_SIZE 30
#define PICA_PROTO_CLNODELISTREQ_SIZE 4
#define PICA_PROTO_CONNID_SIZE 58
#define PICA_PROTO_C2CCONNREQ_SIZE 4
#define PICA_PROTO_DIRECTC2C_ADDRLIST_ITEM_IPV4_SIZE 7
#define PICA_PROTO_DIRECTC2C_ADDRLIST_ITEM_IPV6_SIZE 19
#define PICA_PROTO_DIRECTC2C_FAILED_SIZE 4
#define PICA_PROTO_DIRECTC2C_SWITCH_SIZE 4
#define PICA_PROTO_MSGOK_SIZE 4
#define PICA_PROTO_ACCEPTEDFILE_SIZE 4
#define PICA_PROTO_DENIEDFILE_SIZE 4
#define PICA_PROTO_FILECONTROL_SIZE 4
#define PICA_PROTO_PINGREQ_SIZE 4
#define PICA_PROTO_PINGREP_SIZE 4
#define PICA_PROTO_NODECONNREQ_SIZE 4
#define PICA_PROTO_NEWNODE_IPV4_SIZE 8
#define PICA_PROTO_NEWNODE_IPV6_SIZE 20
#define PICA_PROTO_NODELIST_ITEM_IPV4_SIZE 7
#define PICA_PROTO_NODELIST_ITEM_IPV6_SIZE 19
#define PICA_PROTO_NODELISTREQ_SIZE 4
#define PICA_PROTO_SEARCH_SIZE 30
#define PICA_PROTO_N2NFOUND_SIZE 30
#define PICA_PROTO_N2NCONNREQOUTG_SIZE 58
#define PICA_PROTO_N2NALLOW_SIZE 58
#define PICA_PROTO_N2NNOTFOUND_SIZE 58
#define PICA_PROTO_N2NMSG_MAXDATASIZE 65476
#define PICA_PROTO_C2CMSG_MAXDATASIZE 65532
#define PICA_PROTO_C2CMSG_MAXFILENAMESIZE 255
#define PICA_PROTO_MULTILOGIN_MAXSIGSIZE 65265
#define PICA_MULTILOGIN_PROHIBIT 0
#define PICA_MULTILOGIN_REPLACE 1
#define PICA_MULTILOGIN_ALLOW 2
struct PICA_proto_msg
{
unsigned char head[2];
unsigned char tail[0];
};
#endif