summaryrefslogtreecommitdiff
path: root/server/red_channel.h
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2012-01-08 09:20:55 +0200
committerYonit Halperin <yhalperi@redhat.com>2012-01-12 16:33:36 +0200
commit65c859ba819fdc70ebc3ba5208bb994d06174873 (patch)
tree0156288ab282012b7fdf9e8ad0b1bf66ada00e58 /server/red_channel.h
parentec0bf2488f2ac0b7fb5102fd3d8822fd2883bd0a (diff)
server: add support for SPICE_COMMON_CAP_MINI_HEADER
Support for a header without a serial and without sub list. red_channel: Support the two types of headers. Keep a consistent consecutive messages serial. red_worker: use urgent marshaller instead of sub list. snd_worker: Sound channels need special support since they still don't use red_channel for sending & receiving.
Diffstat (limited to 'server/red_channel.h')
-rw-r--r--server/red_channel.h35
1 files changed, 31 insertions, 4 deletions
diff --git a/server/red_channel.h b/server/red_channel.h
index 40792c1..045bfd4 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -33,10 +33,34 @@
#define MAX_SEND_VEC 100
#define CLIENT_ACK_WINDOW 20
+#define MAX_HEADER_SIZE sizeof(SpiceDataHeader)
+
/* Basic interface for channels, without using the RedChannel interface.
The intention is to move towards one channel interface gradually.
At the final stage, this interface shouldn't be exposed. Only RedChannel will use it. */
+typedef struct SpiceDataHeaderOpaque SpiceDataHeaderOpaque;
+
+typedef uint16_t (*get_msg_type_proc)(SpiceDataHeaderOpaque *header);
+typedef uint32_t (*get_msg_size_proc)(SpiceDataHeaderOpaque *header);
+typedef void (*set_msg_type_proc)(SpiceDataHeaderOpaque *header, uint16_t type);
+typedef void (*set_msg_size_proc)(SpiceDataHeaderOpaque *header, uint32_t size);
+typedef void (*set_msg_serial_proc)(SpiceDataHeaderOpaque *header, uint64_t serial);
+typedef void (*set_msg_sub_list_proc)(SpiceDataHeaderOpaque *header, uint32_t sub_list);
+
+struct SpiceDataHeaderOpaque {
+ uint8_t *data;
+ uint16_t header_size;
+
+ set_msg_type_proc set_msg_type;
+ set_msg_size_proc set_msg_size;
+ set_msg_serial_proc set_msg_serial;
+ set_msg_sub_list_proc set_msg_sub_list;
+
+ get_msg_type_proc get_msg_type;
+ get_msg_size_proc get_msg_size;
+};
+
typedef int (*handle_message_proc)(void *opaque,
uint16_t type, uint32_t size, uint8_t *msg);
typedef int (*handle_parsed_proc)(void *opaque, uint32_t size, uint16_t type, void *message);
@@ -58,10 +82,12 @@ typedef struct IncomingHandlerInterface {
typedef struct IncomingHandler {
IncomingHandlerInterface *cb;
void *opaque;
- SpiceDataHeader header;
+ uint8_t header_buf[MAX_HEADER_SIZE];
+ SpiceDataHeaderOpaque header;
uint32_t header_pos;
uint8_t *msg; // data of the msg following the header. allocated by alloc_msg_buf.
uint32_t msg_pos;
+ uint64_t serial;
} IncomingHandler;
typedef int (*get_outgoing_msg_size_proc)(void *opaque);
@@ -202,21 +228,21 @@ struct RedChannelClient {
struct {
SpiceMarshaller *marshaller;
- SpiceDataHeader *header;
+ SpiceDataHeaderOpaque header;
uint32_t size;
PipeItem *item;
int blocked;
uint64_t serial;
+ uint64_t last_sent_serial;
struct {
SpiceMarshaller *marshaller;
- SpiceDataHeader *header;
+ uint8_t *header_data;
PipeItem *item;
} main;
struct {
SpiceMarshaller *marshaller;
- SpiceDataHeader *header;
} urgent;
} send_data;
@@ -228,6 +254,7 @@ struct RedChannelClient {
uint32_t pipe_size;
RedChannelCapabilities remote_caps;
+ int is_mini_header;
};
struct RedChannel {