[Spice-devel] [PATCH 02/18] channel security cleanup

Gerd Hoffmann kraxel at redhat.com
Mon Mar 29 08:08:38 PDT 2010


drop spice_channel_name_t enum, use spice-protocol defines instead.
---
 server/reds.c  |   26 +++++++++-----------------
 server/spice.h |   16 ++--------------
 2 files changed, 11 insertions(+), 31 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 7ab7805..59f97be 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3751,16 +3751,6 @@ static void reds_do_set_playback_compression_2(const VDICmdArg *args)
     reds_do_set_playback_compression(args[0].string_val);
 }
 
-static void set_all_channels_security(uint32_t security)
-{
-    while (channels_security) {
-        ChannelSecurityOptions *temp = channels_security;
-        channels_security = channels_security->next;
-        free(temp);
-    }
-    default_channel_security = security;
-}
-
 static void set_one_channel_security(int id, uint32_t security)
 {
     ChannelSecurityOptions *security_options;
@@ -5230,15 +5220,17 @@ spice_image_compression_t spice_server_get_image_compression(SpiceServer *s)
 }
 
 int spice_server_set_channel_security(SpiceServer *s,
-                                      spice_channel_name_t channel,
-                                      int security)
+                                      int channel, int security)
 {
     ASSERT(reds == s);
-    if (channel == SPICE_CHANNEL_NAME_ALL) {
-        set_all_channels_security(security);
-    } else {
-        set_one_channel_security(channel, security);
-    }
+    set_one_channel_security(channel, security);
+    return 0;
+}
+
+int spice_server_set_default_channel_security(SpiceServer *s, int security)
+{
+    ASSERT(reds == s);
+    default_channel_security = security;
     return 0;
 }
 
diff --git a/server/spice.h b/server/spice.h
index 4f05aab..9ef9d1a 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -61,24 +61,12 @@ int spice_server_set_image_compression(SpiceServer *s,
                                        spice_image_compression_t comp);
 spice_image_compression_t spice_server_get_image_compression(SpiceServer *s);
 
-typedef enum {
-    SPICE_CHANNEL_NAME_INVALID  = 0,
-    SPICE_CHANNEL_NAME_MAIN     = 1,
-    SPICE_CHANNEL_NAME_DISPLAY,
-    SPICE_CHANNEL_NAME_INPUTS,
-    SPICE_CHANNEL_NAME_CURSOR,
-    SPICE_CHANNEL_NAME_PLAYBACK,
-    SPICE_CHANNEL_NAME_RECORD,
-    SPICE_CHANNEL_NAME_TUNNEL,
-    SPICE_CHANNEL_NAME_ALL      = 999,
-} spice_channel_name_t;
-
 #define SPICE_CHANNEL_SECURITY_NONE (1 << 0)
 #define SPICE_CHANNEL_SECURITY_SSL (1 << 1)
 
 int spice_server_set_channel_security(SpiceServer *s,
-                                      spice_channel_name_t channel,
-                                      int security);
+                                      int channel, int security);
+int spice_server_set_default_channel_security(SpiceServer *s, int security);
 
 int spice_server_set_mouse_absolute(SpiceServer *s, int absolute);
 
-- 
1.6.6.1



More information about the Spice-devel mailing list