diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2011-08-03 15:43:02 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-08-23 18:23:46 +0300 |
commit | 812d01c06090f14ccb65e9a3b81df311c51e4b26 (patch) | |
tree | 673f86f7619dca9f611ac038e45e488ba7f97ee8 /server/red_channel.h | |
parent | 67671b26097a0d629a42356b22690c8b34db51a5 (diff) | |
download | spice-812d01c06090f14ccb65e9a3b81df311c51e4b26.tar.gz spice-812d01c06090f14ccb65e9a3b81df311c51e4b26.tar.xz spice-812d01c06090f14ccb65e9a3b81df311c51e4b26.zip |
server/red_channel.c: pack all channel callbacks to ChannelCbs
Diffstat (limited to 'server/red_channel.h')
-rw-r--r-- | server/red_channel.h | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/server/red_channel.h b/server/red_channel.h index 652673b5..996623bb 100644 --- a/server/red_channel.h +++ b/server/red_channel.h @@ -138,6 +138,23 @@ typedef uint64_t (*channel_handle_migrate_data_proc)(RedChannelClient *base, typedef uint64_t (*channel_handle_migrate_data_get_serial_proc)(RedChannelClient *base, uint32_t size, void *message); +/* + * callbacks that are triggered from channel client stream events. + * They are called from the thread that listen to the stream events. + */ +typedef struct { + channel_configure_socket_proc config_socket; + channel_disconnect_proc disconnect; + channel_send_pipe_item_proc send_item; + channel_hold_pipe_item_proc hold_item; + channel_release_pipe_item_proc release_item; + channel_alloc_msg_recv_buf_proc alloc_recv_buf; + channel_release_msg_recv_buf_proc release_recv_buf; + channel_handle_migrate_flush_mark_proc handle_migrate_flush_mark; + channel_handle_migrate_data_proc handle_migrate_data; + channel_handle_migrate_data_get_serial_proc handle_migrate_data_get_serial; +} ChannelCbs; + struct RedChannelClient { RingItem channel_link; RingItem client_link; @@ -179,11 +196,7 @@ struct RedChannel { OutgoingHandlerInterface outgoing_cb; IncomingHandlerInterface incoming_cb; - channel_configure_socket_proc config_socket; - channel_disconnect_proc disconnect; - channel_send_pipe_item_proc send_item; - channel_hold_pipe_item_proc hold_item; - channel_release_pipe_item_proc release_item; + ChannelCbs channel_cbs; /* Stuff below added for Main and Inputs channels switch to RedChannel * (might be removed later) */ @@ -191,9 +204,6 @@ struct RedChannel { channel_on_outgoing_error_proc on_outgoing_error; int shut; /* signal channel is to be closed */ - channel_handle_migrate_flush_mark_proc handle_migrate_flush_mark; - channel_handle_migrate_data_proc handle_migrate_data; - channel_handle_migrate_data_get_serial_proc handle_migrate_data_get_serial; #ifdef RED_STATISTICS uint64_t *out_bytes_counter; #endif @@ -204,37 +214,19 @@ struct RedChannel { RedChannel *red_channel_create(int size, SpiceCoreInterface *core, int migrate, int handle_acks, - channel_configure_socket_proc config_socket, - channel_disconnect_proc disconnect, channel_handle_message_proc handle_message, - channel_alloc_msg_recv_buf_proc alloc_recv_buf, - channel_release_msg_recv_buf_proc release_recv_buf, - channel_hold_pipe_item_proc hold_item, - channel_send_pipe_item_proc send_item, - channel_release_pipe_item_proc release_item, - channel_handle_migrate_flush_mark_proc handle_migrate_flush_mark, - channel_handle_migrate_data_proc handle_migrate_data, - channel_handle_migrate_data_get_serial_proc handle_migrate_data_get_serial); + ChannelCbs *channel_cbs); /* alternative constructor, meant for marshaller based (inputs,main) channels, * will become default eventually */ RedChannel *red_channel_create_parser(int size, SpiceCoreInterface *core, int migrate, int handle_acks, - channel_configure_socket_proc config_socket, - channel_disconnect_proc disconnect, spice_parse_channel_func_t parser, channel_handle_parsed_proc handle_parsed, - channel_alloc_msg_recv_buf_proc alloc_recv_buf, - channel_release_msg_recv_buf_proc release_recv_buf, - channel_hold_pipe_item_proc hold_item, - channel_send_pipe_item_proc send_item, - channel_release_pipe_item_proc release_item, channel_on_incoming_error_proc incoming_error, channel_on_outgoing_error_proc outgoing_error, - channel_handle_migrate_flush_mark_proc handle_migrate_flush_mark, - channel_handle_migrate_data_proc handle_migrate_data, - channel_handle_migrate_data_get_serial_proc handle_migrate_data_get_serial); + ChannelCbs *channel_cbs); RedChannelClient *red_channel_client_create(int size, RedChannel *channel, RedClient *client, RedsStream *stream); |