[PATCH 2/9] Introduce test_link_capability()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This just hides a bit of pointer arithmetic away from reds_send_link_ack.
This helper will be used in the next commits.
---
 server/reds.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 0a28032..1e169ad 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1326,6 +1326,15 @@ static void reds_channel_init_auth_caps(RedLinkInfo *link, RedChannel *channel)
     red_channel_set_common_cap(channel, SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION);
 }
 
+
+static bool test_link_capability(RedLinkInfo *link, uint32_t cap)
+{
+    uint32_t *caps = (uint32_t *)((uint8_t *)link->link_mess + link->link_mess->caps_offset);
+
+    return test_capability(caps, link->link_mess->num_common_caps, cap);
+}
+
+
 static int reds_send_link_ack(RedLinkInfo *link)
 {
     SpiceLinkHeader header;
@@ -2050,7 +2059,6 @@ static void reds_handle_read_link_done(void *opaque)
     SpiceLinkMess *link_mess = link->link_mess;
     AsyncRead *obj = &link->async_read;
     uint32_t num_caps = link_mess->num_common_caps + link_mess->num_channel_caps;
-    uint32_t *caps = (uint32_t *)((uint8_t *)link_mess + link_mess->caps_offset);
     int auth_selection;
 
     if (num_caps && (num_caps * sizeof(uint32_t) + link_mess->caps_offset >
@@ -2061,8 +2069,8 @@ static void reds_handle_read_link_done(void *opaque)
         return;
     }
 
-    auth_selection = test_capability(caps, link_mess->num_common_caps,
-                                     SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION);
+    auth_selection = test_link_capability(link,
+                                          SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION);
 
     if (!reds_security_check(link)) {
         if (reds_stream_is_ssl(link->stream)) {
-- 
1.8.5.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]