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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
/*
Copyright (C) SEIKO EPSON CORPORATION 2002-2003. All Rights Reserved.
3-3-5, Owa, Suwa-shi Nagano-ken, 392-8502 Japan
Phone: +81-266-52-3131
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License aint with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !defined(__ECONPROTOCOL__)
#define __ECONPROTOCOL__
#include <stdint.h>
#define ECON_PORTNUMBER 3620
#define ECON_MAGICNUM_SIZE 4
#define ECON_IPADDRESS_SIZE 4
#define ECON_UNIQINFO_LENGTH 6
#define ECON_PROJNAME_MAXLEN 32
#define ECON_KEYWORD_MAXLEN 16
#define ECON_ENCRYPTION_MAXLEN 8
#ifdef LITTLE_ENDIAN_HOST
#define Swap16IfLE(s) \
((CARD16) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)))
#define Swap32IfLE(l) \
((CARD32) ((((l) & 0xff000000) >> 24) | \
(((l) & 0x00ff0000) >> 8) | \
(((l) & 0x0000ff00) << 8) | \
(((l) & 0x000000ff) << 24)))
#else
#define Swap16IfLE(s) (s)
#define Swap32IfLE(l) (l)
#endif
#define ECON_MAGIC_NUMBER "EEMP"
#define ECON_PROTO_VERSION "0100"
#define ECON_PROTOVER_MAXLEN 4
enum e_proj_state {
E_PSTAT_NOUSE = 1,
E_PSTAT_USING = 2,
E_PSTAT_APPUSING = 3
};
enum _e_EmpCommand {
E_CMD_EASYSEARCH = 1,
E_CMD_IPSEARCH = 2,
E_CMD_CLIENTINFO = 3,
E_CMD_REQCONNECT = 4,
E_CMD_CONNECTED = 5,
E_CMD_REQRESTART = 6,
E_CMD_FINISHRESTART = 7,
E_CMD_DISCONCLIENT = 8,
E_CMD_INTERRUPT = 9,
E_CMD_KEEPALIVE = 10,
E_CMD_SENDREQUESTS = 12,
E_CMD_CLIENTERROR = 13,
E_CMD_RESENDFULLSCRID = 14,
E_CMD_DISPLAYWAIT = 15,
E_CMD_SENDKEY = 16,
E_CMD_22 = 22,
E_CMD_25 = 25
};
enum _e_ProjType {
e_ptype_IM_X = 1,
e_ptype_IM_XP1 = 2,
e_pType_IM_XP4 = 3
};
enum _e_SendReq {
e_sendreq_OK = 1,
e_sendreq_NG = 2
};
enum _e_Keyword {
e_keyword_nouse = 0,
e_keyword_use = 1
};
enum _e_Encryption {
e_encrypt_nouse = 0,
e_encrypt_use = 1
};
enum _e_Error {
e_error_keyword = 0
};
typedef struct {
uint8_t bitsPerPixel;
uint8_t depth;
uint8_t bigEndian;
uint8_t trueColour;
uint16_t redMax;
uint16_t greenMax;
uint16_t blueMax;
uint8_t redShift;
uint8_t greenShift;
uint8_t blueShift;
uint8_t pad1;
uint16_t pad2;
} rfbPixelFormat;
typedef struct {
uint16_t framebufferWidth;
uint16_t framebufferHeight;
rfbPixelFormat format;
uint32_t nameLength;
} rfbServerInitMsg;
typedef struct {
char projName[ECON_PROJNAME_MAXLEN];
uint8_t projState;
uint8_t useKeyword;
uint8_t displayType;
uint8_t implicit_padding;
uint16_t unknown_field_1; /* value: 256 */
} e_command_clientinfo;
typedef struct {
uint8_t useEncryption;
uint8_t EncPassword[ECON_ENCRYPTION_MAXLEN];
uint8_t subnetMask[ECON_IPADDRESS_SIZE];
uint8_t gateAddress[ECON_IPADDRESS_SIZE];
uint8_t unknown_field_1; /* value: 0x02 */
uint8_t unknown_field_2; /* value: 0x01 */
uint8_t unknown_field_3; /* value: 0x03 */
rfbServerInitMsg vnesInitMsg;
} e_command_reqconnect;
typedef struct {
char projName[ECON_PROJNAME_MAXLEN];
uint8_t projState;
} e_command_connected;
typedef struct {
uint8_t errorNo;
} e_command_clienterror;
typedef struct {
uint32_t resendID;
} e_command_resendfullscrid;
typedef struct {
uint32_t keyID;
} e_command_sendkey;
typedef struct {
uint16_t unknown_field1;
uint16_t unknown_field2;
uint16_t width;
uint16_t height;
} e_command_cmd22;
typedef struct {
uint32_t unknown_field1;
uint32_t unknown_field2;
} e_command_cmd25;
struct econ_header {
char magicnum[ECON_MAGICNUM_SIZE];
char version[ECON_PROTOVER_MAXLEN];
uint8_t IPaddress[ECON_IPADDRESS_SIZE];
uint32_t commandID;
uint32_t datasize;
};
struct econ_command {
uint8_t recordCount;
uint8_t implicit_padding[3];
union e_commands {
e_command_clientinfo clientinfo;
e_command_reqconnect reqconnect;
e_command_connected connected;
e_command_clienterror clienterror;
e_command_resendfullscrid resendid;
e_command_sendkey sendkey;
e_command_cmd22 cmd22;
e_command_cmd25 cmd25;
} command;
};
struct econ_record {
uint8_t projUniqInfo[ECON_UNIQINFO_LENGTH];
uint8_t projKeyword[ECON_KEYWORD_MAXLEN];
uint8_t IPaddress[ECON_IPADDRESS_SIZE];
};
#endif
|