1 /////////////////////////////////////////////////////////////////////////
2 // $Id: rfb.h,v 1.6 2008/02/05 22:57:41 sshwarts Exp $
3 /////////////////////////////////////////////////////////////////////////
5 // Copyright (C) 2002 MandrakeSoft S.A.
9 // 75002 Paris - France
10 // http://www.linux-mandrake.com/
11 // http://www.mandrakesoft.com/
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2 of the License, or (at your option) any later version.
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 // This file includes the rfb spec header and the port numbers
29 // Define the RFB types
38 #define BX_RFB_PORT_MIN 5900
39 #define BX_RFB_PORT_MAX 5949
42 // RFB Protocol definitions.
43 // Please refer to the specification document
44 // http://www.realvnc.com/docs/rfbproto.pdf
54 #define rfbRectangleSize (sizeof(rfbRectangle))
71 #define rfbPixelFormatSize (sizeof(rfbPixelFormat))
74 #define rfbProtocolVersionFormat "RFB %03d.%03d\n"
75 #define rfbServerProtocolMajorVersion 3
76 #define rfbServerProtocolMinorVersion 3
78 typedef char rfbProtocolVersionMessage
[12 + 1]; // Add 1 for null byte
79 #define rfbProtocolVersionMessageSize (sizeof(rfbProtocolVersionMessage) - 1) // Real Message Length
82 #define rfbSecurityConnFailed 0
83 #define rfbSecurityNone 1
84 #define rfbSecurityVncAuth 2
86 #define rfbSecurityVncAuthOK 0
87 #define rfbSecurityVncAuthFailed 1
88 #define rfbSecurityVncAuthTooMany 2 // No longer used (3.7)
93 } rfbClientInitMessage
;
95 #define rfbClientInitMessageSize (sizeof(rfbClientInitMessage))
100 U16 framebufferHeight
;
101 rfbPixelFormat serverPixelFormat
;
104 } rfbServerInitMessage
;
106 #define rfbServerInitMessageSize (sizeof(rfbServerInitMessage))
108 // Client to Server message types
109 #define rfbSetPixelFormat 0
110 #define rfbFixColourMapEntries 1
111 #define rfbSetEncodings 2
112 #define rfbFramebufferUpdateRequest 3
113 #define rfbKeyEvent 4
114 #define rfbPointerEvent 5
115 #define rfbClientCutText 6
118 // Client to Server messages
123 rfbPixelFormat pixelFormat
;
124 } rfbSetPixelFormatMessage
;
126 #define rfbSetPixelFormatMessageSize (sizeof(rfbSetPixelFormatMessage))
134 } rfbFixColourMapEntriesMessage
;
136 #define rfbFixColourMapEntriesMessageSize (sizeof(rfbFixColourMapEntriesMessage))
142 U16 numberOfEncodings
;
143 } rfbSetEncodingsMessage
;
145 #define rfbSetEncodingsMessageSize (sizeof(rfbSetEncodingsMessage))
155 } rfbFramebufferUpdateRequestMessage
;
157 #define rfbFramebufferUpdateRequestMessageSize (sizeof(rfbFramebufferUpdateRequestMessage))
165 } rfbKeyEventMessage
;
167 #define rfbKeyEventMessageSize (sizeof(rfbKeyEventMessage))
175 } rfbPointerEventMessage
;
177 #define rfbPointerEventMessageSize (sizeof(rfbPointerEventMessage))
179 #define rfbButton1Mask 1
180 #define rfbButton2Mask 2
181 #define rfbButton3Mask 4
189 } rfbClientCutTextMessage
;
191 #define rfbClientCutTextMessageSize (sizeof(rfbClientCutTextMessage))
193 // Fill in correct names
195 rfbSetPixelFormatMessage spf
;
196 rfbFixColourMapEntriesMessage fcme
;
197 rfbSetEncodingsMessage se
;
198 rfbFramebufferUpdateRequestMessage fur
;
199 rfbKeyEventMessage ke
;
200 rfbPointerEventMessage pe
;
201 rfbClientCutTextMessage cct
;
202 } rfbClientToServerMessage
;
205 // Server to Client message types
206 #define rfbFramebufferUpdate 0
207 #define rfbSetColourMapEntries 1
209 #define rfbServerCutText 3
212 #define rfbEncodingRaw 0
213 #define rfbEncodingCopyRect 1
214 #define rfbEncodingRRE 2
215 #define rfbEncodingCoRRE 4
216 #define rfbEncodingHextile 5
217 #define rfbEncodingZRLE 16
218 #define rfbEncodingCursor 0xffffff11
219 #define rfbEncodingDesktopSize 0xffffff21
220 #define rfbEncodingZlib 6
221 #define rfbEncodingTight 7
222 #define rfbEncodingZlibHex 8
223 #define rfbEncodingTightOption00 0xffffff00 // to 0xffffffff except 0xffffff11 and 0xffffff21
224 #define rfbEncodingTightOption01 0xffffff01
225 #define rfbEncodingTightOption02 0xffffff02
226 #define rfbEncodingTightOption03 0xffffff03
227 #define rfbEncodingTightOption04 0xffffff04
228 #define rfbEncodingTightOption05 0xffffff05
229 #define rfbEncodingTightOption06 0xffffff06
230 #define rfbEncodingTightOption07 0xffffff07
231 #define rfbEncodingTightOption08 0xffffff08
232 #define rfbEncodingTightOption09 0xffffff09
233 #define rfbEncodingTightOption0a 0xffffff0a
234 #define rfbEncodingTightOption0b 0xffffff0b
235 #define rfbEncodingTightOption0c 0xffffff0c
236 #define rfbEncodingTightOption0d 0xffffff0d
237 #define rfbEncodingTightOption0e 0xffffff0e
238 #define rfbEncodingTightOption0f 0xffffff0f
239 #define rfbEncodingTightOption10 0xffffff10
240 #define rfbEncodingTightOption12 0xffffff12
241 #define rfbEncodingTightOption13 0xffffff13
242 #define rfbEncodingTightOption14 0xffffff14
243 #define rfbEncodingTightOption15 0xffffff15
244 #define rfbEncodingTightOption16 0xffffff16
245 #define rfbEncodingTightOption17 0xffffff17
246 #define rfbEncodingTightOption18 0xffffff18
247 #define rfbEncodingTightOption19 0xffffff19
248 #define rfbEncodingTightOption1a 0xffffff1a
249 #define rfbEncodingTightOption1b 0xffffff1b
250 #define rfbEncodingTightOption1c 0xffffff1c
251 #define rfbEncodingTightOption1d 0xffffff1d
252 #define rfbEncodingTightOption1e 0xffffff1e
253 #define rfbEncodingTightOption1f 0xffffff1f
254 #define rfbEncodingTightOption20 0xffffff20
261 rfbEncodingType rfbEncodings
[] = {
262 {rfbEncodingRaw
, "Raw"},
263 {rfbEncodingCopyRect
, "CopyRect"},
264 {rfbEncodingRRE
, "RRE"},
265 {rfbEncodingCoRRE
, "CoRRE"},
266 {rfbEncodingHextile
, "Hextile"},
267 {rfbEncodingZRLE
, "ZRLE"},
268 {rfbEncodingCursor
, "Cursor"},
269 {rfbEncodingDesktopSize
, "DesktopSize"},
270 {rfbEncodingZlib
, "Zlib"},
271 {rfbEncodingTight
, "Tight"},
272 {rfbEncodingZlibHex
, "ZlibHex"},
273 {rfbEncodingTightOption00
, "TightOption00"},
274 {rfbEncodingTightOption01
, "TightOption01"},
275 {rfbEncodingTightOption02
, "TightOption02"},
276 {rfbEncodingTightOption03
, "TightOption03"},
277 {rfbEncodingTightOption04
, "TightOption04"},
278 {rfbEncodingTightOption05
, "TightOption05"},
279 {rfbEncodingTightOption06
, "TightOption06"},
280 {rfbEncodingTightOption07
, "TightOption07"},
281 {rfbEncodingTightOption08
, "TightOption08"},
282 {rfbEncodingTightOption09
, "TightOption09"},
283 {rfbEncodingTightOption0a
, "TightOption0a"},
284 {rfbEncodingTightOption0b
, "TightOption0b"},
285 {rfbEncodingTightOption0c
, "TightOption0c"},
286 {rfbEncodingTightOption0d
, "TightOption0d"},
287 {rfbEncodingTightOption0e
, "TightOption0e"},
288 {rfbEncodingTightOption0f
, "TightOption0f"},
289 {rfbEncodingTightOption10
, "TightOption10"},
290 {rfbEncodingTightOption12
, "TightOption12"},
291 {rfbEncodingTightOption13
, "TightOption13"},
292 {rfbEncodingTightOption14
, "TightOption14"},
293 {rfbEncodingTightOption15
, "TightOption15"},
294 {rfbEncodingTightOption16
, "TightOption16"},
295 {rfbEncodingTightOption17
, "TightOption17"},
296 {rfbEncodingTightOption18
, "TightOption18"},
297 {rfbEncodingTightOption19
, "TightOption19"},
298 {rfbEncodingTightOption1a
, "TightOption1a"},
299 {rfbEncodingTightOption1b
, "TightOption1b"},
300 {rfbEncodingTightOption1c
, "TightOption1c"},
301 {rfbEncodingTightOption1d
, "TightOption1d"},
302 {rfbEncodingTightOption1e
, "TightOption1e"},
303 {rfbEncodingTightOption1f
, "TightOption1f"},
304 {rfbEncodingTightOption20
, "TightOption20"},
307 #define rfbEncodingsCount (sizeof(rfbEncodings) / sizeof(rfbEncodingType))
309 // Server To Client Messages
314 U16 numberOfRectangles
;
315 } rfbFramebufferUpdateMessage
;
317 #define rfbFramebufferUpdateMessageSize (sizeof(rfbFramebufferUpdateMessage))
321 } rfbFramebufferUpdateRectHeader
;
323 #define rfbFramebufferUpdateRectHeaderSize (sizeof(rfbFramebufferUpdateRectHeader))
330 #define rfbCopyRectSize (sizeof(rfbCopyRect))
333 /* typedef struct { */
334 /* U32 numberOfSubrectangles; */
335 /* PIXEL backgroundPixelValue; */
336 /* } rfbRREHeader; */
338 /* #define rfbRREHeaderSize (sizeof(rfbRREHeader)) */
341 /* typedef struct { */
342 /* U32 numberOfSubrectangles; */
343 /* PIXEL backgroundPixelValue; */
344 /* } rfbCoRRERectangle; */
346 /* #define rfbCoRRERectangleSize (sizeof(rfbCoRRERectangle)) */
349 #define rfbHextileRaw (1 << 0)
350 #define rfbHextileBackgroundSpecified (1 << 1)
351 #define rfbHextileForegroundSpecified (1 << 2)
352 #define rfbHextileAnySubrects (1 << 3)
353 #define rfbHextileSubrectsColoured (1 << 4)
355 #define rfbHextilePackXY(x,y) (((x) << 4) | (y))
356 #define rfbHextilePackWH(w,h) ((((w)-1) << 4) | ((h)-1))
357 #define rfbHextileExtractX(byte) ((byte) >> 4)
358 #define rfbHextileExtractY(byte) ((byte) & 0xf)
359 #define rfbHextileExtractW(byte) (((byte) >> 4) + 1)
360 #define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)
368 } rfbSetColourMapEntriesMessage
;
370 #define rfbSetColourMapEntriesMessageSize (sizeof(rfbSetColourMapEntriesMessage))
378 #define rfbBellMessageSize (sizeof(rfbBellMessage))
387 } rfbServerCutTextMessage
;
389 #define rfbServerCutTextMessageSize (sizeof(rfbServerCutTextMessage))
391 // Fill in correct names
393 rfbFramebufferUpdateMessage fu
;
395 rfbServerCutTextMessage sct
;
396 } rfbServerToClientMessage
;