render / rpms / qemu

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