summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2013-08-14 09:38:12 -0400
committerYonit Halperin <yhalperi@redhat.com>2013-08-14 11:08:17 -0400
commitd1e7142a0f90e2b977d2a73d26dc5b09d7771826 (patch)
tree53e3b390bcd5610061877d3b3a9be5291b245dc1 /server
parentc1c08c289883455f025836f14eda7bfd86442ed7 (diff)
downloadspice-d1e7142a0f90e2b977d2a73d26dc5b09d7771826.tar.gz
spice-d1e7142a0f90e2b977d2a73d26dc5b09d7771826.tar.xz
spice-d1e7142a0f90e2b977d2a73d26dc5b09d7771826.zip
red_channel: add on_input callback for tracing incoming bytes
The callback will be used in the next patch.
Diffstat (limited to 'server')
-rw-r--r--server/red_channel.c7
-rw-r--r--server/red_channel.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/server/red_channel.c b/server/red_channel.c
index 37b0c1c6..bcf5a607 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -251,6 +251,7 @@ static void red_peer_handle_incoming(RedsStream *stream, IncomingHandler *handle
handler->cb->on_error(handler->opaque);
return;
}
+ handler->cb->on_input(handler->opaque, bytes_read);
handler->header_pos += bytes_read;
if (handler->header_pos != handler->header.header_size) {
@@ -278,6 +279,7 @@ static void red_peer_handle_incoming(RedsStream *stream, IncomingHandler *handle
handler->cb->on_error(handler->opaque);
return;
}
+ handler->cb->on_input(handler->opaque, bytes_read);
handler->msg_pos += bytes_read;
if (handler->msg_pos != msg_size) {
return;
@@ -390,6 +392,10 @@ static void red_channel_client_on_output(void *opaque, int n)
stat_inc_counter(rcc->channel->out_bytes_counter, n);
}
+static void red_channel_client_on_input(void *opaque, int n)
+{
+}
+
static void red_channel_client_default_peer_on_error(RedChannelClient *rcc)
{
red_channel_client_disconnect(rcc);
@@ -935,6 +941,7 @@ RedChannel *red_channel_create(int size,
channel->incoming_cb.handle_message = (handle_message_proc)handle_message;
channel->incoming_cb.on_error =
(on_incoming_error_proc)red_channel_client_default_peer_on_error;
+ channel->incoming_cb.on_input = red_channel_client_on_input;
channel->outgoing_cb.get_msg_size = red_channel_client_peer_get_out_msg_size;
channel->outgoing_cb.prepare = red_channel_client_peer_prepare_out_msg;
channel->outgoing_cb.on_block = red_channel_client_peer_on_out_block;
diff --git a/server/red_channel.h b/server/red_channel.h
index 9021b3f0..1592896b 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -74,6 +74,7 @@ typedef uint8_t *(*alloc_msg_recv_buf_proc)(void *opaque, uint16_t type, uint32_
typedef void (*release_msg_recv_buf_proc)(void *opaque,
uint16_t type, uint32_t size, uint8_t *msg);
typedef void (*on_incoming_error_proc)(void *opaque);
+typedef void (*on_input_proc)(void *opaque, int n);
typedef struct IncomingHandlerInterface {
handle_message_proc handle_message;
@@ -83,6 +84,7 @@ typedef struct IncomingHandlerInterface {
// The following is an optional alternative to handle_message, used if not null
spice_parse_channel_func_t parser;
handle_parsed_proc handle_parsed;
+ on_input_proc on_input;
} IncomingHandlerInterface;
typedef struct IncomingHandler {