From: Alon Levy <alon@xxxxxxxxx> Signed-off-by: Alon Levy <alon@xxxxxxxxx> --- server/dispatcher.c | 10 ++++++++++ server/dispatcher.h | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/server/dispatcher.c b/server/dispatcher.c index 298f5f9..d6c03ca 100644 --- a/server/dispatcher.c +++ b/server/dispatcher.c @@ -135,6 +135,9 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher) /* TODO: close socketpair? */ return 0; } + if (dispatcher->any_handler) { + dispatcher->any_handler(dispatcher->opaque, type, payload); + } if (msg->handler) { msg->handler(dispatcher->opaque, (void *)payload); } else { @@ -223,6 +226,13 @@ void dispatcher_register_handler(Dispatcher *dispatcher, uint32_t message_type, } } +void dispatcher_register_universal_handler( + Dispatcher *dispatcher, + dispatcher_handle_any_message any_handler) +{ + dispatcher->any_handler = any_handler; +} + #ifdef DEBUG_DISPATCHER static void dummy_handler(int bla) { diff --git a/server/dispatcher.h b/server/dispatcher.h index 1b389bd..8cfa1d4 100644 --- a/server/dispatcher.h +++ b/server/dispatcher.h @@ -8,6 +8,10 @@ typedef struct Dispatcher Dispatcher; typedef void (*dispatcher_handle_message)(void *opaque, void *payload); +typedef void (*dispatcher_handle_any_message)(void *opaque, + uint32_t message_type, + void *payload); + typedef void (*dispatcher_handle_async_done)(void *opaque, uint32_t message_type, void *payload); @@ -32,6 +36,7 @@ struct Dispatcher { size_t payload_size; /* used to track realloc calls */ void *opaque; dispatcher_handle_async_done handle_async_done; + dispatcher_handle_any_message any_handler; }; /* @@ -85,6 +90,13 @@ void dispatcher_register_async_done_callback( dispatcher_handle_async_done handler); /* + * Hack to allow red_record to see the message being sent so it can record + * it to file. + */ +void dispatcher_register_universal_handler(Dispatcher *dispatcher, + dispatcher_handle_any_message handler); + +/* * dispatcher_handle_recv_read * @dispatcher: Dispatcher instance */ -- 2.4.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel