/src/wireshark/epan/dissectors/packet-vnc.c
Line | Count | Source |
1 | | /* packet-vnc.c |
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) |
5 | | * |
6 | | * Wireshark - Network traffic analyzer |
7 | | * By Gerald Combs <gerald@wireshark.org> |
8 | | * Copyright 1998 Gerald Combs |
9 | | * |
10 | | * SPDX-License-Identifier: GPL-2.0-or-later |
11 | | */ |
12 | | |
13 | | /* Dissection of the VNC (Virtual Network Computing) network traffic. |
14 | | * |
15 | | * All versions of RealVNC and TightVNC are supported. |
16 | | * Note: The addition of TightVNC support is not yet complete. |
17 | | * |
18 | | * Several VNC implementations available, see: |
19 | | * http://www.realvnc.com/ |
20 | | * http://www.tightvnc.com/ |
21 | | * http://ultravnc.sourceforge.net/ |
22 | | * [Fedora TigerVNC] |
23 | | * ... |
24 | | * |
25 | | * The protocol itself is known as RFB - Remote Frame Buffer Protocol. |
26 | | * |
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. |
31 | | */ |
32 | | |
33 | | /* XXX: |
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 |
37 | | * is that: |
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)". |
41 | | * |
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. |
52 | | * |
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. |
57 | | */ |
58 | | |
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) ? |
64 | | */ |
65 | | |
66 | | #include "config.h" |
67 | | |
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> |
73 | | #include <epan/tfs.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. */ |
77 | | |
78 | | void proto_register_vnc(void); |
79 | | |
80 | | typedef enum { |
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; |
106 | | |
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" }, |
119 | | { 0, NULL } |
120 | | }; |
121 | | |
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" }, |
134 | | { 0, NULL } |
135 | | }; |
136 | | |
137 | | static const true_false_string auth_result_tfs = { |
138 | | "Failed", |
139 | | "OK" |
140 | | }; |
141 | | |
142 | | typedef enum { |
143 | | /* Required */ |
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, |
150 | | /* Optional */ |
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; |
160 | | |
161 | | typedef enum { |
162 | | QEMU_CLIENT_MESSAGE_SUBTYPE_EXTENDED_KEY_EVENTS = 0 |
163 | | } qemu_client_message_subtypes_e; |
164 | | |
165 | | static const value_string qemu_subtype_vals[] = { |
166 | | { QEMU_CLIENT_MESSAGE_SUBTYPE_EXTENDED_KEY_EVENTS, "QEMU Extended Key Event" }, |
167 | | { 0, NULL } |
168 | | }; |
169 | | |
170 | | static const value_string vnc_client_message_types_vs[] = { |
171 | | /* Required */ |
172 | | { VNC_CLIENT_MESSAGE_TYPE_SET_PIXEL_FORMAT, "Set Pixel Format" }, |
173 | | { VNC_CLIENT_MESSAGE_TYPE_SET_ENCODINGS, "Set Encodings" }, |
174 | | { VNC_CLIENT_MESSAGE_TYPE_FRAMEBUF_UPDATE_REQ, "Framebuffer Update Request" }, |
175 | | { VNC_CLIENT_MESSAGE_TYPE_KEY_EVENT, "Key Event" }, |
176 | | { VNC_CLIENT_MESSAGE_TYPE_POINTER_EVENT, "Pointer Event" }, |
177 | | { VNC_CLIENT_MESSAGE_TYPE_CLIENT_CUT_TEXT, "Cut Text" }, |
178 | | /* Optional */ |
179 | | { VNC_CLIENT_MESSAGE_TYPE_MIRRORLINK, "MirrorLink" }, |
180 | | { VNC_CLIENT_MESSAGE_TYPE_ENABLE_CONTINUOUS_UPDATES, "Enable Continuous Updates" }, |
181 | | { VNC_CLIENT_MESSAGE_TYPE_FENCE, "Fence" }, |
182 | | { VNC_CLIENT_MESSAGE_TYPE_XVP, "Xvp" }, |
183 | | { VNC_CLIENT_MESSAGE_TYPE_SETR_DESKTOP_SIZE, "Setr Desktop Size" }, |
184 | | { VNC_CLIENT_MESSAGE_TYPE_TIGHT, "Tight" }, |
185 | | { VNC_CLIENT_MESSAGE_TYPE_GII, "Gii" }, |
186 | | { VNC_CLIENT_MESSAGE_TYPE_QEMU, "Qemu" }, |
187 | | { 0, NULL } |
188 | | }; |
189 | | |
190 | | typedef enum { |
191 | | VNC_SERVER_MESSAGE_TYPE_FRAMEBUFFER_UPDATE = 0, |
192 | | VNC_SERVER_MESSAGE_TYPE_SET_COLORMAP_ENTRIES = 1, |
193 | | VNC_SERVER_MESSAGE_TYPE_RING_BELL = 2, |
194 | | VNC_SERVER_MESSAGE_TYPE_CUT_TEXT = 3, |
195 | | VNC_SERVER_MESSAGE_TYPE_MIRRORLINK = 128, |
196 | | VNC_SERVER_MESSAGE_TYPE_END_CONTINUOUS_UPDATES = 150, /* TightVNC */ |
197 | | VNC_SERVER_MESSAGE_TYPE_FENCE = 248, /* TigerVNC */ |
198 | | VNC_SERVER_MESSAGE_TYPE_XVP = 250, |
199 | | VNC_SERVER_MESSAGE_TYPE_TIGHT = 252, |
200 | | VNC_SERVER_MESSAGE_TYPE_GII = 253, |
201 | | VNC_SERVER_MESSAGE_TYPE_QEMU = 255 |
202 | | } vnc_server_message_types_e; |
203 | | |
204 | | static const value_string vnc_server_message_types_vs[] = { |
205 | | { VNC_SERVER_MESSAGE_TYPE_FRAMEBUFFER_UPDATE, "Framebuffer Update" }, |
206 | | { VNC_SERVER_MESSAGE_TYPE_SET_COLORMAP_ENTRIES, "Set Colormap Entries" }, |
207 | | { VNC_SERVER_MESSAGE_TYPE_RING_BELL, "Ring Bell" }, |
208 | | { VNC_SERVER_MESSAGE_TYPE_CUT_TEXT, "Cut Text" }, |
209 | | { VNC_SERVER_MESSAGE_TYPE_MIRRORLINK, "MirrorLink" }, |
210 | | { VNC_SERVER_MESSAGE_TYPE_END_CONTINUOUS_UPDATES, "End Continuous Updates" }, |
211 | | { VNC_SERVER_MESSAGE_TYPE_FENCE, "Fence" }, |
212 | | { VNC_SERVER_MESSAGE_TYPE_XVP, "Xvp" }, |
213 | | { VNC_SERVER_MESSAGE_TYPE_TIGHT, "Tight" }, |
214 | | { VNC_SERVER_MESSAGE_TYPE_GII, "Gii" }, |
215 | | { VNC_SERVER_MESSAGE_TYPE_QEMU, "Qemu" }, |
216 | | { 0, NULL } |
217 | | }; |
218 | | |
219 | | |
220 | 0 | #define VNC_ENCODING_TYPE_DESKTOP_SIZE 0xFFFFFF21 |
221 | 0 | #define VNC_ENCODING_TYPE_LAST_RECT 0xFFFFFF20 |
222 | 0 | #define VNC_ENCODING_TYPE_POINTER_POS 0xFFFFFF18 |
223 | 0 | #define VNC_ENCODING_TYPE_RICH_CURSOR 0xFFFFFF11 |
224 | 0 | #define VNC_ENCODING_TYPE_X_CURSOR 0xFFFFFF10 |
225 | 3 | #define VNC_ENCODING_TYPE_RAW 0 |
226 | 0 | #define VNC_ENCODING_TYPE_COPY_RECT 1 |
227 | 0 | #define VNC_ENCODING_TYPE_RRE 2 |
228 | 0 | #define VNC_ENCODING_TYPE_CORRE 4 |
229 | 0 | #define VNC_ENCODING_TYPE_HEXTILE 5 |
230 | 0 | #define VNC_ENCODING_TYPE_ZLIB 6 |
231 | 0 | #define VNC_ENCODING_TYPE_TIGHT 7 |
232 | | #define VNC_ENCODING_TYPE_ZLIBHEX 8 |
233 | | #define VNC_ENCODING_TYPE_ULTRA 9 |
234 | | #define VNC_ENCODING_TYPE_TRLE 15 |
235 | 0 | #define VNC_ENCODING_TYPE_RLE 16 |
236 | | #define VNC_ENCODING_TYPE_HITACHI_ZYWRLE 17 |
237 | | #define VNC_ENCODING_TYPE_OPEN_H264 50 |
238 | | #define VNC_ENCODING_TYPE_JPEG_0 -32 |
239 | | #define VNC_ENCODING_TYPE_JPEG_1 -31 |
240 | | #define VNC_ENCODING_TYPE_JPEG_2 -30 |
241 | | #define VNC_ENCODING_TYPE_JPEG_3 -29 |
242 | | #define VNC_ENCODING_TYPE_JPEG_4 -28 |
243 | | #define VNC_ENCODING_TYPE_JPEG_5 -27 |
244 | | #define VNC_ENCODING_TYPE_JPEG_6 -26 |
245 | | #define VNC_ENCODING_TYPE_JPEG_7 -25 |
246 | | #define VNC_ENCODING_TYPE_JPEG_8 -24 |
247 | | #define VNC_ENCODING_TYPE_JPEG_9 -23 |
248 | | #define VNC_ENCODING_TYPE_COMPRESSION_0 0xFFFFFF00 |
249 | | #define VNC_ENCODING_TYPE_COMPRESSION_1 0xFFFFFF01 |
250 | | #define VNC_ENCODING_TYPE_COMPRESSION_2 0xFFFFFF02 |
251 | | #define VNC_ENCODING_TYPE_COMPRESSION_3 0xFFFFFF03 |
252 | | #define VNC_ENCODING_TYPE_COMPRESSION_4 0xFFFFFF04 |
253 | | #define VNC_ENCODING_TYPE_COMPRESSION_5 0xFFFFFF05 |
254 | | #define VNC_ENCODING_TYPE_COMPRESSION_6 0xFFFFFF06 |
255 | | #define VNC_ENCODING_TYPE_COMPRESSION_7 0xFFFFFF07 |
256 | | #define VNC_ENCODING_TYPE_COMPRESSION_8 0xFFFFFF08 |
257 | | #define VNC_ENCODING_TYPE_COMPRESSION_9 0xFFFFFF09 |
258 | | #define VNC_ENCODING_TYPE_VMWARE_CURSOR 0x574D5664 |
259 | | #define VNC_ENCODING_TYPE_VMWARE_CURSOR_POS 0x574D5666 |
260 | | #define VNC_ENCODING_TYPE_VMWARE_LED_STATE 0x574D5668 |
261 | | #define VNC_ENCODING_TYPE_VMWARE_DISPLAY_MODE_CHANGE 0x574D5669 |
262 | | #define VNC_ENCODING_TYPE_CACHE 0xFFFF0000 |
263 | | #define VNC_ENCODING_TYPE_CACHE_ENABLE 0xFFFF0001 |
264 | | #define VNC_ENCODING_TYPE_XOR_ZLIB 0xFFFF0002 |
265 | | #define VNC_ENCODING_TYPE_XOR_MONO_ZLIB 0xFFFF0003 |
266 | | #define VNC_ENCODING_TYPE_XOR_MULTI_ZLIB 0xFFFF0004 |
267 | | #define VNC_ENCODING_TYPE_SOLID_COLOR 0xFFFF0005 |
268 | | #define VNC_ENCODING_TYPE_XOR_ENABLE 0xFFFF0006 |
269 | | #define VNC_ENCODING_TYPE_CACHE_ZIP 0xFFFF0007 |
270 | | #define VNC_ENCODING_TYPE_SOL_MONO_ZIP 0xFFFF0008 |
271 | | #define VNC_ENCODING_TYPE_ULTRA_ZIP 0xFFFF0009 |
272 | | #define VNC_ENCODING_TYPE_SERVER_STATE 0xFFFF8000 |
273 | | #define VNC_ENCODING_TYPE_ENABLE_KEEP_ALIVE 0xFFFF8001 |
274 | | #define VNC_ENCODING_TYPE_FTP_PROTO_VER 0xFFFF8002 |
275 | | #define VNC_ENCODING_TYPE_POINTER_CHANGE -257 |
276 | | #define VNC_ENCODING_TYPE_EXT_KEY_EVENT -258 |
277 | | #define VNC_ENCODING_TYPE_AUDIO -259 |
278 | | #define VNC_ENCODING_TYPE_QEMU_LED_STATE -261 |
279 | | #define VNC_ENCODING_TYPE_DESKTOP_NAME -307 |
280 | 0 | #define VNC_ENCODING_TYPE_EXTENDED_DESK_SIZE -308 |
281 | | #define VNC_ENCODING_TYPE_FENCE -312 |
282 | | #define VNC_ENCODING_TYPE_CONTINUOUS_UPDATES -313 |
283 | | #define VNC_ENCODING_TYPE_CURSOR_WITH_ALPHA -314 |
284 | 0 | #define VNC_ENCODING_TYPE_KEYBOARD_LED_STATE 0XFFFE0000 |
285 | 0 | #define VNC_ENCODING_TYPE_SUPPORTED_MESSAGES 0XFFFE0001 |
286 | 0 | #define VNC_ENCODING_TYPE_SUPPORTED_ENCODINGS 0XFFFE0002 |
287 | 0 | #define VNC_ENCODING_TYPE_SERVER_IDENTITY 0XFFFE0003 |
288 | | #define VNC_ENCODING_TYPE_MIRRORLINK 0xFFFFFDF5 |
289 | 0 | #define VNC_ENCODING_TYPE_CONTEXT_INFORMATION 0xFFFFFDF4 |
290 | 0 | #define VNC_ENCODING_TYPE_SLRLE 0xFFFFFDF3 |
291 | | #define VNC_ENCODING_TYPE_TRANSFORM 0xFFFFFDF2 |
292 | | #define VNC_ENCODING_TYPE_HSML 0xFFFFFDF1 |
293 | 0 | #define VNC_ENCODING_TYPE_H264 0X48323634 |
294 | 0 | #define VNC_ENCODING_EXTENDED_CLIPBOARD 0xC0A1E5CE |
295 | | |
296 | | static const value_string encoding_types_vs[] = { |
297 | | { VNC_ENCODING_TYPE_DESKTOP_SIZE, "DesktopSize (pseudo)" }, |
298 | | { VNC_ENCODING_TYPE_LAST_RECT, "LastRect (pseudo)" }, |
299 | | { VNC_ENCODING_TYPE_POINTER_POS, "Pointer pos (pseudo)" }, |
300 | | { VNC_ENCODING_TYPE_RICH_CURSOR, "Rich Cursor (pseudo)" }, |
301 | | { VNC_ENCODING_TYPE_X_CURSOR, "X Cursor (pseudo)" }, |
302 | | { VNC_ENCODING_TYPE_RAW, "Raw" }, |
303 | | { VNC_ENCODING_TYPE_COPY_RECT, "CopyRect" }, |
304 | | { VNC_ENCODING_TYPE_RRE, "RRE" }, |
305 | | { VNC_ENCODING_TYPE_CORRE, "CoRRE" }, |
306 | | { VNC_ENCODING_TYPE_HEXTILE, "Hextile" }, |
307 | | { VNC_ENCODING_TYPE_ZLIB, "Zlib" }, |
308 | | { VNC_ENCODING_TYPE_TIGHT, "Tight" }, |
309 | | { VNC_ENCODING_TYPE_ZLIBHEX, "ZlibHex" }, |
310 | | { VNC_ENCODING_TYPE_ULTRA, "Ultra" }, |
311 | | { VNC_ENCODING_TYPE_TRLE, "Tiled Run-Length" }, |
312 | | { VNC_ENCODING_TYPE_RLE, "ZRLE" }, |
313 | | { VNC_ENCODING_TYPE_HITACHI_ZYWRLE, "Hitachi ZYWRLE" }, |
314 | | { VNC_ENCODING_TYPE_OPEN_H264, "Open H.264" }, |
315 | | { VNC_ENCODING_TYPE_JPEG_0, "JPEG quality level 0" }, |
316 | | { VNC_ENCODING_TYPE_JPEG_1, "JPEG quality level 1" }, |
317 | | { VNC_ENCODING_TYPE_JPEG_2, "JPEG quality level 2" }, |
318 | | { VNC_ENCODING_TYPE_JPEG_3, "JPEG quality level 3" }, |
319 | | { VNC_ENCODING_TYPE_JPEG_4, "JPEG quality level 4" }, |
320 | | { VNC_ENCODING_TYPE_JPEG_5, "JPEG quality level 5" }, |
321 | | { VNC_ENCODING_TYPE_JPEG_6, "JPEG quality level 6" }, |
322 | | { VNC_ENCODING_TYPE_JPEG_7, "JPEG quality level 7" }, |
323 | | { VNC_ENCODING_TYPE_JPEG_8, "JPEG quality level 8" }, |
324 | | { VNC_ENCODING_TYPE_JPEG_9, "JPEG quality level 9" }, |
325 | | { VNC_ENCODING_TYPE_COMPRESSION_0, "Compression level 0" }, |
326 | | { VNC_ENCODING_TYPE_COMPRESSION_1, "Compression level 1" }, |
327 | | { VNC_ENCODING_TYPE_COMPRESSION_2, "Compression level 2" }, |
328 | | { VNC_ENCODING_TYPE_COMPRESSION_3, "Compression level 3" }, |
329 | | { VNC_ENCODING_TYPE_COMPRESSION_4, "Compression level 4" }, |
330 | | { VNC_ENCODING_TYPE_COMPRESSION_5, "Compression level 5" }, |
331 | | { VNC_ENCODING_TYPE_COMPRESSION_6, "Compression level 6" }, |
332 | | { VNC_ENCODING_TYPE_COMPRESSION_7, "Compression level 7" }, |
333 | | { VNC_ENCODING_TYPE_COMPRESSION_8, "Compression level 8" }, |
334 | | { VNC_ENCODING_TYPE_COMPRESSION_9, "Compression level 9" }, |
335 | | { VNC_ENCODING_TYPE_VMWARE_CURSOR, "VMware Cursor (pseudo)" }, |
336 | | { VNC_ENCODING_TYPE_VMWARE_CURSOR_POS, "VMware Cursor Position (pseudo)" }, |
337 | | { VNC_ENCODING_TYPE_VMWARE_LED_STATE, "VMware LED State (pseudo)" }, |
338 | | { VNC_ENCODING_TYPE_VMWARE_DISPLAY_MODE_CHANGE, "VMWare Display Mode Change (pseudo)" }, |
339 | | /* FIXME understand for real what the below mean. Taken from Ultra VNC source code */ |
340 | | /* { VNC_ENCODING_TYPE_CACHE, */ |
341 | | { VNC_ENCODING_TYPE_CACHE_ENABLE, "Enable Caching"}, |
342 | | /* { VNC_ENCODING_TYPE_XOR_ZLIB, |
343 | | { VNC_ENCODING_TYPE_XOR_MONO_ZLIB, |
344 | | { VNC_ENCODING_TYPE_XOR_MULTI_ZLIB, |
345 | | { VNC_ENCODING_TYPE_SOLID_COLOR, |
346 | | { VNC_ENCODING_TYPE_XOR_ENABLE, |
347 | | { VNC_ENCODING_TYPE_CACHE_ZIP, |
348 | | { VNC_ENCODING_TYPE_SOL_MONO_ZIP, |
349 | | { VNC_ENCODING_TYPE_ULTRA_ZIP, |
350 | | */ { VNC_ENCODING_TYPE_SERVER_STATE, "Server State" }, |
351 | | { VNC_ENCODING_TYPE_ENABLE_KEEP_ALIVE, "Enable Keep Alive" }, |
352 | | { VNC_ENCODING_TYPE_FTP_PROTO_VER, "FTP protocol version" }, |
353 | | { VNC_ENCODING_TYPE_POINTER_CHANGE, "QEMU Pointer Motion Change (pseudo)" }, |
354 | | { VNC_ENCODING_TYPE_EXT_KEY_EVENT, "QEMU Extended Key Event (pseudo)" }, |
355 | | { VNC_ENCODING_TYPE_FENCE, "Fence (pseudo)" }, |
356 | | { VNC_ENCODING_TYPE_CONTINUOUS_UPDATES, "Continuous Updates (pseudo)" }, |
357 | | { VNC_ENCODING_TYPE_CURSOR_WITH_ALPHA, "Cursor With Alpha (pseudo)" }, |
358 | | { VNC_ENCODING_TYPE_AUDIO, "QEMU Audio (pseudo)" }, |
359 | | { VNC_ENCODING_TYPE_QEMU_LED_STATE, "QEMU LED State (pseudo)" }, |
360 | | { VNC_ENCODING_TYPE_DESKTOP_NAME, "Desktop Name" }, |
361 | | { VNC_ENCODING_TYPE_EXTENDED_DESK_SIZE, "Extended Desktop Size"}, |
362 | | { VNC_ENCODING_TYPE_KEYBOARD_LED_STATE, "Keyboard LED State" }, |
363 | | { VNC_ENCODING_TYPE_SUPPORTED_MESSAGES, "Supported Messages" }, |
364 | | { VNC_ENCODING_TYPE_SUPPORTED_ENCODINGS, "Supported Encodings" }, |
365 | | { VNC_ENCODING_TYPE_SERVER_IDENTITY, "Server Identity" }, |
366 | | { VNC_ENCODING_TYPE_MIRRORLINK, "MirrorLink" }, |
367 | | { VNC_ENCODING_TYPE_CONTEXT_INFORMATION, "Context Information" }, |
368 | | { VNC_ENCODING_TYPE_SLRLE, "SLRLE" }, |
369 | | { VNC_ENCODING_TYPE_TRANSFORM, "Transform" }, |
370 | | { VNC_ENCODING_TYPE_HSML, "HSML" }, |
371 | | { VNC_ENCODING_TYPE_H264, "H264" }, |
372 | | { VNC_ENCODING_EXTENDED_CLIPBOARD, "Extended Clipboard (pseudo)" }, |
373 | | { 0, NULL } |
374 | | }; |
375 | | |
376 | | /* Rectangle types for Tight encoding. These come in the "control byte" at the |
377 | | * start of a rectangle's payload. Note that these are with respect to the most |
378 | | * significant bits 4-7 of the control byte, so you must shift it to the right 4 |
379 | | * bits before comparing against these values. |
380 | | */ |
381 | 0 | #define TIGHT_RECT_FILL 0x08 |
382 | 0 | #define TIGHT_RECT_JPEG 0x09 |
383 | 0 | #define TIGHT_RECT_MAX_VALUE 0x09 |
384 | | |
385 | 0 | #define TIGHT_RECT_EXPLICIT_FILTER_FLAG 0x04 |
386 | | |
387 | | /* Filter types for Basic encoding of Tight rectangles */ |
388 | 0 | #define TIGHT_RECT_FILTER_COPY 0x00 |
389 | 0 | #define TIGHT_RECT_FILTER_PALETTE 0x01 |
390 | 0 | #define TIGHT_RECT_FILTER_GRADIENT 0x02 |
391 | | |
392 | | /* Minimum number of bytes to compress for Tight encoding */ |
393 | 0 | #define TIGHT_MIN_BYTES_TO_COMPRESS 12 |
394 | | |
395 | | static const value_string tight_filter_ids_vs[] = { |
396 | | { TIGHT_RECT_FILTER_COPY, "Copy" }, |
397 | | { TIGHT_RECT_FILTER_PALETTE, "Palette" }, |
398 | | { TIGHT_RECT_FILTER_GRADIENT, "Gradient" }, |
399 | | { 0, NULL } |
400 | | }; |
401 | | |
402 | | /* MirrorLink messages */ |
403 | | typedef enum { |
404 | | VNC_ML_EXT_BYE_BYE = 0, |
405 | | VNC_ML_EXT_SERVER_DISPLAY_CONFIGURATION = 1, |
406 | | VNC_ML_EXT_CLIENT_DISPLAY_CONFIGURATION = 2, |
407 | | VNC_ML_EXT_SERVER_EVENT_CONFIGURATION = 3, |
408 | | VNC_ML_EXT_CLIENT_EVENT_CONFIGURATION = 4, |
409 | | VNC_ML_EXT_EVENT_MAPPING = 5, |
410 | | VNC_ML_EXT_EVENT_MAPPING_REQUEST = 6, |
411 | | VNC_ML_EXT_KEY_EVENT_LISTING = 7, |
412 | | VNC_ML_EXT_KEY_EVENT_LISTING_REQUEST = 8, |
413 | | VNC_ML_EXT_VIRTUAL_KEYBOARD = 9, |
414 | | VNC_ML_EXT_VIRTUAL_KEYBOARD_REQUEST = 10, |
415 | | VNC_ML_EXT_DEVICE_STATUS = 11, |
416 | | VNC_ML_EXT_DEVICE_STATUS_REQUEST = 12, |
417 | | VNC_ML_EXT_CONTENT_ATTESTATION = 13, |
418 | | VNC_ML_EXT_CONTENT_ATTESTATION_REQUEST = 14, |
419 | | VNC_ML_EXT_FB_BLOCKING_NOTIFICATION = 16, |
420 | | VNC_ML_EXT_AUDIO_BLOCKING_NOTIFICATION = 18, |
421 | | VNC_ML_EXT_TOUCH_EVENT = 20, |
422 | | VNC_ML_EXT_FB_ALTERNATIVE_TEXT = 21, |
423 | | VNC_ML_EXT_FB_ALTERNATIVE_TEXT_REQUEST = 22 |
424 | | } vnc_mirrorlink_ext_types_e; |
425 | | |
426 | | static const value_string vnc_mirrorlink_types_vs[] = { |
427 | | { VNC_ML_EXT_BYE_BYE, "ByeBye" }, |
428 | | { VNC_ML_EXT_SERVER_DISPLAY_CONFIGURATION, "Server Display Configuration" }, |
429 | | { VNC_ML_EXT_CLIENT_DISPLAY_CONFIGURATION, "Client Display Configuration" }, |
430 | | { VNC_ML_EXT_SERVER_EVENT_CONFIGURATION, "Server Event Configuration" }, |
431 | | { VNC_ML_EXT_CLIENT_EVENT_CONFIGURATION, "Client Event Configuration" }, |
432 | | { VNC_ML_EXT_EVENT_MAPPING, "Event Mapping" }, |
433 | | { VNC_ML_EXT_EVENT_MAPPING_REQUEST, "Event Mapping Request" }, |
434 | | { VNC_ML_EXT_KEY_EVENT_LISTING, "Key Event Listing" }, |
435 | | { VNC_ML_EXT_KEY_EVENT_LISTING_REQUEST, "Key Event Listing Request" }, |
436 | | { VNC_ML_EXT_VIRTUAL_KEYBOARD, "Virtual Keyboard Trigger" }, |
437 | | { VNC_ML_EXT_VIRTUAL_KEYBOARD_REQUEST, "Virtual Keyboard Trigger Request" }, |
438 | | { VNC_ML_EXT_DEVICE_STATUS, "Device Status" }, |
439 | | { VNC_ML_EXT_DEVICE_STATUS_REQUEST, "Device Status Request" }, |
440 | | { VNC_ML_EXT_CONTENT_ATTESTATION, "Content Attestation" }, |
441 | | { VNC_ML_EXT_CONTENT_ATTESTATION_REQUEST, "Content Attestation Request" }, |
442 | | { VNC_ML_EXT_FB_BLOCKING_NOTIFICATION, "Framebuffer Blocking Notification" }, |
443 | | { VNC_ML_EXT_AUDIO_BLOCKING_NOTIFICATION, "Audio Blocking Notification" }, |
444 | | { VNC_ML_EXT_TOUCH_EVENT, "Touch Event" }, |
445 | | { VNC_ML_EXT_FB_ALTERNATIVE_TEXT, "Framebuffer Alternative Text" }, |
446 | | { VNC_ML_EXT_FB_ALTERNATIVE_TEXT_REQUEST, "Framebuffer Alternative Text Request" }, |
447 | | { 0, NULL } |
448 | | }; |
449 | | |
450 | | /* Slice types for H.264 encoding */ |
451 | | typedef enum { |
452 | | VNC_H264_SLICE_TYPE_P = 0, |
453 | | VNC_H264_SLICE_TYPE_B = 1, |
454 | | VNC_H264_SLICE_TYPE_I = 2 |
455 | | } vnc_h264_slice_types_e; |
456 | | |
457 | | static const value_string vnc_h264_slice_types_vs[] = { |
458 | | { VNC_H264_SLICE_TYPE_P, "Predicted" }, |
459 | | { VNC_H264_SLICE_TYPE_B, "Bi-predicted" }, |
460 | | { VNC_H264_SLICE_TYPE_I, "Intra coded" }, |
461 | | { 0, NULL } |
462 | | }; |
463 | | |
464 | | |
465 | | typedef enum { |
466 | | VNC_SESSION_STATE_SERVER_VERSION, |
467 | | VNC_SESSION_STATE_CLIENT_VERSION, |
468 | | |
469 | | VNC_SESSION_STATE_SECURITY, |
470 | | VNC_SESSION_STATE_SECURITY_TYPES, |
471 | | |
472 | | VNC_SESSION_STATE_TIGHT_TUNNELING_CAPABILITIES, |
473 | | VNC_SESSION_STATE_TIGHT_TUNNEL_TYPE_REPLY, |
474 | | VNC_SESSION_STATE_TIGHT_AUTH_CAPABILITIES, |
475 | | VNC_SESSION_STATE_TIGHT_AUTH_TYPE_REPLY, |
476 | | VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3, |
477 | | |
478 | | VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE, |
479 | | VNC_SESSION_STATE_VNC_AUTHENTICATION_RESPONSE, |
480 | | |
481 | | VNC_SESSION_STATE_ARD_AUTHENTICATION_CHALLENGE, |
482 | | VNC_SESSION_STATE_ARD_AUTHENTICATION_RESPONSE, |
483 | | |
484 | | VNC_SESSION_STATE_SECURITY_RESULT, |
485 | | |
486 | | VNC_SESSION_STATE_VENCRYPT_SERVER_VERSION, |
487 | | VNC_SESSION_STATE_VENCRYPT_CLIENT_VERSION, |
488 | | VNC_SESSION_STATE_VENCRYPT_AUTH_CAPABILITIES, |
489 | | VNC_SESSION_STATE_VENCRYPT_AUTH_TYPE_REPLY, |
490 | | VNC_SESSION_STATE_VENCRYPT_AUTH_ACK, |
491 | | |
492 | | VNC_SESSION_STATE_CLIENT_INIT, |
493 | | VNC_SESSION_STATE_SERVER_INIT, |
494 | | |
495 | | VNC_SESSION_STATE_TIGHT_INTERACTION_CAPS, |
496 | | |
497 | | VNC_SESSION_STATE_NORMAL_TRAFFIC |
498 | | } vnc_session_state_e; |
499 | | |
500 | 14 | #define VNC_FENCE_BLOCK_BEFORE 0x00000001 |
501 | 14 | #define VNC_FENCE_BLOCK_AFTER 0x00000002 |
502 | 14 | #define VNC_FENCE_SYNC_NEXT 0x00000004 |
503 | 14 | #define VNC_FENCE_REQUEST 0x80000000 |
504 | | |
505 | 14 | #define VNC_EXT_CLIPBOARD_TEXT 0x1 << 0 |
506 | 14 | #define VNC_EXT_CLIPBOARD_RTF 0x1 << 1 |
507 | 14 | #define VNC_EXT_CLIPBOARD_HTML 0x1 << 2 |
508 | 14 | #define VNC_EXT_CLIPBOARD_DIB 0x1 << 3 |
509 | 14 | #define VNC_EXT_CLIPBOARD_FILES 0x1 << 4 |
510 | 14 | #define VNC_EXT_CLIPBOARD_CAPS 0x1 << 24 |
511 | 14 | #define VNC_EXT_CLIPBOARD_REQUEST 0x1 << 25 |
512 | 14 | #define VNC_EXT_CLIPBOARD_PEEK 0x1 << 26 |
513 | 14 | #define VNC_EXT_CLIPBOARD_NOTIFY 0x1 << 27 |
514 | 14 | #define VNC_EXT_CLIPBOARD_PROVIDE 0x1 << 28 |
515 | | |
516 | | |
517 | | /* This structure will be tied to each conversation. */ |
518 | | typedef struct { |
519 | | double server_proto_ver, client_proto_ver; |
520 | | uint32_t server_port; |
521 | | /* These are specific to TightVNC */ |
522 | | int num_server_message_types; |
523 | | int num_client_message_types; |
524 | | int num_encoding_types; |
525 | | uint8_t security_type_selected; |
526 | | bool tight_enabled; |
527 | | /* This is specific to Apple Remote Desktop */ |
528 | | uint16_t ard_key_length; |
529 | | /* State information valid on first sequential pass; |
530 | | * stored in per-packet info for subsequent passes. */ |
531 | | uint8_t bytes_per_pixel; |
532 | | uint8_t depth; |
533 | | vnc_session_state_e vnc_next_state; |
534 | | int preferred_encoding; |
535 | | bool extended_clipboard_enabled; |
536 | | } vnc_conversation_t; |
537 | | |
538 | | /* This structure will be tied to each packet */ |
539 | | typedef struct { |
540 | | vnc_session_state_e state; |
541 | | //int preferred_encoding; XXX: Not actually used? |
542 | | uint8_t bytes_per_pixel; |
543 | | uint8_t depth; |
544 | | } vnc_packet_t; |
545 | | |
546 | | void proto_reg_handoff_vnc(void); |
547 | | |
548 | | static bool vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, |
549 | | int offset, proto_tree *tree, |
550 | | vnc_conversation_t *per_conversation_info); |
551 | | static void vnc_client_to_server(tvbuff_t *tvb, packet_info *pinfo, |
552 | | int *offset, proto_tree *tree, |
553 | | vnc_conversation_t *per_conversation_info); |
554 | | static void vnc_server_to_client(tvbuff_t *tvb, packet_info *pinfo, |
555 | | int *offset, proto_tree *tree); |
556 | | static void vnc_client_set_pixel_format(tvbuff_t *tvb, packet_info *pinfo, |
557 | | int *offset, proto_tree *tree, |
558 | | vnc_conversation_t *per_conversation_info); |
559 | | static void vnc_client_set_encodings(tvbuff_t *tvb, packet_info *pinfo, |
560 | | int *offset, proto_tree *tree, |
561 | | vnc_conversation_t *per_conversation_info); |
562 | | static void vnc_client_framebuffer_update_request(tvbuff_t *tvb, |
563 | | packet_info *pinfo, |
564 | | int *offset, |
565 | | proto_tree *tree); |
566 | | static void vnc_client_key_event(tvbuff_t *tvb, packet_info *pinfo, |
567 | | int *offset, proto_tree *tree); |
568 | | static void vnc_client_pointer_event(tvbuff_t *tvb, packet_info *pinfo, |
569 | | int *offset, proto_tree *tree); |
570 | | static unsigned vnc_client_cut_text(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
571 | | proto_tree *tree); |
572 | | static unsigned vnc_client_cut_text_extended(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
573 | | proto_tree *tree); |
574 | | static void vnc_client_cut_text_extended_non_compatible(tvbuff_t *tvb, packet_info *pinfo, |
575 | | int *offset, proto_tree *tree, int message_length); |
576 | | |
577 | | static unsigned vnc_server_framebuffer_update(tvbuff_t *tvb, packet_info *pinfo, |
578 | | int *offset, proto_tree *tree); |
579 | | static unsigned vnc_raw_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
580 | | proto_tree *tree, const uint16_t width, const uint16_t height); |
581 | | static unsigned vnc_copyrect_encoding(tvbuff_t *tvb, packet_info *pinfo, |
582 | | int *offset, proto_tree *tree, |
583 | | const uint16_t width, const uint16_t height); |
584 | | static unsigned vnc_rre_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
585 | | proto_tree *tree, const uint16_t width, const uint16_t height); |
586 | | static unsigned vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, |
587 | | int *offset, proto_tree *tree, |
588 | | const uint16_t width, const uint16_t height); |
589 | | static unsigned vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
590 | | proto_tree *tree, const uint16_t width, const uint16_t height); |
591 | | static unsigned vnc_tight_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
592 | | proto_tree *tree, const uint16_t width, const uint16_t height); |
593 | | static unsigned vnc_rich_cursor_encoding(tvbuff_t *tvb, packet_info *pinfo, |
594 | | int *offset, proto_tree *tree, const uint16_t width, |
595 | | const uint16_t height); |
596 | | static unsigned vnc_x_cursor_encoding(tvbuff_t *tvb, packet_info *pinfo, |
597 | | int *offset, proto_tree *tree, const uint16_t width, |
598 | | const uint16_t height); |
599 | | static unsigned vnc_server_set_colormap_entries(tvbuff_t *tvb, packet_info *pinfo, |
600 | | int *offset, proto_tree *tree); |
601 | | static void vnc_server_ring_bell(tvbuff_t *tvb, packet_info *pinfo, |
602 | | int *offset, proto_tree *tree); |
603 | | static unsigned vnc_server_cut_text(tvbuff_t *tvb, packet_info *pinfo, |
604 | | int *offset, proto_tree *tree); |
605 | | static void vnc_set_bytes_per_pixel(packet_info *pinfo, vnc_conversation_t *per_conversation_info, const uint8_t bytes_per_pixel); |
606 | | static void vnc_set_depth(packet_info *pinfo, vnc_conversation_t *per_conversation_info, const uint8_t depth); |
607 | | static uint8_t vnc_get_bytes_per_pixel(packet_info *pinfo); |
608 | | static uint8_t vnc_get_depth(packet_info *pinfo); |
609 | | static uint32_t vnc_extended_desktop_size(tvbuff_t *tvb, int *offset, proto_tree *tree); |
610 | | |
611 | | static unsigned vnc_supported_messages(tvbuff_t *tvb, int *offset, |
612 | | proto_tree *tree, const uint16_t width); |
613 | | static unsigned vnc_supported_encodings(tvbuff_t *tvb, int *offset, |
614 | | proto_tree *tree, const uint16_t width, |
615 | | const uint16_t height); |
616 | | static unsigned vnc_server_identity(tvbuff_t *tvb, int *offset, |
617 | | proto_tree *tree, const uint16_t width); |
618 | | |
619 | | static unsigned vnc_fence(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
620 | | proto_tree *tree); |
621 | | static void vnc_qemu(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
622 | | proto_tree *tree); |
623 | | static void vnc_qemu_extended_key_event(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
624 | | proto_tree *tree); |
625 | | static unsigned vnc_mirrorlink(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
626 | | proto_tree *tree); |
627 | | static unsigned vnc_context_information(tvbuff_t *tvb, int *offset, |
628 | | proto_tree *tree); |
629 | | static unsigned vnc_slrle_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
630 | | proto_tree *tree, const uint16_t height); |
631 | | |
632 | | static unsigned vnc_h264_encoding(tvbuff_t *tvb, int *offset, proto_tree *tree); |
633 | | |
634 | | #define VNC_BYTES_NEEDED(a) \ |
635 | 0 | if((a) > (unsigned)tvb_reported_length_remaining(tvb, *offset)) \ |
636 | 0 | return (a); |
637 | | |
638 | | /* Initialize the protocol and registered fields */ |
639 | | static int proto_vnc; /* Protocol subtree */ |
640 | | static int hf_vnc_padding; |
641 | | static int hf_vnc_server_proto_ver; |
642 | | static int hf_vnc_client_proto_ver; |
643 | | static int hf_vnc_num_security_types; |
644 | | static int hf_vnc_security_type; |
645 | | static int hf_vnc_server_security_type; |
646 | | static int hf_vnc_client_security_type; |
647 | | static int hf_vnc_auth_challenge; |
648 | | static int hf_vnc_auth_response; |
649 | | static int hf_vnc_auth_result; |
650 | | static int hf_vnc_auth_error; |
651 | | static int hf_vnc_auth_error_length; |
652 | | |
653 | | static int hf_vnc_ard_auth_generator; |
654 | | static int hf_vnc_ard_auth_key_len; |
655 | | static int hf_vnc_ard_auth_modulus; |
656 | | static int hf_vnc_ard_auth_server_key; |
657 | | static int hf_vnc_ard_auth_credentials; |
658 | | static int hf_vnc_ard_auth_client_key; |
659 | | |
660 | | static int hf_vnc_share_desktop_flag; |
661 | | static int hf_vnc_width; |
662 | | static int hf_vnc_height; |
663 | | static int hf_vnc_server_bits_per_pixel; |
664 | | static int hf_vnc_server_depth; |
665 | | static int hf_vnc_server_big_endian_flag; |
666 | | static int hf_vnc_server_true_color_flag; |
667 | | static int hf_vnc_server_red_max; |
668 | | static int hf_vnc_server_green_max; |
669 | | static int hf_vnc_server_blue_max; |
670 | | static int hf_vnc_server_red_shift; |
671 | | static int hf_vnc_server_green_shift; |
672 | | static int hf_vnc_server_blue_shift; |
673 | | static int hf_vnc_desktop_name; |
674 | | static int hf_vnc_desktop_name_len; |
675 | | static int hf_vnc_desktop_screen_num; |
676 | | static int hf_vnc_desktop_screen_id; |
677 | | static int hf_vnc_desktop_screen_x; |
678 | | static int hf_vnc_desktop_screen_y; |
679 | | static int hf_vnc_desktop_screen_width; |
680 | | static int hf_vnc_desktop_screen_height; |
681 | | static int hf_vnc_desktop_screen_flags; |
682 | | static int hf_vnc_num_server_message_types; |
683 | | static int hf_vnc_num_client_message_types; |
684 | | static int hf_vnc_num_encoding_types; |
685 | | |
686 | | /********** Client Message Types **********/ |
687 | | |
688 | | static int hf_vnc_client_message_type; /* A subtree under VNC */ |
689 | | static int hf_vnc_client_bits_per_pixel; |
690 | | static int hf_vnc_client_depth; |
691 | | static int hf_vnc_client_big_endian_flag; |
692 | | static int hf_vnc_client_true_color_flag; |
693 | | static int hf_vnc_client_red_max; |
694 | | static int hf_vnc_client_green_max; |
695 | | static int hf_vnc_client_blue_max; |
696 | | static int hf_vnc_client_red_shift; |
697 | | static int hf_vnc_client_green_shift; |
698 | | static int hf_vnc_client_blue_shift; |
699 | | |
700 | | /* Client Key Event */ |
701 | | static int hf_vnc_key_down; |
702 | | static int hf_vnc_key; |
703 | | |
704 | | /* Client Pointer Event */ |
705 | | static int hf_vnc_button_1_pos; |
706 | | static int hf_vnc_button_2_pos; |
707 | | static int hf_vnc_button_3_pos; |
708 | | static int hf_vnc_button_4_pos; |
709 | | static int hf_vnc_button_5_pos; |
710 | | static int hf_vnc_button_6_pos; |
711 | | static int hf_vnc_button_7_pos; |
712 | | static int hf_vnc_button_8_pos; |
713 | | static int hf_vnc_pointer_x_pos; |
714 | | static int hf_vnc_pointer_y_pos; |
715 | | |
716 | | /* Client Framebuffer Update Request */ |
717 | | static int hf_vnc_update_req_incremental; |
718 | | static int hf_vnc_update_req_x_pos; |
719 | | static int hf_vnc_update_req_y_pos; |
720 | | static int hf_vnc_update_req_width; |
721 | | static int hf_vnc_update_req_height; |
722 | | |
723 | | /* Client Set Encodings */ |
724 | | static int hf_vnc_encoding_num; |
725 | | static int hf_vnc_client_set_encodings_encoding_type; |
726 | | |
727 | | /* Client Cut Text */ |
728 | | static int hf_vnc_client_cut_text_len; |
729 | | static int hf_vnc_client_cut_text_len_ext; |
730 | | static int hf_vnc_client_cut_text; |
731 | | |
732 | | /* Client QEMU Message SubType */ |
733 | | static int hf_vnc_qemu_subtype; |
734 | | |
735 | | /* Client QEMU Extended Key Event */ |
736 | | static int hf_vnc_qemu_extended_key_down_flag; |
737 | | static int hf_vnc_qemu_extended_key_keysum; |
738 | | static int hf_vnc_qemu_extended_key_keycode; |
739 | | |
740 | | /********** Server Message Types **********/ |
741 | | |
742 | | static int hf_vnc_server_message_type; /* Subtree */ |
743 | | |
744 | | /* Tunneling capabilities (TightVNC extension) */ |
745 | | static int hf_vnc_tight_num_tunnel_types; |
746 | | static int hf_vnc_tight_tunnel_type_code; |
747 | | static int hf_vnc_tight_tunnel_type_vendor; |
748 | | static int hf_vnc_tight_tunnel_type_signature; |
749 | | |
750 | | /* Authentication capabilities (TightVNC extension) */ |
751 | | static int hf_vnc_tight_num_auth_types; |
752 | | static int hf_vnc_tight_auth_code; |
753 | | /* TightVNC capabilities */ |
754 | | static int hf_vnc_tight_server_message_type; |
755 | | static int hf_vnc_tight_server_vendor; |
756 | | static int hf_vnc_tight_signature; |
757 | | static int hf_vnc_tight_server_name; |
758 | | |
759 | | static int hf_vnc_tight_client_message_type; |
760 | | static int hf_vnc_tight_client_vendor; |
761 | | static int hf_vnc_tight_client_name; |
762 | | |
763 | | static int hf_vnc_tight_encoding_type; |
764 | | static int hf_vnc_tight_encoding_vendor; |
765 | | static int hf_vnc_tight_encoding_name; |
766 | | |
767 | | /* VeNCrypt capabilities */ |
768 | | static int hf_vnc_vencrypt_server_major_ver; |
769 | | static int hf_vnc_vencrypt_server_minor_ver; |
770 | | static int hf_vnc_vencrypt_client_major_ver; |
771 | | static int hf_vnc_vencrypt_client_minor_ver; |
772 | | static int hf_vnc_vencrypt_version_ack; |
773 | | static int hf_vnc_vencrypt_num_auth_types; |
774 | | static int hf_vnc_vencrypt_auth_type; |
775 | | static int hf_vnc_vencrypt_auth_type_ack; |
776 | | |
777 | | /* Tight compression parameters */ |
778 | | static int hf_vnc_tight_reset_stream0; |
779 | | static int hf_vnc_tight_reset_stream1; |
780 | | static int hf_vnc_tight_reset_stream2; |
781 | | static int hf_vnc_tight_reset_stream3; |
782 | | |
783 | | static int hf_vnc_tight_rect_type; |
784 | | |
785 | | static int hf_vnc_tight_image_len; |
786 | | static int hf_vnc_tight_image_data; |
787 | | |
788 | | static int hf_vnc_tight_fill_color; |
789 | | |
790 | | static int hf_vnc_tight_filter_flag; |
791 | | static int hf_vnc_tight_filter_id; |
792 | | |
793 | | static int hf_vnc_tight_palette_num_colors; |
794 | | static int hf_vnc_tight_palette_data; |
795 | | |
796 | | /* Server Framebuffer Update */ |
797 | | static int hf_vnc_rectangle_num; |
798 | | static int hf_vnc_fb_update_x_pos; |
799 | | static int hf_vnc_fb_update_y_pos; |
800 | | static int hf_vnc_fb_update_width; |
801 | | static int hf_vnc_fb_update_height; |
802 | | static int hf_vnc_fb_update_encoding_type; |
803 | | |
804 | | /* Raw Encoding */ |
805 | | static int hf_vnc_raw_pixel_data; |
806 | | |
807 | | /* CopyRect Encoding */ |
808 | | static int hf_vnc_copyrect_src_x_pos; |
809 | | static int hf_vnc_copyrect_src_y_pos; |
810 | | |
811 | | /* RRE Encoding */ |
812 | | static int hf_vnc_rre_num_subrects; |
813 | | static int hf_vnc_rre_bg_pixel; |
814 | | |
815 | | static int hf_vnc_rre_subrect_pixel; |
816 | | static int hf_vnc_rre_subrect_x_pos; |
817 | | static int hf_vnc_rre_subrect_y_pos; |
818 | | static int hf_vnc_rre_subrect_width; |
819 | | static int hf_vnc_rre_subrect_height; |
820 | | |
821 | | /* Hextile Encoding */ |
822 | | static int hf_vnc_hextile_subencoding_mask; |
823 | | static int hf_vnc_hextile_raw; |
824 | | static int hf_vnc_hextile_raw_value; |
825 | | static int hf_vnc_hextile_bg; |
826 | | static int hf_vnc_hextile_bg_value; |
827 | | static int hf_vnc_hextile_fg; |
828 | | static int hf_vnc_hextile_fg_value; |
829 | | static int hf_vnc_hextile_anysubrects; |
830 | | static int hf_vnc_hextile_num_subrects; |
831 | | static int hf_vnc_hextile_subrectscolored; |
832 | | static int hf_vnc_hextile_subrect_pixel_value; |
833 | | static int hf_vnc_hextile_subrect_x_pos; |
834 | | static int hf_vnc_hextile_subrect_y_pos; |
835 | | static int hf_vnc_hextile_subrect_width; |
836 | | static int hf_vnc_hextile_subrect_height; |
837 | | |
838 | | /* ZRLE Encoding */ |
839 | | static int hf_vnc_zrle_len; |
840 | | static int hf_vnc_zrle_subencoding; |
841 | | static int hf_vnc_zrle_rle; |
842 | | static int hf_vnc_zrle_palette_size; |
843 | | static int hf_vnc_zrle_data; |
844 | | static int hf_vnc_zrle_raw; |
845 | | static int hf_vnc_zrle_palette; |
846 | | |
847 | | /* Cursor Encoding */ |
848 | | static int hf_vnc_cursor_x_fore_back; |
849 | | static int hf_vnc_cursor_encoding_pixels; |
850 | | static int hf_vnc_cursor_encoding_bitmask; |
851 | | |
852 | | /* Server Set Colormap Entries */ |
853 | | static int hf_vnc_color_groups; |
854 | | static int hf_vnc_colormap_first_color; |
855 | | static int hf_vnc_colormap_num_colors; |
856 | | static int hf_vnc_colormap_red; |
857 | | static int hf_vnc_colormap_green; |
858 | | static int hf_vnc_colormap_blue; |
859 | | |
860 | | /* Server Cut Text */ |
861 | | static int hf_vnc_server_cut_text_len; |
862 | | static int hf_vnc_server_cut_text; |
863 | | |
864 | | /* LibVNCServer additions */ |
865 | | static int hf_vnc_supported_messages_client2server; |
866 | | static int hf_vnc_supported_messages_server2client; |
867 | | static int hf_vnc_num_supported_encodings; |
868 | | static int hf_vnc_supported_encodings; |
869 | | static int hf_vnc_server_identity; |
870 | | |
871 | | /* MirrorLink */ |
872 | | static int hf_vnc_mirrorlink_type; |
873 | | static int hf_vnc_mirrorlink_length; |
874 | | static int hf_vnc_mirrorlink_version_major; |
875 | | static int hf_vnc_mirrorlink_version_minor; |
876 | | static int hf_vnc_mirrorlink_framebuffer_configuration; |
877 | | static int hf_vnc_mirrorlink_pixel_width; |
878 | | static int hf_vnc_mirrorlink_pixel_height; |
879 | | static int hf_vnc_mirrorlink_pixel_format; |
880 | | static int hf_vnc_mirrorlink_display_width; |
881 | | static int hf_vnc_mirrorlink_display_height; |
882 | | static int hf_vnc_mirrorlink_display_distance; |
883 | | static int hf_vnc_mirrorlink_keyboard_language; |
884 | | static int hf_vnc_mirrorlink_keyboard_country; |
885 | | static int hf_vnc_mirrorlink_ui_language; |
886 | | static int hf_vnc_mirrorlink_ui_country; |
887 | | static int hf_vnc_mirrorlink_knob_keys; |
888 | | static int hf_vnc_mirrorlink_device_keys; |
889 | | static int hf_vnc_mirrorlink_multimedia_keys; |
890 | | static int hf_vnc_mirrorlink_key_related; |
891 | | static int hf_vnc_mirrorlink_pointer_related; |
892 | | static int hf_vnc_mirrorlink_key_symbol_value_client; |
893 | | static int hf_vnc_mirrorlink_key_symbol_value_server; |
894 | | static int hf_vnc_mirrorlink_key_configuration; |
895 | | static int hf_vnc_mirrorlink_key_num_events; |
896 | | static int hf_vnc_mirrorlink_key_event_counter; |
897 | | static int hf_vnc_mirrorlink_key_symbol_value; |
898 | | static int hf_vnc_mirrorlink_key_request_configuration; |
899 | | static int hf_vnc_mirrorlink_keyboard_configuration; |
900 | | static int hf_vnc_mirrorlink_cursor_x; |
901 | | static int hf_vnc_mirrorlink_cursor_y; |
902 | | static int hf_vnc_mirrorlink_text_x; |
903 | | static int hf_vnc_mirrorlink_text_y; |
904 | | static int hf_vnc_mirrorlink_text_width; |
905 | | static int hf_vnc_mirrorlink_text_height; |
906 | | static int hf_vnc_mirrorlink_keyboard_request_configuration; |
907 | | static int hf_vnc_mirrorlink_device_status; |
908 | | static int hf_vnc_mirrorlink_app_id; |
909 | | static int hf_vnc_mirrorlink_fb_block_x; |
910 | | static int hf_vnc_mirrorlink_fb_block_y; |
911 | | static int hf_vnc_mirrorlink_fb_block_width; |
912 | | static int hf_vnc_mirrorlink_fb_block_height; |
913 | | static int hf_vnc_mirrorlink_fb_block_reason; |
914 | | static int hf_vnc_mirrorlink_audio_block_reason; |
915 | | static int hf_vnc_mirrorlink_touch_num_events; |
916 | | static int hf_vnc_mirrorlink_touch_x; |
917 | | static int hf_vnc_mirrorlink_touch_y; |
918 | | static int hf_vnc_mirrorlink_touch_id; |
919 | | static int hf_vnc_mirrorlink_touch_pressure; |
920 | | static int hf_vnc_mirrorlink_text; |
921 | | static int hf_vnc_mirrorlink_text_length; |
922 | | static int hf_vnc_mirrorlink_text_max_length; |
923 | | static int hf_vnc_mirrorlink_unknown; |
924 | | |
925 | | /* Fence */ |
926 | | static int hf_vnc_fence_flags; |
927 | | static int hf_vnc_fence_request; |
928 | | static int hf_vnc_fence_sync_next; |
929 | | static int hf_vnc_fence_block_after; |
930 | | static int hf_vnc_fence_block_before; |
931 | | static int hf_vnc_fence_payload_length; |
932 | | static int hf_vnc_fence_payload; |
933 | | |
934 | | static int * const vnc_fence_flags[] = { |
935 | | &hf_vnc_fence_request, |
936 | | &hf_vnc_fence_sync_next, |
937 | | &hf_vnc_fence_block_after, |
938 | | &hf_vnc_fence_block_before, |
939 | | NULL |
940 | | }; |
941 | | |
942 | | /* Context Information */ |
943 | | static int hf_vnc_context_information_app_id; |
944 | | static int hf_vnc_context_information_app_category; |
945 | | static int hf_vnc_context_information_app_trust_level; |
946 | | static int hf_vnc_context_information_content_category; |
947 | | static int hf_vnc_context_information_content_rules; |
948 | | static int hf_vnc_context_information_content_trust_level; |
949 | | |
950 | | /* Scan Line based Run-Length Encoding */ |
951 | | static int hf_vnc_slrle_run_num; |
952 | | static int hf_vnc_slrle_run_data; |
953 | | |
954 | | /* H.264 Encoding */ |
955 | | static int hf_vnc_h264_slice_type; |
956 | | static int hf_vnc_h264_nbytes; |
957 | | static int hf_vnc_h264_width; |
958 | | static int hf_vnc_h264_height; |
959 | | static int hf_vnc_h264_data; |
960 | | |
961 | | /* Extended clipboard */ |
962 | | static int hf_vnc_ext_clipboard_flags; |
963 | | static int hf_vnc_ext_clipboard_text; |
964 | | static int hf_vnc_ext_clipboard_rtf; |
965 | | static int hf_vnc_ext_clipboard_html; |
966 | | static int hf_vnc_ext_clipboard_dib; |
967 | | static int hf_vnc_ext_clipboard_files; |
968 | | static int hf_vnc_ext_clipboard_caps; |
969 | | static int hf_vnc_ext_clipboard_request; |
970 | | static int hf_vnc_ext_clipboard_peek; |
971 | | static int hf_vnc_ext_clipboard_notify; |
972 | | static int hf_vnc_ext_clipboard_provide; |
973 | | |
974 | | static int * const vnc_ext_clipboard_flags[] = { |
975 | | &hf_vnc_ext_clipboard_text, |
976 | | &hf_vnc_ext_clipboard_rtf, |
977 | | &hf_vnc_ext_clipboard_html, |
978 | | &hf_vnc_ext_clipboard_dib, |
979 | | &hf_vnc_ext_clipboard_files, |
980 | | &hf_vnc_ext_clipboard_caps, |
981 | | &hf_vnc_ext_clipboard_request, |
982 | | &hf_vnc_ext_clipboard_peek, |
983 | | &hf_vnc_ext_clipboard_notify, |
984 | | &hf_vnc_ext_clipboard_provide, |
985 | | NULL |
986 | | }; |
987 | | |
988 | | static int hf_vnc_ext_clipboard_cap_text; |
989 | | static int hf_vnc_ext_clipboard_cap_rtf; |
990 | | static int hf_vnc_ext_clipboard_cap_html; |
991 | | static int hf_vnc_ext_clipboard_cap_dib; |
992 | | |
993 | | static int hf_vnc_ext_clipboard_text_value; |
994 | | static int hf_vnc_ext_clipboard_rtf_value; |
995 | | static int hf_vnc_ext_clipboard_html_value; |
996 | | static int hf_vnc_ext_clipboard_dib_value; |
997 | | |
998 | | static int hf_vnc_ext_clipboard_compressed; |
999 | | |
1000 | | /********** End of Server Message Types **********/ |
1001 | | |
1002 | | static bool vnc_preference_desegment = true; |
1003 | | |
1004 | | /* Initialize the subtree pointers */ |
1005 | | static int ett_vnc; |
1006 | | static int ett_vnc_client_message_type; |
1007 | | static int ett_vnc_server_message_type; |
1008 | | static int ett_vnc_rect; |
1009 | | static int ett_vnc_encoding_type; |
1010 | | static int ett_vnc_rre_subrect; |
1011 | | static int ett_vnc_hextile_subencoding_mask; |
1012 | | static int ett_vnc_hextile_num_subrects; |
1013 | | static int ett_vnc_hextile_subrect; |
1014 | | static int ett_vnc_hextile_tile; |
1015 | | static int ett_vnc_zrle_subencoding; |
1016 | | static int ett_vnc_colormap_num_groups; |
1017 | | static int ett_vnc_colormap_color_group; |
1018 | | static int ett_vnc_desktop_screen; |
1019 | | static int ett_vnc_key_events; |
1020 | | static int ett_vnc_touch_events; |
1021 | | static int ett_vnc_slrle_subline; |
1022 | | static int ett_vnc_fence_flags; |
1023 | | static int ett_vnc_ext_clipboard_flags; |
1024 | | |
1025 | | static expert_field ei_vnc_possible_gtk_vnc_bug; |
1026 | | static expert_field ei_vnc_auth_code_mismatch; |
1027 | | static expert_field ei_vnc_unknown_tight_vnc_auth; |
1028 | | static expert_field ei_vnc_too_many_rectangles; |
1029 | | static expert_field ei_vnc_too_many_sub_rectangles; |
1030 | | static expert_field ei_vnc_invalid_encoding; |
1031 | | static expert_field ei_vnc_too_many_colors; |
1032 | | static expert_field ei_vnc_too_many_cut_text; |
1033 | | static expert_field ei_vnc_zrle_failed; |
1034 | | static expert_field ei_vnc_unknown_tight; |
1035 | | static expert_field ei_vnc_reassemble; |
1036 | | |
1037 | 14 | #define VNC_PORT_RANGE "5500-5501,5900-5901" |
1038 | | /* Port 5900 is IANA registered (under the service name "Remote Framebuffer"), |
1039 | | * the others are customary but not registered as mentioned in RFC 6143. |
1040 | | * (5900+N is commonly used in the case of multiple servers, analogous to |
1041 | | * X11.) */ |
1042 | | |
1043 | | static range_t *vnc_tcp_range; |
1044 | | static dissector_handle_t vnc_handle; |
1045 | | static dissector_handle_t tls_handle; |
1046 | | |
1047 | | /* Code to dissect the packets */ |
1048 | | static int |
1049 | | dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
1050 | 4 | { |
1051 | 4 | bool ret; |
1052 | 4 | int offset = 0; |
1053 | | |
1054 | | /* Set up structures needed to add the protocol subtree and manage it */ |
1055 | 4 | proto_item *ti; |
1056 | 4 | proto_tree *vnc_tree; |
1057 | | |
1058 | 4 | conversation_t *conversation; |
1059 | 4 | vnc_conversation_t *per_conversation_info; |
1060 | | |
1061 | 4 | conversation = find_or_create_conversation(pinfo); |
1062 | | |
1063 | | /* Retrieve information from conversation, or add it if it isn't |
1064 | | * there yet */ |
1065 | 4 | per_conversation_info = (vnc_conversation_t *)conversation_get_proto_data(conversation, proto_vnc); |
1066 | 4 | if(!per_conversation_info) { |
1067 | 3 | per_conversation_info = wmem_new(wmem_file_scope(), vnc_conversation_t); |
1068 | | |
1069 | 3 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SERVER_VERSION; |
1070 | 3 | per_conversation_info->security_type_selected = VNC_SECURITY_TYPE_INVALID; |
1071 | 3 | per_conversation_info->tight_enabled = false; |
1072 | 3 | per_conversation_info->preferred_encoding = VNC_ENCODING_TYPE_RAW; |
1073 | 3 | per_conversation_info->extended_clipboard_enabled = false; |
1074 | | /* Initial values for depth and bytes_per_pixel are set in |
1075 | | * in the mandatory VNC_SESSION_STATE_SERVER_INIT startup |
1076 | | * message. "This pixel format will be used unless the |
1077 | | * client requests a different format using the SetPixelFormat |
1078 | | * message" (RFC 6143 7.3.2 ServerInit) */ |
1079 | | |
1080 | 3 | conversation_add_proto_data(conversation, proto_vnc, per_conversation_info); |
1081 | 3 | } |
1082 | | |
1083 | | |
1084 | | /* Make entries in Protocol column and Info column on summary display */ |
1085 | 4 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "VNC"); |
1086 | | |
1087 | | /* First, clear the info column */ |
1088 | 4 | col_clear(pinfo->cinfo, COL_INFO); |
1089 | | |
1090 | | /* create display subtree for the protocol */ |
1091 | 4 | ti = proto_tree_add_item(tree, proto_vnc, tvb, 0, -1, ENC_NA); |
1092 | 4 | vnc_tree = proto_item_add_subtree(ti, ett_vnc); |
1093 | | |
1094 | | /* Dissect any remaining session startup messages */ |
1095 | 4 | ret = vnc_startup_messages(tvb, pinfo, offset, vnc_tree, |
1096 | 4 | per_conversation_info); |
1097 | | |
1098 | 4 | if (ret) { |
1099 | 4 | return tvb_captured_length(tvb); /* We're in a "startup" state; Cannot yet do "normal" processing */ |
1100 | 4 | } |
1101 | | |
1102 | 0 | if (per_conversation_info->security_type_selected == VNC_SECURITY_TYPE_VENCRYPT) { |
1103 | 0 | call_dissector_with_data(tls_handle, tvb, pinfo, vnc_tree, GUINT_TO_POINTER(offset)); |
1104 | 0 | return tvb_captured_length(tvb); |
1105 | 0 | } |
1106 | | |
1107 | 0 | if(value_is_in_range(vnc_tcp_range, pinfo->destport) || per_conversation_info->server_port == pinfo->destport) { |
1108 | 0 | vnc_client_to_server(tvb, pinfo, &offset, vnc_tree, per_conversation_info); |
1109 | 0 | } |
1110 | 0 | else { |
1111 | 0 | vnc_server_to_client(tvb, pinfo, &offset, vnc_tree); |
1112 | 0 | } |
1113 | 0 | return tvb_captured_length(tvb); |
1114 | 0 | } |
1115 | | |
1116 | | /* Returns the new offset after processing the 4-byte vendor string */ |
1117 | | static int |
1118 | | process_vendor(proto_tree *tree, packet_info* pinfo, int hfindex, tvbuff_t *tvb, int offset) |
1119 | 0 | { |
1120 | 0 | const char *vendor; |
1121 | 0 | proto_item *ti; |
1122 | |
|
1123 | 0 | if (tree) { |
1124 | 0 | ti = proto_tree_add_item_ret_string(tree, hfindex, tvb, offset, 4, ENC_ASCII|ENC_NA, pinfo->pool, (const uint8_t**)&vendor); |
1125 | |
|
1126 | 0 | if(g_ascii_strcasecmp(vendor, "STDV") == 0) |
1127 | 0 | proto_item_append_text(ti, " (Standard VNC vendor)"); |
1128 | 0 | else if(g_ascii_strcasecmp(vendor, "TRDV") == 0) |
1129 | 0 | proto_item_append_text(ti, " (Tridia VNC vendor)"); |
1130 | 0 | else if(g_ascii_strcasecmp(vendor, "TGHT") == 0) |
1131 | 0 | proto_item_append_text(ti, " (Tight VNC vendor)"); |
1132 | 0 | } |
1133 | |
|
1134 | 0 | offset += 4; |
1135 | 0 | return offset; |
1136 | 0 | } |
1137 | | |
1138 | | /* Returns the new offset after processing the specified number of capabilities */ |
1139 | | static int |
1140 | | process_tight_capabilities(proto_tree *tree, packet_info* pinfo, |
1141 | | int type_index, int vendor_index, int name_index, |
1142 | | tvbuff_t *tvb, int offset, const int num_capabilities) |
1143 | 0 | { |
1144 | 0 | int i; |
1145 | | /* See vnc_unixsrc/include/rfbproto.h:rfbCapabilityInfo */ |
1146 | |
|
1147 | 0 | for (i = 0; i < num_capabilities; i++) { |
1148 | |
|
1149 | 0 | proto_tree_add_item(tree, type_index, tvb, offset, 4, ENC_BIG_ENDIAN); |
1150 | 0 | offset += 4; |
1151 | |
|
1152 | 0 | offset = process_vendor(tree, pinfo, vendor_index, tvb, offset); |
1153 | |
|
1154 | 0 | proto_tree_add_item(tree, name_index, tvb, offset, 8, ENC_ASCII|ENC_NA); |
1155 | 0 | offset += 8; |
1156 | 0 | } |
1157 | |
|
1158 | 0 | return offset; |
1159 | 0 | } |
1160 | | |
1161 | | /* Returns true if this looks like a client or server version packet: 12 bytes, in the format "RFB xxx.yyy\n" . |
1162 | | * Will check for the 12 bytes exact length, the 'RFB ' string and that it ends with a '\n'. |
1163 | | * The exact 'xxx.yyy' is checked later, by trying to convert it to a double using g_ascii_strtod. |
1164 | | * pinfo and tree are NULL when using this function to check the heuristics for dissection. If we're |
1165 | | * checking the heuristics, we don't need to add expert_info, we just reject that packet as not |
1166 | | * being a VNC packet. |
1167 | | */ |
1168 | | static bool |
1169 | | vnc_is_client_or_server_version_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
1170 | 3.00k | { |
1171 | 3.00k | if(tvb_captured_length(tvb) != 12) { |
1172 | 2.93k | return false; |
1173 | 2.93k | } |
1174 | | |
1175 | 64 | if(tvb_strncaseeql(tvb, 0, "RFB ", 4) != 0) { |
1176 | 64 | return false; |
1177 | 64 | } |
1178 | | |
1179 | | /* 0x2e = '.' 0xa = '\n' */ |
1180 | 0 | if (tvb_get_uint8(tvb, 7) != 0x2e) { |
1181 | 0 | return false; |
1182 | 0 | } |
1183 | | |
1184 | 0 | if (tvb_get_uint8(tvb,11) != 0xa) { |
1185 | 0 | if (tvb_get_uint8(tvb,11) == 0) { |
1186 | | /* Per bug 5469, It appears that any VNC clients using gtk-vnc before [1] was |
1187 | | * fixed will exhibit the described protocol violation that prevents wireshark |
1188 | | * from dissecting the session. |
1189 | | * |
1190 | | * [1] http://git.gnome.org/browse/gtk-vnc/commit/?id=bc9e2b19167686dd381a0508af1a5113675d08a2 |
1191 | | */ |
1192 | 0 | if ((pinfo != NULL) && (tree != NULL)) { |
1193 | 0 | proto_tree_add_expert(tree, pinfo, &ei_vnc_possible_gtk_vnc_bug, tvb, -1, 0); |
1194 | 0 | } |
1195 | |
|
1196 | 0 | return true; |
1197 | 0 | } |
1198 | | |
1199 | 0 | return false; |
1200 | 0 | } |
1201 | | |
1202 | 0 | return true; |
1203 | 0 | } |
1204 | | |
1205 | | static bool test_vnc_protocol(tvbuff_t *tvb, packet_info *pinfo, |
1206 | | proto_tree *tree, void *data _U_) |
1207 | 2.99k | { |
1208 | 2.99k | conversation_t *conversation; |
1209 | | |
1210 | 2.99k | if (vnc_is_client_or_server_version_message(tvb, NULL, NULL)) { |
1211 | 0 | conversation = conversation_new(pinfo->num, &pinfo->src, |
1212 | 0 | &pinfo->dst, conversation_pt_to_conversation_type(pinfo->ptype), |
1213 | 0 | pinfo->srcport, |
1214 | 0 | pinfo->destport, 0); |
1215 | 0 | conversation_set_dissector(conversation, vnc_handle); |
1216 | 0 | dissect_vnc(tvb, pinfo, tree, data); |
1217 | 0 | return true; |
1218 | 0 | } |
1219 | 2.99k | return false; |
1220 | 2.99k | } |
1221 | | |
1222 | | /* Returns true if additional session startup messages follow */ |
1223 | | static bool |
1224 | | vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, int offset, |
1225 | | proto_tree *tree, vnc_conversation_t |
1226 | | *per_conversation_info) |
1227 | 4 | { |
1228 | 4 | uint8_t num_security_types; |
1229 | 4 | uint32_t desktop_name_len, auth_result, text_len, auth_code; |
1230 | 4 | vnc_packet_t *per_packet_info; |
1231 | 4 | int num_tunnel_types; |
1232 | 4 | int num_auth_types; |
1233 | 4 | proto_item* auth_item; |
1234 | 4 | int bytes_available; |
1235 | 4 | int bytes_needed = 0; |
1236 | | |
1237 | 4 | per_packet_info = (vnc_packet_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0); |
1238 | | |
1239 | 4 | if(!per_packet_info) { |
1240 | 4 | per_packet_info = wmem_new(wmem_file_scope(), vnc_packet_t); |
1241 | | |
1242 | 4 | per_packet_info->state = per_conversation_info->vnc_next_state; |
1243 | 4 | per_packet_info->bytes_per_pixel = per_conversation_info->bytes_per_pixel; |
1244 | 4 | per_packet_info->depth = per_conversation_info->depth; |
1245 | | |
1246 | 4 | p_add_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0, per_packet_info); |
1247 | 4 | } |
1248 | | |
1249 | 4 | bytes_available = tvb_reported_length_remaining(tvb, offset); |
1250 | | |
1251 | | /* Packet dissection follows */ |
1252 | 4 | switch(per_packet_info->state) { |
1253 | | |
1254 | 4 | case VNC_SESSION_STATE_SERVER_VERSION : |
1255 | 4 | if (!vnc_is_client_or_server_version_message(tvb, pinfo, tree)) |
1256 | 4 | return true; /* we still hope to get a SERVER_VERSION message some day. Do not proceed yet */ |
1257 | | |
1258 | 0 | proto_tree_add_item(tree, hf_vnc_server_proto_ver, tvb, 4, |
1259 | 0 | 7, ENC_ASCII); |
1260 | 0 | per_conversation_info->server_proto_ver = |
1261 | 0 | g_ascii_strtod((char *)tvb_get_string_enc(pinfo->pool, tvb, 4, 7, ENC_ASCII), NULL); |
1262 | 0 | per_conversation_info->server_port = pinfo->srcport; |
1263 | |
|
1264 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, |
1265 | 0 | "Server protocol version: %s", |
1266 | 0 | tvb_format_text(pinfo->pool, tvb, 4, 7)); |
1267 | |
|
1268 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_CLIENT_VERSION; |
1269 | 0 | break; |
1270 | | |
1271 | 0 | case VNC_SESSION_STATE_CLIENT_VERSION : |
1272 | 0 | if (!vnc_is_client_or_server_version_message(tvb, pinfo, tree)) |
1273 | 0 | return true; /* we still hope to get a CLIENT_VERSION message some day. Do not proceed yet */ |
1274 | | |
1275 | 0 | proto_tree_add_item(tree, hf_vnc_client_proto_ver, tvb, |
1276 | 0 | 4, 7, ENC_ASCII); |
1277 | 0 | per_conversation_info->client_proto_ver = |
1278 | 0 | g_ascii_strtod((char *)tvb_get_string_enc(pinfo->pool, tvb, 4, 7, ENC_ASCII), NULL); |
1279 | |
|
1280 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, |
1281 | 0 | "Client protocol version: %s", |
1282 | 0 | tvb_format_text(pinfo->pool, tvb, 4, 7)); |
1283 | |
|
1284 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SECURITY; |
1285 | 0 | break; |
1286 | | |
1287 | 0 | case VNC_SESSION_STATE_SECURITY : |
1288 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Security types supported"); |
1289 | | |
1290 | | /* We're checking against the client protocol version because |
1291 | | * the client is the final decider on which version to use |
1292 | | * after the server offers the highest version it supports. */ |
1293 | |
|
1294 | 0 | if(per_conversation_info->client_proto_ver >= 3.007) { |
1295 | 0 | num_security_types = tvb_get_uint8(tvb, offset); |
1296 | 0 | bytes_needed = 1 + num_security_types; |
1297 | 0 | if (bytes_available < bytes_needed && vnc_preference_desegment && pinfo->can_desegment) { |
1298 | 0 | pinfo->desegment_offset = offset; |
1299 | 0 | pinfo->desegment_len = bytes_needed - bytes_available; |
1300 | 0 | break; |
1301 | 0 | } |
1302 | | |
1303 | 0 | if (tree) { |
1304 | 0 | proto_tree_add_item(tree, |
1305 | 0 | hf_vnc_num_security_types, |
1306 | 0 | tvb, offset, 1, ENC_BIG_ENDIAN); |
1307 | |
|
1308 | 0 | for(offset = 1; offset <= num_security_types; offset++){ |
1309 | 0 | proto_tree_add_item(tree, |
1310 | 0 | hf_vnc_security_type, tvb, |
1311 | 0 | offset, 1, ENC_BIG_ENDIAN); |
1312 | 0 | } |
1313 | 0 | } |
1314 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SECURITY_TYPES; |
1315 | 0 | } else { |
1316 | | /* Version < 3.007: The server decides the |
1317 | | * authentication type for us to use */ |
1318 | 0 | proto_tree_add_item(tree, hf_vnc_server_security_type, |
1319 | 0 | tvb, offset, 4, ENC_BIG_ENDIAN); |
1320 | | /* The cast below is possible since in older versions of the protocol the only possible values are 0,1,2 */ |
1321 | 0 | per_conversation_info->security_type_selected = (uint8_t)tvb_get_ntohl(tvb, offset); |
1322 | 0 | switch(per_conversation_info->security_type_selected) { |
1323 | | |
1324 | 0 | case VNC_SECURITY_TYPE_INVALID: |
1325 | | /* TODO: In this case (INVALID) the connection has failed */ |
1326 | | /* and there should be an error string describing the error */ |
1327 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SECURITY_TYPES; |
1328 | 0 | break; |
1329 | | |
1330 | 0 | case VNC_SECURITY_TYPE_NONE: |
1331 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_CLIENT_INIT; |
1332 | 0 | break; |
1333 | | |
1334 | 0 | case VNC_SECURITY_TYPE_VNC: |
1335 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE; |
1336 | 0 | break; |
1337 | | |
1338 | 0 | case VNC_SECURITY_TYPE_ARD: |
1339 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_ARD_AUTHENTICATION_CHALLENGE; |
1340 | 0 | break; |
1341 | | |
1342 | 0 | default: |
1343 | | /* Security type not supported by this dissector */ |
1344 | 0 | break; |
1345 | 0 | } |
1346 | 0 | } |
1347 | | |
1348 | 0 | break; |
1349 | | |
1350 | 0 | case VNC_SESSION_STATE_SECURITY_TYPES : |
1351 | 0 | proto_tree_add_item(tree, hf_vnc_client_security_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
1352 | 0 | per_conversation_info->security_type_selected = |
1353 | 0 | tvb_get_uint8(tvb, offset); |
1354 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, "Security type %s (%d) selected by client", |
1355 | 0 | val_to_str_const(per_conversation_info->security_type_selected, vnc_security_types_vs, "Unknown"), |
1356 | 0 | per_conversation_info->security_type_selected); |
1357 | |
|
1358 | 0 | switch(per_conversation_info->security_type_selected) { |
1359 | | |
1360 | 0 | case VNC_SECURITY_TYPE_NONE : |
1361 | 0 | if(per_conversation_info->client_proto_ver >= 3.008) |
1362 | 0 | per_conversation_info->vnc_next_state = |
1363 | 0 | VNC_SESSION_STATE_SECURITY_RESULT; |
1364 | 0 | else |
1365 | 0 | per_conversation_info->vnc_next_state = |
1366 | 0 | VNC_SESSION_STATE_CLIENT_INIT; |
1367 | |
|
1368 | 0 | break; |
1369 | | |
1370 | 0 | case VNC_SECURITY_TYPE_VNC : |
1371 | 0 | per_conversation_info->vnc_next_state = |
1372 | 0 | VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE; |
1373 | 0 | break; |
1374 | | |
1375 | 0 | case VNC_SECURITY_TYPE_TIGHT : |
1376 | 0 | per_conversation_info->vnc_next_state = |
1377 | 0 | VNC_SESSION_STATE_TIGHT_TUNNELING_CAPABILITIES; |
1378 | 0 | per_conversation_info->tight_enabled = true; |
1379 | 0 | break; |
1380 | | |
1381 | 0 | case VNC_SECURITY_TYPE_ARD: |
1382 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_ARD_AUTHENTICATION_CHALLENGE; |
1383 | 0 | break; |
1384 | | |
1385 | 0 | case VNC_SECURITY_TYPE_VENCRYPT: |
1386 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_VENCRYPT_SERVER_VERSION; |
1387 | 0 | break; |
1388 | 0 | default : |
1389 | | /* Security type not supported by this dissector */ |
1390 | 0 | break; |
1391 | 0 | } |
1392 | | |
1393 | 0 | break; |
1394 | | |
1395 | 0 | case VNC_SESSION_STATE_TIGHT_TUNNELING_CAPABILITIES : |
1396 | 0 | { |
1397 | 0 | int i; |
1398 | |
|
1399 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "TightVNC tunneling capabilities supported"); |
1400 | |
|
1401 | 0 | proto_tree_add_item(tree, hf_vnc_tight_num_tunnel_types, tvb, offset, 4, ENC_BIG_ENDIAN); |
1402 | 0 | num_tunnel_types = tvb_get_ntohl(tvb, offset); |
1403 | |
|
1404 | 0 | offset += 4; |
1405 | |
|
1406 | 0 | for(i = 0; i < num_tunnel_types; i++) { |
1407 | | /* TightVNC and Xvnc don't support any tunnel capabilities yet, but each capability |
1408 | | * is 16 bytes, so skip them. |
1409 | | */ |
1410 | |
|
1411 | 0 | proto_tree_add_item(tree, hf_vnc_tight_tunnel_type_code, tvb, offset, 4, ENC_BIG_ENDIAN); |
1412 | 0 | proto_tree_add_item(tree, hf_vnc_tight_tunnel_type_vendor, tvb, offset + 4, 4, ENC_ASCII); |
1413 | 0 | proto_tree_add_item(tree, hf_vnc_tight_tunnel_type_signature, tvb, offset + 8, 8, ENC_ASCII); |
1414 | 0 | offset += 16; |
1415 | 0 | } |
1416 | |
|
1417 | 0 | if (num_tunnel_types == 0) |
1418 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_TIGHT_AUTH_CAPABILITIES; |
1419 | 0 | else |
1420 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_TIGHT_TUNNEL_TYPE_REPLY; |
1421 | 0 | break; |
1422 | 0 | } |
1423 | 0 | case VNC_SESSION_STATE_TIGHT_TUNNEL_TYPE_REPLY: |
1424 | | /* Neither TightVNC nor Xvnc implement this; they just have a placeholder that emits an error |
1425 | | * message and closes the connection (xserver/hw/vnc/auth.c:rfbProcessClientTunnelingType). |
1426 | | * We should actually never get here... |
1427 | | */ |
1428 | 0 | break; |
1429 | | |
1430 | 0 | case VNC_SESSION_STATE_TIGHT_AUTH_CAPABILITIES: |
1431 | 0 | { |
1432 | 0 | const char *vendor, *signature; |
1433 | |
|
1434 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "TightVNC authentication capabilities supported"); |
1435 | |
|
1436 | 0 | proto_tree_add_item(tree, hf_vnc_tight_num_auth_types, tvb, offset, 4, ENC_BIG_ENDIAN); |
1437 | 0 | num_auth_types = tvb_get_ntohl(tvb, offset); |
1438 | 0 | offset += 4; |
1439 | |
|
1440 | 0 | auth_code = tvb_get_ntohl(tvb, offset); |
1441 | 0 | auth_item = proto_tree_add_item(tree, hf_vnc_tight_auth_code, tvb, offset, 4, ENC_BIG_ENDIAN); |
1442 | 0 | offset += 4; |
1443 | 0 | vendor = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, 4, ENC_ASCII); |
1444 | 0 | process_vendor(tree, pinfo, hf_vnc_tight_server_vendor, tvb, offset); |
1445 | 0 | offset += 4; |
1446 | 0 | proto_tree_add_item_ret_string(tree, hf_vnc_tight_signature, tvb, offset, 8, ENC_ASCII|ENC_NA, pinfo->pool, (const uint8_t**)&signature); |
1447 | |
|
1448 | 0 | switch(auth_code) { |
1449 | 0 | case VNC_SECURITY_TYPE_NONE: |
1450 | 0 | if ((g_ascii_strcasecmp(vendor, "STDV") != 0) || (g_ascii_strcasecmp(signature, "NOAUTH__") != 0)) { |
1451 | 0 | expert_add_info(pinfo, auth_item, &ei_vnc_auth_code_mismatch); |
1452 | 0 | } |
1453 | 0 | break; |
1454 | 0 | case VNC_SECURITY_TYPE_VNC: |
1455 | 0 | if ((g_ascii_strcasecmp(vendor, "STDV") != 0) || (g_ascii_strcasecmp(signature, "VNCAUTH_") != 0)) { |
1456 | 0 | expert_add_info(pinfo, auth_item, &ei_vnc_auth_code_mismatch); |
1457 | 0 | } |
1458 | 0 | break; |
1459 | 0 | case VNC_SECURITY_TYPE_VENCRYPT: |
1460 | 0 | if ((g_ascii_strcasecmp(vendor, "VENC") != 0) || (g_ascii_strcasecmp(signature, "VENCRYPT") != 0)) { |
1461 | 0 | expert_add_info(pinfo, auth_item, &ei_vnc_auth_code_mismatch); |
1462 | 0 | } |
1463 | 0 | break; |
1464 | 0 | case VNC_SECURITY_TYPE_GTK_VNC_SASL: |
1465 | 0 | if ((g_ascii_strcasecmp(vendor, "GTKV") != 0) || (g_ascii_strcasecmp(signature, "SASL____") != 0)) { |
1466 | 0 | expert_add_info(pinfo, auth_item, &ei_vnc_auth_code_mismatch); |
1467 | 0 | } |
1468 | 0 | break; |
1469 | 0 | case VNC_TIGHT_AUTH_TGHT_ULGNAUTH: |
1470 | 0 | if ((g_ascii_strcasecmp(vendor, "TGHT") != 0) || (g_ascii_strcasecmp(signature, "ULGNAUTH") != 0)) { |
1471 | 0 | expert_add_info(pinfo, auth_item, &ei_vnc_auth_code_mismatch); |
1472 | 0 | } |
1473 | 0 | break; |
1474 | 0 | case VNC_TIGHT_AUTH_TGHT_XTRNAUTH: |
1475 | 0 | if ((g_ascii_strcasecmp(vendor, "TGHT") != 0) || (g_ascii_strcasecmp(signature, "XTRNAUTH") != 0)) { |
1476 | 0 | expert_add_info(pinfo, auth_item, &ei_vnc_auth_code_mismatch); |
1477 | 0 | } |
1478 | 0 | break; |
1479 | 0 | default: |
1480 | 0 | expert_add_info(pinfo, auth_item, &ei_vnc_unknown_tight_vnc_auth); |
1481 | 0 | break; |
1482 | 0 | } |
1483 | | |
1484 | 0 | if (num_auth_types == 0) |
1485 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_CLIENT_INIT; |
1486 | 0 | else |
1487 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_TIGHT_AUTH_TYPE_REPLY; |
1488 | 0 | break; |
1489 | 0 | } |
1490 | 0 | case VNC_SESSION_STATE_TIGHT_AUTH_TYPE_REPLY: |
1491 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "TightVNC authentication type selected by client"); |
1492 | 0 | auth_code = tvb_get_ntohl(tvb, offset); |
1493 | 0 | auth_item = proto_tree_add_item(tree, hf_vnc_tight_auth_code, tvb, offset, 4, ENC_BIG_ENDIAN); |
1494 | |
|
1495 | 0 | switch(auth_code) { |
1496 | 0 | case VNC_SECURITY_TYPE_NONE: |
1497 | 0 | per_conversation_info->security_type_selected = VNC_SECURITY_TYPE_NONE; |
1498 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_CLIENT_INIT; |
1499 | 0 | break; |
1500 | 0 | case VNC_SECURITY_TYPE_VNC: |
1501 | 0 | per_conversation_info->security_type_selected = VNC_SECURITY_TYPE_VNC; |
1502 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE; |
1503 | 0 | break; |
1504 | 0 | case VNC_SECURITY_TYPE_GTK_VNC_SASL: |
1505 | 0 | per_conversation_info->security_type_selected = VNC_SECURITY_TYPE_GTK_VNC_SASL; |
1506 | | /* TODO: dissection not implemented yet */ |
1507 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3; |
1508 | 0 | break; |
1509 | 0 | case VNC_TIGHT_AUTH_TGHT_ULGNAUTH: |
1510 | 0 | per_conversation_info->security_type_selected = VNC_TIGHT_AUTH_TGHT_ULGNAUTH; |
1511 | | /* TODO: dissection not implemented yet */ |
1512 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3; |
1513 | 0 | break; |
1514 | 0 | case VNC_TIGHT_AUTH_TGHT_XTRNAUTH: |
1515 | 0 | per_conversation_info->security_type_selected = VNC_TIGHT_AUTH_TGHT_XTRNAUTH; |
1516 | | /* TODO: dissection not implemented yet */ |
1517 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3; |
1518 | 0 | break; |
1519 | 0 | default: |
1520 | 0 | expert_add_info(pinfo, auth_item, &ei_vnc_unknown_tight_vnc_auth); |
1521 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3; |
1522 | 0 | break; |
1523 | 0 | } |
1524 | | |
1525 | 0 | break; |
1526 | | |
1527 | 0 | case VNC_SESSION_STATE_TIGHT_UNKNOWN_PACKET3 : |
1528 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Unknown packet (TightVNC)"); |
1529 | |
|
1530 | 0 | proto_tree_add_expert(tree, pinfo, &ei_vnc_unknown_tight, tvb, offset, -1); |
1531 | |
|
1532 | 0 | per_conversation_info->vnc_next_state = |
1533 | 0 | VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE; |
1534 | |
|
1535 | 0 | break; |
1536 | | |
1537 | 0 | case VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE : |
1538 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Authentication challenge from server"); |
1539 | |
|
1540 | 0 | proto_tree_add_item(tree, hf_vnc_auth_challenge, tvb, |
1541 | 0 | offset, 16, ENC_NA); |
1542 | |
|
1543 | 0 | per_conversation_info->vnc_next_state = |
1544 | 0 | VNC_SESSION_STATE_VNC_AUTHENTICATION_RESPONSE; |
1545 | 0 | break; |
1546 | | |
1547 | 0 | case VNC_SESSION_STATE_VNC_AUTHENTICATION_RESPONSE : |
1548 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Authentication response from client"); |
1549 | |
|
1550 | 0 | proto_tree_add_item(tree, hf_vnc_auth_response, tvb, |
1551 | 0 | offset, 16, ENC_NA); |
1552 | |
|
1553 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SECURITY_RESULT; |
1554 | 0 | break; |
1555 | | |
1556 | 0 | case VNC_SESSION_STATE_ARD_AUTHENTICATION_CHALLENGE : |
1557 | 0 | { |
1558 | 0 | int key_len; |
1559 | |
|
1560 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "ARD authentication challenge"); |
1561 | |
|
1562 | 0 | proto_tree_add_item(tree, hf_vnc_ard_auth_generator, tvb, |
1563 | 0 | offset, 2, ENC_BIG_ENDIAN); |
1564 | 0 | proto_tree_add_item(tree, hf_vnc_ard_auth_key_len, tvb, |
1565 | 0 | offset + 2, 2, ENC_BIG_ENDIAN); |
1566 | |
|
1567 | 0 | key_len = tvb_get_ntohs(tvb, offset + 2); |
1568 | |
|
1569 | 0 | offset += 4; |
1570 | |
|
1571 | 0 | proto_tree_add_item(tree, hf_vnc_ard_auth_modulus, tvb, |
1572 | 0 | offset, key_len, ENC_NA); |
1573 | 0 | proto_tree_add_item(tree, hf_vnc_ard_auth_server_key, tvb, |
1574 | 0 | offset + key_len, key_len, ENC_NA); |
1575 | |
|
1576 | 0 | per_conversation_info->ard_key_length = key_len; |
1577 | 0 | per_conversation_info->vnc_next_state = |
1578 | 0 | VNC_SESSION_STATE_ARD_AUTHENTICATION_RESPONSE; |
1579 | 0 | } |
1580 | 0 | break; |
1581 | | |
1582 | 0 | case VNC_SESSION_STATE_ARD_AUTHENTICATION_RESPONSE : |
1583 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "ARD authentication response"); |
1584 | |
|
1585 | 0 | proto_tree_add_item(tree, hf_vnc_ard_auth_credentials, tvb, |
1586 | 0 | offset, 128, ENC_NA); |
1587 | 0 | proto_tree_add_item(tree, hf_vnc_ard_auth_client_key, tvb, |
1588 | 0 | offset + 128, per_conversation_info->ard_key_length, ENC_NA); |
1589 | |
|
1590 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SECURITY_RESULT; |
1591 | 0 | break; |
1592 | | |
1593 | 0 | case VNC_SESSION_STATE_SECURITY_RESULT : |
1594 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Authentication result"); |
1595 | |
|
1596 | 0 | proto_tree_add_item(tree, hf_vnc_auth_result, tvb, offset, |
1597 | 0 | 4, ENC_BIG_ENDIAN); |
1598 | 0 | auth_result = tvb_get_ntohl(tvb, offset); |
1599 | 0 | offset += 4; |
1600 | |
|
1601 | 0 | switch(auth_result) { |
1602 | | |
1603 | 0 | case 0 : /* OK */ |
1604 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_CLIENT_INIT; |
1605 | 0 | break; |
1606 | | |
1607 | 0 | case 1 : /* Failed */ |
1608 | 0 | if(per_conversation_info->client_proto_ver >= 3.008) { |
1609 | 0 | text_len = tvb_get_ntohl(tvb, offset); |
1610 | 0 | proto_tree_add_item(tree, hf_vnc_auth_error_length, tvb, offset, 4, ENC_BIG_ENDIAN); |
1611 | 0 | offset += 4; |
1612 | |
|
1613 | 0 | proto_tree_add_item(tree, hf_vnc_auth_error, tvb, |
1614 | 0 | offset, text_len, ENC_ASCII); |
1615 | 0 | } |
1616 | |
|
1617 | 0 | return true; /* All versions: Do not continue |
1618 | | processing VNC packets as connection |
1619 | | will be closed after this packet. */ |
1620 | | |
1621 | 0 | break; |
1622 | 0 | } |
1623 | | |
1624 | 0 | break; |
1625 | 0 | case VNC_SESSION_STATE_VENCRYPT_SERVER_VERSION: |
1626 | 0 | { |
1627 | 0 | bytes_needed = 2; |
1628 | 0 | if (bytes_available < bytes_needed && vnc_preference_desegment && pinfo->can_desegment) { |
1629 | 0 | pinfo->desegment_offset = offset; |
1630 | 0 | pinfo->desegment_len = bytes_needed - bytes_available; |
1631 | 0 | break; |
1632 | 0 | } |
1633 | 0 | proto_tree_add_item(tree, hf_vnc_vencrypt_server_major_ver, tvb, offset, 1, ENC_BIG_ENDIAN); |
1634 | 0 | int major = tvb_get_uint8(tvb, offset++); |
1635 | 0 | proto_tree_add_item(tree, hf_vnc_vencrypt_server_minor_ver, tvb, offset, 1, ENC_BIG_ENDIAN); |
1636 | 0 | int minor = tvb_get_uint8(tvb, offset++); |
1637 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, "VeNCrypt server version %d.%d", major, minor); |
1638 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_VENCRYPT_CLIENT_VERSION; |
1639 | 0 | break; |
1640 | 0 | } |
1641 | 0 | case VNC_SESSION_STATE_VENCRYPT_CLIENT_VERSION: |
1642 | 0 | { |
1643 | 0 | bytes_needed = 2; |
1644 | 0 | if (bytes_available < bytes_needed && vnc_preference_desegment && pinfo->can_desegment) { |
1645 | 0 | pinfo->desegment_offset = offset; |
1646 | 0 | pinfo->desegment_len = bytes_needed - bytes_available; |
1647 | 0 | break; |
1648 | 0 | } |
1649 | 0 | proto_tree_add_item(tree, hf_vnc_vencrypt_client_major_ver, tvb, offset, 1, ENC_BIG_ENDIAN); |
1650 | 0 | int major = tvb_get_uint8(tvb, offset++); |
1651 | 0 | proto_tree_add_item(tree, hf_vnc_vencrypt_client_minor_ver, tvb, offset, 1, ENC_BIG_ENDIAN); |
1652 | 0 | int minor = tvb_get_uint8(tvb, offset++); |
1653 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, "VeNCrypt client version %d.%d", major, minor); |
1654 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_VENCRYPT_AUTH_CAPABILITIES; |
1655 | 0 | break; |
1656 | 0 | } |
1657 | 0 | case VNC_SESSION_STATE_VENCRYPT_AUTH_CAPABILITIES: |
1658 | 0 | { |
1659 | 0 | int i; |
1660 | 0 | bytes_needed = 2; |
1661 | 0 | if (bytes_available < bytes_needed && vnc_preference_desegment && pinfo->can_desegment) { |
1662 | 0 | pinfo->desegment_offset = offset; |
1663 | 0 | pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; |
1664 | 0 | break; |
1665 | 0 | } |
1666 | 0 | num_auth_types = tvb_get_uint8(tvb, offset + 1); |
1667 | 0 | bytes_needed = 2 + 4 * num_auth_types; |
1668 | 0 | if (bytes_available < bytes_needed && vnc_preference_desegment && pinfo->can_desegment) { |
1669 | 0 | pinfo->desegment_offset = offset; |
1670 | 0 | pinfo->desegment_len = bytes_needed - bytes_available; |
1671 | 0 | break; |
1672 | 0 | } |
1673 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "VeNCrypt authentication types supported"); |
1674 | 0 | proto_tree_add_item(tree, hf_vnc_vencrypt_version_ack, tvb, offset, 1, ENC_BIG_ENDIAN); |
1675 | 0 | offset += 1; |
1676 | 0 | proto_tree_add_item(tree, hf_vnc_vencrypt_num_auth_types, tvb, offset, 1, ENC_BIG_ENDIAN); |
1677 | 0 | offset += 1; |
1678 | |
|
1679 | 0 | for(i = 0; i < num_auth_types; i++) { |
1680 | 0 | proto_tree_add_item(tree, hf_vnc_vencrypt_auth_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
1681 | 0 | offset += 4; |
1682 | 0 | } |
1683 | |
|
1684 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_VENCRYPT_AUTH_TYPE_REPLY; |
1685 | 0 | break; |
1686 | 0 | } |
1687 | 0 | case VNC_SESSION_STATE_VENCRYPT_AUTH_TYPE_REPLY: |
1688 | 0 | { |
1689 | 0 | bytes_needed = 4; |
1690 | 0 | if (bytes_available < bytes_needed && vnc_preference_desegment && pinfo->can_desegment) { |
1691 | 0 | pinfo->desegment_offset = offset; |
1692 | 0 | pinfo->desegment_len = bytes_needed - bytes_available; |
1693 | 0 | break; |
1694 | 0 | } |
1695 | 0 | uint32_t authtype = tvb_get_ntohl(tvb, offset); |
1696 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, "VeNCrypt authentication type %s (%d) selected by client", |
1697 | 0 | val_to_str_const(authtype, vnc_vencrypt_auth_types_vs, "Unknown"), |
1698 | 0 | authtype); |
1699 | 0 | proto_tree_add_item(tree, hf_vnc_vencrypt_auth_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
1700 | | /* offset+=4; */ |
1701 | 0 | if (authtype == VNC_SECURITY_TYPE_NONE) { |
1702 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_CLIENT_INIT; |
1703 | 0 | per_conversation_info->security_type_selected = VNC_SECURITY_TYPE_NONE; |
1704 | 0 | } else if (authtype == VNC_SECURITY_TYPE_VNC) { |
1705 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_VNC_AUTHENTICATION_CHALLENGE; |
1706 | 0 | per_conversation_info->security_type_selected = VNC_SECURITY_TYPE_VNC; |
1707 | 0 | } else { |
1708 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_VENCRYPT_AUTH_ACK; |
1709 | 0 | } |
1710 | 0 | break; |
1711 | 0 | } |
1712 | 0 | case VNC_SESSION_STATE_VENCRYPT_AUTH_ACK: |
1713 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "VeNCrypt server ack"); |
1714 | 0 | proto_tree_add_item(tree, hf_vnc_vencrypt_auth_type_ack, tvb, offset, 1, ENC_BIG_ENDIAN); |
1715 | 0 | tls_handle = find_dissector("tls"); |
1716 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_NORMAL_TRAFFIC; |
1717 | 0 | break; |
1718 | | |
1719 | 0 | case VNC_SESSION_STATE_CLIENT_INIT : |
1720 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Share desktop flag"); |
1721 | |
|
1722 | 0 | proto_tree_add_item(tree, hf_vnc_share_desktop_flag, tvb, |
1723 | 0 | offset, 1, ENC_BIG_ENDIAN); |
1724 | |
|
1725 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SERVER_INIT; |
1726 | |
|
1727 | 0 | break; |
1728 | | |
1729 | 0 | case VNC_SESSION_STATE_SERVER_INIT : |
1730 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Server framebuffer parameters"); |
1731 | |
|
1732 | 0 | proto_tree_add_item(tree, hf_vnc_width, tvb, offset, 2, |
1733 | 0 | ENC_BIG_ENDIAN); |
1734 | 0 | offset += 2; |
1735 | |
|
1736 | 0 | proto_tree_add_item(tree, hf_vnc_height, tvb, offset, 2, |
1737 | 0 | ENC_BIG_ENDIAN); |
1738 | 0 | offset += 2; |
1739 | |
|
1740 | 0 | proto_tree_add_item(tree, hf_vnc_server_bits_per_pixel, |
1741 | 0 | tvb, offset, 1, ENC_BIG_ENDIAN); |
1742 | 0 | vnc_set_bytes_per_pixel(pinfo, per_conversation_info, tvb_get_uint8(tvb, offset) / 8); |
1743 | 0 | offset += 1; |
1744 | |
|
1745 | 0 | proto_tree_add_item(tree, hf_vnc_server_depth, tvb, offset, |
1746 | 0 | 1, ENC_BIG_ENDIAN); |
1747 | 0 | vnc_set_depth(pinfo, per_conversation_info, tvb_get_uint8(tvb, offset)); |
1748 | 0 | offset += 1; |
1749 | |
|
1750 | 0 | proto_tree_add_item(tree, hf_vnc_server_big_endian_flag, |
1751 | 0 | tvb, offset, 1, ENC_BIG_ENDIAN); |
1752 | 0 | offset += 1; |
1753 | |
|
1754 | 0 | proto_tree_add_item(tree, hf_vnc_server_true_color_flag, |
1755 | 0 | tvb, offset, 1, ENC_BIG_ENDIAN); |
1756 | 0 | offset += 1; |
1757 | |
|
1758 | 0 | proto_tree_add_item(tree, hf_vnc_server_red_max, |
1759 | 0 | tvb, offset, 2, ENC_BIG_ENDIAN); |
1760 | 0 | offset += 2; |
1761 | |
|
1762 | 0 | proto_tree_add_item(tree, hf_vnc_server_green_max, |
1763 | 0 | tvb, offset, 2, ENC_BIG_ENDIAN); |
1764 | 0 | offset += 2; |
1765 | |
|
1766 | 0 | proto_tree_add_item(tree, hf_vnc_server_blue_max, |
1767 | 0 | tvb, offset, 2, ENC_BIG_ENDIAN); |
1768 | 0 | offset += 2; |
1769 | |
|
1770 | 0 | proto_tree_add_item(tree, hf_vnc_server_red_shift, |
1771 | 0 | tvb, offset, 1, ENC_BIG_ENDIAN); |
1772 | 0 | offset += 1; |
1773 | |
|
1774 | 0 | proto_tree_add_item(tree, hf_vnc_server_green_shift, |
1775 | 0 | tvb, offset, 1, ENC_BIG_ENDIAN); |
1776 | 0 | offset += 1; |
1777 | |
|
1778 | 0 | proto_tree_add_item(tree, hf_vnc_server_blue_shift, |
1779 | 0 | tvb, offset, 1, ENC_BIG_ENDIAN); |
1780 | 0 | offset += 1; |
1781 | |
|
1782 | 0 | proto_tree_add_item(tree, hf_vnc_padding, |
1783 | 0 | tvb, offset, 3, ENC_NA); |
1784 | 0 | offset += 3; /* Skip over 3 bytes of padding */ |
1785 | |
|
1786 | 0 | if(tvb_reported_length_remaining(tvb, offset) > 4) { |
1787 | | /* Sometimes the desktop name & length is skipped */ |
1788 | 0 | proto_tree_add_item(tree, hf_vnc_desktop_name_len, |
1789 | 0 | tvb, offset, 4, ENC_BIG_ENDIAN); |
1790 | 0 | desktop_name_len = tvb_get_ntohl(tvb, offset); |
1791 | 0 | offset += 4; |
1792 | |
|
1793 | 0 | proto_tree_add_item(tree, hf_vnc_desktop_name, |
1794 | 0 | tvb, offset, desktop_name_len, |
1795 | 0 | ENC_ASCII); |
1796 | 0 | } |
1797 | |
|
1798 | 0 | if(per_conversation_info->tight_enabled == true) |
1799 | 0 | per_conversation_info->vnc_next_state = |
1800 | 0 | VNC_SESSION_STATE_TIGHT_INTERACTION_CAPS; |
1801 | 0 | else |
1802 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_NORMAL_TRAFFIC; |
1803 | 0 | break; |
1804 | | |
1805 | 0 | case VNC_SESSION_STATE_TIGHT_INTERACTION_CAPS : |
1806 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "TightVNC Interaction Capabilities"); |
1807 | |
|
1808 | 0 | proto_tree_add_item(tree, hf_vnc_num_server_message_types, |
1809 | 0 | tvb, offset, 2, ENC_BIG_ENDIAN); |
1810 | 0 | per_conversation_info->num_server_message_types = tvb_get_ntohs(tvb, offset); |
1811 | 0 | offset += 2; |
1812 | |
|
1813 | 0 | proto_tree_add_item(tree, hf_vnc_num_client_message_types, |
1814 | 0 | tvb, offset, 2, ENC_BIG_ENDIAN); |
1815 | 0 | per_conversation_info->num_client_message_types = tvb_get_ntohs(tvb, offset); |
1816 | 0 | offset += 2; |
1817 | |
|
1818 | 0 | proto_tree_add_item(tree, hf_vnc_num_encoding_types, |
1819 | 0 | tvb, offset, 2, ENC_BIG_ENDIAN); |
1820 | 0 | per_conversation_info->num_encoding_types = tvb_get_ntohs(tvb, offset); |
1821 | 0 | offset += 2; |
1822 | |
|
1823 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, offset, 2, ENC_NA); |
1824 | 0 | offset += 2; |
1825 | |
|
1826 | 0 | offset = process_tight_capabilities(tree, pinfo, |
1827 | 0 | hf_vnc_tight_server_message_type, |
1828 | 0 | hf_vnc_tight_server_vendor, |
1829 | 0 | hf_vnc_tight_server_name, |
1830 | 0 | tvb, offset, per_conversation_info->num_server_message_types); |
1831 | 0 | offset = process_tight_capabilities(tree, pinfo, |
1832 | 0 | hf_vnc_tight_client_message_type, |
1833 | 0 | hf_vnc_tight_client_vendor, |
1834 | 0 | hf_vnc_tight_client_name, |
1835 | 0 | tvb, offset, per_conversation_info->num_client_message_types); |
1836 | 0 | process_tight_capabilities(tree, pinfo, |
1837 | 0 | hf_vnc_tight_encoding_type, |
1838 | 0 | hf_vnc_tight_encoding_vendor, |
1839 | 0 | hf_vnc_tight_encoding_name, |
1840 | 0 | tvb, offset, per_conversation_info->num_encoding_types); |
1841 | |
|
1842 | 0 | per_conversation_info->vnc_next_state = VNC_SESSION_STATE_NORMAL_TRAFFIC; |
1843 | 0 | break; |
1844 | | |
1845 | 0 | case VNC_SESSION_STATE_NORMAL_TRAFFIC : |
1846 | 0 | return false; |
1847 | 4 | } |
1848 | | |
1849 | 0 | return true; |
1850 | 4 | } |
1851 | | |
1852 | | |
1853 | | static void |
1854 | | vnc_client_to_server(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
1855 | | proto_tree *tree, |
1856 | | vnc_conversation_t *per_conversation_info) |
1857 | 0 | { |
1858 | 0 | uint8_t message_type; |
1859 | 0 | int bytes_needed = 0; |
1860 | 0 | int bytes_available; |
1861 | 0 | proto_item *ti; |
1862 | 0 | proto_tree *vnc_client_message_type_tree; |
1863 | |
|
1864 | 0 | message_type = tvb_get_uint8(tvb, *offset); |
1865 | |
|
1866 | 0 | ti = proto_tree_add_item(tree, hf_vnc_client_message_type, tvb, |
1867 | 0 | *offset, 1, ENC_BIG_ENDIAN); |
1868 | |
|
1869 | 0 | vnc_client_message_type_tree = |
1870 | 0 | proto_item_add_subtree(ti, ett_vnc_client_message_type); |
1871 | |
|
1872 | 0 | *offset += 1; |
1873 | |
|
1874 | 0 | switch(message_type) { |
1875 | | |
1876 | 0 | case VNC_CLIENT_MESSAGE_TYPE_SET_PIXEL_FORMAT : |
1877 | 0 | vnc_client_set_pixel_format(tvb, pinfo, offset, |
1878 | 0 | vnc_client_message_type_tree, |
1879 | 0 | per_conversation_info); |
1880 | 0 | break; |
1881 | | |
1882 | 0 | case VNC_CLIENT_MESSAGE_TYPE_SET_ENCODINGS : |
1883 | 0 | vnc_client_set_encodings(tvb, pinfo, offset, |
1884 | 0 | vnc_client_message_type_tree, |
1885 | 0 | per_conversation_info); |
1886 | 0 | break; |
1887 | | |
1888 | 0 | case VNC_CLIENT_MESSAGE_TYPE_FRAMEBUF_UPDATE_REQ : |
1889 | 0 | vnc_client_framebuffer_update_request(tvb, pinfo, offset, |
1890 | 0 | vnc_client_message_type_tree); |
1891 | 0 | break; |
1892 | | |
1893 | 0 | case VNC_CLIENT_MESSAGE_TYPE_KEY_EVENT : |
1894 | 0 | vnc_client_key_event(tvb, pinfo, offset, |
1895 | 0 | vnc_client_message_type_tree); |
1896 | 0 | break; |
1897 | | |
1898 | 0 | case VNC_CLIENT_MESSAGE_TYPE_POINTER_EVENT: |
1899 | 0 | vnc_client_pointer_event(tvb, pinfo, offset, |
1900 | 0 | vnc_client_message_type_tree); |
1901 | 0 | break; |
1902 | | |
1903 | 0 | case VNC_CLIENT_MESSAGE_TYPE_CLIENT_CUT_TEXT : |
1904 | 0 | bytes_available = tvb_reported_length_remaining(tvb, *offset); |
1905 | 0 | if(per_conversation_info->extended_clipboard_enabled) { |
1906 | 0 | bytes_needed = vnc_client_cut_text_extended(tvb, pinfo, offset, |
1907 | 0 | vnc_client_message_type_tree); |
1908 | 0 | } else { |
1909 | 0 | bytes_needed = vnc_client_cut_text(tvb, pinfo, offset, |
1910 | 0 | vnc_client_message_type_tree); |
1911 | 0 | } |
1912 | 0 | if (bytes_available < bytes_needed && vnc_preference_desegment && pinfo->can_desegment) { |
1913 | 0 | pinfo->desegment_offset = *offset; |
1914 | 0 | pinfo->desegment_len = bytes_needed - bytes_available; |
1915 | 0 | break; |
1916 | 0 | } |
1917 | 0 | break; |
1918 | | |
1919 | 0 | case VNC_CLIENT_MESSAGE_TYPE_MIRRORLINK : |
1920 | 0 | vnc_mirrorlink(tvb, pinfo, offset, |
1921 | 0 | vnc_client_message_type_tree); |
1922 | 0 | break; |
1923 | | |
1924 | 0 | case VNC_CLIENT_MESSAGE_TYPE_ENABLE_CONTINUOUS_UPDATES : |
1925 | 0 | col_append_sep_str(pinfo->cinfo, COL_INFO, "; ", "Client Enable Continuous Updates"); |
1926 | 0 | *offset += 9; |
1927 | 0 | break; |
1928 | | |
1929 | 0 | case VNC_CLIENT_MESSAGE_TYPE_FENCE : |
1930 | 0 | vnc_fence(tvb, pinfo, offset, |
1931 | 0 | vnc_client_message_type_tree); |
1932 | 0 | break; |
1933 | | |
1934 | 0 | case VNC_CLIENT_MESSAGE_TYPE_QEMU : |
1935 | 0 | vnc_qemu(tvb, pinfo, offset, |
1936 | 0 | vnc_client_message_type_tree); |
1937 | 0 | break; |
1938 | | |
1939 | 0 | default : |
1940 | 0 | col_append_sep_fstr(pinfo->cinfo, COL_INFO, "; ", |
1941 | 0 | "Unknown client message type (%u)", |
1942 | 0 | message_type); |
1943 | 0 | break; |
1944 | 0 | } |
1945 | 0 | } |
1946 | | |
1947 | | static void |
1948 | | vnc_server_to_client(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
1949 | | proto_tree *tree) |
1950 | 0 | { |
1951 | 0 | int start_offset; |
1952 | 0 | uint8_t message_type; |
1953 | 0 | int bytes_needed = 0; |
1954 | |
|
1955 | 0 | proto_item *ti; |
1956 | 0 | proto_tree *vnc_server_message_type_tree; |
1957 | |
|
1958 | 0 | again: |
1959 | 0 | start_offset = *offset; |
1960 | |
|
1961 | 0 | message_type = tvb_get_uint8(tvb, *offset); |
1962 | |
|
1963 | 0 | ti = proto_tree_add_item(tree, hf_vnc_server_message_type, tvb, |
1964 | 0 | *offset, 1, ENC_BIG_ENDIAN); |
1965 | 0 | vnc_server_message_type_tree = |
1966 | 0 | proto_item_add_subtree(ti, ett_vnc_server_message_type); |
1967 | |
|
1968 | 0 | *offset += 1; |
1969 | |
|
1970 | 0 | switch(message_type) { |
1971 | | |
1972 | 0 | case VNC_SERVER_MESSAGE_TYPE_FRAMEBUFFER_UPDATE : |
1973 | 0 | bytes_needed = |
1974 | 0 | vnc_server_framebuffer_update(tvb, pinfo, offset, |
1975 | 0 | vnc_server_message_type_tree); |
1976 | 0 | break; |
1977 | | |
1978 | 0 | case VNC_SERVER_MESSAGE_TYPE_SET_COLORMAP_ENTRIES : |
1979 | 0 | bytes_needed = vnc_server_set_colormap_entries(tvb, pinfo, offset, vnc_server_message_type_tree); |
1980 | 0 | break; |
1981 | | |
1982 | 0 | case VNC_SERVER_MESSAGE_TYPE_RING_BELL : |
1983 | 0 | vnc_server_ring_bell(tvb, pinfo, offset, |
1984 | 0 | vnc_server_message_type_tree); |
1985 | 0 | break; |
1986 | | |
1987 | 0 | case VNC_SERVER_MESSAGE_TYPE_CUT_TEXT : |
1988 | 0 | bytes_needed = vnc_server_cut_text(tvb, pinfo, offset, |
1989 | 0 | vnc_server_message_type_tree); |
1990 | 0 | break; |
1991 | | |
1992 | 0 | case VNC_SERVER_MESSAGE_TYPE_MIRRORLINK : |
1993 | 0 | bytes_needed = vnc_mirrorlink(tvb, pinfo, offset, |
1994 | 0 | vnc_server_message_type_tree); |
1995 | 0 | break; |
1996 | | |
1997 | 0 | case VNC_SERVER_MESSAGE_TYPE_END_CONTINUOUS_UPDATES : |
1998 | 0 | col_append_sep_str(pinfo->cinfo, COL_INFO, "; ", "Server End Continuous Updates"); |
1999 | 0 | *offset += 1; |
2000 | 0 | break; |
2001 | | |
2002 | 0 | case VNC_SERVER_MESSAGE_TYPE_FENCE : |
2003 | 0 | bytes_needed = vnc_fence(tvb, pinfo, offset, |
2004 | 0 | vnc_server_message_type_tree); |
2005 | 0 | break; |
2006 | | |
2007 | 0 | default : |
2008 | 0 | col_append_sep_str(pinfo->cinfo, COL_INFO, "; ", |
2009 | 0 | "Unknown server message type"); |
2010 | 0 | *offset = tvb_reported_length(tvb); /* Swallow the rest of the segment */ |
2011 | 0 | break; |
2012 | 0 | } |
2013 | | |
2014 | 0 | if(bytes_needed > 0 && vnc_preference_desegment && pinfo->can_desegment) { |
2015 | 0 | proto_tree_add_expert(vnc_server_message_type_tree, pinfo, &ei_vnc_reassemble, tvb, start_offset, -1); |
2016 | 0 | pinfo->desegment_offset = start_offset; |
2017 | 0 | pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; |
2018 | 0 | return; |
2019 | 0 | } |
2020 | | |
2021 | 0 | if ((unsigned)*offset < tvb_reported_length(tvb)) { |
2022 | 0 | goto again; |
2023 | 0 | } |
2024 | 0 | } |
2025 | | |
2026 | | |
2027 | | static void |
2028 | | vnc_client_set_pixel_format(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2029 | | proto_tree *tree, |
2030 | | vnc_conversation_t *per_conversation_info) |
2031 | 0 | { |
2032 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Client set pixel format"); |
2033 | |
|
2034 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 3, ENC_NA); |
2035 | 0 | *offset += 3; /* Skip over 3 bytes of padding */ |
2036 | |
|
2037 | 0 | proto_tree_add_item(tree, hf_vnc_client_bits_per_pixel, tvb, *offset, |
2038 | 0 | 1, ENC_BIG_ENDIAN); |
2039 | 0 | vnc_set_bytes_per_pixel(pinfo, per_conversation_info, tvb_get_uint8(tvb, *offset) / 8); |
2040 | 0 | *offset += 1; |
2041 | |
|
2042 | 0 | proto_tree_add_item(tree, hf_vnc_client_depth, tvb, *offset, |
2043 | 0 | 1, ENC_BIG_ENDIAN); |
2044 | 0 | vnc_set_depth(pinfo, per_conversation_info, tvb_get_uint8(tvb, *offset)); |
2045 | 0 | *offset += 1; |
2046 | |
|
2047 | 0 | proto_tree_add_item(tree, hf_vnc_client_big_endian_flag, tvb, *offset, |
2048 | 0 | 1, ENC_BIG_ENDIAN); |
2049 | 0 | *offset += 1; |
2050 | |
|
2051 | 0 | proto_tree_add_item(tree, hf_vnc_client_true_color_flag, tvb, *offset, |
2052 | 0 | 1, ENC_BIG_ENDIAN); |
2053 | 0 | *offset += 1; |
2054 | |
|
2055 | 0 | proto_tree_add_item(tree, hf_vnc_client_red_max, tvb, *offset, |
2056 | 0 | 2, ENC_BIG_ENDIAN); |
2057 | 0 | *offset += 2; |
2058 | |
|
2059 | 0 | proto_tree_add_item(tree, hf_vnc_client_green_max, tvb, *offset, |
2060 | 0 | 2, ENC_BIG_ENDIAN); |
2061 | 0 | *offset += 2; |
2062 | |
|
2063 | 0 | proto_tree_add_item(tree, hf_vnc_client_blue_max, tvb, *offset, |
2064 | 0 | 2, ENC_BIG_ENDIAN); |
2065 | 0 | *offset += 2; |
2066 | |
|
2067 | 0 | proto_tree_add_item(tree, hf_vnc_client_red_shift, tvb, *offset, |
2068 | 0 | 1, ENC_BIG_ENDIAN); |
2069 | 0 | *offset += 1; |
2070 | |
|
2071 | 0 | proto_tree_add_item(tree, hf_vnc_client_green_shift, tvb, *offset, |
2072 | 0 | 1, ENC_BIG_ENDIAN); |
2073 | 0 | *offset += 1; |
2074 | |
|
2075 | 0 | proto_tree_add_item(tree, hf_vnc_client_blue_shift, tvb, *offset, |
2076 | 0 | 1, ENC_BIG_ENDIAN); |
2077 | 0 | *offset += 1; |
2078 | |
|
2079 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 3, ENC_NA); |
2080 | 0 | *offset += 3; /* Skip over 3 bytes of padding */ |
2081 | 0 | } |
2082 | | |
2083 | | |
2084 | | static void |
2085 | | vnc_client_set_encodings(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2086 | | proto_tree *tree, |
2087 | | vnc_conversation_t *per_conversation_info) |
2088 | 0 | { |
2089 | 0 | uint16_t number_of_encodings; |
2090 | 0 | unsigned counter; |
2091 | |
|
2092 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Client set encodings"); |
2093 | |
|
2094 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 1, ENC_NA); |
2095 | 0 | *offset += 1; /* Skip over 1 byte of padding */ |
2096 | |
|
2097 | 0 | number_of_encodings = tvb_get_ntohs(tvb, *offset); |
2098 | 0 | proto_tree_add_item(tree, hf_vnc_encoding_num, tvb, *offset, 2, ENC_BIG_ENDIAN); |
2099 | 0 | *offset += 2; |
2100 | |
|
2101 | 0 | per_conversation_info->preferred_encoding = -1; |
2102 | |
|
2103 | 0 | for(counter = 0; counter < number_of_encodings; counter++) { |
2104 | 0 | proto_tree_add_item(tree, |
2105 | 0 | hf_vnc_client_set_encodings_encoding_type, |
2106 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2107 | | |
2108 | | /* Remember the first real encoding as the preferred encoding, |
2109 | | * per xserver/hw/vnc/rfbserver.c:rfbProcessClientNormalMessage(). |
2110 | | * Otherwise, use RAW as the preferred encoding. |
2111 | | */ |
2112 | 0 | if (per_conversation_info->preferred_encoding == -1) { |
2113 | 0 | int encoding; |
2114 | |
|
2115 | 0 | encoding = tvb_get_ntohl(tvb, *offset); |
2116 | |
|
2117 | 0 | switch(encoding) { |
2118 | 0 | case VNC_ENCODING_TYPE_RAW: |
2119 | 0 | case VNC_ENCODING_TYPE_RRE: |
2120 | 0 | case VNC_ENCODING_TYPE_CORRE: |
2121 | 0 | case VNC_ENCODING_TYPE_HEXTILE: |
2122 | 0 | case VNC_ENCODING_TYPE_ZLIB: |
2123 | 0 | case VNC_ENCODING_TYPE_TIGHT: |
2124 | 0 | per_conversation_info->preferred_encoding = encoding; |
2125 | 0 | break; |
2126 | 0 | case VNC_ENCODING_EXTENDED_CLIPBOARD: |
2127 | 0 | per_conversation_info->extended_clipboard_enabled = true; |
2128 | 0 | break; |
2129 | 0 | } |
2130 | 0 | } |
2131 | | |
2132 | 0 | *offset += 4; |
2133 | 0 | } |
2134 | | |
2135 | 0 | if (per_conversation_info->preferred_encoding == -1) |
2136 | 0 | per_conversation_info->preferred_encoding = VNC_ENCODING_TYPE_RAW; |
2137 | 0 | } |
2138 | | |
2139 | | |
2140 | | static void |
2141 | | vnc_client_framebuffer_update_request(tvbuff_t *tvb, packet_info *pinfo, |
2142 | | int *offset, proto_tree *tree) |
2143 | 0 | { |
2144 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Client framebuffer update request"); |
2145 | |
|
2146 | 0 | proto_tree_add_item(tree, hf_vnc_update_req_incremental, |
2147 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
2148 | 0 | *offset += 1; |
2149 | |
|
2150 | 0 | proto_tree_add_item(tree, hf_vnc_update_req_x_pos, |
2151 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2152 | 0 | *offset += 2; |
2153 | |
|
2154 | 0 | proto_tree_add_item(tree, hf_vnc_update_req_y_pos, |
2155 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2156 | 0 | *offset += 2; |
2157 | |
|
2158 | 0 | proto_tree_add_item(tree, hf_vnc_update_req_width, tvb, |
2159 | 0 | *offset, 2, ENC_BIG_ENDIAN); |
2160 | 0 | *offset += 2; |
2161 | |
|
2162 | 0 | proto_tree_add_item(tree, hf_vnc_update_req_height, tvb, |
2163 | 0 | *offset, 2, ENC_BIG_ENDIAN); |
2164 | 0 | *offset += 2; |
2165 | 0 | } |
2166 | | |
2167 | | |
2168 | | static void |
2169 | | vnc_client_key_event(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2170 | | proto_tree *tree) |
2171 | 0 | { |
2172 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Client key event"); |
2173 | |
|
2174 | 0 | proto_tree_add_item(tree, hf_vnc_key_down, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2175 | 0 | *offset += 1; |
2176 | |
|
2177 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 2, ENC_NA); |
2178 | 0 | *offset += 2; /* Skip over 2 bytes of padding */ |
2179 | |
|
2180 | 0 | proto_tree_add_item(tree, hf_vnc_key, tvb, *offset, 4, ENC_BIG_ENDIAN); |
2181 | 0 | *offset += 4; |
2182 | 0 | } |
2183 | | |
2184 | | |
2185 | | static void |
2186 | | vnc_client_pointer_event(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2187 | | proto_tree *tree) |
2188 | 0 | { |
2189 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Client pointer event"); |
2190 | |
|
2191 | 0 | proto_tree_add_item(tree, hf_vnc_button_1_pos, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2192 | 0 | proto_tree_add_item(tree, hf_vnc_button_2_pos, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2193 | 0 | proto_tree_add_item(tree, hf_vnc_button_3_pos, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2194 | 0 | proto_tree_add_item(tree, hf_vnc_button_4_pos, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2195 | 0 | proto_tree_add_item(tree, hf_vnc_button_5_pos, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2196 | 0 | proto_tree_add_item(tree, hf_vnc_button_6_pos, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2197 | 0 | proto_tree_add_item(tree, hf_vnc_button_7_pos, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2198 | 0 | proto_tree_add_item(tree, hf_vnc_button_8_pos, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2199 | 0 | *offset += 1; |
2200 | |
|
2201 | 0 | proto_tree_add_item(tree, hf_vnc_pointer_x_pos, tvb, *offset, 2, ENC_BIG_ENDIAN); |
2202 | 0 | *offset += 2; |
2203 | |
|
2204 | 0 | proto_tree_add_item(tree, hf_vnc_pointer_y_pos, tvb, *offset, 2, ENC_BIG_ENDIAN); |
2205 | 0 | *offset += 2; |
2206 | 0 | } |
2207 | | |
2208 | | |
2209 | | static unsigned |
2210 | | vnc_client_cut_text(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2211 | | proto_tree *tree) |
2212 | 0 | { |
2213 | 0 | uint32_t text_len; |
2214 | |
|
2215 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Client cut text"); |
2216 | |
|
2217 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 3, ENC_NA); |
2218 | 0 | *offset += 3; /* Skip over 3 bytes of padding */ |
2219 | |
|
2220 | 0 | text_len = tvb_get_ntohl(tvb, *offset); |
2221 | 0 | VNC_BYTES_NEEDED((uint32_t) text_len); |
2222 | 0 | proto_tree_add_item(tree, hf_vnc_client_cut_text_len, tvb, *offset, 4, |
2223 | 0 | ENC_BIG_ENDIAN); |
2224 | 0 | *offset += 4; |
2225 | |
|
2226 | 0 | proto_tree_add_item(tree, hf_vnc_client_cut_text, tvb, *offset, |
2227 | 0 | text_len, ENC_ASCII); |
2228 | 0 | *offset += text_len; |
2229 | 0 | return 0; |
2230 | 0 | } |
2231 | | |
2232 | | static unsigned |
2233 | | vnc_client_cut_text_extended(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2234 | | proto_tree *tree) |
2235 | 0 | { |
2236 | 0 | int message_length; |
2237 | 0 | bool original_format; |
2238 | |
|
2239 | 0 | message_length = (int) tvb_get_ntohil(tvb, *offset + 3); |
2240 | |
|
2241 | 0 | if (message_length >= 0) { |
2242 | 0 | original_format = true; |
2243 | 0 | } else { |
2244 | 0 | original_format = false; |
2245 | 0 | message_length = abs(message_length); |
2246 | 0 | } |
2247 | 0 | VNC_BYTES_NEEDED((uint32_t) message_length); |
2248 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 3, ENC_NA); |
2249 | 0 | *offset += 3; /* Skip over 3 bytes of padding */ |
2250 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Client cut text (extended)"); |
2251 | 0 | proto_tree_add_int(tree, hf_vnc_client_cut_text_len_ext, tvb, *offset, 4, message_length); |
2252 | 0 | *offset += 4; |
2253 | 0 | if (original_format) { |
2254 | 0 | proto_tree_add_item(tree, hf_vnc_client_cut_text, tvb, *offset, |
2255 | 0 | message_length - 4, ENC_ASCII); |
2256 | 0 | } else { |
2257 | 0 | vnc_client_cut_text_extended_non_compatible( |
2258 | 0 | tvb, pinfo, offset, tree, message_length); |
2259 | 0 | } |
2260 | 0 | *offset += message_length; |
2261 | 0 | return 0; |
2262 | 0 | } |
2263 | | |
2264 | | |
2265 | | static void |
2266 | | vnc_client_cut_text_extended_non_compatible(tvbuff_t *tvb, packet_info *pinfo _U_, int *offset, |
2267 | | proto_tree *tree, int message_length) |
2268 | 0 | { |
2269 | 0 | int end_offset = *offset + message_length; |
2270 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_vnc_ext_clipboard_flags, |
2271 | 0 | ett_vnc_ext_clipboard_flags, vnc_ext_clipboard_flags, ENC_BIG_ENDIAN); |
2272 | 0 | uint32_t flags = tvb_get_uint32(tvb, *offset, ENC_BIG_ENDIAN); |
2273 | 0 | *offset += 4; |
2274 | 0 | bool has_utf = (flags & VNC_EXT_CLIPBOARD_TEXT) != 0; |
2275 | 0 | bool has_rtf = (flags & VNC_EXT_CLIPBOARD_RTF) != 0; |
2276 | 0 | bool has_html = (flags & VNC_EXT_CLIPBOARD_HTML) != 0; |
2277 | 0 | bool has_dib = (flags & VNC_EXT_CLIPBOARD_DIB) != 0; |
2278 | 0 | if ((flags & VNC_EXT_CLIPBOARD_CAPS) != 0) { |
2279 | 0 | if (has_utf) { |
2280 | 0 | proto_tree_add_item(tree, hf_vnc_ext_clipboard_cap_text, tvb, *offset, 4, |
2281 | 0 | ENC_BIG_ENDIAN); |
2282 | 0 | *offset += 4; |
2283 | 0 | } |
2284 | 0 | if (has_rtf) { |
2285 | 0 | proto_tree_add_item(tree, hf_vnc_ext_clipboard_cap_rtf, tvb, *offset, 4, |
2286 | 0 | ENC_BIG_ENDIAN); |
2287 | 0 | *offset += 4; |
2288 | 0 | } |
2289 | 0 | if (has_html) { |
2290 | 0 | proto_tree_add_item(tree, hf_vnc_ext_clipboard_cap_html, tvb, *offset, 4, |
2291 | 0 | ENC_BIG_ENDIAN); |
2292 | 0 | *offset += 4; |
2293 | 0 | } |
2294 | 0 | if (has_dib) { |
2295 | 0 | proto_tree_add_item(tree, hf_vnc_ext_clipboard_cap_dib, tvb, *offset, 4, |
2296 | 0 | ENC_BIG_ENDIAN); |
2297 | 0 | *offset += 4; |
2298 | 0 | } |
2299 | 0 | } |
2300 | 0 | #if defined (HAVE_ZLIB) || defined (HAVE_ZLIBNG) |
2301 | 0 | if (has_utf || has_rtf || has_html || has_dib) { |
2302 | 0 | int value_length; |
2303 | 0 | int uncomp_offset = 0; |
2304 | 0 | tvbuff_t *uncomp_tvb = tvb_child_uncompress_zlib(tvb, tvb, *offset, end_offset - *offset); |
2305 | |
|
2306 | 0 | if(uncomp_tvb != NULL) { |
2307 | 0 | add_new_data_source(pinfo, uncomp_tvb, "Decompressed Data"); |
2308 | 0 | if (has_utf) { |
2309 | 0 | value_length = tvb_get_uint32(uncomp_tvb, uncomp_offset, ENC_BIG_ENDIAN); |
2310 | 0 | uncomp_offset += 4; |
2311 | 0 | proto_tree_add_item(tree, |
2312 | 0 | hf_vnc_ext_clipboard_text_value, uncomp_tvb, |
2313 | 0 | uncomp_offset, value_length, ENC_UTF_8); |
2314 | 0 | uncomp_offset += value_length; |
2315 | 0 | } |
2316 | 0 | if (has_rtf) { |
2317 | 0 | value_length = tvb_get_uint32(uncomp_tvb, uncomp_offset, ENC_BIG_ENDIAN); |
2318 | 0 | uncomp_offset += 4; |
2319 | 0 | proto_tree_add_item(tree, |
2320 | 0 | hf_vnc_ext_clipboard_rtf_value, uncomp_tvb, |
2321 | 0 | uncomp_offset, value_length, ENC_NA); |
2322 | 0 | uncomp_offset += value_length; |
2323 | 0 | } |
2324 | 0 | if (has_html) { |
2325 | 0 | value_length = tvb_get_uint32(uncomp_tvb, uncomp_offset, ENC_BIG_ENDIAN); |
2326 | 0 | uncomp_offset += 4; |
2327 | 0 | proto_tree_add_item(tree, |
2328 | 0 | hf_vnc_ext_clipboard_html_value, uncomp_tvb, |
2329 | 0 | uncomp_offset, value_length, ENC_UTF_8); |
2330 | 0 | uncomp_offset += value_length; |
2331 | 0 | } |
2332 | 0 | if (has_dib) { |
2333 | 0 | value_length = tvb_get_uint32(uncomp_tvb, uncomp_offset, ENC_BIG_ENDIAN); |
2334 | 0 | uncomp_offset += 4; |
2335 | 0 | proto_tree_add_item(tree, |
2336 | 0 | hf_vnc_ext_clipboard_dib_value, uncomp_tvb, |
2337 | 0 | uncomp_offset, value_length, ENC_NA); |
2338 | | /* uncomp_offset += value_length; */ |
2339 | 0 | } |
2340 | 0 | } |
2341 | 0 | } |
2342 | | #else |
2343 | | (void)end_offset; |
2344 | | proto_tree_add_item(tree, |
2345 | | hf_vnc_ext_clipboard_compressed, tvb, *offset, message_length, ENC_NA); |
2346 | | #endif /* HAVE_ZLIB */ |
2347 | 0 | } |
2348 | | |
2349 | | |
2350 | | static unsigned |
2351 | | vnc_server_framebuffer_update(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2352 | | proto_tree *tree) |
2353 | 0 | { |
2354 | 0 | unsigned ii; |
2355 | 0 | unsigned num_rects; |
2356 | 0 | uint16_t width, height; |
2357 | 0 | unsigned bytes_needed = 0; |
2358 | 0 | uint32_t encoding_type; |
2359 | 0 | proto_item *ti, *ti_x, *ti_y, *ti_width, *ti_height; |
2360 | 0 | proto_tree *vnc_rect_tree, *vnc_encoding_type_tree; |
2361 | |
|
2362 | 0 | col_append_sep_str(pinfo->cinfo, COL_INFO, "; ", "Server framebuffer update"); |
2363 | |
|
2364 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 1, ENC_NA); |
2365 | 0 | *offset += 1; |
2366 | |
|
2367 | 0 | num_rects = tvb_get_ntohs(tvb, *offset); |
2368 | 0 | ti = proto_tree_add_item(tree, hf_vnc_rectangle_num, tvb, *offset, 2, ENC_BIG_ENDIAN); |
2369 | | |
2370 | | /* In some cases, TIGHT encoding ignores the "number of rectangles" field; */ |
2371 | | /* VNC_ENCODING_TYPE_LAST_RECT is used to indicate the end of the rectangle list. */ |
2372 | | /* (It appears that TIGHT encoding uses 0xFFFF for the num_rects field when the */ |
2373 | | /* field is not being used). For now: we'll assume that a value 0f 0xFFFF means */ |
2374 | | /* that the field is not being used. */ |
2375 | 0 | if (num_rects == 0xFFFF) { |
2376 | 0 | proto_item_append_text(ti, " [TIGHT encoding assumed (field is not used)]"); |
2377 | 0 | } |
2378 | 0 | if ((num_rects != 0xFFFF) && (num_rects > 5000)) { |
2379 | 0 | expert_add_info_format(pinfo, ti, &ei_vnc_too_many_rectangles, |
2380 | 0 | "Too many rectangles (%d), aborting dissection", num_rects); |
2381 | 0 | return 0; |
2382 | 0 | } |
2383 | | |
2384 | 0 | *offset += 2; |
2385 | |
|
2386 | 0 | for(ii = 0; ii < num_rects; ii++) { |
2387 | 0 | if (ii > 5000) { |
2388 | 0 | expert_add_info_format(pinfo, ti, &ei_vnc_too_many_rectangles, |
2389 | 0 | "Too many rectangles (%d), aborting dissection", ii); |
2390 | 0 | return 0; |
2391 | 0 | } |
2392 | 0 | VNC_BYTES_NEEDED(12); |
2393 | |
|
2394 | 0 | vnc_rect_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 12, |
2395 | 0 | ett_vnc_rect, NULL, "Rectangle #%d", ii+1); |
2396 | | |
2397 | |
|
2398 | 0 | ti_x = proto_tree_add_item(vnc_rect_tree, hf_vnc_fb_update_x_pos, |
2399 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2400 | 0 | *offset += 2; |
2401 | |
|
2402 | 0 | ti_y = proto_tree_add_item(vnc_rect_tree, hf_vnc_fb_update_y_pos, |
2403 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2404 | 0 | *offset += 2; |
2405 | |
|
2406 | 0 | ti_width = proto_tree_add_item(vnc_rect_tree, hf_vnc_fb_update_width, |
2407 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2408 | 0 | width = tvb_get_ntohs(tvb, *offset); |
2409 | 0 | *offset += 2; |
2410 | |
|
2411 | 0 | ti_height = proto_tree_add_item(vnc_rect_tree, hf_vnc_fb_update_height, |
2412 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2413 | 0 | height = tvb_get_ntohs(tvb, *offset); |
2414 | 0 | *offset += 2; |
2415 | |
|
2416 | 0 | ti = proto_tree_add_item(vnc_rect_tree, |
2417 | 0 | hf_vnc_fb_update_encoding_type, |
2418 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2419 | |
|
2420 | 0 | encoding_type = tvb_get_ntohl(tvb, *offset); |
2421 | 0 | *offset += 4; |
2422 | |
|
2423 | 0 | if (encoding_type == VNC_ENCODING_TYPE_LAST_RECT) |
2424 | 0 | break; /* exit the loop */ |
2425 | | |
2426 | 0 | vnc_encoding_type_tree = |
2427 | 0 | proto_item_add_subtree(ti, ett_vnc_encoding_type); |
2428 | |
|
2429 | 0 | switch(encoding_type) { |
2430 | | |
2431 | 0 | case VNC_ENCODING_TYPE_RAW: |
2432 | 0 | bytes_needed = vnc_raw_encoding(tvb, pinfo, offset, |
2433 | 0 | vnc_encoding_type_tree, |
2434 | 0 | width, height); |
2435 | 0 | break; |
2436 | | |
2437 | 0 | case VNC_ENCODING_TYPE_COPY_RECT: |
2438 | 0 | bytes_needed = |
2439 | 0 | vnc_copyrect_encoding(tvb, pinfo, offset, |
2440 | 0 | vnc_encoding_type_tree, |
2441 | 0 | width, height); |
2442 | 0 | break; |
2443 | | |
2444 | 0 | case VNC_ENCODING_TYPE_RRE: |
2445 | 0 | bytes_needed = |
2446 | 0 | vnc_rre_encoding(tvb, pinfo, offset, |
2447 | 0 | vnc_encoding_type_tree, |
2448 | 0 | width, height); |
2449 | 0 | break; |
2450 | | |
2451 | 0 | case VNC_ENCODING_TYPE_HEXTILE: |
2452 | 0 | bytes_needed = |
2453 | 0 | vnc_hextile_encoding(tvb, pinfo, offset, |
2454 | 0 | vnc_encoding_type_tree, |
2455 | 0 | width, height); |
2456 | 0 | break; |
2457 | | |
2458 | 0 | case VNC_ENCODING_TYPE_RLE: |
2459 | 0 | bytes_needed = |
2460 | 0 | vnc_zrle_encoding(tvb, pinfo, offset, |
2461 | 0 | vnc_encoding_type_tree, |
2462 | 0 | width, height); |
2463 | 0 | break; |
2464 | | |
2465 | 0 | case VNC_ENCODING_TYPE_TIGHT: |
2466 | 0 | bytes_needed = |
2467 | 0 | vnc_tight_encoding(tvb, pinfo, offset, |
2468 | 0 | vnc_encoding_type_tree, |
2469 | 0 | width, height); |
2470 | 0 | break; |
2471 | | |
2472 | 0 | case VNC_ENCODING_TYPE_RICH_CURSOR: |
2473 | 0 | case VNC_ENCODING_TYPE_X_CURSOR: |
2474 | 0 | proto_item_append_text (ti_x, " (hotspot X)"); |
2475 | 0 | proto_item_append_text (ti_y, " (hotspot Y)"); |
2476 | 0 | proto_item_append_text (ti_width, " (cursor width)"); |
2477 | 0 | proto_item_append_text (ti_height, " (cursor height)"); |
2478 | |
|
2479 | 0 | if (encoding_type == VNC_ENCODING_TYPE_RICH_CURSOR) |
2480 | 0 | bytes_needed = vnc_rich_cursor_encoding(tvb, pinfo, offset, vnc_encoding_type_tree, width, height); |
2481 | 0 | else |
2482 | 0 | bytes_needed = vnc_x_cursor_encoding(tvb, pinfo, offset, vnc_encoding_type_tree, width, height); |
2483 | |
|
2484 | 0 | break; |
2485 | | |
2486 | 0 | case VNC_ENCODING_TYPE_POINTER_POS: |
2487 | 0 | proto_item_append_text (ti_x, " (pointer X)"); |
2488 | 0 | proto_item_append_text (ti_y, " (pointer Y)"); |
2489 | 0 | proto_item_append_text (ti_width, " (unused)"); |
2490 | 0 | proto_item_append_text (ti_height, " (unused)"); |
2491 | 0 | bytes_needed = 0; |
2492 | 0 | break; |
2493 | | |
2494 | 0 | case VNC_ENCODING_TYPE_DESKTOP_SIZE: |
2495 | | |
2496 | | /* There is no payload for this message type */ |
2497 | |
|
2498 | 0 | bytes_needed = 0; |
2499 | 0 | break; |
2500 | | |
2501 | 0 | case VNC_ENCODING_TYPE_EXTENDED_DESK_SIZE : |
2502 | 0 | bytes_needed = vnc_extended_desktop_size(tvb, offset, vnc_encoding_type_tree); |
2503 | 0 | break; |
2504 | | |
2505 | 0 | case VNC_ENCODING_TYPE_KEYBOARD_LED_STATE : |
2506 | | |
2507 | | /* There is no payload for this message type */ |
2508 | |
|
2509 | 0 | bytes_needed = 0; |
2510 | 0 | break; |
2511 | | |
2512 | 0 | case VNC_ENCODING_TYPE_SUPPORTED_MESSAGES : |
2513 | 0 | bytes_needed = vnc_supported_messages(tvb, offset, |
2514 | 0 | vnc_encoding_type_tree, |
2515 | 0 | width); |
2516 | 0 | break; |
2517 | | |
2518 | 0 | case VNC_ENCODING_TYPE_SUPPORTED_ENCODINGS : |
2519 | 0 | bytes_needed = vnc_supported_encodings(tvb, offset, |
2520 | 0 | vnc_encoding_type_tree, |
2521 | 0 | width, height); |
2522 | 0 | break; |
2523 | | |
2524 | 0 | case VNC_ENCODING_TYPE_SERVER_IDENTITY : |
2525 | 0 | bytes_needed = vnc_server_identity(tvb, offset, |
2526 | 0 | vnc_encoding_type_tree, |
2527 | 0 | width); |
2528 | 0 | break; |
2529 | | |
2530 | 0 | case VNC_ENCODING_TYPE_CONTEXT_INFORMATION : |
2531 | 0 | bytes_needed = vnc_context_information(tvb, offset, |
2532 | 0 | vnc_encoding_type_tree); |
2533 | 0 | break; |
2534 | | |
2535 | 0 | case VNC_ENCODING_TYPE_SLRLE : |
2536 | 0 | bytes_needed = vnc_slrle_encoding(tvb, pinfo, offset, |
2537 | 0 | vnc_encoding_type_tree, |
2538 | 0 | height); |
2539 | 0 | break; |
2540 | | |
2541 | 0 | case VNC_ENCODING_TYPE_H264 : |
2542 | 0 | bytes_needed = vnc_h264_encoding(tvb, offset, |
2543 | 0 | vnc_encoding_type_tree); |
2544 | 0 | break; |
2545 | |
|
2546 | 0 | } |
2547 | | |
2548 | | /* Check if the routines above requested more bytes to |
2549 | | * be desegmented. */ |
2550 | 0 | if(bytes_needed > 0) |
2551 | 0 | return bytes_needed; |
2552 | 0 | } |
2553 | | |
2554 | 0 | return 0; |
2555 | 0 | } |
2556 | | |
2557 | | static uint32_t |
2558 | | vnc_extended_desktop_size(tvbuff_t *tvb, int *offset, proto_tree *tree) |
2559 | 0 | { |
2560 | |
|
2561 | 0 | uint8_t i, num_of_screens; |
2562 | 0 | proto_tree *screen_tree; |
2563 | |
|
2564 | 0 | num_of_screens = tvb_get_uint8(tvb, *offset); |
2565 | 0 | proto_tree_add_item(tree, hf_vnc_desktop_screen_num, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2566 | 0 | *offset += 1; |
2567 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 3, ENC_NA); |
2568 | |
|
2569 | 0 | VNC_BYTES_NEEDED((uint32_t)(3 + (num_of_screens * 16))); |
2570 | 0 | *offset += 3; |
2571 | 0 | for(i = 0; i < num_of_screens; i++) { |
2572 | 0 | screen_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 16, ett_vnc_desktop_screen, NULL, "Screen #%u", i+1); |
2573 | |
|
2574 | 0 | proto_tree_add_item(screen_tree, hf_vnc_desktop_screen_id, tvb, *offset, 4, ENC_BIG_ENDIAN); |
2575 | 0 | *offset += 4; |
2576 | 0 | proto_tree_add_item(screen_tree, hf_vnc_desktop_screen_x, tvb, *offset, 2, ENC_BIG_ENDIAN); |
2577 | 0 | *offset += 2; |
2578 | 0 | proto_tree_add_item(screen_tree, hf_vnc_desktop_screen_y, tvb, *offset, 2, ENC_BIG_ENDIAN); |
2579 | 0 | *offset += 2; |
2580 | 0 | proto_tree_add_item(screen_tree, hf_vnc_desktop_screen_width, tvb, *offset, 2, ENC_BIG_ENDIAN); |
2581 | 0 | *offset += 2; |
2582 | 0 | proto_tree_add_item(screen_tree, hf_vnc_desktop_screen_height, tvb, *offset, 2, ENC_BIG_ENDIAN); |
2583 | 0 | *offset += 2; |
2584 | 0 | proto_tree_add_item(screen_tree, hf_vnc_desktop_screen_flags, tvb, *offset, 4, ENC_BIG_ENDIAN); |
2585 | 0 | *offset += 4; |
2586 | 0 | } |
2587 | |
|
2588 | 0 | return 0; |
2589 | 0 | } |
2590 | | |
2591 | | static unsigned |
2592 | | vnc_raw_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2593 | | proto_tree *tree, const uint16_t width, const uint16_t height) |
2594 | 0 | { |
2595 | 0 | uint8_t bytes_per_pixel = vnc_get_bytes_per_pixel(pinfo); |
2596 | 0 | unsigned length; |
2597 | |
|
2598 | 0 | length = width * height * bytes_per_pixel; |
2599 | 0 | VNC_BYTES_NEEDED(length); |
2600 | |
|
2601 | 0 | proto_tree_add_item(tree, hf_vnc_raw_pixel_data, tvb, *offset, |
2602 | 0 | length, ENC_NA); |
2603 | 0 | *offset += length; |
2604 | |
|
2605 | 0 | return 0; /* bytes_needed */ |
2606 | 0 | } |
2607 | | |
2608 | | |
2609 | | static unsigned |
2610 | | vnc_copyrect_encoding(tvbuff_t *tvb, packet_info *pinfo _U_, int *offset, |
2611 | | proto_tree *tree, const uint16_t width _U_, const uint16_t height _U_) |
2612 | 0 | { |
2613 | 0 | proto_tree_add_item(tree, hf_vnc_copyrect_src_x_pos, tvb, *offset, |
2614 | 0 | 2, ENC_BIG_ENDIAN); |
2615 | 0 | *offset += 2; |
2616 | |
|
2617 | 0 | proto_tree_add_item(tree, hf_vnc_copyrect_src_y_pos, tvb, *offset, |
2618 | 0 | 2, ENC_BIG_ENDIAN); |
2619 | 0 | *offset += 2; |
2620 | |
|
2621 | 0 | return 0; /* bytes_needed */ |
2622 | 0 | } |
2623 | | |
2624 | | |
2625 | | static unsigned |
2626 | | vnc_rre_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2627 | | proto_tree *tree, const uint16_t width _U_, const uint16_t height _U_) |
2628 | 0 | { |
2629 | 0 | uint8_t bytes_per_pixel = vnc_get_bytes_per_pixel(pinfo); |
2630 | 0 | uint32_t num_subrects, i; |
2631 | 0 | unsigned bytes_needed; |
2632 | 0 | proto_item *ti; |
2633 | 0 | proto_tree *subrect_tree; |
2634 | |
|
2635 | 0 | VNC_BYTES_NEEDED(4); |
2636 | 0 | ti = proto_tree_add_item(tree, hf_vnc_rre_num_subrects, tvb, *offset, |
2637 | 0 | 4, ENC_BIG_ENDIAN); |
2638 | 0 | num_subrects = tvb_get_ntohl(tvb, *offset); |
2639 | 0 | *offset += 4; |
2640 | |
|
2641 | 0 | if (num_subrects > 10000) { |
2642 | 0 | expert_add_info_format(pinfo, ti, &ei_vnc_too_many_sub_rectangles, |
2643 | 0 | "Too many sub-rectangles (%d), aborting dissection", num_subrects); |
2644 | 0 | return 0; |
2645 | 0 | } |
2646 | | |
2647 | 0 | VNC_BYTES_NEEDED(bytes_per_pixel); |
2648 | 0 | proto_tree_add_item(tree, hf_vnc_rre_bg_pixel, tvb, *offset, |
2649 | 0 | bytes_per_pixel, ENC_NA); |
2650 | 0 | *offset += bytes_per_pixel; |
2651 | | |
2652 | | /* We know we need (at least) all these bytes, so ask for them now |
2653 | | * (instead of a few at a time...). |
2654 | | */ |
2655 | 0 | bytes_needed = bytes_per_pixel + 8; |
2656 | 0 | VNC_BYTES_NEEDED(bytes_needed * num_subrects); |
2657 | 0 | for(i = 0; i < num_subrects; i++) { |
2658 | |
|
2659 | 0 | subrect_tree = proto_tree_add_subtree_format(tree, tvb, *offset, bytes_per_pixel + |
2660 | 0 | 8, ett_vnc_rre_subrect, NULL, "Subrectangle #%d", i+1); |
2661 | |
|
2662 | 0 | proto_tree_add_item(subrect_tree, hf_vnc_rre_subrect_pixel, |
2663 | 0 | tvb, *offset, bytes_per_pixel, ENC_NA); |
2664 | 0 | *offset += bytes_per_pixel; |
2665 | |
|
2666 | 0 | proto_tree_add_item(subrect_tree, hf_vnc_rre_subrect_x_pos, |
2667 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2668 | 0 | *offset += 2; |
2669 | |
|
2670 | 0 | proto_tree_add_item(subrect_tree, hf_vnc_rre_subrect_y_pos, |
2671 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2672 | 0 | *offset += 2; |
2673 | |
|
2674 | 0 | proto_tree_add_item(subrect_tree, hf_vnc_rre_subrect_width, |
2675 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2676 | 0 | *offset += 2; |
2677 | |
|
2678 | 0 | proto_tree_add_item(subrect_tree, hf_vnc_rre_subrect_height, |
2679 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2680 | 0 | *offset += 2; |
2681 | 0 | } |
2682 | |
|
2683 | 0 | return 0; /* bytes_needed */ |
2684 | 0 | } |
2685 | | |
2686 | | |
2687 | | static unsigned |
2688 | | vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2689 | | proto_tree *tree, const uint16_t width, const uint16_t height) |
2690 | 0 | { |
2691 | 0 | uint8_t bytes_per_pixel = vnc_get_bytes_per_pixel(pinfo); |
2692 | 0 | uint8_t i, subencoding_mask, num_subrects, subrect_len, tile_height, tile_width; |
2693 | 0 | uint32_t raw_length; |
2694 | 0 | proto_tree *tile_tree, *subencoding_mask_tree, *subrect_tree, *num_subrects_tree; |
2695 | 0 | proto_item *ti; |
2696 | 0 | uint16_t current_height = 0, current_width; |
2697 | |
|
2698 | 0 | while(current_height != height) { |
2699 | 0 | if (current_height + 16 > height) |
2700 | 0 | tile_height = height - current_height; |
2701 | 0 | else |
2702 | 0 | tile_height = 16; |
2703 | 0 | current_height += tile_height; |
2704 | 0 | current_width = 0; |
2705 | 0 | while(current_width != width) { |
2706 | 0 | if (current_width + 16 > width) |
2707 | 0 | tile_width = width - current_width; |
2708 | 0 | else |
2709 | 0 | tile_width = 16; |
2710 | |
|
2711 | 0 | current_width += tile_width; |
2712 | |
|
2713 | 0 | VNC_BYTES_NEEDED(1); |
2714 | 0 | subencoding_mask = tvb_get_uint8(tvb, *offset); |
2715 | |
|
2716 | 0 | tile_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 1, ett_vnc_hextile_tile, NULL, |
2717 | 0 | "Tile {%d:%d}, sub encoding mask %u", current_width, current_height, subencoding_mask); |
2718 | |
|
2719 | 0 | ti = proto_tree_add_item(tile_tree, hf_vnc_hextile_subencoding_mask, tvb, |
2720 | 0 | *offset, 1, ENC_BIG_ENDIAN); |
2721 | |
|
2722 | 0 | subencoding_mask_tree = |
2723 | 0 | proto_item_add_subtree(ti, ett_vnc_hextile_subencoding_mask); |
2724 | |
|
2725 | 0 | proto_tree_add_item(subencoding_mask_tree, |
2726 | 0 | hf_vnc_hextile_raw, tvb, *offset, 1, |
2727 | 0 | ENC_BIG_ENDIAN); |
2728 | 0 | proto_tree_add_item(subencoding_mask_tree, |
2729 | 0 | hf_vnc_hextile_bg, tvb, *offset, 1, |
2730 | 0 | ENC_BIG_ENDIAN); |
2731 | 0 | proto_tree_add_item(subencoding_mask_tree, |
2732 | 0 | hf_vnc_hextile_fg, tvb, *offset, 1, |
2733 | 0 | ENC_BIG_ENDIAN); |
2734 | 0 | proto_tree_add_item(subencoding_mask_tree, |
2735 | 0 | hf_vnc_hextile_anysubrects, tvb, *offset, 1, |
2736 | 0 | ENC_BIG_ENDIAN); |
2737 | 0 | proto_tree_add_item(subencoding_mask_tree, |
2738 | 0 | hf_vnc_hextile_subrectscolored, tvb, *offset, 1, |
2739 | 0 | ENC_BIG_ENDIAN); |
2740 | 0 | *offset += 1; |
2741 | |
|
2742 | 0 | if(subencoding_mask & 0x1) { /* Raw */ |
2743 | 0 | raw_length = tile_width * tile_height * bytes_per_pixel; |
2744 | |
|
2745 | 0 | VNC_BYTES_NEEDED(raw_length); |
2746 | 0 | proto_tree_add_item(tile_tree, hf_vnc_hextile_raw_value, tvb, |
2747 | 0 | *offset, raw_length, ENC_NA); |
2748 | 0 | *offset += raw_length; |
2749 | 0 | } else { |
2750 | 0 | if(subencoding_mask & 0x2) { /* Background Specified */ |
2751 | 0 | VNC_BYTES_NEEDED(bytes_per_pixel); |
2752 | 0 | proto_tree_add_item(tile_tree, hf_vnc_hextile_bg_value, |
2753 | 0 | tvb, *offset, bytes_per_pixel, |
2754 | 0 | ENC_NA); |
2755 | 0 | *offset += bytes_per_pixel; |
2756 | 0 | } |
2757 | | |
2758 | 0 | if(subencoding_mask & 0x4) { /* Foreground Specified */ |
2759 | 0 | VNC_BYTES_NEEDED(bytes_per_pixel); |
2760 | 0 | proto_tree_add_item(tile_tree, hf_vnc_hextile_fg_value, |
2761 | 0 | tvb, *offset, bytes_per_pixel, |
2762 | 0 | ENC_NA); |
2763 | 0 | *offset += bytes_per_pixel; |
2764 | 0 | } |
2765 | | |
2766 | 0 | if(subencoding_mask & 0x8) { /* Any Subrects */ |
2767 | 0 | VNC_BYTES_NEEDED(3); /* 1 byte for number of subrects field, +2 at least for 1 subrect */ |
2768 | 0 | ti = proto_tree_add_item(tile_tree, |
2769 | 0 | hf_vnc_hextile_num_subrects, |
2770 | 0 | tvb, *offset, 1, |
2771 | 0 | ENC_BIG_ENDIAN); |
2772 | 0 | num_subrects = tvb_get_uint8(tvb, *offset); |
2773 | 0 | *offset += 1; |
2774 | |
|
2775 | 0 | if(subencoding_mask & 0x10) |
2776 | 0 | subrect_len = bytes_per_pixel + 2; |
2777 | 0 | else |
2778 | 0 | subrect_len = 2; |
2779 | 0 | VNC_BYTES_NEEDED((unsigned)(subrect_len * num_subrects)); |
2780 | |
|
2781 | 0 | num_subrects_tree = |
2782 | 0 | proto_item_add_subtree(ti, ett_vnc_hextile_num_subrects); |
2783 | |
|
2784 | 0 | for(i = 0; i < num_subrects; i++) { |
2785 | 0 | subrect_tree = proto_tree_add_subtree_format(num_subrects_tree, tvb, |
2786 | 0 | *offset, subrect_len, ett_vnc_hextile_subrect, NULL, |
2787 | 0 | "Subrectangle #%d", i+1); |
2788 | |
|
2789 | 0 | if(subencoding_mask & 0x10) { |
2790 | | /* Subrects Colored */ |
2791 | 0 | proto_tree_add_item(subrect_tree, hf_vnc_hextile_subrect_pixel_value, tvb, *offset, bytes_per_pixel, ENC_NA); |
2792 | |
|
2793 | 0 | *offset += bytes_per_pixel; |
2794 | 0 | } |
2795 | |
|
2796 | 0 | proto_tree_add_item(subrect_tree, |
2797 | 0 | hf_vnc_hextile_subrect_x_pos, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2798 | |
|
2799 | 0 | proto_tree_add_item(subrect_tree, hf_vnc_hextile_subrect_y_pos, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2800 | |
|
2801 | 0 | *offset += 1; |
2802 | |
|
2803 | 0 | proto_tree_add_item(subrect_tree, hf_vnc_hextile_subrect_width, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2804 | |
|
2805 | 0 | proto_tree_add_item(subrect_tree, hf_vnc_hextile_subrect_height, tvb, *offset, 1, ENC_BIG_ENDIAN); |
2806 | |
|
2807 | 0 | *offset += 1; |
2808 | 0 | } |
2809 | 0 | } |
2810 | 0 | } |
2811 | 0 | } |
2812 | 0 | } |
2813 | 0 | return 0; /* bytes_needed */ |
2814 | 0 | } |
2815 | | |
2816 | | static unsigned |
2817 | | vnc_supported_messages(tvbuff_t *tvb, int *offset, proto_tree *tree, |
2818 | | const uint16_t width) |
2819 | 0 | { |
2820 | 0 | VNC_BYTES_NEEDED(width); |
2821 | 0 | if (width >= 64) { |
2822 | 0 | proto_tree_add_item(tree, |
2823 | 0 | hf_vnc_supported_messages_client2server, |
2824 | 0 | tvb, *offset, 32, ENC_NA); |
2825 | 0 | *offset += 32; |
2826 | 0 | proto_tree_add_item(tree, |
2827 | 0 | hf_vnc_supported_messages_server2client, |
2828 | 0 | tvb, *offset, 32, ENC_NA); |
2829 | 0 | *offset += 32; |
2830 | 0 | *offset += width - 64; |
2831 | 0 | } else { |
2832 | 0 | *offset += width; |
2833 | 0 | } |
2834 | |
|
2835 | 0 | return 0; /* bytes_needed */ |
2836 | 0 | } |
2837 | | |
2838 | | static unsigned |
2839 | | vnc_supported_encodings(tvbuff_t *tvb, int *offset, proto_tree *tree, |
2840 | | const uint16_t width, const uint16_t height) |
2841 | 0 | { |
2842 | 0 | uint16_t i = width; |
2843 | |
|
2844 | 0 | proto_tree_add_uint(tree, hf_vnc_num_supported_encodings, tvb, *offset, 0, height); |
2845 | |
|
2846 | 0 | VNC_BYTES_NEEDED(width); |
2847 | 0 | for (; i >= 4; i -= 4) { |
2848 | 0 | proto_tree_add_item(tree, hf_vnc_supported_encodings, |
2849 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2850 | 0 | *offset += 4; |
2851 | 0 | } |
2852 | 0 | *offset += i; |
2853 | |
|
2854 | 0 | return 0; /* bytes_needed */ |
2855 | 0 | } |
2856 | | |
2857 | | static unsigned |
2858 | | vnc_server_identity(tvbuff_t *tvb, int *offset, proto_tree *tree, |
2859 | | const uint16_t width) |
2860 | 0 | { |
2861 | 0 | VNC_BYTES_NEEDED(width); |
2862 | 0 | proto_tree_add_item(tree, hf_vnc_server_identity, |
2863 | 0 | tvb, *offset, width, ENC_ASCII); |
2864 | 0 | *offset += width; |
2865 | |
|
2866 | 0 | return 0; /* bytes_needed */ |
2867 | 0 | } |
2868 | | |
2869 | | static unsigned |
2870 | | vnc_mirrorlink(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
2871 | | proto_tree *tree) |
2872 | 0 | { |
2873 | 0 | uint8_t type; |
2874 | 0 | uint16_t length; |
2875 | 0 | uint16_t num, i; |
2876 | 0 | int end; |
2877 | 0 | proto_tree *sub_tree; |
2878 | | |
2879 | | /* Header */ |
2880 | 0 | VNC_BYTES_NEEDED(3); |
2881 | |
|
2882 | 0 | type = tvb_get_uint8(tvb, *offset); |
2883 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_type, |
2884 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
2885 | 0 | *offset += 1; |
2886 | |
|
2887 | 0 | length = tvb_get_ntohs(tvb, *offset); |
2888 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_length, |
2889 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2890 | 0 | *offset += 2; |
2891 | |
|
2892 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, "MirrorLink (%s)", |
2893 | 0 | val_to_str_const(type, vnc_mirrorlink_types_vs, |
2894 | 0 | "Unknown")); |
2895 | | |
2896 | | /* Payload */ |
2897 | 0 | end = *offset + length; |
2898 | |
|
2899 | 0 | switch(type) { |
2900 | | |
2901 | 0 | case VNC_ML_EXT_BYE_BYE : |
2902 | 0 | break; |
2903 | | |
2904 | 0 | case VNC_ML_EXT_SERVER_DISPLAY_CONFIGURATION : |
2905 | 0 | VNC_BYTES_NEEDED(12); |
2906 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_version_major, |
2907 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
2908 | 0 | *offset += 1; |
2909 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_version_minor, |
2910 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
2911 | 0 | *offset += 1; |
2912 | 0 | proto_tree_add_item(tree, |
2913 | 0 | hf_vnc_mirrorlink_framebuffer_configuration, |
2914 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2915 | 0 | *offset += 2; |
2916 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_pixel_width, |
2917 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2918 | 0 | *offset += 2; |
2919 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_pixel_height, |
2920 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2921 | 0 | *offset += 2; |
2922 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_pixel_format, |
2923 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2924 | 0 | *offset += 4; |
2925 | 0 | break; |
2926 | | |
2927 | 0 | case VNC_ML_EXT_CLIENT_DISPLAY_CONFIGURATION : |
2928 | 0 | VNC_BYTES_NEEDED(14); |
2929 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_version_major, |
2930 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
2931 | 0 | *offset += 1; |
2932 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_version_minor, |
2933 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
2934 | 0 | *offset += 1; |
2935 | 0 | proto_tree_add_item(tree, |
2936 | 0 | hf_vnc_mirrorlink_framebuffer_configuration, |
2937 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2938 | 0 | *offset += 2; |
2939 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_pixel_width, |
2940 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2941 | 0 | *offset += 2; |
2942 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_pixel_height, |
2943 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2944 | 0 | *offset += 2; |
2945 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_display_width, |
2946 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2947 | 0 | *offset += 2; |
2948 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_display_height, |
2949 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2950 | 0 | *offset += 2; |
2951 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_display_distance, |
2952 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
2953 | 0 | *offset += 2; |
2954 | 0 | break; |
2955 | | |
2956 | 0 | case VNC_ML_EXT_SERVER_EVENT_CONFIGURATION : |
2957 | 0 | case VNC_ML_EXT_CLIENT_EVENT_CONFIGURATION : |
2958 | 0 | VNC_BYTES_NEEDED(28); |
2959 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_keyboard_language, |
2960 | 0 | tvb, *offset, 2, ENC_ASCII); |
2961 | 0 | *offset += 2; |
2962 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_keyboard_country, |
2963 | 0 | tvb, *offset, 2, ENC_ASCII); |
2964 | 0 | *offset += 2; |
2965 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_ui_language, |
2966 | 0 | tvb, *offset, 2, ENC_ASCII); |
2967 | 0 | *offset += 2; |
2968 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_ui_country, |
2969 | 0 | tvb, *offset, 2, ENC_ASCII); |
2970 | 0 | *offset += 2; |
2971 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_knob_keys, |
2972 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2973 | 0 | *offset += 4; |
2974 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_device_keys, |
2975 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2976 | 0 | *offset += 4; |
2977 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_multimedia_keys, |
2978 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2979 | 0 | *offset += 4; |
2980 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_key_related, |
2981 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2982 | 0 | *offset += 4; |
2983 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_pointer_related, |
2984 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2985 | 0 | *offset += 4; |
2986 | 0 | break; |
2987 | | |
2988 | 0 | case VNC_ML_EXT_EVENT_MAPPING : |
2989 | 0 | case VNC_ML_EXT_EVENT_MAPPING_REQUEST : |
2990 | 0 | VNC_BYTES_NEEDED(8); |
2991 | 0 | proto_tree_add_item(tree, |
2992 | 0 | hf_vnc_mirrorlink_key_symbol_value_client, |
2993 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2994 | 0 | *offset += 4; |
2995 | 0 | proto_tree_add_item(tree, |
2996 | 0 | hf_vnc_mirrorlink_key_symbol_value_server, |
2997 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
2998 | 0 | *offset += 4; |
2999 | 0 | break; |
3000 | | |
3001 | 0 | case VNC_ML_EXT_KEY_EVENT_LISTING : |
3002 | 0 | VNC_BYTES_NEEDED(4); |
3003 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_key_configuration, |
3004 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
3005 | 0 | *offset += 1; |
3006 | 0 | num = tvb_get_uint8(tvb, *offset); |
3007 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_key_num_events, |
3008 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
3009 | 0 | *offset += 1; |
3010 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_key_event_counter, |
3011 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3012 | 0 | *offset += 2; |
3013 | 0 | VNC_BYTES_NEEDED((unsigned)(4 * num)); |
3014 | 0 | sub_tree = proto_tree_add_subtree(tree, tvb, *offset, 4 * num, |
3015 | 0 | ett_vnc_key_events, NULL, "Key Event List"); |
3016 | 0 | for (; num > 0; num--) { |
3017 | 0 | proto_tree_add_item(sub_tree, |
3018 | 0 | hf_vnc_mirrorlink_key_symbol_value, |
3019 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3020 | 0 | *offset += 4 ; |
3021 | 0 | } |
3022 | 0 | break; |
3023 | | |
3024 | 0 | case VNC_ML_EXT_KEY_EVENT_LISTING_REQUEST : |
3025 | 0 | VNC_BYTES_NEEDED(4); |
3026 | 0 | proto_tree_add_item(tree, |
3027 | 0 | hf_vnc_mirrorlink_key_request_configuration, |
3028 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3029 | 0 | *offset += 4; |
3030 | 0 | break; |
3031 | | |
3032 | 0 | case VNC_ML_EXT_VIRTUAL_KEYBOARD : |
3033 | 0 | VNC_BYTES_NEEDED(16); |
3034 | 0 | proto_tree_add_item(tree, |
3035 | 0 | hf_vnc_mirrorlink_keyboard_configuration, |
3036 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3037 | 0 | *offset += 4; |
3038 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_cursor_x, |
3039 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3040 | 0 | *offset += 2; |
3041 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_cursor_y, |
3042 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3043 | 0 | *offset += 2; |
3044 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_text_x, |
3045 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3046 | 0 | *offset += 2; |
3047 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_text_y, |
3048 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3049 | 0 | *offset += 2; |
3050 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_text_width, |
3051 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3052 | 0 | *offset += 2; |
3053 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_text_height, |
3054 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3055 | 0 | *offset += 2; |
3056 | 0 | break; |
3057 | | |
3058 | 0 | case VNC_ML_EXT_VIRTUAL_KEYBOARD_REQUEST : |
3059 | 0 | VNC_BYTES_NEEDED(4); |
3060 | 0 | proto_tree_add_item(tree, |
3061 | 0 | hf_vnc_mirrorlink_keyboard_request_configuration, |
3062 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3063 | 0 | *offset += 4; |
3064 | 0 | break; |
3065 | | |
3066 | 0 | case VNC_ML_EXT_DEVICE_STATUS : |
3067 | 0 | case VNC_ML_EXT_DEVICE_STATUS_REQUEST : |
3068 | 0 | VNC_BYTES_NEEDED(4); |
3069 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_device_status, |
3070 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3071 | 0 | *offset += 4; |
3072 | 0 | break; |
3073 | | /* |
3074 | | case VNC_ML_EXT_CONTENT_ATTESTATION : |
3075 | | break; |
3076 | | |
3077 | | case VNC_ML_EXT_CONTENT_ATTESTATION_REQUEST : |
3078 | | break; |
3079 | | */ |
3080 | 0 | case VNC_ML_EXT_FB_BLOCKING_NOTIFICATION : |
3081 | 0 | VNC_BYTES_NEEDED(14); |
3082 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_fb_block_x, |
3083 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3084 | 0 | *offset += 2; |
3085 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_fb_block_y, |
3086 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3087 | 0 | *offset += 2; |
3088 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_fb_block_width, |
3089 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3090 | 0 | *offset += 2; |
3091 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_fb_block_height, |
3092 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3093 | 0 | *offset += 2; |
3094 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_app_id, |
3095 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3096 | 0 | *offset += 4; |
3097 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_fb_block_reason, |
3098 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3099 | 0 | *offset += 2; |
3100 | 0 | break; |
3101 | | |
3102 | 0 | case VNC_ML_EXT_AUDIO_BLOCKING_NOTIFICATION : |
3103 | 0 | VNC_BYTES_NEEDED(6); |
3104 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_app_id, |
3105 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3106 | 0 | *offset += 4; |
3107 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_audio_block_reason, |
3108 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3109 | 0 | *offset += 2; |
3110 | 0 | break; |
3111 | | |
3112 | 0 | case VNC_ML_EXT_TOUCH_EVENT : |
3113 | 0 | VNC_BYTES_NEEDED(1); |
3114 | 0 | num = tvb_get_uint8(tvb, *offset); |
3115 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_touch_num_events, |
3116 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
3117 | 0 | *offset += 1; |
3118 | 0 | VNC_BYTES_NEEDED((unsigned)(6 * num)); |
3119 | | /*sub_tree = proto_item_add_subtree(tree, ett_vnc_touch_events);*/ |
3120 | 0 | for (i = 0; i < num; i++) { |
3121 | 0 | sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 6, |
3122 | 0 | ett_vnc_touch_events, NULL, "Touch Event #%d", i + 1); |
3123 | |
|
3124 | 0 | proto_tree_add_item(sub_tree, hf_vnc_mirrorlink_touch_x, |
3125 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3126 | 0 | *offset += 2; |
3127 | 0 | proto_tree_add_item(sub_tree, hf_vnc_mirrorlink_touch_y, |
3128 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3129 | 0 | *offset += 2; |
3130 | 0 | proto_tree_add_item(sub_tree, |
3131 | 0 | hf_vnc_mirrorlink_touch_id, |
3132 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
3133 | 0 | *offset += 1; |
3134 | 0 | proto_tree_add_item(sub_tree, |
3135 | 0 | hf_vnc_mirrorlink_touch_pressure, |
3136 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
3137 | 0 | *offset += 1; |
3138 | 0 | } |
3139 | 0 | break; |
3140 | | |
3141 | 0 | case VNC_ML_EXT_FB_ALTERNATIVE_TEXT : |
3142 | 0 | VNC_BYTES_NEEDED(6); |
3143 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_app_id, |
3144 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3145 | 0 | *offset += 4; |
3146 | 0 | num = tvb_get_ntohs(tvb, *offset); |
3147 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_text_length, |
3148 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3149 | 0 | *offset += 2; |
3150 | 0 | VNC_BYTES_NEEDED(num); |
3151 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_text, |
3152 | 0 | tvb, *offset, num, ENC_ASCII); |
3153 | 0 | *offset += num; |
3154 | 0 | break; |
3155 | | |
3156 | 0 | case VNC_ML_EXT_FB_ALTERNATIVE_TEXT_REQUEST : |
3157 | 0 | VNC_BYTES_NEEDED(2); |
3158 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_text_max_length, |
3159 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3160 | 0 | *offset += 2; |
3161 | 0 | break; |
3162 | |
|
3163 | 0 | } |
3164 | | |
3165 | 0 | if (end > *offset) { |
3166 | 0 | length = end - *offset; |
3167 | 0 | VNC_BYTES_NEEDED(length); |
3168 | 0 | proto_tree_add_item(tree, hf_vnc_mirrorlink_unknown, |
3169 | 0 | tvb, *offset, length, ENC_NA); |
3170 | 0 | *offset = end; |
3171 | 0 | } |
3172 | | |
3173 | 0 | return 0; /* bytes_needed */ |
3174 | 0 | } |
3175 | | |
3176 | | static unsigned |
3177 | | vnc_fence(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
3178 | | proto_tree *tree) |
3179 | 0 | { |
3180 | 0 | unsigned payload_length; |
3181 | |
|
3182 | 0 | VNC_BYTES_NEEDED(8); |
3183 | |
|
3184 | 0 | payload_length = tvb_get_uint8(tvb, *offset+7); |
3185 | 0 | VNC_BYTES_NEEDED((8+payload_length)); |
3186 | |
|
3187 | 0 | col_append_sep_str(pinfo->cinfo, COL_INFO, "; ", "Fence"); |
3188 | |
|
3189 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 3, ENC_NA); |
3190 | 0 | *offset += 3; /* skip padding */ |
3191 | |
|
3192 | 0 | proto_tree_add_bitmask(tree, tvb, *offset, hf_vnc_fence_flags, |
3193 | 0 | ett_vnc_fence_flags, vnc_fence_flags, ENC_BIG_ENDIAN); |
3194 | |
|
3195 | 0 | *offset += 4; |
3196 | |
|
3197 | 0 | proto_tree_add_item(tree, hf_vnc_fence_payload_length, |
3198 | 0 | tvb, *offset, 1, ENC_BIG_ENDIAN); |
3199 | |
|
3200 | 0 | *offset += 1; |
3201 | |
|
3202 | 0 | if (payload_length > 0) { |
3203 | 0 | proto_tree_add_item(tree, hf_vnc_fence_payload, |
3204 | 0 | tvb, *offset, payload_length, ENC_NA); |
3205 | 0 | *offset += payload_length; |
3206 | 0 | } |
3207 | 0 | return 0; |
3208 | 0 | } |
3209 | | |
3210 | | static void |
3211 | | vnc_qemu(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
3212 | | proto_tree *tree) |
3213 | 0 | { |
3214 | 0 | uint8_t message_subtype; |
3215 | 0 | message_subtype = tvb_get_uint8(tvb, *offset); |
3216 | 0 | proto_tree_add_item(tree, hf_vnc_qemu_subtype, tvb, *offset, 1, ENC_BIG_ENDIAN); |
3217 | 0 | *offset += 1; |
3218 | 0 | switch(message_subtype) { |
3219 | 0 | case QEMU_CLIENT_MESSAGE_SUBTYPE_EXTENDED_KEY_EVENTS : |
3220 | 0 | vnc_qemu_extended_key_event(tvb, pinfo, offset, tree); |
3221 | 0 | break; |
3222 | 0 | default : |
3223 | 0 | col_append_sep_str( |
3224 | 0 | pinfo->cinfo, COL_INFO, "; ", "Unknown QEMU message subtype"); |
3225 | 0 | *offset = tvb_reported_length(tvb); /* Skip the rest of the segment */ |
3226 | 0 | break; |
3227 | 0 | } |
3228 | 0 | } |
3229 | | |
3230 | | static void |
3231 | | vnc_qemu_extended_key_event(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
3232 | | proto_tree *tree) |
3233 | 0 | { |
3234 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "QEMU Extended Key Event"); |
3235 | 0 | proto_tree_add_item(tree, hf_vnc_qemu_extended_key_down_flag, |
3236 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3237 | 0 | *offset += 2; |
3238 | 0 | proto_tree_add_item(tree, hf_vnc_qemu_extended_key_keysum, |
3239 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3240 | 0 | *offset += 4; |
3241 | 0 | proto_tree_add_item(tree, hf_vnc_qemu_extended_key_keycode, |
3242 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3243 | 0 | *offset += 4; |
3244 | 0 | } |
3245 | | |
3246 | | static unsigned |
3247 | | vnc_context_information(tvbuff_t *tvb, int *offset, proto_tree *tree) |
3248 | 0 | { |
3249 | 0 | VNC_BYTES_NEEDED(20); |
3250 | |
|
3251 | 0 | proto_tree_add_item(tree, hf_vnc_context_information_app_id, |
3252 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3253 | 0 | *offset += 4; |
3254 | |
|
3255 | 0 | proto_tree_add_item(tree, hf_vnc_context_information_app_trust_level, |
3256 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3257 | 0 | *offset += 2; |
3258 | |
|
3259 | 0 | proto_tree_add_item(tree, |
3260 | 0 | hf_vnc_context_information_content_trust_level, |
3261 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3262 | 0 | *offset += 2; |
3263 | |
|
3264 | 0 | proto_tree_add_item(tree, hf_vnc_context_information_app_category, |
3265 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3266 | 0 | *offset += 4; |
3267 | |
|
3268 | 0 | proto_tree_add_item(tree, hf_vnc_context_information_content_category, |
3269 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3270 | 0 | *offset += 4; |
3271 | |
|
3272 | 0 | proto_tree_add_item(tree, hf_vnc_context_information_content_rules, |
3273 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3274 | 0 | *offset += 4; |
3275 | |
|
3276 | 0 | return 0; /* bytes_needed */ |
3277 | 0 | } |
3278 | | |
3279 | | static unsigned |
3280 | | vnc_slrle_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
3281 | | proto_tree *tree, const uint16_t height) |
3282 | 0 | { |
3283 | 0 | uint8_t depth = vnc_get_depth(pinfo); |
3284 | 0 | uint8_t depth_mod = depth % 8; |
3285 | 0 | uint8_t bytes_per_run; |
3286 | 0 | uint16_t num_runs, i; |
3287 | 0 | unsigned length; |
3288 | 0 | proto_tree *sub_tree; |
3289 | |
|
3290 | 0 | if (depth_mod <= 4) |
3291 | 0 | bytes_per_run = ( 8 - depth_mod + depth) / 8; |
3292 | 0 | else |
3293 | 0 | bytes_per_run = (16 - depth_mod + depth) / 8; |
3294 | |
|
3295 | 0 | for (i = 0; i < height; i++) { |
3296 | 0 | VNC_BYTES_NEEDED(2); |
3297 | 0 | num_runs = tvb_get_ntohs(tvb, *offset); |
3298 | |
|
3299 | 0 | length = num_runs * bytes_per_run; |
3300 | |
|
3301 | 0 | sub_tree = proto_tree_add_subtree_format(tree, tvb, *offset, 2 + length, |
3302 | 0 | ett_vnc_slrle_subline, NULL, "Scanline #%d", i+1); |
3303 | |
|
3304 | 0 | proto_tree_add_item(sub_tree, hf_vnc_slrle_run_num, |
3305 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3306 | 0 | *offset += 2; |
3307 | |
|
3308 | 0 | VNC_BYTES_NEEDED(length); |
3309 | 0 | proto_tree_add_item(sub_tree, hf_vnc_slrle_run_data, |
3310 | 0 | tvb, *offset, length, ENC_NA); |
3311 | 0 | *offset += length; |
3312 | 0 | } |
3313 | | |
3314 | 0 | return 0; /* bytes_needed */ |
3315 | 0 | } |
3316 | | |
3317 | | static unsigned |
3318 | | vnc_h264_encoding(tvbuff_t *tvb, int *offset, proto_tree *tree) |
3319 | 0 | { |
3320 | 0 | uint32_t nbytes; |
3321 | |
|
3322 | 0 | VNC_BYTES_NEEDED(16); |
3323 | |
|
3324 | 0 | nbytes = tvb_get_ntohl(tvb, *offset); |
3325 | 0 | proto_tree_add_item(tree, hf_vnc_h264_nbytes, |
3326 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3327 | 0 | *offset += 4; |
3328 | | |
3329 | | /*0 == P-Frame; 1 == B-Frame; 2 == I-Frame*/ |
3330 | 0 | proto_tree_add_item(tree, hf_vnc_h264_slice_type, |
3331 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3332 | 0 | *offset += 4; |
3333 | |
|
3334 | 0 | proto_tree_add_item(tree, hf_vnc_h264_width, |
3335 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3336 | 0 | *offset += 4; |
3337 | |
|
3338 | 0 | proto_tree_add_item(tree, hf_vnc_h264_height, |
3339 | 0 | tvb, *offset, 4, ENC_BIG_ENDIAN); |
3340 | 0 | *offset += 4; |
3341 | |
|
3342 | 0 | VNC_BYTES_NEEDED(nbytes); |
3343 | 0 | proto_tree_add_item(tree, hf_vnc_h264_data, |
3344 | 0 | tvb, *offset, nbytes, ENC_NA); |
3345 | 0 | *offset += nbytes; |
3346 | |
|
3347 | 0 | return 0; /* bytes_needed */ |
3348 | 0 | } |
3349 | | |
3350 | | #if defined(HAVE_ZLIB) || defined(HAVE_ZLIBNG) |
3351 | | static unsigned |
3352 | | vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
3353 | | proto_tree *tree, const uint16_t width, const uint16_t height) |
3354 | | #else |
3355 | | static unsigned |
3356 | | vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo _U_, int *offset, |
3357 | | proto_tree *tree, const uint16_t width _U_, const uint16_t height _U_) |
3358 | | #endif |
3359 | 0 | { |
3360 | 0 | uint32_t data_len; |
3361 | 0 | #if defined (HAVE_ZLIB) || defined (HAVE_ZLIBNG) |
3362 | 0 | uint8_t palette_size; |
3363 | 0 | uint8_t bytes_per_cpixel = vnc_get_bytes_per_pixel(pinfo); |
3364 | 0 | int uncomp_offset = 0; |
3365 | 0 | unsigned length; |
3366 | 0 | int subencoding_type; |
3367 | 0 | tvbuff_t *uncomp_tvb; |
3368 | 0 | proto_tree *zrle_subencoding_tree; |
3369 | 0 | proto_item *ti; |
3370 | 0 | #endif |
3371 | |
|
3372 | 0 | VNC_BYTES_NEEDED(4); |
3373 | 0 | proto_tree_add_item(tree, hf_vnc_zrle_len, tvb, *offset, |
3374 | 0 | 4, ENC_BIG_ENDIAN); |
3375 | 0 | data_len = tvb_get_ntohl(tvb, *offset); |
3376 | |
|
3377 | 0 | *offset += 4; |
3378 | |
|
3379 | 0 | VNC_BYTES_NEEDED(data_len); |
3380 | |
|
3381 | 0 | proto_tree_add_item(tree, hf_vnc_zrle_data, tvb, *offset, |
3382 | 0 | data_len, ENC_NA); |
3383 | |
|
3384 | 0 | #if defined (HAVE_ZLIB) || defined (HAVE_ZLIBNG) |
3385 | 0 | uncomp_tvb = tvb_child_uncompress_zlib(tvb, tvb, *offset, data_len); |
3386 | |
|
3387 | 0 | if(uncomp_tvb != NULL) { |
3388 | 0 | add_new_data_source(pinfo, uncomp_tvb, |
3389 | 0 | "Uncompressed ZRLE data"); |
3390 | |
|
3391 | 0 | ti = proto_tree_add_item(tree, hf_vnc_zrle_subencoding, |
3392 | 0 | uncomp_tvb, uncomp_offset, 1, ENC_BIG_ENDIAN); |
3393 | 0 | zrle_subencoding_tree = |
3394 | 0 | proto_item_add_subtree(ti, ett_vnc_zrle_subencoding); |
3395 | |
|
3396 | 0 | proto_tree_add_item(zrle_subencoding_tree, hf_vnc_zrle_rle, |
3397 | 0 | uncomp_tvb, uncomp_offset, 1, ENC_BIG_ENDIAN); |
3398 | |
|
3399 | 0 | proto_tree_add_item(zrle_subencoding_tree, |
3400 | 0 | hf_vnc_zrle_palette_size, uncomp_tvb, |
3401 | 0 | uncomp_offset, 1, ENC_BIG_ENDIAN); |
3402 | |
|
3403 | 0 | subencoding_type = tvb_get_uint8(uncomp_tvb, uncomp_offset); |
3404 | 0 | palette_size = subencoding_type & 0x7F; |
3405 | |
|
3406 | 0 | uncomp_offset += 1; |
3407 | |
|
3408 | 0 | if(subencoding_type == 0) { /* Raw */ |
3409 | 0 | length = width * height * bytes_per_cpixel; |
3410 | 0 | VNC_BYTES_NEEDED(length); |
3411 | | |
3412 | | /* XXX - not working yet! */ |
3413 | |
|
3414 | 0 | proto_tree_add_item(zrle_subencoding_tree, |
3415 | 0 | hf_vnc_zrle_raw, uncomp_tvb, |
3416 | 0 | uncomp_offset, length, ENC_NA); |
3417 | |
|
3418 | 0 | } else if(subencoding_type >= 130 && subencoding_type <= 255) { |
3419 | 0 | length = palette_size * bytes_per_cpixel; |
3420 | 0 | VNC_BYTES_NEEDED(length); |
3421 | |
|
3422 | 0 | proto_tree_add_item(zrle_subencoding_tree, |
3423 | 0 | hf_vnc_zrle_palette, uncomp_tvb, |
3424 | 0 | uncomp_offset, length, ENC_NA); |
3425 | | |
3426 | | /* XXX - Not complete! */ |
3427 | 0 | } |
3428 | |
|
3429 | 0 | } else { |
3430 | 0 | proto_tree_add_expert(tree, pinfo, &ei_vnc_zrle_failed, tvb, *offset, data_len); |
3431 | 0 | } |
3432 | 0 | #endif /* HAVE_ZLIB */ |
3433 | | |
3434 | 0 | *offset += data_len; |
3435 | |
|
3436 | 0 | return 0; /* bytes_needed */ |
3437 | 0 | } |
3438 | | |
3439 | | |
3440 | | static unsigned |
3441 | | read_compact_len(tvbuff_t *tvb, int *offset, unsigned *length, unsigned *value_length) |
3442 | 0 | { |
3443 | 0 | int b; |
3444 | | |
3445 | | // A ENC_VARINT_PROTOBUF variant that always stops at the 3rd octet, |
3446 | | // even if its MSBit is 1. |
3447 | |
|
3448 | 0 | VNC_BYTES_NEEDED(1); |
3449 | |
|
3450 | 0 | *value_length = 0; |
3451 | |
|
3452 | 0 | b = tvb_get_uint8(tvb, *offset); |
3453 | 0 | *offset += 1; |
3454 | 0 | *value_length += 1; |
3455 | |
|
3456 | 0 | *length = b & 0x7f; |
3457 | 0 | if ((b & 0x80) != 0) { |
3458 | 0 | VNC_BYTES_NEEDED(1); |
3459 | |
|
3460 | 0 | b = tvb_get_uint8(tvb, *offset); |
3461 | 0 | *offset += 1; |
3462 | 0 | *value_length += 1; |
3463 | |
|
3464 | 0 | *length |= (b & 0x7f) << 7; |
3465 | |
|
3466 | 0 | if ((b & 0x80) != 0) { |
3467 | 0 | VNC_BYTES_NEEDED (1); |
3468 | |
|
3469 | 0 | b = tvb_get_uint8(tvb, *offset); |
3470 | 0 | *offset += 1; |
3471 | 0 | *value_length += 1; |
3472 | |
|
3473 | 0 | *length |= (b & 0xff) << 14; |
3474 | 0 | } |
3475 | 0 | } |
3476 | | |
3477 | 0 | return 0; |
3478 | 0 | } |
3479 | | |
3480 | | |
3481 | | static unsigned |
3482 | | process_compact_length_and_image_data(tvbuff_t *tvb, int *offset, proto_tree *tree) |
3483 | 0 | { |
3484 | 0 | unsigned bytes_needed; |
3485 | 0 | unsigned length, value_length; |
3486 | |
|
3487 | 0 | bytes_needed = read_compact_len (tvb, offset, &length, &value_length); |
3488 | 0 | if (bytes_needed != 0) |
3489 | 0 | return bytes_needed; |
3490 | | |
3491 | 0 | proto_tree_add_uint(tree, hf_vnc_tight_image_len, tvb, *offset - value_length, value_length, length); |
3492 | |
|
3493 | 0 | VNC_BYTES_NEEDED(length); |
3494 | 0 | proto_tree_add_item(tree, hf_vnc_tight_image_data, tvb, *offset, length, ENC_NA); |
3495 | 0 | *offset += length; |
3496 | |
|
3497 | 0 | return 0; /* bytes_needed */ |
3498 | 0 | } |
3499 | | |
3500 | | |
3501 | | static unsigned |
3502 | | process_tight_rect_filter_palette(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
3503 | | proto_tree *tree, int *bits_per_pixel) |
3504 | 0 | { |
3505 | 0 | vnc_packet_t *per_packet_info; |
3506 | 0 | int num_colors; |
3507 | 0 | unsigned palette_bytes; |
3508 | | |
3509 | | /* See TightVNC's vnc_unixsrc/vncviewer/tight.c:InitFilterPaletteBPP() */ |
3510 | |
|
3511 | 0 | per_packet_info = (vnc_packet_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0); |
3512 | | /* Our calling function should have set the packet's proto data already */ |
3513 | 0 | DISSECTOR_ASSERT(per_packet_info != NULL); |
3514 | |
|
3515 | 0 | VNC_BYTES_NEEDED(1); |
3516 | 0 | proto_tree_add_item(tree, hf_vnc_tight_palette_num_colors, tvb, *offset, 1, ENC_BIG_ENDIAN); |
3517 | 0 | num_colors = tvb_get_uint8(tvb, *offset); |
3518 | 0 | *offset += 1; |
3519 | |
|
3520 | 0 | num_colors++; |
3521 | 0 | if (num_colors < 2) |
3522 | 0 | return 0; |
3523 | | |
3524 | 0 | if (per_packet_info->depth == 24) |
3525 | 0 | palette_bytes = num_colors * 3; |
3526 | 0 | else |
3527 | 0 | palette_bytes = num_colors * per_packet_info->depth / 8; |
3528 | |
|
3529 | 0 | VNC_BYTES_NEEDED(palette_bytes); |
3530 | 0 | proto_tree_add_item(tree, hf_vnc_tight_palette_data, tvb, *offset, palette_bytes, ENC_NA); |
3531 | 0 | *offset += palette_bytes; |
3532 | | |
3533 | | /* This is the number of bits per pixel *in the image data*, not the actual client depth */ |
3534 | 0 | if (num_colors == 2) |
3535 | 0 | *bits_per_pixel = 1; |
3536 | 0 | else |
3537 | 0 | *bits_per_pixel = 8; |
3538 | |
|
3539 | 0 | return 0; |
3540 | 0 | } |
3541 | | |
3542 | | static unsigned |
3543 | | vnc_tight_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
3544 | | proto_tree *tree, const uint16_t width _U_, const uint16_t height _U_) |
3545 | 0 | { |
3546 | 0 | vnc_packet_t *per_packet_info; |
3547 | 0 | uint8_t comp_ctl; |
3548 | 0 | proto_item *compression_type_ti; |
3549 | 0 | int bit_offset; |
3550 | 0 | int bytes_needed = -1; |
3551 | |
|
3552 | 0 | per_packet_info = (vnc_packet_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0); |
3553 | | /* Our calling function should have set the packet's proto data already */ |
3554 | 0 | DISSECTOR_ASSERT(per_packet_info != NULL); |
3555 | | |
3556 | | /* See xserver/hw/vnc/rfbproto.h and grep for "Tight Encoding." for the following layout */ |
3557 | |
|
3558 | 0 | VNC_BYTES_NEEDED(1); |
3559 | | |
3560 | | /* least significant bits 0-3 are "reset compression stream N" */ |
3561 | 0 | bit_offset = *offset * 8; |
3562 | 0 | proto_tree_add_bits_item(tree, hf_vnc_tight_reset_stream0, tvb, bit_offset + 7, 1, ENC_BIG_ENDIAN); |
3563 | 0 | proto_tree_add_bits_item(tree, hf_vnc_tight_reset_stream1, tvb, bit_offset + 6, 1, ENC_BIG_ENDIAN); |
3564 | 0 | proto_tree_add_bits_item(tree, hf_vnc_tight_reset_stream2, tvb, bit_offset + 5, 1, ENC_BIG_ENDIAN); |
3565 | 0 | proto_tree_add_bits_item(tree, hf_vnc_tight_reset_stream3, tvb, bit_offset + 4, 1, ENC_BIG_ENDIAN); |
3566 | | |
3567 | | /* most significant bits 4-7 are "compression type" */ |
3568 | 0 | compression_type_ti = proto_tree_add_bits_item(tree, hf_vnc_tight_rect_type, tvb, bit_offset + 0, 4, ENC_BIG_ENDIAN); |
3569 | |
|
3570 | 0 | comp_ctl = tvb_get_uint8(tvb, *offset); |
3571 | 0 | *offset += 1; |
3572 | |
|
3573 | 0 | comp_ctl >>= 4; /* skip over the "reset compression" bits from above */ |
3574 | | |
3575 | | /* compression format */ |
3576 | |
|
3577 | 0 | if (comp_ctl == TIGHT_RECT_FILL) { |
3578 | | /* "fill" encoding (solid rectangle) */ |
3579 | |
|
3580 | 0 | proto_item_append_text(compression_type_ti, " (fill encoding - solid rectangle)"); |
3581 | |
|
3582 | 0 | if (per_packet_info->depth == 24) { |
3583 | 0 | VNC_BYTES_NEEDED(3); |
3584 | 0 | proto_tree_add_item(tree, hf_vnc_tight_fill_color, tvb, *offset, 3, ENC_NA); |
3585 | 0 | *offset += 3; |
3586 | 0 | } else { |
3587 | 0 | VNC_BYTES_NEEDED(per_packet_info->bytes_per_pixel); |
3588 | 0 | proto_tree_add_item(tree, hf_vnc_tight_fill_color, tvb, *offset, per_packet_info->bytes_per_pixel, ENC_NA); |
3589 | 0 | *offset += per_packet_info->bytes_per_pixel; |
3590 | 0 | } |
3591 | | |
3592 | 0 | bytes_needed = 0; |
3593 | 0 | } else if (comp_ctl == TIGHT_RECT_JPEG) { |
3594 | | /* jpeg encoding */ |
3595 | |
|
3596 | 0 | proto_item_append_text(compression_type_ti, " (JPEG encoding)"); |
3597 | 0 | bytes_needed = process_compact_length_and_image_data(tvb, offset, tree); |
3598 | 0 | if (bytes_needed != 0) |
3599 | 0 | return bytes_needed; |
3600 | 0 | } else if (comp_ctl > TIGHT_RECT_MAX_VALUE) { |
3601 | | /* invalid encoding */ |
3602 | |
|
3603 | 0 | expert_add_info(pinfo, compression_type_ti, &ei_vnc_invalid_encoding); |
3604 | 0 | } else { |
3605 | 0 | unsigned row_size; |
3606 | 0 | int bits_per_pixel; |
3607 | | |
3608 | | /* basic encoding */ |
3609 | |
|
3610 | 0 | proto_item_append_text(compression_type_ti, " (basic encoding)"); |
3611 | |
|
3612 | 0 | proto_tree_add_bits_item(tree, hf_vnc_tight_filter_flag, tvb, bit_offset + 1, 1, ENC_BIG_ENDIAN); |
3613 | |
|
3614 | 0 | bits_per_pixel = per_packet_info->depth; |
3615 | |
|
3616 | 0 | if ((comp_ctl & TIGHT_RECT_EXPLICIT_FILTER_FLAG) != 0) { |
3617 | 0 | uint8_t filter_id; |
3618 | | |
3619 | | /* explicit filter */ |
3620 | |
|
3621 | 0 | VNC_BYTES_NEEDED(1); |
3622 | 0 | proto_tree_add_item(tree, hf_vnc_tight_filter_id, tvb, *offset, 1, ENC_BIG_ENDIAN); |
3623 | 0 | filter_id = tvb_get_uint8(tvb, *offset); |
3624 | 0 | *offset += 1; |
3625 | |
|
3626 | 0 | switch (filter_id) { |
3627 | 0 | case TIGHT_RECT_FILTER_COPY: |
3628 | | /* nothing to do */ |
3629 | 0 | break; |
3630 | | |
3631 | 0 | case TIGHT_RECT_FILTER_PALETTE: |
3632 | 0 | bytes_needed = process_tight_rect_filter_palette(tvb, pinfo, offset, tree, &bits_per_pixel); |
3633 | 0 | if (bytes_needed != 0) |
3634 | 0 | return bytes_needed; |
3635 | | |
3636 | 0 | break; |
3637 | | |
3638 | 0 | case TIGHT_RECT_FILTER_GRADIENT: |
3639 | | /* nothing to do */ |
3640 | 0 | break; |
3641 | 0 | } |
3642 | 0 | } else { |
3643 | | /* this is the same case as TIGHT_RECT_FILTER_COPY, so there's nothing special to do */ |
3644 | 0 | } |
3645 | | |
3646 | 0 | row_size = ((unsigned) width * bits_per_pixel + 7) / 8; |
3647 | 0 | if (row_size * height < TIGHT_MIN_BYTES_TO_COMPRESS) { |
3648 | 0 | unsigned num_bytes; |
3649 | | |
3650 | | /* The data is not compressed; just skip over it */ |
3651 | |
|
3652 | 0 | num_bytes = row_size * height; |
3653 | 0 | VNC_BYTES_NEEDED(num_bytes); |
3654 | 0 | proto_tree_add_item(tree, hf_vnc_tight_image_data, tvb, *offset, num_bytes, ENC_NA); |
3655 | 0 | *offset += num_bytes; |
3656 | |
|
3657 | 0 | bytes_needed = 0; |
3658 | 0 | } else { |
3659 | | /* The data is compressed; read its length and data */ |
3660 | 0 | bytes_needed = process_compact_length_and_image_data(tvb, offset, tree); |
3661 | 0 | if (bytes_needed != 0) |
3662 | 0 | return bytes_needed; |
3663 | 0 | } |
3664 | 0 | } |
3665 | | |
3666 | 0 | DISSECTOR_ASSERT(bytes_needed != -1); |
3667 | |
|
3668 | 0 | return bytes_needed; |
3669 | 0 | } |
3670 | | |
3671 | | |
3672 | | static unsigned |
3673 | | decode_cursor(tvbuff_t *tvb, int *offset, proto_tree *tree, |
3674 | | unsigned pixels_bytes, unsigned mask_bytes) |
3675 | 0 | { |
3676 | 0 | unsigned total_bytes; |
3677 | |
|
3678 | 0 | total_bytes = pixels_bytes + mask_bytes; |
3679 | 0 | VNC_BYTES_NEEDED (total_bytes); |
3680 | |
|
3681 | 0 | proto_tree_add_item(tree, hf_vnc_cursor_encoding_pixels, tvb, *offset, |
3682 | 0 | pixels_bytes, ENC_NA); |
3683 | 0 | *offset += pixels_bytes; |
3684 | |
|
3685 | 0 | proto_tree_add_item(tree, hf_vnc_cursor_encoding_bitmask, tvb, *offset, |
3686 | 0 | mask_bytes, ENC_NA); |
3687 | 0 | *offset += mask_bytes; |
3688 | |
|
3689 | 0 | return 0; /* bytes_needed */ |
3690 | 0 | } |
3691 | | |
3692 | | |
3693 | | static unsigned |
3694 | | vnc_rich_cursor_encoding(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
3695 | | proto_tree *tree, const uint16_t width, const uint16_t height) |
3696 | 0 | { |
3697 | 0 | uint8_t bytes_per_pixel = vnc_get_bytes_per_pixel(pinfo); |
3698 | 0 | unsigned pixels_bytes, mask_bytes; |
3699 | |
|
3700 | 0 | pixels_bytes = width * height * bytes_per_pixel; |
3701 | 0 | mask_bytes = ((width + 7) / 8) * height; |
3702 | |
|
3703 | 0 | return decode_cursor(tvb, offset, tree, |
3704 | 0 | pixels_bytes, mask_bytes); |
3705 | 0 | } |
3706 | | |
3707 | | |
3708 | | static unsigned |
3709 | | vnc_x_cursor_encoding(tvbuff_t *tvb, packet_info *pinfo _U_, int *offset, |
3710 | | proto_tree *tree, const uint16_t width, const uint16_t height) |
3711 | 0 | { |
3712 | 0 | int bitmap_row_bytes = (width + 7) / 8; |
3713 | 0 | int mask_bytes = bitmap_row_bytes * height; |
3714 | |
|
3715 | 0 | VNC_BYTES_NEEDED (6); |
3716 | 0 | proto_tree_add_item(tree, hf_vnc_cursor_x_fore_back, tvb, *offset, 6, ENC_NA); |
3717 | 0 | *offset += 6; |
3718 | | |
3719 | | /* The length of the pixel data is the same as the length of the mask data (X cursors are strictly black/white) */ |
3720 | 0 | return decode_cursor(tvb, offset, tree, |
3721 | 0 | mask_bytes, mask_bytes); |
3722 | 0 | } |
3723 | | |
3724 | | |
3725 | | static unsigned |
3726 | | vnc_server_set_colormap_entries(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
3727 | | proto_tree *tree) |
3728 | 0 | { |
3729 | 0 | uint16_t number_of_colors; |
3730 | 0 | unsigned counter, bytes_needed; |
3731 | 0 | proto_item *ti; |
3732 | 0 | proto_tree *vnc_colormap_num_groups, *vnc_colormap_color_group; |
3733 | |
|
3734 | 0 | col_append_sep_str(pinfo->cinfo, COL_INFO, "; ", "Server set colormap entries"); |
3735 | |
|
3736 | 0 | number_of_colors = tvb_get_ntohs(tvb, 4); |
3737 | |
|
3738 | 0 | VNC_BYTES_NEEDED(3); |
3739 | 0 | proto_tree_add_item(tree, hf_vnc_padding, tvb, *offset, 1, ENC_NA); |
3740 | 0 | *offset += 1; /* Skip over 1 byte of padding */ |
3741 | |
|
3742 | 0 | proto_tree_add_item(tree, hf_vnc_colormap_first_color, |
3743 | 0 | tvb, *offset, 2, ENC_BIG_ENDIAN); |
3744 | 0 | *offset += 2; |
3745 | | |
3746 | | /* XXX - this is 3 bytes into the tvb, but number_of_colors is set off |
3747 | | * of 4 bytes in... Bug??? |
3748 | | */ |
3749 | 0 | ti = proto_tree_add_item(tree, hf_vnc_colormap_num_colors, tvb, |
3750 | 0 | *offset, 2, ENC_BIG_ENDIAN); |
3751 | |
|
3752 | 0 | if (number_of_colors > 10000) { |
3753 | 0 | expert_add_info_format(pinfo, ti, &ei_vnc_too_many_colors,"Too many colors (%d), aborting dissection", |
3754 | 0 | number_of_colors); |
3755 | 0 | return 0; |
3756 | 0 | } |
3757 | | |
3758 | 0 | bytes_needed = (number_of_colors * 6) + 5; |
3759 | 0 | VNC_BYTES_NEEDED(bytes_needed); |
3760 | |
|
3761 | 0 | *offset += 2; |
3762 | |
|
3763 | 0 | ti = proto_tree_add_item(tree, hf_vnc_color_groups, tvb, |
3764 | 0 | *offset, number_of_colors * 6, ENC_NA); |
3765 | 0 | vnc_colormap_num_groups = |
3766 | 0 | proto_item_add_subtree(ti, ett_vnc_colormap_num_groups); |
3767 | |
|
3768 | 0 | for(counter = 0; counter < number_of_colors; counter++) { |
3769 | 0 | vnc_colormap_color_group = proto_tree_add_subtree_format(vnc_colormap_num_groups, tvb, |
3770 | 0 | *offset, 6, ett_vnc_colormap_color_group, NULL, |
3771 | 0 | "Color group #%d", counter+1); |
3772 | |
|
3773 | 0 | proto_tree_add_item(vnc_colormap_color_group, |
3774 | 0 | hf_vnc_colormap_red, tvb, |
3775 | 0 | *offset, 2, ENC_BIG_ENDIAN); |
3776 | 0 | *offset += 2; |
3777 | |
|
3778 | 0 | proto_tree_add_item(vnc_colormap_color_group, |
3779 | 0 | hf_vnc_colormap_green, tvb, |
3780 | 0 | *offset, 2, ENC_BIG_ENDIAN); |
3781 | 0 | *offset += 2; |
3782 | |
|
3783 | 0 | proto_tree_add_item(vnc_colormap_color_group, |
3784 | 0 | hf_vnc_colormap_blue, tvb, |
3785 | 0 | *offset, 2, ENC_BIG_ENDIAN); |
3786 | 0 | *offset += 2; |
3787 | 0 | } |
3788 | 0 | return 0; |
3789 | 0 | } |
3790 | | |
3791 | | |
3792 | | static void |
3793 | | vnc_server_ring_bell(tvbuff_t *tvb _U_, packet_info *pinfo, int *offset _U_, |
3794 | | proto_tree *tree _U_) |
3795 | 0 | { |
3796 | 0 | col_append_sep_str(pinfo->cinfo, COL_INFO, "; ", "Server ring bell on client"); |
3797 | | /* This message type has no payload... */ |
3798 | 0 | } |
3799 | | |
3800 | | |
3801 | | static unsigned |
3802 | | vnc_server_cut_text(tvbuff_t *tvb, packet_info *pinfo, int *offset, |
3803 | | proto_tree *tree) |
3804 | 0 | { |
3805 | 0 | uint32_t text_len; |
3806 | 0 | proto_item *pi; |
3807 | |
|
3808 | 0 | col_append_sep_str(pinfo->cinfo, COL_INFO, "; ", "Server cut text"); |
3809 | |
|
3810 | 0 | text_len = tvb_get_ntohl(tvb, *offset); |
3811 | 0 | pi = proto_tree_add_item(tree, hf_vnc_server_cut_text_len, tvb, *offset, 4, |
3812 | 0 | ENC_BIG_ENDIAN); |
3813 | 0 | *offset += 4; |
3814 | |
|
3815 | 0 | if (text_len > 100000) { |
3816 | 0 | expert_add_info_format(pinfo, pi, &ei_vnc_too_many_cut_text, |
3817 | 0 | "Too much cut text (%d), aborting dissection", text_len); |
3818 | 0 | return 0; |
3819 | 0 | } |
3820 | | |
3821 | 0 | VNC_BYTES_NEEDED(text_len); |
3822 | |
|
3823 | 0 | proto_tree_add_item(tree, hf_vnc_server_cut_text, tvb, *offset, |
3824 | 0 | text_len, ENC_ASCII); |
3825 | 0 | *offset += text_len; |
3826 | |
|
3827 | 0 | return *offset; |
3828 | 0 | } |
3829 | | |
3830 | | |
3831 | | static void |
3832 | | vnc_set_bytes_per_pixel(packet_info *pinfo, vnc_conversation_t *per_conversation_info, const uint8_t bytes_per_pixel) |
3833 | 0 | { |
3834 | 0 | if (PINFO_FD_VISITED(pinfo)) { |
3835 | 0 | return; |
3836 | 0 | } |
3837 | | |
3838 | 0 | vnc_packet_t *per_packet_info; |
3839 | |
|
3840 | 0 | per_packet_info = (vnc_packet_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0); |
3841 | | /* Our calling function should have set the packet's proto data already */ |
3842 | 0 | DISSECTOR_ASSERT(per_packet_info != NULL); |
3843 | |
|
3844 | 0 | per_packet_info->bytes_per_pixel = per_conversation_info->bytes_per_pixel = bytes_per_pixel; |
3845 | 0 | } |
3846 | | |
3847 | | |
3848 | | static void |
3849 | | vnc_set_depth(packet_info *pinfo, vnc_conversation_t *per_conversation_info, const uint8_t depth) |
3850 | 0 | { |
3851 | 0 | if (PINFO_FD_VISITED(pinfo)) { |
3852 | 0 | return; |
3853 | 0 | } |
3854 | | |
3855 | 0 | vnc_packet_t *per_packet_info; |
3856 | |
|
3857 | 0 | per_packet_info = (vnc_packet_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0); |
3858 | | /* Our calling function should have set the packet's proto data already */ |
3859 | 0 | DISSECTOR_ASSERT(per_packet_info != NULL); |
3860 | |
|
3861 | 0 | per_packet_info->depth = per_conversation_info->depth = depth; |
3862 | 0 | } |
3863 | | |
3864 | | |
3865 | | static uint8_t |
3866 | | vnc_get_bytes_per_pixel(packet_info *pinfo) |
3867 | 0 | { |
3868 | 0 | vnc_packet_t *per_packet_info; |
3869 | |
|
3870 | 0 | per_packet_info = (vnc_packet_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0); |
3871 | | /* Our calling function should have set the packet's proto data already */ |
3872 | 0 | DISSECTOR_ASSERT(per_packet_info != NULL); |
3873 | |
|
3874 | 0 | return per_packet_info->bytes_per_pixel; |
3875 | 0 | } |
3876 | | |
3877 | | |
3878 | | static uint8_t |
3879 | | vnc_get_depth(packet_info *pinfo) |
3880 | 0 | { |
3881 | 0 | vnc_packet_t *per_packet_info; |
3882 | |
|
3883 | 0 | per_packet_info = (vnc_packet_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0); |
3884 | | /* Our calling function should have set the packet's proto data already */ |
3885 | 0 | DISSECTOR_ASSERT(per_packet_info != NULL); |
3886 | |
|
3887 | 0 | return per_packet_info->depth; |
3888 | 0 | } |
3889 | | |
3890 | | /* Preference callbacks */ |
3891 | | static void |
3892 | 0 | apply_vnc_prefs(void) { |
3893 | 0 | vnc_tcp_range = prefs_get_range_value("vnc", "tcp.port"); |
3894 | 0 | } |
3895 | | |
3896 | | /* Register the protocol with Wireshark */ |
3897 | | void |
3898 | | proto_register_vnc(void) |
3899 | 14 | { |
3900 | 14 | module_t *vnc_module; /* To handle our preferences */ |
3901 | 14 | expert_module_t* expert_vnc; |
3902 | | |
3903 | | /* Setup list of header fields */ |
3904 | 14 | static hf_register_info hf[] = { |
3905 | 14 | { &hf_vnc_padding, |
3906 | 14 | { "Padding", "vnc.padding", |
3907 | 14 | FT_NONE, BASE_NONE, NULL, 0x0, |
3908 | 14 | "Unused space", HFILL } |
3909 | 14 | }, |
3910 | | |
3911 | 14 | { &hf_vnc_server_proto_ver, |
3912 | 14 | { "Server protocol version", "vnc.server_proto_ver", |
3913 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
3914 | 14 | "VNC protocol version on server", HFILL } |
3915 | 14 | }, |
3916 | 14 | { &hf_vnc_client_proto_ver, |
3917 | 14 | { "Client protocol version", "vnc.client_proto_ver", |
3918 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
3919 | 14 | "VNC protocol version on client", HFILL } |
3920 | 14 | }, |
3921 | 14 | { &hf_vnc_num_security_types, |
3922 | 14 | { "Number of security types", "vnc.num_security_types", |
3923 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
3924 | 14 | "Number of security (authentication) types supported by the server", HFILL } |
3925 | 14 | }, |
3926 | 14 | { &hf_vnc_security_type, |
3927 | 14 | { "Security type", "vnc.security_type", |
3928 | 14 | FT_UINT8, BASE_DEC, VALS(vnc_security_types_vs), 0x0, |
3929 | 14 | "Security types offered by the server (VNC versions => 3.007)", HFILL } |
3930 | 14 | }, |
3931 | 14 | { &hf_vnc_server_security_type, |
3932 | 14 | { "Security type", "vnc.server_security_type", |
3933 | 14 | FT_UINT32, BASE_DEC, VALS(vnc_security_types_vs), 0x0, |
3934 | 14 | "Security type mandated by the server", HFILL } |
3935 | 14 | }, |
3936 | 14 | { &hf_vnc_client_security_type, |
3937 | 14 | { "Security type selected", "vnc.client_security_type", |
3938 | 14 | FT_UINT8, BASE_DEC, VALS(vnc_security_types_vs), 0x0, |
3939 | 14 | "Security type selected by the client", HFILL } |
3940 | 14 | }, |
3941 | 14 | { &hf_vnc_tight_num_tunnel_types, |
3942 | 14 | { "Number of supported tunnel types", "vnc.num_tunnel_types", |
3943 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
3944 | 14 | "Number of tunnel types for TightVNC", HFILL } |
3945 | 14 | }, |
3946 | 14 | { &hf_vnc_tight_tunnel_type_code, |
3947 | 14 | { "Tunnel type code", "vnc.tunnel_type_code", |
3948 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
3949 | 14 | "Tunnel type code specific to TightVNC", HFILL } |
3950 | 14 | }, |
3951 | 14 | { &hf_vnc_tight_tunnel_type_vendor, |
3952 | 14 | { "Tunnel type vendor", "vnc.tunnel_type_vendor", |
3953 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
3954 | 14 | "Tunnel type vendor specific to TightVNC", HFILL } |
3955 | 14 | }, |
3956 | 14 | { &hf_vnc_tight_tunnel_type_signature, |
3957 | 14 | { "Tunnel type signature", "vnc.tunnel_type_signature", |
3958 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
3959 | 14 | "Tunnel type signature specific to TightVNC", HFILL } |
3960 | 14 | }, |
3961 | 14 | { &hf_vnc_tight_num_auth_types, |
3962 | 14 | { "Number of supported authentication types", "vnc.num_auth_types", |
3963 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
3964 | 14 | "Authentication types specific to TightVNC", HFILL } |
3965 | 14 | }, |
3966 | 14 | { &hf_vnc_tight_auth_code, |
3967 | 14 | { "Authentication code", "vnc.tight_auth_code", |
3968 | 14 | FT_UINT32, BASE_DEC, VALS(vnc_security_types_vs), 0x0, |
3969 | 14 | "Authentication code specific to TightVNC", HFILL } |
3970 | 14 | }, |
3971 | 14 | { &hf_vnc_tight_server_message_type, |
3972 | 14 | { "Server message type (TightVNC)", "vnc.tight_server_message_type", |
3973 | 14 | FT_INT32, BASE_DEC, NULL, 0x0, |
3974 | 14 | "Server message type specific to TightVNC", HFILL } |
3975 | 14 | }, |
3976 | 14 | { &hf_vnc_tight_server_vendor, |
3977 | 14 | { "Server vendor code", "vnc.server_vendor", |
3978 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
3979 | 14 | "Server vendor code specific to TightVNC", HFILL } |
3980 | 14 | }, |
3981 | 14 | { &hf_vnc_tight_signature, |
3982 | 14 | { "Signature", "vnc.signature", |
3983 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
3984 | 14 | NULL, HFILL } |
3985 | 14 | }, |
3986 | 14 | { &hf_vnc_tight_server_name, |
3987 | 14 | { "Server name", "vnc.server_name", |
3988 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
3989 | 14 | "Server name specific to TightVNC", HFILL } |
3990 | 14 | }, |
3991 | 14 | { &hf_vnc_tight_client_message_type, |
3992 | 14 | { "Client message type (TightVNC)", "vnc.tight_client_message_type", |
3993 | 14 | FT_INT32, BASE_DEC, NULL, 0x0, |
3994 | 14 | "Client message type specific to TightVNC", HFILL } |
3995 | 14 | }, |
3996 | 14 | { &hf_vnc_tight_client_vendor, |
3997 | 14 | { "Client vendor code", "vnc.client_vendor", |
3998 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
3999 | 14 | "Client vendor code specific to TightVNC", HFILL } |
4000 | 14 | }, |
4001 | 14 | { &hf_vnc_tight_client_name, |
4002 | 14 | { "Client name", "vnc.client_name", |
4003 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4004 | 14 | "Client name specific to TightVNC", HFILL } |
4005 | 14 | }, |
4006 | 14 | { &hf_vnc_tight_encoding_type, |
4007 | 14 | { "Encoding type", "vnc.encoding_type", |
4008 | 14 | FT_INT32, BASE_DEC, VALS(encoding_types_vs), 0x0, |
4009 | 14 | "Encoding type specific to TightVNC", HFILL } |
4010 | 14 | }, |
4011 | 14 | { &hf_vnc_tight_encoding_vendor, |
4012 | 14 | { "Encoding vendor code", "vnc.encoding_vendor", |
4013 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4014 | 14 | "Encoding vendor code specific to TightVNC", HFILL } |
4015 | 14 | }, |
4016 | 14 | { &hf_vnc_tight_encoding_name, |
4017 | 14 | { "Encoding name", "vnc.encoding_name", |
4018 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4019 | 14 | "Encoding name specific to TightVNC", HFILL } |
4020 | 14 | }, |
4021 | 14 | { &hf_vnc_tight_reset_stream0, |
4022 | 14 | { "Reset compression stream 0", "vnc.tight_reset_stream0", |
4023 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4024 | 14 | "Tight compression, reset compression stream 0", HFILL } |
4025 | 14 | }, |
4026 | 14 | { &hf_vnc_tight_reset_stream1, |
4027 | 14 | { "Reset compression stream 1", "vnc.tight_reset_stream1", |
4028 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4029 | 14 | "Tight compression, reset compression stream 1", HFILL } |
4030 | 14 | }, |
4031 | 14 | { &hf_vnc_tight_reset_stream2, |
4032 | 14 | { "Reset compression stream 2", "vnc.tight_reset_stream2", |
4033 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4034 | 14 | "Tight compression, reset compression stream 2", HFILL } |
4035 | 14 | }, |
4036 | 14 | { &hf_vnc_tight_reset_stream3, |
4037 | 14 | { "Reset compression stream 3", "vnc.tight_reset_stream3", |
4038 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4039 | 14 | "Tight compression, reset compression stream 3", HFILL } |
4040 | 14 | }, |
4041 | 14 | { &hf_vnc_tight_rect_type, |
4042 | 14 | { "Rectangle type", "vnc.tight_rect_type", |
4043 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
4044 | 14 | "Tight compression, rectangle type", HFILL } |
4045 | 14 | }, |
4046 | 14 | { &hf_vnc_tight_image_len, |
4047 | 14 | { "Image data length", "vnc.tight_image_len", |
4048 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4049 | 14 | "Tight compression, length of image data", HFILL } |
4050 | 14 | }, |
4051 | 14 | { &hf_vnc_tight_image_data, |
4052 | 14 | { "Image data", "vnc.tight_image_data", |
4053 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4054 | 14 | "Tight compression, image data", HFILL } |
4055 | 14 | }, |
4056 | 14 | { &hf_vnc_tight_fill_color, |
4057 | 14 | { "Fill color (RGB)", "vnc.tight_fill_color", |
4058 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4059 | 14 | "Tight compression, fill color for solid rectangle", HFILL } |
4060 | 14 | }, |
4061 | 14 | { &hf_vnc_tight_filter_flag, |
4062 | 14 | { "Explicit filter flag", "vnc.tight_filter_flag", |
4063 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4064 | 14 | "Tight compression, explicit filter flag", HFILL } |
4065 | 14 | }, |
4066 | 14 | { &hf_vnc_tight_filter_id, |
4067 | 14 | { "Filter ID", "vnc.tight_filter_id", |
4068 | 14 | FT_UINT8, BASE_DEC, VALS(tight_filter_ids_vs), 0x0, |
4069 | 14 | "Tight compression, filter ID", HFILL } |
4070 | 14 | }, |
4071 | 14 | { &hf_vnc_tight_palette_num_colors, |
4072 | 14 | { "Number of colors in palette", "vnc.tight_palette_num_colors", |
4073 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4074 | 14 | "Tight compression, number of colors in rectangle's palette", HFILL } |
4075 | 14 | }, |
4076 | 14 | { &hf_vnc_tight_palette_data, |
4077 | 14 | { "Palette data", "vnc.tight_palette_data", |
4078 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4079 | 14 | "Tight compression, palette data for a rectangle", HFILL } |
4080 | 14 | }, |
4081 | 14 | { &hf_vnc_auth_challenge, |
4082 | 14 | { "Authentication challenge", "vnc.auth_challenge", |
4083 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4084 | 14 | "Random authentication challenge from server to client", HFILL } |
4085 | 14 | }, |
4086 | 14 | { &hf_vnc_auth_response, |
4087 | 14 | { "Authentication response", "vnc.auth_response", |
4088 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4089 | 14 | "Client's encrypted response to the server's authentication challenge", HFILL } |
4090 | 14 | }, |
4091 | 14 | { &hf_vnc_auth_result, |
4092 | 14 | { "Authentication result", "vnc.auth_result", |
4093 | 14 | FT_BOOLEAN, 32, TFS(&auth_result_tfs), 0x1, |
4094 | 14 | NULL, HFILL } |
4095 | 14 | }, |
4096 | 14 | { &hf_vnc_auth_error_length, |
4097 | 14 | { "Length of authentication error", "vnc.auth_error_len", |
4098 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4099 | 14 | "Authentication error length (present only if the authentication result is fail)", HFILL } |
4100 | 14 | }, |
4101 | 14 | { &hf_vnc_auth_error, |
4102 | 14 | { "Authentication error", "vnc.auth_error", |
4103 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4104 | 14 | "Authentication error (present only if the authentication result is fail)", HFILL } |
4105 | 14 | }, |
4106 | 14 | { &hf_vnc_ard_auth_generator, |
4107 | 14 | { "Generator", "vnc.ard_auth_generator", |
4108 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4109 | 14 | "Generator for Diffie-Hellman key exchange", HFILL } |
4110 | 14 | }, |
4111 | 14 | { &hf_vnc_ard_auth_key_len, |
4112 | 14 | { "Key length", "vnc.ard_auth_key_len", |
4113 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4114 | 14 | "Diffie-Hellman key length", HFILL } |
4115 | 14 | }, |
4116 | 14 | { &hf_vnc_ard_auth_modulus, |
4117 | 14 | { "Prime modulus", "vnc.ard_auth_modulus", |
4118 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4119 | 14 | "Prime modulus for Diffie-Hellman key exchange", HFILL } |
4120 | 14 | }, |
4121 | 14 | { &hf_vnc_ard_auth_server_key, |
4122 | 14 | { "Server public key", "vnc.ard_auth_server_key", |
4123 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4124 | 14 | "Server's public Diffie-Hellman key", HFILL } |
4125 | 14 | }, |
4126 | 14 | { &hf_vnc_ard_auth_credentials, |
4127 | 14 | { "Encrypted credentials", "vnc.ard_auth_credentials", |
4128 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4129 | 14 | "Encrypted client username and password", HFILL } |
4130 | 14 | }, |
4131 | 14 | { &hf_vnc_ard_auth_client_key, |
4132 | 14 | { "Client public key", "vnc.ard_auth_client_key", |
4133 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4134 | 14 | "Client's public Diffie-Hellman key", HFILL } |
4135 | 14 | }, |
4136 | 14 | { &hf_vnc_vencrypt_server_major_ver, |
4137 | 14 | { "VeNCrypt server major version", "vnc.vencrypt_server_major_ver", |
4138 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4139 | 14 | NULL, HFILL } |
4140 | 14 | }, |
4141 | 14 | { &hf_vnc_vencrypt_server_minor_ver, |
4142 | 14 | { "VeNCrypt server minor version", "vnc.vencrypt_server_minor_ver", |
4143 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4144 | 14 | NULL, HFILL } |
4145 | 14 | }, |
4146 | 14 | { &hf_vnc_vencrypt_client_major_ver, |
4147 | 14 | { "VeNCrypt client major version", "vnc.vencrypt_client_major_ver", |
4148 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4149 | 14 | NULL, HFILL } |
4150 | 14 | }, |
4151 | 14 | { &hf_vnc_vencrypt_client_minor_ver, |
4152 | 14 | { "VeNCrypt client minor version", "vnc.vencrypt_client_minor_ver", |
4153 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4154 | 14 | NULL, HFILL } |
4155 | 14 | }, |
4156 | 14 | { &hf_vnc_vencrypt_version_ack, |
4157 | 14 | { "VeNCrypt version ack", "vnc.vencrypt_version_ack", |
4158 | 14 | FT_BOOLEAN, 8, TFS(&tfs_error_ok), 0xFF, |
4159 | 14 | NULL, HFILL } |
4160 | 14 | }, |
4161 | 14 | { &hf_vnc_vencrypt_auth_type, |
4162 | 14 | { "VeNCrypt authentication type", "vnc.vencrypt_auth_type", |
4163 | 14 | FT_UINT32, BASE_DEC, VALS(vnc_vencrypt_auth_types_vs), 0x0, |
4164 | 14 | "Authentication type specific to VeNCrypt", HFILL } |
4165 | 14 | }, |
4166 | 14 | { &hf_vnc_vencrypt_num_auth_types, |
4167 | 14 | { "VeNCrypt Number of supported authentication types", "vnc.vencrypt_num_auth_types", |
4168 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4169 | 14 | NULL, HFILL } |
4170 | 14 | }, |
4171 | 14 | { &hf_vnc_vencrypt_auth_type_ack, |
4172 | 14 | { "VeNCrypt Authorization type ack", "vnc.vencrypt_auth_type_ack", |
4173 | 14 | FT_BOOLEAN, 8, TFS(&tfs_ok_error), 0xFF, |
4174 | 14 | NULL, HFILL } |
4175 | 14 | }, |
4176 | 14 | { &hf_vnc_share_desktop_flag, |
4177 | 14 | { "Share desktop flag", "vnc.share_desktop_flag", |
4178 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4179 | 14 | "Client's desire to share the server's desktop with other clients", HFILL } |
4180 | 14 | }, |
4181 | 14 | { &hf_vnc_width, |
4182 | 14 | { "Framebuffer width", "vnc.width", |
4183 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4184 | 14 | "Width of the framebuffer (screen) in pixels", HFILL } |
4185 | 14 | }, |
4186 | 14 | { &hf_vnc_height, |
4187 | 14 | { "Framebuffer height", "vnc.height", |
4188 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4189 | 14 | "Height of the framebuffer (screen) in pixels", HFILL } |
4190 | 14 | }, |
4191 | 14 | { &hf_vnc_server_bits_per_pixel, |
4192 | 14 | { "Bits per pixel", "vnc.server_bits_per_pixel", |
4193 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4194 | 14 | "Number of bits used by server for each pixel value on the wire from the server", HFILL } |
4195 | 14 | }, |
4196 | 14 | { &hf_vnc_server_depth, |
4197 | 14 | { "Depth", "vnc.server_depth", |
4198 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4199 | 14 | "Number of useful bits in the pixel value on server", HFILL } |
4200 | 14 | }, |
4201 | 14 | { &hf_vnc_server_big_endian_flag, |
4202 | 14 | { "Big endian flag", "vnc.server_big_endian_flag", |
4203 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4204 | 14 | "True if multi-byte pixels are interpreted as big endian by server", HFILL } |
4205 | 14 | }, |
4206 | 14 | { &hf_vnc_server_true_color_flag, |
4207 | 14 | { "True color flag", "vnc.server_true_color_flag", |
4208 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4209 | 14 | "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 } |
4210 | 14 | }, |
4211 | 14 | { &hf_vnc_server_red_max, |
4212 | 14 | { "Red maximum", "vnc.server_red_max", |
4213 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4214 | 14 | "Maximum red value on server as n: 2^n - 1", HFILL } |
4215 | 14 | }, |
4216 | 14 | { &hf_vnc_server_green_max, |
4217 | 14 | { "Green maximum", "vnc.server_green_max", |
4218 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4219 | 14 | "Maximum green value on server as n: 2^n - 1", HFILL } |
4220 | 14 | }, |
4221 | 14 | { &hf_vnc_server_blue_max, |
4222 | 14 | { "Blue maximum", "vnc.server_blue_max", |
4223 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4224 | 14 | "Maximum blue value on server as n: 2^n - 1", HFILL } |
4225 | 14 | }, |
4226 | 14 | { &hf_vnc_server_red_shift, |
4227 | 14 | { "Red shift", "vnc.server_red_shift", |
4228 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4229 | 14 | "Number of shifts needed to get the red value in a pixel to the least significant bit on the server", HFILL } |
4230 | 14 | }, |
4231 | 14 | { &hf_vnc_server_green_shift, |
4232 | 14 | { "Green shift", "vnc.server_green_shift", |
4233 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4234 | 14 | "Number of shifts needed to get the green value in a pixel to the least significant bit on the server", HFILL } |
4235 | 14 | }, |
4236 | 14 | { &hf_vnc_server_blue_shift, |
4237 | 14 | { "Blue shift", "vnc.server_blue_shift", |
4238 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4239 | 14 | "Number of shifts needed to get the blue value in a pixel to the least significant bit on the server", HFILL } |
4240 | 14 | }, |
4241 | 14 | { &hf_vnc_desktop_name_len, |
4242 | 14 | { "Desktop name length", "vnc.desktop_name_len", |
4243 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4244 | 14 | "Length of desktop name in bytes", HFILL } |
4245 | 14 | }, |
4246 | 14 | { &hf_vnc_desktop_screen_num, |
4247 | 14 | { "Number of screens", "vnc.screen_num", |
4248 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4249 | 14 | NULL, HFILL } |
4250 | 14 | }, |
4251 | 14 | { &hf_vnc_desktop_screen_id, |
4252 | 14 | { "Screen ID", "vnc.screen_id", |
4253 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4254 | 14 | "ID of screen", HFILL } |
4255 | 14 | }, |
4256 | 14 | { &hf_vnc_desktop_screen_x, |
4257 | 14 | { "Screen X position", "vnc.screen_x", |
4258 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4259 | 14 | "X coordinate of screen", HFILL } |
4260 | 14 | }, |
4261 | 14 | { &hf_vnc_desktop_screen_y, |
4262 | 14 | { "Screen Y position", "vnc.screen_y", |
4263 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4264 | 14 | "Y coordinate of screen", HFILL } |
4265 | 14 | }, |
4266 | 14 | { &hf_vnc_desktop_screen_width, |
4267 | 14 | { "Screen width", "vnc.screen_width", |
4268 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4269 | 14 | "Width of screen", HFILL } |
4270 | 14 | }, |
4271 | 14 | { &hf_vnc_desktop_screen_height, |
4272 | 14 | { "Screen height", "vnc.screen_height", |
4273 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4274 | 14 | "Height of screen", HFILL } |
4275 | 14 | }, |
4276 | 14 | { &hf_vnc_desktop_screen_flags, |
4277 | 14 | { "Screen flags", "vnc.screen_flags", |
4278 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4279 | 14 | "Flags of screen", HFILL } |
4280 | 14 | }, |
4281 | 14 | { &hf_vnc_desktop_name, |
4282 | 14 | { "Desktop name", "vnc.desktop_name", |
4283 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4284 | 14 | "Name of the VNC desktop on the server", HFILL } |
4285 | 14 | }, |
4286 | 14 | { &hf_vnc_num_server_message_types, |
4287 | 14 | { "Server message types", "vnc.num_server_message_types", |
4288 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4289 | 14 | "Unknown", HFILL } /* XXX - Needs description */ |
4290 | 14 | }, |
4291 | 14 | { &hf_vnc_num_client_message_types, |
4292 | 14 | { "Client message types", "vnc.num_client_message_types", |
4293 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4294 | 14 | "Unknown", HFILL } /* XXX - Needs description */ |
4295 | 14 | }, |
4296 | 14 | { &hf_vnc_num_encoding_types, |
4297 | 14 | { "Encoding types", "vnc.num_encoding_types", |
4298 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4299 | 14 | "Unknown", HFILL } /* XXX - Needs description */ |
4300 | 14 | }, |
4301 | 14 | { &hf_vnc_client_message_type, |
4302 | 14 | { "Client Message Type", "vnc.client_message_type", |
4303 | 14 | FT_UINT8, BASE_DEC, VALS(vnc_client_message_types_vs), 0x0, |
4304 | 14 | "Message type from client", HFILL } |
4305 | 14 | }, |
4306 | 14 | { &hf_vnc_client_bits_per_pixel, |
4307 | 14 | { "Bits per pixel", "vnc.client_bits_per_pixel", |
4308 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4309 | 14 | "Number of bits used by server for each pixel value on the wire from the client", HFILL } |
4310 | 14 | }, |
4311 | 14 | { &hf_vnc_client_depth, |
4312 | 14 | { "Depth", "vnc.client_depth", |
4313 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4314 | 14 | "Number of useful bits in the pixel value on client", HFILL } |
4315 | 14 | }, |
4316 | 14 | { &hf_vnc_client_big_endian_flag, |
4317 | 14 | { "Big endian flag", "vnc.client_big_endian_flag", |
4318 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4319 | 14 | "True if multi-byte pixels are interpreted as big endian by client", HFILL } |
4320 | 14 | }, |
4321 | 14 | { &hf_vnc_client_true_color_flag, |
4322 | 14 | { "True color flag", "vnc.client_true_color_flag", |
4323 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4324 | 14 | "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 } |
4325 | 14 | }, |
4326 | 14 | { &hf_vnc_client_red_max, |
4327 | 14 | { "Red maximum", "vnc.client_red_max", |
4328 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4329 | 14 | "Maximum red value on client as n: 2^n - 1", HFILL } |
4330 | 14 | }, |
4331 | 14 | { &hf_vnc_client_green_max, |
4332 | 14 | { "Green maximum", "vnc.client_green_max", |
4333 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4334 | 14 | "Maximum green value on client as n: 2^n - 1", HFILL } |
4335 | 14 | }, |
4336 | 14 | { &hf_vnc_client_blue_max, |
4337 | 14 | { "Blue maximum", "vnc.client_blue_max", |
4338 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4339 | 14 | "Maximum blue value on client as n: 2^n - 1", HFILL } |
4340 | 14 | }, |
4341 | 14 | { &hf_vnc_client_red_shift, |
4342 | 14 | { "Red shift", "vnc.client_red_shift", |
4343 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4344 | 14 | "Number of shifts needed to get the red value in a pixel to the least significant bit on the client", HFILL } |
4345 | 14 | }, |
4346 | 14 | { &hf_vnc_client_green_shift, |
4347 | 14 | { "Green shift", "vnc.client_green_shift", |
4348 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4349 | 14 | "Number of shifts needed to get the green value in a pixel to the least significant bit on the client", HFILL } |
4350 | 14 | }, |
4351 | 14 | { &hf_vnc_client_blue_shift, |
4352 | 14 | { "Blue shift", "vnc.client_blue_shift", |
4353 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4354 | 14 | "Number of shifts needed to get the blue value in a pixel to the least significant bit on the client", HFILL } |
4355 | 14 | }, |
4356 | | |
4357 | | /* Client Key Event */ |
4358 | 14 | { &hf_vnc_key_down, |
4359 | 14 | { "Key down", "vnc.key_down", |
4360 | 14 | FT_BOOLEAN, BASE_NONE, TFS(&tfs_yes_no), 0x0, |
4361 | 14 | "Specifies whether the key is being pressed or not", HFILL } |
4362 | 14 | }, |
4363 | 14 | { &hf_vnc_key, |
4364 | 14 | { "Key", "vnc.key", |
4365 | 14 | FT_UINT32, BASE_HEX | BASE_EXT_STRING, &x11_keysym_vals_source_ext, 0x0, /* keysym_vals_source_exr is from packet-x11.c */ |
4366 | 14 | "Key being pressed/depressed", HFILL } |
4367 | 14 | }, |
4368 | | |
4369 | | /* Client Pointer Event */ |
4370 | 14 | { &hf_vnc_button_1_pos, |
4371 | 14 | { "Mouse button #1 position", "vnc.button_1_pos", |
4372 | 14 | FT_BOOLEAN, 8, TFS(&tfs_pressed_not_pressed), 0x1, |
4373 | 14 | "Whether mouse button #1 is being pressed or not", HFILL } |
4374 | 14 | }, |
4375 | 14 | { &hf_vnc_button_2_pos, |
4376 | 14 | { "Mouse button #2 position", "vnc.button_2_pos", |
4377 | 14 | FT_BOOLEAN, 8, TFS(&tfs_pressed_not_pressed), 0x2, |
4378 | 14 | "Whether mouse button #2 is being pressed or not", HFILL } |
4379 | 14 | }, |
4380 | 14 | { &hf_vnc_button_3_pos, |
4381 | 14 | { "Mouse button #3 position", "vnc.button_3_pos", |
4382 | 14 | FT_BOOLEAN, 8, TFS(&tfs_pressed_not_pressed), 0x4, |
4383 | 14 | "Whether mouse button #3 is being pressed or not", HFILL } |
4384 | 14 | }, |
4385 | 14 | { &hf_vnc_button_4_pos, |
4386 | 14 | { "Mouse button #4 position", "vnc.button_4_pos", |
4387 | 14 | FT_BOOLEAN, 8, TFS(&tfs_pressed_not_pressed), 0x8, |
4388 | 14 | "Whether mouse button #4 is being pressed or not", HFILL } |
4389 | 14 | }, |
4390 | 14 | { &hf_vnc_button_5_pos, |
4391 | 14 | { "Mouse button #5 position", "vnc.button_5_pos", |
4392 | 14 | FT_BOOLEAN, 8, TFS(&tfs_pressed_not_pressed), 0x10, |
4393 | 14 | "Whether mouse button #5 is being pressed or not", HFILL } |
4394 | 14 | }, |
4395 | 14 | { &hf_vnc_button_6_pos, |
4396 | 14 | { "Mouse button #6 position", "vnc.button_6_pos", |
4397 | 14 | FT_BOOLEAN, 8, TFS(&tfs_pressed_not_pressed), 0x20, |
4398 | 14 | "Whether mouse button #6 is being pressed or not", HFILL } |
4399 | 14 | }, |
4400 | 14 | { &hf_vnc_button_7_pos, |
4401 | 14 | { "Mouse button #7 position", "vnc.button_7_pos", |
4402 | 14 | FT_BOOLEAN, 8, TFS(&tfs_pressed_not_pressed), 0x40, |
4403 | 14 | "Whether mouse button #7 is being pressed or not", HFILL } |
4404 | 14 | }, |
4405 | 14 | { &hf_vnc_button_8_pos, |
4406 | 14 | { "Mouse button #8 position", "vnc.button_8_pos", |
4407 | 14 | FT_BOOLEAN, 8, TFS(&tfs_pressed_not_pressed), 0x80, |
4408 | 14 | "Whether mouse button #8 is being pressed or not", HFILL } |
4409 | 14 | }, |
4410 | 14 | { &hf_vnc_pointer_x_pos, |
4411 | 14 | { "X position", "vnc.pointer_x_pos", |
4412 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4413 | 14 | "Position of mouse cursor on the x-axis", HFILL } |
4414 | 14 | }, |
4415 | 14 | { &hf_vnc_pointer_y_pos, |
4416 | 14 | { "Y position", "vnc.pointer_y_pos", |
4417 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4418 | 14 | "Position of mouse cursor on the y-axis", HFILL } |
4419 | 14 | }, |
4420 | 14 | { &hf_vnc_encoding_num, |
4421 | 14 | { "Number of encodings", "vnc.client_set_encodings_num", |
4422 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4423 | 14 | "Number of encodings used to send pixel data from server to client", HFILL } |
4424 | 14 | }, |
4425 | 14 | { &hf_vnc_client_set_encodings_encoding_type, |
4426 | 14 | { "Encoding type", "vnc.client_set_encodings_encoding_type", |
4427 | 14 | FT_INT32, BASE_DEC, VALS(encoding_types_vs), 0x0, |
4428 | 14 | "Type of encoding used to send pixel data from server to client", HFILL } |
4429 | 14 | }, |
4430 | | |
4431 | | /* Client Framebuffer Update Request */ |
4432 | 14 | { &hf_vnc_update_req_incremental, |
4433 | 14 | { "Incremental update", "vnc.update_req_incremental", |
4434 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4435 | 14 | "Specifies if the client wants an incremental update instead of a full one", HFILL } |
4436 | 14 | }, |
4437 | 14 | { &hf_vnc_update_req_x_pos, |
4438 | 14 | { "X position", "vnc.update_req_x_pos", |
4439 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4440 | 14 | "X position of framebuffer (screen) update requested", HFILL } |
4441 | 14 | }, |
4442 | 14 | { &hf_vnc_update_req_y_pos, |
4443 | 14 | { "Y position", "vnc.update_req_y_pos", |
4444 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4445 | 14 | "Y position of framebuffer (screen) update request", HFILL } |
4446 | 14 | }, |
4447 | 14 | { &hf_vnc_update_req_width, |
4448 | 14 | { "Width", "vnc.update_req_width", |
4449 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4450 | 14 | "Width of framebuffer (screen) update request", HFILL } |
4451 | 14 | }, |
4452 | 14 | { &hf_vnc_update_req_height, |
4453 | 14 | { "Height", "vnc.update_req_height", |
4454 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4455 | 14 | "Height of framebuffer (screen) update request", HFILL } |
4456 | 14 | }, |
4457 | 14 | { &hf_vnc_client_cut_text_len, |
4458 | 14 | { "Length", "vnc.client_cut_text_len", |
4459 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4460 | 14 | "Length of client's copy/cut text (clipboard) string in bytes", HFILL } |
4461 | 14 | }, |
4462 | 14 | { &hf_vnc_client_cut_text_len_ext, |
4463 | 14 | { "Length", "vnc.client_cut_text_len_ext", |
4464 | 14 | FT_INT32, BASE_DEC, NULL, 0x0, |
4465 | 14 | "Length of client's copy/cut text (clipboard) string in bytes (extended)", HFILL } |
4466 | 14 | }, |
4467 | 14 | { &hf_vnc_client_cut_text, |
4468 | 14 | { "Text", "vnc.client_cut_text", |
4469 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4470 | 14 | "Text string in the client's copy/cut text (clipboard)", HFILL } |
4471 | 14 | }, |
4472 | | |
4473 | | /* Client QEMU Message SubType */ |
4474 | 14 | { &hf_vnc_qemu_subtype, |
4475 | 14 | { "Subtype", "vnc.qemu.msg_subtype", |
4476 | 14 | FT_UINT8, BASE_DEC, VALS(qemu_subtype_vals), 0x0, |
4477 | 14 | "QEMU message subtype", HFILL } |
4478 | 14 | }, |
4479 | | |
4480 | | /* QEMU Extended Key Event */ |
4481 | 14 | { &hf_vnc_qemu_extended_key_down_flag, |
4482 | 14 | { "Key pressed", "vnc.qemu.key_event.down_flag", |
4483 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4484 | 14 | "Key status (pressed or released)", HFILL } |
4485 | 14 | }, |
4486 | 14 | { &hf_vnc_qemu_extended_key_keysum, |
4487 | 14 | { "KeySum", "vnc.qemu.key_event.keysum", |
4488 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4489 | 14 | "Pressed or released key KeySum", HFILL } |
4490 | 14 | }, |
4491 | 14 | { &hf_vnc_qemu_extended_key_keycode, |
4492 | 14 | { "KeyCode", "vnc.qemu.key_event.keycode", |
4493 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4494 | 14 | "Pressed or released key KeyCode", HFILL } |
4495 | 14 | }, |
4496 | | |
4497 | | /********** Server Message Types **********/ |
4498 | 14 | { &hf_vnc_server_message_type, |
4499 | 14 | { "Server Message Type", "vnc.server_message_type", |
4500 | 14 | FT_UINT8, BASE_DEC, VALS(vnc_server_message_types_vs), 0x0, |
4501 | 14 | "Message type from server", HFILL } |
4502 | 14 | }, |
4503 | | |
4504 | 14 | { &hf_vnc_rectangle_num, |
4505 | 14 | { "Number of rectangles", "vnc.fb_update_num_rects", |
4506 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4507 | 14 | "Number of rectangles of this server framebuffer update", HFILL } |
4508 | 14 | }, |
4509 | | |
4510 | 14 | { &hf_vnc_fb_update_x_pos, |
4511 | 14 | { "X position", "vnc.fb_update_x_pos", |
4512 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4513 | 14 | "X position of this server framebuffer update", HFILL } |
4514 | 14 | }, |
4515 | | |
4516 | 14 | { &hf_vnc_fb_update_y_pos, |
4517 | 14 | { "Y position", "vnc.fb_update_y_pos", |
4518 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4519 | 14 | "Y position of this server framebuffer update", HFILL } |
4520 | 14 | }, |
4521 | | |
4522 | 14 | { &hf_vnc_fb_update_width, |
4523 | 14 | { "Width", "vnc.fb_update_width", |
4524 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4525 | 14 | "Width of this server framebuffer update", HFILL } |
4526 | 14 | }, |
4527 | | |
4528 | 14 | { &hf_vnc_fb_update_height, |
4529 | 14 | { "Height", "vnc.fb_update_height", |
4530 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4531 | 14 | "Height of this server framebuffer update", HFILL } |
4532 | 14 | }, |
4533 | | |
4534 | 14 | { &hf_vnc_fb_update_encoding_type, |
4535 | 14 | { "Encoding type", "vnc.fb_update_encoding_type", |
4536 | 14 | FT_INT32, BASE_DEC, VALS(encoding_types_vs), 0x0, |
4537 | 14 | "Encoding type of this server framebuffer update", HFILL } |
4538 | 14 | }, |
4539 | | |
4540 | | /* Cursor encoding */ |
4541 | 14 | { &hf_vnc_cursor_x_fore_back, |
4542 | 14 | { "X Cursor foreground RGB / background RGB", "vnc.cursor_x_fore_back", |
4543 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4544 | 14 | "RGB values for the X cursor's foreground and background", HFILL } |
4545 | 14 | }, |
4546 | | |
4547 | 14 | { &hf_vnc_cursor_encoding_pixels, |
4548 | 14 | { "Cursor encoding pixels", "vnc.cursor_encoding_pixels", |
4549 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4550 | 14 | "Cursor encoding pixel data", HFILL } |
4551 | 14 | }, |
4552 | | |
4553 | 14 | { &hf_vnc_cursor_encoding_bitmask, |
4554 | 14 | { "Cursor encoding bitmask", "vnc.cursor_encoding_bitmask", |
4555 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4556 | 14 | "Cursor encoding pixel bitmask", HFILL } |
4557 | 14 | }, |
4558 | | |
4559 | | /* Raw Encoding */ |
4560 | 14 | { &hf_vnc_raw_pixel_data, |
4561 | 14 | { "Pixel data", "vnc.raw_pixel_data", |
4562 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4563 | 14 | "Raw pixel data.", HFILL } |
4564 | 14 | }, |
4565 | | |
4566 | | /* CopyRect Encoding*/ |
4567 | 14 | { &hf_vnc_copyrect_src_x_pos, |
4568 | 14 | { "Source x position", "vnc.copyrect_src_x_pos", |
4569 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4570 | 14 | "X position of the rectangle to copy from", HFILL } |
4571 | 14 | }, |
4572 | | |
4573 | 14 | { &hf_vnc_copyrect_src_y_pos, |
4574 | 14 | { "Source y position", "vnc.copyrect_src_y_pos", |
4575 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4576 | 14 | "Y position of the rectangle to copy from", HFILL } |
4577 | 14 | }, |
4578 | | |
4579 | | /* RRE Encoding */ |
4580 | 14 | { &hf_vnc_rre_num_subrects, |
4581 | 14 | { "Number of subrectangles", "vnc.rre_num_subrects", |
4582 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4583 | 14 | "Number of subrectangles contained in this encoding type", HFILL } |
4584 | 14 | }, |
4585 | | |
4586 | 14 | { &hf_vnc_rre_bg_pixel, |
4587 | 14 | { "Background pixel value", "vnc.rre_bg_pixel", |
4588 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4589 | 14 | NULL, HFILL } |
4590 | 14 | }, |
4591 | | |
4592 | 14 | { &hf_vnc_rre_subrect_pixel, |
4593 | 14 | { "Pixel value", "vnc.rre_subrect_pixel", |
4594 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4595 | 14 | "Subrectangle pixel value", HFILL } |
4596 | 14 | }, |
4597 | | |
4598 | 14 | { &hf_vnc_rre_subrect_x_pos, |
4599 | 14 | { "X position", "vnc.rre_subrect_x_pos", |
4600 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4601 | 14 | "Position of this subrectangle on the x axis", HFILL } |
4602 | 14 | }, |
4603 | | |
4604 | 14 | { &hf_vnc_rre_subrect_y_pos, |
4605 | 14 | { "Y position", "vnc.rre_subrect_y_pos", |
4606 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4607 | 14 | "Position of this subrectangle on the y axis", HFILL } |
4608 | 14 | }, |
4609 | | |
4610 | 14 | { &hf_vnc_rre_subrect_width, |
4611 | 14 | { "Width", "vnc.rre_subrect_width", |
4612 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4613 | 14 | "Width of this subrectangle", HFILL } |
4614 | 14 | }, |
4615 | | |
4616 | 14 | { &hf_vnc_rre_subrect_height, |
4617 | 14 | { "Height", "vnc.rre_subrect_height", |
4618 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4619 | 14 | "Height of this subrectangle", HFILL } |
4620 | 14 | }, |
4621 | | |
4622 | | |
4623 | | /* Hextile Encoding */ |
4624 | 14 | { &hf_vnc_hextile_subencoding_mask, |
4625 | 14 | { "Subencoding type", "vnc.hextile_subencoding", |
4626 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4627 | 14 | "Hextile subencoding type.", HFILL } |
4628 | 14 | }, |
4629 | | |
4630 | 14 | { &hf_vnc_hextile_raw, |
4631 | 14 | { "Raw", "vnc.hextile_raw", |
4632 | 14 | FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x1, |
4633 | 14 | "Raw subencoding is used in this tile", HFILL } |
4634 | 14 | }, |
4635 | | |
4636 | 14 | { &hf_vnc_hextile_raw_value, |
4637 | 14 | { "Raw pixel values", "vnc.hextile_raw_value", |
4638 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4639 | 14 | "Raw subencoding pixel values", HFILL } |
4640 | 14 | }, |
4641 | | |
4642 | 14 | { &hf_vnc_hextile_bg, |
4643 | 14 | { "Background Specified", "vnc.hextile_bg", |
4644 | 14 | FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x2, |
4645 | 14 | "Background Specified subencoding is used in this tile", HFILL } |
4646 | 14 | }, |
4647 | | |
4648 | 14 | { &hf_vnc_hextile_bg_value, |
4649 | 14 | { "Background pixel value", "vnc.hextile_bg_value", |
4650 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4651 | 14 | "Background color for this tile", HFILL } |
4652 | 14 | }, |
4653 | | |
4654 | 14 | { &hf_vnc_hextile_fg, |
4655 | 14 | { "Foreground Specified", "vnc.hextile_fg", |
4656 | 14 | FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x4, |
4657 | 14 | "Foreground Specified subencoding is used in this tile", HFILL } |
4658 | 14 | }, |
4659 | | |
4660 | 14 | { &hf_vnc_hextile_fg_value, |
4661 | 14 | { "Foreground pixel value", "vnc.hextile_fg_value", |
4662 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4663 | 14 | "Foreground color for this tile", HFILL } |
4664 | 14 | }, |
4665 | | |
4666 | 14 | { &hf_vnc_hextile_anysubrects, |
4667 | 14 | { "Any Subrects", "vnc.hextile_anysubrects", |
4668 | 14 | FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x8, |
4669 | 14 | "Any subrects subencoding is used in this tile", HFILL } |
4670 | 14 | }, |
4671 | | |
4672 | 14 | { &hf_vnc_hextile_num_subrects, |
4673 | 14 | { "Number of subrectangles", "vnc.hextile_num_subrects", |
4674 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4675 | 14 | "Number of subrectangles that follow", HFILL } |
4676 | 14 | }, |
4677 | | |
4678 | 14 | { &hf_vnc_hextile_subrectscolored, |
4679 | 14 | { "Subrects Colored", "vnc.hextile_subrectscolored", |
4680 | 14 | FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, |
4681 | 14 | "Subrects colored subencoding is used in this tile", HFILL } |
4682 | 14 | }, |
4683 | | |
4684 | 14 | { &hf_vnc_hextile_subrect_pixel_value, |
4685 | 14 | { "Pixel value", "vnc.hextile_subrect_pixel_value", |
4686 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4687 | 14 | "Pixel value of this subrectangle", HFILL } |
4688 | 14 | }, |
4689 | | |
4690 | 14 | { &hf_vnc_hextile_subrect_x_pos, |
4691 | 14 | { "X position", "vnc.hextile_subrect_x_pos", |
4692 | 14 | FT_UINT8, BASE_DEC, NULL, 0xF0, /* Top 4 bits */ |
4693 | 14 | "X position of this subrectangle", HFILL } |
4694 | 14 | }, |
4695 | | |
4696 | 14 | { &hf_vnc_hextile_subrect_y_pos, |
4697 | 14 | { "Y position", "vnc.hextile_subrect_y_pos", |
4698 | 14 | FT_UINT8, BASE_DEC, NULL, 0xF, /* Bottom 4 bits */ |
4699 | 14 | "Y position of this subrectangle", HFILL } |
4700 | 14 | }, |
4701 | | |
4702 | 14 | { &hf_vnc_hextile_subrect_width, |
4703 | 14 | { "Width", "vnc.hextile_subrect_width", |
4704 | 14 | FT_UINT8, BASE_DEC, NULL, 0xF0, /* Top 4 bits */ |
4705 | 14 | "Subrectangle width minus one", HFILL } |
4706 | 14 | }, |
4707 | | |
4708 | 14 | { &hf_vnc_hextile_subrect_height, |
4709 | 14 | { "Height", "vnc.hextile_subrect_height", |
4710 | 14 | FT_UINT8, BASE_DEC, NULL, 0xF, /* Bottom 4 bits */ |
4711 | 14 | "Subrectangle height minus one", HFILL } |
4712 | 14 | }, |
4713 | | |
4714 | | |
4715 | | /* ZRLE Encoding */ |
4716 | 14 | { &hf_vnc_zrle_len, |
4717 | 14 | { "ZRLE compressed length", "vnc.zrle_len", |
4718 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4719 | 14 | "Length of compressed ZRLE data that follows", HFILL } |
4720 | 14 | }, |
4721 | | |
4722 | 14 | { &hf_vnc_zrle_subencoding, |
4723 | 14 | { "Subencoding type", "vnc.zrle_subencoding", |
4724 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4725 | 14 | "Subencoding type byte", HFILL } |
4726 | 14 | }, |
4727 | | |
4728 | 14 | { &hf_vnc_zrle_rle, |
4729 | 14 | { "RLE", "vnc.zrle_rle", |
4730 | 14 | FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, /* Upper bit */ |
4731 | 14 | "Specifies that data is run-length encoded", HFILL } |
4732 | 14 | }, |
4733 | | |
4734 | 14 | { &hf_vnc_zrle_palette_size, |
4735 | 14 | { "Palette size", "vnc.zrle_palette_size", |
4736 | 14 | FT_UINT8, BASE_DEC, NULL, 0x7F, /* Lower 7 bits */ |
4737 | 14 | NULL, HFILL } |
4738 | 14 | }, |
4739 | | |
4740 | 14 | { &hf_vnc_zrle_data, |
4741 | 14 | { "ZRLE compressed data", "vnc.zrle_data", |
4742 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4743 | 14 | "Compressed ZRLE data. Compiling with zlib support will uncompress and dissect this data", HFILL } |
4744 | 14 | }, |
4745 | | |
4746 | 14 | { &hf_vnc_zrle_raw, |
4747 | 14 | { "Pixel values", "vnc.zrle_raw", |
4748 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4749 | 14 | "Raw pixel values for this tile", HFILL } |
4750 | 14 | }, |
4751 | | |
4752 | 14 | { &hf_vnc_zrle_palette, |
4753 | 14 | { "Palette", "vnc.zrle_palette", |
4754 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4755 | 14 | "Palette pixel values", HFILL } |
4756 | 14 | }, |
4757 | | |
4758 | | /* Server Set Colormap Entries */ |
4759 | 14 | { &hf_vnc_colormap_first_color, |
4760 | 14 | { "First color", "vnc.colormap_first_color", |
4761 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4762 | 14 | "First color that should be mapped to given RGB intensities", HFILL } |
4763 | 14 | }, |
4764 | | |
4765 | 14 | { &hf_vnc_color_groups, |
4766 | 14 | { "Color groups", "vnc.color_groups", |
4767 | 14 | FT_NONE, BASE_NONE, NULL, 0x0, |
4768 | 14 | NULL, HFILL } |
4769 | 14 | }, |
4770 | | |
4771 | 14 | { &hf_vnc_colormap_num_colors, |
4772 | 14 | { "Number of color groups", "vnc.colormap_groups", |
4773 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4774 | 14 | "Number of red/green/blue color groups", HFILL } |
4775 | 14 | }, |
4776 | 14 | { &hf_vnc_colormap_red, |
4777 | 14 | { "Red", "vnc.colormap_red", |
4778 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4779 | 14 | "Red intensity", HFILL } |
4780 | 14 | }, |
4781 | 14 | { &hf_vnc_colormap_green, |
4782 | 14 | { "Green", "vnc.colormap_green", |
4783 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4784 | 14 | "Green intensity", HFILL } |
4785 | 14 | }, |
4786 | 14 | { &hf_vnc_colormap_blue, |
4787 | 14 | { "Blue", "vnc.colormap_blue", |
4788 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4789 | 14 | "Blue intensity", HFILL } |
4790 | 14 | }, |
4791 | | |
4792 | | /* Server Cut Text */ |
4793 | 14 | { &hf_vnc_server_cut_text_len, |
4794 | 14 | { "Length", "vnc.server_cut_text_len", |
4795 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4796 | 14 | "Length of server's copy/cut text (clipboard) string in bytes", HFILL } |
4797 | 14 | }, |
4798 | 14 | { &hf_vnc_server_cut_text, |
4799 | 14 | { "Text", "vnc.server_cut_text", |
4800 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4801 | 14 | "Text string in the server's copy/cut text (clipboard)", HFILL } |
4802 | 14 | }, |
4803 | | |
4804 | | /* LibVNCServer additions */ |
4805 | 14 | { &hf_vnc_supported_messages_client2server, |
4806 | 14 | { "Client2server", "vnc.supported_messages_client2server", |
4807 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4808 | 14 | "Supported client to server messages (bit flags)", HFILL } |
4809 | 14 | }, |
4810 | 14 | { &hf_vnc_supported_messages_server2client, |
4811 | 14 | { "Server2client", "vnc.supported_messages_server2client", |
4812 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4813 | 14 | "Supported server to client messages (bit flags)", HFILL } |
4814 | 14 | }, |
4815 | 14 | { &hf_vnc_num_supported_encodings, |
4816 | 14 | { "Number of supported encodings", "vnc.num_supported_encodings", |
4817 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4818 | 14 | NULL, HFILL } |
4819 | 14 | }, |
4820 | 14 | { &hf_vnc_supported_encodings, |
4821 | 14 | { "Encoding", "vnc.supported_encodings", |
4822 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4823 | 14 | "Supported encoding", HFILL } |
4824 | 14 | }, |
4825 | 14 | { &hf_vnc_server_identity, |
4826 | 14 | { "Server Identity", "vnc.server_identity", |
4827 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4828 | 14 | "Server identity string", HFILL } |
4829 | 14 | }, |
4830 | | |
4831 | | /* MirrorLink */ |
4832 | 14 | { &hf_vnc_mirrorlink_type, |
4833 | 14 | { "Type", "vnc.mirrorlink_type", |
4834 | 14 | FT_UINT8, BASE_DEC, VALS(vnc_mirrorlink_types_vs), 0x0, |
4835 | 14 | "MirrorLink extension message type", HFILL } |
4836 | 14 | }, |
4837 | 14 | { &hf_vnc_mirrorlink_length, |
4838 | 14 | { "Length", "vnc.mirrorlink_length", |
4839 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4840 | 14 | "Payload length", HFILL } |
4841 | 14 | }, |
4842 | 14 | { &hf_vnc_mirrorlink_version_major, |
4843 | 14 | { "Major Version", "vnc.mirrorlink_version_major", |
4844 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4845 | 14 | "MirrorLink major version", HFILL } |
4846 | 14 | }, |
4847 | 14 | { &hf_vnc_mirrorlink_version_minor, |
4848 | 14 | { "Minor Version", "vnc.mirrorlink_version_minor", |
4849 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4850 | 14 | "MirrorLink minor version", HFILL } |
4851 | 14 | }, |
4852 | 14 | { &hf_vnc_mirrorlink_framebuffer_configuration, |
4853 | 14 | { "Configuration", |
4854 | 14 | "vnc.mirrorlink_framebuffer_configuration", |
4855 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
4856 | 14 | "Framebuffer configuration", HFILL } |
4857 | 14 | }, |
4858 | 14 | { &hf_vnc_mirrorlink_pixel_width, |
4859 | 14 | { "Pixel Width", "vnc.mirrorlink_pixel_width", |
4860 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4861 | 14 | "Display width [pixel]", HFILL } |
4862 | 14 | }, |
4863 | 14 | { &hf_vnc_mirrorlink_pixel_height, |
4864 | 14 | { "Pixel Height", "vnc.mirrorlink_pixel_height", |
4865 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4866 | 14 | "Display height [pixel]", HFILL } |
4867 | 14 | }, |
4868 | 14 | { &hf_vnc_mirrorlink_pixel_format, |
4869 | 14 | { "Pixel Format", "vnc.mirrorlink_pixel_format", |
4870 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4871 | 14 | "Pixel format support", HFILL } |
4872 | 14 | }, |
4873 | 14 | { &hf_vnc_mirrorlink_display_width, |
4874 | 14 | { "Display Width", "vnc.mirrorlink_display_width", |
4875 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4876 | 14 | "Display width [mm]", HFILL } |
4877 | 14 | }, |
4878 | 14 | { &hf_vnc_mirrorlink_display_height, |
4879 | 14 | { "Display Height", "vnc.mirrorlink_display_height", |
4880 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4881 | 14 | "Display height [mm]", HFILL } |
4882 | 14 | }, |
4883 | 14 | { &hf_vnc_mirrorlink_display_distance, |
4884 | 14 | { "Display Distance", "vnc.mirrorlink_display_distance", |
4885 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4886 | 14 | "Display distance [mm]", HFILL } |
4887 | 14 | }, |
4888 | 14 | { &hf_vnc_mirrorlink_keyboard_language, |
4889 | 14 | { "Keyboard Language", "vnc.mirrorlink_keyboard_language", |
4890 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4891 | 14 | "Keyboard layout - Language code (according ISO 639-1)", |
4892 | 14 | HFILL } |
4893 | 14 | }, |
4894 | 14 | { &hf_vnc_mirrorlink_keyboard_country, |
4895 | 14 | { "Keyboard Country", "vnc.mirrorlink_keyboard_country", |
4896 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4897 | 14 | "Keyboard layout - Country code (according ISO 3166-1 alpha-2)", |
4898 | 14 | HFILL } |
4899 | 14 | }, |
4900 | 14 | { &hf_vnc_mirrorlink_ui_language, |
4901 | 14 | { "UI Language", "vnc.mirrorlink_ui_language", |
4902 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4903 | 14 | "UI language - Language code (according ISO 639-1)", HFILL } |
4904 | 14 | }, |
4905 | 14 | { &hf_vnc_mirrorlink_ui_country, |
4906 | 14 | { "UI Country", "vnc.mirrorlink_ui_country", |
4907 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4908 | 14 | "UI language - Country code (according ISO 3166-1 alpha 2)", |
4909 | 14 | HFILL } |
4910 | 14 | }, |
4911 | 14 | { &hf_vnc_mirrorlink_knob_keys, |
4912 | 14 | { "Knob Keys", "vnc.mirrorlink_knob_keys", |
4913 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4914 | 14 | "Supported knob keys", HFILL } |
4915 | 14 | }, |
4916 | 14 | { &hf_vnc_mirrorlink_device_keys, |
4917 | 14 | { "Device Keys", "vnc.mirrorlink_device_keys", |
4918 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4919 | 14 | "Supported device keys", HFILL } |
4920 | 14 | }, |
4921 | 14 | { &hf_vnc_mirrorlink_multimedia_keys, |
4922 | 14 | { "Multimedia Keys", "vnc.mirrorlink_multimedia_keys", |
4923 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4924 | 14 | "Supported multimedia keys", HFILL } |
4925 | 14 | }, |
4926 | 14 | { &hf_vnc_mirrorlink_key_related, |
4927 | 14 | { "Keyboard", "vnc.mirrorlink_key_related", |
4928 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4929 | 14 | "Keyboard related", HFILL } |
4930 | 14 | }, |
4931 | 14 | { &hf_vnc_mirrorlink_pointer_related, |
4932 | 14 | { "Pointer", "vnc.mirrorlink_pointer_related", |
4933 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4934 | 14 | "Pointer related", HFILL } |
4935 | 14 | }, |
4936 | 14 | { &hf_vnc_mirrorlink_key_symbol_value_client, |
4937 | 14 | { "Client KeySymValue", |
4938 | 14 | "vnc.mirrorlink_key_symbol_value_client", |
4939 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4940 | 14 | "Client key symbol value", HFILL } |
4941 | 14 | }, |
4942 | 14 | { &hf_vnc_mirrorlink_key_symbol_value_server, |
4943 | 14 | { "Server KeySymValue", |
4944 | 14 | "vnc.mirrorlink_key_symbol_value_server", |
4945 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4946 | 14 | "Server key symbol value", HFILL } |
4947 | 14 | }, |
4948 | 14 | { &hf_vnc_mirrorlink_key_configuration, |
4949 | 14 | { "Configuration", "vnc.mirrorlink_key_configuration", |
4950 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
4951 | 14 | "Key event listing configuration", HFILL } |
4952 | 14 | }, |
4953 | 14 | { &hf_vnc_mirrorlink_key_num_events, |
4954 | 14 | { "Number of Key Events", "vnc.mirrorlink_key_num_events", |
4955 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4956 | 14 | "Number of key events in list", HFILL } |
4957 | 14 | }, |
4958 | 14 | { &hf_vnc_mirrorlink_key_event_counter, |
4959 | 14 | { "Key Event Counter", "vnc.mirrorlink_key_event_counter", |
4960 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4961 | 14 | "Key event listing counter", HFILL } |
4962 | 14 | }, |
4963 | 14 | { &hf_vnc_mirrorlink_key_symbol_value, |
4964 | 14 | { "KeySymValue", |
4965 | 14 | "vnc.mirrorlink_key_symbol_value", |
4966 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4967 | 14 | "Key symbol value", HFILL } |
4968 | 14 | }, |
4969 | 14 | { &hf_vnc_mirrorlink_key_request_configuration, |
4970 | 14 | { "Configuration", "vnc.mirrorlink_key_request_configuration", |
4971 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4972 | 14 | "Key event listing request configuration", HFILL } |
4973 | 14 | }, |
4974 | 14 | { &hf_vnc_mirrorlink_keyboard_configuration, |
4975 | 14 | { "Configuration", "vnc.mirrorlink_keyboard_configuration", |
4976 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4977 | 14 | "Virtual keyboard configuration", HFILL } |
4978 | 14 | }, |
4979 | 14 | { &hf_vnc_mirrorlink_cursor_x, |
4980 | 14 | { "Cursor X", "vnc.mirrorlink_cursor_x", |
4981 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4982 | 14 | "Cursor - X position", HFILL } |
4983 | 14 | }, |
4984 | 14 | { &hf_vnc_mirrorlink_cursor_y, |
4985 | 14 | { "Cursor Y", "vnc.mirrorlink_cursor_y", |
4986 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4987 | 14 | "Cursor - Y position", HFILL } |
4988 | 14 | }, |
4989 | 14 | { &hf_vnc_mirrorlink_text_x, |
4990 | 14 | { "Text X", "vnc.mirrorlink_text_x", |
4991 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4992 | 14 | "Text input area - X position", HFILL } |
4993 | 14 | }, |
4994 | 14 | { &hf_vnc_mirrorlink_text_y, |
4995 | 14 | { "Text Y", "vnc.mirrorlink_text_y", |
4996 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4997 | 14 | "Text input area - Y position", HFILL } |
4998 | 14 | }, |
4999 | 14 | { &hf_vnc_mirrorlink_text_width, |
5000 | 14 | { "Text Width", "vnc.mirrorlink_text_width", |
5001 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5002 | 14 | "Text input area - Width", HFILL } |
5003 | 14 | }, |
5004 | 14 | { &hf_vnc_mirrorlink_text_height, |
5005 | 14 | { "Text Height", "vnc.mirrorlink_text_height", |
5006 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5007 | 14 | "Text input area - Height", HFILL } |
5008 | 14 | }, |
5009 | 14 | { &hf_vnc_mirrorlink_keyboard_request_configuration, |
5010 | 14 | { "Configuration", |
5011 | 14 | "vnc.mirrorlink_keyboard_request_configuration", |
5012 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
5013 | 14 | "Virtual keyboard request configuration", HFILL } |
5014 | 14 | }, |
5015 | 14 | { &hf_vnc_mirrorlink_device_status, |
5016 | 14 | { "Device Status", "vnc.mirrorlink_device_status", |
5017 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
5018 | 14 | "Status of Device Features", HFILL } |
5019 | 14 | }, |
5020 | 14 | { &hf_vnc_mirrorlink_app_id, |
5021 | 14 | { "App Id", "vnc.mirrorlink_app_id", |
5022 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
5023 | 14 | "Unique application id", HFILL } |
5024 | 14 | }, |
5025 | 14 | { &hf_vnc_mirrorlink_fb_block_x, |
5026 | 14 | { "Framebuffer X", "vnc.mirrorlink_fb_block_x", |
5027 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5028 | 14 | "Framebuffer blocking - X position", HFILL } |
5029 | 14 | }, |
5030 | 14 | { &hf_vnc_mirrorlink_fb_block_y, |
5031 | 14 | { "Framebuffer Y", "vnc.mirrorlink_fb_block_y", |
5032 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5033 | 14 | "Framebuffer blocking - Y position", HFILL } |
5034 | 14 | }, |
5035 | 14 | { &hf_vnc_mirrorlink_fb_block_width, |
5036 | 14 | { "Framebuffer Width", "vnc.mirrorlink_fb_block_width", |
5037 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5038 | 14 | "Framebuffer blocking - Width", HFILL } |
5039 | 14 | }, |
5040 | 14 | { &hf_vnc_mirrorlink_fb_block_height, |
5041 | 14 | { "Framebuffer Height", "vnc.mirrorlink_fb_block_height", |
5042 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5043 | 14 | "Framebuffer blocking - Height", HFILL } |
5044 | 14 | }, |
5045 | 14 | { &hf_vnc_mirrorlink_fb_block_reason, |
5046 | 14 | { "Reason", "vnc.mirrorlink_fb_block_reason", |
5047 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
5048 | 14 | "Reason for blocking", HFILL } |
5049 | 14 | }, |
5050 | 14 | { &hf_vnc_mirrorlink_audio_block_reason, |
5051 | 14 | { "Reason", "vnc.mirrorlink_audio_block_reason", |
5052 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
5053 | 14 | "Reason for blocking", HFILL } |
5054 | 14 | }, |
5055 | 14 | { &hf_vnc_mirrorlink_touch_num_events, |
5056 | 14 | { "Number of Touch Events", "vnc.mirrorlink_touch_num_events", |
5057 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
5058 | 14 | "Number of touch events in list", HFILL } |
5059 | 14 | }, |
5060 | 14 | { &hf_vnc_mirrorlink_touch_x, |
5061 | 14 | { "Touch X", "vnc.mirrorlink_touch_x", |
5062 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5063 | 14 | "Touch event - X position", HFILL } |
5064 | 14 | }, |
5065 | 14 | { &hf_vnc_mirrorlink_touch_y, |
5066 | 14 | { "Touch Y", "vnc.mirrorlink_touch_y", |
5067 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5068 | 14 | "Touch event - Y position", HFILL } |
5069 | 14 | }, |
5070 | 14 | { &hf_vnc_mirrorlink_touch_id, |
5071 | 14 | { "Touch Id", "vnc.mirrorlink_touch_id", |
5072 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
5073 | 14 | "Touch event - identifier", HFILL } |
5074 | 14 | }, |
5075 | 14 | { &hf_vnc_mirrorlink_touch_pressure, |
5076 | 14 | { "Touch Pressure", "vnc.mirrorlink_touch_pressure", |
5077 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
5078 | 14 | "Touch event - pressure value", HFILL } |
5079 | 14 | }, |
5080 | 14 | { &hf_vnc_mirrorlink_text, |
5081 | 14 | { "Text", "vnc.mirrorlink_text", |
5082 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
5083 | 14 | "Textual information", HFILL } |
5084 | 14 | }, |
5085 | 14 | { &hf_vnc_mirrorlink_text_length, |
5086 | 14 | { "Length", "vnc.mirrorlink_text_length", |
5087 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5088 | 14 | "Length of textual information", HFILL } |
5089 | 14 | }, |
5090 | 14 | { &hf_vnc_mirrorlink_text_max_length, |
5091 | 14 | { "Max Length", "vnc.mirrorlink_text_max_length", |
5092 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5093 | 14 | "Maximum length of textual information", HFILL } |
5094 | 14 | }, |
5095 | 14 | { &hf_vnc_mirrorlink_unknown, |
5096 | 14 | { "Unknown", "vnc.mirrorlink_unknown", |
5097 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5098 | 14 | "Unknown data", HFILL } |
5099 | 14 | }, |
5100 | | |
5101 | | /* Fence */ |
5102 | 14 | { &hf_vnc_fence_flags, |
5103 | 14 | {"Fence flags", "vnc.fence_flags", FT_UINT32, BASE_HEX, |
5104 | 14 | NULL, 0, NULL, HFILL}}, |
5105 | | |
5106 | 14 | { &hf_vnc_fence_request, |
5107 | 14 | { "Fence_request", "vnc.fence_request", |
5108 | 14 | FT_BOOLEAN, 32, NULL, VNC_FENCE_REQUEST, |
5109 | 14 | NULL, HFILL } |
5110 | 14 | }, |
5111 | 14 | { &hf_vnc_fence_sync_next, |
5112 | 14 | { "Fence_sync_next", "vnc.fence_sync_next", |
5113 | 14 | FT_BOOLEAN, 32, NULL, VNC_FENCE_SYNC_NEXT, |
5114 | 14 | NULL, HFILL } |
5115 | 14 | }, |
5116 | 14 | { &hf_vnc_fence_block_after, |
5117 | 14 | { "Fence_block_after", "vnc.fence_block_after", |
5118 | 14 | FT_BOOLEAN, 32, NULL, VNC_FENCE_BLOCK_AFTER, |
5119 | 14 | NULL, HFILL } |
5120 | 14 | }, |
5121 | 14 | { &hf_vnc_fence_block_before, |
5122 | 14 | { "Fence block_before", "vnc.fence_block_before", |
5123 | 14 | FT_BOOLEAN, 32, NULL, VNC_FENCE_BLOCK_BEFORE, |
5124 | 14 | NULL, HFILL } |
5125 | 14 | }, |
5126 | 14 | { &hf_vnc_fence_payload_length, |
5127 | 14 | { "Fence payload length", "vnc.fence_payload_length", |
5128 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
5129 | 14 | NULL, HFILL } |
5130 | 14 | }, |
5131 | 14 | { &hf_vnc_fence_payload, |
5132 | 14 | { "Fence payload", "vnc.fence_payload", |
5133 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5134 | 14 | NULL, HFILL } |
5135 | 14 | }, |
5136 | | |
5137 | | /* Context Information */ |
5138 | 14 | { &hf_vnc_context_information_app_id, |
5139 | 14 | { "App Id", "vnc.context_information_app_id", |
5140 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
5141 | 14 | "Unique application id", HFILL } |
5142 | 14 | }, |
5143 | 14 | { &hf_vnc_context_information_app_trust_level, |
5144 | 14 | { "App Trust Level", |
5145 | 14 | "vnc.context_information_app_trust_level", |
5146 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
5147 | 14 | "Trust Level for Application Category", HFILL } |
5148 | 14 | }, |
5149 | 14 | { &hf_vnc_context_information_content_trust_level, |
5150 | 14 | { "Content Trust Level", |
5151 | 14 | "vnc.context_information_content_trust_level", |
5152 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
5153 | 14 | "Trust Level for Content Category", HFILL } |
5154 | 14 | }, |
5155 | 14 | { &hf_vnc_context_information_app_category, |
5156 | 14 | { "App Category", "vnc.context_information_app_category", |
5157 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
5158 | 14 | "Application Category", HFILL } |
5159 | 14 | }, |
5160 | 14 | { &hf_vnc_context_information_content_category, |
5161 | 14 | { "Content Category", |
5162 | 14 | "vnc.context_information_content_category", |
5163 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
5164 | 14 | "Visual content category", HFILL } |
5165 | 14 | }, |
5166 | 14 | { &hf_vnc_context_information_content_rules, |
5167 | 14 | { "Content Rules", "vnc.context_information_content_rules", |
5168 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
5169 | 14 | "Visual content rules", HFILL } |
5170 | 14 | }, |
5171 | | |
5172 | | /* Scan Line based Run-Length Encoding */ |
5173 | 14 | { &hf_vnc_slrle_run_num, |
5174 | 14 | { "Number of Runs", "vnc.slrle_run_num", |
5175 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5176 | 14 | "Number of Runs within Line", HFILL } |
5177 | 14 | }, |
5178 | 14 | { &hf_vnc_slrle_run_data, |
5179 | 14 | { "Raw RLE data", "vnc.slrle_run_data", |
5180 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5181 | 14 | "Raw Run-Length encoded data within Line", HFILL } |
5182 | 14 | }, |
5183 | | |
5184 | | /* H.264 Encoding */ |
5185 | 14 | { &hf_vnc_h264_slice_type, |
5186 | 14 | { "Slice Type", "vnc.h264_slice_type", |
5187 | 14 | FT_UINT32, BASE_DEC, VALS(vnc_h264_slice_types_vs), 0x0, |
5188 | 14 | "Frame slice type", HFILL } |
5189 | 14 | }, |
5190 | 14 | { &hf_vnc_h264_nbytes, |
5191 | 14 | { "Number of Bytes", "vnc.h264_nbytes", |
5192 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5193 | 14 | "Number of bytes within frame", HFILL } |
5194 | 14 | }, |
5195 | 14 | { &hf_vnc_h264_width, |
5196 | 14 | { "Width", "vnc.h264_width", |
5197 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5198 | 14 | "Frame Width", HFILL } |
5199 | 14 | }, |
5200 | 14 | { &hf_vnc_h264_height, |
5201 | 14 | { "Height", "vnc.h264_height", |
5202 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5203 | 14 | "Frame Height", HFILL } |
5204 | 14 | }, |
5205 | 14 | { &hf_vnc_h264_data, |
5206 | 14 | { "Data", "vnc.h264_data", |
5207 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5208 | 14 | "Frame H.264 data", HFILL } |
5209 | 14 | }, |
5210 | | |
5211 | | /* Extended Clipboard */ |
5212 | 14 | { &hf_vnc_ext_clipboard_flags, |
5213 | 14 | {"Extended clipboard flags", "vnc.ext_clipboard.flags", FT_UINT32, BASE_HEX, |
5214 | 14 | NULL, 0, NULL, HFILL}}, |
5215 | | |
5216 | 14 | { &hf_vnc_ext_clipboard_text, |
5217 | 14 | { "PlainText", "vnc.ext_clipboard.is_plain", |
5218 | 14 | FT_BOOLEAN, 32, NULL, VNC_EXT_CLIPBOARD_TEXT, |
5219 | 14 | NULL, HFILL } |
5220 | 14 | }, |
5221 | 14 | { &hf_vnc_ext_clipboard_rtf, |
5222 | 14 | { "Microsoft RTF", "vnc.ext_clipboard.is_rtf", |
5223 | 14 | FT_BOOLEAN, 32, NULL, VNC_EXT_CLIPBOARD_RTF, |
5224 | 14 | NULL, HFILL } |
5225 | 14 | }, |
5226 | 14 | { &hf_vnc_ext_clipboard_html, |
5227 | 14 | { "HTML", "vnc.ext_clipboard.is_html", |
5228 | 14 | FT_BOOLEAN, 32, NULL, VNC_EXT_CLIPBOARD_HTML, |
5229 | 14 | NULL, HFILL } |
5230 | 14 | }, |
5231 | 14 | { &hf_vnc_ext_clipboard_dib, |
5232 | 14 | { "Microsoft DIB", "vnc.ext_clipboard.is_dib", |
5233 | 14 | FT_BOOLEAN, 32, NULL, VNC_EXT_CLIPBOARD_DIB, |
5234 | 14 | NULL, HFILL } |
5235 | 14 | }, |
5236 | 14 | { &hf_vnc_ext_clipboard_files, |
5237 | 14 | { "Undefined (files)", "vnc.ext_clipboard.is_files", |
5238 | 14 | FT_BOOLEAN, 32, NULL, VNC_EXT_CLIPBOARD_FILES, |
5239 | 14 | NULL, HFILL } |
5240 | 14 | }, |
5241 | 14 | { &hf_vnc_ext_clipboard_caps, |
5242 | 14 | { "Caps present", "vnc.ext_clipboard.has_caps", |
5243 | 14 | FT_BOOLEAN, 32, NULL, VNC_EXT_CLIPBOARD_CAPS, |
5244 | 14 | NULL, HFILL } |
5245 | 14 | }, |
5246 | 14 | { &hf_vnc_ext_clipboard_request, |
5247 | 14 | { "Request specific formats", "vnc.ext_clipboard.request", |
5248 | 14 | FT_BOOLEAN, 32, NULL, VNC_EXT_CLIPBOARD_REQUEST, |
5249 | 14 | NULL, HFILL } |
5250 | 14 | }, |
5251 | 14 | { &hf_vnc_ext_clipboard_peek, |
5252 | 14 | { "Ask formats list", "vnc.ext_clipboard.peek", |
5253 | 14 | FT_BOOLEAN, 32, NULL, VNC_EXT_CLIPBOARD_PEEK, |
5254 | 14 | NULL, HFILL } |
5255 | 14 | }, |
5256 | 14 | { &hf_vnc_ext_clipboard_notify, |
5257 | 14 | { "Send formats list", "vnc.ext_clipboard.notify", |
5258 | 14 | FT_BOOLEAN, 32, NULL, VNC_EXT_CLIPBOARD_NOTIFY, |
5259 | 14 | NULL, HFILL } |
5260 | 14 | }, |
5261 | 14 | { &hf_vnc_ext_clipboard_provide, |
5262 | 14 | { "Data is provided", "vnc.ext_clipboard.provide", |
5263 | 14 | FT_BOOLEAN, 32, NULL, VNC_EXT_CLIPBOARD_PROVIDE, |
5264 | 14 | NULL, HFILL } |
5265 | 14 | }, |
5266 | | |
5267 | 14 | { &hf_vnc_ext_clipboard_cap_text, |
5268 | 14 | { "Maximum Text length", "vnc.clipboard.cap.text", |
5269 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5270 | 14 | NULL, HFILL } |
5271 | 14 | }, |
5272 | 14 | { &hf_vnc_ext_clipboard_cap_rtf, |
5273 | 14 | { "Maximum RTF length", "vnc.clipboard.cap.rtf", |
5274 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5275 | 14 | NULL, HFILL } |
5276 | 14 | }, |
5277 | 14 | { &hf_vnc_ext_clipboard_cap_html, |
5278 | 14 | { "Maximum HTML length", "vnc.clipboard.cap.html", |
5279 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5280 | 14 | NULL, HFILL } |
5281 | 14 | }, |
5282 | 14 | { &hf_vnc_ext_clipboard_cap_dib, |
5283 | 14 | { "Maximum DIB length", "vnc.clipboard.cap.dib", |
5284 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5285 | 14 | NULL, HFILL } |
5286 | 14 | }, |
5287 | | |
5288 | 14 | { &hf_vnc_ext_clipboard_text_value, |
5289 | 14 | { "UTF8 text", "vnc.clipboard.text", |
5290 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
5291 | 14 | NULL, HFILL } |
5292 | 14 | }, |
5293 | 14 | { &hf_vnc_ext_clipboard_rtf_value, |
5294 | 14 | { "RTF", "vnc.clipboard.rtf", |
5295 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5296 | 14 | NULL, HFILL } |
5297 | 14 | }, |
5298 | 14 | { &hf_vnc_ext_clipboard_html_value, |
5299 | 14 | { "HTML", "vnc.clipboard.html", |
5300 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
5301 | 14 | NULL, HFILL } |
5302 | 14 | }, |
5303 | 14 | { &hf_vnc_ext_clipboard_dib_value, |
5304 | 14 | { "DIB", "vnc.clipboard.dib", |
5305 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5306 | 14 | NULL, HFILL } |
5307 | 14 | }, |
5308 | 14 | { &hf_vnc_ext_clipboard_compressed, |
5309 | 14 | { "Compressed value", "vnc.clipboard.compressed_value", |
5310 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5311 | 14 | NULL, HFILL } |
5312 | 14 | }, |
5313 | | |
5314 | 14 | }; |
5315 | | |
5316 | | /* Setup protocol subtree arrays */ |
5317 | 14 | static int *ett[] = { |
5318 | 14 | &ett_vnc, |
5319 | 14 | &ett_vnc_client_message_type, |
5320 | 14 | &ett_vnc_server_message_type, |
5321 | 14 | &ett_vnc_rect, |
5322 | 14 | &ett_vnc_encoding_type, |
5323 | 14 | &ett_vnc_rre_subrect, |
5324 | 14 | &ett_vnc_hextile_subencoding_mask, |
5325 | 14 | &ett_vnc_hextile_num_subrects, |
5326 | 14 | &ett_vnc_hextile_subrect, |
5327 | 14 | &ett_vnc_hextile_tile, |
5328 | 14 | &ett_vnc_zrle_subencoding, |
5329 | 14 | &ett_vnc_colormap_num_groups, |
5330 | 14 | &ett_vnc_desktop_screen, |
5331 | 14 | &ett_vnc_colormap_color_group, |
5332 | 14 | &ett_vnc_key_events, |
5333 | 14 | &ett_vnc_touch_events, |
5334 | 14 | &ett_vnc_slrle_subline, |
5335 | 14 | &ett_vnc_fence_flags, |
5336 | 14 | &ett_vnc_ext_clipboard_flags |
5337 | 14 | }; |
5338 | | |
5339 | 14 | static ei_register_info ei[] = { |
5340 | 14 | { &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 }}, |
5341 | 14 | { &ei_vnc_auth_code_mismatch, { "vnc.auth_code_mismatch", PI_PROTOCOL, PI_WARN, "Authentication code does not match vendor or signature", EXPFILL }}, |
5342 | 14 | { &ei_vnc_unknown_tight_vnc_auth, { "vnc.unknown_tight_vnc_auth", PI_PROTOCOL, PI_ERROR, "Unknown TIGHT VNC authentication", EXPFILL }}, |
5343 | 14 | { &ei_vnc_too_many_rectangles, { "vnc.too_many_rectangles", PI_MALFORMED, PI_ERROR, "Too many rectangles, aborting dissection", EXPFILL }}, |
5344 | 14 | { &ei_vnc_too_many_sub_rectangles, { "vnc.too_many_sub_rectangles", PI_MALFORMED, PI_ERROR, "Too many sub-rectangles, aborting dissection", EXPFILL }}, |
5345 | 14 | { &ei_vnc_invalid_encoding, { "vnc.invalid_encoding", PI_MALFORMED, PI_ERROR, "Invalid encoding", EXPFILL }}, |
5346 | 14 | { &ei_vnc_too_many_colors, { "vnc.too_many_colors", PI_MALFORMED, PI_ERROR, "Too many colors, aborting dissection", EXPFILL }}, |
5347 | 14 | { &ei_vnc_too_many_cut_text, { "vnc.too_many_cut_text", PI_MALFORMED, PI_ERROR, "Too much cut text, aborting dissection", EXPFILL }}, |
5348 | 14 | { &ei_vnc_zrle_failed, { "vnc.zrle_failed", PI_UNDECODED, PI_ERROR, "Decompression of ZRLE data failed", EXPFILL }}, |
5349 | 14 | { &ei_vnc_unknown_tight, { "vnc.unknown_tight_packet", PI_UNDECODED, PI_WARN, "Unknown packet (TightVNC)", EXPFILL }}, |
5350 | 14 | { &ei_vnc_reassemble, { "vnc.reassemble", PI_REASSEMBLE, PI_CHAT, "See further on for dissection of the complete (reassembled) PDU", EXPFILL }}, |
5351 | 14 | }; |
5352 | | |
5353 | | /* Register the protocol name and description */ |
5354 | 14 | proto_vnc = proto_register_protocol("Virtual Network Computing", "VNC", "vnc"); |
5355 | 14 | vnc_handle = register_dissector("vnc", dissect_vnc, proto_vnc); |
5356 | | |
5357 | | /* Required function calls to register the header fields and subtrees */ |
5358 | 14 | proto_register_field_array(proto_vnc, hf, array_length(hf)); |
5359 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
5360 | 14 | expert_vnc = expert_register_protocol(proto_vnc); |
5361 | 14 | expert_register_field_array(expert_vnc, ei, array_length(ei)); |
5362 | | |
5363 | | /* Register our preferences module */ |
5364 | 14 | vnc_module = prefs_register_protocol(proto_vnc, apply_vnc_prefs); |
5365 | | |
5366 | 14 | prefs_register_bool_preference(vnc_module, "desegment", |
5367 | 14 | "Reassemble VNC messages spanning multiple TCP segments.", |
5368 | 14 | "Whether the VNC dissector should reassemble messages spanning " |
5369 | 14 | "multiple TCP segments. To use this option, you must also enable " |
5370 | 14 | "\"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", |
5371 | 14 | &vnc_preference_desegment); |
5372 | 14 | } |
5373 | | |
5374 | | void |
5375 | | proto_reg_handoff_vnc(void) |
5376 | 14 | { |
5377 | 14 | dissector_add_uint_range_with_preference("tcp.port", VNC_PORT_RANGE, vnc_handle); |
5378 | 14 | heur_dissector_add("tcp", test_vnc_protocol, "VNC over TCP", "vnc_tcp", proto_vnc, HEURISTIC_ENABLE); |
5379 | | /* We don't register a port for the VNC HTTP server because |
5380 | | * that simply provides a java program for download via the |
5381 | | * HTTP protocol. The java program then connects to a standard |
5382 | | * VNC port. */ |
5383 | 14 | } |
5384 | | |
5385 | | /* |
5386 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
5387 | | * |
5388 | | * Local variables: |
5389 | | * c-basic-offset: 8 |
5390 | | * tab-width: 8 |
5391 | | * indent-tabs-mode: t |
5392 | | * End: |
5393 | | * |
5394 | | * vi: set shiftwidth=8 tabstop=8 noexpandtab: |
5395 | | * :indentSize=8:tabSize=8:noTabs=false: |
5396 | | */ |