diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2011-10-05 09:05:13 +0200 |
---|---|---|
committer | Yonit Halperin <yhalperi@redhat.com> | 2011-11-02 11:19:48 +0200 |
commit | 0bf518cd3daad526a16468e82c1d6c715535e9ba (patch) | |
tree | 937b1d33c82d86a5ac391335069e3115d6a40bef /server/red_channel.h | |
parent | bd8771adbcf3ff34d14333cf874191e8d105f612 (diff) | |
download | spice-0bf518cd3daad526a16468e82c1d6c715535e9ba.tar.gz spice-0bf518cd3daad526a16468e82c1d6c715535e9ba.tar.xz spice-0bf518cd3daad526a16468e82c1d6c715535e9ba.zip |
server: set & test channel capabilities in red_channel
The code for setting and testing channel capabilities was
unnecessarily duplicated. Now it is in red_channel.
RedsChannel was dropped from Reds; It was used only for holding
the channels common capabilities, which are now held in RedChannel.
Diffstat (limited to 'server/red_channel.h')
-rw-r--r-- | server/red_channel.h | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/server/red_channel.h b/server/red_channel.h index 2ebb6b63..d044253a 100644 --- a/server/red_channel.h +++ b/server/red_channel.h @@ -143,7 +143,7 @@ typedef uint64_t (*channel_handle_migrate_data_get_serial_proc)(RedChannelClient typedef void (*channel_client_connect_proc)(RedChannel *channel, RedClient *client, RedsStream *stream, - int migration, int num_common_caps, uint32_t *common_caps, + int migration, int num_common_cap, uint32_t *common_caps, int num_caps, uint32_t *caps); typedef void (*channel_client_disconnect_proc)(RedChannelClient *base); typedef void (*channel_client_migrate_proc)(RedChannelClient *base); @@ -178,6 +178,15 @@ typedef struct { channel_client_migrate_proc migrate; } ClientCbs; +typedef struct RedChannelCapabilities { + int num_common_caps; + uint32_t *common_caps; + int num_caps; + uint32_t *caps; +} RedChannelCapabilities; + +int test_capabilty(uint32_t *caps, int num_caps, uint32_t cap); + struct RedChannelClient { RingItem channel_link; RingItem client_link; @@ -206,12 +215,16 @@ struct RedChannelClient { int id; // debugging purposes Ring pipe; uint32_t pipe_size; + + RedChannelCapabilities remote_caps; }; struct RedChannel { uint32_t type; uint32_t id; + RingItem link; // channels link for reds + SpiceCoreInterface *core; int migrate; int handle_acks; @@ -232,8 +245,7 @@ struct RedChannel { ChannelCbs channel_cbs; ClientCbs client_cbs; - int num_caps; - uint32_t *caps; + RedChannelCapabilities local_caps; void *data; @@ -265,19 +277,23 @@ RedChannel *red_channel_create_parser(int size, void red_channel_register_client_cbs(RedChannel *channel, ClientCbs *client_cbs); // caps are freed when the channel is destroyed -void red_channel_set_caps(RedChannel *channel, int num_caps, uint32_t *caps); +void red_channel_set_common_cap(RedChannel *channel, uint32_t cap); +void red_channel_set_cap(RedChannel *channel, uint32_t cap); void red_channel_set_data(RedChannel *channel, void *data); RedChannelClient *red_channel_client_create(int size, RedChannel *channel, RedClient *client, - RedsStream *stream); - + RedsStream *stream, + int num_common_caps, uint32_t *common_caps, + int num_caps, uint32_t *caps); // TODO: tmp, for channels that don't use RedChannel yet (e.g., snd channel), but // do use the client callbacks. So the channel clients are not connected (the channel doesn't // have list of them, but they do have a link to the channel, and the client has a list of them) RedChannel *red_channel_create_dummy(int size, uint32_t type, uint32_t id); RedChannelClient *red_channel_client_create_dummy(int size, RedChannel *channel, - RedClient *client); + RedClient *client, + int num_common_caps, uint32_t *common_caps, + int num_caps, uint32_t *caps); void red_channel_client_destroy_dummy(RedChannelClient *rcc); @@ -294,6 +310,9 @@ int red_channel_client_is_connected(RedChannelClient *rcc); void red_channel_client_destroy(RedChannelClient *rcc); 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); + /* 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. */ |