diff --git a/server/cursor-channel.c b/server/cursor-channel.c index 9af1db29..b3cbb96b 100644 --- a/server/cursor-channel.c +++ b/server/cursor-channel.c @@ -191,7 +191,7 @@ static void red_marshall_cursor_init(CursorChannelClient *ccc, SpiceMarshaller * spice_assert(rcc); cursor_channel = CURSOR_CHANNEL(red_channel_client_get_channel(rcc)); - red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INIT, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INIT); msg.visible = cursor_channel->cursor_visible; msg.position = cursor_channel->cursor_position; msg.trail_length = cursor_channel->cursor_trail_length; @@ -217,7 +217,7 @@ static void cursor_marshall(CursorChannelClient *ccc, case QXL_CURSOR_MOVE: { SpiceMsgCursorMove cursor_move; - red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_MOVE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_MOVE); cursor_move.position = cmd->u.position; spice_marshall_msg_cursor_move(m, &cursor_move); break; @@ -226,7 +226,7 @@ static void cursor_marshall(CursorChannelClient *ccc, { SpiceMsgCursorSet cursor_set; - red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_SET, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_SET); cursor_set.position = cmd->u.set.position; cursor_set.visible = cursor_channel->cursor_visible; @@ -235,13 +235,13 @@ static void cursor_marshall(CursorChannelClient *ccc, break; } case QXL_CURSOR_HIDE: - red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_HIDE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_HIDE); break; case QXL_CURSOR_TRAIL: { SpiceMsgCursorTrail cursor_trail; - red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_TRAIL, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_TRAIL); cursor_trail.length = cmd->u.trail.length; cursor_trail.frequency = cmd->u.trail.frequency; spice_marshall_msg_cursor_trail(m, &cursor_trail); @@ -258,7 +258,7 @@ static inline void red_marshall_inval(RedChannelClient *rcc, { SpiceMsgDisplayInvalOne inval_one; - red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ONE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ONE); inval_one.id = cach_item->id; spice_marshall_msg_cursor_inval_one(base_marshaller, &inval_one); @@ -282,7 +282,7 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it break; case RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE: cursor_channel_client_reset_cursor_cache(rcc); - red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ALL, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ALL); break; default: spice_error("invalid pipe item type"); diff --git a/server/dcc-send.c b/server/dcc-send.c index b6afefb5..ab5f0106 100644 --- a/server/dcc-send.c +++ b/server/dcc-send.c @@ -285,12 +285,12 @@ static void send_free_list(RedChannelClient *rcc) if (!free_list->wait.header.wait_count) { /* only one message, no need for a list */ - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_LIST, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_LIST); spice_marshall_msg_display_inval_list(urgent_marshaller, free_list->res); return; } - red_channel_client_init_send_data(rcc, SPICE_MSG_LIST, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_LIST); /* append invalidate list */ inval_m = spice_marshaller_get_submarshaller(urgent_marshaller); @@ -554,7 +554,7 @@ static void marshall_qxl_draw_fill(RedChannelClient *rcc, SpiceMarshaller *mask_bitmap_out; SpiceFill fill; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_FILL, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_FILL); fill_base(base_marshaller, item); fill = drawable->u.fill; spice_marshall_Fill(base_marshaller, @@ -898,7 +898,7 @@ static FillBitsType red_marshall_qxl_draw_opaque(RedChannelClient *rcc, SpiceOpaque opaque; FillBitsType src_send_type; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_OPAQUE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_OPAQUE); fill_base(base_marshaller, item); opaque = drawable->u.opaque; spice_marshall_Opaque(base_marshaller, @@ -995,7 +995,7 @@ static FillBitsType red_marshall_qxl_draw_copy(RedChannelClient *rcc, SpiceCopy copy; FillBitsType src_send_type; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY); fill_base(base_marshaller, item); copy = drawable->u.copy; spice_marshall_Copy(base_marshaller, @@ -1044,7 +1044,7 @@ static void red_marshall_qxl_draw_transparent(RedChannelClient *rcc, SpiceMarshaller *src_bitmap_out; SpiceTransparent transparent; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TRANSPARENT, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TRANSPARENT); fill_base(base_marshaller, item); transparent = drawable->u.transparent; spice_marshall_Transparent(base_marshaller, @@ -1092,7 +1092,7 @@ static FillBitsType red_marshall_qxl_draw_alpha_blend(RedChannelClient *rcc, SpiceAlphaBlend alpha_blend; FillBitsType src_send_type; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND); fill_base(base_marshaller, item); alpha_blend = drawable->u.alpha_blend; spice_marshall_AlphaBlend(base_marshaller, @@ -1139,7 +1139,7 @@ static void red_marshall_qxl_copy_bits(RedChannelClient *rcc, RedDrawable *drawable = item->red_drawable; SpicePoint copy_bits; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_COPY_BITS, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_COPY_BITS); fill_base(base_marshaller, item); copy_bits = drawable->u.copy_bits.src_pos; spice_marshall_Point(base_marshaller, @@ -1186,7 +1186,7 @@ static void red_marshall_qxl_draw_blend(RedChannelClient *rcc, SpiceMarshaller *mask_bitmap_out; SpiceBlend blend; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLEND, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLEND); fill_base(base_marshaller, item); blend = drawable->u.blend; spice_marshall_Blend(base_marshaller, @@ -1250,7 +1250,7 @@ static void red_marshall_qxl_draw_blackness(RedChannelClient *rcc, SpiceMarshaller *mask_bitmap_out; SpiceBlackness blackness; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLACKNESS, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_BLACKNESS); fill_base(base_marshaller, item); blackness = drawable->u.blackness; @@ -1284,7 +1284,7 @@ static void red_marshall_qxl_draw_whiteness(RedChannelClient *rcc, SpiceMarshaller *mask_bitmap_out; SpiceWhiteness whiteness; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_WHITENESS, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_WHITENESS); fill_base(base_marshaller, item); whiteness = drawable->u.whiteness; @@ -1317,7 +1317,7 @@ static void red_marshall_qxl_draw_inverse(RedChannelClient *rcc, SpiceMarshaller *mask_bitmap_out; SpiceInvers inverse; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_INVERS, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_INVERS); fill_base(base_marshaller, item); inverse = drawable->u.invers; @@ -1347,7 +1347,7 @@ static void red_marshall_qxl_draw_rop3(RedChannelClient *rcc, SpiceMarshaller *brush_pat_out; SpiceMarshaller *mask_bitmap_out; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ROP3, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_ROP3); fill_base(base_marshaller, item); rop3 = drawable->u.rop3; spice_marshall_Rop3(base_marshaller, @@ -1430,7 +1430,7 @@ static void red_marshall_qxl_draw_composite(RedChannelClient *rcc, SpiceMarshaller *mask_bitmap_out; SpiceComposite composite; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COMPOSITE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COMPOSITE); fill_base(base_marshaller, item); composite = drawable->u.composite; spice_marshall_Composite(base_marshaller, @@ -1511,7 +1511,7 @@ static void red_marshall_qxl_draw_stroke(RedChannelClient *rcc, SpiceMarshaller *brush_pat_out; SpiceMarshaller *style_out; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_STROKE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_STROKE); fill_base(base_marshaller, item); stroke = drawable->u.stroke; spice_marshall_Stroke(base_marshaller, @@ -1591,7 +1591,7 @@ static void red_marshall_qxl_draw_text(RedChannelClient *rcc, SpiceMarshaller *brush_pat_out; SpiceMarshaller *back_brush_pat_out; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TEXT, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_TEXT); fill_base(base_marshaller, item); text = drawable->u.text; spice_marshall_Text(base_marshaller, @@ -1739,7 +1739,7 @@ static int red_marshall_stream_data(RedChannelClient *rcc, if (!is_sized) { SpiceMsgDisplayStreamData stream_data; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA); stream_data.base.id = display_channel_get_stream_id(display, stream); stream_data.base.multi_media_time = frame_mm_time; @@ -1749,7 +1749,7 @@ static int red_marshall_stream_data(RedChannelClient *rcc, } else { SpiceMsgDisplayStreamDataSized stream_data; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA_SIZED, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA_SIZED); stream_data.base.id = display_channel_get_stream_id(display, stream); stream_data.base.multi_media_time = frame_mm_time; @@ -1779,7 +1779,7 @@ static inline void marshall_inval_palette(RedChannelClient *rcc, { SpiceMsgDisplayInvalOne inval_one; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_PALETTE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_PALETTE); inval_one.id = cache_item->id; spice_marshall_msg_display_inval_palette(base_marshaller, &inval_one); @@ -1826,7 +1826,7 @@ static void display_channel_marshall_migrate_data(RedChannelClient *rcc, display_channel = DISPLAY_CHANNEL(red_channel_client_get_channel(rcc)); - red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA); spice_marshaller_add_uint32(base_marshaller, SPICE_MIGRATE_DATA_DISPLAY_MAGIC); spice_marshaller_add_uint32(base_marshaller, SPICE_MIGRATE_DATA_DISPLAY_VERSION); @@ -1860,7 +1860,7 @@ static void display_channel_marshall_pixmap_sync(RedChannelClient *rcc, SpiceMsgWaitForChannels wait; PixmapCache *pixmap_cache; - red_channel_client_init_send_data(rcc, SPICE_MSG_WAIT_FOR_CHANNELS, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_WAIT_FOR_CHANNELS); pixmap_cache = dcc->priv->pixmap_cache; pthread_mutex_lock(&pixmap_cache->lock); @@ -1911,7 +1911,7 @@ static void display_channel_marshall_reset_cache(RedChannelClient *rcc, DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc); SpiceMsgWaitForChannels wait; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS); dcc_pixmap_cache_reset(dcc, &wait); spice_marshall_msg_display_inval_all_pixmaps(base_marshaller, @@ -1954,7 +1954,7 @@ static void red_marshall_image(RedChannelClient *rcc, chunks = spice_chunks_new_linear(item->data, bitmap.stride * bitmap.y); bitmap.data = chunks; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY); copy.base.surface_id = item->surface_id; copy.base.box.left = item->pos.x; @@ -2154,7 +2154,7 @@ static void marshall_stream_start(RedChannelClient *rcc, /* Without a video encoder nothing will be streamed */ return; } - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CREATE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CREATE); SpiceMsgDisplayStreamCreate stream_create; SpiceClipRects clip_rects; @@ -2192,7 +2192,7 @@ static void marshall_stream_clip(RedChannelClient *rcc, spice_return_if_fail(agent->stream); - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CLIP, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CLIP); SpiceMsgDisplayStreamClip stream_clip; stream_clip.id = display_channel_get_stream_id(DCC_TO_DC(dcc), agent->stream); @@ -2208,7 +2208,7 @@ static void marshall_stream_end(RedChannelClient *rcc, DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc); SpiceMsgDisplayStreamDestroy destroy; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DESTROY, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DESTROY); destroy.id = display_channel_get_stream_id(DCC_TO_DC(dcc), agent->stream); stream_agent_stop(agent); spice_marshall_msg_display_stream_destroy(base_marshaller, &destroy); @@ -2224,7 +2224,7 @@ static void marshall_upgrade(RedChannelClient *rcc, SpiceMarshaller *m, SpiceMarshaller *src_bitmap_out, *mask_bitmap_out; spice_assert(channel && item && item->drawable); - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_DRAW_COPY); red_drawable = item->drawable->red_drawable; spice_assert(red_drawable->type == QXL_DRAW_COPY); @@ -2250,7 +2250,7 @@ static void marshall_surface_create(RedChannelClient *rcc, DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc); region_init(&dcc->priv->surface_client_lossy_region[surface_create->surface_id]); - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_CREATE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_CREATE); spice_marshall_msg_display_surface_create(base_marshaller, surface_create); } @@ -2262,7 +2262,7 @@ static void marshall_surface_destroy(RedChannelClient *rcc, SpiceMsgSurfaceDestroy surface_destroy; region_destroy(&dcc->priv->surface_client_lossy_region[surface_id]); - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_DESTROY, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_DESTROY); surface_destroy.surface_id = surface_id; @@ -2277,7 +2277,7 @@ static void marshall_monitors_config(RedChannelClient *rcc, SpiceMarshaller *bas SpiceMsgDisplayMonitorsConfig *msg = spice_malloc0(sizeof(*msg) + heads_size); int count = 0; // ignore monitors_config->count, it may contain zero width monitors, remove them now - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_MONITORS_CONFIG, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_MONITORS_CONFIG); for (i = 0 ; i < monitors_config->count; ++i) { if (monitors_config->heads[i].width == 0 || monitors_config->heads[i].height == 0) { continue; @@ -2304,7 +2304,7 @@ static void marshall_stream_activate_report(RedChannelClient *rcc, StreamAgent *agent = &dcc->priv->stream_agents[stream_id]; SpiceMsgDisplayStreamActivateReport msg; - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT); msg.stream_id = stream_id; msg.unique_id = agent->report_id; msg.max_window_size = RED_STREAM_CLIENT_REPORT_WINDOW; @@ -2322,7 +2322,7 @@ static void marshall_gl_scanout(RedChannelClient *rcc, SpiceMsgDisplayGlScanoutUnix *scanout = red_qxl_get_gl_scanout(qxl); if (scanout != NULL) { - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX); spice_marshall_msg_display_gl_scanout_unix(m, scanout); } red_qxl_put_gl_scanout(qxl, scanout); @@ -2334,7 +2334,7 @@ static void marshall_gl_draw(RedChannelClient *rcc, { RedGlDrawItem *p = SPICE_UPCAST(RedGlDrawItem, item); - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_GL_DRAW, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_GL_DRAW); spice_marshall_msg_display_gl_draw(m, &p->draw); } @@ -2419,7 +2419,7 @@ void dcc_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item) break; case RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE: dcc_palette_cache_reset(dcc); - red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES); break; case RED_PIPE_ITEM_TYPE_CREATE_SURFACE: { RedSurfaceCreateItem *surface_create = SPICE_CONTAINEROF(pipe_item, RedSurfaceCreateItem, diff --git a/server/inputs-channel-client.c b/server/inputs-channel-client.c index 0200ecd4..4a534e86 100644 --- a/server/inputs-channel-client.c +++ b/server/inputs-channel-client.c @@ -89,7 +89,7 @@ void inputs_channel_client_send_migrate_data(RedChannelClient *rcc, { InputsChannelClient *icc = INPUTS_CHANNEL_CLIENT(rcc); - red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA); spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_INPUTS_MAGIC); spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_INPUTS_VERSION); diff --git a/server/inputs-channel.c b/server/inputs-channel.c index f628f482..f105b4d0 100644 --- a/server/inputs-channel.c +++ b/server/inputs-channel.c @@ -249,7 +249,7 @@ static void inputs_channel_send_item(RedChannelClient *rcc, RedPipeItem *base) { SpiceMsgInputsKeyModifiers key_modifiers; - red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_KEY_MODIFIERS, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_KEY_MODIFIERS); key_modifiers.modifiers = SPICE_UPCAST(RedKeyModifiersPipeItem, base)->modifiers; spice_marshall_msg_inputs_key_modifiers(m, &key_modifiers); @@ -259,14 +259,14 @@ static void inputs_channel_send_item(RedChannelClient *rcc, RedPipeItem *base) { SpiceMsgInputsInit inputs_init; - red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_INIT, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_INIT); inputs_init.keyboard_modifiers = SPICE_UPCAST(RedInputsInitPipeItem, base)->modifiers; spice_marshall_msg_inputs_init(m, &inputs_init); break; } case RED_PIPE_ITEM_MOUSE_MOTION_ACK: - red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_MOUSE_MOTION_ACK, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_MOUSE_MOTION_ACK); break; case RED_PIPE_ITEM_MIGRATE_DATA: INPUTS_CHANNEL(red_channel_client_get_channel(rcc))->src_during_migrate = FALSE; diff --git a/server/main-channel-client.c b/server/main-channel-client.c index a06eb484..94150e67 100644 --- a/server/main-channel-client.c +++ b/server/main-channel-client.c @@ -771,7 +771,7 @@ static void main_channel_marshall_channels(RedChannelClient *rcc, SpiceMsgChannels* channels_info; RedChannel *channel = red_channel_client_get_channel(rcc); - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_CHANNELS_LIST, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_CHANNELS_LIST); channels_info = reds_msg_channels_new(red_channel_get_server(channel)); spice_marshall_msg_main_channels_list(m, channels_info); free(channels_info); @@ -785,7 +785,7 @@ static void main_channel_marshall_ping(RedChannelClient *rcc, SpiceMsgPing ping; int size_left = item->size; - red_channel_client_init_send_data(rcc, SPICE_MSG_PING, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_PING); ping.id = main_channel_client_next_ping_id(mcc); ping.timestamp = g_get_monotonic_time(); spice_marshall_msg_ping(m, &ping); @@ -803,7 +803,7 @@ static void main_channel_marshall_mouse_mode(RedChannelClient *rcc, { SpiceMsgMainMouseMode mouse_mode; - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MOUSE_MODE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MOUSE_MODE); mouse_mode.supported_modes = SPICE_MOUSE_MODE_SERVER; if (item->is_client_mouse_allowed) { mouse_mode.supported_modes |= SPICE_MOUSE_MODE_CLIENT; @@ -818,7 +818,7 @@ static void main_channel_marshall_agent_disconnected(RedChannelClient *rcc, { SpiceMsgMainAgentDisconnect disconnect; - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DISCONNECTED, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DISCONNECTED); disconnect.error_code = SPICE_LINK_ERR_OK; spice_marshall_msg_main_agent_disconnected(m, &disconnect); } @@ -828,7 +828,7 @@ static void main_channel_marshall_tokens(RedChannelClient *rcc, { SpiceMsgMainAgentTokens tokens; - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_TOKEN, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_TOKEN); tokens.num_tokens = item->tokens; spice_marshall_msg_main_agent_token(m, &tokens); } @@ -837,7 +837,7 @@ static void main_channel_marshall_agent_data(RedChannelClient *rcc, SpiceMarshaller *m, RedAgentDataPipeItem *item) { - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DATA, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DATA); /* since pipe item owns the data, keep it alive until it's sent */ red_pipe_item_ref(&item->base); spice_marshaller_add_by_ref_full(m, item->data, item->len, marshaller_unref_pipe_item, item); @@ -848,7 +848,7 @@ static void main_channel_marshall_migrate_data_item(RedChannelClient *rcc, RedPipeItem *item) { RedChannel *channel = red_channel_client_get_channel(rcc); - red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA); // TODO: from reds split. ugly separation. reds_marshall_migrate_data(red_channel_get_server(channel), m); } @@ -860,7 +860,7 @@ static void main_channel_marshall_init(RedChannelClient *rcc, SpiceMsgMainInit init; // TODO - remove this copy, make RedInitPipeItem reuse SpiceMsgMainInit RedChannel *channel = red_channel_client_get_channel(rcc); - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_INIT, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_INIT); init.session_id = item->connection_id; init.display_channels_hint = item->display_channels_hint; init.current_mouse_mode = item->current_mouse_mode; @@ -880,7 +880,7 @@ static void main_channel_marshall_notify(RedChannelClient *rcc, { SpiceMsgNotify notify; - red_channel_client_init_send_data(rcc, SPICE_MSG_NOTIFY, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_NOTIFY); notify.time_stamp = spice_get_monotonic_time_ns(); // TODO - move to main_new_notify_item notify.severity = SPICE_NOTIFY_SEVERITY_WARN; notify.visibilty = SPICE_NOTIFY_VISIBILITY_HIGH; @@ -913,7 +913,7 @@ static void main_channel_marshall_migrate_begin(SpiceMarshaller *m, RedChannelCl RedChannel *channel = red_channel_client_get_channel(rcc); SpiceMsgMainMigrationBegin migrate; - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_BEGIN, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_BEGIN); main_channel_fill_migrate_dst_info(MAIN_CHANNEL(channel), &migrate.dst_info); spice_marshall_msg_main_migrate_begin(m, &migrate); } @@ -925,7 +925,7 @@ static void main_channel_marshall_migrate_begin_seamless(SpiceMarshaller *m, RedChannel *channel = red_channel_client_get_channel(rcc); SpiceMsgMainMigrateBeginSeamless migrate_seamless; - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS); main_channel_fill_migrate_dst_info(MAIN_CHANNEL(channel), &migrate_seamless.dst_info); migrate_seamless.src_mig_version = SPICE_MIGRATION_PROTOCOL_VERSION; spice_marshall_msg_main_migrate_begin_seamless(m, &migrate_seamless); @@ -937,7 +937,7 @@ static void main_channel_marshall_multi_media_time(RedChannelClient *rcc, { SpiceMsgMainMultiMediaTime time_mes; - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MULTI_MEDIA_TIME, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MULTI_MEDIA_TIME); time_mes.time = item->time; spice_marshall_msg_main_multi_media_time(m, &time_mes); } @@ -951,7 +951,7 @@ static void main_channel_marshall_migrate_switch(SpiceMarshaller *m, RedChannelC const RedsMigSpice *mig_target; spice_printerr(""); - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST); main_ch = MAIN_CHANNEL(channel); mig_target = main_channel_get_migration_target(main_ch); migrate.port = mig_target->port; @@ -974,7 +974,7 @@ static void main_channel_marshall_agent_connected(SpiceMarshaller *m, { SpiceMsgMainAgentConnectedTokens connected; - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS); connected.num_tokens = REDS_AGENT_WINDOW_SIZE; spice_marshall_msg_main_agent_connected_tokens(m, &connected); } @@ -1045,11 +1045,11 @@ void main_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *base) main_channel_marshall_migrate_switch(m, rcc, base); break; case RED_PIPE_ITEM_TYPE_MAIN_NAME: - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_NAME, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_NAME); spice_marshall_msg_main_name(m, &SPICE_UPCAST(RedNamePipeItem, base)->msg); break; case RED_PIPE_ITEM_TYPE_MAIN_UUID: - red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_UUID, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_UUID); spice_marshall_msg_main_uuid(m, &SPICE_UPCAST(RedUuidPipeItem, base)->msg); break; case RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS: diff --git a/server/red-channel-client-private.h b/server/red-channel-client-private.h index 0cb3ddd5..593fee50 100644 --- a/server/red-channel-client-private.h +++ b/server/red-channel-client-private.h @@ -69,14 +69,12 @@ struct RedChannelClientPrivate SpiceMarshaller *marshaller; SpiceDataHeaderOpaque header; uint32_t size; - RedPipeItem *item; int blocked; uint64_t last_sent_serial; struct { SpiceMarshaller *marshaller; uint8_t *header_data; - RedPipeItem *item; } main; struct { diff --git a/server/red-channel-client.c b/server/red-channel-client.c index a69146a7..8312d3e6 100644 --- a/server/red-channel-client.c +++ b/server/red-channel-client.c @@ -444,7 +444,7 @@ static void red_channel_client_send_set_ack(RedChannelClient *rcc) SpiceMsgSetAck ack; spice_assert(rcc); - red_channel_client_init_send_data(rcc, SPICE_MSG_SET_ACK, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_SET_ACK); ack.generation = ++rcc->priv->ack_data.generation; ack.window = rcc->priv->ack_data.client_window; rcc->priv->ack_data.messages_window = 0; @@ -458,7 +458,7 @@ static void red_channel_client_send_migrate(RedChannelClient *rcc) { SpiceMsgMigrate migrate; - red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE); g_object_get(rcc->priv->channel, "migration-flags", &migrate.flags, NULL); spice_marshall_msg_migrate(rcc->priv->send_data.marshaller, &migrate); if (migrate.flags & SPICE_MIGRATE_NEED_FLUSH) { @@ -500,7 +500,7 @@ static void red_channel_client_send_ping(RedChannelClient *rcc) } } - red_channel_client_init_send_data(rcc, SPICE_MSG_PING, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_PING); ping.id = rcc->priv->latency_monitor.id; ping.timestamp = spice_get_monotonic_time_ns(); spice_marshall_msg_ping(rcc->priv->send_data.marshaller, &ping); @@ -511,7 +511,7 @@ static void red_channel_client_send_empty_msg(RedChannelClient *rcc, RedPipeItem { RedEmptyMsgPipeItem *msg_pipe_item = SPICE_UPCAST(RedEmptyMsgPipeItem, base); - red_channel_client_init_send_data(rcc, msg_pipe_item->msg, NULL); + red_channel_client_init_send_data(rcc, msg_pipe_item->msg); red_channel_client_begin_send_message(rcc); } @@ -541,19 +541,10 @@ static void red_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *ite red_pipe_item_unref(item); } -static inline void red_channel_client_release_sent_item(RedChannelClient *rcc) -{ - if (rcc->priv->send_data.item) { - red_pipe_item_unref(rcc->priv->send_data.item); - rcc->priv->send_data.item = NULL; - } -} - static void red_channel_client_restore_main_sender(RedChannelClient *rcc) { rcc->priv->send_data.marshaller = rcc->priv->send_data.main.marshaller; rcc->priv->send_data.header.data = rcc->priv->send_data.main.header_data; - rcc->priv->send_data.item = rcc->priv->send_data.main.item; } void red_channel_client_on_out_msg_done(void *opaque) @@ -1391,15 +1382,11 @@ int red_channel_client_handle_message(RedChannelClient *rcc, uint32_t size, return TRUE; } -void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type, RedPipeItem *item) +void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type) { spice_assert(red_channel_client_no_item_being_sent(rcc)); spice_assert(msg_type != 0); rcc->priv->send_data.header.set_msg_type(&rcc->priv->send_data.header, msg_type); - rcc->priv->send_data.item = item; - if (item) { - red_pipe_item_ref(item); - } } void red_channel_client_begin_send_message(RedChannelClient *rcc) @@ -1432,10 +1419,8 @@ SpiceMarshaller *red_channel_client_switch_to_urgent_sender(RedChannelClient *rc spice_assert(red_channel_client_no_item_being_sent(rcc)); spice_assert(rcc->priv->send_data.header.data != NULL); rcc->priv->send_data.main.header_data = rcc->priv->send_data.header.data; - rcc->priv->send_data.main.item = rcc->priv->send_data.item; rcc->priv->send_data.marshaller = rcc->priv->send_data.urgent.marshaller; - rcc->priv->send_data.item = NULL; red_channel_client_reset_send_data(rcc); return rcc->priv->send_data.marshaller; } @@ -1587,7 +1572,6 @@ gboolean red_channel_client_is_connected(RedChannelClient *rcc) static void red_channel_client_clear_sent_item(RedChannelClient *rcc) { - red_channel_client_release_sent_item(rcc); rcc->priv->send_data.blocked = FALSE; rcc->priv->send_data.size = 0; spice_marshaller_reset(rcc->priv->send_data.marshaller); diff --git a/server/red-channel-client.h b/server/red-channel-client.h index 94b4f58f..0d404d1f 100644 --- a/server/red-channel-client.h +++ b/server/red-channel-client.h @@ -89,7 +89,7 @@ void red_channel_client_shutdown(RedChannelClient *rcc); int red_channel_client_handle_message(RedChannelClient *rcc, uint32_t size, uint16_t type, void *message); /* when preparing send_data: should call init and then use marshaller */ -void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type, RedPipeItem *item); +void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type); uint64_t red_channel_client_get_message_serial(RedChannelClient *channel); void red_channel_client_set_message_serial(RedChannelClient *channel, uint64_t); diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c index 6f39874b..668a1fb8 100644 --- a/server/smartcard-channel-client.c +++ b/server/smartcard-channel-client.c @@ -214,7 +214,7 @@ void smartcard_channel_client_send_data(RedChannelClient *rcc, /* NOTE: 'vheader' is assumed to be owned by 'item' so we keep the pipe * item valid until the message is actually sent. */ red_pipe_item_ref(item); - red_channel_client_init_send_data(rcc, SPICE_MSG_SMARTCARD_DATA, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_SMARTCARD_DATA); spice_marshaller_add_by_ref_full(m, (uint8_t*)vheader, sizeof(VSCMsgHeader) + vheader->length, marshaller_unref_pipe_item, item); } diff --git a/server/smartcard.c b/server/smartcard.c index 9e0d968b..f4bc40d3 100644 --- a/server/smartcard.c +++ b/server/smartcard.c @@ -419,7 +419,7 @@ static void smartcard_channel_send_migrate_data(RedChannelClient *rcc, scc = SMARTCARD_CHANNEL_CLIENT(rcc); dev = smartcard_channel_client_get_char_device(scc); - red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA); spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SMARTCARD_MAGIC); spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SMARTCARD_VERSION); diff --git a/server/spicevmc.c b/server/spicevmc.c index d5e398b0..bbe72b5c 100644 --- a/server/spicevmc.c +++ b/server/spicevmc.c @@ -635,10 +635,10 @@ static void spicevmc_red_channel_send_data(RedChannelClient *rcc, /* for compatibility send using not compressed data message */ if (i->type == SPICE_DATA_COMPRESSION_TYPE_NONE) { - red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_DATA, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_DATA); } else { /* send as compressed */ - red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_COMPRESSED_DATA, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_COMPRESSED_DATA); SpiceMsgCompressedData compressed_msg = { .type = i->type, .uncompressed_size = i->uncompressed_data_size @@ -657,7 +657,7 @@ static void spicevmc_red_channel_send_migrate_data(RedChannelClient *rcc, RedVmcChannel *channel; channel = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc)); - red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA); spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SPICEVMC_MAGIC); spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SPICEVMC_VERSION); @@ -671,7 +671,7 @@ static void spicevmc_red_channel_send_port_init(RedChannelClient *rcc, RedPortInitPipeItem *i = SPICE_UPCAST(RedPortInitPipeItem, item); SpiceMsgPortInit init; - red_channel_client_init_send_data(rcc, SPICE_MSG_PORT_INIT, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_PORT_INIT); init.name = (uint8_t *)i->name; init.name_size = strlen(i->name) + 1; init.opened = i->opened; @@ -685,7 +685,7 @@ static void spicevmc_red_channel_send_port_event(RedChannelClient *rcc, RedPortEventPipeItem *i = SPICE_UPCAST(RedPortEventPipeItem, item); SpiceMsgPortEvent event; - red_channel_client_init_send_data(rcc, SPICE_MSG_PORT_EVENT, NULL); + red_channel_client_init_send_data(rcc, SPICE_MSG_PORT_EVENT); event.event = i->event; spice_marshall_msg_port_event(m, &event); }