2 * Routines for VNC dissection (Virtual Network Computing)
3 * Copyright 2005, Ulf Lamping <ulf.lamping@web.de>
4 * Copyright 2006-2007, Stephen Fisher (see AUTHORS file)
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 /* Dissection of the VNC (Virtual Network Computing) network traffic.
15 * All versions of RealVNC and TightVNC are supported.
16 * Note: The addition of TightVNC support is not yet complete.
18 * Several VNC implementations available, see:
19 * http://www.realvnc.com/
20 * http://www.tightvnc.com/
21 * http://ultravnc.sourceforge.net/
25 * The protocol itself is known as RFB - Remote Frame Buffer Protocol.
27 * This code is based on the protocol specification published in RFC 6143
28 * and the RealVNC free edition & TightVNC source code
29 * Note: rfbproto.rst [ https://github.com/svn2github/tigervnc/blob/master/rfbproto/rfbproto.rst ]
30 * seems to have additional information over rfbproto.pdf.
34 * This dissector adds items to the protocol tree before completing re-assembly
35 * of a VNC PDU which extends over more than one TCP segment.
36 * This is not correct. As noted in Bug #5366 (and elsewhere), the correct method
38 * "one must walk over all the message first, to determine its exact length
39 * (one of the characteristics of the protocol, hard to determine prior to
40 * going over the message what its final size would be)".
42 * The original method of reassembly:
43 * When more data is needed to continue dissecting a PDU, repeatedly request
44 * a few additional bytes (for one or a few more fields of the PDU).
45 * This resulted in 'one-pass' tshark dissection redissecting
46 * the PDU repeatedly many, many times with each time dissecting
47 * the PDU with one or a few more additional fields.
48 * This generated *lots* of (repeated) output since a reassembled
49 * VNC PDU can contain many fields (each of short length).
50 * It also resulted in the fragment table containing many, many small fragments
51 * for VNC PDUS containing many small fields.
53 * The current reassembly method:
54 * Use DESEGMENT_ONE_MORE_SEGMENT when requesting additional data for a PDU.
55 * This significantly reduces the amount of repeated data in a dissection,
56 * but will still result in "partial" repeated dissection output in some cases.
59 /* (Somewhat random notes while reviewing the code):
60 Check types, etc against IANA list
61 Optimize: Do col_set(..., COL_INFO) once (after fetching message type & before dispatching ?)
62 Dispatch via a message table (instead of using a switch(...)
63 Msg type 150: client-server: enable/disable (1+9 bytes); server-client: endofContinousUpdates(1+0 bytes) ?
68 #include <epan/packet.h>
69 #include <epan/conversation.h>
70 #include <epan/prefs.h>
71 #include <epan/expert.h>
72 #include <epan/proto_data.h>
74 #include <wsutil/array.h>
75 #include "packet-x11.h" /* This contains the extern for the X11 value_string_ext
76 * "x11_keysym_vals_source_ext" that VNC uses. */
78 void proto_register_vnc(void);
81 VNC_SECURITY_TYPE_INVALID
= 0,
82 VNC_SECURITY_TYPE_NONE
= 1,
83 VNC_SECURITY_TYPE_VNC
= 2,
84 VNC_SECURITY_TYPE_RA2
= 5,
85 VNC_SECURITY_TYPE_RA2ne
= 6,
86 VNC_SECURITY_TYPE_TIGHT
= 16,
87 VNC_SECURITY_TYPE_ULTRA
= 17,
88 VNC_SECURITY_TYPE_TLS
= 18,
89 VNC_SECURITY_TYPE_VENCRYPT
= 19,
90 VNC_SECURITY_TYPE_GTK_VNC_SASL
= 20,
91 VNC_SECURITY_TYPE_MD5_HASH_AUTH
= 21,
92 VNC_SECURITY_TYPE_XVP
= 22,
93 VNC_SECURITY_TYPE_ARD
= 30,
94 VNC_TIGHT_AUTH_TGHT_ULGNAUTH
= 119,
95 VNC_TIGHT_AUTH_TGHT_XTRNAUTH
= 130,
96 VNC_VENCRYPT_AUTH_PLAIN
= 256,
97 VNC_VENCRYPT_AUTH_TLSNONE
= 257,
98 VNC_VENCRYPT_AUTH_TLSVNC
= 258,
99 VNC_VENCRYPT_AUTH_TLSPLAIN
= 259,
100 VNC_VENCRYPT_AUTH_X509_NONE
= 260,
101 VNC_VENCRYPT_AUTH_X509_VNC
= 261,
102 VNC_VENCRYPT_AUTH_X509_PLAIN
= 262,
103 VNC_VENCRYPT_AUTH_TLSSASL
= 263,
104 VNC_VENCRYPT_AUTH_X509_SASL
= 264
105 } vnc_security_types_e
;
107 static const value_string vnc_security_types_vs
[] = {
108 { VNC_SECURITY_TYPE_INVALID
, "Invalid" },
109 { VNC_SECURITY_TYPE_NONE
, "None" },
110 { VNC_SECURITY_TYPE_VNC
, "VNC" },
111 { VNC_SECURITY_TYPE_RA2
, "RA2" },
112 { VNC_SECURITY_TYPE_RA2ne
, "RA2ne" },
113 { VNC_SECURITY_TYPE_TIGHT
, "Tight" },
114 { VNC_SECURITY_TYPE_ULTRA
, "Ultra" },
115 { VNC_SECURITY_TYPE_TLS
, "TLS" },
116 { VNC_SECURITY_TYPE_VENCRYPT
, "VeNCrypt" },
117 { VNC_SECURITY_TYPE_GTK_VNC_SASL
, "GTK-VNC SASL" },
118 { VNC_SECURITY_TYPE_ARD
, "Apple Remote Desktop" },
122 static const value_string vnc_vencrypt_auth_types_vs
[] = {
123 { VNC_SECURITY_TYPE_NONE
, "None" },
124 { VNC_SECURITY_TYPE_VNC
, "VNC" },
125 { VNC_VENCRYPT_AUTH_PLAIN
, "Plain" },
126 { VNC_VENCRYPT_AUTH_TLSNONE
, "TLS None" },
127 { VNC_VENCRYPT_AUTH_TLSVNC
, "TLS VNC" },
128 { VNC_VENCRYPT_AUTH_TLSPLAIN
, "TLS Plain" },
129 { VNC_VENCRYPT_AUTH_X509_NONE
, "X.509 None" },
130 { VNC_VENCRYPT_AUTH_X509_VNC
, "X.509 VNC" },
131 { VNC_VENCRYPT_AUTH_X509_PLAIN
, "X.509 Plain" },
132 { VNC_VENCRYPT_AUTH_TLSSASL
, "TLS SASL" },
133 { VNC_VENCRYPT_AUTH_X509_SASL
, "X.509 SASL" },
137 static const true_false_string auth_result_tfs
= {
144 VNC_CLIENT_MESSAGE_TYPE_SET_PIXEL_FORMAT
= 0,
145 VNC_CLIENT_MESSAGE_TYPE_SET_ENCODINGS
= 2,
146 VNC_CLIENT_MESSAGE_TYPE_FRAMEBUF_UPDATE_REQ
= 3,
147 VNC_CLIENT_MESSAGE_TYPE_KEY_EVENT
= 4,
148 VNC_CLIENT_MESSAGE_TYPE_POINTER_EVENT
= 5,
149 VNC_CLIENT_MESSAGE_TYPE_CLIENT_CUT_TEXT
= 6,
151 VNC_CLIENT_MESSAGE_TYPE_MIRRORLINK
= 128,
152 VNC_CLIENT_MESSAGE_TYPE_ENABLE_CONTINUOUS_UPDATES
= 150, /* TightVNC */
153 VNC_CLIENT_MESSAGE_TYPE_FENCE
= 248, /* TigerVNC */
154 VNC_CLIENT_MESSAGE_TYPE_XVP
= 250,
155 VNC_CLIENT_MESSAGE_TYPE_SETR_DESKTOP_SIZE
= 251,
156 VNC_CLIENT_MESSAGE_TYPE_TIGHT
= 252,
157 VNC_CLIENT_MESSAGE_TYPE_GII
= 253,
158 VNC_CLIENT_MESSAGE_TYPE_QEMU
= 255
159 } vnc_client_message_types_e
;
161 static const value_string vnc_client_message_types_vs
[] = {
163 { VNC_CLIENT_MESSAGE_TYPE_SET_PIXEL_FORMAT
, "Set Pixel Format" },
164 { VNC_CLIENT_MESSAGE_TYPE_SET_ENCODINGS
, "Set Encodings" },
165 { VNC_CLIENT_MESSAGE_TYPE_FRAMEBUF_UPDATE_REQ
, "Framebuffer Update Request" },
166 { VNC_CLIENT_MESSAGE_TYPE_KEY_EVENT
, "Key Event" },
167 { VNC_CLIENT_MESSAGE_TYPE_POINTER_EVENT
, "Pointer Event" },
168 { VNC_CLIENT_MESSAGE_TYPE_CLIENT_CUT_TEXT
, "Cut Text" },
170 { VNC_CLIENT_MESSAGE_TYPE_MIRRORLINK
, "MirrorLink" },
171 { VNC_CLIENT_MESSAGE_TYPE_ENABLE_CONTINUOUS_UPDATES
, "Enable Continuous Updates" },
172 { VNC_CLIENT_MESSAGE_TYPE_FENCE
, "Fence" },
173 { VNC_CLIENT_MESSAGE_TYPE_XVP
, "Xvp" },
174 { VNC_CLIENT_MESSAGE_TYPE_SETR_DESKTOP_SIZE
, "Setr Desktop Size" },
175 { VNC_CLIENT_MESSAGE_TYPE_TIGHT
, "Tight" },
176 { VNC_CLIENT_MESSAGE_TYPE_GII
, "Gii" },
177 { VNC_CLIENT_MESSAGE_TYPE_QEMU
, "Qemu" },
182 VNC_SERVER_MESSAGE_TYPE_FRAMEBUFFER_UPDATE
= 0,
183 VNC_SERVER_MESSAGE_TYPE_SET_COLORMAP_ENTRIES
= 1,
184 VNC_SERVER_MESSAGE_TYPE_RING_BELL
= 2,
185 VNC_SERVER_MESSAGE_TYPE_CUT_TEXT
= 3,
186 VNC_SERVER_MESSAGE_TYPE_MIRRORLINK
= 128,
187 VNC_SERVER_MESSAGE_TYPE_END_CONTINUOUS_UPDATES
= 150, /* TightVNC */
188 VNC_SERVER_MESSAGE_TYPE_FENCE
= 248, /* TigerVNC */
189 VNC_SERVER_MESSAGE_TYPE_XVP
= 250,
190 VNC_SERVER_MESSAGE_TYPE_TIGHT
= 252,
191 VNC_SERVER_MESSAGE_TYPE_GII
= 253,
192 VNC_SERVER_MESSAGE_TYPE_QEMU
= 255
193 } vnc_server_message_types_e
;
195 static const value_string vnc_server_message_types_vs
[] = {
196 { VNC_SERVER_MESSAGE_TYPE_FRAMEBUFFER_UPDATE
, "Framebuffer Update" },
197 { VNC_SERVER_MESSAGE_TYPE_SET_COLORMAP_ENTRIES
, "Set Colormap Entries" },
198 { VNC_SERVER_MESSAGE_TYPE_RING_BELL
, "Ring Bell" },
199 { VNC_SERVER_MESSAGE_TYPE_CUT_TEXT
, "Cut Text" },
200 { VNC_SERVER_MESSAGE_TYPE_MIRRORLINK
, "MirrorLink" },
201 { VNC_SERVER_MESSAGE_TYPE_END_CONTINUOUS_UPDATES
, "End Continuous Updates" },
202 { VNC_SERVER_MESSAGE_TYPE_FENCE
, "Fence" },
203 { VNC_SERVER_MESSAGE_TYPE_XVP
, "Xvp" },
204 { VNC_SERVER_MESSAGE_TYPE_TIGHT
, "Tight" },
205 { VNC_SERVER_MESSAGE_TYPE_GII
, "Gii" },
206 { VNC_SERVER_MESSAGE_TYPE_QEMU
, "Qemu" },
211 #define VNC_ENCODING_TYPE_DESKTOP_SIZE 0xFFFFFF21
212 #define VNC_ENCODING_TYPE_LAST_RECT 0xFFFFFF20
213 #define VNC_ENCODING_TYPE_POINTER_POS 0xFFFFFF18
214 #define VNC_ENCODING_TYPE_RICH_CURSOR 0xFFFFFF11
215 #define VNC_ENCODING_TYPE_X_CURSOR 0xFFFFFF10
216 #define VNC_ENCODING_TYPE_RAW 0
217 #define VNC_ENCODING_TYPE_COPY_RECT 1
218 #define VNC_ENCODING_TYPE_RRE 2
219 #define VNC_ENCODING_TYPE_CORRE 4
220 #define VNC_ENCODING_TYPE_HEXTILE 5
221 #define VNC_ENCODING_TYPE_ZLIB 6
222 #define VNC_ENCODING_TYPE_TIGHT 7
223 #define VNC_ENCODING_TYPE_ZLIBHEX 8
224 #define VNC_ENCODING_TYPE_ULTRA 9
225 #define VNC_ENCODING_TYPE_TRLE 15
226 #define VNC_ENCODING_TYPE_RLE 16
227 #define VNC_ENCODING_TYPE_HITACHI_ZYWRLE 17
228 #define VNC_ENCODING_TYPE_JPEG_0 -32
229 #define VNC_ENCODING_TYPE_JPEG_1 -31
230 #define VNC_ENCODING_TYPE_JPEG_2 -30
231 #define VNC_ENCODING_TYPE_JPEG_3 -29
232 #define VNC_ENCODING_TYPE_JPEG_4 -28
233 #define VNC_ENCODING_TYPE_JPEG_5 -27
234 #define VNC_ENCODING_TYPE_JPEG_6 -26
235 #define VNC_ENCODING_TYPE_JPEG_7 -25
236 #define VNC_ENCODING_TYPE_JPEG_8 -24
237 #define VNC_ENCODING_TYPE_JPEG_9 -23
238 #define VNC_ENCODING_TYPE_COMPRESSION_0 0xFFFFFF00
239 #define VNC_ENCODING_TYPE_COMPRESSION_1 0xFFFFFF01
240 #define VNC_ENCODING_TYPE_COMPRESSION_2 0xFFFFFF02
241 #define VNC_ENCODING_TYPE_COMPRESSION_3 0xFFFFFF03
242 #define VNC_ENCODING_TYPE_COMPRESSION_4 0xFFFFFF04
243 #define VNC_ENCODING_TYPE_COMPRESSION_5 0xFFFFFF05
244 #define VNC_ENCODING_TYPE_COMPRESSION_6 0xFFFFFF06
245 #define VNC_ENCODING_TYPE_COMPRESSION_7 0xFFFFFF07
246 #define VNC_ENCODING_TYPE_COMPRESSION_8 0xFFFFFF08
247 #define VNC_ENCODING_TYPE_COMPRESSION_9 0xFFFFFF09
248 #define VNC_ENCODING_TYPE_WMVi 0x574D5669
249 #define VNC_ENCODING_TYPE_CACHE 0xFFFF0000
250 #define VNC_ENCODING_TYPE_CACHE_ENABLE 0xFFFF0001
251 #define VNC_ENCODING_TYPE_XOR_ZLIB 0xFFFF0002
252 #define VNC_ENCODING_TYPE_XOR_MONO_ZLIB 0xFFFF0003
253 #define VNC_ENCODING_TYPE_XOR_MULTI_ZLIB 0xFFFF0004
254 #define VNC_ENCODING_TYPE_SOLID_COLOR 0xFFFF0005
255 #define VNC_ENCODING_TYPE_XOR_ENABLE 0xFFFF0006
256 #define VNC_ENCODING_TYPE_CACHE_ZIP 0xFFFF0007
257 #define VNC_ENCODING_TYPE_SOL_MONO_ZIP 0xFFFF0008
258 #define VNC_ENCODING_TYPE_ULTRA_ZIP 0xFFFF0009
259 #define VNC_ENCODING_TYPE_SERVER_STATE 0xFFFF8000
260 #define VNC_ENCODING_TYPE_ENABLE_KEEP_ALIVE 0xFFFF8001
261 #define VNC_ENCODING_TYPE_FTP_PROTO_VER 0xFFFF8002
262 #define VNC_ENCODING_TYPE_POINTER_CHANGE -257
263 #define VNC_ENCODING_TYPE_EXT_KEY_EVENT -258
264 #define VNC_ENCODING_TYPE_AUDIO 259
265 #define VNC_ENCODING_TYPE_DESKTOP_NAME -307
266 #define VNC_ENCODING_TYPE_EXTENDED_DESK_SIZE -308
267 #define VNC_ENCODING_TYPE_KEYBOARD_LED_STATE 0XFFFE0000
268 #define VNC_ENCODING_TYPE_SUPPORTED_MESSAGES 0XFFFE0001
269 #define VNC_ENCODING_TYPE_SUPPORTED_ENCODINGS 0XFFFE0002
270 #define VNC_ENCODING_TYPE_SERVER_IDENTITY 0XFFFE0003
271 #define VNC_ENCODING_TYPE_MIRRORLINK 0xFFFFFDF5
272 #define VNC_ENCODING_TYPE_CONTEXT_INFORMATION 0xFFFFFDF4
273 #define VNC_ENCODING_TYPE_SLRLE 0xFFFFFDF3
274 #define VNC_ENCODING_TYPE_TRANSFORM 0xFFFFFDF2
275 #define VNC_ENCODING_TYPE_HSML 0xFFFFFDF1
276 #define VNC_ENCODING_TYPE_H264 0X48323634
278 static const value_string encoding_types_vs
[] = {
279 { VNC_ENCODING_TYPE_DESKTOP_SIZE
, "DesktopSize (pseudo)" },
280 { VNC_ENCODING_TYPE_LAST_RECT
, "LastRect (pseudo)" },
281 { VNC_ENCODING_TYPE_POINTER_POS
, "Pointer pos (pseudo)" },
282 { VNC_ENCODING_TYPE_RICH_CURSOR
, "Rich Cursor (pseudo)" },
283 { VNC_ENCODING_TYPE_X_CURSOR
, "X Cursor (pseudo)" },
284 { VNC_ENCODING_TYPE_RAW
, "Raw" },
285 { VNC_ENCODING_TYPE_COPY_RECT
, "CopyRect" },
286 { VNC_ENCODING_TYPE_RRE
, "RRE" },
287 { VNC_ENCODING_TYPE_CORRE
, "CoRRE" },
288 { VNC_ENCODING_TYPE_HEXTILE
, "Hextile" },
289 { VNC_ENCODING_TYPE_ZLIB
, "Zlib" },
290 { VNC_ENCODING_TYPE_TIGHT
, "Tight" },
291 { VNC_ENCODING_TYPE_ZLIBHEX
, "ZlibHex" },
292 { VNC_ENCODING_TYPE_ULTRA
, "Ultra" },
293 { VNC_ENCODING_TYPE_RLE
, "ZRLE" },
294 { VNC_ENCODING_TYPE_HITACHI_ZYWRLE
, "Hitachi ZYWRLE" },
295 { VNC_ENCODING_TYPE_JPEG_0
, "JPEG quality level 0" },
296 { VNC_ENCODING_TYPE_JPEG_1
, "JPEG quality level 1" },
297 { VNC_ENCODING_TYPE_JPEG_2
, "JPEG quality level 2" },
298 { VNC_ENCODING_TYPE_JPEG_3
, "JPEG quality level 3" },
299 { VNC_ENCODING_TYPE_JPEG_4
, "JPEG quality level 4" },
300 { VNC_ENCODING_TYPE_JPEG_5
, "JPEG quality level 5" },
301 { VNC_ENCODING_TYPE_JPEG_6
, "JPEG quality level 6" },
302 { VNC_ENCODING_TYPE_JPEG_7
, "JPEG quality level 7" },
303 { VNC_ENCODING_TYPE_JPEG_8
, "JPEG quality level 8" },
304 { VNC_ENCODING_TYPE_JPEG_9
, "JPEG quality level 9" },
305 { VNC_ENCODING_TYPE_COMPRESSION_0
, "Compression level 0" },
306 { VNC_ENCODING_TYPE_COMPRESSION_1
, "Compression level 1" },
307 { VNC_ENCODING_TYPE_COMPRESSION_2
, "Compression level 2" },
308 { VNC_ENCODING_TYPE_COMPRESSION_3
, "Compression level 3" },
309 { VNC_ENCODING_TYPE_COMPRESSION_4
, "Compression level 4" },
310 { VNC_ENCODING_TYPE_COMPRESSION_5
, "Compression level 5" },
311 { VNC_ENCODING_TYPE_COMPRESSION_6
, "Compression level 6" },
312 { VNC_ENCODING_TYPE_COMPRESSION_7
, "Compression level 7" },
313 { VNC_ENCODING_TYPE_COMPRESSION_8
, "Compression level 8" },
314 { VNC_ENCODING_TYPE_COMPRESSION_9
, "Compression level 9" },
315 /* FIXME understand for real what the below mean. Taken from Ultra VNC source code */
316 /* { VNC_ENCODING_TYPE_CACHE, */
317 { VNC_ENCODING_TYPE_CACHE_ENABLE
, "Enable Caching"},
318 /* { VNC_ENCODING_TYPE_XOR_ZLIB,
319 { VNC_ENCODING_TYPE_XOR_MONO_ZLIB,
320 { VNC_ENCODING_TYPE_XOR_MULTI_ZLIB,
321 { VNC_ENCODING_TYPE_SOLID_COLOR,
322 { VNC_ENCODING_TYPE_XOR_ENABLE,
323 { VNC_ENCODING_TYPE_CACHE_ZIP,
324 { VNC_ENCODING_TYPE_SOL_MONO_ZIP,
325 { VNC_ENCODING_TYPE_ULTRA_ZIP,
326 */ { VNC_ENCODING_TYPE_SERVER_STATE
, "Server State" },
327 { VNC_ENCODING_TYPE_ENABLE_KEEP_ALIVE
, "Enable Keep Alive" },
328 { VNC_ENCODING_TYPE_FTP_PROTO_VER
, "FTP protocol version" },
329 { VNC_ENCODING_TYPE_EXTENDED_DESK_SIZE
, "Extended Desktop Size"},
330 { VNC_ENCODING_TYPE_DESKTOP_NAME
, "Desktop Name" },
331 { VNC_ENCODING_TYPE_KEYBOARD_LED_STATE
, "Keyboard LED State" },
332 { VNC_ENCODING_TYPE_SUPPORTED_MESSAGES
, "Supported Messages" },
333 { VNC_ENCODING_TYPE_SUPPORTED_ENCODINGS
, "Supported Encodings" },
334 { VNC_ENCODING_TYPE_SERVER_IDENTITY
, "Server Identity" },
335 { VNC_ENCODING_TYPE_MIRRORLINK
, "MirrorLink" },
336 { VNC_ENCODING_TYPE_CONTEXT_INFORMATION
, "Context Information" },
337 { VNC_ENCODING_TYPE_SLRLE
, "SLRLE" },
338 { VNC_ENCODING_TYPE_TRANSFORM
, "Transform" },
339 { VNC_ENCODING_TYPE_HSML
, "HSML" },
340 { VNC_ENCODING_TYPE_H264
, "H264" },
344 /* Rectangle types for Tight encoding. These come in the "control byte" at the
345 * start of a rectangle's payload. Note that these are with respect to the most
346 * significant bits 4-7 of the control byte, so you must shift it to the right 4
347 * bits before comparing against these values.
349 #define TIGHT_RECT_FILL 0x08
350 #define TIGHT_RECT_JPEG 0x09
351 #define TIGHT_RECT_MAX_VALUE 0x09
353 #define TIGHT_RECT_EXPLICIT_FILTER_FLAG 0x04
355 /* Filter types for Basic encoding of Tight rectangles */
356 #define TIGHT_RECT_FILTER_COPY 0x00
357 #define TIGHT_RECT_FILTER_PALETTE 0x01
358 #define TIGHT_RECT_FILTER_GRADIENT 0x02
360 /* Minimum number of bytes to compress for Tight encoding */
361 #define TIGHT_MIN_BYTES_TO_COMPRESS 12
363 static const value_string tight_filter_ids_vs
[] = {
364 { TIGHT_RECT_FILTER_COPY
, "Copy" },
365 { TIGHT_RECT_FILTER_PALETTE
, "Palette" },
366 { TIGHT_RECT_FILTER_GRADIENT
, "Gradient" },
370 /* MirrorLink messages */
372 VNC_ML_EXT_BYE_BYE
= 0,
373 VNC_ML_EXT_SERVER_DISPLAY_CONFIGURATION
= 1,
374 VNC_ML_EXT_CLIENT_DISPLAY_CONFIGURATION
= 2,
375 VNC_ML_EXT_SERVER_EVENT_CONFIGURATION
= 3,
376 VNC_ML_EXT_CLIENT_EVENT_CONFIGURATION
= 4,
377 VNC_ML_EXT_EVENT_MAPPING
= 5,
378 VNC_ML_EXT_EVENT_MAPPING_REQUEST
= 6,
379 VNC_ML_EXT_KEY_EVENT_LISTING
= 7,
380 VNC_ML_EXT_KEY_EVENT_LISTING_REQUEST
= 8,
381 VNC_ML_EXT_VIRTUAL_KEYBOARD
= 9,
382 VNC_ML_EXT_VIRTUAL_KEYBOARD_REQUEST
= 10,
383 VNC_ML_EXT_DEVICE_STATUS
= 11,
384 VNC_ML_EXT_DEVICE_STATUS_REQUEST
= 12,
385 VNC_ML_EXT_CONTENT_ATTESTATION
= 13,
386 VNC_ML_EXT_CONTENT_ATTESTATION_REQUEST
= 14,
387 VNC_ML_EXT_FB_BLOCKING_NOTIFICATION
= 16,
388 VNC_ML_EXT_AUDIO_BLOCKING_NOTIFICATION
= 18,
389 VNC_ML_EXT_TOUCH_EVENT
= 20,
390 VNC_ML_EXT_FB_ALTERNATIVE_TEXT
= 21,
391 VNC_ML_EXT_FB_ALTERNATIVE_TEXT_REQUEST
= 22
392 } vnc_mirrorlink_ext_types_e
;
394 static const value_string vnc_mirrorlink_types_vs
[] = {
395 { VNC_ML_EXT_BYE_BYE
, "ByeBye" },
396 { VNC_ML_EXT_SERVER_DISPLAY_CONFIGURATION
, "Server Display Configuration" },
397 { VNC_ML_EXT_CLIENT_DISPLAY_CONFIGURATION
, "Client Display Configuration" },
398 { VNC_ML_EXT_SERVER_EVENT_CONFIGURATION
, "Server Event Configuration" },
399 { VNC_ML_EXT_CLIENT_EVENT_CONFIGURATION
, "Client Event Configuration" },
400 { VNC_ML_EXT_EVENT_MAPPING
, "Event Mapping" },
401 { VNC_ML_EXT_EVENT_MAPPING_REQUEST
, "Event Mapping Request" },
402 { VNC_ML_EXT_KEY_EVENT_LISTING
, "Key Event Listing" },
403 { VNC_ML_EXT_KEY_EVENT_LISTING_REQUEST
, "Key Event Listing Request" },
404 { VNC_ML_EXT_VIRTUAL_KEYBOARD
, "Virtual Keyboard Trigger" },
405 { VNC_ML_EXT_VIRTUAL_KEYBOARD_REQUEST
, "Virtual Keyboard Trigger Request" },
406 { VNC_ML_EXT_DEVICE_STATUS
, "Device Status" },
407 { VNC_ML_EXT_DEVICE_STATUS_REQUEST
, "Device Status Request" },
408 { VNC_ML_EXT_CONTENT_ATTESTATION
, "Content Attestation" },
409 { VNC_ML_EXT_CONTENT_ATTESTATION_REQUEST
, "Content Attestation Request" },
410 { VNC_ML_EXT_FB_BLOCKING_NOTIFICATION
, "Framebuffer Blocking Notification" },
411 { VNC_ML_EXT_AUDIO_BLOCKING_NOTIFICATION
, "Audio Blocking Notification" },
412 { VNC_ML_EXT_TOUCH_EVENT
, "Touch Event" },
413 { VNC_ML_EXT_FB_ALTERNATIVE_TEXT
, "Framebuffer Alternative Text" },
414 { VNC_ML_EXT_FB_ALTERNATIVE_TEXT_REQUEST
, "Framebuffer Alternative Text Request" },
418 /* Slice types for H.264 encoding */
420 VNC_H264_SLICE_TYPE_P
= 0,
421 VNC_H264_SLICE_TYPE_B
= 1,
422 VNC_H264_SLICE_TYPE_I
= 2
423 } vnc_h264_slice_types_e
;
425 static const value_string vnc_h264_slice_types_vs
[] = {
426 { VNC_H264_SLICE_TYPE_P
, "Predicted" },
427 { VNC_H264_SLICE_TYPE_B
, "Bi-predicted" },
428 { VNC_H264_SLICE_TYPE_I
, "Intra coded" },
434 VNC_SESSION_STATE_SERVER_VERSION
,
435 VNC_SESSION_STATE_CLIENT_VERSION
,
437 VNC_SESSION_STATE_SECURITY
,
438 VNC_SESSION_STATE_SECURITY_TYPES
,
440 VNC_SESSION_STATE_TIGHT_TUNNELING_CAPABILITIES
,
441 VNC_SESSION_STATE_TIGHT_TUNNEL_TYPE_REPLY
,
442 VNC_SESSION_STATE_TIGHT_AUTH_CAPABILITIES
,
443 VNC_SESSION_STATE_TIGHT_AUTH_TYPE_REPLY
,
444 VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3
,
446 VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE
,
447 VNC_SESSION_STATE_VNC_AUTHENTICATION_RESPONSE
,
449 VNC_SESSION_STATE_ARD_AUTHENTICATION_CHALLENGE
,
450 VNC_SESSION_STATE_ARD_AUTHENTICATION_RESPONSE
,
452 VNC_SESSION_STATE_SECURITY_RESULT
,
454 VNC_SESSION_STATE_VENCRYPT_SERVER_VERSION
,
455 VNC_SESSION_STATE_VENCRYPT_CLIENT_VERSION
,
456 VNC_SESSION_STATE_VENCRYPT_AUTH_CAPABILITIES
,
457 VNC_SESSION_STATE_VENCRYPT_AUTH_TYPE_REPLY
,
458 VNC_SESSION_STATE_VENCRYPT_AUTH_ACK
,
460 VNC_SESSION_STATE_CLIENT_INIT
,
461 VNC_SESSION_STATE_SERVER_INIT
,
463 VNC_SESSION_STATE_TIGHT_INTERACTION_CAPS
,
465 VNC_SESSION_STATE_NORMAL_TRAFFIC
466 } vnc_session_state_e
;
468 #define VNC_FENCE_BLOCK_BEFORE 0x00000001
469 #define VNC_FENCE_BLOCK_AFTER 0x00000002
470 #define VNC_FENCE_SYNC_NEXT 0x00000004
471 #define VNC_FENCE_REQUEST 0x80000000
473 /* This structure will be tied to each conversation. */
475 double server_proto_ver
, client_proto_ver
;
476 uint32_t server_port
;
477 /* These are specific to TightVNC */
478 int num_server_message_types
;
479 int num_client_message_types
;
480 int num_encoding_types
;
481 uint8_t security_type_selected
;
483 /* This is specific to Apple Remote Desktop */
484 uint16_t ard_key_length
;
485 /* State information valid on first sequential pass;
486 * stored in per-packet info for subsequent passes. */
487 uint8_t bytes_per_pixel
;
489 vnc_session_state_e vnc_next_state
;
490 int preferred_encoding
;
491 } vnc_conversation_t
;
493 /* This structure will be tied to each packet */
495 vnc_session_state_e state
;
496 //int preferred_encoding; XXX: Not actually used?
497 uint8_t bytes_per_pixel
;
501 void proto_reg_handoff_vnc(void);
503 static bool vnc_startup_messages(tvbuff_t
*tvb
, packet_info
*pinfo
,
504 int offset
, proto_tree
*tree
,
505 vnc_conversation_t
*per_conversation_info
);
506 static void vnc_client_to_server(tvbuff_t
*tvb
, packet_info
*pinfo
,
507 int *offset
, proto_tree
*tree
,
508 vnc_conversation_t
*per_conversation_info
);
509 static void vnc_server_to_client(tvbuff_t
*tvb
, packet_info
*pinfo
,
510 int *offset
, proto_tree
*tree
);
511 static void vnc_client_set_pixel_format(tvbuff_t
*tvb
, packet_info
*pinfo
,
512 int *offset
, proto_tree
*tree
,
513 vnc_conversation_t
*per_conversation_info
);
514 static void vnc_client_set_encodings(tvbuff_t
*tvb
, packet_info
*pinfo
,
515 int *offset
, proto_tree
*tree
,
516 vnc_conversation_t
*per_conversation_info
);
517 static void vnc_client_framebuffer_update_request(tvbuff_t
*tvb
,
521 static void vnc_client_key_event(tvbuff_t
*tvb
, packet_info
*pinfo
,
522 int *offset
, proto_tree
*tree
);
523 static void vnc_client_pointer_event(tvbuff_t
*tvb
, packet_info
*pinfo
,
524 int *offset
, proto_tree
*tree
);
525 static void vnc_client_cut_text(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
528 static unsigned vnc_server_framebuffer_update(tvbuff_t
*tvb
, packet_info
*pinfo
,
529 int *offset
, proto_tree
*tree
);
530 static unsigned vnc_raw_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
531 proto_tree
*tree
, const uint16_t width
, const uint16_t height
);
532 static unsigned vnc_copyrect_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
,
533 int *offset
, proto_tree
*tree
,
534 const uint16_t width
, const uint16_t height
);
535 static unsigned vnc_rre_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
536 proto_tree
*tree
, const uint16_t width
, const uint16_t height
);
537 static unsigned vnc_hextile_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
,
538 int *offset
, proto_tree
*tree
,
539 const uint16_t width
, const uint16_t height
);
540 static unsigned vnc_zrle_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
541 proto_tree
*tree
, const uint16_t width
, const uint16_t height
);
542 static unsigned vnc_tight_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
543 proto_tree
*tree
, const uint16_t width
, const uint16_t height
);
544 static unsigned vnc_rich_cursor_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
,
545 int *offset
, proto_tree
*tree
, const uint16_t width
,
546 const uint16_t height
);
547 static unsigned vnc_x_cursor_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
,
548 int *offset
, proto_tree
*tree
, const uint16_t width
,
549 const uint16_t height
);
550 static unsigned vnc_server_set_colormap_entries(tvbuff_t
*tvb
, packet_info
*pinfo
,
551 int *offset
, proto_tree
*tree
);
552 static void vnc_server_ring_bell(tvbuff_t
*tvb
, packet_info
*pinfo
,
553 int *offset
, proto_tree
*tree
);
554 static unsigned vnc_server_cut_text(tvbuff_t
*tvb
, packet_info
*pinfo
,
555 int *offset
, proto_tree
*tree
);
556 static void vnc_set_bytes_per_pixel(packet_info
*pinfo
, vnc_conversation_t
*per_conversation_info
, const uint8_t bytes_per_pixel
);
557 static void vnc_set_depth(packet_info
*pinfo
, vnc_conversation_t
*per_conversation_info
, const uint8_t depth
);
558 static uint8_t vnc_get_bytes_per_pixel(packet_info
*pinfo
);
559 static uint8_t vnc_get_depth(packet_info
*pinfo
);
560 static uint32_t vnc_extended_desktop_size(tvbuff_t
*tvb
, int *offset
, proto_tree
*tree
);
562 static unsigned vnc_supported_messages(tvbuff_t
*tvb
, int *offset
,
563 proto_tree
*tree
, const uint16_t width
);
564 static unsigned vnc_supported_encodings(tvbuff_t
*tvb
, int *offset
,
565 proto_tree
*tree
, const uint16_t width
,
566 const uint16_t height
);
567 static unsigned vnc_server_identity(tvbuff_t
*tvb
, int *offset
,
568 proto_tree
*tree
, const uint16_t width
);
570 static unsigned vnc_fence(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
572 static unsigned vnc_mirrorlink(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
574 static unsigned vnc_context_information(tvbuff_t
*tvb
, int *offset
,
576 static unsigned vnc_slrle_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
577 proto_tree
*tree
, const uint16_t height
);
579 static unsigned vnc_h264_encoding(tvbuff_t
*tvb
, int *offset
, proto_tree
*tree
);
581 #define VNC_BYTES_NEEDED(a) \
582 if((a) > (unsigned)tvb_reported_length_remaining(tvb, *offset)) \
585 /* Initialize the protocol and registered fields */
586 static int proto_vnc
; /* Protocol subtree */
587 static int hf_vnc_padding
;
588 static int hf_vnc_server_proto_ver
;
589 static int hf_vnc_client_proto_ver
;
590 static int hf_vnc_num_security_types
;
591 static int hf_vnc_security_type
;
592 static int hf_vnc_server_security_type
;
593 static int hf_vnc_client_security_type
;
594 static int hf_vnc_auth_challenge
;
595 static int hf_vnc_auth_response
;
596 static int hf_vnc_auth_result
;
597 static int hf_vnc_auth_error
;
598 static int hf_vnc_auth_error_length
;
600 static int hf_vnc_ard_auth_generator
;
601 static int hf_vnc_ard_auth_key_len
;
602 static int hf_vnc_ard_auth_modulus
;
603 static int hf_vnc_ard_auth_server_key
;
604 static int hf_vnc_ard_auth_credentials
;
605 static int hf_vnc_ard_auth_client_key
;
607 static int hf_vnc_share_desktop_flag
;
608 static int hf_vnc_width
;
609 static int hf_vnc_height
;
610 static int hf_vnc_server_bits_per_pixel
;
611 static int hf_vnc_server_depth
;
612 static int hf_vnc_server_big_endian_flag
;
613 static int hf_vnc_server_true_color_flag
;
614 static int hf_vnc_server_red_max
;
615 static int hf_vnc_server_green_max
;
616 static int hf_vnc_server_blue_max
;
617 static int hf_vnc_server_red_shift
;
618 static int hf_vnc_server_green_shift
;
619 static int hf_vnc_server_blue_shift
;
620 static int hf_vnc_desktop_name
;
621 static int hf_vnc_desktop_name_len
;
622 static int hf_vnc_desktop_screen_num
;
623 static int hf_vnc_desktop_screen_id
;
624 static int hf_vnc_desktop_screen_x
;
625 static int hf_vnc_desktop_screen_y
;
626 static int hf_vnc_desktop_screen_width
;
627 static int hf_vnc_desktop_screen_height
;
628 static int hf_vnc_desktop_screen_flags
;
629 static int hf_vnc_num_server_message_types
;
630 static int hf_vnc_num_client_message_types
;
631 static int hf_vnc_num_encoding_types
;
633 /********** Client Message Types **********/
635 static int hf_vnc_client_message_type
; /* A subtree under VNC */
636 static int hf_vnc_client_bits_per_pixel
;
637 static int hf_vnc_client_depth
;
638 static int hf_vnc_client_big_endian_flag
;
639 static int hf_vnc_client_true_color_flag
;
640 static int hf_vnc_client_red_max
;
641 static int hf_vnc_client_green_max
;
642 static int hf_vnc_client_blue_max
;
643 static int hf_vnc_client_red_shift
;
644 static int hf_vnc_client_green_shift
;
645 static int hf_vnc_client_blue_shift
;
647 /* Client Key Event */
648 static int hf_vnc_key_down
;
649 static int hf_vnc_key
;
651 /* Client Pointer Event */
652 static int hf_vnc_button_1_pos
;
653 static int hf_vnc_button_2_pos
;
654 static int hf_vnc_button_3_pos
;
655 static int hf_vnc_button_4_pos
;
656 static int hf_vnc_button_5_pos
;
657 static int hf_vnc_button_6_pos
;
658 static int hf_vnc_button_7_pos
;
659 static int hf_vnc_button_8_pos
;
660 static int hf_vnc_pointer_x_pos
;
661 static int hf_vnc_pointer_y_pos
;
663 /* Client Framebuffer Update Request */
664 static int hf_vnc_update_req_incremental
;
665 static int hf_vnc_update_req_x_pos
;
666 static int hf_vnc_update_req_y_pos
;
667 static int hf_vnc_update_req_width
;
668 static int hf_vnc_update_req_height
;
670 /* Client Set Encodings */
671 static int hf_vnc_encoding_num
;
672 static int hf_vnc_client_set_encodings_encoding_type
;
674 /* Client Cut Text */
675 static int hf_vnc_client_cut_text_len
;
676 static int hf_vnc_client_cut_text
;
678 /********** Server Message Types **********/
680 static int hf_vnc_server_message_type
; /* Subtree */
682 /* Tunneling capabilities (TightVNC extension) */
683 static int hf_vnc_tight_num_tunnel_types
;
684 static int hf_vnc_tight_tunnel_type_code
;
685 static int hf_vnc_tight_tunnel_type_vendor
;
686 static int hf_vnc_tight_tunnel_type_signature
;
688 /* Authentication capabilities (TightVNC extension) */
689 static int hf_vnc_tight_num_auth_types
;
690 static int hf_vnc_tight_auth_code
;
691 /* TightVNC capabilities */
692 static int hf_vnc_tight_server_message_type
;
693 static int hf_vnc_tight_server_vendor
;
694 static int hf_vnc_tight_signature
;
695 static int hf_vnc_tight_server_name
;
697 static int hf_vnc_tight_client_message_type
;
698 static int hf_vnc_tight_client_vendor
;
699 static int hf_vnc_tight_client_name
;
701 static int hf_vnc_tight_encoding_type
;
702 static int hf_vnc_tight_encoding_vendor
;
703 static int hf_vnc_tight_encoding_name
;
705 /* VeNCrypt capabilities */
706 static int hf_vnc_vencrypt_server_major_ver
;
707 static int hf_vnc_vencrypt_server_minor_ver
;
708 static int hf_vnc_vencrypt_client_major_ver
;
709 static int hf_vnc_vencrypt_client_minor_ver
;
710 static int hf_vnc_vencrypt_version_ack
;
711 static int hf_vnc_vencrypt_num_auth_types
;
712 static int hf_vnc_vencrypt_auth_type
;
713 static int hf_vnc_vencrypt_auth_type_ack
;
715 /* Tight compression parameters */
716 static int hf_vnc_tight_reset_stream0
;
717 static int hf_vnc_tight_reset_stream1
;
718 static int hf_vnc_tight_reset_stream2
;
719 static int hf_vnc_tight_reset_stream3
;
721 static int hf_vnc_tight_rect_type
;
723 static int hf_vnc_tight_image_len
;
724 static int hf_vnc_tight_image_data
;
726 static int hf_vnc_tight_fill_color
;
728 static int hf_vnc_tight_filter_flag
;
729 static int hf_vnc_tight_filter_id
;
731 static int hf_vnc_tight_palette_num_colors
;
732 static int hf_vnc_tight_palette_data
;
734 /* Server Framebuffer Update */
735 static int hf_vnc_rectangle_num
;
736 static int hf_vnc_fb_update_x_pos
;
737 static int hf_vnc_fb_update_y_pos
;
738 static int hf_vnc_fb_update_width
;
739 static int hf_vnc_fb_update_height
;
740 static int hf_vnc_fb_update_encoding_type
;
743 static int hf_vnc_raw_pixel_data
;
745 /* CopyRect Encoding */
746 static int hf_vnc_copyrect_src_x_pos
;
747 static int hf_vnc_copyrect_src_y_pos
;
750 static int hf_vnc_rre_num_subrects
;
751 static int hf_vnc_rre_bg_pixel
;
753 static int hf_vnc_rre_subrect_pixel
;
754 static int hf_vnc_rre_subrect_x_pos
;
755 static int hf_vnc_rre_subrect_y_pos
;
756 static int hf_vnc_rre_subrect_width
;
757 static int hf_vnc_rre_subrect_height
;
759 /* Hextile Encoding */
760 static int hf_vnc_hextile_subencoding_mask
;
761 static int hf_vnc_hextile_raw
;
762 static int hf_vnc_hextile_raw_value
;
763 static int hf_vnc_hextile_bg
;
764 static int hf_vnc_hextile_bg_value
;
765 static int hf_vnc_hextile_fg
;
766 static int hf_vnc_hextile_fg_value
;
767 static int hf_vnc_hextile_anysubrects
;
768 static int hf_vnc_hextile_num_subrects
;
769 static int hf_vnc_hextile_subrectscolored
;
770 static int hf_vnc_hextile_subrect_pixel_value
;
771 static int hf_vnc_hextile_subrect_x_pos
;
772 static int hf_vnc_hextile_subrect_y_pos
;
773 static int hf_vnc_hextile_subrect_width
;
774 static int hf_vnc_hextile_subrect_height
;
777 static int hf_vnc_zrle_len
;
778 static int hf_vnc_zrle_subencoding
;
779 static int hf_vnc_zrle_rle
;
780 static int hf_vnc_zrle_palette_size
;
781 static int hf_vnc_zrle_data
;
782 static int hf_vnc_zrle_raw
;
783 static int hf_vnc_zrle_palette
;
785 /* Cursor Encoding */
786 static int hf_vnc_cursor_x_fore_back
;
787 static int hf_vnc_cursor_encoding_pixels
;
788 static int hf_vnc_cursor_encoding_bitmask
;
790 /* Server Set Colormap Entries */
791 static int hf_vnc_color_groups
;
792 static int hf_vnc_colormap_first_color
;
793 static int hf_vnc_colormap_num_colors
;
794 static int hf_vnc_colormap_red
;
795 static int hf_vnc_colormap_green
;
796 static int hf_vnc_colormap_blue
;
798 /* Server Cut Text */
799 static int hf_vnc_server_cut_text_len
;
800 static int hf_vnc_server_cut_text
;
802 /* LibVNCServer additions */
803 static int hf_vnc_supported_messages_client2server
;
804 static int hf_vnc_supported_messages_server2client
;
805 static int hf_vnc_num_supported_encodings
;
806 static int hf_vnc_supported_encodings
;
807 static int hf_vnc_server_identity
;
810 static int hf_vnc_mirrorlink_type
;
811 static int hf_vnc_mirrorlink_length
;
812 static int hf_vnc_mirrorlink_version_major
;
813 static int hf_vnc_mirrorlink_version_minor
;
814 static int hf_vnc_mirrorlink_framebuffer_configuration
;
815 static int hf_vnc_mirrorlink_pixel_width
;
816 static int hf_vnc_mirrorlink_pixel_height
;
817 static int hf_vnc_mirrorlink_pixel_format
;
818 static int hf_vnc_mirrorlink_display_width
;
819 static int hf_vnc_mirrorlink_display_height
;
820 static int hf_vnc_mirrorlink_display_distance
;
821 static int hf_vnc_mirrorlink_keyboard_language
;
822 static int hf_vnc_mirrorlink_keyboard_country
;
823 static int hf_vnc_mirrorlink_ui_language
;
824 static int hf_vnc_mirrorlink_ui_country
;
825 static int hf_vnc_mirrorlink_knob_keys
;
826 static int hf_vnc_mirrorlink_device_keys
;
827 static int hf_vnc_mirrorlink_multimedia_keys
;
828 static int hf_vnc_mirrorlink_key_related
;
829 static int hf_vnc_mirrorlink_pointer_related
;
830 static int hf_vnc_mirrorlink_key_symbol_value_client
;
831 static int hf_vnc_mirrorlink_key_symbol_value_server
;
832 static int hf_vnc_mirrorlink_key_configuration
;
833 static int hf_vnc_mirrorlink_key_num_events
;
834 static int hf_vnc_mirrorlink_key_event_counter
;
835 static int hf_vnc_mirrorlink_key_symbol_value
;
836 static int hf_vnc_mirrorlink_key_request_configuration
;
837 static int hf_vnc_mirrorlink_keyboard_configuration
;
838 static int hf_vnc_mirrorlink_cursor_x
;
839 static int hf_vnc_mirrorlink_cursor_y
;
840 static int hf_vnc_mirrorlink_text_x
;
841 static int hf_vnc_mirrorlink_text_y
;
842 static int hf_vnc_mirrorlink_text_width
;
843 static int hf_vnc_mirrorlink_text_height
;
844 static int hf_vnc_mirrorlink_keyboard_request_configuration
;
845 static int hf_vnc_mirrorlink_device_status
;
846 static int hf_vnc_mirrorlink_app_id
;
847 static int hf_vnc_mirrorlink_fb_block_x
;
848 static int hf_vnc_mirrorlink_fb_block_y
;
849 static int hf_vnc_mirrorlink_fb_block_width
;
850 static int hf_vnc_mirrorlink_fb_block_height
;
851 static int hf_vnc_mirrorlink_fb_block_reason
;
852 static int hf_vnc_mirrorlink_audio_block_reason
;
853 static int hf_vnc_mirrorlink_touch_num_events
;
854 static int hf_vnc_mirrorlink_touch_x
;
855 static int hf_vnc_mirrorlink_touch_y
;
856 static int hf_vnc_mirrorlink_touch_id
;
857 static int hf_vnc_mirrorlink_touch_pressure
;
858 static int hf_vnc_mirrorlink_text
;
859 static int hf_vnc_mirrorlink_text_length
;
860 static int hf_vnc_mirrorlink_text_max_length
;
861 static int hf_vnc_mirrorlink_unknown
;
864 static int hf_vnc_fence_flags
;
865 static int hf_vnc_fence_request
;
866 static int hf_vnc_fence_sync_next
;
867 static int hf_vnc_fence_block_after
;
868 static int hf_vnc_fence_block_before
;
869 static int hf_vnc_fence_payload_length
;
870 static int hf_vnc_fence_payload
;
872 static int * const vnc_fence_flags
[] = {
873 &hf_vnc_fence_request
,
874 &hf_vnc_fence_sync_next
,
875 &hf_vnc_fence_block_after
,
876 &hf_vnc_fence_block_before
,
880 /* Context Information */
881 static int hf_vnc_context_information_app_id
;
882 static int hf_vnc_context_information_app_category
;
883 static int hf_vnc_context_information_app_trust_level
;
884 static int hf_vnc_context_information_content_category
;
885 static int hf_vnc_context_information_content_rules
;
886 static int hf_vnc_context_information_content_trust_level
;
888 /* Scan Line based Run-Length Encoding */
889 static int hf_vnc_slrle_run_num
;
890 static int hf_vnc_slrle_run_data
;
893 static int hf_vnc_h264_slice_type
;
894 static int hf_vnc_h264_nbytes
;
895 static int hf_vnc_h264_width
;
896 static int hf_vnc_h264_height
;
897 static int hf_vnc_h264_data
;
899 /********** End of Server Message Types **********/
901 static bool vnc_preference_desegment
= true;
903 /* Initialize the subtree pointers */
905 static int ett_vnc_client_message_type
;
906 static int ett_vnc_server_message_type
;
907 static int ett_vnc_rect
;
908 static int ett_vnc_encoding_type
;
909 static int ett_vnc_rre_subrect
;
910 static int ett_vnc_hextile_subencoding_mask
;
911 static int ett_vnc_hextile_num_subrects
;
912 static int ett_vnc_hextile_subrect
;
913 static int ett_vnc_hextile_tile
;
914 static int ett_vnc_zrle_subencoding
;
915 static int ett_vnc_colormap_num_groups
;
916 static int ett_vnc_colormap_color_group
;
917 static int ett_vnc_desktop_screen
;
918 static int ett_vnc_key_events
;
919 static int ett_vnc_touch_events
;
920 static int ett_vnc_slrle_subline
;
921 static int ett_vnc_fence_flags
;
923 static expert_field ei_vnc_possible_gtk_vnc_bug
;
924 static expert_field ei_vnc_auth_code_mismatch
;
925 static expert_field ei_vnc_unknown_tight_vnc_auth
;
926 static expert_field ei_vnc_too_many_rectangles
;
927 static expert_field ei_vnc_too_many_sub_rectangles
;
928 static expert_field ei_vnc_invalid_encoding
;
929 static expert_field ei_vnc_too_many_colors
;
930 static expert_field ei_vnc_too_many_cut_text
;
931 static expert_field ei_vnc_zrle_failed
;
932 static expert_field ei_vnc_unknown_tight
;
933 static expert_field ei_vnc_reassemble
;
935 #define VNC_PORT_RANGE "5500-5501,5900-5901"
936 /* Port 5900 is IANA registered (under the service name "Remote Framebuffer"),
937 * the others are customary but not registered as mentioned in RFC 6143.
938 * (5900+N is commonly used in the case of multiple servers, analogous to
941 static range_t
*vnc_tcp_range
;
942 static dissector_handle_t vnc_handle
;
943 static dissector_handle_t tls_handle
;
945 /* Code to dissect the packets */
947 dissect_vnc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
952 /* Set up structures needed to add the protocol subtree and manage it */
954 proto_tree
*vnc_tree
;
956 conversation_t
*conversation
;
957 vnc_conversation_t
*per_conversation_info
;
959 conversation
= find_or_create_conversation(pinfo
);
961 /* Retrieve information from conversation, or add it if it isn't
963 per_conversation_info
= (vnc_conversation_t
*)conversation_get_proto_data(conversation
, proto_vnc
);
964 if(!per_conversation_info
) {
965 per_conversation_info
= wmem_new(wmem_file_scope(), vnc_conversation_t
);
967 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_SERVER_VERSION
;
968 per_conversation_info
->security_type_selected
= VNC_SECURITY_TYPE_INVALID
;
969 per_conversation_info
->tight_enabled
= false;
970 per_conversation_info
->preferred_encoding
= VNC_ENCODING_TYPE_RAW
;
971 /* Initial values for depth and bytes_per_pixel are set in
972 * in the mandatory VNC_SESSION_STATE_SERVER_INIT startup
973 * message. "This pixel format will be used unless the
974 * client requests a different format using the SetPixelFormat
975 * message" (RFC 6143 7.3.2 ServerInit) */
977 conversation_add_proto_data(conversation
, proto_vnc
, per_conversation_info
);
981 /* Make entries in Protocol column and Info column on summary display */
982 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "VNC");
984 /* First, clear the info column */
985 col_clear(pinfo
->cinfo
, COL_INFO
);
987 /* create display subtree for the protocol */
988 ti
= proto_tree_add_item(tree
, proto_vnc
, tvb
, 0, -1, ENC_NA
);
989 vnc_tree
= proto_item_add_subtree(ti
, ett_vnc
);
991 /* Dissect any remaining session startup messages */
992 ret
= vnc_startup_messages(tvb
, pinfo
, offset
, vnc_tree
,
993 per_conversation_info
);
996 return tvb_captured_length(tvb
); /* We're in a "startup" state; Cannot yet do "normal" processing */
999 if (per_conversation_info
->security_type_selected
== VNC_SECURITY_TYPE_VENCRYPT
) {
1000 call_dissector_with_data(tls_handle
, tvb
, pinfo
, vnc_tree
, GUINT_TO_POINTER(offset
));
1001 return tvb_captured_length(tvb
);
1004 if(value_is_in_range(vnc_tcp_range
, pinfo
->destport
) || per_conversation_info
->server_port
== pinfo
->destport
) {
1005 vnc_client_to_server(tvb
, pinfo
, &offset
, vnc_tree
, per_conversation_info
);
1008 vnc_server_to_client(tvb
, pinfo
, &offset
, vnc_tree
);
1010 return tvb_captured_length(tvb
);
1013 /* Returns the new offset after processing the 4-byte vendor string */
1015 process_vendor(proto_tree
*tree
, int hfindex
, tvbuff_t
*tvb
, int offset
)
1017 const uint8_t *vendor
;
1021 ti
= proto_tree_add_item_ret_string(tree
, hfindex
, tvb
, offset
, 4, ENC_ASCII
|ENC_NA
, wmem_packet_scope(), &vendor
);
1023 if(g_ascii_strcasecmp(vendor
, "STDV") == 0)
1024 proto_item_append_text(ti
, " (Standard VNC vendor)");
1025 else if(g_ascii_strcasecmp(vendor
, "TRDV") == 0)
1026 proto_item_append_text(ti
, " (Tridia VNC vendor)");
1027 else if(g_ascii_strcasecmp(vendor
, "TGHT") == 0)
1028 proto_item_append_text(ti
, " (Tight VNC vendor)");
1035 /* Returns the new offset after processing the specified number of capabilities */
1037 process_tight_capabilities(proto_tree
*tree
,
1038 int type_index
, int vendor_index
, int name_index
,
1039 tvbuff_t
*tvb
, int offset
, const int num_capabilities
)
1042 /* See vnc_unixsrc/include/rfbproto.h:rfbCapabilityInfo */
1044 for (i
= 0; i
< num_capabilities
; i
++) {
1046 proto_tree_add_item(tree
, type_index
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1049 offset
= process_vendor(tree
, vendor_index
, tvb
, offset
);
1051 proto_tree_add_item(tree
, name_index
, tvb
, offset
, 8, ENC_ASCII
|ENC_NA
);
1058 /* Returns true if this looks like a client or server version packet: 12 bytes, in the format "RFB xxx.yyy\n" .
1059 * Will check for the 12 bytes exact length, the 'RFB ' string and that it ends with a '\n'.
1060 * The exact 'xxx.yyy' is checked later, by trying to convert it to a double using g_ascii_strtod.
1061 * pinfo and tree are NULL when using this function to check the heuristics for dissection. If we're
1062 * checking the heuristics, we don't need to add expert_info, we just reject that packet as not
1063 * being a VNC packet.
1066 vnc_is_client_or_server_version_message(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
1068 if(tvb_captured_length(tvb
) != 12) {
1072 if(tvb_strncaseeql(tvb
, 0, "RFB ", 4) != 0) {
1076 /* 0x2e = '.' 0xa = '\n' */
1077 if (tvb_get_uint8(tvb
, 7) != 0x2e) {
1081 if (tvb_get_uint8(tvb
,11) != 0xa) {
1082 if (tvb_get_uint8(tvb
,11) == 0) {
1083 /* Per bug 5469, It appears that any VNC clients using gtk-vnc before [1] was
1084 * fixed will exhibit the described protocol violation that prevents wireshark
1085 * from dissecting the session.
1087 * [1] http://git.gnome.org/browse/gtk-vnc/commit/?id=bc9e2b19167686dd381a0508af1a5113675d08a2
1089 if ((pinfo
!= NULL
) && (tree
!= NULL
)) {
1090 proto_tree_add_expert(tree
, pinfo
, &ei_vnc_possible_gtk_vnc_bug
, tvb
, -1, 0);
1102 static bool test_vnc_protocol(tvbuff_t
*tvb
, packet_info
*pinfo
,
1103 proto_tree
*tree
, void *data _U_
)
1105 conversation_t
*conversation
;
1107 if (vnc_is_client_or_server_version_message(tvb
, NULL
, NULL
)) {
1108 conversation
= conversation_new(pinfo
->num
, &pinfo
->src
,
1109 &pinfo
->dst
, conversation_pt_to_conversation_type(pinfo
->ptype
),
1111 pinfo
->destport
, 0);
1112 conversation_set_dissector(conversation
, vnc_handle
);
1113 dissect_vnc(tvb
, pinfo
, tree
, data
);
1119 /* Returns true if additional session startup messages follow */
1121 vnc_startup_messages(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
,
1122 proto_tree
*tree
, vnc_conversation_t
1123 *per_conversation_info
)
1125 uint8_t num_security_types
;
1126 uint32_t desktop_name_len
, auth_result
, text_len
, auth_code
;
1127 vnc_packet_t
*per_packet_info
;
1128 int num_tunnel_types
;
1130 proto_item
* auth_item
;
1131 int bytes_available
;
1132 int bytes_needed
= 0;
1134 per_packet_info
= (vnc_packet_t
*)p_get_proto_data(wmem_file_scope(), pinfo
, proto_vnc
, 0);
1136 if(!per_packet_info
) {
1137 per_packet_info
= wmem_new(wmem_file_scope(), vnc_packet_t
);
1139 per_packet_info
->state
= per_conversation_info
->vnc_next_state
;
1140 per_packet_info
->bytes_per_pixel
= per_conversation_info
->bytes_per_pixel
;
1141 per_packet_info
->depth
= per_conversation_info
->depth
;
1143 p_add_proto_data(wmem_file_scope(), pinfo
, proto_vnc
, 0, per_packet_info
);
1146 bytes_available
= tvb_reported_length_remaining(tvb
, offset
);
1148 /* Packet dissection follows */
1149 switch(per_packet_info
->state
) {
1151 case VNC_SESSION_STATE_SERVER_VERSION
:
1152 if (!vnc_is_client_or_server_version_message(tvb
, pinfo
, tree
))
1153 return true; /* we still hope to get a SERVER_VERSION message some day. Do not proceed yet */
1155 proto_tree_add_item(tree
, hf_vnc_server_proto_ver
, tvb
, 4,
1157 per_conversation_info
->server_proto_ver
=
1158 g_ascii_strtod((char *)tvb_get_string_enc(wmem_packet_scope(), tvb
, 4, 7, ENC_ASCII
), NULL
);
1159 per_conversation_info
->server_port
= pinfo
->srcport
;
1161 col_add_fstr(pinfo
->cinfo
, COL_INFO
,
1162 "Server protocol version: %s",
1163 tvb_format_text(pinfo
->pool
, tvb
, 4, 7));
1165 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_CLIENT_VERSION
;
1168 case VNC_SESSION_STATE_CLIENT_VERSION
:
1169 if (!vnc_is_client_or_server_version_message(tvb
, pinfo
, tree
))
1170 return true; /* we still hope to get a CLIENT_VERSION message some day. Do not proceed yet */
1172 proto_tree_add_item(tree
, hf_vnc_client_proto_ver
, tvb
,
1174 per_conversation_info
->client_proto_ver
=
1175 g_ascii_strtod((char *)tvb_get_string_enc(wmem_packet_scope(), tvb
, 4, 7, ENC_ASCII
), NULL
);
1177 col_add_fstr(pinfo
->cinfo
, COL_INFO
,
1178 "Client protocol version: %s",
1179 tvb_format_text(pinfo
->pool
, tvb
, 4, 7));
1181 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_SECURITY
;
1184 case VNC_SESSION_STATE_SECURITY
:
1185 col_set_str(pinfo
->cinfo
, COL_INFO
, "Security types supported");
1187 /* We're checking against the client protocol version because
1188 * the client is the final decider on which version to use
1189 * after the server offers the highest version it supports. */
1191 if(per_conversation_info
->client_proto_ver
>= 3.007) {
1192 num_security_types
= tvb_get_uint8(tvb
, offset
);
1193 bytes_needed
= 1 + num_security_types
;
1194 if (bytes_available
< bytes_needed
&& vnc_preference_desegment
&& pinfo
->can_desegment
) {
1195 pinfo
->desegment_offset
= offset
;
1196 pinfo
->desegment_len
= bytes_needed
- bytes_available
;
1201 proto_tree_add_item(tree
,
1202 hf_vnc_num_security_types
,
1203 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1205 for(offset
= 1; offset
<= num_security_types
; offset
++){
1206 proto_tree_add_item(tree
,
1207 hf_vnc_security_type
, tvb
,
1208 offset
, 1, ENC_BIG_ENDIAN
);
1211 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_SECURITY_TYPES
;
1213 /* Version < 3.007: The server decides the
1214 * authentication type for us to use */
1215 proto_tree_add_item(tree
, hf_vnc_server_security_type
,
1216 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1217 /* The cast below is possible since in older versions of the protocol the only possible values are 0,1,2 */
1218 per_conversation_info
->security_type_selected
= (uint8_t)tvb_get_ntohl(tvb
, offset
);
1219 switch(per_conversation_info
->security_type_selected
) {
1221 case VNC_SECURITY_TYPE_INVALID
:
1222 /* TODO: In this case (INVALID) the connection has failed */
1223 /* and there should be an error string describing the error */
1224 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_SECURITY_TYPES
;
1227 case VNC_SECURITY_TYPE_NONE
:
1228 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_CLIENT_INIT
;
1231 case VNC_SECURITY_TYPE_VNC
:
1232 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE
;
1235 case VNC_SECURITY_TYPE_ARD
:
1236 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_ARD_AUTHENTICATION_CHALLENGE
;
1240 /* Security type not supported by this dissector */
1247 case VNC_SESSION_STATE_SECURITY_TYPES
:
1248 proto_tree_add_item(tree
, hf_vnc_client_security_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1249 per_conversation_info
->security_type_selected
=
1250 tvb_get_uint8(tvb
, offset
);
1251 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "Security type %s (%d) selected by client",
1252 val_to_str_const(per_conversation_info
->security_type_selected
, vnc_security_types_vs
, "Unknown"),
1253 per_conversation_info
->security_type_selected
);
1255 switch(per_conversation_info
->security_type_selected
) {
1257 case VNC_SECURITY_TYPE_NONE
:
1258 if(per_conversation_info
->client_proto_ver
>= 3.008)
1259 per_conversation_info
->vnc_next_state
=
1260 VNC_SESSION_STATE_SECURITY_RESULT
;
1262 per_conversation_info
->vnc_next_state
=
1263 VNC_SESSION_STATE_CLIENT_INIT
;
1267 case VNC_SECURITY_TYPE_VNC
:
1268 per_conversation_info
->vnc_next_state
=
1269 VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE
;
1272 case VNC_SECURITY_TYPE_TIGHT
:
1273 per_conversation_info
->vnc_next_state
=
1274 VNC_SESSION_STATE_TIGHT_TUNNELING_CAPABILITIES
;
1275 per_conversation_info
->tight_enabled
= true;
1278 case VNC_SECURITY_TYPE_ARD
:
1279 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_ARD_AUTHENTICATION_CHALLENGE
;
1282 case VNC_SECURITY_TYPE_VENCRYPT
:
1283 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_VENCRYPT_SERVER_VERSION
;
1286 /* Security type not supported by this dissector */
1292 case VNC_SESSION_STATE_TIGHT_TUNNELING_CAPABILITIES
:
1296 col_set_str(pinfo
->cinfo
, COL_INFO
, "TightVNC tunneling capabilities supported");
1298 proto_tree_add_item(tree
, hf_vnc_tight_num_tunnel_types
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1299 num_tunnel_types
= tvb_get_ntohl(tvb
, offset
);
1303 for(i
= 0; i
< num_tunnel_types
; i
++) {
1304 /* TightVNC and Xvnc don't support any tunnel capabilities yet, but each capability
1305 * is 16 bytes, so skip them.
1308 proto_tree_add_item(tree
, hf_vnc_tight_tunnel_type_code
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1309 proto_tree_add_item(tree
, hf_vnc_tight_tunnel_type_vendor
, tvb
, offset
+ 4, 4, ENC_ASCII
);
1310 proto_tree_add_item(tree
, hf_vnc_tight_tunnel_type_signature
, tvb
, offset
+ 8, 8, ENC_ASCII
);
1314 if (num_tunnel_types
== 0)
1315 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_TIGHT_AUTH_CAPABILITIES
;
1317 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_TIGHT_TUNNEL_TYPE_REPLY
;
1320 case VNC_SESSION_STATE_TIGHT_TUNNEL_TYPE_REPLY
:
1321 /* Neither TightVNC nor Xvnc implement this; they just have a placeholder that emits an error
1322 * message and closes the connection (xserver/hw/vnc/auth.c:rfbProcessClientTunnelingType).
1323 * We should actually never get here...
1327 case VNC_SESSION_STATE_TIGHT_AUTH_CAPABILITIES
:
1329 const uint8_t *vendor
, *signature
;
1331 col_set_str(pinfo
->cinfo
, COL_INFO
, "TightVNC authentication capabilities supported");
1333 proto_tree_add_item(tree
, hf_vnc_tight_num_auth_types
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1334 num_auth_types
= tvb_get_ntohl(tvb
, offset
);
1337 auth_code
= tvb_get_ntohl(tvb
, offset
);
1338 auth_item
= proto_tree_add_item(tree
, hf_vnc_tight_auth_code
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1340 vendor
= tvb_get_string_enc(wmem_packet_scope(), tvb
, offset
, 4, ENC_ASCII
);
1341 process_vendor(tree
, hf_vnc_tight_server_vendor
, tvb
, offset
);
1343 proto_tree_add_item_ret_string(tree
, hf_vnc_tight_signature
, tvb
, offset
, 8, ENC_ASCII
|ENC_NA
, wmem_packet_scope(), &signature
);
1346 case VNC_SECURITY_TYPE_NONE
:
1347 if ((g_ascii_strcasecmp(vendor
, "STDV") != 0) || (g_ascii_strcasecmp(signature
, "NOAUTH__") != 0)) {
1348 expert_add_info(pinfo
, auth_item
, &ei_vnc_auth_code_mismatch
);
1351 case VNC_SECURITY_TYPE_VNC
:
1352 if ((g_ascii_strcasecmp(vendor
, "STDV") != 0) || (g_ascii_strcasecmp(signature
, "VNCAUTH_") != 0)) {
1353 expert_add_info(pinfo
, auth_item
, &ei_vnc_auth_code_mismatch
);
1356 case VNC_SECURITY_TYPE_VENCRYPT
:
1357 if ((g_ascii_strcasecmp(vendor
, "VENC") != 0) || (g_ascii_strcasecmp(signature
, "VENCRYPT") != 0)) {
1358 expert_add_info(pinfo
, auth_item
, &ei_vnc_auth_code_mismatch
);
1361 case VNC_SECURITY_TYPE_GTK_VNC_SASL
:
1362 if ((g_ascii_strcasecmp(vendor
, "GTKV") != 0) || (g_ascii_strcasecmp(signature
, "SASL____") != 0)) {
1363 expert_add_info(pinfo
, auth_item
, &ei_vnc_auth_code_mismatch
);
1366 case VNC_TIGHT_AUTH_TGHT_ULGNAUTH
:
1367 if ((g_ascii_strcasecmp(vendor
, "TGHT") != 0) || (g_ascii_strcasecmp(signature
, "ULGNAUTH") != 0)) {
1368 expert_add_info(pinfo
, auth_item
, &ei_vnc_auth_code_mismatch
);
1371 case VNC_TIGHT_AUTH_TGHT_XTRNAUTH
:
1372 if ((g_ascii_strcasecmp(vendor
, "TGHT") != 0) || (g_ascii_strcasecmp(signature
, "XTRNAUTH") != 0)) {
1373 expert_add_info(pinfo
, auth_item
, &ei_vnc_auth_code_mismatch
);
1377 expert_add_info(pinfo
, auth_item
, &ei_vnc_unknown_tight_vnc_auth
);
1381 if (num_auth_types
== 0)
1382 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_CLIENT_INIT
;
1384 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_TIGHT_AUTH_TYPE_REPLY
;
1387 case VNC_SESSION_STATE_TIGHT_AUTH_TYPE_REPLY
:
1388 col_set_str(pinfo
->cinfo
, COL_INFO
, "TightVNC authentication type selected by client");
1389 auth_code
= tvb_get_ntohl(tvb
, offset
);
1390 auth_item
= proto_tree_add_item(tree
, hf_vnc_tight_auth_code
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1393 case VNC_SECURITY_TYPE_NONE
:
1394 per_conversation_info
->security_type_selected
= VNC_SECURITY_TYPE_NONE
;
1395 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_CLIENT_INIT
;
1397 case VNC_SECURITY_TYPE_VNC
:
1398 per_conversation_info
->security_type_selected
= VNC_SECURITY_TYPE_VNC
;
1399 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE
;
1401 case VNC_SECURITY_TYPE_GTK_VNC_SASL
:
1402 per_conversation_info
->security_type_selected
= VNC_SECURITY_TYPE_GTK_VNC_SASL
;
1403 /* TODO: dissection not implemented yet */
1404 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3
;
1406 case VNC_TIGHT_AUTH_TGHT_ULGNAUTH
:
1407 per_conversation_info
->security_type_selected
= VNC_TIGHT_AUTH_TGHT_ULGNAUTH
;
1408 /* TODO: dissection not implemented yet */
1409 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3
;
1411 case VNC_TIGHT_AUTH_TGHT_XTRNAUTH
:
1412 per_conversation_info
->security_type_selected
= VNC_TIGHT_AUTH_TGHT_XTRNAUTH
;
1413 /* TODO: dissection not implemented yet */
1414 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3
;
1417 expert_add_info(pinfo
, auth_item
, &ei_vnc_unknown_tight_vnc_auth
);
1418 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3
;
1424 case VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3
:
1425 col_set_str(pinfo
->cinfo
, COL_INFO
, "Unknown packet (TightVNC)");
1427 proto_tree_add_expert(tree
, pinfo
, &ei_vnc_unknown_tight
, tvb
, offset
, -1);
1429 per_conversation_info
->vnc_next_state
=
1430 VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE
;
1434 case VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE
:
1435 col_set_str(pinfo
->cinfo
, COL_INFO
, "Authentication challenge from server");
1437 proto_tree_add_item(tree
, hf_vnc_auth_challenge
, tvb
,
1438 offset
, 16, ENC_NA
);
1440 per_conversation_info
->vnc_next_state
=
1441 VNC_SESSION_STATE_VNC_AUTHENTICATION_RESPONSE
;
1444 case VNC_SESSION_STATE_VNC_AUTHENTICATION_RESPONSE
:
1445 col_set_str(pinfo
->cinfo
, COL_INFO
, "Authentication response from client");
1447 proto_tree_add_item(tree
, hf_vnc_auth_response
, tvb
,
1448 offset
, 16, ENC_NA
);
1450 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_SECURITY_RESULT
;
1453 case VNC_SESSION_STATE_ARD_AUTHENTICATION_CHALLENGE
:
1457 col_set_str(pinfo
->cinfo
, COL_INFO
, "ARD authentication challenge");
1459 proto_tree_add_item(tree
, hf_vnc_ard_auth_generator
, tvb
,
1460 offset
, 2, ENC_BIG_ENDIAN
);
1461 proto_tree_add_item(tree
, hf_vnc_ard_auth_key_len
, tvb
,
1462 offset
+ 2, 2, ENC_BIG_ENDIAN
);
1464 key_len
= tvb_get_ntohs(tvb
, offset
+ 2);
1468 proto_tree_add_item(tree
, hf_vnc_ard_auth_modulus
, tvb
,
1469 offset
, key_len
, ENC_NA
);
1470 proto_tree_add_item(tree
, hf_vnc_ard_auth_server_key
, tvb
,
1471 offset
+ key_len
, key_len
, ENC_NA
);
1473 per_conversation_info
->ard_key_length
= key_len
;
1474 per_conversation_info
->vnc_next_state
=
1475 VNC_SESSION_STATE_ARD_AUTHENTICATION_RESPONSE
;
1479 case VNC_SESSION_STATE_ARD_AUTHENTICATION_RESPONSE
:
1480 col_set_str(pinfo
->cinfo
, COL_INFO
, "ARD authentication response");
1482 proto_tree_add_item(tree
, hf_vnc_ard_auth_credentials
, tvb
,
1483 offset
, 128, ENC_NA
);
1484 proto_tree_add_item(tree
, hf_vnc_ard_auth_client_key
, tvb
,
1485 offset
+ 128, per_conversation_info
->ard_key_length
, ENC_NA
);
1487 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_SECURITY_RESULT
;
1490 case VNC_SESSION_STATE_SECURITY_RESULT
:
1491 col_set_str(pinfo
->cinfo
, COL_INFO
, "Authentication result");
1493 proto_tree_add_item(tree
, hf_vnc_auth_result
, tvb
, offset
,
1495 auth_result
= tvb_get_ntohl(tvb
, offset
);
1498 switch(auth_result
) {
1501 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_CLIENT_INIT
;
1504 case 1 : /* Failed */
1505 if(per_conversation_info
->client_proto_ver
>= 3.008) {
1506 text_len
= tvb_get_ntohl(tvb
, offset
);
1507 proto_tree_add_item(tree
, hf_vnc_auth_error_length
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1510 proto_tree_add_item(tree
, hf_vnc_auth_error
, tvb
,
1511 offset
, text_len
, ENC_ASCII
);
1514 return true; /* All versions: Do not continue
1515 processing VNC packets as connection
1516 will be closed after this packet. */
1522 case VNC_SESSION_STATE_VENCRYPT_SERVER_VERSION
:
1525 if (bytes_available
< bytes_needed
&& vnc_preference_desegment
&& pinfo
->can_desegment
) {
1526 pinfo
->desegment_offset
= offset
;
1527 pinfo
->desegment_len
= bytes_needed
- bytes_available
;
1530 proto_tree_add_item(tree
, hf_vnc_vencrypt_server_major_ver
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1531 int major
= tvb_get_uint8(tvb
, offset
++);
1532 proto_tree_add_item(tree
, hf_vnc_vencrypt_server_minor_ver
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1533 int minor
= tvb_get_uint8(tvb
, offset
++);
1534 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "VeNCrypt server version %d.%d", major
, minor
);
1535 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_VENCRYPT_CLIENT_VERSION
;
1538 case VNC_SESSION_STATE_VENCRYPT_CLIENT_VERSION
:
1541 if (bytes_available
< bytes_needed
&& vnc_preference_desegment
&& pinfo
->can_desegment
) {
1542 pinfo
->desegment_offset
= offset
;
1543 pinfo
->desegment_len
= bytes_needed
- bytes_available
;
1546 proto_tree_add_item(tree
, hf_vnc_vencrypt_client_major_ver
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1547 int major
= tvb_get_uint8(tvb
, offset
++);
1548 proto_tree_add_item(tree
, hf_vnc_vencrypt_client_minor_ver
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1549 int minor
= tvb_get_uint8(tvb
, offset
++);
1550 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "VeNCrypt client version %d.%d", major
, minor
);
1551 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_VENCRYPT_AUTH_CAPABILITIES
;
1554 case VNC_SESSION_STATE_VENCRYPT_AUTH_CAPABILITIES
:
1558 if (bytes_available
< bytes_needed
&& vnc_preference_desegment
&& pinfo
->can_desegment
) {
1559 pinfo
->desegment_offset
= offset
;
1560 pinfo
->desegment_len
= DESEGMENT_ONE_MORE_SEGMENT
;
1563 num_auth_types
= tvb_get_uint8(tvb
, offset
+ 1);
1564 bytes_needed
= 2 + 4 * num_auth_types
;
1565 if (bytes_available
< bytes_needed
&& vnc_preference_desegment
&& pinfo
->can_desegment
) {
1566 pinfo
->desegment_offset
= offset
;
1567 pinfo
->desegment_len
= bytes_needed
- bytes_available
;
1570 col_set_str(pinfo
->cinfo
, COL_INFO
, "VeNCrypt authentication types supported");
1571 proto_tree_add_item(tree
, hf_vnc_vencrypt_version_ack
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1573 proto_tree_add_item(tree
, hf_vnc_vencrypt_num_auth_types
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1576 for(i
= 0; i
< num_auth_types
; i
++) {
1577 proto_tree_add_item(tree
, hf_vnc_vencrypt_auth_type
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1581 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_VENCRYPT_AUTH_TYPE_REPLY
;
1584 case VNC_SESSION_STATE_VENCRYPT_AUTH_TYPE_REPLY
:
1587 if (bytes_available
< bytes_needed
&& vnc_preference_desegment
&& pinfo
->can_desegment
) {
1588 pinfo
->desegment_offset
= offset
;
1589 pinfo
->desegment_len
= bytes_needed
- bytes_available
;
1592 uint32_t authtype
= tvb_get_ntohl(tvb
, offset
);
1593 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "VeNCrypt authentication type %s (%d) selected by client",
1594 val_to_str_const(authtype
, vnc_vencrypt_auth_types_vs
, "Unknown"),
1596 proto_tree_add_item(tree
, hf_vnc_vencrypt_auth_type
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1598 if (authtype
== VNC_SECURITY_TYPE_NONE
) {
1599 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_CLIENT_INIT
;
1600 per_conversation_info
->security_type_selected
= VNC_SECURITY_TYPE_NONE
;
1601 } else if (authtype
== VNC_SECURITY_TYPE_VNC
) {
1602 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE
;
1603 per_conversation_info
->security_type_selected
= VNC_SECURITY_TYPE_VNC
;
1605 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_VENCRYPT_AUTH_ACK
;
1609 case VNC_SESSION_STATE_VENCRYPT_AUTH_ACK
:
1610 col_set_str(pinfo
->cinfo
, COL_INFO
, "VeNCrypt server ack");
1611 proto_tree_add_item(tree
, hf_vnc_vencrypt_auth_type_ack
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1612 tls_handle
= find_dissector("tls");
1613 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_NORMAL_TRAFFIC
;
1616 case VNC_SESSION_STATE_CLIENT_INIT
:
1617 col_set_str(pinfo
->cinfo
, COL_INFO
, "Share desktop flag");
1619 proto_tree_add_item(tree
, hf_vnc_share_desktop_flag
, tvb
,
1620 offset
, 1, ENC_BIG_ENDIAN
);
1622 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_SERVER_INIT
;
1626 case VNC_SESSION_STATE_SERVER_INIT
:
1627 col_set_str(pinfo
->cinfo
, COL_INFO
, "Server framebuffer parameters");
1629 proto_tree_add_item(tree
, hf_vnc_width
, tvb
, offset
, 2,
1633 proto_tree_add_item(tree
, hf_vnc_height
, tvb
, offset
, 2,
1637 proto_tree_add_item(tree
, hf_vnc_server_bits_per_pixel
,
1638 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1639 vnc_set_bytes_per_pixel(pinfo
, per_conversation_info
, tvb_get_uint8(tvb
, offset
) / 8);
1642 proto_tree_add_item(tree
, hf_vnc_server_depth
, tvb
, offset
,
1644 vnc_set_depth(pinfo
, per_conversation_info
, tvb_get_uint8(tvb
, offset
));
1647 proto_tree_add_item(tree
, hf_vnc_server_big_endian_flag
,
1648 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1651 proto_tree_add_item(tree
, hf_vnc_server_true_color_flag
,
1652 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1655 proto_tree_add_item(tree
, hf_vnc_server_red_max
,
1656 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1659 proto_tree_add_item(tree
, hf_vnc_server_green_max
,
1660 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1663 proto_tree_add_item(tree
, hf_vnc_server_blue_max
,
1664 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1667 proto_tree_add_item(tree
, hf_vnc_server_red_shift
,
1668 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1671 proto_tree_add_item(tree
, hf_vnc_server_green_shift
,
1672 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1675 proto_tree_add_item(tree
, hf_vnc_server_blue_shift
,
1676 tvb
, offset
, 1, ENC_BIG_ENDIAN
);
1679 proto_tree_add_item(tree
, hf_vnc_padding
,
1680 tvb
, offset
, 3, ENC_NA
);
1681 offset
+= 3; /* Skip over 3 bytes of padding */
1683 if(tvb_reported_length_remaining(tvb
, offset
) > 4) {
1684 /* Sometimes the desktop name & length is skipped */
1685 proto_tree_add_item(tree
, hf_vnc_desktop_name_len
,
1686 tvb
, offset
, 4, ENC_BIG_ENDIAN
);
1687 desktop_name_len
= tvb_get_ntohl(tvb
, offset
);
1690 proto_tree_add_item(tree
, hf_vnc_desktop_name
,
1691 tvb
, offset
, desktop_name_len
,
1695 if(per_conversation_info
->tight_enabled
== true)
1696 per_conversation_info
->vnc_next_state
=
1697 VNC_SESSION_STATE_TIGHT_INTERACTION_CAPS
;
1699 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_NORMAL_TRAFFIC
;
1702 case VNC_SESSION_STATE_TIGHT_INTERACTION_CAPS
:
1703 col_set_str(pinfo
->cinfo
, COL_INFO
, "TightVNC Interaction Capabilities");
1705 proto_tree_add_item(tree
, hf_vnc_num_server_message_types
,
1706 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1707 per_conversation_info
->num_server_message_types
= tvb_get_ntohs(tvb
, offset
);
1710 proto_tree_add_item(tree
, hf_vnc_num_client_message_types
,
1711 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1712 per_conversation_info
->num_client_message_types
= tvb_get_ntohs(tvb
, offset
);
1715 proto_tree_add_item(tree
, hf_vnc_num_encoding_types
,
1716 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1717 per_conversation_info
->num_encoding_types
= tvb_get_ntohs(tvb
, offset
);
1720 proto_tree_add_item(tree
, hf_vnc_padding
, tvb
, offset
, 2, ENC_NA
);
1723 offset
= process_tight_capabilities(tree
,
1724 hf_vnc_tight_server_message_type
,
1725 hf_vnc_tight_server_vendor
,
1726 hf_vnc_tight_server_name
,
1727 tvb
, offset
, per_conversation_info
->num_server_message_types
);
1728 offset
= process_tight_capabilities(tree
,
1729 hf_vnc_tight_client_message_type
,
1730 hf_vnc_tight_client_vendor
,
1731 hf_vnc_tight_client_name
,
1732 tvb
, offset
, per_conversation_info
->num_client_message_types
);
1733 process_tight_capabilities(tree
,
1734 hf_vnc_tight_encoding_type
,
1735 hf_vnc_tight_encoding_vendor
,
1736 hf_vnc_tight_encoding_name
,
1737 tvb
, offset
, per_conversation_info
->num_encoding_types
);
1739 per_conversation_info
->vnc_next_state
= VNC_SESSION_STATE_NORMAL_TRAFFIC
;
1742 case VNC_SESSION_STATE_NORMAL_TRAFFIC
:
1751 vnc_client_to_server(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
1753 vnc_conversation_t
*per_conversation_info
)
1755 uint8_t message_type
;
1758 proto_tree
*vnc_client_message_type_tree
;
1760 message_type
= tvb_get_uint8(tvb
, *offset
);
1762 ti
= proto_tree_add_item(tree
, hf_vnc_client_message_type
, tvb
,
1763 *offset
, 1, ENC_BIG_ENDIAN
);
1765 vnc_client_message_type_tree
=
1766 proto_item_add_subtree(ti
, ett_vnc_client_message_type
);
1770 switch(message_type
) {
1772 case VNC_CLIENT_MESSAGE_TYPE_SET_PIXEL_FORMAT
:
1773 vnc_client_set_pixel_format(tvb
, pinfo
, offset
,
1774 vnc_client_message_type_tree
,
1775 per_conversation_info
);
1778 case VNC_CLIENT_MESSAGE_TYPE_SET_ENCODINGS
:
1779 vnc_client_set_encodings(tvb
, pinfo
, offset
,
1780 vnc_client_message_type_tree
,
1781 per_conversation_info
);
1784 case VNC_CLIENT_MESSAGE_TYPE_FRAMEBUF_UPDATE_REQ
:
1785 vnc_client_framebuffer_update_request(tvb
, pinfo
, offset
,
1786 vnc_client_message_type_tree
);
1789 case VNC_CLIENT_MESSAGE_TYPE_KEY_EVENT
:
1790 vnc_client_key_event(tvb
, pinfo
, offset
,
1791 vnc_client_message_type_tree
);
1794 case VNC_CLIENT_MESSAGE_TYPE_POINTER_EVENT
:
1795 vnc_client_pointer_event(tvb
, pinfo
, offset
,
1796 vnc_client_message_type_tree
);
1799 case VNC_CLIENT_MESSAGE_TYPE_CLIENT_CUT_TEXT
:
1800 vnc_client_cut_text(tvb
, pinfo
, offset
,
1801 vnc_client_message_type_tree
);
1804 case VNC_CLIENT_MESSAGE_TYPE_MIRRORLINK
:
1805 vnc_mirrorlink(tvb
, pinfo
, offset
,
1806 vnc_client_message_type_tree
);
1809 case VNC_CLIENT_MESSAGE_TYPE_ENABLE_CONTINUOUS_UPDATES
:
1810 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, "; ", "Client Enable Continuous Updates");
1814 case VNC_CLIENT_MESSAGE_TYPE_FENCE
:
1815 vnc_fence(tvb
, pinfo
, offset
,
1816 vnc_client_message_type_tree
);
1820 col_append_sep_fstr(pinfo
->cinfo
, COL_INFO
, "; ",
1821 "Unknown client message type (%u)",
1828 vnc_server_to_client(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
1832 uint8_t message_type
;
1833 int bytes_needed
= 0;
1836 proto_tree
*vnc_server_message_type_tree
;
1839 start_offset
= *offset
;
1841 message_type
= tvb_get_uint8(tvb
, *offset
);
1843 ti
= proto_tree_add_item(tree
, hf_vnc_server_message_type
, tvb
,
1844 *offset
, 1, ENC_BIG_ENDIAN
);
1845 vnc_server_message_type_tree
=
1846 proto_item_add_subtree(ti
, ett_vnc_server_message_type
);
1850 switch(message_type
) {
1852 case VNC_SERVER_MESSAGE_TYPE_FRAMEBUFFER_UPDATE
:
1854 vnc_server_framebuffer_update(tvb
, pinfo
, offset
,
1855 vnc_server_message_type_tree
);
1858 case VNC_SERVER_MESSAGE_TYPE_SET_COLORMAP_ENTRIES
:
1859 bytes_needed
= vnc_server_set_colormap_entries(tvb
, pinfo
, offset
, vnc_server_message_type_tree
);
1862 case VNC_SERVER_MESSAGE_TYPE_RING_BELL
:
1863 vnc_server_ring_bell(tvb
, pinfo
, offset
,
1864 vnc_server_message_type_tree
);
1867 case VNC_SERVER_MESSAGE_TYPE_CUT_TEXT
:
1868 bytes_needed
= vnc_server_cut_text(tvb
, pinfo
, offset
,
1869 vnc_server_message_type_tree
);
1872 case VNC_SERVER_MESSAGE_TYPE_MIRRORLINK
:
1873 bytes_needed
= vnc_mirrorlink(tvb
, pinfo
, offset
,
1874 vnc_server_message_type_tree
);
1877 case VNC_SERVER_MESSAGE_TYPE_END_CONTINUOUS_UPDATES
:
1878 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, "; ", "Server End Continuous Updates");
1882 case VNC_SERVER_MESSAGE_TYPE_FENCE
:
1883 bytes_needed
= vnc_fence(tvb
, pinfo
, offset
,
1884 vnc_server_message_type_tree
);
1888 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, "; ",
1889 "Unknown server message type");
1890 *offset
= tvb_reported_length(tvb
); /* Swallow the rest of the segment */
1894 if(bytes_needed
> 0 && vnc_preference_desegment
&& pinfo
->can_desegment
) {
1895 proto_tree_add_expert(vnc_server_message_type_tree
, pinfo
, &ei_vnc_reassemble
, tvb
, start_offset
, -1);
1896 pinfo
->desegment_offset
= start_offset
;
1897 pinfo
->desegment_len
= DESEGMENT_ONE_MORE_SEGMENT
;
1901 if ((unsigned)*offset
< tvb_reported_length(tvb
)) {
1908 vnc_client_set_pixel_format(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
1910 vnc_conversation_t
*per_conversation_info
)
1912 col_set_str(pinfo
->cinfo
, COL_INFO
, "Client set pixel format");
1914 proto_tree_add_item(tree
, hf_vnc_padding
, tvb
, *offset
, 3, ENC_NA
);
1915 *offset
+= 3; /* Skip over 3 bytes of padding */
1917 proto_tree_add_item(tree
, hf_vnc_client_bits_per_pixel
, tvb
, *offset
,
1919 vnc_set_bytes_per_pixel(pinfo
, per_conversation_info
, tvb_get_uint8(tvb
, *offset
) / 8);
1922 proto_tree_add_item(tree
, hf_vnc_client_depth
, tvb
, *offset
,
1924 vnc_set_depth(pinfo
, per_conversation_info
, tvb_get_uint8(tvb
, *offset
));
1927 proto_tree_add_item(tree
, hf_vnc_client_big_endian_flag
, tvb
, *offset
,
1931 proto_tree_add_item(tree
, hf_vnc_client_true_color_flag
, tvb
, *offset
,
1935 proto_tree_add_item(tree
, hf_vnc_client_red_max
, tvb
, *offset
,
1939 proto_tree_add_item(tree
, hf_vnc_client_green_max
, tvb
, *offset
,
1943 proto_tree_add_item(tree
, hf_vnc_client_blue_max
, tvb
, *offset
,
1947 proto_tree_add_item(tree
, hf_vnc_client_red_shift
, tvb
, *offset
,
1951 proto_tree_add_item(tree
, hf_vnc_client_green_shift
, tvb
, *offset
,
1955 proto_tree_add_item(tree
, hf_vnc_client_blue_shift
, tvb
, *offset
,
1959 proto_tree_add_item(tree
, hf_vnc_padding
, tvb
, *offset
, 3, ENC_NA
);
1960 *offset
+= 3; /* Skip over 3 bytes of padding */
1965 vnc_client_set_encodings(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
1967 vnc_conversation_t
*per_conversation_info
)
1969 uint16_t number_of_encodings
;
1972 col_set_str(pinfo
->cinfo
, COL_INFO
, "Client set encodings");
1974 proto_tree_add_item(tree
, hf_vnc_padding
, tvb
, *offset
, 1, ENC_NA
);
1975 *offset
+= 1; /* Skip over 1 byte of padding */
1977 number_of_encodings
= tvb_get_ntohs(tvb
, *offset
);
1978 proto_tree_add_item(tree
, hf_vnc_encoding_num
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
1981 per_conversation_info
->preferred_encoding
= -1;
1983 for(counter
= 0; counter
< number_of_encodings
; counter
++) {
1984 proto_tree_add_item(tree
,
1985 hf_vnc_client_set_encodings_encoding_type
,
1986 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
1988 /* Remember the first real encoding as the preferred encoding,
1989 * per xserver/hw/vnc/rfbserver.c:rfbProcessClientNormalMessage().
1990 * Otherwise, use RAW as the preferred encoding.
1992 if (per_conversation_info
->preferred_encoding
== -1) {
1995 encoding
= tvb_get_ntohl(tvb
, *offset
);
1998 case VNC_ENCODING_TYPE_RAW
:
1999 case VNC_ENCODING_TYPE_RRE
:
2000 case VNC_ENCODING_TYPE_CORRE
:
2001 case VNC_ENCODING_TYPE_HEXTILE
:
2002 case VNC_ENCODING_TYPE_ZLIB
:
2003 case VNC_ENCODING_TYPE_TIGHT
:
2004 per_conversation_info
->preferred_encoding
= encoding
;
2012 if (per_conversation_info
->preferred_encoding
== -1)
2013 per_conversation_info
->preferred_encoding
= VNC_ENCODING_TYPE_RAW
;
2018 vnc_client_framebuffer_update_request(tvbuff_t
*tvb
, packet_info
*pinfo
,
2019 int *offset
, proto_tree
*tree
)
2021 col_set_str(pinfo
->cinfo
, COL_INFO
, "Client framebuffer update request");
2023 proto_tree_add_item(tree
, hf_vnc_update_req_incremental
,
2024 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2027 proto_tree_add_item(tree
, hf_vnc_update_req_x_pos
,
2028 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2031 proto_tree_add_item(tree
, hf_vnc_update_req_y_pos
,
2032 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2035 proto_tree_add_item(tree
, hf_vnc_update_req_width
, tvb
,
2036 *offset
, 2, ENC_BIG_ENDIAN
);
2039 proto_tree_add_item(tree
, hf_vnc_update_req_height
, tvb
,
2040 *offset
, 2, ENC_BIG_ENDIAN
);
2046 vnc_client_key_event(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
2049 col_set_str(pinfo
->cinfo
, COL_INFO
, "Client key event");
2051 proto_tree_add_item(tree
, hf_vnc_key_down
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2054 proto_tree_add_item(tree
, hf_vnc_padding
, tvb
, *offset
, 2, ENC_NA
);
2055 *offset
+= 2; /* Skip over 2 bytes of padding */
2057 proto_tree_add_item(tree
, hf_vnc_key
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2063 vnc_client_pointer_event(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
2066 col_set_str(pinfo
->cinfo
, COL_INFO
, "Client pointer event");
2068 proto_tree_add_item(tree
, hf_vnc_button_1_pos
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2069 proto_tree_add_item(tree
, hf_vnc_button_2_pos
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2070 proto_tree_add_item(tree
, hf_vnc_button_3_pos
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2071 proto_tree_add_item(tree
, hf_vnc_button_4_pos
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2072 proto_tree_add_item(tree
, hf_vnc_button_5_pos
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2073 proto_tree_add_item(tree
, hf_vnc_button_6_pos
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2074 proto_tree_add_item(tree
, hf_vnc_button_7_pos
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2075 proto_tree_add_item(tree
, hf_vnc_button_8_pos
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2078 proto_tree_add_item(tree
, hf_vnc_pointer_x_pos
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2081 proto_tree_add_item(tree
, hf_vnc_pointer_y_pos
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2087 vnc_client_cut_text(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
2092 col_set_str(pinfo
->cinfo
, COL_INFO
, "Client cut text");
2094 proto_tree_add_item(tree
, hf_vnc_padding
, tvb
, *offset
, 3, ENC_NA
);
2095 *offset
+= 3; /* Skip over 3 bytes of padding */
2097 text_len
= tvb_get_ntohl(tvb
, *offset
);
2098 proto_tree_add_item(tree
, hf_vnc_client_cut_text_len
, tvb
, *offset
, 4,
2102 proto_tree_add_item(tree
, hf_vnc_client_cut_text
, tvb
, *offset
,
2103 text_len
, ENC_ASCII
);
2104 *offset
+= text_len
;
2110 vnc_server_framebuffer_update(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
2115 uint16_t width
, height
;
2116 unsigned bytes_needed
= 0;
2117 uint32_t encoding_type
;
2118 proto_item
*ti
, *ti_x
, *ti_y
, *ti_width
, *ti_height
;
2119 proto_tree
*vnc_rect_tree
, *vnc_encoding_type_tree
;
2121 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, "; ", "Server framebuffer update");
2123 proto_tree_add_item(tree
, hf_vnc_padding
, tvb
, *offset
, 1, ENC_NA
);
2126 num_rects
= tvb_get_ntohs(tvb
, *offset
);
2127 ti
= proto_tree_add_item(tree
, hf_vnc_rectangle_num
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2129 /* In some cases, TIGHT encoding ignores the "number of rectangles" field; */
2130 /* VNC_ENCODING_TYPE_LAST_RECT is used to indicate the end of the rectangle list. */
2131 /* (It appears that TIGHT encoding uses 0xFFFF for the num_rects field when the */
2132 /* field is not being used). For now: we'll assume that a value 0f 0xFFFF means */
2133 /* that the field is not being used. */
2134 if (num_rects
== 0xFFFF) {
2135 proto_item_append_text(ti
, " [TIGHT encoding assumed (field is not used)]");
2137 if ((num_rects
!= 0xFFFF) && (num_rects
> 5000)) {
2138 expert_add_info_format(pinfo
, ti
, &ei_vnc_too_many_rectangles
,
2139 "Too many rectangles (%d), aborting dissection", num_rects
);
2145 for(ii
= 0; ii
< num_rects
; ii
++) {
2147 expert_add_info_format(pinfo
, ti
, &ei_vnc_too_many_rectangles
,
2148 "Too many rectangles (%d), aborting dissection", ii
);
2151 VNC_BYTES_NEEDED(12);
2153 vnc_rect_tree
= proto_tree_add_subtree_format(tree
, tvb
, *offset
, 12,
2154 ett_vnc_rect
, NULL
, "Rectangle #%d", ii
+1);
2157 ti_x
= proto_tree_add_item(vnc_rect_tree
, hf_vnc_fb_update_x_pos
,
2158 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2161 ti_y
= proto_tree_add_item(vnc_rect_tree
, hf_vnc_fb_update_y_pos
,
2162 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2165 ti_width
= proto_tree_add_item(vnc_rect_tree
, hf_vnc_fb_update_width
,
2166 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2167 width
= tvb_get_ntohs(tvb
, *offset
);
2170 ti_height
= proto_tree_add_item(vnc_rect_tree
, hf_vnc_fb_update_height
,
2171 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2172 height
= tvb_get_ntohs(tvb
, *offset
);
2175 ti
= proto_tree_add_item(vnc_rect_tree
,
2176 hf_vnc_fb_update_encoding_type
,
2177 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2179 encoding_type
= tvb_get_ntohl(tvb
, *offset
);
2182 if (encoding_type
== VNC_ENCODING_TYPE_LAST_RECT
)
2183 break; /* exit the loop */
2185 vnc_encoding_type_tree
=
2186 proto_item_add_subtree(ti
, ett_vnc_encoding_type
);
2188 switch(encoding_type
) {
2190 case VNC_ENCODING_TYPE_RAW
:
2191 bytes_needed
= vnc_raw_encoding(tvb
, pinfo
, offset
,
2192 vnc_encoding_type_tree
,
2196 case VNC_ENCODING_TYPE_COPY_RECT
:
2198 vnc_copyrect_encoding(tvb
, pinfo
, offset
,
2199 vnc_encoding_type_tree
,
2203 case VNC_ENCODING_TYPE_RRE
:
2205 vnc_rre_encoding(tvb
, pinfo
, offset
,
2206 vnc_encoding_type_tree
,
2210 case VNC_ENCODING_TYPE_HEXTILE
:
2212 vnc_hextile_encoding(tvb
, pinfo
, offset
,
2213 vnc_encoding_type_tree
,
2217 case VNC_ENCODING_TYPE_RLE
:
2219 vnc_zrle_encoding(tvb
, pinfo
, offset
,
2220 vnc_encoding_type_tree
,
2224 case VNC_ENCODING_TYPE_TIGHT
:
2226 vnc_tight_encoding(tvb
, pinfo
, offset
,
2227 vnc_encoding_type_tree
,
2231 case VNC_ENCODING_TYPE_RICH_CURSOR
:
2232 case VNC_ENCODING_TYPE_X_CURSOR
:
2233 proto_item_append_text (ti_x
, " (hotspot X)");
2234 proto_item_append_text (ti_y
, " (hotspot Y)");
2235 proto_item_append_text (ti_width
, " (cursor width)");
2236 proto_item_append_text (ti_height
, " (cursor height)");
2238 if (encoding_type
== VNC_ENCODING_TYPE_RICH_CURSOR
)
2239 bytes_needed
= vnc_rich_cursor_encoding(tvb
, pinfo
, offset
, vnc_encoding_type_tree
, width
, height
);
2241 bytes_needed
= vnc_x_cursor_encoding(tvb
, pinfo
, offset
, vnc_encoding_type_tree
, width
, height
);
2245 case VNC_ENCODING_TYPE_POINTER_POS
:
2246 proto_item_append_text (ti_x
, " (pointer X)");
2247 proto_item_append_text (ti_y
, " (pointer Y)");
2248 proto_item_append_text (ti_width
, " (unused)");
2249 proto_item_append_text (ti_height
, " (unused)");
2253 case VNC_ENCODING_TYPE_DESKTOP_SIZE
:
2255 /* There is no payload for this message type */
2260 case VNC_ENCODING_TYPE_EXTENDED_DESK_SIZE
:
2261 bytes_needed
= vnc_extended_desktop_size(tvb
, offset
, vnc_encoding_type_tree
);
2264 case VNC_ENCODING_TYPE_KEYBOARD_LED_STATE
:
2266 /* There is no payload for this message type */
2271 case VNC_ENCODING_TYPE_SUPPORTED_MESSAGES
:
2272 bytes_needed
= vnc_supported_messages(tvb
, offset
,
2273 vnc_encoding_type_tree
,
2277 case VNC_ENCODING_TYPE_SUPPORTED_ENCODINGS
:
2278 bytes_needed
= vnc_supported_encodings(tvb
, offset
,
2279 vnc_encoding_type_tree
,
2283 case VNC_ENCODING_TYPE_SERVER_IDENTITY
:
2284 bytes_needed
= vnc_server_identity(tvb
, offset
,
2285 vnc_encoding_type_tree
,
2289 case VNC_ENCODING_TYPE_CONTEXT_INFORMATION
:
2290 bytes_needed
= vnc_context_information(tvb
, offset
,
2291 vnc_encoding_type_tree
);
2294 case VNC_ENCODING_TYPE_SLRLE
:
2295 bytes_needed
= vnc_slrle_encoding(tvb
, pinfo
, offset
,
2296 vnc_encoding_type_tree
,
2300 case VNC_ENCODING_TYPE_H264
:
2301 bytes_needed
= vnc_h264_encoding(tvb
, offset
,
2302 vnc_encoding_type_tree
);
2307 /* Check if the routines above requested more bytes to
2308 * be desegmented. */
2309 if(bytes_needed
> 0)
2310 return bytes_needed
;
2317 vnc_extended_desktop_size(tvbuff_t
*tvb
, int *offset
, proto_tree
*tree
)
2320 uint8_t i
, num_of_screens
;
2321 proto_tree
*screen_tree
;
2323 num_of_screens
= tvb_get_uint8(tvb
, *offset
);
2324 proto_tree_add_item(tree
, hf_vnc_desktop_screen_num
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2326 proto_tree_add_item(tree
, hf_vnc_padding
, tvb
, *offset
, 3, ENC_NA
);
2328 VNC_BYTES_NEEDED((uint32_t)(3 + (num_of_screens
* 16)));
2330 for(i
= 0; i
< num_of_screens
; i
++) {
2331 screen_tree
= proto_tree_add_subtree_format(tree
, tvb
, *offset
, 16, ett_vnc_desktop_screen
, NULL
, "Screen #%u", i
+1);
2333 proto_tree_add_item(screen_tree
, hf_vnc_desktop_screen_id
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2335 proto_tree_add_item(screen_tree
, hf_vnc_desktop_screen_x
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2337 proto_tree_add_item(screen_tree
, hf_vnc_desktop_screen_y
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2339 proto_tree_add_item(screen_tree
, hf_vnc_desktop_screen_width
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2341 proto_tree_add_item(screen_tree
, hf_vnc_desktop_screen_height
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2343 proto_tree_add_item(screen_tree
, hf_vnc_desktop_screen_flags
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2351 vnc_raw_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
2352 proto_tree
*tree
, const uint16_t width
, const uint16_t height
)
2354 uint8_t bytes_per_pixel
= vnc_get_bytes_per_pixel(pinfo
);
2357 length
= width
* height
* bytes_per_pixel
;
2358 VNC_BYTES_NEEDED(length
);
2360 proto_tree_add_item(tree
, hf_vnc_raw_pixel_data
, tvb
, *offset
,
2364 return 0; /* bytes_needed */
2369 vnc_copyrect_encoding(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, int *offset
,
2370 proto_tree
*tree
, const uint16_t width _U_
, const uint16_t height _U_
)
2372 proto_tree_add_item(tree
, hf_vnc_copyrect_src_x_pos
, tvb
, *offset
,
2376 proto_tree_add_item(tree
, hf_vnc_copyrect_src_y_pos
, tvb
, *offset
,
2380 return 0; /* bytes_needed */
2385 vnc_rre_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
2386 proto_tree
*tree
, const uint16_t width _U_
, const uint16_t height _U_
)
2388 uint8_t bytes_per_pixel
= vnc_get_bytes_per_pixel(pinfo
);
2389 uint32_t num_subrects
, i
;
2390 unsigned bytes_needed
;
2392 proto_tree
*subrect_tree
;
2394 VNC_BYTES_NEEDED(4);
2395 ti
= proto_tree_add_item(tree
, hf_vnc_rre_num_subrects
, tvb
, *offset
,
2397 num_subrects
= tvb_get_ntohl(tvb
, *offset
);
2400 if (num_subrects
> 10000) {
2401 expert_add_info_format(pinfo
, ti
, &ei_vnc_too_many_sub_rectangles
,
2402 "Too many sub-rectangles (%d), aborting dissection", num_subrects
);
2406 VNC_BYTES_NEEDED(bytes_per_pixel
);
2407 proto_tree_add_item(tree
, hf_vnc_rre_bg_pixel
, tvb
, *offset
,
2408 bytes_per_pixel
, ENC_NA
);
2409 *offset
+= bytes_per_pixel
;
2411 /* We know we need (at least) all these bytes, so ask for them now
2412 * (instead of a few at a time...).
2414 bytes_needed
= bytes_per_pixel
+ 8;
2415 VNC_BYTES_NEEDED(bytes_needed
* num_subrects
);
2416 for(i
= 0; i
< num_subrects
; i
++) {
2418 subrect_tree
= proto_tree_add_subtree_format(tree
, tvb
, *offset
, bytes_per_pixel
+
2419 8, ett_vnc_rre_subrect
, NULL
, "Subrectangle #%d", i
+1);
2421 proto_tree_add_item(subrect_tree
, hf_vnc_rre_subrect_pixel
,
2422 tvb
, *offset
, bytes_per_pixel
, ENC_NA
);
2423 *offset
+= bytes_per_pixel
;
2425 proto_tree_add_item(subrect_tree
, hf_vnc_rre_subrect_x_pos
,
2426 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2429 proto_tree_add_item(subrect_tree
, hf_vnc_rre_subrect_y_pos
,
2430 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2433 proto_tree_add_item(subrect_tree
, hf_vnc_rre_subrect_width
,
2434 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2437 proto_tree_add_item(subrect_tree
, hf_vnc_rre_subrect_height
,
2438 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2442 return 0; /* bytes_needed */
2447 vnc_hextile_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
2448 proto_tree
*tree
, const uint16_t width
, const uint16_t height
)
2450 uint8_t bytes_per_pixel
= vnc_get_bytes_per_pixel(pinfo
);
2451 uint8_t i
, subencoding_mask
, num_subrects
, subrect_len
, tile_height
, tile_width
;
2452 uint32_t raw_length
;
2453 proto_tree
*tile_tree
, *subencoding_mask_tree
, *subrect_tree
, *num_subrects_tree
;
2455 uint16_t current_height
= 0, current_width
;
2457 while(current_height
!= height
) {
2458 if (current_height
+ 16 > height
)
2459 tile_height
= height
- current_height
;
2462 current_height
+= tile_height
;
2464 while(current_width
!= width
) {
2465 if (current_width
+ 16 > width
)
2466 tile_width
= width
- current_width
;
2470 current_width
+= tile_width
;
2472 VNC_BYTES_NEEDED(1);
2473 subencoding_mask
= tvb_get_uint8(tvb
, *offset
);
2475 tile_tree
= proto_tree_add_subtree_format(tree
, tvb
, *offset
, 1, ett_vnc_hextile_tile
, NULL
,
2476 "Tile {%d:%d}, sub encoding mask %u", current_width
, current_height
, subencoding_mask
);
2478 ti
= proto_tree_add_item(tile_tree
, hf_vnc_hextile_subencoding_mask
, tvb
,
2479 *offset
, 1, ENC_BIG_ENDIAN
);
2481 subencoding_mask_tree
=
2482 proto_item_add_subtree(ti
, ett_vnc_hextile_subencoding_mask
);
2484 proto_tree_add_item(subencoding_mask_tree
,
2485 hf_vnc_hextile_raw
, tvb
, *offset
, 1,
2487 proto_tree_add_item(subencoding_mask_tree
,
2488 hf_vnc_hextile_bg
, tvb
, *offset
, 1,
2490 proto_tree_add_item(subencoding_mask_tree
,
2491 hf_vnc_hextile_fg
, tvb
, *offset
, 1,
2493 proto_tree_add_item(subencoding_mask_tree
,
2494 hf_vnc_hextile_anysubrects
, tvb
, *offset
, 1,
2496 proto_tree_add_item(subencoding_mask_tree
,
2497 hf_vnc_hextile_subrectscolored
, tvb
, *offset
, 1,
2501 if(subencoding_mask
& 0x1) { /* Raw */
2502 raw_length
= tile_width
* tile_height
* bytes_per_pixel
;
2504 VNC_BYTES_NEEDED(raw_length
);
2505 proto_tree_add_item(tile_tree
, hf_vnc_hextile_raw_value
, tvb
,
2506 *offset
, raw_length
, ENC_NA
);
2507 *offset
+= raw_length
;
2509 if(subencoding_mask
& 0x2) { /* Background Specified */
2510 VNC_BYTES_NEEDED(bytes_per_pixel
);
2511 proto_tree_add_item(tile_tree
, hf_vnc_hextile_bg_value
,
2512 tvb
, *offset
, bytes_per_pixel
,
2514 *offset
+= bytes_per_pixel
;
2517 if(subencoding_mask
& 0x4) { /* Foreground Specified */
2518 VNC_BYTES_NEEDED(bytes_per_pixel
);
2519 proto_tree_add_item(tile_tree
, hf_vnc_hextile_fg_value
,
2520 tvb
, *offset
, bytes_per_pixel
,
2522 *offset
+= bytes_per_pixel
;
2525 if(subencoding_mask
& 0x8) { /* Any Subrects */
2526 VNC_BYTES_NEEDED(3); /* 1 byte for number of subrects field, +2 at least for 1 subrect */
2527 ti
= proto_tree_add_item(tile_tree
,
2528 hf_vnc_hextile_num_subrects
,
2531 num_subrects
= tvb_get_uint8(tvb
, *offset
);
2534 if(subencoding_mask
& 0x10)
2535 subrect_len
= bytes_per_pixel
+ 2;
2538 VNC_BYTES_NEEDED((unsigned)(subrect_len
* num_subrects
));
2541 proto_item_add_subtree(ti
, ett_vnc_hextile_num_subrects
);
2543 for(i
= 0; i
< num_subrects
; i
++) {
2544 subrect_tree
= proto_tree_add_subtree_format(num_subrects_tree
, tvb
,
2545 *offset
, subrect_len
, ett_vnc_hextile_subrect
, NULL
,
2546 "Subrectangle #%d", i
+1);
2548 if(subencoding_mask
& 0x10) {
2549 /* Subrects Colored */
2550 proto_tree_add_item(subrect_tree
, hf_vnc_hextile_subrect_pixel_value
, tvb
, *offset
, bytes_per_pixel
, ENC_NA
);
2552 *offset
+= bytes_per_pixel
;
2555 proto_tree_add_item(subrect_tree
,
2556 hf_vnc_hextile_subrect_x_pos
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2558 proto_tree_add_item(subrect_tree
, hf_vnc_hextile_subrect_y_pos
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2562 proto_tree_add_item(subrect_tree
, hf_vnc_hextile_subrect_width
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2564 proto_tree_add_item(subrect_tree
, hf_vnc_hextile_subrect_height
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2572 return 0; /* bytes_needed */
2576 vnc_supported_messages(tvbuff_t
*tvb
, int *offset
, proto_tree
*tree
,
2577 const uint16_t width
)
2579 VNC_BYTES_NEEDED(width
);
2581 proto_tree_add_item(tree
,
2582 hf_vnc_supported_messages_client2server
,
2583 tvb
, *offset
, 32, ENC_NA
);
2585 proto_tree_add_item(tree
,
2586 hf_vnc_supported_messages_server2client
,
2587 tvb
, *offset
, 32, ENC_NA
);
2589 *offset
+= width
- 64;
2594 return 0; /* bytes_needed */
2598 vnc_supported_encodings(tvbuff_t
*tvb
, int *offset
, proto_tree
*tree
,
2599 const uint16_t width
, const uint16_t height
)
2603 proto_tree_add_uint(tree
, hf_vnc_num_supported_encodings
, tvb
, *offset
, 0, height
);
2605 VNC_BYTES_NEEDED(width
);
2606 for (; i
>= 4; i
-= 4) {
2607 proto_tree_add_item(tree
, hf_vnc_supported_encodings
,
2608 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2613 return 0; /* bytes_needed */
2617 vnc_server_identity(tvbuff_t
*tvb
, int *offset
, proto_tree
*tree
,
2618 const uint16_t width
)
2620 VNC_BYTES_NEEDED(width
);
2621 proto_tree_add_item(tree
, hf_vnc_server_identity
,
2622 tvb
, *offset
, width
, ENC_ASCII
);
2625 return 0; /* bytes_needed */
2629 vnc_mirrorlink(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
2636 proto_tree
*sub_tree
;
2639 VNC_BYTES_NEEDED(3);
2641 type
= tvb_get_uint8(tvb
, *offset
);
2642 proto_tree_add_item(tree
, hf_vnc_mirrorlink_type
,
2643 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2646 length
= tvb_get_ntohs(tvb
, *offset
);
2647 proto_tree_add_item(tree
, hf_vnc_mirrorlink_length
,
2648 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2651 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "MirrorLink (%s)",
2652 val_to_str_const(type
, vnc_mirrorlink_types_vs
,
2656 end
= *offset
+ length
;
2660 case VNC_ML_EXT_BYE_BYE
:
2663 case VNC_ML_EXT_SERVER_DISPLAY_CONFIGURATION
:
2664 VNC_BYTES_NEEDED(12);
2665 proto_tree_add_item(tree
, hf_vnc_mirrorlink_version_major
,
2666 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2668 proto_tree_add_item(tree
, hf_vnc_mirrorlink_version_minor
,
2669 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2671 proto_tree_add_item(tree
,
2672 hf_vnc_mirrorlink_framebuffer_configuration
,
2673 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2675 proto_tree_add_item(tree
, hf_vnc_mirrorlink_pixel_width
,
2676 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2678 proto_tree_add_item(tree
, hf_vnc_mirrorlink_pixel_height
,
2679 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2681 proto_tree_add_item(tree
, hf_vnc_mirrorlink_pixel_format
,
2682 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2686 case VNC_ML_EXT_CLIENT_DISPLAY_CONFIGURATION
:
2687 VNC_BYTES_NEEDED(14);
2688 proto_tree_add_item(tree
, hf_vnc_mirrorlink_version_major
,
2689 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2691 proto_tree_add_item(tree
, hf_vnc_mirrorlink_version_minor
,
2692 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2694 proto_tree_add_item(tree
,
2695 hf_vnc_mirrorlink_framebuffer_configuration
,
2696 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2698 proto_tree_add_item(tree
, hf_vnc_mirrorlink_pixel_width
,
2699 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2701 proto_tree_add_item(tree
, hf_vnc_mirrorlink_pixel_height
,
2702 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2704 proto_tree_add_item(tree
, hf_vnc_mirrorlink_display_width
,
2705 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2707 proto_tree_add_item(tree
, hf_vnc_mirrorlink_display_height
,
2708 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2710 proto_tree_add_item(tree
, hf_vnc_mirrorlink_display_distance
,
2711 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2715 case VNC_ML_EXT_SERVER_EVENT_CONFIGURATION
:
2716 case VNC_ML_EXT_CLIENT_EVENT_CONFIGURATION
:
2717 VNC_BYTES_NEEDED(28);
2718 proto_tree_add_item(tree
, hf_vnc_mirrorlink_keyboard_language
,
2719 tvb
, *offset
, 2, ENC_ASCII
);
2721 proto_tree_add_item(tree
, hf_vnc_mirrorlink_keyboard_country
,
2722 tvb
, *offset
, 2, ENC_ASCII
);
2724 proto_tree_add_item(tree
, hf_vnc_mirrorlink_ui_language
,
2725 tvb
, *offset
, 2, ENC_ASCII
);
2727 proto_tree_add_item(tree
, hf_vnc_mirrorlink_ui_country
,
2728 tvb
, *offset
, 2, ENC_ASCII
);
2730 proto_tree_add_item(tree
, hf_vnc_mirrorlink_knob_keys
,
2731 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2733 proto_tree_add_item(tree
, hf_vnc_mirrorlink_device_keys
,
2734 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2736 proto_tree_add_item(tree
, hf_vnc_mirrorlink_multimedia_keys
,
2737 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2739 proto_tree_add_item(tree
, hf_vnc_mirrorlink_key_related
,
2740 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2742 proto_tree_add_item(tree
, hf_vnc_mirrorlink_pointer_related
,
2743 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2747 case VNC_ML_EXT_EVENT_MAPPING
:
2748 case VNC_ML_EXT_EVENT_MAPPING_REQUEST
:
2749 VNC_BYTES_NEEDED(8);
2750 proto_tree_add_item(tree
,
2751 hf_vnc_mirrorlink_key_symbol_value_client
,
2752 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2754 proto_tree_add_item(tree
,
2755 hf_vnc_mirrorlink_key_symbol_value_server
,
2756 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2760 case VNC_ML_EXT_KEY_EVENT_LISTING
:
2761 VNC_BYTES_NEEDED(4);
2762 proto_tree_add_item(tree
, hf_vnc_mirrorlink_key_configuration
,
2763 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2765 num
= tvb_get_uint8(tvb
, *offset
);
2766 proto_tree_add_item(tree
, hf_vnc_mirrorlink_key_num_events
,
2767 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2769 proto_tree_add_item(tree
, hf_vnc_mirrorlink_key_event_counter
,
2770 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2772 VNC_BYTES_NEEDED((unsigned)(4 * num
));
2773 sub_tree
= proto_tree_add_subtree(tree
, tvb
, *offset
, 4 * num
,
2774 ett_vnc_key_events
, NULL
, "Key Event List");
2775 for (; num
> 0; num
--) {
2776 proto_tree_add_item(sub_tree
,
2777 hf_vnc_mirrorlink_key_symbol_value
,
2778 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2783 case VNC_ML_EXT_KEY_EVENT_LISTING_REQUEST
:
2784 VNC_BYTES_NEEDED(4);
2785 proto_tree_add_item(tree
,
2786 hf_vnc_mirrorlink_key_request_configuration
,
2787 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2791 case VNC_ML_EXT_VIRTUAL_KEYBOARD
:
2792 VNC_BYTES_NEEDED(16);
2793 proto_tree_add_item(tree
,
2794 hf_vnc_mirrorlink_keyboard_configuration
,
2795 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2797 proto_tree_add_item(tree
, hf_vnc_mirrorlink_cursor_x
,
2798 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2800 proto_tree_add_item(tree
, hf_vnc_mirrorlink_cursor_y
,
2801 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2803 proto_tree_add_item(tree
, hf_vnc_mirrorlink_text_x
,
2804 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2806 proto_tree_add_item(tree
, hf_vnc_mirrorlink_text_y
,
2807 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2809 proto_tree_add_item(tree
, hf_vnc_mirrorlink_text_width
,
2810 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2812 proto_tree_add_item(tree
, hf_vnc_mirrorlink_text_height
,
2813 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2817 case VNC_ML_EXT_VIRTUAL_KEYBOARD_REQUEST
:
2818 VNC_BYTES_NEEDED(4);
2819 proto_tree_add_item(tree
,
2820 hf_vnc_mirrorlink_keyboard_request_configuration
,
2821 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2825 case VNC_ML_EXT_DEVICE_STATUS
:
2826 case VNC_ML_EXT_DEVICE_STATUS_REQUEST
:
2827 VNC_BYTES_NEEDED(4);
2828 proto_tree_add_item(tree
, hf_vnc_mirrorlink_device_status
,
2829 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2833 case VNC_ML_EXT_CONTENT_ATTESTATION :
2836 case VNC_ML_EXT_CONTENT_ATTESTATION_REQUEST :
2839 case VNC_ML_EXT_FB_BLOCKING_NOTIFICATION
:
2840 VNC_BYTES_NEEDED(14);
2841 proto_tree_add_item(tree
, hf_vnc_mirrorlink_fb_block_x
,
2842 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2844 proto_tree_add_item(tree
, hf_vnc_mirrorlink_fb_block_y
,
2845 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2847 proto_tree_add_item(tree
, hf_vnc_mirrorlink_fb_block_width
,
2848 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2850 proto_tree_add_item(tree
, hf_vnc_mirrorlink_fb_block_height
,
2851 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2853 proto_tree_add_item(tree
, hf_vnc_mirrorlink_app_id
,
2854 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2856 proto_tree_add_item(tree
, hf_vnc_mirrorlink_fb_block_reason
,
2857 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2861 case VNC_ML_EXT_AUDIO_BLOCKING_NOTIFICATION
:
2862 VNC_BYTES_NEEDED(6);
2863 proto_tree_add_item(tree
, hf_vnc_mirrorlink_app_id
,
2864 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2866 proto_tree_add_item(tree
, hf_vnc_mirrorlink_audio_block_reason
,
2867 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2871 case VNC_ML_EXT_TOUCH_EVENT
:
2872 VNC_BYTES_NEEDED(1);
2873 num
= tvb_get_uint8(tvb
, *offset
);
2874 proto_tree_add_item(tree
, hf_vnc_mirrorlink_touch_num_events
,
2875 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2877 VNC_BYTES_NEEDED((unsigned)(6 * num
));
2878 /*sub_tree = proto_item_add_subtree(tree, ett_vnc_touch_events);*/
2879 for (i
= 0; i
< num
; i
++) {
2880 sub_tree
= proto_tree_add_subtree_format(tree
, tvb
, *offset
, 6,
2881 ett_vnc_touch_events
, NULL
, "Touch Event #%d", i
+ 1);
2883 proto_tree_add_item(sub_tree
, hf_vnc_mirrorlink_touch_x
,
2884 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2886 proto_tree_add_item(sub_tree
, hf_vnc_mirrorlink_touch_y
,
2887 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2889 proto_tree_add_item(sub_tree
,
2890 hf_vnc_mirrorlink_touch_id
,
2891 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2893 proto_tree_add_item(sub_tree
,
2894 hf_vnc_mirrorlink_touch_pressure
,
2895 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2900 case VNC_ML_EXT_FB_ALTERNATIVE_TEXT
:
2901 VNC_BYTES_NEEDED(6);
2902 proto_tree_add_item(tree
, hf_vnc_mirrorlink_app_id
,
2903 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2905 num
= tvb_get_ntohs(tvb
, *offset
);
2906 proto_tree_add_item(tree
, hf_vnc_mirrorlink_text_length
,
2907 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2909 VNC_BYTES_NEEDED(num
);
2910 proto_tree_add_item(tree
, hf_vnc_mirrorlink_text
,
2911 tvb
, *offset
, num
, ENC_ASCII
);
2915 case VNC_ML_EXT_FB_ALTERNATIVE_TEXT_REQUEST
:
2916 VNC_BYTES_NEEDED(2);
2917 proto_tree_add_item(tree
, hf_vnc_mirrorlink_text_max_length
,
2918 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2924 if (end
> *offset
) {
2925 length
= end
- *offset
;
2926 VNC_BYTES_NEEDED(length
);
2927 proto_tree_add_item(tree
, hf_vnc_mirrorlink_unknown
,
2928 tvb
, *offset
, length
, ENC_NA
);
2932 return 0; /* bytes_needed */
2936 vnc_fence(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
2939 unsigned payload_length
;
2941 VNC_BYTES_NEEDED(8);
2943 payload_length
= tvb_get_uint8(tvb
, *offset
+7);
2944 VNC_BYTES_NEEDED((8+payload_length
));
2946 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, "; ", "Fence");
2948 proto_tree_add_item(tree
, hf_vnc_padding
, tvb
, *offset
, 3, ENC_NA
);
2949 *offset
+= 3; /* skip padding */
2951 proto_tree_add_bitmask(tree
, tvb
, *offset
, hf_vnc_fence_flags
,
2952 ett_vnc_fence_flags
, vnc_fence_flags
, ENC_BIG_ENDIAN
);
2956 proto_tree_add_item(tree
, hf_vnc_fence_payload_length
,
2957 tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
2961 if (payload_length
> 0) {
2962 proto_tree_add_item(tree
, hf_vnc_fence_payload
,
2963 tvb
, *offset
, payload_length
, ENC_NA
);
2964 *offset
+= payload_length
;
2970 vnc_context_information(tvbuff_t
*tvb
, int *offset
, proto_tree
*tree
)
2972 VNC_BYTES_NEEDED(20);
2974 proto_tree_add_item(tree
, hf_vnc_context_information_app_id
,
2975 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2978 proto_tree_add_item(tree
, hf_vnc_context_information_app_trust_level
,
2979 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2982 proto_tree_add_item(tree
,
2983 hf_vnc_context_information_content_trust_level
,
2984 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
2987 proto_tree_add_item(tree
, hf_vnc_context_information_app_category
,
2988 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2991 proto_tree_add_item(tree
, hf_vnc_context_information_content_category
,
2992 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2995 proto_tree_add_item(tree
, hf_vnc_context_information_content_rules
,
2996 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
2999 return 0; /* bytes_needed */
3003 vnc_slrle_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
3004 proto_tree
*tree
, const uint16_t height
)
3006 uint8_t depth
= vnc_get_depth(pinfo
);
3007 uint8_t depth_mod
= depth
% 8;
3008 uint8_t bytes_per_run
;
3009 uint16_t num_runs
, i
;
3011 proto_tree
*sub_tree
;
3014 bytes_per_run
= ( 8 - depth_mod
+ depth
) / 8;
3016 bytes_per_run
= (16 - depth_mod
+ depth
) / 8;
3018 for (i
= 0; i
< height
; i
++) {
3019 VNC_BYTES_NEEDED(2);
3020 num_runs
= tvb_get_ntohs(tvb
, *offset
);
3022 length
= num_runs
* bytes_per_run
;
3024 sub_tree
= proto_tree_add_subtree_format(tree
, tvb
, *offset
, 2 + length
,
3025 ett_vnc_slrle_subline
, NULL
, "Scanline #%d", i
+1);
3027 proto_tree_add_item(sub_tree
, hf_vnc_slrle_run_num
,
3028 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
3031 VNC_BYTES_NEEDED(length
);
3032 proto_tree_add_item(sub_tree
, hf_vnc_slrle_run_data
,
3033 tvb
, *offset
, length
, ENC_NA
);
3037 return 0; /* bytes_needed */
3041 vnc_h264_encoding(tvbuff_t
*tvb
, int *offset
, proto_tree
*tree
)
3045 VNC_BYTES_NEEDED(16);
3047 nbytes
= tvb_get_ntohl(tvb
, *offset
);
3048 proto_tree_add_item(tree
, hf_vnc_h264_nbytes
,
3049 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
3052 /*0 == P-Frame; 1 == B-Frame; 2 == I-Frame*/
3053 proto_tree_add_item(tree
, hf_vnc_h264_slice_type
,
3054 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
3057 proto_tree_add_item(tree
, hf_vnc_h264_width
,
3058 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
3061 proto_tree_add_item(tree
, hf_vnc_h264_height
,
3062 tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
3065 VNC_BYTES_NEEDED(nbytes
);
3066 proto_tree_add_item(tree
, hf_vnc_h264_data
,
3067 tvb
, *offset
, nbytes
, ENC_NA
);
3070 return 0; /* bytes_needed */
3073 #if defined(HAVE_ZLIB) || defined(HAVE_ZLIBNG)
3075 vnc_zrle_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
3076 proto_tree
*tree
, const uint16_t width
, const uint16_t height
)
3079 vnc_zrle_encoding(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, int *offset
,
3080 proto_tree
*tree
, const uint16_t width _U_
, const uint16_t height _U_
)
3084 #if defined (HAVE_ZLIB) || defined (HAVE_ZLIBNG)
3085 uint8_t palette_size
;
3086 uint8_t bytes_per_cpixel
= vnc_get_bytes_per_pixel(pinfo
);
3087 int uncomp_offset
= 0;
3089 int subencoding_type
;
3090 tvbuff_t
*uncomp_tvb
;
3091 proto_tree
*zrle_subencoding_tree
;
3095 VNC_BYTES_NEEDED(4);
3096 proto_tree_add_item(tree
, hf_vnc_zrle_len
, tvb
, *offset
,
3098 data_len
= tvb_get_ntohl(tvb
, *offset
);
3102 VNC_BYTES_NEEDED(data_len
);
3104 proto_tree_add_item(tree
, hf_vnc_zrle_data
, tvb
, *offset
,
3107 #if defined (HAVE_ZLIB) || defined (HAVE_ZLIBNG)
3108 uncomp_tvb
= tvb_child_uncompress_zlib(tvb
, tvb
, *offset
, data_len
);
3110 if(uncomp_tvb
!= NULL
) {
3111 add_new_data_source(pinfo
, uncomp_tvb
,
3112 "Uncompressed ZRLE data");
3114 ti
= proto_tree_add_item(tree
, hf_vnc_zrle_subencoding
,
3115 uncomp_tvb
, uncomp_offset
, 1, ENC_BIG_ENDIAN
);
3116 zrle_subencoding_tree
=
3117 proto_item_add_subtree(ti
, ett_vnc_zrle_subencoding
);
3119 proto_tree_add_item(zrle_subencoding_tree
, hf_vnc_zrle_rle
,
3120 uncomp_tvb
, uncomp_offset
, 1, ENC_BIG_ENDIAN
);
3122 proto_tree_add_item(zrle_subencoding_tree
,
3123 hf_vnc_zrle_palette_size
, uncomp_tvb
,
3124 uncomp_offset
, 1, ENC_BIG_ENDIAN
);
3126 subencoding_type
= tvb_get_uint8(uncomp_tvb
, uncomp_offset
);
3127 palette_size
= subencoding_type
& 0x7F;
3131 if(subencoding_type
== 0) { /* Raw */
3132 length
= width
* height
* bytes_per_cpixel
;
3133 VNC_BYTES_NEEDED(length
);
3135 /* XXX - not working yet! */
3137 proto_tree_add_item(zrle_subencoding_tree
,
3138 hf_vnc_zrle_raw
, uncomp_tvb
,
3139 uncomp_offset
, length
, ENC_NA
);
3141 } else if(subencoding_type
>= 130 && subencoding_type
<= 255) {
3142 length
= palette_size
* bytes_per_cpixel
;
3143 VNC_BYTES_NEEDED(length
);
3145 proto_tree_add_item(zrle_subencoding_tree
,
3146 hf_vnc_zrle_palette
, uncomp_tvb
,
3147 uncomp_offset
, length
, ENC_NA
);
3149 /* XXX - Not complete! */
3153 proto_tree_add_expert(tree
, pinfo
, &ei_vnc_zrle_failed
, tvb
, *offset
, data_len
);
3155 #endif /* HAVE_ZLIB */
3157 *offset
+= data_len
;
3159 return 0; /* bytes_needed */
3164 read_compact_len(tvbuff_t
*tvb
, int *offset
, int *length
, int *value_length
)
3168 VNC_BYTES_NEEDED(1);
3172 b
= tvb_get_uint8(tvb
, *offset
);
3177 if ((b
& 0x80) != 0) {
3178 VNC_BYTES_NEEDED(1);
3180 b
= tvb_get_uint8(tvb
, *offset
);
3184 *length
|= (b
& 0x7f) << 7;
3186 if ((b
& 0x80) != 0) {
3187 VNC_BYTES_NEEDED (1);
3189 b
= tvb_get_uint8(tvb
, *offset
);
3193 *length
|= (b
& 0xff) << 14;
3202 process_compact_length_and_image_data(tvbuff_t
*tvb
, int *offset
, proto_tree
*tree
)
3204 unsigned bytes_needed
;
3205 unsigned length
, value_length
;
3207 bytes_needed
= read_compact_len (tvb
, offset
, &length
, &value_length
);
3208 if (bytes_needed
!= 0)
3209 return bytes_needed
;
3211 proto_tree_add_uint(tree
, hf_vnc_tight_image_len
, tvb
, *offset
- value_length
, value_length
, length
);
3213 VNC_BYTES_NEEDED(length
);
3214 proto_tree_add_item(tree
, hf_vnc_tight_image_data
, tvb
, *offset
, length
, ENC_NA
);
3217 return 0; /* bytes_needed */
3222 process_tight_rect_filter_palette(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
3223 proto_tree
*tree
, int *bits_per_pixel
)
3225 vnc_packet_t
*per_packet_info
;
3227 unsigned palette_bytes
;
3229 /* See TightVNC's vnc_unixsrc/vncviewer/tight.c:InitFilterPaletteBPP() */
3231 per_packet_info
= (vnc_packet_t
*)p_get_proto_data(wmem_file_scope(), pinfo
, proto_vnc
, 0);
3232 /* Our calling function should have set the packet's proto data already */
3233 DISSECTOR_ASSERT(per_packet_info
!= NULL
);
3235 VNC_BYTES_NEEDED(1);
3236 proto_tree_add_item(tree
, hf_vnc_tight_palette_num_colors
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
3237 num_colors
= tvb_get_uint8(tvb
, *offset
);
3244 if (per_packet_info
->depth
== 24)
3245 palette_bytes
= num_colors
* 3;
3247 palette_bytes
= num_colors
* per_packet_info
->depth
/ 8;
3249 VNC_BYTES_NEEDED(palette_bytes
);
3250 proto_tree_add_item(tree
, hf_vnc_tight_palette_data
, tvb
, *offset
, palette_bytes
, ENC_NA
);
3251 *offset
+= palette_bytes
;
3253 /* This is the number of bits per pixel *in the image data*, not the actual client depth */
3254 if (num_colors
== 2)
3255 *bits_per_pixel
= 1;
3257 *bits_per_pixel
= 8;
3263 vnc_tight_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
3264 proto_tree
*tree
, const uint16_t width _U_
, const uint16_t height _U_
)
3266 vnc_packet_t
*per_packet_info
;
3268 proto_item
*compression_type_ti
;
3270 int bytes_needed
= -1;
3272 per_packet_info
= (vnc_packet_t
*)p_get_proto_data(wmem_file_scope(), pinfo
, proto_vnc
, 0);
3273 /* Our calling function should have set the packet's proto data already */
3274 DISSECTOR_ASSERT(per_packet_info
!= NULL
);
3276 /* See xserver/hw/vnc/rfbproto.h and grep for "Tight Encoding." for the following layout */
3278 VNC_BYTES_NEEDED(1);
3280 /* least significant bits 0-3 are "reset compression stream N" */
3281 bit_offset
= *offset
* 8;
3282 proto_tree_add_bits_item(tree
, hf_vnc_tight_reset_stream0
, tvb
, bit_offset
+ 7, 1, ENC_BIG_ENDIAN
);
3283 proto_tree_add_bits_item(tree
, hf_vnc_tight_reset_stream1
, tvb
, bit_offset
+ 6, 1, ENC_BIG_ENDIAN
);
3284 proto_tree_add_bits_item(tree
, hf_vnc_tight_reset_stream2
, tvb
, bit_offset
+ 5, 1, ENC_BIG_ENDIAN
);
3285 proto_tree_add_bits_item(tree
, hf_vnc_tight_reset_stream3
, tvb
, bit_offset
+ 4, 1, ENC_BIG_ENDIAN
);
3287 /* most significant bits 4-7 are "compression type" */
3288 compression_type_ti
= proto_tree_add_bits_item(tree
, hf_vnc_tight_rect_type
, tvb
, bit_offset
+ 0, 4, ENC_BIG_ENDIAN
);
3290 comp_ctl
= tvb_get_uint8(tvb
, *offset
);
3293 comp_ctl
>>= 4; /* skip over the "reset compression" bits from above */
3295 /* compression format */
3297 if (comp_ctl
== TIGHT_RECT_FILL
) {
3298 /* "fill" encoding (solid rectangle) */
3300 proto_item_append_text(compression_type_ti
, " (fill encoding - solid rectangle)");
3302 if (per_packet_info
->depth
== 24) {
3303 VNC_BYTES_NEEDED(3);
3304 proto_tree_add_item(tree
, hf_vnc_tight_fill_color
, tvb
, *offset
, 3, ENC_NA
);
3307 VNC_BYTES_NEEDED(per_packet_info
->bytes_per_pixel
);
3308 proto_tree_add_item(tree
, hf_vnc_tight_fill_color
, tvb
, *offset
, per_packet_info
->bytes_per_pixel
, ENC_NA
);
3309 *offset
+= per_packet_info
->bytes_per_pixel
;
3313 } else if (comp_ctl
== TIGHT_RECT_JPEG
) {
3316 proto_item_append_text(compression_type_ti
, " (JPEG encoding)");
3317 bytes_needed
= process_compact_length_and_image_data(tvb
, offset
, tree
);
3318 if (bytes_needed
!= 0)
3319 return bytes_needed
;
3320 } else if (comp_ctl
> TIGHT_RECT_MAX_VALUE
) {
3321 /* invalid encoding */
3323 expert_add_info(pinfo
, compression_type_ti
, &ei_vnc_invalid_encoding
);
3328 /* basic encoding */
3330 proto_item_append_text(compression_type_ti
, " (basic encoding)");
3332 proto_tree_add_bits_item(tree
, hf_vnc_tight_filter_flag
, tvb
, bit_offset
+ 1, 1, ENC_BIG_ENDIAN
);
3334 bits_per_pixel
= per_packet_info
->depth
;
3336 if ((comp_ctl
& TIGHT_RECT_EXPLICIT_FILTER_FLAG
) != 0) {
3339 /* explicit filter */
3341 VNC_BYTES_NEEDED(1);
3342 proto_tree_add_item(tree
, hf_vnc_tight_filter_id
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
3343 filter_id
= tvb_get_uint8(tvb
, *offset
);
3346 switch (filter_id
) {
3347 case TIGHT_RECT_FILTER_COPY
:
3351 case TIGHT_RECT_FILTER_PALETTE
:
3352 bytes_needed
= process_tight_rect_filter_palette(tvb
, pinfo
, offset
, tree
, &bits_per_pixel
);
3353 if (bytes_needed
!= 0)
3354 return bytes_needed
;
3358 case TIGHT_RECT_FILTER_GRADIENT
:
3363 /* this is the same case as TIGHT_RECT_FILTER_COPY, so there's nothing special to do */
3366 row_size
= ((unsigned) width
* bits_per_pixel
+ 7) / 8;
3367 if (row_size
* height
< TIGHT_MIN_BYTES_TO_COMPRESS
) {
3370 /* The data is not compressed; just skip over it */
3372 num_bytes
= row_size
* height
;
3373 VNC_BYTES_NEEDED(num_bytes
);
3374 proto_tree_add_item(tree
, hf_vnc_tight_image_data
, tvb
, *offset
, num_bytes
, ENC_NA
);
3375 *offset
+= num_bytes
;
3379 /* The data is compressed; read its length and data */
3380 bytes_needed
= process_compact_length_and_image_data(tvb
, offset
, tree
);
3381 if (bytes_needed
!= 0)
3382 return bytes_needed
;
3386 DISSECTOR_ASSERT(bytes_needed
!= -1);
3388 return bytes_needed
;
3393 decode_cursor(tvbuff_t
*tvb
, int *offset
, proto_tree
*tree
,
3394 unsigned pixels_bytes
, unsigned mask_bytes
)
3396 unsigned total_bytes
;
3398 total_bytes
= pixels_bytes
+ mask_bytes
;
3399 VNC_BYTES_NEEDED (total_bytes
);
3401 proto_tree_add_item(tree
, hf_vnc_cursor_encoding_pixels
, tvb
, *offset
,
3402 pixels_bytes
, ENC_NA
);
3403 *offset
+= pixels_bytes
;
3405 proto_tree_add_item(tree
, hf_vnc_cursor_encoding_bitmask
, tvb
, *offset
,
3406 mask_bytes
, ENC_NA
);
3407 *offset
+= mask_bytes
;
3409 return 0; /* bytes_needed */
3414 vnc_rich_cursor_encoding(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
3415 proto_tree
*tree
, const uint16_t width
, const uint16_t height
)
3417 uint8_t bytes_per_pixel
= vnc_get_bytes_per_pixel(pinfo
);
3418 unsigned pixels_bytes
, mask_bytes
;
3420 pixels_bytes
= width
* height
* bytes_per_pixel
;
3421 mask_bytes
= ((width
+ 7) / 8) * height
;
3423 return decode_cursor(tvb
, offset
, tree
,
3424 pixels_bytes
, mask_bytes
);
3429 vnc_x_cursor_encoding(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, int *offset
,
3430 proto_tree
*tree
, const uint16_t width
, const uint16_t height
)
3432 int bitmap_row_bytes
= (width
+ 7) / 8;
3433 int mask_bytes
= bitmap_row_bytes
* height
;
3435 VNC_BYTES_NEEDED (6);
3436 proto_tree_add_item(tree
, hf_vnc_cursor_x_fore_back
, tvb
, *offset
, 6, ENC_NA
);
3439 /* The length of the pixel data is the same as the length of the mask data (X cursors are strictly black/white) */
3440 return decode_cursor(tvb
, offset
, tree
,
3441 mask_bytes
, mask_bytes
);
3446 vnc_server_set_colormap_entries(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
3449 uint16_t number_of_colors
;
3450 unsigned counter
, bytes_needed
;
3452 proto_tree
*vnc_colormap_num_groups
, *vnc_colormap_color_group
;
3454 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, "; ", "Server set colormap entries");
3456 number_of_colors
= tvb_get_ntohs(tvb
, 4);
3458 VNC_BYTES_NEEDED(3);
3459 proto_tree_add_item(tree
, hf_vnc_padding
, tvb
, *offset
, 1, ENC_NA
);
3460 *offset
+= 1; /* Skip over 1 byte of padding */
3462 proto_tree_add_item(tree
, hf_vnc_colormap_first_color
,
3463 tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
3466 /* XXX - this is 3 bytes into the tvb, but number_of_colors is set off
3467 * of 4 bytes in... Bug???
3469 ti
= proto_tree_add_item(tree
, hf_vnc_colormap_num_colors
, tvb
,
3470 *offset
, 2, ENC_BIG_ENDIAN
);
3472 if (number_of_colors
> 10000) {
3473 expert_add_info_format(pinfo
, ti
, &ei_vnc_too_many_colors
,"Too many colors (%d), aborting dissection",
3478 bytes_needed
= (number_of_colors
* 6) + 5;
3479 VNC_BYTES_NEEDED(bytes_needed
);
3483 ti
= proto_tree_add_item(tree
, hf_vnc_color_groups
, tvb
,
3484 *offset
, number_of_colors
* 6, ENC_NA
);
3485 vnc_colormap_num_groups
=
3486 proto_item_add_subtree(ti
, ett_vnc_colormap_num_groups
);
3488 for(counter
= 0; counter
< number_of_colors
; counter
++) {
3489 vnc_colormap_color_group
= proto_tree_add_subtree_format(vnc_colormap_num_groups
, tvb
,
3490 *offset
, 6, ett_vnc_colormap_color_group
, NULL
,
3491 "Color group #%d", counter
+1);
3493 proto_tree_add_item(vnc_colormap_color_group
,
3494 hf_vnc_colormap_red
, tvb
,
3495 *offset
, 2, ENC_BIG_ENDIAN
);
3498 proto_tree_add_item(vnc_colormap_color_group
,
3499 hf_vnc_colormap_green
, tvb
,
3500 *offset
, 2, ENC_BIG_ENDIAN
);
3503 proto_tree_add_item(vnc_colormap_color_group
,
3504 hf_vnc_colormap_blue
, tvb
,
3505 *offset
, 2, ENC_BIG_ENDIAN
);
3513 vnc_server_ring_bell(tvbuff_t
*tvb _U_
, packet_info
*pinfo
, int *offset _U_
,
3514 proto_tree
*tree _U_
)
3516 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, "; ", "Server ring bell on client");
3517 /* This message type has no payload... */
3522 vnc_server_cut_text(tvbuff_t
*tvb
, packet_info
*pinfo
, int *offset
,
3528 col_append_sep_str(pinfo
->cinfo
, COL_INFO
, "; ", "Server cut text");
3530 text_len
= tvb_get_ntohl(tvb
, *offset
);
3531 pi
= proto_tree_add_item(tree
, hf_vnc_server_cut_text_len
, tvb
, *offset
, 4,
3535 if (text_len
> 100000) {
3536 expert_add_info_format(pinfo
, pi
, &ei_vnc_too_many_cut_text
,
3537 "Too much cut text (%d), aborting dissection", text_len
);
3541 VNC_BYTES_NEEDED(text_len
);
3543 proto_tree_add_item(tree
, hf_vnc_server_cut_text
, tvb
, *offset
,
3544 text_len
, ENC_ASCII
);
3545 *offset
+= text_len
;
3552 vnc_set_bytes_per_pixel(packet_info
*pinfo
, vnc_conversation_t
*per_conversation_info
, const uint8_t bytes_per_pixel
)
3554 if (PINFO_FD_VISITED(pinfo
)) {
3558 vnc_packet_t
*per_packet_info
;
3560 per_packet_info
= (vnc_packet_t
*)p_get_proto_data(wmem_file_scope(), pinfo
, proto_vnc
, 0);
3561 /* Our calling function should have set the packet's proto data already */
3562 DISSECTOR_ASSERT(per_packet_info
!= NULL
);
3564 per_packet_info
->bytes_per_pixel
= per_conversation_info
->bytes_per_pixel
= bytes_per_pixel
;
3569 vnc_set_depth(packet_info
*pinfo
, vnc_conversation_t
*per_conversation_info
, const uint8_t depth
)
3571 if (PINFO_FD_VISITED(pinfo
)) {
3575 vnc_packet_t
*per_packet_info
;
3577 per_packet_info
= (vnc_packet_t
*)p_get_proto_data(wmem_file_scope(), pinfo
, proto_vnc
, 0);
3578 /* Our calling function should have set the packet's proto data already */
3579 DISSECTOR_ASSERT(per_packet_info
!= NULL
);
3581 per_packet_info
->depth
= per_conversation_info
->depth
= depth
;
3586 vnc_get_bytes_per_pixel(packet_info
*pinfo
)
3588 vnc_packet_t
*per_packet_info
;
3590 per_packet_info
= (vnc_packet_t
*)p_get_proto_data(wmem_file_scope(), pinfo
, proto_vnc
, 0);
3591 /* Our calling function should have set the packet's proto data already */
3592 DISSECTOR_ASSERT(per_packet_info
!= NULL
);
3594 return per_packet_info
->bytes_per_pixel
;
3599 vnc_get_depth(packet_info
*pinfo
)
3601 vnc_packet_t
*per_packet_info
;
3603 per_packet_info
= (vnc_packet_t
*)p_get_proto_data(wmem_file_scope(), pinfo
, proto_vnc
, 0);
3604 /* Our calling function should have set the packet's proto data already */
3605 DISSECTOR_ASSERT(per_packet_info
!= NULL
);
3607 return per_packet_info
->depth
;
3610 /* Preference callbacks */
3612 apply_vnc_prefs(void) {
3613 vnc_tcp_range
= prefs_get_range_value("vnc", "tcp.port");
3616 /* Register the protocol with Wireshark */
3618 proto_register_vnc(void)
3620 module_t
*vnc_module
; /* To handle our preferences */
3621 expert_module_t
* expert_vnc
;
3623 /* Setup list of header fields */
3624 static hf_register_info hf
[] = {
3626 { "Padding", "vnc.padding",
3627 FT_NONE
, BASE_NONE
, NULL
, 0x0,
3628 "Unused space", HFILL
}
3631 { &hf_vnc_server_proto_ver
,
3632 { "Server protocol version", "vnc.server_proto_ver",
3633 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3634 "VNC protocol version on server", HFILL
}
3636 { &hf_vnc_client_proto_ver
,
3637 { "Client protocol version", "vnc.client_proto_ver",
3638 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3639 "VNC protocol version on client", HFILL
}
3641 { &hf_vnc_num_security_types
,
3642 { "Number of security types", "vnc.num_security_types",
3643 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3644 "Number of security (authentication) types supported by the server", HFILL
}
3646 { &hf_vnc_security_type
,
3647 { "Security type", "vnc.security_type",
3648 FT_UINT8
, BASE_DEC
, VALS(vnc_security_types_vs
), 0x0,
3649 "Security types offered by the server (VNC versions => 3.007)", HFILL
}
3651 { &hf_vnc_server_security_type
,
3652 { "Security type", "vnc.server_security_type",
3653 FT_UINT32
, BASE_DEC
, VALS(vnc_security_types_vs
), 0x0,
3654 "Security type mandated by the server", HFILL
}
3656 { &hf_vnc_client_security_type
,
3657 { "Security type selected", "vnc.client_security_type",
3658 FT_UINT8
, BASE_DEC
, VALS(vnc_security_types_vs
), 0x0,
3659 "Security type selected by the client", HFILL
}
3661 { &hf_vnc_tight_num_tunnel_types
,
3662 { "Number of supported tunnel types", "vnc.num_tunnel_types",
3663 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3664 "Number of tunnel types for TightVNC", HFILL
}
3666 { &hf_vnc_tight_tunnel_type_code
,
3667 { "Tunnel type code", "vnc.tunnel_type_code",
3668 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3669 "Tunnel type code specific to TightVNC", HFILL
}
3671 { &hf_vnc_tight_tunnel_type_vendor
,
3672 { "Tunnel type vendor", "vnc.tunnel_type_vendor",
3673 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3674 "Tunnel type vendor specific to TightVNC", HFILL
}
3676 { &hf_vnc_tight_tunnel_type_signature
,
3677 { "Tunnel type signature", "vnc.tunnel_type_signature",
3678 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3679 "Tunnel type signature specific to TightVNC", HFILL
}
3681 { &hf_vnc_tight_num_auth_types
,
3682 { "Number of supported authentication types", "vnc.num_auth_types",
3683 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3684 "Authentication types specific to TightVNC", HFILL
}
3686 { &hf_vnc_tight_auth_code
,
3687 { "Authentication code", "vnc.tight_auth_code",
3688 FT_UINT32
, BASE_DEC
, VALS(vnc_security_types_vs
), 0x0,
3689 "Authentication code specific to TightVNC", HFILL
}
3691 { &hf_vnc_tight_server_message_type
,
3692 { "Server message type (TightVNC)", "vnc.tight_server_message_type",
3693 FT_INT32
, BASE_DEC
, NULL
, 0x0,
3694 "Server message type specific to TightVNC", HFILL
}
3696 { &hf_vnc_tight_server_vendor
,
3697 { "Server vendor code", "vnc.server_vendor",
3698 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3699 "Server vendor code specific to TightVNC", HFILL
}
3701 { &hf_vnc_tight_signature
,
3702 { "Signature", "vnc.signature",
3703 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3706 { &hf_vnc_tight_server_name
,
3707 { "Server name", "vnc.server_name",
3708 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3709 "Server name specific to TightVNC", HFILL
}
3711 { &hf_vnc_tight_client_message_type
,
3712 { "Client message type (TightVNC)", "vnc.tight_client_message_type",
3713 FT_INT32
, BASE_DEC
, NULL
, 0x0,
3714 "Client message type specific to TightVNC", HFILL
}
3716 { &hf_vnc_tight_client_vendor
,
3717 { "Client vendor code", "vnc.client_vendor",
3718 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3719 "Client vendor code specific to TightVNC", HFILL
}
3721 { &hf_vnc_tight_client_name
,
3722 { "Client name", "vnc.client_name",
3723 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3724 "Client name specific to TightVNC", HFILL
}
3726 { &hf_vnc_tight_encoding_type
,
3727 { "Encoding type", "vnc.encoding_type",
3728 FT_INT32
, BASE_DEC
, VALS(encoding_types_vs
), 0x0,
3729 "Encoding type specific to TightVNC", HFILL
}
3731 { &hf_vnc_tight_encoding_vendor
,
3732 { "Encoding vendor code", "vnc.encoding_vendor",
3733 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3734 "Encoding vendor code specific to TightVNC", HFILL
}
3736 { &hf_vnc_tight_encoding_name
,
3737 { "Encoding name", "vnc.encoding_name",
3738 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3739 "Encoding name specific to TightVNC", HFILL
}
3741 { &hf_vnc_tight_reset_stream0
,
3742 { "Reset compression stream 0", "vnc.tight_reset_stream0",
3743 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3744 "Tight compression, reset compression stream 0", HFILL
}
3746 { &hf_vnc_tight_reset_stream1
,
3747 { "Reset compression stream 1", "vnc.tight_reset_stream1",
3748 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3749 "Tight compression, reset compression stream 1", HFILL
}
3751 { &hf_vnc_tight_reset_stream2
,
3752 { "Reset compression stream 2", "vnc.tight_reset_stream2",
3753 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3754 "Tight compression, reset compression stream 2", HFILL
}
3756 { &hf_vnc_tight_reset_stream3
,
3757 { "Reset compression stream 3", "vnc.tight_reset_stream3",
3758 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3759 "Tight compression, reset compression stream 3", HFILL
}
3761 { &hf_vnc_tight_rect_type
,
3762 { "Rectangle type", "vnc.tight_rect_type",
3763 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
3764 "Tight compression, rectangle type", HFILL
}
3766 { &hf_vnc_tight_image_len
,
3767 { "Image data length", "vnc.tight_image_len",
3768 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3769 "Tight compression, length of image data", HFILL
}
3771 { &hf_vnc_tight_image_data
,
3772 { "Image data", "vnc.tight_image_data",
3773 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3774 "Tight compression, image data", HFILL
}
3776 { &hf_vnc_tight_fill_color
,
3777 { "Fill color (RGB)", "vnc.tight_fill_color",
3778 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3779 "Tight compression, fill color for solid rectangle", HFILL
}
3781 { &hf_vnc_tight_filter_flag
,
3782 { "Explicit filter flag", "vnc.tight_filter_flag",
3783 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3784 "Tight compression, explicit filter flag", HFILL
}
3786 { &hf_vnc_tight_filter_id
,
3787 { "Filter ID", "vnc.tight_filter_id",
3788 FT_UINT8
, BASE_DEC
, VALS(tight_filter_ids_vs
), 0x0,
3789 "Tight compression, filter ID", HFILL
}
3791 { &hf_vnc_tight_palette_num_colors
,
3792 { "Number of colors in palette", "vnc.tight_palette_num_colors",
3793 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3794 "Tight compression, number of colors in rectangle's palette", HFILL
}
3796 { &hf_vnc_tight_palette_data
,
3797 { "Palette data", "vnc.tight_palette_data",
3798 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3799 "Tight compression, palette data for a rectangle", HFILL
}
3801 { &hf_vnc_auth_challenge
,
3802 { "Authentication challenge", "vnc.auth_challenge",
3803 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3804 "Random authentication challenge from server to client", HFILL
}
3806 { &hf_vnc_auth_response
,
3807 { "Authentication response", "vnc.auth_response",
3808 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3809 "Client's encrypted response to the server's authentication challenge", HFILL
}
3811 { &hf_vnc_auth_result
,
3812 { "Authentication result", "vnc.auth_result",
3813 FT_BOOLEAN
, 32, TFS(&auth_result_tfs
), 0x1,
3816 { &hf_vnc_auth_error_length
,
3817 { "Length of authentication error", "vnc.auth_error_len",
3818 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3819 "Authentication error length (present only if the authentication result is fail)", HFILL
}
3821 { &hf_vnc_auth_error
,
3822 { "Authentication error", "vnc.auth_error",
3823 FT_STRING
, BASE_NONE
, NULL
, 0x0,
3824 "Authentication error (present only if the authentication result is fail)", HFILL
}
3826 { &hf_vnc_ard_auth_generator
,
3827 { "Generator", "vnc.ard_auth_generator",
3828 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3829 "Generator for Diffie-Hellman key exchange", HFILL
}
3831 { &hf_vnc_ard_auth_key_len
,
3832 { "Key length", "vnc.ard_auth_key_len",
3833 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3834 "Diffie-Hellman key length", HFILL
}
3836 { &hf_vnc_ard_auth_modulus
,
3837 { "Prime modulus", "vnc.ard_auth_modulus",
3838 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3839 "Prime modulus for Diffie-Hellman key exchange", HFILL
}
3841 { &hf_vnc_ard_auth_server_key
,
3842 { "Server public key", "vnc.ard_auth_server_key",
3843 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3844 "Server's public Diffie-Hellman key", HFILL
}
3846 { &hf_vnc_ard_auth_credentials
,
3847 { "Encrypted credentials", "vnc.ard_auth_credentials",
3848 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3849 "Encrypted client username and password", HFILL
}
3851 { &hf_vnc_ard_auth_client_key
,
3852 { "Client public key", "vnc.ard_auth_client_key",
3853 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
3854 "Client's public Diffie-Hellman key", HFILL
}
3856 { &hf_vnc_vencrypt_server_major_ver
,
3857 { "VeNCrypt server major version", "vnc.vencrypt_server_major_ver",
3858 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3861 { &hf_vnc_vencrypt_server_minor_ver
,
3862 { "VeNCrypt server minor version", "vnc.vencrypt_server_minor_ver",
3863 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3866 { &hf_vnc_vencrypt_client_major_ver
,
3867 { "VeNCrypt client major version", "vnc.vencrypt_client_major_ver",
3868 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3871 { &hf_vnc_vencrypt_client_minor_ver
,
3872 { "VeNCrypt client minor version", "vnc.vencrypt_client_minor_ver",
3873 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3876 { &hf_vnc_vencrypt_version_ack
,
3877 { "VeNCrypt version ack", "vnc.vencrypt_version_ack",
3878 FT_BOOLEAN
, 8, TFS(&tfs_error_ok
), 0xFF,
3881 { &hf_vnc_vencrypt_auth_type
,
3882 { "VeNCrypt authentication type", "vnc.vencrypt_auth_type",
3883 FT_UINT32
, BASE_DEC
, VALS(vnc_vencrypt_auth_types_vs
), 0x0,
3884 "Authentication type specific to VeNCrypt", HFILL
}
3886 { &hf_vnc_vencrypt_num_auth_types
,
3887 { "VeNCrypt Number of supported authentication types", "vnc.vencrypt_num_auth_types",
3888 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3891 { &hf_vnc_vencrypt_auth_type_ack
,
3892 { "VeNCrypt Authorization type ack", "vnc.vencrypt_auth_type_ack",
3893 FT_BOOLEAN
, 8, TFS(&tfs_ok_error
), 0xFF,
3896 { &hf_vnc_share_desktop_flag
,
3897 { "Share desktop flag", "vnc.share_desktop_flag",
3898 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3899 "Client's desire to share the server's desktop with other clients", HFILL
}
3902 { "Framebuffer width", "vnc.width",
3903 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3904 "Width of the framebuffer (screen) in pixels", HFILL
}
3907 { "Framebuffer height", "vnc.height",
3908 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3909 "Height of the framebuffer (screen) in pixels", HFILL
}
3911 { &hf_vnc_server_bits_per_pixel
,
3912 { "Bits per pixel", "vnc.server_bits_per_pixel",
3913 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3914 "Number of bits used by server for each pixel value on the wire from the server", HFILL
}
3916 { &hf_vnc_server_depth
,
3917 { "Depth", "vnc.server_depth",
3918 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3919 "Number of useful bits in the pixel value on server", HFILL
}
3921 { &hf_vnc_server_big_endian_flag
,
3922 { "Big endian flag", "vnc.server_big_endian_flag",
3923 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3924 "True if multi-byte pixels are interpreted as big endian by server", HFILL
}
3926 { &hf_vnc_server_true_color_flag
,
3927 { "True color flag", "vnc.server_true_color_flag",
3928 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
3929 "If true, then the next six items specify how to extract the red, green and blue intensities from the pixel value on the server.", HFILL
}
3931 { &hf_vnc_server_red_max
,
3932 { "Red maximum", "vnc.server_red_max",
3933 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3934 "Maximum red value on server as n: 2^n - 1", HFILL
}
3936 { &hf_vnc_server_green_max
,
3937 { "Green maximum", "vnc.server_green_max",
3938 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3939 "Maximum green value on server as n: 2^n - 1", HFILL
}
3941 { &hf_vnc_server_blue_max
,
3942 { "Blue maximum", "vnc.server_blue_max",
3943 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3944 "Maximum blue value on server as n: 2^n - 1", HFILL
}
3946 { &hf_vnc_server_red_shift
,
3947 { "Red shift", "vnc.server_red_shift",
3948 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3949 "Number of shifts needed to get the red value in a pixel to the least significant bit on the server", HFILL
}
3951 { &hf_vnc_server_green_shift
,
3952 { "Green shift", "vnc.server_green_shift",
3953 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3954 "Number of shifts needed to get the green value in a pixel to the least significant bit on the server", HFILL
}
3956 { &hf_vnc_server_blue_shift
,
3957 { "Blue shift", "vnc.server_blue_shift",
3958 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3959 "Number of shifts needed to get the blue value in a pixel to the least significant bit on the server", HFILL
}
3961 { &hf_vnc_desktop_name_len
,
3962 { "Desktop name length", "vnc.desktop_name_len",
3963 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3964 "Length of desktop name in bytes", HFILL
}
3966 { &hf_vnc_desktop_screen_num
,
3967 { "Number of screens", "vnc.screen_num",
3968 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
3971 { &hf_vnc_desktop_screen_id
,
3972 { "Screen ID", "vnc.screen_id",
3973 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3974 "ID of screen", HFILL
}
3976 { &hf_vnc_desktop_screen_x
,
3977 { "Screen X position", "vnc.screen_x",
3978 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3979 "X coordinate of screen", HFILL
}
3981 { &hf_vnc_desktop_screen_y
,
3982 { "Screen Y position", "vnc.screen_y",
3983 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3984 "Y coordinate of screen", HFILL
}
3986 { &hf_vnc_desktop_screen_width
,
3987 { "Screen width", "vnc.screen_width",
3988 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3989 "Width of screen", HFILL
}
3991 { &hf_vnc_desktop_screen_height
,
3992 { "Screen height", "vnc.screen_height",
3993 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
3994 "Height of screen", HFILL
}
3996 { &hf_vnc_desktop_screen_flags
,
3997 { "Screen flags", "vnc.screen_flags",
3998 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
3999 "Flags of screen", HFILL
}
4001 { &hf_vnc_desktop_name
,
4002 { "Desktop name", "vnc.desktop_name",
4003 FT_STRING
, BASE_NONE
, NULL
, 0x0,
4004 "Name of the VNC desktop on the server", HFILL
}
4006 { &hf_vnc_num_server_message_types
,
4007 { "Server message types", "vnc.num_server_message_types",
4008 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4009 "Unknown", HFILL
} /* XXX - Needs description */
4011 { &hf_vnc_num_client_message_types
,
4012 { "Client message types", "vnc.num_client_message_types",
4013 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4014 "Unknown", HFILL
} /* XXX - Needs description */
4016 { &hf_vnc_num_encoding_types
,
4017 { "Encoding types", "vnc.num_encoding_types",
4018 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4019 "Unknown", HFILL
} /* XXX - Needs description */
4021 { &hf_vnc_client_message_type
,
4022 { "Client Message Type", "vnc.client_message_type",
4023 FT_UINT8
, BASE_DEC
, VALS(vnc_client_message_types_vs
), 0x0,
4024 "Message type from client", HFILL
}
4026 { &hf_vnc_client_bits_per_pixel
,
4027 { "Bits per pixel", "vnc.client_bits_per_pixel",
4028 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4029 "Number of bits used by server for each pixel value on the wire from the client", HFILL
}
4031 { &hf_vnc_client_depth
,
4032 { "Depth", "vnc.client_depth",
4033 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4034 "Number of useful bits in the pixel value on client", HFILL
}
4036 { &hf_vnc_client_big_endian_flag
,
4037 { "Big endian flag", "vnc.client_big_endian_flag",
4038 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4039 "True if multi-byte pixels are interpreted as big endian by client", HFILL
}
4041 { &hf_vnc_client_true_color_flag
,
4042 { "True color flag", "vnc.client_true_color_flag",
4043 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4044 "If true, then the next six items specify how to extract the red, green and blue intensities from the pixel value on the client.", HFILL
}
4046 { &hf_vnc_client_red_max
,
4047 { "Red maximum", "vnc.client_red_max",
4048 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4049 "Maximum red value on client as n: 2^n - 1", HFILL
}
4051 { &hf_vnc_client_green_max
,
4052 { "Green maximum", "vnc.client_green_max",
4053 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4054 "Maximum green value on client as n: 2^n - 1", HFILL
}
4056 { &hf_vnc_client_blue_max
,
4057 { "Blue maximum", "vnc.client_blue_max",
4058 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4059 "Maximum blue value on client as n: 2^n - 1", HFILL
}
4061 { &hf_vnc_client_red_shift
,
4062 { "Red shift", "vnc.client_red_shift",
4063 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4064 "Number of shifts needed to get the red value in a pixel to the least significant bit on the client", HFILL
}
4066 { &hf_vnc_client_green_shift
,
4067 { "Green shift", "vnc.client_green_shift",
4068 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4069 "Number of shifts needed to get the green value in a pixel to the least significant bit on the client", HFILL
}
4071 { &hf_vnc_client_blue_shift
,
4072 { "Blue shift", "vnc.client_blue_shift",
4073 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4074 "Number of shifts needed to get the blue value in a pixel to the least significant bit on the client", HFILL
}
4077 /* Client Key Event */
4079 { "Key down", "vnc.key_down",
4080 FT_BOOLEAN
, BASE_NONE
, TFS(&tfs_yes_no
), 0x0,
4081 "Specifies whether the key is being pressed or not", HFILL
}
4085 FT_UINT32
, BASE_HEX
| BASE_EXT_STRING
, &x11_keysym_vals_source_ext
, 0x0, /* keysym_vals_source_exr is from packet-x11.c */
4086 "Key being pressed/depressed", HFILL
}
4089 /* Client Pointer Event */
4090 { &hf_vnc_button_1_pos
,
4091 { "Mouse button #1 position", "vnc.button_1_pos",
4092 FT_BOOLEAN
, 8, TFS(&tfs_pressed_not_pressed
), 0x1,
4093 "Whether mouse button #1 is being pressed or not", HFILL
}
4095 { &hf_vnc_button_2_pos
,
4096 { "Mouse button #2 position", "vnc.button_2_pos",
4097 FT_BOOLEAN
, 8, TFS(&tfs_pressed_not_pressed
), 0x2,
4098 "Whether mouse button #2 is being pressed or not", HFILL
}
4100 { &hf_vnc_button_3_pos
,
4101 { "Mouse button #3 position", "vnc.button_3_pos",
4102 FT_BOOLEAN
, 8, TFS(&tfs_pressed_not_pressed
), 0x4,
4103 "Whether mouse button #3 is being pressed or not", HFILL
}
4105 { &hf_vnc_button_4_pos
,
4106 { "Mouse button #4 position", "vnc.button_4_pos",
4107 FT_BOOLEAN
, 8, TFS(&tfs_pressed_not_pressed
), 0x8,
4108 "Whether mouse button #4 is being pressed or not", HFILL
}
4110 { &hf_vnc_button_5_pos
,
4111 { "Mouse button #5 position", "vnc.button_5_pos",
4112 FT_BOOLEAN
, 8, TFS(&tfs_pressed_not_pressed
), 0x10,
4113 "Whether mouse button #5 is being pressed or not", HFILL
}
4115 { &hf_vnc_button_6_pos
,
4116 { "Mouse button #6 position", "vnc.button_6_pos",
4117 FT_BOOLEAN
, 8, TFS(&tfs_pressed_not_pressed
), 0x20,
4118 "Whether mouse button #6 is being pressed or not", HFILL
}
4120 { &hf_vnc_button_7_pos
,
4121 { "Mouse button #7 position", "vnc.button_7_pos",
4122 FT_BOOLEAN
, 8, TFS(&tfs_pressed_not_pressed
), 0x40,
4123 "Whether mouse button #7 is being pressed or not", HFILL
}
4125 { &hf_vnc_button_8_pos
,
4126 { "Mouse button #8 position", "vnc.button_8_pos",
4127 FT_BOOLEAN
, 8, TFS(&tfs_pressed_not_pressed
), 0x80,
4128 "Whether mouse button #8 is being pressed or not", HFILL
}
4130 { &hf_vnc_pointer_x_pos
,
4131 { "X position", "vnc.pointer_x_pos",
4132 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4133 "Position of mouse cursor on the x-axis", HFILL
}
4135 { &hf_vnc_pointer_y_pos
,
4136 { "Y position", "vnc.pointer_y_pos",
4137 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4138 "Position of mouse cursor on the y-axis", HFILL
}
4140 { &hf_vnc_encoding_num
,
4141 { "Number of encodings", "vnc.client_set_encodings_num",
4142 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4143 "Number of encodings used to send pixel data from server to client", HFILL
}
4145 { &hf_vnc_client_set_encodings_encoding_type
,
4146 { "Encoding type", "vnc.client_set_encodings_encoding_type",
4147 FT_INT32
, BASE_DEC
, VALS(encoding_types_vs
), 0x0,
4148 "Type of encoding used to send pixel data from server to client", HFILL
}
4151 /* Client Framebuffer Update Request */
4152 { &hf_vnc_update_req_incremental
,
4153 { "Incremental update", "vnc.update_req_incremental",
4154 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
4155 "Specifies if the client wants an incremental update instead of a full one", HFILL
}
4157 { &hf_vnc_update_req_x_pos
,
4158 { "X position", "vnc.update_req_x_pos",
4159 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4160 "X position of framebuffer (screen) update requested", HFILL
}
4162 { &hf_vnc_update_req_y_pos
,
4163 { "Y position", "vnc.update_req_y_pos",
4164 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4165 "Y position of framebuffer (screen) update request", HFILL
}
4167 { &hf_vnc_update_req_width
,
4168 { "Width", "vnc.update_req_width",
4169 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4170 "Width of framebuffer (screen) update request", HFILL
}
4172 { &hf_vnc_update_req_height
,
4173 { "Height", "vnc.update_req_height",
4174 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4175 "Height of framebuffer (screen) update request", HFILL
}
4177 { &hf_vnc_client_cut_text_len
,
4178 { "Length", "vnc.client_cut_text_len",
4179 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
4180 "Length of client's copy/cut text (clipboard) string in bytes", HFILL
}
4182 { &hf_vnc_client_cut_text
,
4183 { "Text", "vnc.client_cut_text",
4184 FT_STRING
, BASE_NONE
, NULL
, 0x0,
4185 "Text string in the client's copy/cut text (clipboard)", HFILL
}
4189 /********** Server Message Types **********/
4190 { &hf_vnc_server_message_type
,
4191 { "Server Message Type", "vnc.server_message_type",
4192 FT_UINT8
, BASE_DEC
, VALS(vnc_server_message_types_vs
), 0x0,
4193 "Message type from server", HFILL
}
4196 { &hf_vnc_rectangle_num
,
4197 { "Number of rectangles", "vnc.fb_update_num_rects",
4198 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4199 "Number of rectangles of this server framebuffer update", HFILL
}
4202 { &hf_vnc_fb_update_x_pos
,
4203 { "X position", "vnc.fb_update_x_pos",
4204 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4205 "X position of this server framebuffer update", HFILL
}
4208 { &hf_vnc_fb_update_y_pos
,
4209 { "Y position", "vnc.fb_update_y_pos",
4210 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4211 "Y position of this server framebuffer update", HFILL
}
4214 { &hf_vnc_fb_update_width
,
4215 { "Width", "vnc.fb_update_width",
4216 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4217 "Width of this server framebuffer update", HFILL
}
4220 { &hf_vnc_fb_update_height
,
4221 { "Height", "vnc.fb_update_height",
4222 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4223 "Height of this server framebuffer update", HFILL
}
4226 { &hf_vnc_fb_update_encoding_type
,
4227 { "Encoding type", "vnc.fb_update_encoding_type",
4228 FT_INT32
, BASE_DEC
, VALS(encoding_types_vs
), 0x0,
4229 "Encoding type of this server framebuffer update", HFILL
}
4232 /* Cursor encoding */
4233 { &hf_vnc_cursor_x_fore_back
,
4234 { "X Cursor foreground RGB / background RGB", "vnc.cursor_x_fore_back",
4235 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4236 "RGB values for the X cursor's foreground and background", HFILL
}
4239 { &hf_vnc_cursor_encoding_pixels
,
4240 { "Cursor encoding pixels", "vnc.cursor_encoding_pixels",
4241 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4242 "Cursor encoding pixel data", HFILL
}
4245 { &hf_vnc_cursor_encoding_bitmask
,
4246 { "Cursor encoding bitmask", "vnc.cursor_encoding_bitmask",
4247 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4248 "Cursor encoding pixel bitmask", HFILL
}
4252 { &hf_vnc_raw_pixel_data
,
4253 { "Pixel data", "vnc.raw_pixel_data",
4254 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4255 "Raw pixel data.", HFILL
}
4258 /* CopyRect Encoding*/
4259 { &hf_vnc_copyrect_src_x_pos
,
4260 { "Source x position", "vnc.copyrect_src_x_pos",
4261 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4262 "X position of the rectangle to copy from", HFILL
}
4265 { &hf_vnc_copyrect_src_y_pos
,
4266 { "Source y position", "vnc.copyrect_src_y_pos",
4267 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4268 "Y position of the rectangle to copy from", HFILL
}
4272 { &hf_vnc_rre_num_subrects
,
4273 { "Number of subrectangles", "vnc.rre_num_subrects",
4274 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
4275 "Number of subrectangles contained in this encoding type", HFILL
}
4278 { &hf_vnc_rre_bg_pixel
,
4279 { "Background pixel value", "vnc.rre_bg_pixel",
4280 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4284 { &hf_vnc_rre_subrect_pixel
,
4285 { "Pixel value", "vnc.rre_subrect_pixel",
4286 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4287 "Subrectangle pixel value", HFILL
}
4290 { &hf_vnc_rre_subrect_x_pos
,
4291 { "X position", "vnc.rre_subrect_x_pos",
4292 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4293 "Position of this subrectangle on the x axis", HFILL
}
4296 { &hf_vnc_rre_subrect_y_pos
,
4297 { "Y position", "vnc.rre_subrect_y_pos",
4298 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4299 "Position of this subrectangle on the y axis", HFILL
}
4302 { &hf_vnc_rre_subrect_width
,
4303 { "Width", "vnc.rre_subrect_width",
4304 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4305 "Width of this subrectangle", HFILL
}
4308 { &hf_vnc_rre_subrect_height
,
4309 { "Height", "vnc.rre_subrect_height",
4310 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4311 "Height of this subrectangle", HFILL
}
4315 /* Hextile Encoding */
4316 { &hf_vnc_hextile_subencoding_mask
,
4317 { "Subencoding type", "vnc.hextile_subencoding",
4318 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4319 "Hextile subencoding type.", HFILL
}
4322 { &hf_vnc_hextile_raw
,
4323 { "Raw", "vnc.hextile_raw",
4324 FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), 0x1,
4325 "Raw subencoding is used in this tile", HFILL
}
4328 { &hf_vnc_hextile_raw_value
,
4329 { "Raw pixel values", "vnc.hextile_raw_value",
4330 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4331 "Raw subencoding pixel values", HFILL
}
4334 { &hf_vnc_hextile_bg
,
4335 { "Background Specified", "vnc.hextile_bg",
4336 FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), 0x2,
4337 "Background Specified subencoding is used in this tile", HFILL
}
4340 { &hf_vnc_hextile_bg_value
,
4341 { "Background pixel value", "vnc.hextile_bg_value",
4342 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4343 "Background color for this tile", HFILL
}
4346 { &hf_vnc_hextile_fg
,
4347 { "Foreground Specified", "vnc.hextile_fg",
4348 FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), 0x4,
4349 "Foreground Specified subencoding is used in this tile", HFILL
}
4352 { &hf_vnc_hextile_fg_value
,
4353 { "Foreground pixel value", "vnc.hextile_fg_value",
4354 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4355 "Foreground color for this tile", HFILL
}
4358 { &hf_vnc_hextile_anysubrects
,
4359 { "Any Subrects", "vnc.hextile_anysubrects",
4360 FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), 0x8,
4361 "Any subrects subencoding is used in this tile", HFILL
}
4364 { &hf_vnc_hextile_num_subrects
,
4365 { "Number of subrectangles", "vnc.hextile_num_subrects",
4366 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4367 "Number of subrectangles that follow", HFILL
}
4370 { &hf_vnc_hextile_subrectscolored
,
4371 { "Subrects Colored", "vnc.hextile_subrectscolored",
4372 FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), 0x10,
4373 "Subrects colored subencoding is used in this tile", HFILL
}
4376 { &hf_vnc_hextile_subrect_pixel_value
,
4377 { "Pixel value", "vnc.hextile_subrect_pixel_value",
4378 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4379 "Pixel value of this subrectangle", HFILL
}
4382 { &hf_vnc_hextile_subrect_x_pos
,
4383 { "X position", "vnc.hextile_subrect_x_pos",
4384 FT_UINT8
, BASE_DEC
, NULL
, 0xF0, /* Top 4 bits */
4385 "X position of this subrectangle", HFILL
}
4388 { &hf_vnc_hextile_subrect_y_pos
,
4389 { "Y position", "vnc.hextile_subrect_y_pos",
4390 FT_UINT8
, BASE_DEC
, NULL
, 0xF, /* Bottom 4 bits */
4391 "Y position of this subrectangle", HFILL
}
4394 { &hf_vnc_hextile_subrect_width
,
4395 { "Width", "vnc.hextile_subrect_width",
4396 FT_UINT8
, BASE_DEC
, NULL
, 0xF0, /* Top 4 bits */
4397 "Subrectangle width minus one", HFILL
}
4400 { &hf_vnc_hextile_subrect_height
,
4401 { "Height", "vnc.hextile_subrect_height",
4402 FT_UINT8
, BASE_DEC
, NULL
, 0xF, /* Bottom 4 bits */
4403 "Subrectangle height minus one", HFILL
}
4409 { "ZRLE compressed length", "vnc.zrle_len",
4410 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
4411 "Length of compressed ZRLE data that follows", HFILL
}
4414 { &hf_vnc_zrle_subencoding
,
4415 { "Subencoding type", "vnc.zrle_subencoding",
4416 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4417 "Subencoding type byte", HFILL
}
4421 { "RLE", "vnc.zrle_rle",
4422 FT_BOOLEAN
, 8, TFS(&tfs_yes_no
), 0x80, /* Upper bit */
4423 "Specifies that data is run-length encoded", HFILL
}
4426 { &hf_vnc_zrle_palette_size
,
4427 { "Palette size", "vnc.zrle_palette_size",
4428 FT_UINT8
, BASE_DEC
, NULL
, 0x7F, /* Lower 7 bits */
4432 { &hf_vnc_zrle_data
,
4433 { "ZRLE compressed data", "vnc.zrle_data",
4434 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4435 "Compressed ZRLE data. Compiling with zlib support will uncompress and dissect this data", HFILL
}
4439 { "Pixel values", "vnc.zrle_raw",
4440 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4441 "Raw pixel values for this tile", HFILL
}
4444 { &hf_vnc_zrle_palette
,
4445 { "Palette", "vnc.zrle_palette",
4446 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4447 "Palette pixel values", HFILL
}
4450 /* Server Set Colormap Entries */
4451 { &hf_vnc_colormap_first_color
,
4452 { "First color", "vnc.colormap_first_color",
4453 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4454 "First color that should be mapped to given RGB intensities", HFILL
}
4457 { &hf_vnc_color_groups
,
4458 { "Color groups", "vnc.color_groups",
4459 FT_NONE
, BASE_NONE
, NULL
, 0x0,
4463 { &hf_vnc_colormap_num_colors
,
4464 { "Number of color groups", "vnc.colormap_groups",
4465 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4466 "Number of red/green/blue color groups", HFILL
}
4468 { &hf_vnc_colormap_red
,
4469 { "Red", "vnc.colormap_red",
4470 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4471 "Red intensity", HFILL
}
4473 { &hf_vnc_colormap_green
,
4474 { "Green", "vnc.colormap_green",
4475 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4476 "Green intensity", HFILL
}
4478 { &hf_vnc_colormap_blue
,
4479 { "Blue", "vnc.colormap_blue",
4480 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4481 "Blue intensity", HFILL
}
4484 /* Server Cut Text */
4485 { &hf_vnc_server_cut_text_len
,
4486 { "Length", "vnc.server_cut_text_len",
4487 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
4488 "Length of server's copy/cut text (clipboard) string in bytes", HFILL
}
4490 { &hf_vnc_server_cut_text
,
4491 { "Text", "vnc.server_cut_text",
4492 FT_STRING
, BASE_NONE
, NULL
, 0x0,
4493 "Text string in the server's copy/cut text (clipboard)", HFILL
}
4496 /* LibVNCServer additions */
4497 { &hf_vnc_supported_messages_client2server
,
4498 { "Client2server", "vnc.supported_messages_client2server",
4499 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4500 "Supported client to server messages (bit flags)", HFILL
}
4502 { &hf_vnc_supported_messages_server2client
,
4503 { "Server2client", "vnc.supported_messages_server2client",
4504 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4505 "Supported server to client messages (bit flags)", HFILL
}
4507 { &hf_vnc_num_supported_encodings
,
4508 { "Number of supported encodings", "vnc.num_supported_encodings",
4509 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4512 { &hf_vnc_supported_encodings
,
4513 { "Encoding", "vnc.supported_encodings",
4514 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4515 "Supported encoding", HFILL
}
4517 { &hf_vnc_server_identity
,
4518 { "Server Identity", "vnc.server_identity",
4519 FT_STRING
, BASE_NONE
, NULL
, 0x0,
4520 "Server identity string", HFILL
}
4524 { &hf_vnc_mirrorlink_type
,
4525 { "Type", "vnc.mirrorlink_type",
4526 FT_UINT8
, BASE_DEC
, VALS(vnc_mirrorlink_types_vs
), 0x0,
4527 "MirrorLink extension message type", HFILL
}
4529 { &hf_vnc_mirrorlink_length
,
4530 { "Length", "vnc.mirrorlink_length",
4531 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4532 "Payload length", HFILL
}
4534 { &hf_vnc_mirrorlink_version_major
,
4535 { "Major Version", "vnc.mirrorlink_version_major",
4536 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4537 "MirrorLink major version", HFILL
}
4539 { &hf_vnc_mirrorlink_version_minor
,
4540 { "Minor Version", "vnc.mirrorlink_version_minor",
4541 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4542 "MirrorLink minor version", HFILL
}
4544 { &hf_vnc_mirrorlink_framebuffer_configuration
,
4546 "vnc.mirrorlink_framebuffer_configuration",
4547 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
4548 "Framebuffer configuration", HFILL
}
4550 { &hf_vnc_mirrorlink_pixel_width
,
4551 { "Pixel Width", "vnc.mirrorlink_pixel_width",
4552 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4553 "Display width [pixel]", HFILL
}
4555 { &hf_vnc_mirrorlink_pixel_height
,
4556 { "Pixel Height", "vnc.mirrorlink_pixel_height",
4557 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4558 "Display height [pixel]", HFILL
}
4560 { &hf_vnc_mirrorlink_pixel_format
,
4561 { "Pixel Format", "vnc.mirrorlink_pixel_format",
4562 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4563 "Pixel format support", HFILL
}
4565 { &hf_vnc_mirrorlink_display_width
,
4566 { "Display Width", "vnc.mirrorlink_display_width",
4567 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4568 "Display width [mm]", HFILL
}
4570 { &hf_vnc_mirrorlink_display_height
,
4571 { "Display Height", "vnc.mirrorlink_display_height",
4572 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4573 "Display height [mm]", HFILL
}
4575 { &hf_vnc_mirrorlink_display_distance
,
4576 { "Display Distance", "vnc.mirrorlink_display_distance",
4577 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4578 "Display distance [mm]", HFILL
}
4580 { &hf_vnc_mirrorlink_keyboard_language
,
4581 { "Keyboard Language", "vnc.mirrorlink_keyboard_language",
4582 FT_STRING
, BASE_NONE
, NULL
, 0x0,
4583 "Keyboard layout - Language code (according ISO 639-1)",
4586 { &hf_vnc_mirrorlink_keyboard_country
,
4587 { "Keyboard Country", "vnc.mirrorlink_keyboard_country",
4588 FT_STRING
, BASE_NONE
, NULL
, 0x0,
4589 "Keyboard layout - Country code (according ISO 3166-1 alpha-2)",
4592 { &hf_vnc_mirrorlink_ui_language
,
4593 { "UI Language", "vnc.mirrorlink_ui_language",
4594 FT_STRING
, BASE_NONE
, NULL
, 0x0,
4595 "UI language - Language code (according ISO 639-1)", HFILL
}
4597 { &hf_vnc_mirrorlink_ui_country
,
4598 { "UI Country", "vnc.mirrorlink_ui_country",
4599 FT_STRING
, BASE_NONE
, NULL
, 0x0,
4600 "UI language - Country code (according ISO 3166-1 alpha 2)",
4603 { &hf_vnc_mirrorlink_knob_keys
,
4604 { "Knob Keys", "vnc.mirrorlink_knob_keys",
4605 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4606 "Supported knob keys", HFILL
}
4608 { &hf_vnc_mirrorlink_device_keys
,
4609 { "Device Keys", "vnc.mirrorlink_device_keys",
4610 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4611 "Supported device keys", HFILL
}
4613 { &hf_vnc_mirrorlink_multimedia_keys
,
4614 { "Multimedia Keys", "vnc.mirrorlink_multimedia_keys",
4615 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4616 "Supported multimedia keys", HFILL
}
4618 { &hf_vnc_mirrorlink_key_related
,
4619 { "Keyboard", "vnc.mirrorlink_key_related",
4620 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4621 "Keyboard related", HFILL
}
4623 { &hf_vnc_mirrorlink_pointer_related
,
4624 { "Pointer", "vnc.mirrorlink_pointer_related",
4625 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4626 "Pointer related", HFILL
}
4628 { &hf_vnc_mirrorlink_key_symbol_value_client
,
4629 { "Client KeySymValue",
4630 "vnc.mirrorlink_key_symbol_value_client",
4631 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4632 "Client key symbol value", HFILL
}
4634 { &hf_vnc_mirrorlink_key_symbol_value_server
,
4635 { "Server KeySymValue",
4636 "vnc.mirrorlink_key_symbol_value_server",
4637 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4638 "Server key symbol value", HFILL
}
4640 { &hf_vnc_mirrorlink_key_configuration
,
4641 { "Configuration", "vnc.mirrorlink_key_configuration",
4642 FT_UINT8
, BASE_HEX
, NULL
, 0x0,
4643 "Key event listing configuration", HFILL
}
4645 { &hf_vnc_mirrorlink_key_num_events
,
4646 { "Number of Key Events", "vnc.mirrorlink_key_num_events",
4647 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4648 "Number of key events in list", HFILL
}
4650 { &hf_vnc_mirrorlink_key_event_counter
,
4651 { "Key Event Counter", "vnc.mirrorlink_key_event_counter",
4652 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4653 "Key event listing counter", HFILL
}
4655 { &hf_vnc_mirrorlink_key_symbol_value
,
4657 "vnc.mirrorlink_key_symbol_value",
4658 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4659 "Key symbol value", HFILL
}
4661 { &hf_vnc_mirrorlink_key_request_configuration
,
4662 { "Configuration", "vnc.mirrorlink_key_request_configuration",
4663 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4664 "Key event listing request configuration", HFILL
}
4666 { &hf_vnc_mirrorlink_keyboard_configuration
,
4667 { "Configuration", "vnc.mirrorlink_keyboard_configuration",
4668 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4669 "Virtual keyboard configuration", HFILL
}
4671 { &hf_vnc_mirrorlink_cursor_x
,
4672 { "Cursor X", "vnc.mirrorlink_cursor_x",
4673 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4674 "Cursor - X position", HFILL
}
4676 { &hf_vnc_mirrorlink_cursor_y
,
4677 { "Cursor Y", "vnc.mirrorlink_cursor_y",
4678 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4679 "Cursor - Y position", HFILL
}
4681 { &hf_vnc_mirrorlink_text_x
,
4682 { "Text X", "vnc.mirrorlink_text_x",
4683 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4684 "Text input area - X position", HFILL
}
4686 { &hf_vnc_mirrorlink_text_y
,
4687 { "Text Y", "vnc.mirrorlink_text_y",
4688 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4689 "Text input area - Y position", HFILL
}
4691 { &hf_vnc_mirrorlink_text_width
,
4692 { "Text Width", "vnc.mirrorlink_text_width",
4693 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4694 "Text input area - Width", HFILL
}
4696 { &hf_vnc_mirrorlink_text_height
,
4697 { "Text Height", "vnc.mirrorlink_text_height",
4698 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4699 "Text input area - Height", HFILL
}
4701 { &hf_vnc_mirrorlink_keyboard_request_configuration
,
4703 "vnc.mirrorlink_keyboard_request_configuration",
4704 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4705 "Virtual keyboard request configuration", HFILL
}
4707 { &hf_vnc_mirrorlink_device_status
,
4708 { "Device Status", "vnc.mirrorlink_device_status",
4709 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4710 "Status of Device Features", HFILL
}
4712 { &hf_vnc_mirrorlink_app_id
,
4713 { "App Id", "vnc.mirrorlink_app_id",
4714 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4715 "Unique application id", HFILL
}
4717 { &hf_vnc_mirrorlink_fb_block_x
,
4718 { "Framebuffer X", "vnc.mirrorlink_fb_block_x",
4719 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4720 "Framebuffer blocking - X position", HFILL
}
4722 { &hf_vnc_mirrorlink_fb_block_y
,
4723 { "Framebuffer Y", "vnc.mirrorlink_fb_block_y",
4724 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4725 "Framdbuffer blocking - Y position", HFILL
}
4727 { &hf_vnc_mirrorlink_fb_block_width
,
4728 { "Framebuffer Width", "vnc.mirrorlink_fb_block_width",
4729 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4730 "Framebuffer blocking - Width", HFILL
}
4732 { &hf_vnc_mirrorlink_fb_block_height
,
4733 { "Framebuffer Height", "vnc.mirrorlink_fb_block_height",
4734 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4735 "Framebuffer blocking - Height", HFILL
}
4737 { &hf_vnc_mirrorlink_fb_block_reason
,
4738 { "Reason", "vnc.mirrorlink_fb_block_reason",
4739 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
4740 "Reason for blocking", HFILL
}
4742 { &hf_vnc_mirrorlink_audio_block_reason
,
4743 { "Reason", "vnc.mirrorlink_audio_block_reason",
4744 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
4745 "Reason for blocking", HFILL
}
4747 { &hf_vnc_mirrorlink_touch_num_events
,
4748 { "Number of Touch Events", "vnc.mirrorlink_touch_num_events",
4749 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4750 "Number of touch events in list", HFILL
}
4752 { &hf_vnc_mirrorlink_touch_x
,
4753 { "Touch X", "vnc.mirrorlink_touch_x",
4754 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4755 "Touch event - X position", HFILL
}
4757 { &hf_vnc_mirrorlink_touch_y
,
4758 { "Touch Y", "vnc.mirrorlink_touch_y",
4759 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4760 "Touch event - Y position", HFILL
}
4762 { &hf_vnc_mirrorlink_touch_id
,
4763 { "Touch Id", "vnc.mirrorlink_touch_id",
4764 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4765 "Touch event - identifier", HFILL
}
4767 { &hf_vnc_mirrorlink_touch_pressure
,
4768 { "Touch Pressure", "vnc.mirrorlink_touch_pressure",
4769 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4770 "Touch event - pressure value", HFILL
}
4772 { &hf_vnc_mirrorlink_text
,
4773 { "Text", "vnc.mirrorlink_text",
4774 FT_STRING
, BASE_NONE
, NULL
, 0x0,
4775 "Textual information", HFILL
}
4777 { &hf_vnc_mirrorlink_text_length
,
4778 { "Length", "vnc.mirrorlink_text_length",
4779 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4780 "Length of textual information", HFILL
}
4782 { &hf_vnc_mirrorlink_text_max_length
,
4783 { "Max Length", "vnc.mirrorlink_text_max_length",
4784 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4785 "Maximum length of textual information", HFILL
}
4787 { &hf_vnc_mirrorlink_unknown
,
4788 { "Unknown", "vnc.mirrorlink_unknown",
4789 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4790 "Unknown data", HFILL
}
4794 { &hf_vnc_fence_flags
,
4795 {"Fence flags", "vnc.fence_flags", FT_UINT32
, BASE_HEX
,
4796 NULL
, 0, NULL
, HFILL
}},
4798 { &hf_vnc_fence_request
,
4799 { "Fence_request", "vnc.fence_request",
4800 FT_BOOLEAN
, 32, NULL
, VNC_FENCE_REQUEST
,
4803 { &hf_vnc_fence_sync_next
,
4804 { "Fence_sync_next", "vnc.fence_sync_next",
4805 FT_BOOLEAN
, 32, NULL
, VNC_FENCE_SYNC_NEXT
,
4808 { &hf_vnc_fence_block_after
,
4809 { "Fence_block_after", "vnc.fence_block_after",
4810 FT_BOOLEAN
, 32, NULL
, VNC_FENCE_BLOCK_AFTER
,
4813 { &hf_vnc_fence_block_before
,
4814 { "Fence block_before", "vnc.fence_block_before",
4815 FT_BOOLEAN
, 32, NULL
, VNC_FENCE_BLOCK_BEFORE
,
4818 { &hf_vnc_fence_payload_length
,
4819 { "Fence payload length", "vnc.fence_payload_length",
4820 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
4823 { &hf_vnc_fence_payload
,
4824 { "Fence payload", "vnc.fence_payload",
4825 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4829 /* Context Information */
4830 { &hf_vnc_context_information_app_id
,
4831 { "App Id", "vnc.context_information_app_id",
4832 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4833 "Unique application id", HFILL
}
4835 { &hf_vnc_context_information_app_trust_level
,
4836 { "App Trust Level",
4837 "vnc.context_information_app_trust_level",
4838 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
4839 "Trust Level for Application Category", HFILL
}
4841 { &hf_vnc_context_information_content_trust_level
,
4842 { "Content Trust Level",
4843 "vnc.context_information_content_trust_level",
4844 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
4845 "Trust Level for Content Category", HFILL
}
4847 { &hf_vnc_context_information_app_category
,
4848 { "App Category", "vnc.context_information_app_category",
4849 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4850 "Application Category", HFILL
}
4852 { &hf_vnc_context_information_content_category
,
4853 { "Content Category",
4854 "vnc.context_information_content_category",
4855 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4856 "Visual content category", HFILL
}
4858 { &hf_vnc_context_information_content_rules
,
4859 { "Content Rules", "vnc.context_information_content_rules",
4860 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
4861 "Visual content rules", HFILL
}
4864 /* Scan Line based Run-Length Encoding */
4865 { &hf_vnc_slrle_run_num
,
4866 { "Number of Runs", "vnc.slrle_run_num",
4867 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
4868 "Number of Runs within Line", HFILL
}
4870 { &hf_vnc_slrle_run_data
,
4871 { "Raw RLE data", "vnc.slrle_run_data",
4872 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4873 "Raw Run-Length encoded data within Line", HFILL
}
4876 /* H.264 Encoding */
4877 { &hf_vnc_h264_slice_type
,
4878 { "Slice Type", "vnc.h264_slice_type",
4879 FT_UINT32
, BASE_DEC
, VALS(vnc_h264_slice_types_vs
), 0x0,
4880 "Frame slice type", HFILL
}
4882 { &hf_vnc_h264_nbytes
,
4883 { "Number of Bytes", "vnc.h264_nbytes",
4884 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
4885 "Number of bytes within frame", HFILL
}
4887 { &hf_vnc_h264_width
,
4888 { "Width", "vnc.h264_width",
4889 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
4890 "Frame Width", HFILL
}
4892 { &hf_vnc_h264_height
,
4893 { "Height", "vnc.h264_height",
4894 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
4895 "Frame Height", HFILL
}
4897 { &hf_vnc_h264_data
,
4898 { "Data", "vnc.h264_data",
4899 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
4900 "Frame H.264 data", HFILL
}
4905 /* Setup protocol subtree arrays */
4906 static int *ett
[] = {
4908 &ett_vnc_client_message_type
,
4909 &ett_vnc_server_message_type
,
4911 &ett_vnc_encoding_type
,
4912 &ett_vnc_rre_subrect
,
4913 &ett_vnc_hextile_subencoding_mask
,
4914 &ett_vnc_hextile_num_subrects
,
4915 &ett_vnc_hextile_subrect
,
4916 &ett_vnc_hextile_tile
,
4917 &ett_vnc_zrle_subencoding
,
4918 &ett_vnc_colormap_num_groups
,
4919 &ett_vnc_desktop_screen
,
4920 &ett_vnc_colormap_color_group
,
4921 &ett_vnc_key_events
,
4922 &ett_vnc_touch_events
,
4923 &ett_vnc_slrle_subline
,
4924 &ett_vnc_fence_flags
4927 static ei_register_info ei
[] = {
4928 { &ei_vnc_possible_gtk_vnc_bug
, { "vnc.possible_gtk_vnc_bug", PI_MALFORMED
, PI_ERROR
, "NULL found in greeting. client -> server greeting must be 12 bytes (possible gtk-vnc bug)", EXPFILL
}},
4929 { &ei_vnc_auth_code_mismatch
, { "vnc.auth_code_mismatch", PI_PROTOCOL
, PI_WARN
, "Authentication code does not match vendor or signature", EXPFILL
}},
4930 { &ei_vnc_unknown_tight_vnc_auth
, { "vnc.unknown_tight_vnc_auth", PI_PROTOCOL
, PI_ERROR
, "Unknown TIGHT VNC authentication", EXPFILL
}},
4931 { &ei_vnc_too_many_rectangles
, { "vnc.too_many_rectangles", PI_MALFORMED
, PI_ERROR
, "Too many rectangles, aborting dissection", EXPFILL
}},
4932 { &ei_vnc_too_many_sub_rectangles
, { "vnc.too_many_sub_rectangles", PI_MALFORMED
, PI_ERROR
, "Too many sub-rectangles, aborting dissection", EXPFILL
}},
4933 { &ei_vnc_invalid_encoding
, { "vnc.invalid_encoding", PI_MALFORMED
, PI_ERROR
, "Invalid encoding", EXPFILL
}},
4934 { &ei_vnc_too_many_colors
, { "vnc.too_many_colors", PI_MALFORMED
, PI_ERROR
, "Too many colors, aborting dissection", EXPFILL
}},
4935 { &ei_vnc_too_many_cut_text
, { "vnc.too_many_cut_text", PI_MALFORMED
, PI_ERROR
, "Too much cut text, aborting dissection", EXPFILL
}},
4936 { &ei_vnc_zrle_failed
, { "vnc.zrle_failed", PI_UNDECODED
, PI_ERROR
, "Decompression of ZRLE data failed", EXPFILL
}},
4937 { &ei_vnc_unknown_tight
, { "vnc.unknown_tight_packet", PI_UNDECODED
, PI_WARN
, "Unknown packet (TightVNC)", EXPFILL
}},
4938 { &ei_vnc_reassemble
, { "vnc.reassemble", PI_REASSEMBLE
, PI_CHAT
, "See further on for dissection of the complete (reassembled) PDU", EXPFILL
}},
4941 /* Register the protocol name and description */
4942 proto_vnc
= proto_register_protocol("Virtual Network Computing", "VNC", "vnc");
4943 vnc_handle
= register_dissector("vnc", dissect_vnc
, proto_vnc
);
4945 /* Required function calls to register the header fields and subtrees */
4946 proto_register_field_array(proto_vnc
, hf
, array_length(hf
));
4947 proto_register_subtree_array(ett
, array_length(ett
));
4948 expert_vnc
= expert_register_protocol(proto_vnc
);
4949 expert_register_field_array(expert_vnc
, ei
, array_length(ei
));
4951 /* Register our preferences module */
4952 vnc_module
= prefs_register_protocol(proto_vnc
, apply_vnc_prefs
);
4954 prefs_register_bool_preference(vnc_module
, "desegment",
4955 "Reassemble VNC messages spanning multiple TCP segments.",
4956 "Whether the VNC dissector should reassemble messages spanning "
4957 "multiple TCP segments. To use this option, you must also enable "
4958 "\"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
4959 &vnc_preference_desegment
);
4963 proto_reg_handoff_vnc(void)
4965 dissector_add_uint_range_with_preference("tcp.port", VNC_PORT_RANGE
, vnc_handle
);
4966 heur_dissector_add("tcp", test_vnc_protocol
, "VNC over TCP", "vnc_tcp", proto_vnc
, HEURISTIC_ENABLE
);
4967 /* We don't register a port for the VNC HTTP server because
4968 * that simply provides a java program for download via the
4969 * HTTP protocol. The java program then connects to a standard
4974 * Editor modelines - https://www.wireshark.org/tools/modelines.html
4979 * indent-tabs-mode: t
4982 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
4983 * :indentSize=8:tabSize=8:noTabs=false: