From 1088332376343c52ca6c66fbd2053146e5b72d22 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 16 Apr 2016 23:28:50 -0700 Subject: [PATCH] GUACAMOLE-25: Add support for multiple versions of IWTSVirtualChannelCallback. --- configure.ac | 22 +++++++++++++++++++ src/protocols/rdp/guac_ai/ai_service.c | 29 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/configure.ac b/configure.ac index 485c10d3..04cb6bb1 100644 --- a/configure.ac +++ b/configure.ac @@ -764,6 +764,28 @@ then [Whether the legacy rdpBitmap API was found])]) fi +# +# FreeRDP: IWTSVirtualChannelCallback +# + +if test "x${have_freerdp}" = "xyes" +then + AC_MSG_CHECKING([whether IWTSVirtualChannelCallback.OnDataReceived() uses a wStream]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include + #include + #include + int __data_received( + IWTSVirtualChannelCallback* channel_callback, + wStream* stream); + IWTSVirtualChannelCallback cb = { + .OnDataReceived = __data_received + };]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_DEFINE([LEGACY_IWTSVIRTUALCHANNELCALLBACK],, + [Whether the legacy IWTSVirtualChannelCallback API was found])]) +fi + # # FreeRDP: Decompression function variants # diff --git a/src/protocols/rdp/guac_ai/ai_service.c b/src/protocols/rdp/guac_ai/ai_service.c index 5b723546..e822f90e 100644 --- a/src/protocols/rdp/guac_ai/ai_service.c +++ b/src/protocols/rdp/guac_ai/ai_service.c @@ -62,6 +62,7 @@ static void guac_rdp_ai_handle_data(guac_client* client, wStream* stream) { } +#if LEGACY_IWTSVIRTUALCHANNELCALLBACK /** * Callback which is invoked when data is received along a connection to the * AUDIO_INPUT plugin. This callback is specific to FreeRDP 1.1 and older. @@ -93,6 +94,34 @@ static int guac_rdp_ai_data(IWTSVirtualChannelCallback* channel_callback, return 0; } +#else +/** + * Callback which is invoked when data is received along a connection to the + * AUDIO_INPUT plugin. This callback is specific to FreeRDP 1.2 and newer. + * + * @param channel_callback + * The IWTSVirtualChannelCallback structure to which this callback was + * originally assigned. + * + * @param stream + * The data received. + * + * @return + * Always zero. + */ +static int guac_rdp_ai_data(IWTSVirtualChannelCallback* channel_callback, + wStream* stream) { + + guac_rdp_ai_channel_callback* ai_channel_callback = + (guac_rdp_ai_channel_callback*) channel_callback; + + /* Invoke generalized (API-independent) data handler */ + guac_rdp_ai_handle_data(ai_channel_callback->client, stream); + + return 0; + +} +#endif /** * Callback which is invoked when a connection to the AUDIO_INPUT plugin is