]>
Commit | Line | Data |
---|---|---|
19a490bf AL |
1 | /* |
2 | * QEMU VNC display driver | |
3 | * | |
4 | * Copyright (C) 2006 Anthony Liguori <[email protected]> | |
5 | * Copyright (C) 2006 Fabrice Bellard | |
6 | * Copyright (C) 2009 Red Hat, Inc | |
7 | * | |
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
9 | * of this software and associated documentation files (the "Software"), to deal | |
10 | * in the Software without restriction, including without limitation the rights | |
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
12 | * copies of the Software, and to permit persons to whom the Software is | |
13 | * furnished to do so, subject to the following conditions: | |
14 | * | |
15 | * The above copyright notice and this permission notice shall be included in | |
16 | * all copies or substantial portions of the Software. | |
17 | * | |
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
24 | * THE SOFTWARE. | |
25 | */ | |
26 | ||
27 | #ifndef __QEMU_VNC_H | |
28 | #define __QEMU_VNC_H | |
29 | ||
30 | #include "qemu-common.h" | |
41b4bef6 | 31 | #include "qemu-queue.h" |
bd023f95 CC |
32 | #ifdef CONFIG_VNC_THREAD |
33 | #include "qemu-thread.h" | |
34 | #endif | |
19a490bf AL |
35 | #include "console.h" |
36 | #include "monitor.h" | |
37 | #include "audio/audio.h" | |
38 | #include <zlib.h> | |
6f9c78c1 | 39 | #include <stdbool.h> |
19a490bf | 40 | |
19a490bf AL |
41 | #include "keymaps.h" |
42 | ||
5fb6c7a8 AL |
43 | // #define _VNC_DEBUG 1 |
44 | ||
45 | #ifdef _VNC_DEBUG | |
46 | #define VNC_DEBUG(fmt, ...) do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) | |
47 | #else | |
48 | #define VNC_DEBUG(fmt, ...) do { } while (0) | |
49 | #endif | |
50 | ||
19a490bf AL |
51 | /***************************************************************************** |
52 | * | |
53 | * Core data structures | |
54 | * | |
55 | *****************************************************************************/ | |
56 | ||
57 | typedef struct Buffer | |
58 | { | |
59 | size_t capacity; | |
60 | size_t offset; | |
61 | uint8_t *buffer; | |
62 | } Buffer; | |
63 | ||
64 | typedef struct VncState VncState; | |
bd023f95 CC |
65 | typedef struct VncJob VncJob; |
66 | typedef struct VncRect VncRect; | |
67 | typedef struct VncRectEntry VncRectEntry; | |
19a490bf AL |
68 | |
69 | typedef int VncReadEvent(VncState *vs, uint8_t *data, size_t len); | |
70 | ||
d467b679 | 71 | typedef void VncWritePixels(VncState *vs, struct PixelFormat *pf, void *data, int size); |
19a490bf AL |
72 | |
73 | typedef void VncSendHextileTile(VncState *vs, | |
74 | int x, int y, int w, int h, | |
75 | void *last_bg, | |
76 | void *last_fg, | |
77 | int *has_bg, int *has_fg); | |
78 | ||
3f54bfbf | 79 | #define VNC_MAX_WIDTH 2560 |
19a490bf AL |
80 | #define VNC_MAX_HEIGHT 2048 |
81 | #define VNC_DIRTY_WORDS (VNC_MAX_WIDTH / (16 * 32)) | |
82 | ||
83 | #define VNC_AUTH_CHALLENGE_SIZE 16 | |
84 | ||
85 | typedef struct VncDisplay VncDisplay; | |
86 | ||
5fb6c7a8 AL |
87 | #ifdef CONFIG_VNC_TLS |
88 | #include "vnc-tls.h" | |
89 | #include "vnc-auth-vencrypt.h" | |
90 | #endif | |
2f9606b3 AL |
91 | #ifdef CONFIG_VNC_SASL |
92 | #include "vnc-auth-sasl.h" | |
93 | #endif | |
94 | ||
1fc62412 SS |
95 | struct VncSurface |
96 | { | |
97 | uint32_t dirty[VNC_MAX_HEIGHT][VNC_DIRTY_WORDS]; | |
98 | DisplaySurface *ds; | |
99 | }; | |
5fb6c7a8 | 100 | |
19a490bf AL |
101 | struct VncDisplay |
102 | { | |
41b4bef6 | 103 | QTAILQ_HEAD(, VncState) clients; |
703bc68f | 104 | QEMUTimer *timer; |
2430ffe4 | 105 | int timer_interval; |
19a490bf AL |
106 | int lsock; |
107 | DisplayState *ds; | |
c227f099 | 108 | kbd_layout_t *kbd_layout; |
3a0558b5 | 109 | int lock_key_sync; |
bd023f95 CC |
110 | #ifdef CONFIG_VNC_THREAD |
111 | QemuMutex mutex; | |
112 | #endif | |
19a490bf | 113 | |
d467b679 GH |
114 | QEMUCursor *cursor; |
115 | int cursor_msize; | |
116 | uint8_t *cursor_mask; | |
117 | ||
1fc62412 SS |
118 | struct VncSurface guest; /* guest visible surface (aka ds->surface) */ |
119 | DisplaySurface *server; /* vnc server surface */ | |
120 | ||
19a490bf AL |
121 | char *display; |
122 | char *password; | |
123 | int auth; | |
6f9c78c1 | 124 | bool lossy; |
19a490bf | 125 | #ifdef CONFIG_VNC_TLS |
5fb6c7a8 AL |
126 | int subauth; /* Used by VeNCrypt */ |
127 | VncDisplayTLS tls; | |
19a490bf | 128 | #endif |
76655d6d AL |
129 | #ifdef CONFIG_VNC_SASL |
130 | VncDisplaySASL sasl; | |
131 | #endif | |
19a490bf AL |
132 | }; |
133 | ||
d1af0e05 CC |
134 | typedef struct VncTight { |
135 | int type; | |
136 | uint8_t quality; | |
137 | uint8_t compression; | |
138 | uint8_t pixel24; | |
139 | Buffer tight; | |
140 | Buffer tmp; | |
141 | Buffer zlib; | |
142 | Buffer gradient; | |
143 | #ifdef CONFIG_VNC_JPEG | |
144 | Buffer jpeg; | |
145 | #endif | |
146 | #ifdef CONFIG_VNC_PNG | |
147 | Buffer png; | |
148 | #endif | |
149 | int levels[4]; | |
150 | z_stream stream[4]; | |
151 | } VncTight; | |
152 | ||
153 | typedef struct VncHextile { | |
154 | VncSendHextileTile *send_tile; | |
155 | } VncHextile; | |
156 | ||
157 | typedef struct VncZlib { | |
158 | Buffer zlib; | |
159 | Buffer tmp; | |
160 | z_stream stream; | |
161 | int level; | |
162 | } VncZlib; | |
163 | ||
bd023f95 CC |
164 | #ifdef CONFIG_VNC_THREAD |
165 | struct VncRect | |
166 | { | |
167 | int x; | |
168 | int y; | |
169 | int w; | |
170 | int h; | |
171 | }; | |
172 | ||
173 | struct VncRectEntry | |
174 | { | |
175 | struct VncRect rect; | |
176 | QLIST_ENTRY(VncRectEntry) next; | |
177 | }; | |
178 | ||
179 | struct VncJob | |
180 | { | |
181 | VncState *vs; | |
182 | ||
183 | QLIST_HEAD(, VncRectEntry) rectangles; | |
184 | QTAILQ_ENTRY(VncJob) next; | |
185 | }; | |
186 | #else | |
187 | struct VncJob | |
188 | { | |
189 | VncState *vs; | |
190 | int rectangles; | |
191 | size_t saved_offset; | |
192 | }; | |
193 | #endif | |
194 | ||
19a490bf AL |
195 | struct VncState |
196 | { | |
19a490bf | 197 | int csock; |
6baebed7 | 198 | |
19a490bf | 199 | DisplayState *ds; |
1fc62412 | 200 | uint32_t dirty[VNC_MAX_HEIGHT][VNC_DIRTY_WORDS]; |
6baebed7 | 201 | |
19a490bf AL |
202 | VncDisplay *vd; |
203 | int need_update; | |
c522d0e2 | 204 | int force_update; |
19a490bf AL |
205 | uint32_t features; |
206 | int absolute; | |
207 | int last_x; | |
208 | int last_y; | |
5862d195 GH |
209 | int client_width; |
210 | int client_height; | |
19a490bf AL |
211 | |
212 | uint32_t vnc_encoding; | |
19a490bf AL |
213 | |
214 | int major; | |
215 | int minor; | |
216 | ||
217 | char challenge[VNC_AUTH_CHALLENGE_SIZE]; | |
19a490bf | 218 | #ifdef CONFIG_VNC_TLS |
5fb6c7a8 | 219 | VncStateTLS tls; |
19a490bf | 220 | #endif |
2f9606b3 AL |
221 | #ifdef CONFIG_VNC_SASL |
222 | VncStateSASL sasl; | |
223 | #endif | |
19a490bf | 224 | |
4a80dba3 LC |
225 | QObject *info; |
226 | ||
19a490bf AL |
227 | Buffer output; |
228 | Buffer input; | |
229 | /* current output mode information */ | |
230 | VncWritePixels *write_pixels; | |
6baebed7 | 231 | DisplaySurface clientds; |
19a490bf AL |
232 | |
233 | CaptureVoiceOut *audio_cap; | |
234 | struct audsettings as; | |
235 | ||
236 | VncReadEvent *read_handler; | |
237 | size_t read_handler_expect; | |
238 | /* input */ | |
239 | uint8_t modifiers_state[256]; | |
7ffb82ca | 240 | QEMUPutLEDEntry *led; |
19a490bf | 241 | |
bd023f95 CC |
242 | bool abort; |
243 | #ifndef CONFIG_VNC_THREAD | |
244 | VncJob job; | |
245 | #else | |
246 | QemuMutex output_mutex; | |
247 | #endif | |
248 | ||
249 | /* Encoding specific, if you add something here, don't forget to | |
250 | * update vnc_async_encoding_start() | |
251 | */ | |
d1af0e05 CC |
252 | VncTight tight; |
253 | VncZlib zlib; | |
254 | VncHextile hextile; | |
70a4568f | 255 | |
19a490bf | 256 | |
37c34d9d AL |
257 | Notifier mouse_mode_notifier; |
258 | ||
41b4bef6 | 259 | QTAILQ_ENTRY(VncState) next; |
19a490bf AL |
260 | }; |
261 | ||
e06679fb AL |
262 | |
263 | /***************************************************************************** | |
264 | * | |
265 | * Authentication modes | |
266 | * | |
267 | *****************************************************************************/ | |
268 | ||
269 | enum { | |
270 | VNC_AUTH_INVALID = 0, | |
271 | VNC_AUTH_NONE = 1, | |
272 | VNC_AUTH_VNC = 2, | |
273 | VNC_AUTH_RA2 = 5, | |
274 | VNC_AUTH_RA2NE = 6, | |
275 | VNC_AUTH_TIGHT = 16, | |
276 | VNC_AUTH_ULTRA = 17, | |
2f9606b3 AL |
277 | VNC_AUTH_TLS = 18, /* Supported in GTK-VNC & VINO */ |
278 | VNC_AUTH_VENCRYPT = 19, /* Supported in GTK-VNC & VeNCrypt */ | |
279 | VNC_AUTH_SASL = 20, /* Supported in GTK-VNC & VINO */ | |
e06679fb AL |
280 | }; |
281 | ||
e06679fb AL |
282 | enum { |
283 | VNC_AUTH_VENCRYPT_PLAIN = 256, | |
284 | VNC_AUTH_VENCRYPT_TLSNONE = 257, | |
285 | VNC_AUTH_VENCRYPT_TLSVNC = 258, | |
286 | VNC_AUTH_VENCRYPT_TLSPLAIN = 259, | |
287 | VNC_AUTH_VENCRYPT_X509NONE = 260, | |
288 | VNC_AUTH_VENCRYPT_X509VNC = 261, | |
289 | VNC_AUTH_VENCRYPT_X509PLAIN = 262, | |
2f9606b3 AL |
290 | VNC_AUTH_VENCRYPT_X509SASL = 263, |
291 | VNC_AUTH_VENCRYPT_TLSSASL = 264, | |
e06679fb AL |
292 | }; |
293 | ||
e06679fb AL |
294 | |
295 | /***************************************************************************** | |
296 | * | |
297 | * Encoding types | |
298 | * | |
299 | *****************************************************************************/ | |
300 | ||
301 | #define VNC_ENCODING_RAW 0x00000000 | |
302 | #define VNC_ENCODING_COPYRECT 0x00000001 | |
303 | #define VNC_ENCODING_RRE 0x00000002 | |
304 | #define VNC_ENCODING_CORRE 0x00000004 | |
305 | #define VNC_ENCODING_HEXTILE 0x00000005 | |
306 | #define VNC_ENCODING_ZLIB 0x00000006 | |
307 | #define VNC_ENCODING_TIGHT 0x00000007 | |
308 | #define VNC_ENCODING_ZLIBHEX 0x00000008 | |
309 | #define VNC_ENCODING_TRLE 0x0000000f | |
310 | #define VNC_ENCODING_ZRLE 0x00000010 | |
311 | #define VNC_ENCODING_ZYWRLE 0x00000011 | |
312 | #define VNC_ENCODING_COMPRESSLEVEL0 0xFFFFFF00 /* -256 */ | |
313 | #define VNC_ENCODING_QUALITYLEVEL0 0xFFFFFFE0 /* -32 */ | |
314 | #define VNC_ENCODING_XCURSOR 0xFFFFFF10 /* -240 */ | |
315 | #define VNC_ENCODING_RICH_CURSOR 0xFFFFFF11 /* -239 */ | |
316 | #define VNC_ENCODING_POINTER_POS 0xFFFFFF18 /* -232 */ | |
317 | #define VNC_ENCODING_LASTRECT 0xFFFFFF20 /* -224 */ | |
318 | #define VNC_ENCODING_DESKTOPRESIZE 0xFFFFFF21 /* -223 */ | |
319 | #define VNC_ENCODING_POINTER_TYPE_CHANGE 0XFFFFFEFF /* -257 */ | |
320 | #define VNC_ENCODING_EXT_KEY_EVENT 0XFFFFFEFE /* -258 */ | |
321 | #define VNC_ENCODING_AUDIO 0XFFFFFEFD /* -259 */ | |
efe556ad | 322 | #define VNC_ENCODING_TIGHT_PNG 0xFFFFFEFC /* -260 */ |
e06679fb AL |
323 | #define VNC_ENCODING_WMVi 0x574D5669 |
324 | ||
325 | /***************************************************************************** | |
326 | * | |
327 | * Other tight constants | |
328 | * | |
329 | *****************************************************************************/ | |
330 | ||
331 | /* | |
332 | * Vendors known by TightVNC: standard VNC/RealVNC, TridiaVNC, and TightVNC. | |
333 | */ | |
334 | ||
335 | #define VNC_TIGHT_CCB_RESET_MASK (0x0f) | |
336 | #define VNC_TIGHT_CCB_TYPE_MASK (0x0f << 4) | |
337 | #define VNC_TIGHT_CCB_TYPE_FILL (0x08 << 4) | |
338 | #define VNC_TIGHT_CCB_TYPE_JPEG (0x09 << 4) | |
efe556ad | 339 | #define VNC_TIGHT_CCB_TYPE_PNG (0x0A << 4) |
e06679fb AL |
340 | #define VNC_TIGHT_CCB_BASIC_MAX (0x07 << 4) |
341 | #define VNC_TIGHT_CCB_BASIC_ZLIB (0x03 << 4) | |
342 | #define VNC_TIGHT_CCB_BASIC_FILTER (0x04 << 4) | |
343 | ||
344 | /***************************************************************************** | |
345 | * | |
346 | * Features | |
347 | * | |
348 | *****************************************************************************/ | |
349 | ||
350 | #define VNC_FEATURE_RESIZE 0 | |
351 | #define VNC_FEATURE_HEXTILE 1 | |
352 | #define VNC_FEATURE_POINTER_TYPE_CHANGE 2 | |
353 | #define VNC_FEATURE_WMVI 3 | |
354 | #define VNC_FEATURE_TIGHT 4 | |
355 | #define VNC_FEATURE_ZLIB 5 | |
753b4053 | 356 | #define VNC_FEATURE_COPYRECT 6 |
d467b679 | 357 | #define VNC_FEATURE_RICH_CURSOR 7 |
efe556ad | 358 | #define VNC_FEATURE_TIGHT_PNG 8 |
e06679fb AL |
359 | |
360 | #define VNC_FEATURE_RESIZE_MASK (1 << VNC_FEATURE_RESIZE) | |
361 | #define VNC_FEATURE_HEXTILE_MASK (1 << VNC_FEATURE_HEXTILE) | |
362 | #define VNC_FEATURE_POINTER_TYPE_CHANGE_MASK (1 << VNC_FEATURE_POINTER_TYPE_CHANGE) | |
363 | #define VNC_FEATURE_WMVI_MASK (1 << VNC_FEATURE_WMVI) | |
364 | #define VNC_FEATURE_TIGHT_MASK (1 << VNC_FEATURE_TIGHT) | |
365 | #define VNC_FEATURE_ZLIB_MASK (1 << VNC_FEATURE_ZLIB) | |
753b4053 | 366 | #define VNC_FEATURE_COPYRECT_MASK (1 << VNC_FEATURE_COPYRECT) |
d467b679 | 367 | #define VNC_FEATURE_RICH_CURSOR_MASK (1 << VNC_FEATURE_RICH_CURSOR) |
efe556ad | 368 | #define VNC_FEATURE_TIGHT_PNG_MASK (1 << VNC_FEATURE_TIGHT_PNG) |
e06679fb | 369 | |
5fb6c7a8 | 370 | |
46a183da DB |
371 | /* Client -> Server message IDs */ |
372 | #define VNC_MSG_CLIENT_SET_PIXEL_FORMAT 0 | |
373 | #define VNC_MSG_CLIENT_SET_ENCODINGS 2 | |
374 | #define VNC_MSG_CLIENT_FRAMEBUFFER_UPDATE_REQUEST 3 | |
375 | #define VNC_MSG_CLIENT_KEY_EVENT 4 | |
376 | #define VNC_MSG_CLIENT_POINTER_EVENT 5 | |
377 | #define VNC_MSG_CLIENT_CUT_TEXT 6 | |
378 | #define VNC_MSG_CLIENT_VMWARE_0 127 | |
379 | #define VNC_MSG_CLIENT_CALL_CONTROL 249 | |
380 | #define VNC_MSG_CLIENT_XVP 250 | |
381 | #define VNC_MSG_CLIENT_SET_DESKTOP_SIZE 251 | |
382 | #define VNC_MSG_CLIENT_TIGHT 252 | |
383 | #define VNC_MSG_CLIENT_GII 253 | |
384 | #define VNC_MSG_CLIENT_VMWARE_1 254 | |
385 | #define VNC_MSG_CLIENT_QEMU 255 | |
386 | ||
387 | /* Server -> Client message IDs */ | |
388 | #define VNC_MSG_SERVER_FRAMEBUFFER_UPDATE 0 | |
389 | #define VNC_MSG_SERVER_SET_COLOUR_MAP_ENTRIES 1 | |
390 | #define VNC_MSG_SERVER_BELL 2 | |
391 | #define VNC_MSG_SERVER_CUT_TEXT 3 | |
392 | #define VNC_MSG_SERVER_VMWARE_0 127 | |
393 | #define VNC_MSG_SERVER_CALL_CONTROL 249 | |
394 | #define VNC_MSG_SERVER_XVP 250 | |
395 | #define VNC_MSG_SERVER_TIGHT 252 | |
396 | #define VNC_MSG_SERVER_GII 253 | |
397 | #define VNC_MSG_SERVER_VMWARE_1 254 | |
398 | #define VNC_MSG_SERVER_QEMU 255 | |
399 | ||
400 | ||
401 | ||
402 | /* QEMU client -> server message IDs */ | |
403 | #define VNC_MSG_CLIENT_QEMU_EXT_KEY_EVENT 0 | |
404 | #define VNC_MSG_CLIENT_QEMU_AUDIO 1 | |
405 | ||
406 | /* QEMU server -> client message IDs */ | |
407 | #define VNC_MSG_SERVER_QEMU_AUDIO 1 | |
408 | ||
409 | ||
410 | ||
411 | /* QEMU client -> server audio message IDs */ | |
412 | #define VNC_MSG_CLIENT_QEMU_AUDIO_ENABLE 0 | |
413 | #define VNC_MSG_CLIENT_QEMU_AUDIO_DISABLE 1 | |
414 | #define VNC_MSG_CLIENT_QEMU_AUDIO_SET_FORMAT 2 | |
415 | ||
416 | /* QEMU server -> client audio message IDs */ | |
417 | #define VNC_MSG_SERVER_QEMU_AUDIO_END 0 | |
418 | #define VNC_MSG_SERVER_QEMU_AUDIO_BEGIN 1 | |
419 | #define VNC_MSG_SERVER_QEMU_AUDIO_DATA 2 | |
420 | ||
421 | ||
5fb6c7a8 AL |
422 | /***************************************************************************** |
423 | * | |
424 | * Internal APIs | |
425 | * | |
426 | *****************************************************************************/ | |
427 | ||
428 | /* Event loop functions */ | |
429 | void vnc_client_read(void *opaque); | |
430 | void vnc_client_write(void *opaque); | |
431 | ||
2f9606b3 AL |
432 | long vnc_client_read_buf(VncState *vs, uint8_t *data, size_t datalen); |
433 | long vnc_client_write_buf(VncState *vs, const uint8_t *data, size_t datalen); | |
5fb6c7a8 AL |
434 | |
435 | /* Protocol I/O functions */ | |
436 | void vnc_write(VncState *vs, const void *data, size_t len); | |
437 | void vnc_write_u32(VncState *vs, uint32_t value); | |
438 | void vnc_write_s32(VncState *vs, int32_t value); | |
439 | void vnc_write_u16(VncState *vs, uint16_t value); | |
440 | void vnc_write_u8(VncState *vs, uint8_t value); | |
441 | void vnc_flush(VncState *vs); | |
442 | void vnc_read_when(VncState *vs, VncReadEvent *func, size_t expecting); | |
443 | ||
444 | ||
445 | /* Buffer I/O functions */ | |
446 | uint8_t read_u8(uint8_t *data, size_t offset); | |
447 | uint16_t read_u16(uint8_t *data, size_t offset); | |
448 | int32_t read_s32(uint8_t *data, size_t offset); | |
449 | uint32_t read_u32(uint8_t *data, size_t offset); | |
450 | ||
451 | /* Protocol stage functions */ | |
452 | void vnc_client_error(VncState *vs); | |
2f9606b3 | 453 | int vnc_client_io_error(VncState *vs, int ret, int last_errno); |
5fb6c7a8 AL |
454 | |
455 | void start_client_init(VncState *vs); | |
456 | void start_auth_vnc(VncState *vs); | |
457 | ||
2f9606b3 AL |
458 | /* Buffer management */ |
459 | void buffer_reserve(Buffer *buffer, size_t len); | |
460 | int buffer_empty(Buffer *buffer); | |
461 | uint8_t *buffer_end(Buffer *buffer); | |
462 | void buffer_reset(Buffer *buffer); | |
5d418e3b | 463 | void buffer_free(Buffer *buffer); |
2f9606b3 AL |
464 | void buffer_append(Buffer *buffer, const void *data, size_t len); |
465 | ||
466 | ||
467 | /* Misc helpers */ | |
468 | ||
469 | char *vnc_socket_local_addr(const char *format, int fd); | |
470 | char *vnc_socket_remote_addr(const char *format, int fd); | |
471 | ||
efe556ad CC |
472 | static inline uint32_t vnc_has_feature(VncState *vs, int feature) { |
473 | return (vs->features & (1 << feature)); | |
474 | } | |
475 | ||
70a4568f CC |
476 | /* Framebuffer */ |
477 | void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h, | |
478 | int32_t encoding); | |
479 | ||
480 | void vnc_convert_pixel(VncState *vs, uint8_t *buf, uint32_t v); | |
481 | ||
482 | /* Encodings */ | |
bd023f95 CC |
483 | int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h); |
484 | ||
a885211e | 485 | int vnc_raw_send_framebuffer_update(VncState *vs, int x, int y, int w, int h); |
70a4568f | 486 | |
a885211e | 487 | int vnc_hextile_send_framebuffer_update(VncState *vs, int x, |
70a4568f CC |
488 | int y, int w, int h); |
489 | void vnc_hextile_set_pixel_conversion(VncState *vs, int generic); | |
490 | ||
380282b0 CC |
491 | void *vnc_zlib_zalloc(void *x, unsigned items, unsigned size); |
492 | void vnc_zlib_zfree(void *x, void *addr); | |
a885211e | 493 | int vnc_zlib_send_framebuffer_update(VncState *vs, int x, int y, int w, int h); |
161c4f20 | 494 | void vnc_zlib_clear(VncState *vs); |
70a4568f | 495 | |
380282b0 | 496 | int vnc_tight_send_framebuffer_update(VncState *vs, int x, int y, int w, int h); |
efe556ad CC |
497 | int vnc_tight_png_send_framebuffer_update(VncState *vs, int x, int y, |
498 | int w, int h); | |
380282b0 CC |
499 | void vnc_tight_clear(VncState *vs); |
500 | ||
19a490bf | 501 | #endif /* __QEMU_VNC_H */ |