[Spice-commits] 4 commits - configure.ac server/reds.c server/reds-private.h server/tests spice-common

Alon Levy alon at kemper.freedesktop.org
Thu Oct 25 03:32:04 PDT 2012


 configure.ac                     |    1 
 server/reds-private.h            |  182 +++++++++++++++++++++++++++++++++++++++
 server/reds.c                    |  180 --------------------------------------
 server/tests/test_display_base.c |    6 +
 spice-common                     |    2 
 5 files changed, 193 insertions(+), 178 deletions(-)

New commits:
commit f0761ef894e473f52553c89f7cb7157544dbf951
Author: Alon Levy <alevy at redhat.com>
Date:   Fri Oct 19 12:04:53 2012 +0200

    server/tests/test_display_base: fix segfault in test

diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 8c7f512..588e960 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -703,7 +703,11 @@ static int flush_resources(QXLInstance *qin)
 
 static void client_monitors_config(QXLInstance *qin, VDAgentMonitorsConfig *monitors_config)
 {
-    printf("%s: %d\n", __func__, monitors_config->num_of_monitors);
+    if (!monitors_config) {
+        printf("%s: NULL monitors_config\n", __func__);
+    } else {
+        printf("%s: %d\n", __func__, monitors_config->num_of_monitors);
+    }
 }
 
 QXLInterface display_sif = {
commit 488b7e40275762b872a22dd008d6f76e008a19e1
Author: Alon Levy <alevy at redhat.com>
Date:   Fri Oct 19 12:04:31 2012 +0200

    server/reds.c: split off reds-private.h

diff --git a/server/reds-private.h b/server/reds-private.h
new file mode 100644
index 0000000..3db6565
--- /dev/null
+++ b/server/reds-private.h
@@ -0,0 +1,182 @@
+#ifndef REDS_PRIVATE_H
+#define REDS_PRIVATE_H
+
+#include <time.h>
+
+#include <spice/protocol.h>
+
+#define MIGRATE_TIMEOUT (1000 * 10) /* 10sec */
+#define MM_TIMER_GRANULARITY_MS (1000 / 30)
+#define MM_TIME_DELTA 400 /*ms*/
+
+typedef struct TicketAuthentication {
+    char password[SPICE_MAX_PASSWORD_LENGTH];
+    time_t expiration_time;
+} TicketAuthentication;
+
+typedef struct TicketInfo {
+    RSA *rsa;
+    int rsa_size;
+    BIGNUM *bn;
+    SpiceLinkEncryptedTicket encrypted_ticket;
+} TicketInfo;
+
+typedef struct MonitorMode {
+    uint32_t x_res;
+    uint32_t y_res;
+} MonitorMode;
+
+typedef struct VDIReadBuf {
+    RingItem link;
+    uint32_t refs;
+
+    int len;
+    uint8_t data[SPICE_AGENT_MAX_DATA_SIZE];
+} VDIReadBuf;
+
+static VDIReadBuf *vdi_port_read_buf_get(void);
+static VDIReadBuf *vdi_port_read_buf_ref(VDIReadBuf *buf);
+static void vdi_port_read_buf_unref(VDIReadBuf *buf);
+
+enum {
+    VDI_PORT_READ_STATE_READ_HEADER,
+    VDI_PORT_READ_STATE_GET_BUFF,
+    VDI_PORT_READ_STATE_READ_DATA,
+};
+
+typedef struct VDIPortState {
+    SpiceCharDeviceState *base;
+    uint32_t plug_generation;
+    int client_agent_started;
+
+    /* write to agent */
+    SpiceCharDeviceWriteBuffer *recv_from_client_buf;
+    int recv_from_client_buf_pushed;
+    AgentMsgFilter write_filter;
+
+    /* read from agent */
+    Ring read_bufs;
+    uint32_t read_state;
+    uint32_t message_recive_len;
+    uint8_t *recive_pos;
+    uint32_t recive_len;
+    VDIReadBuf *current_read_buf;
+    AgentMsgFilter read_filter;
+
+    VDIChunkHeader vdi_chunk_header;
+
+    SpiceMigrateDataMain *mig_data; /* storing it when migration data arrives
+                                       before agent is attached */
+} VDIPortState;
+
+/* messages that are addressed to the agent and are created in the server */
+typedef struct __attribute__ ((__packed__)) VDInternalBuf {
+    VDIChunkHeader chunk_header;
+    VDAgentMessage header;
+    union {
+        VDAgentMouseState mouse_state;
+    }
+    u;
+} VDInternalBuf;
+
+#ifdef RED_STATISTICS
+
+#define REDS_MAX_STAT_NODES 100
+#define REDS_STAT_SHM_SIZE (sizeof(SpiceStat) + REDS_MAX_STAT_NODES * sizeof(SpiceStatNode))
+
+typedef struct RedsStatValue {
+    uint32_t value;
+    uint32_t min;
+    uint32_t max;
+    uint32_t average;
+    uint32_t count;
+} RedsStatValue;
+
+#endif
+
+typedef struct RedsMigPendingLink {
+    RingItem ring_link; // list of links that belongs to the same client
+    SpiceLinkMess *link_msg;
+    RedsStream *stream;
+} RedsMigPendingLink;
+
+typedef struct RedsMigTargetClient {
+    RingItem link;
+    RedClient *client;
+    Ring pending_links;
+} RedsMigTargetClient;
+
+typedef struct RedsMigWaitDisconnectClient {
+    RingItem link;
+    RedClient *client;
+} RedsMigWaitDisconnectClient;
+
+typedef struct SpiceCharDeviceStateItem {
+    RingItem link;
+    SpiceCharDeviceState *st;
+} SpiceCharDeviceStateItem;
+
+/* Intermediate state for on going monitors config message from a single
+ * client, being passed to the guest */
+typedef struct RedsClientMonitorsConfig {
+    MainChannelClient *mcc;
+    uint8_t *buffer;
+    int buffer_size;
+    int buffer_pos;
+} RedsClientMonitorsConfig;
+
+typedef struct RedsState {
+    int listen_socket;
+    int secure_listen_socket;
+    SpiceWatch *listen_watch;
+    SpiceWatch *secure_listen_watch;
+    VDIPortState agent_state;
+    int pending_mouse_event;
+    Ring clients;
+    int num_clients;
+    MainChannel *main_channel;
+
+    int mig_wait_connect; /* src waits for clients to establish connection to dest
+                             (before migration starts) */
+    int mig_wait_disconnect; /* src waits for clients to disconnect (after migration completes) */
+    Ring mig_wait_disconnect_clients; /* List of RedsMigWaitDisconnectClient. Holds the clients
+                                         which the src waits for their disconnection */
+
+    int mig_inprogress;
+    int expect_migrate;
+    int src_do_seamless_migrate; /* per migration. Updated after the migration handshake
+                                    between the 2 servers */
+    int dst_do_seamless_migrate; /* per migration. Updated after the migration handshake
+                                    between the 2 servers */
+    Ring mig_target_clients;
+    int num_mig_target_clients;
+    RedsMigSpice *mig_spice;
+
+    int num_of_channels;
+    Ring channels;
+    int mouse_mode;
+    int is_client_mouse_allowed;
+    int dispatcher_allows_client_mouse;
+    MonitorMode monitor_mode;
+    SpiceTimer *mig_timer;
+    SpiceTimer *mm_timer;
+
+    int vm_running;
+    Ring char_devs_states; /* list of SpiceCharDeviceStateItem */
+    int seamless_migration_enabled; /* command line arg */
+
+    SSL_CTX *ctx;
+
+#ifdef RED_STATISTICS
+    char *stat_shm_name;
+    SpiceStat *stat;
+    pthread_mutex_t stat_lock;
+    RedsStatValue roundtrip_stat;
+#endif
+    int peer_minor_version;
+    int allow_multiple_clients;
+
+    RedsClientMonitorsConfig client_monitors_config;
+} RedsState;
+
+#endif
diff --git a/server/reds.c b/server/reds.c
index 9fc0057..98c8706 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -75,6 +75,8 @@
 #include "smartcard.h"
 #endif
 
+#include "reds-private.h"
+
 SpiceCoreInterface *core = NULL;
 static SpiceCharDeviceInstance *vdagent = NULL;
 static SpiceMigrateInstance *migration_interface = NULL;
@@ -93,6 +95,8 @@ static SpiceMigrateInstance *migration_interface = NULL;
 #define REDS_TOKENS_TO_SEND 5
 #define REDS_VDI_PORT_NUM_RECEIVE_BUFFS 5
 
+static TicketAuthentication taTicket;
+
 static int spice_port = -1;
 static int spice_secure_port = -1;
 static int spice_listen_socket_fd = -1;
@@ -121,182 +125,6 @@ int agent_mouse = TRUE;
 int agent_copypaste = TRUE;
 static bool exit_on_disconnect = FALSE;
 
-#define MIGRATE_TIMEOUT (1000 * 10) /* 10sec */
-#define MM_TIMER_GRANULARITY_MS (1000 / 30)
-#define MM_TIME_DELTA 400 /*ms*/
-
-typedef struct TicketAuthentication {
-    char password[SPICE_MAX_PASSWORD_LENGTH];
-    time_t expiration_time;
-} TicketAuthentication;
-
-static TicketAuthentication taTicket;
-
-typedef struct TicketInfo {
-    RSA *rsa;
-    int rsa_size;
-    BIGNUM *bn;
-    SpiceLinkEncryptedTicket encrypted_ticket;
-} TicketInfo;
-
-typedef struct MonitorMode {
-    uint32_t x_res;
-    uint32_t y_res;
-} MonitorMode;
-
-typedef struct VDIReadBuf {
-    RingItem link;
-    uint32_t refs;
-
-    int len;
-    uint8_t data[SPICE_AGENT_MAX_DATA_SIZE];
-} VDIReadBuf;
-
-static VDIReadBuf *vdi_port_read_buf_get(void);
-static VDIReadBuf *vdi_port_read_buf_ref(VDIReadBuf *buf);
-static void vdi_port_read_buf_unref(VDIReadBuf *buf);
-
-enum {
-    VDI_PORT_READ_STATE_READ_HEADER,
-    VDI_PORT_READ_STATE_GET_BUFF,
-    VDI_PORT_READ_STATE_READ_DATA,
-};
-
-typedef struct VDIPortState {
-    SpiceCharDeviceState *base;
-    uint32_t plug_generation;
-    int client_agent_started;
-
-    /* write to agent */
-    SpiceCharDeviceWriteBuffer *recv_from_client_buf;
-    int recv_from_client_buf_pushed;
-    AgentMsgFilter write_filter;
-
-    /* read from agent */
-    Ring read_bufs;
-    uint32_t read_state;
-    uint32_t message_recive_len;
-    uint8_t *recive_pos;
-    uint32_t recive_len;
-    VDIReadBuf *current_read_buf;
-    AgentMsgFilter read_filter;
-
-    VDIChunkHeader vdi_chunk_header;
-
-    SpiceMigrateDataMain *mig_data; /* storing it when migration data arrives
-                                       before agent is attached */
-} VDIPortState;
-
-/* messages that are addressed to the agent and are created in the server */
-typedef struct __attribute__ ((__packed__)) VDInternalBuf {
-    VDIChunkHeader chunk_header;
-    VDAgentMessage header;
-    union {
-        VDAgentMouseState mouse_state;
-    }
-    u;
-} VDInternalBuf;
-
-#ifdef RED_STATISTICS
-
-#define REDS_MAX_STAT_NODES 100
-#define REDS_STAT_SHM_SIZE (sizeof(SpiceStat) + REDS_MAX_STAT_NODES * sizeof(SpiceStatNode))
-
-typedef struct RedsStatValue {
-    uint32_t value;
-    uint32_t min;
-    uint32_t max;
-    uint32_t average;
-    uint32_t count;
-} RedsStatValue;
-
-#endif
-
-typedef struct RedsMigPendingLink {
-    RingItem ring_link; // list of links that belongs to the same client
-    SpiceLinkMess *link_msg;
-    RedsStream *stream;
-} RedsMigPendingLink;
-
-typedef struct RedsMigTargetClient {
-    RingItem link;
-    RedClient *client;
-    Ring pending_links;
-} RedsMigTargetClient;
-
-typedef struct RedsMigWaitDisconnectClient {
-    RingItem link;
-    RedClient *client;
-} RedsMigWaitDisconnectClient;
-
-typedef struct SpiceCharDeviceStateItem {
-    RingItem link;
-    SpiceCharDeviceState *st;
-} SpiceCharDeviceStateItem;
-
-/* Intermediate state for on going monitors config message from a single
- * client, being passed to the guest */
-typedef struct RedsClientMonitorsConfig {
-    MainChannelClient *mcc;
-    uint8_t *buffer;
-    int buffer_size;
-    int buffer_pos;
-} RedsClientMonitorsConfig;
-
-typedef struct RedsState {
-    int listen_socket;
-    int secure_listen_socket;
-    SpiceWatch *listen_watch;
-    SpiceWatch *secure_listen_watch;
-    VDIPortState agent_state;
-    int pending_mouse_event;
-    Ring clients;
-    int num_clients;
-    MainChannel *main_channel;
-
-    int mig_wait_connect; /* src waits for clients to establish connection to dest
-                             (before migration starts) */
-    int mig_wait_disconnect; /* src waits for clients to disconnect (after migration completes) */
-    Ring mig_wait_disconnect_clients; /* List of RedsMigWaitDisconnectClient. Holds the clients
-                                         which the src waits for their disconnection */
-
-    int mig_inprogress;
-    int expect_migrate;
-    int src_do_seamless_migrate; /* per migration. Updated after the migration handshake
-                                    between the 2 servers */
-    int dst_do_seamless_migrate; /* per migration. Updated after the migration handshake
-                                    between the 2 servers */
-    Ring mig_target_clients;
-    int num_mig_target_clients;
-    RedsMigSpice *mig_spice;
-
-    int num_of_channels;
-    Ring channels;
-    int mouse_mode;
-    int is_client_mouse_allowed;
-    int dispatcher_allows_client_mouse;
-    MonitorMode monitor_mode;
-    SpiceTimer *mig_timer;
-    SpiceTimer *mm_timer;
-
-    int vm_running;
-    Ring char_devs_states; /* list of SpiceCharDeviceStateItem */
-    int seamless_migration_enabled; /* command line arg */
-
-    SSL_CTX *ctx;
-
-#ifdef RED_STATISTICS
-    char *stat_shm_name;
-    SpiceStat *stat;
-    pthread_mutex_t stat_lock;
-    RedsStatValue roundtrip_stat;
-#endif
-    int peer_minor_version;
-    int allow_multiple_clients;
-
-    RedsClientMonitorsConfig client_monitors_config;
-} RedsState;
-
 static RedsState *reds = NULL;
 
 typedef struct AsyncRead {
commit d227a5b6b689739aebe4ce27f1425bd0bb60cbd5
Author: Alon Levy <alevy at redhat.com>
Date:   Fri Oct 19 11:35:31 2012 +0200

    configure.ac: add libcacard to SPICE_REQUIRES if built with smartcard support

diff --git a/configure.ac b/configure.ac
index 51f6039..83d4c95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -234,6 +234,7 @@ if test "x$enable_smartcard" = "xyes"; then
     SMARTCARD_CFLAGS="$CAC_CARD_CFLAGS"
     AC_SUBST(SMARTCARD_LIBS)
     AC_SUBST(SMARTCARD_CFLAGS)
+    SPICE_REQUIRES+=" libcacard >= 0.1.2"
 fi
 
 
commit c114baddc95e37c9c45f008292766af5a6d98983
Author: Alon Levy <alevy at redhat.com>
Date:   Wed Oct 17 15:39:29 2012 +0200

    update spice-common

diff --git a/spice-common b/spice-common
index 9b9592f..20a39e0 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit 9b9592f80cb71b4dacf88400236a9138f227ae1d
+Subproject commit 20a39e0c1fcd61c07264cef7974b774d1afea8b6


More information about the Spice-commits mailing list