[Spice-devel] [PATCH spice-server 2/4] red_channel: add on_input callback for tracing incoming bytes
Alon Levy
alevy at redhat.com
Wed Aug 14 09:28:53 PDT 2013
ACK
> The callback will be used in the next patch.
> ---
> server/red_channel.c | 7 +++++++
> server/red_channel.h | 2 ++
> 2 files changed, 9 insertions(+)
>
> diff --git a/server/red_channel.c b/server/red_channel.c
> index 37b0c1c..bcf5a60 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 9021b3f..1592896 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 {
> --
> 1.8.1.4
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list