GUACAMOLE-249: Remove all legacy FreeRDP compatibility.

This commit is contained in:
Michael Jumper 2019-09-21 12:25:06 -07:00
parent a5b62aa82e
commit 17d31d94b7
54 changed files with 28 additions and 1541 deletions

View File

@ -528,10 +528,10 @@ then
fi
#
# FreeRDP
# FreeRDP 2
#
have_freerdp=disabled
have_freerdp2=disabled
RDP_LIBS=
AC_ARG_WITH([rdp],
[AS_HELP_STRING([--with-rdp],
@ -541,505 +541,20 @@ AC_ARG_WITH([rdp],
if test "x$with_rdp" != "xno"
then
have_winpr=yes
have_freerdp=yes
legacy_freerdp_extensions=no
rdpsettings_interface=unknown
rdpsettings_audiocapture=yes
rdpsettings_audioplayback=yes
rdpsettings_deviceredirection=yes
freerdp_interface=unknown
event_interface=unknown
have_freerdp2=yes
# libfreerdp-core / libfreerdp
AC_CHECK_LIB([freerdp-core], [freerdp_new],
[RDP_LIBS="$RDP_LIBS -lfreerdp-core"],
[AC_CHECK_LIB([freerdp2], [freerdp_new],
[RDP_LIBS="$RDP_LIBS -lfreerdp2 -lfreerdp-client2"],
# libfreerdp2
AC_CHECK_LIB([freerdp2], [freerdp_new],
[RDP_LIBS="$RDP_LIBS -lfreerdp2 -lfreerdp-client2 -lwinpr2"],
[AC_MSG_WARN([
--------------------------------------------
Unable to find libfreerdp2
RDP will be disabled.
--------------------------------------------])
have_freerdp=no])])
have_freerdp2=no])
fi
# libfreerdp-cache
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_LIB([freerdp-cache], [glyph_cache_register_callbacks],
[RDP_LIBS="$RDP_LIBS -lfreerdp-cache"])
fi
# libfreerdp-channels (1.0) / libfreerdp-client + libfreerdp-core (1.1)
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_LIB([freerdp-client], [freerdp_channels_new],
[RDP_LIBS="$RDP_LIBS -lfreerdp-client"],
[AC_CHECK_LIB([freerdp-channels], [freerdp_channels_new],
[RDP_LIBS="$RDP_LIBS -lfreerdp-channels"
legacy_freerdp_extensions=yes])],
[-lfreerdp-core])
fi
# libfreerdp-utils
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_LIB([freerdp-utils], [svc_plugin_init],
[RDP_LIBS="$RDP_LIBS -lfreerdp-utils"])
fi
# libfreerdp-codec
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_LIB([freerdp-codec], [freerdp_image_convert],
[RDP_LIBS="$RDP_LIBS -lfreerdp-codec"])
fi
# Available color conversion functions
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_DECL([freerdp_convert_gdi_order_color],
[AC_DEFINE([HAVE_FREERDP_CONVERT_GDI_ORDER_COLOR],,
[Whether freerdp_convert_gdi_order_color() is defined])],,
[#include <freerdp/codec/color.h>])
AC_CHECK_DECL([freerdp_color_convert_drawing_order_color_to_gdi_color],
[AC_DEFINE([HAVE_FREERDP_COLOR_CONVERT_DRAWING_ORDER_COLOR_TO_GDI_COLOR],,
[Whether freerdp_color_convert_drawing_order_color_to_gdi_color() is defined])],,
[#include <freerdp/codec/color.h>])
fi
# Check for interval polling in plugins
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_MEMBERS([rdpSvcPlugin.interval_ms],,,
[[#include <freerdp/utils/svc_plugin.h>]])
fi
# Keyboard layout header
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_HEADERS([freerdp/locale/keyboard.h],,
[AC_CHECK_HEADERS([freerdp/kbd/layouts.h],,
[AC_MSG_WARN([
--------------------------------------------
Unable to find keyboard layout headers
RDP will be disabled.
--------------------------------------------])
have_freerdp=no])])
fi
# New headers defining addins
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_HEADERS([freerdp/addin.h freerdp/client/channels.h])
fi
# Header defining cliprdr
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_HEADERS([freerdp/client/cliprdr.h],,
[AC_CHECK_HEADERS([freerdp/plugins/cliprdr.h],,
[AC_MSG_WARN([
--------------------------------------------
Unable to find cliprdr headers
RDP will be disabled.
--------------------------------------------])
have_freerdp=no],
[#include <freerdp/types.h>])],
[#include <winpr/wtypes.h>
#include <winpr/collections.h>])
fi
# Header defining display update channel
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_HEADERS([freerdp/client/disp.h],
[AC_DEFINE([HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT],,
[Whether FreeRDP supports the display update channel])]
[AC_CHECK_MEMBERS([rdpSettings.SupportDisplayControl],,,
[[#include <freerdp/freerdp.h>]])],,
[#include <winpr/wtypes.h>
#include <winpr/collections.h>])
fi
# Support for RDP gateways
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_MEMBERS([rdpSettings.GatewayEnabled],
[AC_DEFINE([HAVE_FREERDP_GATEWAY_SUPPORT],,
[Whether FreeRDP supports RDP gateways])],,
[[#include <freerdp/freerdp.h>]])
fi
# Support for load balancing via connection brokers
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_MEMBERS([rdpSettings.LoadBalanceInfo],
[AC_DEFINE([HAVE_FREERDP_LOAD_BALANCER_SUPPORT],,
[Whether FreeRDP supports load balancers])],,
[[#include <freerdp/freerdp.h>]])
fi
# Support for "PubSub" event system
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_DECL([PubSub_SubscribeChannelConnected],
[AC_DEFINE([HAVE_FREERDP_EVENT_PUBSUB],,
[Whether this version of FreeRDP provides the PubSub event system])],,
[#include <freerdp/event.h>])
fi
# Addin registration variations
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_DECL([freerdp_register_addin_provider],
[AC_DEFINE([HAVE_FREERDP_REGISTER_ADDIN_PROVIDER],,
[Whether freerdp_register_addin_provider() is defined])],,
[#include <freerdp/addin.h>])
AC_CHECK_DECL([freerdp_channels_global_init],
[AC_DEFINE([HAVE_FREERDP_CHANNELS_GLOBAL_INIT],,
[Whether freerdp_channels_global_init() is defined])],,
[#include <freerdp/channels/channels.h>])
fi
# Availability of ADDIN_ARGV structure for configuring plugins
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_TYPE([ADDIN_ARGV],
[AC_DEFINE([HAVE_ADDIN_ARGV],,
[Whether the ADDIN_ARGV type is available])],,
[#include <freerdp/settings.h>])
fi
#
# FreeRDP: WinPR
#
# Check for stream support via WinPR
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_HEADER(winpr/stream.h,,
[have_winpr=no,
AC_CHECK_DECL([stream_write_uint8],,
[AC_MSG_WARN([
--------------------------------------------
Unable to find stream support
RDP will be disabled.
--------------------------------------------])
have_freerdp=no],
[#include <freerdp/utils/stream.h>])])
fi
# Check for types in WinPR
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_HEADER(winpr/wtypes.h,,
[have_winpr=no,
AC_CHECK_HEADER(freerdp/types.h,,
[AC_MSG_WARN([
--------------------------------------------
Unable to find type definitions
RDP will be disabled.
--------------------------------------------])
have_freerdp=no])])
fi
if test "x${have_freerdp}" = "xyes" -a "x${have_winpr}" = "xyes"
then
AC_DEFINE([ENABLE_WINPR],,
[Whether library support for WinPR types was found])
fi
#
# FreeRDP: freerdp
#
if test "x${have_freerdp}" = "xyes"
then
# Check for current (as of 1.1) freerdp interface
AC_CHECK_MEMBERS([freerdp.ContextSize],
[freerdp_interface=stable],,
[[#include <freerdp/freerdp.h>]])
# If not current, check for legacy interface
if test "x${freerdp_interface}" = "xunknown"
then
AC_CHECK_MEMBERS([freerdp.context_size],
[freerdp_interface=legacy],,
[[#include <freerdp/freerdp.h>]])
fi
# Set defines based on interface type, warn if unknown
if test "x${freerdp_interface}" = "xlegacy"; then
AC_DEFINE([LEGACY_FREERDP],,
[Whether the older version of the FreeRDP API was found])
elif test "x${freerdp_interface}" = "xunknown"; then
AC_MSG_WARN([
--------------------------------------------
Unknown FreeRDP interface
RDP will be disabled.
--------------------------------------------])
have_freerdp=no
fi
fi
#
# FreeRDP: rdpSettings
#
if test "x${have_freerdp}" = "xyes"
then
# Check for current (as of 1.1) rdpSettings interface
AC_CHECK_MEMBERS([rdpSettings.Width,
rdpSettings.Height,
rdpSettings.FastPathInput,
rdpSettings.FastPathOutput,
rdpSettings.SendPreconnectionPdu,
rdpSettings.OrderSupport],
[rdpsettings_interface=stable],,
[[#include <freerdp/freerdp.h>]])
# If not current, check for legacy interface
if test "x${rdpsettings_interface}" = "xunknown"
then
AC_CHECK_MEMBERS([rdpSettings.width,
rdpSettings.height,
rdpSettings.order_support],
[rdpsettings_interface=legacy],,
[[#include <freerdp/freerdp.h>]])
fi
# Set defines based on interface type, warn if unknown
if test "x${rdpsettings_interface}" = "xlegacy"; then
AC_DEFINE([LEGACY_RDPSETTINGS],,
[Whether the legacy version of the rdpSettings API was found])
# Legacy interface may not have AudioPlayback settings
AC_CHECK_MEMBERS([rdpSettings.audio_playback],,
[rdpsettings_audioplayback=no],
[[#include <freerdp/freerdp.h>]])
# Legacy interface may not have AudioCapture settings
AC_CHECK_MEMBERS([rdpSettings.audio_capture],,
[rdpsettings_audiocapture=no],
[[#include <freerdp/freerdp.h>]])
# Legacy interface may not have DeviceRedirection settings
AC_CHECK_MEMBERS([rdpSettings.device_redirection],,
[rdpsettings_deviceredirection=no],
[[#include <freerdp/freerdp.h>]])
elif test "x${rdpsettings_interface}" = "xunknown"; then
AC_MSG_WARN([
--------------------------------------------
Unknown rdpSettings interface
RDP will be disabled.
--------------------------------------------])
have_freerdp=no
fi
fi
# Activate audio playback settings if present
if test "x${have_freerdp}" = "xyes" -a "x${rdpsettings_audioplayback}" = "xyes"; then
AC_DEFINE([HAVE_RDPSETTINGS_AUDIOPLAYBACK],,
[Whether the rdpSettings structure has AudioPlayback settings])
fi
# Activate audio capture settings if present
if test "x${have_freerdp}" = "xyes" -a "x${rdpsettings_audiocapture}" = "xyes"; then
AC_DEFINE([HAVE_RDPSETTINGS_AUDIOCAPTURE],,
[Whether the rdpSettings structure has AudioCapture settings])
fi
# Activate device redirection settings if present
if test "x${have_freerdp}" = "xyes" -a "x${rdpsettings_deviceredirection}" = "xyes"; then
AC_DEFINE([HAVE_RDPSETTINGS_DEVICEREDIRECTION],,
[Whether the rdpSettings structure has DeviceRedirection settings])
fi
# Check if the type CHANNEL_ENTRY_POINTS_FREERDP exists, if not define it to CHANNEL_ENTRY_POINTS_EX
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_TYPE([CHANNEL_ENTRY_POINTS_FREERDP],,
AC_DEFINE([CHANNEL_ENTRY_POINTS_FREERDP],[CHANNEL_ENTRY_POINTS_EX], [Type compatibility]),
[[#include <freerdp/svc.h>]])
fi
# Check if the freerdp version header exists
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_HEADERS([freerdp/version.h])
fi
#
# FreeRDP: rdpBitmap
#
if test "x${have_freerdp}" = "xyes"
then
AC_MSG_CHECKING([whether rdpBitmap.Decompress() requires the codec_id])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <winpr/wtypes.h>
#include <freerdp/freerdp.h>
void __decompress(rdpContext* context,
rdpBitmap* bitmap,
UINT8* data,
int width,
int height,
int bpp,
int length,
BOOL compressed,
int codec_id);
rdpBitmap b = { .Decompress = __decompress };]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_DEFINE([LEGACY_RDPBITMAP],,
[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 <winpr/wtypes.h>
#include <freerdp/dvc.h>
#include <freerdp/freerdp.h>
int __data_received(
IWTSVirtualChannelCallback* channel_callback,
wStream* stream);
IWTSVirtualChannelCallback cb = {
.OnDataReceived = __data_received
};
int main() {
return
cb.OnDataReceived(NULL, NULL);
}]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_DEFINE([LEGACY_IWTSVIRTUALCHANNELCALLBACK],,
[Whether the legacy IWTSVirtualChannelCallback API was found])])
fi
#
# FreeRDP: Decompression function variants
#
# Check whether interleaved_decompress() can handle the palette
if test "x${have_freerdp}" = "xyes"
then
AC_MSG_CHECKING([whether interleaved_decompress() accepts an additional palette parameter])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <freerdp/codec/interleaved.h>
int main() {
BYTE* palette = NULL;
interleaved_decompress(NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, 0, 0, palette);
}]])],
[AC_MSG_RESULT([yes])
AC_DEFINE([INTERLEAVED_DECOMPRESS_TAKES_PALETTE],,
[Whether interleaved_decompress() accepts an additional palette parameter])],
[AC_MSG_RESULT([no])])
fi
# Check whether planar_decompress() will handle flipping
if test "x${have_freerdp}" = "xyes"
then
AC_MSG_CHECKING([whether planar_decompress() can flip])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <freerdp/codec/planar.h>
int main() {
BOOL* flip = TRUE;
planar_decompress(NULL, NULL, 0, NULL, 0, 0, 0, 0, 0, 0, flip);
}]])],
[AC_MSG_RESULT([yes])
AC_DEFINE([PLANAR_DECOMPRESS_CAN_FLIP],,
[Whether planar_decompress() can flip])],
[AC_MSG_RESULT([no])])
fi
#
# FreeRDP: rdpContext
#
# Check for rdpContext.codecs
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_MEMBERS([rdpContext.codecs],
[AC_DEFINE([FREERDP_BITMAP_REQUIRES_ALIGNED_MALLOC],,
[Whether this version of FreeRDP requires _aligned_malloc() for bitmap data])],,
[[#include <freerdp/freerdp.h>]])
fi
#
# FreeRDP: rdpPalette
#
if test "x${have_freerdp}" = "xyes"
then
AC_MSG_CHECKING([whether rdpPalette.entries is static])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <freerdp/update.h>
rdpPalette p;
PALETTE_ENTRY* foo = p.entries;]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_DEFINE([LEGACY_RDPPALETTE],,
[Whether the legacy rdpPalette API was found])])
fi
#
# FreeRDP: rdpPointer
#
# Check for SetDefault and SetNull members of rdpPointer
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_MEMBERS([rdpPointer.SetDefault,
rdpPointer.SetNull],
,,
[[#include <freerdp/freerdp.h>]])
fi
#
# FreeRDP: wMessage / RDP_EVENT
#
# Check for current (as of 1.1) wMessage interface
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_MEMBERS([wMessage.id],
[event_interface=stable],,
[[#include <winpr/collections.h>]])
# If not current, check for legacy (RDP_EVENT) interface
if test "x${event_interface}" = "xunknown"
then
AC_CHECK_MEMBERS([RDP_EVENT.event_class],
[event_interface=legacy],,
[[#include <freerdp/types.h>]])
fi
# Set defines based on interface type, warn if unknown
if test "x${event_interface}" = "xlegacy"; then
AC_DEFINE([LEGACY_EVENT],,
[Whether the legacy RDP_EVENT API was found])
elif test "x${event_interface}" = "xunknown"; then
AC_MSG_WARN([
--------------------------------------------
Unknown event interface
RDP will be disabled.
--------------------------------------------])
have_freerdp=no
fi
fi
AM_CONDITIONAL([LEGACY_FREERDP_EXTENSIONS], [test "x${legacy_freerdp_extensions}" = "xyes"])
AM_CONDITIONAL([ENABLE_WINPR], [test "x${have_winpr}" = "xyes"])
AM_CONDITIONAL([ENABLE_RDP], [test "x${have_freerdp}" = "xyes"])
AM_CONDITIONAL([ENABLE_RDP], [test "x${have_freerdp2}" = "xyes"])
AC_SUBST(RDP_LIBS)
@ -1382,7 +897,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION
Library status:
freerdp ............. ${have_freerdp}
freerdp2 ............ ${have_freerdp2}
pango ............... ${have_pango}
libavcodec .......... ${have_libavcodec}
libavutil ........... ${have_libavutil}

View File

@ -88,8 +88,6 @@ guacdr_sources = \
unicode.c
noinst_HEADERS = \
compat/client-cliprdr.h \
compat/rail.h \
guac_ai/ai_messages.h \
guac_ai/ai_service.h \
guac_rdpdr/rdpdr_fs_messages.h \
@ -130,16 +128,6 @@ noinst_HEADERS = \
unicode.h \
user.h
# Add compatibility layer for WinPR if not available
if ! ENABLE_WINPR
noinst_HEADERS += compat/winpr-stream.h compat/winpr-wtypes.h
libguac_client_rdp_la_SOURCES += compat/winpr-stream.c
guacai_sources += compat/winpr-stream.c
guacsvc_sources += compat/winpr-stream.c
guacsnd_sources += compat/winpr-stream.c
guacdr_sources += compat/winpr-stream.c
endif
#
# Main RDP client library
#
@ -277,37 +265,6 @@ EXTRA_DIST = \
$(rdp_keymaps) \
keymaps/generate.pl
if LEGACY_FREERDP_EXTENSIONS
# FreeRDP 1.0-style extensions
freerdp_LTLIBRARIES = \
guacai.la
# guacdr.la \
# guacsnd.la \
# guacsvc.la
guacai_la_SOURCES = ${guacai_sources}
guacai_la_CFLAGS = ${guacai_cflags}
guacai_la_LDFLAGS = ${guacai_ldflags}
guacai_la_LIBADD = ${guacai_libadd}
#guacdr_la_SOURCES = ${guacdr_sources}
#guacdr_la_CFLAGS = ${guacdr_cflags}
#guacdr_la_LDFLAGS = ${guacdr_ldflags}
#guacdr_la_LIBADD = ${guacdr_libadd}
#guacsnd_la_SOURCES = ${guacsnd_sources}
#guacsnd_la_CFLAGS = ${guacsnd_cflags}
#guacsnd_la_LDFLAGS = ${guacsnd_ldflags}
#guacsnd_la_LIBADD = ${guacsnd_libadd}
#guacsvc_la_SOURCES = ${guacsvc_sources}
#guacsvc_la_CFLAGS = ${guacsvc_cflags}
#guacsvc_la_LDFLAGS = ${guacsvc_ldflags}
#guacsvc_la_LIBADD = ${guacsvc_libadd}
else
# FreeRDP 1.1 (and hopefully onward) extensions
freerdp_LTLIBRARIES = \
guacai-client.la
@ -335,7 +292,5 @@ guacai_client_la_LIBADD = ${guacai_libadd}
#guacsvc_client_la_LDFLAGS = ${guacsvc_ldflags}
#guacsvc_client_la_LIBADD = ${guacsvc_libadd}
endif
freerdpdir = ${libdir}/freerdp

View File

@ -35,21 +35,13 @@
#include <freerdp/cache/cache.h>
#include <freerdp/channels/channels.h>
#include <freerdp/client/channels.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/freerdp.h>
#include <guacamole/audio.h>
#include <guacamole/client.h>
#include <guacamole/socket.h>
#ifdef HAVE_FREERDP_CLIENT_CLIPRDR_H
#include <freerdp/client/cliprdr.h>
#else
#include "compat/client-cliprdr.h"
#endif
#ifdef HAVE_FREERDP_CLIENT_CHANNELS_H
#include <freerdp/client/channels.h>
#endif
#include <pthread.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,35 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef __GUAC_CLIENT_CLIPRDR_COMPAT_H
#define __GUAC_CLIENT_CLIPRDR_COMPAT_H
#include "config.h"
#include <freerdp/plugins/cliprdr.h>
#define CliprdrChannel_Class RDP_EVENT_CLASS_CLIPRDR
#define CliprdrChannel_FormatList RDP_EVENT_TYPE_CB_FORMAT_LIST
#define CliprdrChannel_MonitorReady RDP_EVENT_TYPE_CB_MONITOR_READY
#define CliprdrChannel_DataRequest RDP_EVENT_TYPE_CB_DATA_REQUEST
#define CliprdrChannel_DataResponse RDP_EVENT_TYPE_CB_DATA_RESPONSE
#endif

View File

@ -1,39 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef __GUAC_RAIL_COMPAT_H
#define __GUAC_RAIL_COMPAT_H
#include "config.h"
#include <freerdp/rail.h>
#define RailChannel_Class RDP_EVENT_CLASS_RAIL
#define RailChannel_ClientSystemParam RDP_EVENT_TYPE_RAIL_CLIENT_SET_SYSPARAMS
#define RailChannel_GetSystemParam RDP_EVENT_TYPE_RAIL_CHANNEL_GET_SYSPARAMS
#define RailChannel_ServerExecuteResult RDP_EVENT_TYPE_RAIL_CHANNEL_EXEC_RESULTS
#define RailChannel_ServerSystemParam RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_SYSPARAM
#define RailChannel_ServerMinMaxInfo RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_MINMAXINFO
#define RailChannel_ServerLocalMoveSize RDP_EVENT_TYPE_RAIL_CHANNEL_SERVER_LOCALMOVESIZE
#define RailChannel_ServerGetAppIdResponse RDP_EVENT_TYPE_RAIL_CHANNEL_APPID_RESP
#define RailChannel_ServerLanguageBarInfo RDP_EVENT_TYPE_RAIL_CHANNEL_LANGBARINFO
#endif

View File

@ -1,47 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "config.h"
#include "winpr-stream.h"
#include "winpr-wtypes.h"
wStream* Stream_New(BYTE* buffer, size_t size) {
/* If no buffer is provided, allocate a new stream of the given size */
if (buffer == NULL)
return stream_new(size);
/* Otherwise allocate an empty stream and assign the given buffer */
wStream* stream = stream_new(0);
stream_attach(stream, buffer, size);
return stream;
}
void Stream_Free(wStream* s, BOOL bFreeBuffer) {
/* Disassociate buffer if it will be freed externally */
if (!bFreeBuffer)
stream_detach(s);
stream_free(s);
}

View File

@ -1,71 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef __GUAC_WINPR_STREAM_COMPAT_H
#define __GUAC_WINPR_STREAM_COMPAT_H
#include "config.h"
#include "winpr-wtypes.h"
#include <freerdp/utils/stream.h>
#include <stddef.h>
/* FreeRDP 1.0 streams */
#define Stream_Write stream_write
#define Stream_Write_UINT8 stream_write_uint8
#define Stream_Write_UINT16 stream_write_uint16
#define Stream_Write_UINT32 stream_write_uint32
#define Stream_Write_UINT64 stream_write_uint64
#define Stream_Read stream_read
#define Stream_Read_UINT8 stream_read_uint8
#define Stream_Read_UINT16 stream_read_uint16
#define Stream_Read_UINT32 stream_read_uint32
#define Stream_Read_UINT64 stream_read_uint64
#define Stream_Seek stream_seek
#define Stream_Seek_UINT8 stream_seek_uint8
#define Stream_Seek_UINT16 stream_seek_uint16
#define Stream_Seek_UINT32 stream_seek_uint32
#define Stream_Seek_UINT64 stream_seek_uint64
#define Stream_GetPointer stream_get_mark
#define Stream_EnsureRemainingCapacity stream_check_size
#define Stream_Write stream_write
#define Stream_Zero stream_write_zero
#define Stream_Fill stream_set_byte
#define Stream_GetPosition stream_get_pos
#define Stream_SetPosition stream_set_pos
#define Stream_SetPointer stream_set_mark
#define Stream_Buffer stream_get_head
#define Stream_Pointer stream_get_tail
#define Stream_Length stream_get_size
#define wStream STREAM
#define wMessage RDP_EVENT
wStream* Stream_New(BYTE* buffer, size_t size);
void Stream_Free(wStream* s, BOOL bFreeBuffer);
#endif

View File

@ -1,39 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef __GUAC_WINPR_WTYPES_COMPAT_H
#define __GUAC_WINPR_WTYPES_COMPAT_H
#include "config.h"
#include <freerdp/types.h>
typedef uint8 BYTE;
typedef uint8 UINT8;
typedef uint16 UINT16;
typedef uint32 UINT32;
typedef uint64 UINT64;
typedef boolean BOOL;
#define TRUE true
#define FALSE false
#endif

View File

@ -117,14 +117,6 @@ int guac_rdp_load_drdynvc(rdpContext* context, guac_rdp_dvc_list* list) {
if (list->channel_count == 0)
return 0;
#ifndef HAVE_ADDIN_ARGV
/* Allocate plugin data array */
RDP_PLUGIN_DATA* all_plugin_data =
calloc(list->channel_count + 1, sizeof(RDP_PLUGIN_DATA));
RDP_PLUGIN_DATA* current_plugin_data = all_plugin_data;
#endif
/* For each channel */
guac_common_list_element* current = list->channels->head;
while (current != NULL) {
@ -143,41 +135,20 @@ int guac_rdp_load_drdynvc(rdpContext* context, guac_rdp_dvc_list* list) {
guac_client_log(client, GUAC_LOG_DEBUG,
"Registering DVC plugin \"%s\"", dvc->argv[0]);
#ifdef HAVE_ADDIN_ARGV
/* Register plugin with FreeRDP */
ADDIN_ARGV* args = malloc(sizeof(ADDIN_ARGV));
args->argc = dvc->argc;
args->argv = dvc->argv;
freerdp_dynamic_channel_collection_add(context->settings, args);
#else
/* Copy all arguments */
for (int i = 0; i < dvc->argc; i++)
current_plugin_data->data[i] = dvc->argv[i];
/* Store size of entry */
current_plugin_data->size = sizeof(*current_plugin_data);
/* Advance to next set of plugin data */
current_plugin_data++;
#endif
/* Rely on FreeRDP to free argv storage */
dvc->argv = NULL;
}
#ifdef HAVE_ADDIN_ARGV
/* Load virtual channel management plugin */
return freerdp_channels_load_plugin(channels, context->instance->settings,
"drdynvc", context->instance->settings);
#else
/* Terminate with empty RDP_PLUGIN_DATA element */
current_plugin_data->size = 0;
/* Load virtual channel management plugin */
return freerdp_channels_load_plugin(channels, context->instance->settings,
"drdynvc", all_plugin_data);
#endif
}

View File

@ -29,12 +29,7 @@
#include <freerdp/constants.h>
#include <freerdp/dvc.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Reads AUDIO_FORMAT data from the given stream into the given struct.

View File

@ -24,12 +24,7 @@
#include <freerdp/dvc.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* The format tag associated with raw wave audio (WAVE_FORMAT_PCM). This format

View File

@ -32,12 +32,7 @@
#include <freerdp/constants.h>
#include <freerdp/dvc.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Handles the given data received along the AUDIO_INPUT channel of the RDP
@ -95,43 +90,9 @@ static void guac_rdp_ai_handle_data(guac_client* client,
}
#ifdef 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.
*
* @param channel_callback
* The IWTSVirtualChannelCallback structure to which this callback was
* originally assigned.
*
* @param size
* The number of bytes received.
*
* @param buffer
* A buffer containing all bytes received.
*
* @return
* Always zero.
*/
static int guac_rdp_ai_data(IWTSVirtualChannelCallback* channel_callback,
UINT32 size, BYTE* buffer) {
guac_rdp_ai_channel_callback* ai_channel_callback =
(guac_rdp_ai_channel_callback*) channel_callback;
IWTSVirtualChannel* channel = ai_channel_callback->channel;
/* Invoke generalized (API-independent) data handler */
wStream* stream = Stream_New(buffer, size);
guac_rdp_ai_handle_data(ai_channel_callback->client, channel, stream);
Stream_Free(stream, FALSE);
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.
* AUDIO_INPUT plugin.
*
* @param channel_callback
* The IWTSVirtualChannelCallback structure to which this callback was
@ -156,7 +117,6 @@ static UINT guac_rdp_ai_data(IWTSVirtualChannelCallback* channel_callback,
return 0;
}
#endif
/**
* Callback which is invoked when a connection to the AUDIO_INPUT plugin is
@ -315,13 +275,8 @@ static UINT guac_rdp_ai_terminated(IWTSPlugin* plugin) {
int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) {
/* Pull guac_client from arguments */
#ifdef HAVE_ADDIN_ARGV
ADDIN_ARGV* args = pEntryPoints->GetPluginData(pEntryPoints);
guac_client* client = (guac_client*) guac_rdp_string_to_ptr(args->argv[1]);
#else
RDP_PLUGIN_DATA* data = pEntryPoints->GetPluginData(pEntryPoints);
guac_client* client = (guac_client*) guac_rdp_string_to_ptr(data->data[1]);
#endif
/* Pull previously-allocated plugin */
guac_rdp_ai_plugin* ai_plugin = (guac_rdp_ai_plugin*)

View File

@ -31,14 +31,8 @@
#include <freerdp/utils/svc_plugin.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#include <winpr/wtypes.h>
#else
#include "compat/winpr-stream.h"
#include "compat/winpr-wtypes.h"
#endif
#include <inttypes.h>
#include <stdint.h>

View File

@ -33,11 +33,7 @@
#include "rdpdr_service.h"
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Handles a Server Create Drive Request. Despite its name, this request opens

View File

@ -26,12 +26,7 @@
#include <freerdp/utils/svc_plugin.h>
#include <guacamole/unicode.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
#include <stddef.h>

View File

@ -33,11 +33,7 @@
#include "rdpdr_service.h"
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Processes a query request for FileDirectoryInformation. From the

View File

@ -25,14 +25,8 @@
#include "unicode.h"
#include <freerdp/utils/svc_plugin.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#include <winpr/wtypes.h>
#else
#include "compat/winpr-stream.h"
#include "compat/winpr-wtypes.h"
#endif
#include <inttypes.h>
#include <stdint.h>

View File

@ -32,11 +32,7 @@
#include "rdpdr_service.h"
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Processes a query for FileBasicInformation. From the documentation, this is

View File

@ -26,14 +26,8 @@
#include <freerdp/utils/svc_plugin.h>
#include <guacamole/unicode.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#include <winpr/wtypes.h>
#else
#include "compat/winpr-stream.h"
#include "compat/winpr-wtypes.h"
#endif
void guac_rdpdr_fs_process_query_volume_info(guac_rdpdr_device* device,
wStream* input_stream, int file_id, int completion_id) {

View File

@ -33,11 +33,7 @@
#include "rdpdr_service.h"
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Processes a query request for FileFsVolumeInformation. According to the

View File

@ -30,12 +30,7 @@
#include <guacamole/protocol.h>
#include <guacamole/socket.h>
#include <guacamole/unicode.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
static void guac_rdpdr_device_fs_iorequest_handler(guac_rdpdr_device* device,
wStream* input_stream, int file_id, int completion_id, int major_func, int minor_func) {

View File

@ -27,12 +27,7 @@
#include <freerdp/utils/svc_plugin.h>
#include <guacamole/client.h>
#include <guacamole/unicode.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
#include <stdlib.h>
#include <string.h>

View File

@ -25,11 +25,7 @@
#include "rdpdr_service.h"
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
#include <stdint.h>

View File

@ -34,12 +34,7 @@
#include <guacamole/stream.h>
#include <guacamole/unicode.h>
#include <guacamole/user.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
#include <errno.h>
#include <pthread.h>

View File

@ -25,11 +25,7 @@
#include "rdpdr_service.h"
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Registers a new printer device within the RDPDR plugin. This must be done

View File

@ -37,12 +37,7 @@
#include <guacamole/protocol.h>
#include <guacamole/socket.h>
#include <guacamole/stream.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Entry point for RDPDR virtual channel.

View File

@ -25,12 +25,7 @@
#include <freerdp/utils/svc_plugin.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* The maximum number of bytes to allow for a device read.

View File

@ -29,14 +29,8 @@
#include <freerdp/utils/svc_plugin.h>
#include <guacamole/audio.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#include <winpr/wtypes.h>
#else
#include "compat/winpr-stream.h"
#include "compat/winpr-wtypes.h"
#endif
/* MESSAGE HANDLERS */

View File

@ -25,11 +25,7 @@
#include "rdpsnd_service.h"
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/*
* PDU Message Types

View File

@ -28,12 +28,7 @@
#include <freerdp/constants.h>
#include <freerdp/utils/svc_plugin.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Entry point for RDPSND virtual channel.

View File

@ -25,12 +25,7 @@
#include <freerdp/utils/svc_plugin.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* The maximum number of PCM formats to accept during the initial RDPSND

View File

@ -30,12 +30,7 @@
#include <guacamole/protocol.h>
#include <guacamole/socket.h>
#include <guacamole/string.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Entry point for arbitrary SVC.

View File

@ -24,12 +24,7 @@
#include "rdp_svc.h"
#include <freerdp/utils/svc_plugin.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Structure representing the current state of an arbitrary static virtual

View File

@ -45,12 +45,7 @@ print OUTPUT
'#include "config.h"' . "\n"
. '#include "rdp_keymap.h"' . "\n"
. '#include <freerdp/input.h>' . "\n"
. "\n"
. '#ifdef HAVE_FREERDP_LOCALE_KEYBOARD_H' . "\n"
. '#include <freerdp/locale/keyboard.h>' . "\n"
. '#else' . "\n"
. '#include <freerdp/kbd/layouts.h>' . "\n"
. '#endif' . "\n"
. "\n"
. '#include <stddef.h>' . "\n"
. "\n";

View File

@ -48,6 +48,7 @@
#include "common-ssh/user.h"
#endif
#include <freerdp/addin.h>
#include <freerdp/cache/bitmap.h>
#include <freerdp/cache/brush.h>
#include <freerdp/cache/glyph.h>
@ -55,50 +56,19 @@
#include <freerdp/cache/palette.h>
#include <freerdp/cache/pointer.h>
#include <freerdp/channels/channels.h>
#include <freerdp/client/channels.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/client/disp.h>
#include <freerdp/event.h>
#include <freerdp/freerdp.h>
#include <freerdp/rail.h>
#include <freerdp/version.h>
#include <guacamole/audio.h>
#include <guacamole/client.h>
#include <guacamole/protocol.h>
#include <guacamole/socket.h>
#include <guacamole/timestamp.h>
#ifdef HAVE_FREERDP_CLIENT_CLIPRDR_H
#include <freerdp/client/cliprdr.h>
#else
#include "compat/client-cliprdr.h"
#endif
#ifdef HAVE_FREERDP_CLIENT_DISP_H
#include <freerdp/client/disp.h>
#endif
#ifdef HAVE_FREERDP_EVENT_PUBSUB
#include <freerdp/event.h>
#endif
#ifdef LEGACY_FREERDP
#include "compat/rail.h"
#else
#include <freerdp/rail.h>
#endif
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
#ifdef HAVE_FREERDP_ADDIN_H
#include <freerdp/addin.h>
#endif
#ifdef HAVE_FREERDP_CLIENT_CHANNELS_H
#include <freerdp/client/channels.h>
#endif
#ifdef HAVE_FREERDP_VERSION_H
#include <freerdp/version.h>
#endif
#include <errno.h>
#include <poll.h>
@ -108,58 +78,6 @@
#include <sys/time.h>
#include <time.h>
/**
* Callback invoked by FreeRDP for data received along a channel. This is the
* most recent version of the callback and uses a 16-bit unsigned integer for
* the channel ID, as well as different type naming for the datatype of the
* data itself. This function does nothing more than invoke
* freerdp_channels_data() with the given arguments. The prototypes of these
* functions are compatible in 1.2 and later, but not necessarily prior to
* that, hence the conditional compilation of differing prototypes.
*
* Beware that the official purpose of these parameters is an undocumented
* mystery. The meanings below are derived from looking at how the function is
* used within FreeRDP.
*
* @param rdp_inst
* The RDP client instance associated with the channel receiving the data.
*
* @param channelId
* The integer ID of the channel that received the data.
*
* @param data
* A buffer containing the received data.
*
* @param size
* The number of bytes received and contained in the given buffer (the
* number of bytes received within the PDU that resulted in this function
* being inboked).
*
* @param flags
* Channel control flags, as defined by the CHANNEL_PDU_HEADER in the RDP
* specification.
*
* @param total_size
* The total length of the chanel data being received, which may span
* multiple PDUs (see the "length" field of CHANNEL_PDU_HEADER).
*
* @return
* Zero if the received channel data was successfully handled, non-zero
* otherwise. Note that this return value is discarded in practice.
*/
#if defined(FREERDP_VERSION_MAJOR) \
&& (FREERDP_VERSION_MAJOR > 1 || FREERDP_VERSION_MINOR >= 2)
static int __guac_receive_channel_data(freerdp* rdp_inst, UINT16 channelId,
BYTE* data, int size, int flags, int total_size) {
#else
static int __guac_receive_channel_data(freerdp* rdp_inst, int channelId,
UINT8* data, int size, int flags, int total_size) {
#endif
return freerdp_channels_data(rdp_inst, channelId,
data, size, flags, total_size);
}
#ifdef HAVE_FREERDP_EVENT_PUBSUB
/**
* Called whenever a channel connects via the PubSub event system within
* FreeRDP.
@ -179,7 +97,6 @@ static void guac_rdp_channel_connected(rdpContext* context,
guac_rdp_settings* settings = rdp_client->settings;
if (settings->resize_method == GUAC_RESIZE_DISPLAY_UPDATE) {
#ifdef HAVE_RDPSETTINGS_SUPPORTDISPLAYCONTROL
/* Store reference to the display update plugin once it's connected */
if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0) {
@ -196,11 +113,9 @@ static void guac_rdp_channel_connected(rdpContext* context,
"Display update channel connected.");
}
#endif
}
}
#endif
BOOL rdp_freerdp_pre_connect(freerdp* instance) {
@ -219,22 +134,16 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
guac_rdp_dvc_list* dvc_list = guac_rdp_dvc_list_alloc();
#ifdef HAVE_FREERDP_REGISTER_ADDIN_PROVIDER
/* Init FreeRDP add-in provider */
freerdp_register_addin_provider(freerdp_channels_load_static_addin_entry, 0);
#endif
#ifdef HAVE_FREERDP_EVENT_PUBSUB
/* Subscribe to and handle channel connected events */
PubSub_SubscribeChannelConnected(context->pubSub,
(pChannelConnectedEventHandler) guac_rdp_channel_connected);
#endif
#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
/* Load "disp" plugin for display update */
if (settings->resize_method == GUAC_RESIZE_DISPLAY_UPDATE)
guac_rdp_disp_load_plugin(instance->context, dvc_list);
#endif
/* Load "AUDIO_INPUT" plugin for audio input*/
if (settings->enable_audio_input) {
@ -273,29 +182,11 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
/* Load RAIL plugin if RemoteApp in use */
if (settings->remote_app != NULL) {
#ifdef LEGACY_FREERDP
RDP_PLUGIN_DATA* plugin_data = malloc(sizeof(RDP_PLUGIN_DATA) * 2);
plugin_data[0].size = sizeof(RDP_PLUGIN_DATA);
plugin_data[0].data[0] = settings->remote_app;
plugin_data[0].data[1] = settings->remote_app_dir;
plugin_data[0].data[2] = settings->remote_app_args;
plugin_data[0].data[3] = NULL;
plugin_data[1].size = 0;
/* Attempt to load rail */
if (freerdp_channels_load_plugin(channels, instance->settings,
"rail", plugin_data))
guac_client_log(client, GUAC_LOG_WARNING,
"Failed to load rail plugin. RemoteApp will not work.");
#else
/* Attempt to load rail */
if (freerdp_channels_load_plugin(channels, instance->settings,
"rail", instance->settings))
guac_client_log(client, GUAC_LOG_WARNING,
"Failed to load rail plugin. RemoteApp will not work.");
#endif
}
@ -375,12 +266,8 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
pointer->New = guac_rdp_pointer_new;
pointer->Free = guac_rdp_pointer_free;
pointer->Set = guac_rdp_pointer_set;
#ifdef HAVE_RDPPOINTER_SETNULL
pointer->SetNull = guac_rdp_pointer_set_null;
#endif
#ifdef HAVE_RDPPOINTER_SETDEFAULT
pointer->SetDefault = guac_rdp_pointer_set_default;
#endif
graphics_register_pointer(context->graphics, pointer);
free(pointer);
@ -689,9 +576,7 @@ static int guac_rdp_handle_connection(guac_client* client) {
rdp_client->requested_clipboard_format = CB_FORMAT_TEXT;
rdp_client->available_svc = guac_common_list_alloc();
#ifdef HAVE_FREERDP_CHANNELS_GLOBAL_INIT
freerdp_channels_global_init();
#endif
/* Init client */
freerdp* rdp_inst = freerdp_new();
@ -699,14 +584,10 @@ static int guac_rdp_handle_connection(guac_client* client) {
rdp_inst->PostConnect = rdp_freerdp_post_connect;
rdp_inst->Authenticate = rdp_freerdp_authenticate;
rdp_inst->VerifyCertificate = rdp_freerdp_verify_certificate;
rdp_inst->ReceiveChannelData = __guac_receive_channel_data;
rdp_inst->ReceiveChannelData = freerdp_channels_data;
/* Allocate FreeRDP context */
#ifdef LEGACY_FREERDP
rdp_inst->context_size = sizeof(rdp_freerdp_context);
#else
rdp_inst->ContextSize = sizeof(rdp_freerdp_context);
#endif
rdp_inst->ContextNew = (pContextNew) rdp_freerdp_context_new;
rdp_inst->ContextFree = (pContextFree) rdp_freerdp_context_free;
@ -780,17 +661,10 @@ static int guac_rdp_handle_connection(guac_client* client) {
if (event) {
/* Handle channel events (clipboard and RAIL) */
#ifdef LEGACY_EVENT
if (event->event_class == CliprdrChannel_Class)
guac_rdp_process_cliprdr_event(client, event);
else if (event->event_class == RailChannel_Class)
guac_rdp_process_rail_event(client, event);
#else
if (GetMessageClass(event->id) == CliprdrChannel_Class)
guac_rdp_process_cliprdr_event(client, event);
else if (GetMessageClass(event->id) == RailChannel_Class)
guac_rdp_process_rail_event(client, event);
#endif
freerdp_event_free(event);

View File

@ -32,12 +32,7 @@
#include <freerdp/freerdp.h>
#include <guacamole/client.h>
#include <guacamole/socket.h>
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
#include <stdio.h>
#include <stdlib.h>
@ -87,11 +82,7 @@ BOOL guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
/* Free existing image, if any */
if (image_buffer != bitmap->data) {
#ifdef FREERDP_BITMAP_REQUIRES_ALIGNED_MALLOC
_aligned_free(bitmap->data);
#else
free(bitmap->data);
#endif
}
/* Store converted image in bitmap */
@ -194,69 +185,39 @@ BOOL guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, BOOL pri
}
#ifdef LEGACY_RDPBITMAP
void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* data,
int width, int height, int bpp, int length, BOOL compressed) {
#else
BOOL guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, const BYTE* data,
UINT32 width, UINT32 height, UINT32 bpp, UINT32 length, BOOL compressed, UINT32 codec_id) {
#endif
int size = width * height * 4;
#ifdef FREERDP_BITMAP_REQUIRES_ALIGNED_MALLOC
/* Free pre-existing data, if any (might be reused) */
if (bitmap->data != NULL)
_aligned_free(bitmap->data);
/* Allocate new data */
/* Allocate new data - this MUST be allocated with _aligned_malloc() */
bitmap->data = (UINT8*) _aligned_malloc(size, 16);
#else
/* Free pre-existing data, if any (might be reused) */
free(bitmap->data);
/* Allocate new data */
bitmap->data = (UINT8*) malloc(size);
#endif
if (compressed) {
#ifdef HAVE_RDPCONTEXT_CODECS
rdpCodecs* codecs = context->codecs;
/* Decode as interleaved if less than 32 bits per pixel */
if (bpp < 32) {
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
#ifdef INTERLEAVED_DECOMPRESS_TAKES_PALETTE
interleaved_decompress(codecs->interleaved, data, length, bpp,
&(bitmap->data), PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height,
(BYTE*) ((rdp_freerdp_context*) context)->palette);
bitmap->bpp = 32;
#else
interleaved_decompress(codecs->interleaved, data, length, bpp,
&(bitmap->data), PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height);
bitmap->bpp = bpp;
#endif
}
/* Otherwise, decode as planar */
else {
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR);
#ifdef PLANAR_DECOMPRESS_CAN_FLIP
planar_decompress(codecs->planar, data, length,
&(bitmap->data), PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height,
TRUE);
bitmap->bpp = 32;
#else
planar_decompress(codecs->planar, data, length,
&(bitmap->data), PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height);
bitmap->bpp = bpp;
#endif
}
#else
bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp);
bitmap->bpp = bpp;
#endif
}
else {

View File

@ -26,12 +26,7 @@
#include <freerdp/freerdp.h>
#include <guacamole/layer.h>
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
/**
* Guacamole-specific rdpBitmap data.
@ -126,41 +121,6 @@ void guac_rdp_bitmap_free(rdpContext* context, rdpBitmap* bitmap);
BOOL guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap,
BOOL primary);
#ifdef LEGACY_RDPBITMAP
/**
* Decompresses or copies the given image data, storing the result within the
* given bitmap, depending on the compressed flag. Note that even if the
* received data is not compressed, it is the duty of this function to also
* flip received data, if the row order is backwards.
*
* @param context
* The rdpContext associated with the current RDP session.
*
* @param bitmap
* The bitmap in which the decompressed/copied data should be stored.
*
* @param data
* Possibly-compressed image data.
*
* @param width
* The width of the image data, in pixels.
*
* @param height
* The height of the image data, in pixels.
*
* @param bpp
* The number of bits per pixel in the image data.
*
* @param length
* The length of the image data, in bytes.
*
* @param compressed
* TRUE if the image data is compressed, FALSE otherwise.
*/
void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap,
UINT8* data, int width, int height, int bpp, int length,
BOOL compressed);
#else
/**
* Decompresses or copies the given image data, storing the result within the
* given bitmap, depending on the compressed flag. Note that even if the
@ -198,6 +158,5 @@ void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap,
BOOL guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap,
const BYTE* data, UINT32 width, UINT32 height, UINT32 bpp, UINT32 length,
BOOL compressed, UINT32 codec_id);
#endif
#endif

View File

@ -26,32 +26,18 @@
#include "rdp_cliprdr.h"
#include <freerdp/channels/channels.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/freerdp.h>
#include <freerdp/utils/event.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
#ifdef HAVE_FREERDP_CLIENT_CLIPRDR_H
#include <freerdp/client/cliprdr.h>
#else
#include "compat/client-cliprdr.h"
#endif
#include <stdlib.h>
#include <string.h>
void guac_rdp_process_cliprdr_event(guac_client* client, wMessage* event) {
#ifdef LEGACY_EVENT
switch (event->event_type) {
#else
switch (GetMessageType(event->id)) {
#endif
case CliprdrChannel_MonitorReady:
guac_rdp_process_cb_monitor_ready(client, event);
@ -73,15 +59,9 @@ void guac_rdp_process_cliprdr_event(guac_client* client, wMessage* event) {
break;
default:
#ifdef LEGACY_EVENT
guac_client_log(client, GUAC_LOG_INFO,
"Unknown cliprdr event type: 0x%x",
event->event_type);
#else
guac_client_log(client, GUAC_LOG_INFO,
"Unknown cliprdr event type: 0x%x",
GetMessageType(event->id));
#endif
}

View File

@ -24,18 +24,8 @@
#include "config.h"
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
#ifdef HAVE_FREERDP_CLIENT_CLIPRDR_H
#include <freerdp/client/cliprdr.h>
#else
#include "compat/client-cliprdr.h"
#endif
#include <winpr/stream.h>
/**
* Clipboard format for text encoded in Windows CP1252.

View File

@ -25,38 +25,15 @@
#include <freerdp/codec/color.h>
#include <freerdp/freerdp.h>
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
UINT32 guac_rdp_convert_color(rdpContext* context, UINT32 color) {
#ifdef HAVE_FREERDP_CONVERT_GDI_ORDER_COLOR
UINT32* palette = ((rdp_freerdp_context*) context)->palette;
/* Convert given color to ARGB32 */
return freerdp_convert_gdi_order_color(color,
guac_rdp_get_depth(context->instance), PIXEL_FORMAT_ARGB32,
(BYTE*) palette);
#elif defined(HAVE_FREERDP_COLOR_CONVERT_DRAWING_ORDER_COLOR_TO_GDI_COLOR)
CLRCONV* clrconv = ((rdp_freerdp_context*) context)->clrconv;
/* Convert given color to ARGB32 */
return freerdp_color_convert_drawing_order_color_to_gdi_color(color,
guac_rdp_get_depth(context->instance), clrconv);
#else
CLRCONV* clrconv = ((rdp_freerdp_context*) context)->clrconv;
/* Convert given color to ARGB32 */
return freerdp_color_convert_var(color,
guac_rdp_get_depth(context->instance), 32,
clrconv);
#endif
}

View File

@ -21,12 +21,7 @@
#define GUAC_RDP_COLOR_H
#include <freerdp/freerdp.h>
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
/**
* Converts the given color to ARGB32. The color given may be an index

View File

@ -24,22 +24,17 @@
#include "rdp_disp.h"
#include "rdp_settings.h"
#include <freerdp/client/disp.h>
#include <freerdp/freerdp.h>
#include <guacamole/client.h>
#include <guacamole/timestamp.h>
#ifdef HAVE_FREERDP_CLIENT_DISP_H
#include <freerdp/client/disp.h>
#endif
guac_rdp_disp* guac_rdp_disp_alloc() {
guac_rdp_disp* disp = malloc(sizeof(guac_rdp_disp));
#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
/* Not yet connected */
disp->disp = NULL;
#endif
/* No requests have been made */
disp->last_request = guac_timestamp_current();
@ -57,20 +52,16 @@ void guac_rdp_disp_free(guac_rdp_disp* disp) {
void guac_rdp_disp_load_plugin(rdpContext* context, guac_rdp_dvc_list* list) {
#ifdef HAVE_RDPSETTINGS_SUPPORTDISPLAYCONTROL
context->settings->SupportDisplayControl = TRUE;
#endif
/* Add "disp" channel */
guac_rdp_dvc_list_add(list, "disp", NULL);
}
#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
void guac_rdp_disp_connect(guac_rdp_disp* guac_disp, DispClientContext* disp) {
guac_disp->disp = disp;
}
#endif
/**
* Fits a given dimension within the allowed bounds for Display Update
@ -172,7 +163,6 @@ void guac_rdp_disp_update_size(guac_rdp_disp* disp,
}
else if (settings->resize_method == GUAC_RESIZE_DISPLAY_UPDATE) {
#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
DISPLAY_CONTROL_MONITOR_LAYOUT monitors[1] = {{
.Flags = 0x1, /* DISPLAYCONTROL_MONITOR_PRIMARY */
.Left = 0,
@ -189,7 +179,6 @@ void guac_rdp_disp_update_size(guac_rdp_disp* disp,
/* Send display update notification if display channel is connected */
if (disp->disp != NULL)
disp->disp->SendMonitorLayout(disp->disp, 1, monitors);
#endif
}
}

View File

@ -23,11 +23,8 @@
#include "dvc.h"
#include "rdp_settings.h"
#include <freerdp/freerdp.h>
#ifdef HAVE_FREERDP_CLIENT_DISP_H
#include <freerdp/client/disp.h>
#endif
#include <freerdp/freerdp.h>
/**
* The minimum value for width or height, in pixels.
@ -50,12 +47,10 @@
*/
typedef struct guac_rdp_disp {
#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
/**
* Display control interface.
*/
DispClientContext* disp;
#endif
/**
* The timestamp of the last display update request, or 0 if no request
@ -117,7 +112,6 @@ void guac_rdp_disp_free(guac_rdp_disp* disp);
*/
void guac_rdp_disp_load_plugin(rdpContext* context, guac_rdp_dvc_list* list);
#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
/**
* Stores the given DispClientContext within the given guac_rdp_disp, such that
* display updates can be properly sent. Until this is called, changes to the
@ -129,7 +123,6 @@ void guac_rdp_disp_load_plugin(rdpContext* context, guac_rdp_dvc_list* list);
* display update channel.
*/
void guac_rdp_disp_connect(guac_rdp_disp* guac_disp, DispClientContext* disp);
#endif
/**
* Requests a display size update, which may then be sent immediately to the

View File

@ -131,18 +131,6 @@
#define DISP_FILE_OVERWRITE 0x00000004
#define DISP_FILE_OVERWRITE_IF 0x00000005
/*
* Information constants.
* FreeRDP 1.1+ already defines those constants
*/
#ifdef LEGACY_FREERDP
#define FILE_SUPERSEDED 0x00000000
#define FILE_OPENED 0x00000001
#define FILE_OVERWRITTEN 0x00000003
#endif
/*
* File attributes.
*/

View File

@ -30,12 +30,7 @@
#include <freerdp/freerdp.h>
#include <guacamole/client.h>
#include <guacamole/protocol.h>
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
#include <stddef.h>
@ -361,12 +356,8 @@ static void guac_rdp_update_clrconv(CLRCONV* clrconv,
PALETTE_UPDATE* palette) {
clrconv->palette->count = palette->number;
#ifdef LEGACY_RDPPALETTE
clrconv->palette->entries = palette->entries;
#else
memcpy(clrconv->palette->entries, palette->entries,
sizeof(palette->entries));
#endif
}
#endif

View File

@ -28,12 +28,7 @@
#include <freerdp/freerdp.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
#include <pthread.h>
#include <stdint.h>

View File

@ -25,12 +25,7 @@
#include <cairo/cairo.h>
#include <freerdp/freerdp.h>
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
/**
* Guacamole-specific rdpGlyph data.

View File

@ -23,11 +23,7 @@
#include "config.h"
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
/**
* Represents a keysym-to-scancode mapping for RDP, with extra information

View File

@ -26,30 +26,16 @@
#include <freerdp/channels/channels.h>
#include <freerdp/freerdp.h>
#include <freerdp/rail.h>
#include <freerdp/utils/event.h>
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
#ifdef LEGACY_FREERDP
#include "compat/rail.h"
#else
#include <freerdp/rail.h>
#endif
#include <stddef.h>
void guac_rdp_process_rail_event(guac_client* client, wMessage* event) {
#ifdef LEGACY_EVENT
switch (event->event_type) {
#else
switch (GetMessageType(event->id)) {
#endif
/* Get system parameters */
case RailChannel_GetSystemParam:
@ -66,15 +52,9 @@ void guac_rdp_process_rail_event(guac_client* client, wMessage* event) {
break;
default:
#ifdef LEGACY_EVENT
guac_client_log(client, GUAC_LOG_INFO,
"Unknown rail event type: 0x%x",
event->event_type);
#else
guac_client_log(client, GUAC_LOG_INFO,
"Unknown rail event type: 0x%x",
GetMessageType(event->id));
#endif
}
@ -90,11 +70,7 @@ void guac_rdp_process_rail_get_sysparam(guac_client* client, wMessage* event) {
rdpChannels* channels = rdp_client->rdp_inst->context->channels;
/* Get sysparam structure */
#ifdef LEGACY_EVENT
sysparam = (RAIL_SYSPARAM_ORDER*) event->user_data;
#else
sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam;
#endif
response = freerdp_event_new(RailChannel_Class,
RailChannel_ClientSystemParam,

View File

@ -24,12 +24,7 @@
#include "config.h"
#include <guacamole/client.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
/**
* Dispatches a given RAIL event to the appropriate handler.

View File

@ -29,12 +29,7 @@
#include <freerdp/settings.h>
#include <guacamole/string.h>
#include <guacamole/user.h>
#ifdef ENABLE_WINPR
#include <winpr/wtypes.h>
#else
#include "compat/winpr-wtypes.h"
#endif
#include <errno.h>
#include <stddef.h>
@ -107,17 +102,13 @@ const char* GUAC_RDP_CLIENT_ARGS[] = {
"enable-audio-input",
"read-only",
#ifdef HAVE_FREERDP_GATEWAY_SUPPORT
"gateway-hostname",
"gateway-port",
"gateway-domain",
"gateway-username",
"gateway-password",
#endif
#ifdef HAVE_FREERDP_LOAD_BALANCER_SUPPORT
"load-balance-info",
#endif
NULL
};
@ -499,7 +490,6 @@ enum RDP_ARGS_IDX {
*/
IDX_READ_ONLY,
#ifdef HAVE_FREERDP_GATEWAY_SUPPORT
/**
* The hostname of the remote desktop gateway that should be used as an
* intermediary for the remote desktop connection. If omitted, a gateway
@ -536,15 +526,12 @@ enum RDP_ARGS_IDX {
* gateway, if a gateway is being used.
*/
IDX_GATEWAY_PASSWORD,
#endif
#ifdef HAVE_FREERDP_LOAD_BALANCER_SUPPORT
/**
* The load balancing information/cookie which should be provided to
* the connection broker, if a connection broker is being used.
*/
IDX_LOAD_BALANCE_INFO,
#endif
RDP_ARGS_COUNT
};
@ -797,7 +784,6 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
"Preconnection BLOB: \"%s\"", settings->preconnection_blob);
}
#ifndef HAVE_RDPSETTINGS_SENDPRECONNECTIONPDU
/* Warn if support for the preconnection BLOB / ID is absent */
if (settings->preconnection_blob != NULL
|| settings->preconnection_id != -1) {
@ -806,7 +792,6 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
"preconnection PDU. The specified preconnection BLOB and/or "
"ID will be ignored.");
}
#endif
/* Audio enable/disable */
settings->audio_enabled =
@ -974,7 +959,6 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_ENABLE_AUDIO_INPUT, 0);
#ifdef HAVE_FREERDP_GATEWAY_SUPPORT
/* Set gateway hostname */
settings->gateway_hostname =
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
@ -999,14 +983,11 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
settings->gateway_password =
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_GATEWAY_PASSWORD, NULL);
#endif
#ifdef HAVE_FREERDP_LOAD_BALANCER_SUPPORT
/* Set load balance info */
settings->load_balance_info =
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_LOAD_BALANCE_INFO, NULL);
#endif
/* Success */
return settings;
@ -1061,18 +1042,14 @@ void guac_rdp_settings_free(guac_rdp_settings* settings) {
free(settings->sftp_username);
#endif
#ifdef HAVE_FREERDP_GATEWAY_SUPPORT
/* Free RD gateway information */
free(settings->gateway_hostname);
free(settings->gateway_domain);
free(settings->gateway_username);
free(settings->gateway_password);
#endif
#ifdef HAVE_FREERDP_LOAD_BALANCER_SUPPORT
/* Free load balancer information string */
free(settings->load_balance_info);
#endif
/* Free settings structure */
free(settings);
@ -1080,27 +1057,15 @@ void guac_rdp_settings_free(guac_rdp_settings* settings) {
}
int guac_rdp_get_width(freerdp* rdp) {
#ifdef LEGACY_RDPSETTINGS
return rdp->settings->width;
#else
return rdp->settings->DesktopWidth;
#endif
}
int guac_rdp_get_height(freerdp* rdp) {
#ifdef LEGACY_RDPSETTINGS
return rdp->settings->height;
#else
return rdp->settings->DesktopHeight;
#endif
}
int guac_rdp_get_depth(freerdp* rdp) {
#ifdef LEGACY_RDPSETTINGS
return rdp->settings->color_depth;
#else
return rdp->settings->ColorDepth;
#endif
}
/**
@ -1177,56 +1142,22 @@ void guac_rdp_push_settings(guac_client* client,
rdpSettings* rdp_settings = rdp->settings;
/* Authentication */
#ifdef LEGACY_RDPSETTINGS
rdp_settings->domain = guac_rdp_strdup(guac_settings->domain);
rdp_settings->username = guac_rdp_strdup(guac_settings->username);
rdp_settings->password = guac_rdp_strdup(guac_settings->password);
#else
rdp_settings->Domain = guac_rdp_strdup(guac_settings->domain);
rdp_settings->Username = guac_rdp_strdup(guac_settings->username);
rdp_settings->Password = guac_rdp_strdup(guac_settings->password);
#endif
/* Connection */
#ifdef LEGACY_RDPSETTINGS
rdp_settings->hostname = guac_rdp_strdup(guac_settings->hostname);
rdp_settings->port = guac_settings->port;
#else
rdp_settings->ServerHostname = guac_rdp_strdup(guac_settings->hostname);
rdp_settings->ServerPort = guac_settings->port;
#endif
/* Session */
#ifdef LEGACY_RDPSETTINGS
rdp_settings->color_depth = guac_settings->color_depth;
rdp_settings->width = guac_settings->width;
rdp_settings->height = guac_settings->height;
rdp_settings->shell = guac_rdp_strdup(guac_settings->initial_program);
rdp_settings->kbd_layout = guac_settings->server_layout->freerdp_keyboard_layout;
#else
rdp_settings->ColorDepth = guac_settings->color_depth;
rdp_settings->DesktopWidth = guac_settings->width;
rdp_settings->DesktopHeight = guac_settings->height;
rdp_settings->AlternateShell = guac_rdp_strdup(guac_settings->initial_program);
rdp_settings->KeyboardLayout = guac_settings->server_layout->freerdp_keyboard_layout;
#endif
/* Performance flags */
#ifdef LEGACY_RDPSETTINGS
/* Explicitly set flag value */
rdp_settings->performance_flags = guac_rdp_get_performance_flags(guac_settings);
/* Set individual flags - some FreeRDP versions overwrite the above */
rdp_settings->smooth_fonts = guac_settings->font_smoothing_enabled;
rdp_settings->disable_wallpaper = !guac_settings->wallpaper_enabled;
rdp_settings->disable_full_window_drag = !guac_settings->full_window_drag_enabled;
rdp_settings->disable_menu_animations = !guac_settings->menu_animations_enabled;
rdp_settings->disable_theming = !guac_settings->theming_enabled;
rdp_settings->desktop_composition = guac_settings->desktop_composition_enabled;
#else
/* Explicitly set flag value */
rdp_settings->PerformanceFlags = guac_rdp_get_performance_flags(guac_settings);
@ -1238,49 +1169,21 @@ void guac_rdp_push_settings(guac_client* client,
rdp_settings->DisableThemes = !guac_settings->theming_enabled;
rdp_settings->AllowDesktopComposition = guac_settings->desktop_composition_enabled;
#endif
/* Client name */
if (guac_settings->client_name != NULL) {
#ifdef LEGACY_RDPSETTINGS
guac_strlcpy(rdp_settings->client_hostname, guac_settings->client_name,
RDP_CLIENT_HOSTNAME_SIZE);
#else
guac_strlcpy(rdp_settings->ClientHostname, guac_settings->client_name,
RDP_CLIENT_HOSTNAME_SIZE);
#endif
}
/* Console */
#ifdef LEGACY_RDPSETTINGS
rdp_settings->console_session = guac_settings->console;
rdp_settings->console_audio = guac_settings->console_audio;
#else
rdp_settings->ConsoleSession = guac_settings->console;
rdp_settings->RemoteConsoleAudio = guac_settings->console_audio;
#endif
/* Audio */
#ifdef LEGACY_RDPSETTINGS
#ifdef HAVE_RDPSETTINGS_AUDIOPLAYBACK
rdp_settings->audio_playback = guac_settings->audio_enabled;
#endif
#else
#ifdef HAVE_RDPSETTINGS_AUDIOPLAYBACK
rdp_settings->AudioPlayback = guac_settings->audio_enabled;
#endif
#endif
/* Audio capture */
#ifdef LEGACY_RDPSETTINGS
#ifdef HAVE_RDPSETTINGS_AUDIOCAPTURE
rdp_settings->audio_capture = guac_settings->enable_audio_input;
#endif
#else
#ifdef HAVE_RDPSETTINGS_AUDIOCAPTURE
rdp_settings->AudioCapture = guac_settings->enable_audio_input;
#endif
#endif
/* Timezone redirection */
if (guac_settings->timezone) {
@ -1292,35 +1195,15 @@ void guac_rdp_push_settings(guac_client* client,
}
/* Device redirection */
#ifdef LEGACY_RDPSETTINGS
#ifdef HAVE_RDPSETTINGS_DEVICEREDIRECTION
rdp_settings->device_redirection = guac_settings->audio_enabled
|| guac_settings->drive_enabled
|| guac_settings->printing_enabled;
#endif
#else
#ifdef HAVE_RDPSETTINGS_DEVICEREDIRECTION
rdp_settings->DeviceRedirection = guac_settings->audio_enabled
|| guac_settings->drive_enabled
|| guac_settings->printing_enabled;
#endif
#endif
/* Security */
switch (guac_settings->security_mode) {
/* Standard RDP encryption */
case GUAC_SECURITY_RDP:
#ifdef LEGACY_RDPSETTINGS
rdp_settings->rdp_security = TRUE;
rdp_settings->tls_security = FALSE;
rdp_settings->nla_security = FALSE;
rdp_settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
rdp_settings->encryption_method =
ENCRYPTION_METHOD_40BIT
| ENCRYPTION_METHOD_128BIT
| ENCRYPTION_METHOD_FIPS;
#else
rdp_settings->RdpSecurity = TRUE;
rdp_settings->TlsSecurity = FALSE;
rdp_settings->NlaSecurity = FALSE;
@ -1329,78 +1212,46 @@ void guac_rdp_push_settings(guac_client* client,
ENCRYPTION_METHOD_40BIT
| ENCRYPTION_METHOD_128BIT
| ENCRYPTION_METHOD_FIPS;
#endif
break;
/* TLS encryption */
case GUAC_SECURITY_TLS:
#ifdef LEGACY_RDPSETTINGS
rdp_settings->rdp_security = FALSE;
rdp_settings->tls_security = TRUE;
rdp_settings->nla_security = FALSE;
#else
rdp_settings->RdpSecurity = FALSE;
rdp_settings->TlsSecurity = TRUE;
rdp_settings->NlaSecurity = FALSE;
#endif
break;
/* Network level authentication */
case GUAC_SECURITY_NLA:
#ifdef LEGACY_RDPSETTINGS
rdp_settings->rdp_security = FALSE;
rdp_settings->tls_security = FALSE;
rdp_settings->nla_security = TRUE;
#else
rdp_settings->RdpSecurity = FALSE;
rdp_settings->TlsSecurity = FALSE;
rdp_settings->NlaSecurity = TRUE;
#endif
break;
/* All security types */
case GUAC_SECURITY_ANY:
#ifdef LEGACY_RDPSETTINGS
rdp_settings->rdp_security = TRUE;
rdp_settings->tls_security = TRUE;
rdp_settings->nla_security = TRUE;
#else
rdp_settings->RdpSecurity = TRUE;
rdp_settings->TlsSecurity = TRUE;
rdp_settings->NlaSecurity = TRUE;
#endif
break;
}
/* Authentication */
#ifdef LEGACY_RDPSETTINGS
rdp_settings->authentication = !guac_settings->disable_authentication;
rdp_settings->ignore_certificate = guac_settings->ignore_certificate;
rdp_settings->encryption = TRUE;
#else
rdp_settings->Authentication = !guac_settings->disable_authentication;
rdp_settings->IgnoreCertificate = guac_settings->ignore_certificate;
rdp_settings->DisableEncryption = FALSE;
#endif
/* RemoteApp */
if (guac_settings->remote_app != NULL) {
#ifdef LEGACY_RDPSETTINGS
rdp_settings->workarea = TRUE;
rdp_settings->remote_app = TRUE;
rdp_settings->rail_langbar_supported = TRUE;
#else
rdp_settings->Workarea = TRUE;
rdp_settings->RemoteApplicationMode = TRUE;
rdp_settings->RemoteAppLanguageBarSupported = TRUE;
rdp_settings->RemoteApplicationProgram = guac_settings->remote_app;
rdp_settings->ShellWorkingDirectory = guac_rdp_strdup(guac_settings->remote_app_dir);
rdp_settings->RemoteApplicationCmdLine = guac_settings->remote_app_args;
#endif
}
#ifdef HAVE_RDPSETTINGS_SENDPRECONNECTIONPDU
/* Preconnection ID */
if (guac_settings->preconnection_id != -1) {
rdp_settings->NegotiateSecurityLayer = FALSE;
@ -1414,9 +1265,7 @@ void guac_rdp_push_settings(guac_client* client,
rdp_settings->SendPreconnectionPdu = TRUE;
rdp_settings->PreconnectionBlob = guac_settings->preconnection_blob;
}
#endif
#ifdef HAVE_FREERDP_GATEWAY_SUPPORT
/* Enable use of RD gateway if a gateway hostname is provided */
if (guac_settings->gateway_hostname != NULL) {
@ -1434,49 +1283,14 @@ void guac_rdp_push_settings(guac_client* client,
rdp_settings->GatewayPassword = guac_rdp_strdup(guac_settings->gateway_password);
}
#endif
#ifdef HAVE_FREERDP_LOAD_BALANCER_SUPPORT
/* Store load balance info (and calculate length) if provided */
if (guac_settings->load_balance_info != NULL) {
rdp_settings->LoadBalanceInfo = (BYTE*) guac_rdp_strdup(guac_settings->load_balance_info);
rdp_settings->LoadBalanceInfoLength = strlen(guac_settings->load_balance_info);
}
#endif
/* Order support */
#ifdef LEGACY_RDPSETTINGS
rdp_settings->bitmap_cache = bitmap_cache;
rdp_settings->offscreen_bitmap_cache = !guac_settings->disable_offscreen_caching;
rdp_settings->glyph_cache = !guac_settings->disable_glyph_caching;
rdp_settings->os_major_type = OSMAJORTYPE_UNSPECIFIED;
rdp_settings->os_minor_type = OSMINORTYPE_UNSPECIFIED;
rdp_settings->desktop_resize = TRUE;
rdp_settings->order_support[NEG_DSTBLT_INDEX] = TRUE;
rdp_settings->order_support[NEG_PATBLT_INDEX] = FALSE; /* PATBLT not yet supported */
rdp_settings->order_support[NEG_SCRBLT_INDEX] = TRUE;
rdp_settings->order_support[NEG_OPAQUE_RECT_INDEX] = TRUE;
rdp_settings->order_support[NEG_DRAWNINEGRID_INDEX] = FALSE;
rdp_settings->order_support[NEG_MULTIDSTBLT_INDEX] = FALSE;
rdp_settings->order_support[NEG_MULTIPATBLT_INDEX] = FALSE;
rdp_settings->order_support[NEG_MULTISCRBLT_INDEX] = FALSE;
rdp_settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = FALSE;
rdp_settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = FALSE;
rdp_settings->order_support[NEG_LINETO_INDEX] = FALSE;
rdp_settings->order_support[NEG_POLYLINE_INDEX] = FALSE;
rdp_settings->order_support[NEG_MEMBLT_INDEX] = bitmap_cache;
rdp_settings->order_support[NEG_MEM3BLT_INDEX] = FALSE;
rdp_settings->order_support[NEG_MEMBLT_V2_INDEX] = bitmap_cache;
rdp_settings->order_support[NEG_MEM3BLT_V2_INDEX] = FALSE;
rdp_settings->order_support[NEG_SAVEBITMAP_INDEX] = FALSE;
rdp_settings->order_support[NEG_GLYPH_INDEX_INDEX] = TRUE;
rdp_settings->order_support[NEG_FAST_INDEX_INDEX] = TRUE;
rdp_settings->order_support[NEG_FAST_GLYPH_INDEX] = TRUE;
rdp_settings->order_support[NEG_POLYGON_SC_INDEX] = FALSE;
rdp_settings->order_support[NEG_POLYGON_CB_INDEX] = FALSE;
rdp_settings->order_support[NEG_ELLIPSE_SC_INDEX] = FALSE;
rdp_settings->order_support[NEG_ELLIPSE_CB_INDEX] = FALSE;
#else
rdp_settings->BitmapCacheEnabled = bitmap_cache;
rdp_settings->OffscreenSupportLevel = !guac_settings->disable_offscreen_caching;
rdp_settings->GlyphSupportLevel = !guac_settings->disable_glyph_caching ? GLYPH_SUPPORT_FULL : GLYPH_SUPPORT_NONE;
@ -1507,7 +1321,6 @@ void guac_rdp_push_settings(guac_client* client,
rdp_settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE;
rdp_settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
rdp_settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
#endif
}

View File

@ -466,7 +466,6 @@ typedef struct guac_rdp_settings {
*/
int enable_audio_input;
#ifdef HAVE_FREERDP_GATEWAY_SUPPORT
/**
* The hostname of the remote desktop gateway that should be used as an
* intermediary for the remote desktop connection. If no gateway should
@ -501,15 +500,12 @@ typedef struct guac_rdp_settings {
* gateway, if a gateway is being used.
*/
char* gateway_password;
#endif
#ifdef HAVE_FREERDP_LOAD_BALANCER_SUPPORT
/**
* The load balancing information/cookie which should be provided to
* the connection broker, if a connection broker is being used.
*/
char* load_balance_info;
#endif
} guac_rdp_settings;

View File

@ -28,25 +28,14 @@
#include <freerdp/freerdp.h>
#include <freerdp/channels/channels.h>
#include <freerdp/client/cliprdr.h>
#include <guacamole/client.h>
#include <guacamole/protocol.h>
#include <guacamole/socket.h>
#include <guacamole/stream.h>
#include <guacamole/string.h>
#ifdef HAVE_FREERDP_CLIENT_CLIPRDR_H
#include <freerdp/client/cliprdr.h>
#else
#include "compat/client-cliprdr.h"
#endif
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#include <winpr/wtypes.h>
#else
#include "compat/winpr-stream.h"
#include "compat/winpr-wtypes.h"
#endif
#include <stdlib.h>

View File

@ -26,12 +26,7 @@
#include <freerdp/utils/svc_plugin.h>
#include <guacamole/client.h>
#include <guacamole/string.h>
#ifdef ENABLE_WINPR
#include <winpr/stream.h>
#else
#include "compat/winpr-stream.h"
#endif
#include <stdlib.h>