dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 04-vnc-struct.patch

Glauber Costa 47b075
Index: qemu-kvm-0.10/qemu/vnc.c
Glauber Costa 47b075
===================================================================
Glauber Costa 47b075
--- qemu-kvm-0.10.orig/qemu/vnc.c
Glauber Costa 47b075
+++ qemu-kvm-0.10/qemu/vnc.c
Glauber Costa 47b075
@@ -3,6 +3,7 @@
Glauber Costa 47b075
  *
Glauber Costa 47b075
  * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
Glauber Costa 47b075
  * Copyright (C) 2006 Fabrice Bellard
Glauber Costa 47b075
+ * Copyright (C) 2009 Red Hat, Inc
Glauber Costa 47b075
  *
Glauber Costa 47b075
  * Permission is hereby granted, free of charge, to any person obtaining a copy
Glauber Costa 47b075
  * of this software and associated documentation files (the "Software"), to deal
Glauber Costa 47b075
@@ -23,25 +24,16 @@
Glauber Costa 47b075
  * THE SOFTWARE.
Glauber Costa 47b075
  */
Glauber Costa 47b075
 
Glauber Costa 47b075
-#include "qemu-common.h"
Glauber Costa 47b075
-#include "console.h"
Glauber Costa 47b075
+#include "vnc.h"
Glauber Costa 47b075
 #include "sysemu.h"
Glauber Costa 47b075
 #include "qemu_socket.h"
Glauber Costa 47b075
 #include "qemu-timer.h"
Glauber Costa 47b075
-#include "audio/audio.h"
Glauber Costa 47b075
-#include <zlib.h>
Glauber Costa 47b075
 
Glauber Costa 47b075
 #define VNC_REFRESH_INTERVAL (1000 / 30)
Glauber Costa 47b075
 
Glauber Costa 47b075
-#include "vnc.h"
Glauber Costa 47b075
 #include "vnc_keysym.h"
Glauber Costa 47b075
 #include "d3des.h"
Glauber Costa 47b075
 
Glauber Costa 47b075
-#ifdef CONFIG_VNC_TLS
Glauber Costa 47b075
-#include <gnutls/gnutls.h>
Glauber Costa 47b075
-#include <gnutls/x509.h>
Glauber Costa 47b075
-#endif /* CONFIG_VNC_TLS */
Glauber Costa 47b075
-
Glauber Costa 47b075
 // #define _VNC_DEBUG 1
Glauber Costa 47b075
 
Glauber Costa 47b075
 #ifdef _VNC_DEBUG
Glauber Costa 47b075
@@ -64,103 +56,6 @@ static void vnc_debug_gnutls_log(int lev
Glauber Costa 47b075
     } \
Glauber Costa 47b075
 }
Glauber Costa 47b075
 
Glauber Costa 47b075
-typedef struct Buffer
Glauber Costa 47b075
-{
Glauber Costa 47b075
-    size_t capacity;
Glauber Costa 47b075
-    size_t offset;
Glauber Costa 47b075
-    uint8_t *buffer;
Glauber Costa 47b075
-} Buffer;
Glauber Costa 47b075
-
Glauber Costa 47b075
-typedef struct VncState VncState;
Glauber Costa 47b075
-
Glauber Costa 47b075
-typedef int VncReadEvent(VncState *vs, uint8_t *data, size_t len);
Glauber Costa 47b075
-
Glauber Costa 47b075
-typedef void VncWritePixels(VncState *vs, void *data, int size);
Glauber Costa 47b075
-
Glauber Costa 47b075
-typedef void VncSendHextileTile(VncState *vs,
Glauber Costa 47b075
-                                int x, int y, int w, int h,
Glauber Costa 47b075
-                                void *last_bg,
Glauber Costa 47b075
-                                void *last_fg,
Glauber Costa 47b075
-                                int *has_bg, int *has_fg);
Glauber Costa 47b075
-
Glauber Costa 47b075
-#define VNC_MAX_WIDTH 2048
Glauber Costa 47b075
-#define VNC_MAX_HEIGHT 2048
Glauber Costa 47b075
-#define VNC_DIRTY_WORDS (VNC_MAX_WIDTH / (16 * 32))
Glauber Costa 47b075
-
Glauber Costa 47b075
-#define VNC_AUTH_CHALLENGE_SIZE 16
Glauber Costa 47b075
-
Glauber Costa 47b075
-typedef struct VncDisplay VncDisplay;
Glauber Costa 47b075
-
Glauber Costa 47b075
-struct VncDisplay
Glauber Costa 47b075
-{
Glauber Costa 47b075
-    int lsock;
Glauber Costa 47b075
-    DisplayState *ds;
Glauber Costa 47b075
-    VncState *clients;
Glauber Costa 47b075
-    kbd_layout_t *kbd_layout;
Glauber Costa 47b075
-
Glauber Costa 47b075
-    char *display;
Glauber Costa 47b075
-    char *password;
Glauber Costa 47b075
-    int auth;
Glauber Costa 47b075
-#ifdef CONFIG_VNC_TLS
Glauber Costa 47b075
-    int subauth;
Glauber Costa 47b075
-    int x509verify;
Glauber Costa 47b075
-
Glauber Costa 47b075
-    char *x509cacert;
Glauber Costa 47b075
-    char *x509cacrl;
Glauber Costa 47b075
-    char *x509cert;
Glauber Costa 47b075
-    char *x509key;
Glauber Costa 47b075
-#endif
Glauber Costa 47b075
-};
Glauber Costa 47b075
-
Glauber Costa 47b075
-struct VncState
Glauber Costa 47b075
-{
Glauber Costa 47b075
-    QEMUTimer *timer;
Glauber Costa 47b075
-    int csock;
Glauber Costa 47b075
-    DisplayState *ds;
Glauber Costa 47b075
-    VncDisplay *vd;
Glauber Costa 47b075
-    int need_update;
Glauber Costa 47b075
-    uint32_t dirty_row[VNC_MAX_HEIGHT][VNC_DIRTY_WORDS];
Glauber Costa 47b075
-    char *old_data;
Glauber Costa 47b075
-    uint32_t features;
Glauber Costa 47b075
-    int absolute;
Glauber Costa 47b075
-    int last_x;
Glauber Costa 47b075
-    int last_y;
Glauber Costa 47b075
-
Glauber Costa 47b075
-    uint32_t vnc_encoding;
Glauber Costa 47b075
-    uint8_t tight_quality;
Glauber Costa 47b075
-    uint8_t tight_compression;
Glauber Costa 47b075
-
Glauber Costa 47b075
-    int major;
Glauber Costa 47b075
-    int minor;
Glauber Costa 47b075
-
Glauber Costa 47b075
-    char challenge[VNC_AUTH_CHALLENGE_SIZE];
Glauber Costa 47b075
-
Glauber Costa 47b075
-#ifdef CONFIG_VNC_TLS
Glauber Costa 47b075
-    int wiremode;
Glauber Costa 47b075
-    gnutls_session_t tls_session;
Glauber Costa 47b075
-#endif
Glauber Costa 47b075
-
Glauber Costa 47b075
-    Buffer output;
Glauber Costa 47b075
-    Buffer input;
Glauber Costa 47b075
-    /* current output mode information */
Glauber Costa 47b075
-    VncWritePixels *write_pixels;
Glauber Costa 47b075
-    VncSendHextileTile *send_hextile_tile;
Glauber Costa 47b075
-    DisplaySurface clientds, serverds;
Glauber Costa 47b075
-
Glauber Costa 47b075
-    CaptureVoiceOut *audio_cap;
Glauber Costa 47b075
-    struct audsettings as;
Glauber Costa 47b075
-
Glauber Costa 47b075
-    VncReadEvent *read_handler;
Glauber Costa 47b075
-    size_t read_handler_expect;
Glauber Costa 47b075
-    /* input */
Glauber Costa 47b075
-    uint8_t modifiers_state[256];
Glauber Costa 47b075
-
Glauber Costa 47b075
-    Buffer zlib;
Glauber Costa 47b075
-    Buffer zlib_tmp;
Glauber Costa 47b075
-    z_stream zlib_stream[4];
Glauber Costa 47b075
-
Glauber Costa 47b075
-    VncState *next;
Glauber Costa 47b075
-};
Glauber Costa 47b075
 
Glauber Costa 47b075
 static VncDisplay *vnc_display; /* needed for info vnc */
Glauber Costa 47b075
 static DisplayChangeListener *dcl;
Glauber Costa 47b075
Index: qemu-kvm-0.10/qemu/vnc.h
Glauber Costa 47b075
===================================================================
Glauber Costa 47b075
--- qemu-kvm-0.10.orig/qemu/vnc.h
Glauber Costa 47b075
+++ qemu-kvm-0.10/qemu/vnc.h
Glauber Costa 47b075
@@ -1,5 +1,148 @@
Glauber Costa 47b075
-#ifndef __VNCTIGHT_H
Glauber Costa 47b075
-#define __VNCTIGHT_H
Glauber Costa 47b075
+/*
Glauber Costa 47b075
+ * QEMU VNC display driver
Glauber Costa 47b075
+ *
Glauber Costa 47b075
+ * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
Glauber Costa 47b075
+ * Copyright (C) 2006 Fabrice Bellard
Glauber Costa 47b075
+ * Copyright (C) 2009 Red Hat, Inc
Glauber Costa 47b075
+ *
Glauber Costa 47b075
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
Glauber Costa 47b075
+ * of this software and associated documentation files (the "Software"), to deal
Glauber Costa 47b075
+ * in the Software without restriction, including without limitation the rights
Glauber Costa 47b075
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Glauber Costa 47b075
+ * copies of the Software, and to permit persons to whom the Software is
Glauber Costa 47b075
+ * furnished to do so, subject to the following conditions:
Glauber Costa 47b075
+ *
Glauber Costa 47b075
+ * The above copyright notice and this permission notice shall be included in
Glauber Costa 47b075
+ * all copies or substantial portions of the Software.
Glauber Costa 47b075
+ *
Glauber Costa 47b075
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Glauber Costa 47b075
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Glauber Costa 47b075
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
Glauber Costa 47b075
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Glauber Costa 47b075
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Glauber Costa 47b075
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Glauber Costa 47b075
+ * THE SOFTWARE.
Glauber Costa 47b075
+ */
Glauber Costa 47b075
+
Glauber Costa 47b075
+#ifndef __QEMU_VNC_H
Glauber Costa 47b075
+#define __QEMU_VNC_H
Glauber Costa 47b075
+
Glauber Costa 47b075
+#include "qemu-common.h"
Glauber Costa 47b075
+#include "console.h"
Glauber Costa 47b075
+#include "audio/audio.h"
Glauber Costa 47b075
+#include <zlib.h>
Glauber Costa 47b075
+
Glauber Costa 47b075
+#ifdef CONFIG_VNC_TLS
Glauber Costa 47b075
+#include <gnutls/gnutls.h>
Glauber Costa 47b075
+#include <gnutls/x509.h>
Glauber Costa 47b075
+#endif /* CONFIG_VNC_TLS */
Glauber Costa 47b075
+
Glauber Costa 47b075
+#include "keymaps.h"
Glauber Costa 47b075
+
Glauber Costa 47b075
+/*****************************************************************************
Glauber Costa 47b075
+ *
Glauber Costa 47b075
+ * Core data structures
Glauber Costa 47b075
+ *
Glauber Costa 47b075
+ *****************************************************************************/
Glauber Costa 47b075
+
Glauber Costa 47b075
+typedef struct Buffer
Glauber Costa 47b075
+{
Glauber Costa 47b075
+    size_t capacity;
Glauber Costa 47b075
+    size_t offset;
Glauber Costa 47b075
+    uint8_t *buffer;
Glauber Costa 47b075
+} Buffer;
Glauber Costa 47b075
+
Glauber Costa 47b075
+typedef struct VncState VncState;
Glauber Costa 47b075
+
Glauber Costa 47b075
+typedef int VncReadEvent(VncState *vs, uint8_t *data, size_t len);
Glauber Costa 47b075
+
Glauber Costa 47b075
+typedef void VncWritePixels(VncState *vs, void *data, int size);
Glauber Costa 47b075
+
Glauber Costa 47b075
+typedef void VncSendHextileTile(VncState *vs,
Glauber Costa 47b075
+                                int x, int y, int w, int h,
Glauber Costa 47b075
+                                void *last_bg,
Glauber Costa 47b075
+                                void *last_fg,
Glauber Costa 47b075
+                                int *has_bg, int *has_fg);
Glauber Costa 47b075
+
Glauber Costa 47b075
+#define VNC_MAX_WIDTH 2048
Glauber Costa 47b075
+#define VNC_MAX_HEIGHT 2048
Glauber Costa 47b075
+#define VNC_DIRTY_WORDS (VNC_MAX_WIDTH / (16 * 32))
Glauber Costa 47b075
+
Glauber Costa 47b075
+#define VNC_AUTH_CHALLENGE_SIZE 16
Glauber Costa 47b075
+
Glauber Costa 47b075
+typedef struct VncDisplay VncDisplay;
Glauber Costa 47b075
+
Glauber Costa 47b075
+struct VncDisplay
Glauber Costa 47b075
+{
Glauber Costa 47b075
+    int lsock;
Glauber Costa 47b075
+    DisplayState *ds;
Glauber Costa 47b075
+    VncState *clients;
Glauber Costa 47b075
+    kbd_layout_t *kbd_layout;
Glauber Costa 47b075
+
Glauber Costa 47b075
+    char *display;
Glauber Costa 47b075
+    char *password;
Glauber Costa 47b075
+    int auth;
Glauber Costa 47b075
+#ifdef CONFIG_VNC_TLS
Glauber Costa 47b075
+    int subauth;
Glauber Costa 47b075
+    int x509verify;
Glauber Costa 47b075
+
Glauber Costa 47b075
+    char *x509cacert;
Glauber Costa 47b075
+    char *x509cacrl;
Glauber Costa 47b075
+    char *x509cert;
Glauber Costa 47b075
+    char *x509key;
Glauber Costa 47b075
+#endif
Glauber Costa 47b075
+};
Glauber Costa 47b075
+
Glauber Costa 47b075
+struct VncState
Glauber Costa 47b075
+{
Glauber Costa 47b075
+    QEMUTimer *timer;
Glauber Costa 47b075
+    int csock;
Glauber Costa 47b075
+    DisplayState *ds;
Glauber Costa 47b075
+    VncDisplay *vd;
Glauber Costa 47b075
+    int need_update;
Glauber Costa 47b075
+    uint32_t dirty_row[VNC_MAX_HEIGHT][VNC_DIRTY_WORDS];
Glauber Costa 47b075
+    char *old_data;
Glauber Costa 47b075
+    uint32_t features;
Glauber Costa 47b075
+    int absolute;
Glauber Costa 47b075
+    int last_x;
Glauber Costa 47b075
+    int last_y;
Glauber Costa 47b075
+
Glauber Costa 47b075
+    uint32_t vnc_encoding;
Glauber Costa 47b075
+    uint8_t tight_quality;
Glauber Costa 47b075
+    uint8_t tight_compression;
Glauber Costa 47b075
+
Glauber Costa 47b075
+    int major;
Glauber Costa 47b075
+    int minor;
Glauber Costa 47b075
+
Glauber Costa 47b075
+    char challenge[VNC_AUTH_CHALLENGE_SIZE];
Glauber Costa 47b075
+
Glauber Costa 47b075
+#ifdef CONFIG_VNC_TLS
Glauber Costa 47b075
+    int wiremode;
Glauber Costa 47b075
+    gnutls_session_t tls_session;
Glauber Costa 47b075
+#endif
Glauber Costa 47b075
+
Glauber Costa 47b075
+    Buffer output;
Glauber Costa 47b075
+    Buffer input;
Glauber Costa 47b075
+    /* current output mode information */
Glauber Costa 47b075
+    VncWritePixels *write_pixels;
Glauber Costa 47b075
+    VncSendHextileTile *send_hextile_tile;
Glauber Costa 47b075
+    DisplaySurface clientds, serverds;
Glauber Costa 47b075
+
Glauber Costa 47b075
+    CaptureVoiceOut *audio_cap;
Glauber Costa 47b075
+    struct audsettings as;
Glauber Costa 47b075
+
Glauber Costa 47b075
+    VncReadEvent *read_handler;
Glauber Costa 47b075
+    size_t read_handler_expect;
Glauber Costa 47b075
+    /* input */
Glauber Costa 47b075
+    uint8_t modifiers_state[256];
Glauber Costa 47b075
+
Glauber Costa 47b075
+    Buffer zlib;
Glauber Costa 47b075
+    Buffer zlib_tmp;
Glauber Costa 47b075
+    z_stream zlib_stream[4];
Glauber Costa 47b075
+
Glauber Costa 47b075
+    VncState *next;
Glauber Costa 47b075
+};
Glauber Costa 47b075
+
Glauber Costa 47b075
 
Glauber Costa 47b075
 /*****************************************************************************
Glauber Costa 47b075
  *
Glauber Costa 47b075
@@ -111,4 +254,4 @@ enum {
Glauber Costa 47b075
 #define VNC_FEATURE_ZLIB_MASK                (1 << VNC_FEATURE_ZLIB)
Glauber Costa 47b075
 #define VNC_FEATURE_COPYRECT_MASK            (1 << VNC_FEATURE_COPYRECT)
Glauber Costa 47b075
 
Glauber Costa 47b075
-#endif /* __VNCTIGHT_H */
Glauber Costa 47b075
+#endif /* __QEMU_VNC_H */