[Spice-devel] [spice PATCH 01/55] red_channel: add red_channel_test_remote_cap
Yonit Halperin
yhalperi at redhat.com
Wed Aug 15 00:55:41 PDT 2012
for checking if all the channel clients connected support the cap
---
server/red_channel.c | 28 ++++++++++++++++++++++++++++
server/red_channel.h | 4 ++++
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/server/red_channel.c b/server/red_channel.c
index 2a7acbf..1cad9eb 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -560,6 +560,34 @@ int red_channel_client_test_remote_cap(RedChannelClient *rcc, uint32_t cap)
cap);
}
+int red_channel_test_remote_common_cap(RedChannel *channel, uint32_t cap)
+{
+ RingItem *link;
+
+ RING_FOREACH(link, &channel->clients) {
+ RedChannelClient *rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
+
+ if (!red_channel_client_test_remote_common_cap(rcc, cap)) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+int red_channel_test_remote_cap(RedChannel *channel, uint32_t cap)
+{
+ RingItem *link;
+
+ RING_FOREACH(link, &channel->clients) {
+ RedChannelClient *rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
+
+ if (!red_channel_client_test_remote_cap(rcc, cap)) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
static int red_channel_client_pre_create_validate(RedChannel *channel, RedClient *client)
{
if (red_client_get_channel(client, channel->type, channel->id)) {
diff --git a/server/red_channel.h b/server/red_channel.h
index e77e484..acb49cd 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -363,6 +363,10 @@ void red_channel_destroy(RedChannel *channel);
int red_channel_client_test_remote_common_cap(RedChannelClient *rcc, uint32_t cap);
int red_channel_client_test_remote_cap(RedChannelClient *rcc, uint32_t cap);
+/* return true if all the channel clients support the cap */
+int red_channel_test_remote_common_cap(RedChannel *channel, uint32_t cap);
+int red_channel_test_remote_cap(RedChannel *channel, uint32_t cap);
+
/* shutdown is the only safe thing to do out of the client/channel
* thread. It will not touch the rings, just shutdown the socket.
* It should be followed by some way to gurantee a disconnection. */
--
1.7.7.6
More information about the Spice-devel
mailing list