summaryrefslogtreecommitdiffstats
path: root/server/smartcard.c
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-11-10 09:52:28 +0200
committerAlon Levy <alevy@redhat.com>2011-03-02 17:27:52 +0200
commit8cd5568c92384490ec20f898d2d8c12009b6bf47 (patch)
treea9ef6fca1c4d6660b69b8b48e38b6d952fe0e63e /server/smartcard.c
parent16bff20f91c928349dff7329ac63bddcab2444b2 (diff)
downloadspice-8cd5568c92384490ec20f898d2d8c12009b6bf47.tar.gz
spice-8cd5568c92384490ec20f898d2d8c12009b6bf47.tar.xz
spice-8cd5568c92384490ec20f898d2d8c12009b6bf47.zip
server/red_channel (+): remove red_channel_add_buf
Diffstat (limited to 'server/smartcard.c')
-rw-r--r--server/smartcard.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/server/smartcard.c b/server/smartcard.c
index 4c50dbed..941c6329 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -257,20 +257,21 @@ static void smartcard_channel_release_msg_rcv_buf(RedChannel *channel, SpiceData
free(msg);
}
-static void smartcard_channel_send_data(RedChannel *channel, PipeItem *item, VSCMsgHeader *vheader)
+static void smartcard_channel_send_data(RedChannel *channel, SpiceMarshaller *m,
+ PipeItem *item, VSCMsgHeader *vheader)
{
ASSERT(channel);
ASSERT(vheader);
red_channel_init_send_data(channel, SPICE_MSG_SMARTCARD_DATA, item);
- red_channel_add_buf(channel, vheader, sizeof(VSCMsgHeader));
+ spice_marshaller_add_ref(m, (uint8_t*)vheader, sizeof(VSCMsgHeader));
if (vheader->length > 0) {
- red_channel_add_buf(channel, (uint8_t*)(vheader+1), vheader->length);
+ spice_marshaller_add_ref(m, (uint8_t*)(vheader+1), vheader->length);
}
red_channel_begin_send_message(channel);
}
-static void smartcard_channel_send_message(RedChannel *channel, PipeItem *item,
- uint32_t reader_id, VSCMsgType type, uint8_t* data, uint32_t len)
+static void smartcard_channel_send_message(RedChannel *channel, SpiceMarshaller *m,
+ PipeItem *item, uint32_t reader_id, VSCMsgType type, uint8_t* data, uint32_t len)
{
VSCMsgHeader mhHeader;
//SpiceMarshaller* m = msg->marshaller();
@@ -283,38 +284,39 @@ static void smartcard_channel_send_message(RedChannel *channel, PipeItem *item,
//spice_marshaller_add(m, data, len);
//marshaller_outgoing_write(msg);
- smartcard_channel_send_data(channel, item, &mhHeader);
+ smartcard_channel_send_data(channel, m, item, &mhHeader);
}
static void smartcard_channel_send_error(
- SmartCardChannel *smartcard_channel, PipeItem *item)
+ SmartCardChannel *smartcard_channel, SpiceMarshaller *m, PipeItem *item)
{
ErrorItem* error_item = (ErrorItem*)item;
VSCMsgError error;
error.code = error_item->error;
- smartcard_channel_send_message(&smartcard_channel->base, item, error_item->reader_id,
- VSC_Error, (uint8_t*)&error, sizeof(error));
+ smartcard_channel_send_message(&smartcard_channel->base, m, item,
+ error_item->reader_id, VSC_Error, (uint8_t*)&error, sizeof(error));
}
static void smartcard_channel_send_msg(
- SmartCardChannel *smartcard_channel, PipeItem *item)
+ SmartCardChannel *smartcard_channel, SpiceMarshaller *m, PipeItem *item)
{
MsgItem* msg_item = (MsgItem*)item;
- smartcard_channel_send_data(&smartcard_channel->base, item, msg_item->vheader);
+ smartcard_channel_send_data(&smartcard_channel->base, m, item, msg_item->vheader);
}
static void smartcard_channel_send_item(RedChannel *channel, PipeItem *item)
{
SmartCardChannel *smartcard_channel = (SmartCardChannel *)channel;
+ SpiceMarshaller *m = red_channel_get_marshaller(channel);
switch (item->type) {
case PIPE_ITEM_TYPE_ERROR:
- smartcard_channel_send_error(smartcard_channel, item);
+ smartcard_channel_send_error(smartcard_channel, m, item);
break;
case PIPE_ITEM_TYPE_MSG:
- smartcard_channel_send_msg(smartcard_channel, item);
+ smartcard_channel_send_msg(smartcard_channel, m, item);
}
}