summaryrefslogtreecommitdiffstats
path: root/server/main_channel.h
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2011-10-05 09:05:13 +0200
committerYonit Halperin <yhalperi@redhat.com>2011-11-02 11:19:48 +0200
commit0bf518cd3daad526a16468e82c1d6c715535e9ba (patch)
tree937b1d33c82d86a5ac391335069e3115d6a40bef /server/main_channel.h
parentbd8771adbcf3ff34d14333cf874191e8d105f612 (diff)
downloadspice-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/main_channel.h')
-rw-r--r--server/main_channel.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/server/main_channel.h b/server/main_channel.h
index 713bcd09..2ae05e8b 100644
--- a/server/main_channel.h
+++ b/server/main_channel.h
@@ -45,7 +45,20 @@ struct MainMigrateData {
uint32_t write_queue_size;
};
-typedef struct MainChannel MainChannel;
+// TODO: Defines used to calculate receive buffer size, and also by reds.c
+// other options: is to make a reds_main_consts.h, to duplicate defines.
+#define REDS_AGENT_WINDOW_SIZE 10
+#define REDS_NUM_INTERNAL_AGENT_MESSAGES 1
+
+// approximate max receive message size for main channel
+#define RECEIVE_BUF_SIZE \
+ (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * SPICE_AGENT_MAX_DATA_SIZE)
+
+typedef struct MainChannel {
+ RedChannel base;
+ uint8_t recv_buf[RECEIVE_BUF_SIZE];
+} MainChannel;
+
MainChannel *main_channel_init(void);
RedClient *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t link_id);
@@ -82,9 +95,4 @@ int main_channel_client_is_low_bandwidth(MainChannelClient *mcc);
uint64_t main_channel_client_get_bitrate_per_sec(MainChannelClient *mcc);
int main_channel_is_connected(MainChannel *main_chan);
-// TODO: Defines used to calculate receive buffer size, and also by reds.c
-// other options: is to make a reds_main_consts.h, to duplicate defines.
-#define REDS_AGENT_WINDOW_SIZE 10
-#define REDS_NUM_INTERNAL_AGENT_MESSAGES 1
-
#endif