/* Settings */
+ #ifdef __GNUC__
+ #define ALIGN64 __attribute__((aligned(8)))
+ #else
+ #ifdef _WIN32
+ #define ALIGN64 __declspec(align(8))
+ #else
+ #define ALIGN64
+ #endif
+ #endif
+
struct rdp_settings
{
- void* instance; /* 0 */
- uint32 paddingA[16 - 1]; /* 1 */
+ ALIGN64 void* instance; /* 0 */
+ ALIGN64 uint64 paddingA[16 - 1]; /* 1 */
/* Core Protocol Parameters */
- uint32 width; /* 16 */
- uint32 height; /* 17 */
- uint32 rdp_version; /* 18 */
- uint32 color_depth; /* 19 */
- uint32 kbd_layout; /* 20 */
- uint32 kbd_type; /* 21 */
- uint32 kbd_subtype; /* 22 */
- uint32 kbd_fn_keys; /* 23 */
- uint32 client_build; /* 24 */
- uint32 requested_protocols; /* 25 */
- uint32 selected_protocol; /* 26 */
- uint32 encryption_method; /* 27 */
- uint32 encryption_level; /* 28 */
- boolean authentication; /* 29 */
- uint32 negotiationFlags; /* 30 */
- uint32 paddingB[48 - 31]; /* 31 */
+ ALIGN64 uint32 width; /* 16 */
+ ALIGN64 uint32 height; /* 17 */
+ ALIGN64 uint32 rdp_version; /* 18 */
+ ALIGN64 uint32 color_depth; /* 19 */
+ ALIGN64 uint32 kbd_layout; /* 20 */
+ ALIGN64 uint32 kbd_type; /* 21 */
+ ALIGN64 uint32 kbd_subtype; /* 22 */
+ ALIGN64 uint32 kbd_fn_keys; /* 23 */
+ ALIGN64 uint32 client_build; /* 24 */
+ ALIGN64 uint32 requested_protocols; /* 25 */
+ ALIGN64 uint32 selected_protocol; /* 26 */
+ ALIGN64 uint32 encryption_method; /* 27 */
+ ALIGN64 uint32 encryption_level; /* 28 */
+ ALIGN64 boolean authentication; /* 29 */
+ ALIGN64 uint32 negotiationFlags; /* 30 */
+ ALIGN64 uint64 paddingB[48 - 31]; /* 31 */
/* Connection Settings */
- uint32 port; /* 48 */
- boolean ipv6; /* 49 */
- char* hostname; /* 50 */
- char* username; /* 51 */
- char* password; /* 52 */
- char* domain; /* 53 */
- char* shell; /* 54 */
- char* directory; /* 55 */
- char* ip_address; /* 56 */
- char* client_dir; /* 57 */
- boolean autologon; /* 58 */
- boolean compression; /* 59 */
- uint32 performance_flags; /* 60 */
- rdpBlob* password_cookie; /* 61 */
- char* kerberos_kdc; /* 62 */
- char* kerberos_realm; /* 63 */
- boolean ts_gateway; /* 64 */
- char* tsg_hostname; /* 65 */
- char* tsg_username; /* 66 */
- char* tsg_password; /* 67 */
- uint32 paddingC[80 - 68]; /* 68 */
+ ALIGN64 uint32 port; /* 48 */
+ ALIGN64 boolean ipv6; /* 49 */
+ ALIGN64 char* hostname; /* 50 */
+ ALIGN64 char* username; /* 51 */
+ ALIGN64 char* password; /* 52 */
+ ALIGN64 char* domain; /* 53 */
+ ALIGN64 char* shell; /* 54 */
+ ALIGN64 char* directory; /* 55 */
+ ALIGN64 char* ip_address; /* 56 */
+ ALIGN64 char* client_dir; /* 57 */
+ ALIGN64 boolean autologon; /* 58 */
+ ALIGN64 boolean compression; /* 59 */
+ ALIGN64 uint32 performance_flags; /* 60 */
+ ALIGN64 rdpBlob* password_cookie; /* 61 */
+ ALIGN64 char* kerberos_kdc; /* 62 */
+ ALIGN64 char* kerberos_realm; /* 63 */
- ALIGN64 uint64 paddingC[80 - 64]; /* 64 */
++ ALIGN64 boolean ts_gateway; /* 64 */
++ ALIGN64 char* tsg_hostname; /* 65 */
++ ALIGN64 char* tsg_username; /* 66 */
++ ALIGN64 char* tsg_password; /* 67 */
++ ALIGN64 uint64 paddingC[80 - 68]; /* 68 */
/* User Interface Parameters */
- boolean sw_gdi; /* 80 */
- boolean workarea; /* 81 */
- boolean fullscreen; /* 82 */
- boolean grab_keyboard; /* 83 */
- boolean decorations; /* 84 */
- uint32 percent_screen; /* 85 */
- boolean mouse_motion; /* 86 */
- char* window_title; /* 87 */
- uint64 parent_window_xid; /* 88 */
- uint32 paddingD[112 - 89]; /* 89 */
+ ALIGN64 boolean sw_gdi; /* 80 */
+ ALIGN64 boolean workarea; /* 81 */
+ ALIGN64 boolean fullscreen; /* 82 */
+ ALIGN64 boolean grab_keyboard; /* 83 */
+ ALIGN64 boolean decorations; /* 84 */
+ ALIGN64 uint32 percent_screen; /* 85 */
+ ALIGN64 boolean mouse_motion; /* 86 */
+ ALIGN64 char* window_title; /* 87 */
+ ALIGN64 uint64 parent_window_xid; /* 88 */
+ ALIGN64 uint64 paddingD[112 - 89]; /* 89 */
/* Internal Parameters */
- char* home_path; /* 112 */
- uint32 share_id; /* 113 */
- uint32 pdu_source; /* 114 */
- UNICONV* uniconv; /* 115 */
- boolean server_mode; /* 116 */
- char* config_path; /* 117 */
- char* current_path; /* 118 */
- char* development_path; /* 119 */
- boolean development_mode; /* 120 */
- uint32 paddingE[144 - 121]; /* 121 */
+ ALIGN64 char* home_path; /* 112 */
+ ALIGN64 uint32 share_id; /* 113 */
+ ALIGN64 uint32 pdu_source; /* 114 */
+ ALIGN64 UNICONV* uniconv; /* 115 */
+ ALIGN64 boolean server_mode; /* 116 */
+ ALIGN64 char* config_path; /* 117 */
+ ALIGN64 char* current_path; /* 118 */
+ ALIGN64 char* development_path; /* 119 */
+ ALIGN64 boolean development_mode; /* 120 */
+ ALIGN64 uint64 paddingE[144 - 121]; /* 121 */
/* Security */
- boolean encryption; /* 144 */
- boolean tls_security; /* 145 */
- boolean nla_security; /* 146 */
- boolean rdp_security; /* 147 */
- uint32 ntlm_version; /* 148 */
- boolean salted_checksum; /* 149 */
- uint32 paddingF[160 - 150]; /* 150 */
+ ALIGN64 boolean encryption; /* 144 */
+ ALIGN64 boolean tls_security; /* 145 */
+ ALIGN64 boolean nla_security; /* 146 */
+ ALIGN64 boolean rdp_security; /* 147 */
+ ALIGN64 uint32 ntlm_version; /* 148 */
+ ALIGN64 boolean salted_checksum; /* 149 */
+ ALIGN64 uint64 paddingF[160 - 150]; /* 150 */
/* Session */
- boolean console_audio; /* 160 */
- boolean console_session; /* 161 */
- uint32 redirected_session_id; /* 162 */
- boolean audio_playback; /* 163 */
- boolean audio_capture; /* 164 */
- uint32 paddingG[176 - 165]; /* 165 */
+ ALIGN64 boolean console_audio; /* 160 */
+ ALIGN64 boolean console_session; /* 161 */
+ ALIGN64 uint32 redirected_session_id; /* 162 */
+ ALIGN64 boolean audio_playback; /* 163 */
+ ALIGN64 boolean audio_capture; /* 164 */
+ ALIGN64 uint64 paddingG[176 - 165]; /* 165 */
/* Output Control */
- boolean refresh_rect; /* 176 */
- boolean suppress_output; /* 177 */
- boolean desktop_resize; /* 178 */
- uint32 paddingH[192 - 179]; /* 179 */
+ ALIGN64 boolean refresh_rect; /* 176 */
+ ALIGN64 boolean suppress_output; /* 177 */
+ ALIGN64 boolean desktop_resize; /* 178 */
+ ALIGN64 uint64 paddingH[192 - 179]; /* 179 */
/* Reconnection */
- boolean auto_reconnection; /* 192 */
- ARC_CS_PRIVATE_PACKET* client_auto_reconnect_cookie; /* 193 */
- ARC_SC_PRIVATE_PACKET* server_auto_reconnect_cookie; /* 194 */
- uint32 paddingI[208 - 195]; /* 195 */
+ ALIGN64 boolean auto_reconnection; /* 192 */
+ ALIGN64 ARC_CS_PRIVATE_PACKET* client_auto_reconnect_cookie; /* 193 */
+ ALIGN64 ARC_SC_PRIVATE_PACKET* server_auto_reconnect_cookie; /* 194 */
+ ALIGN64 uint64 paddingI[208 - 195]; /* 195 */
/* Time Zone */
- TIME_ZONE_INFO* client_time_zone; /* 208 */
- uint32 paddingJ[216 - 209]; /* 209 */
+ ALIGN64 TIME_ZONE_INFO* client_time_zone; /* 208 */
+ ALIGN64 uint64 paddingJ[216 - 209]; /* 209 */
/* Capabilities */
- uint32 os_major_type; /* 216 */
- uint32 os_minor_type; /* 217 */
- uint32 vc_chunk_size; /* 218 */
- boolean sound_beeps; /* 219 */
- boolean smooth_fonts; /* 220 */
- boolean frame_marker; /* 221 */
- boolean fastpath_input; /* 222 */
- boolean fastpath_output; /* 223 */
- uint8 received_caps[32]; /* 224 (8) */
- uint8 order_support[32]; /* 232 (8) */
- boolean surface_commands; /* 240 */
- boolean disable_wallpaper; /* 241 */
- boolean disable_full_window_drag; /* 242 */
- boolean disable_menu_animations; /* 243 */
- boolean disable_theming; /* 244 */
- uint32 connection_type; /* 245 */
- uint32 multifrag_max_request_size; /* 246 */
- uint32 paddingK[248 - 247]; /* 247 */
+ ALIGN64 uint32 os_major_type; /* 216 */
+ ALIGN64 uint32 os_minor_type; /* 217 */
+ ALIGN64 uint32 vc_chunk_size; /* 218 */
+ ALIGN64 boolean sound_beeps; /* 219 */
+ ALIGN64 boolean smooth_fonts; /* 220 */
+ ALIGN64 boolean frame_marker; /* 221 */
+ ALIGN64 boolean fastpath_input; /* 222 */
+ ALIGN64 boolean fastpath_output; /* 223 */
+ ALIGN64 uint8* received_caps; /* 224 */
+ ALIGN64 uint8* order_support; /* 225 */
+ ALIGN64 boolean surface_commands; /* 226 */
+ ALIGN64 boolean disable_wallpaper; /* 227 */
+ ALIGN64 boolean disable_full_window_drag; /* 228 */
+ ALIGN64 boolean disable_menu_animations; /* 229 */
+ ALIGN64 boolean disable_theming; /* 230 */
+ ALIGN64 uint32 connection_type; /* 231 */
+ ALIGN64 uint32 multifrag_max_request_size; /* 232 */
+ ALIGN64 uint64 paddingK[248 - 233]; /* 233 */
/* Certificate */
- char* cert_file; /* 248 */
- char* privatekey_file; /* 249 */
- char client_hostname[32]; /* 250 (8) */
- char client_product_id[32]; /* 258 (8) */
- rdpBlob* server_random; /* 266 */
- rdpBlob* server_certificate; /* 267 */
- boolean ignore_certificate; /* 268 */
- rdpCertificate* server_cert; /* 269 */
- char* rdp_key_file; /* 270 */
- rdpKey* server_key; /* 271 */
- char* certificate_name; /* 272 */
- uint32 paddingL[280 - 273]; /* 273 */
+ ALIGN64 char* cert_file; /* 248 */
+ ALIGN64 char* privatekey_file; /* 249 */
+ ALIGN64 char* client_hostname; /* 250 */
+ ALIGN64 char* client_product_id; /* 251 */
+ ALIGN64 rdpBlob* server_random; /* 252 */
+ ALIGN64 rdpBlob* server_certificate; /* 253 */
+ ALIGN64 boolean ignore_certificate; /* 254 */
+ ALIGN64 rdpCertificate* server_cert; /* 255 */
+ ALIGN64 char* rdp_key_file; /* 256 */
+ ALIGN64 rdpKey* server_key; /* 257 */
+ ALIGN64 char* certificate_name; /* 258 */
+ ALIGN64 uint64 paddingL[280 - 259]; /* 259 */
/* Codecs */
- boolean rfx_codec; /* 280 */
- boolean ns_codec; /* 281 */
- uint32 rfx_codec_id; /* 282 */
- uint32 ns_codec_id; /* 283 */
- uint32 rfx_codec_mode; /* 284 */
- boolean frame_acknowledge; /* 285 */
- uint32 paddingM[296 - 286]; /* 286 */
+ ALIGN64 boolean rfx_codec; /* 280 */
+ ALIGN64 boolean ns_codec; /* 281 */
+ ALIGN64 uint32 rfx_codec_id; /* 282 */
+ ALIGN64 uint32 ns_codec_id; /* 283 */
+ ALIGN64 uint32 rfx_codec_mode; /* 284 */
+ ALIGN64 boolean frame_acknowledge; /* 285 */
+ ALIGN64 uint64 paddingM[296 - 286]; /* 286 */
/* Recording */
- boolean dump_rfx; /* 296 */
- boolean play_rfx; /* 297 */
- char* dump_rfx_file; /* 298 */
- char* play_rfx_file; /* 299 */
- uint32 paddingN[312 - 300]; /* 300 */
+ ALIGN64 boolean dump_rfx; /* 296 */
+ ALIGN64 boolean play_rfx; /* 297 */
+ ALIGN64 char* dump_rfx_file; /* 298 */
+ ALIGN64 char* play_rfx_file; /* 299 */
+ ALIGN64 uint64 paddingN[312 - 300]; /* 300 */
/* RemoteApp */
- boolean remote_app; /* 312 */
- uint32 num_icon_caches; /* 313 */
- uint32 num_icon_cache_entries; /* 314 */
- boolean rail_langbar_supported; /* 315 */
- uint32 paddingO[320 - 316]; /* 316 */
+ ALIGN64 boolean remote_app; /* 312 */
+ ALIGN64 uint32 num_icon_caches; /* 313 */
+ ALIGN64 uint32 num_icon_cache_entries; /* 314 */
+ ALIGN64 boolean rail_langbar_supported; /* 315 */
+ ALIGN64 uint64 paddingO[320 - 316]; /* 316 */
/* Pointer */
- boolean large_pointer; /* 320 */
- boolean color_pointer; /* 321 */
- uint32 pointer_cache_size; /* 322 */
- uint32 paddingP[328 - 323]; /* 323 */
+ ALIGN64 boolean large_pointer; /* 320 */
+ ALIGN64 boolean color_pointer; /* 321 */
+ ALIGN64 uint32 pointer_cache_size; /* 322 */
+ ALIGN64 uint64 paddingP[328 - 323]; /* 323 */
/* Bitmap Cache */
- boolean bitmap_cache; /* 328 */
- boolean bitmap_cache_v3; /* 329 */
- boolean persistent_bitmap_cache; /* 330 */
- uint32 bitmapCacheV2NumCells; /* 331 */
- BITMAP_CACHE_V2_CELL_INFO* bitmapCacheV2CellInfo; /* 332 */
- uint32 paddingQ[344 - 333]; /* 333 */
+ ALIGN64 boolean bitmap_cache; /* 328 */
+ ALIGN64 boolean bitmap_cache_v3; /* 329 */
+ ALIGN64 boolean persistent_bitmap_cache; /* 330 */
+ ALIGN64 uint32 bitmapCacheV2NumCells; /* 331 */
+ ALIGN64 BITMAP_CACHE_V2_CELL_INFO* bitmapCacheV2CellInfo; /* 332 */
+ ALIGN64 uint64 paddingQ[344 - 333]; /* 333 */
/* Offscreen Bitmap Cache */
- boolean offscreen_bitmap_cache; /* 344 */
- uint32 offscreen_bitmap_cache_size; /* 345 */
- uint32 offscreen_bitmap_cache_entries; /* 346 */
- uint32 paddingR[352 - 347]; /* 347 */
+ ALIGN64 boolean offscreen_bitmap_cache; /* 344 */
+ ALIGN64 uint32 offscreen_bitmap_cache_size; /* 345 */
+ ALIGN64 uint32 offscreen_bitmap_cache_entries; /* 346 */
+ ALIGN64 uint64 paddingR[352 - 347]; /* 347 */
/* Glyph Cache */
- boolean glyph_cache; /* 352 */
- uint32 glyphSupportLevel; /* 353 */
- GLYPH_CACHE_DEFINITION* glyphCache; /* 354 */
- GLYPH_CACHE_DEFINITION* fragCache; /* 355 */
- uint32 paddingS[360 - 356]; /* 356 */
+ ALIGN64 boolean glyph_cache; /* 352 */
+ ALIGN64 uint32 glyphSupportLevel; /* 353 */
+ ALIGN64 GLYPH_CACHE_DEFINITION* glyphCache; /* 354 */
+ ALIGN64 GLYPH_CACHE_DEFINITION* fragCache; /* 355 */
+ ALIGN64 uint64 paddingS[360 - 356]; /* 356 */
/* Draw Nine Grid */
- boolean draw_nine_grid; /* 360 */
- uint32 draw_nine_grid_cache_size; /* 361 */
- uint32 draw_nine_grid_cache_entries; /* 362 */
- uint32 paddingT[368 - 363]; /* 363 */
+ ALIGN64 boolean draw_nine_grid; /* 360 */
+ ALIGN64 uint32 draw_nine_grid_cache_size; /* 361 */
+ ALIGN64 uint32 draw_nine_grid_cache_entries; /* 362 */
+ ALIGN64 uint64 paddingT[368 - 363]; /* 363 */
/* Draw GDI+ */
- boolean draw_gdi_plus; /* 368 */
- boolean draw_gdi_plus_cache; /* 369 */
- uint32 paddingU[376 - 370]; /* 370 */
+ ALIGN64 boolean draw_gdi_plus; /* 368 */
+ ALIGN64 boolean draw_gdi_plus_cache; /* 369 */
+ ALIGN64 uint64 paddingU[376 - 370]; /* 370 */
/* Desktop Composition */
- boolean desktop_composition; /* 376 */
- uint32 paddingV[384 - 377]; /* 377 */
+ ALIGN64 boolean desktop_composition; /* 376 */
+ ALIGN64 uint64 paddingV[384 - 377]; /* 377 */
/* Channels */
- int num_channels;
- rdpChannel channels[16];
+ ALIGN64 int num_channels;
+ ALIGN64 rdpChannel channels[16];
/* Monitors */
- int num_monitors;
- struct rdp_monitor monitors[16];
+ ALIGN64 int num_monitors;
+ ALIGN64 struct rdp_monitor monitors[16];
/* Extensions */
- int num_extensions;
- struct rdp_ext_set extensions[16];
+ ALIGN64 int num_extensions;
+ ALIGN64 struct rdp_ext_set extensions[16];
};
typedef struct rdp_settings rdpSettings;
--- /dev/null
- #include <freerdp/wintypes.h>
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * Terminal Server Gateway (TSG)
+ *
+ * Copyright 2012 Fujitsu Technology Solutions GmbH
+ * Copyright 2012 Dmitrij Jasnov <dmitrij.jasnov@ts.fujitsu.com>
+ *
+ * Licensed 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 FREERDP_CORE_TSG_H
+#define FREERDP_CORE_TSG_H
+
+typedef struct rdp_tsg rdpTsg;
+
+#include "transport.h"
+#include "rpc.h"
+
+#include <time.h>
+#include <freerdp/types.h>
++#include <freerdp/wtypes.h>
+#include <freerdp/settings.h>
+#include <freerdp/utils/stream.h>
+#include <freerdp/utils/wait_obj.h>
+#include <freerdp/utils/debug.h>
+
+struct rdp_tsg
+{
+ rdpRpc* rpc;
+ rdpSettings* settings;
+ rdpTransport* transport;
+ uint8 TunnelContext[16];
+ uint8 ChannelContext[16];
+};
+
+typedef void* I_RPC_HANDLE;
+typedef I_RPC_HANDLE RPC_BINDING_HANDLE;
+typedef RPC_BINDING_HANDLE handle_t;
+
+typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE;
+typedef PCONTEXT_HANDLE PTUNNEL_CONTEXT_HANDLE_SERIALIZE;
+
+typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE;
+typedef PCONTEXT_HANDLE PCHANNEL_CONTEXT_HANDLE_SERIALIZE;
+
+typedef wchar_t* RESOURCENAME;
+
+#define MAX_RESOURCE_NAMES 50
+
+typedef struct _tsendpointinfo
+{
+ RESOURCENAME* resourceName;
+ unsigned long numResourceNames;
+ RESOURCENAME* alternateResourceNames;
+ unsigned short numAlternateResourceNames;
+ unsigned long Port;
+} TSENDPOINTINFO, *PTSENDPOINTINFO;
+
+#define TSG_PACKET_TYPE_HEADER 0x00004844
+#define TSG_PACKET_TYPE_VERSIONCAPS 0x00005643
+#define TSG_PACKET_TYPE_QUARCONFIGREQUEST 0x00005143
+#define TSG_PACKET_TYPE_QUARREQUEST 0x00005152
+#define TSG_PACKET_TYPE_RESPONSE 0x00005052
+#define TSG_PACKET_TYPE_QUARENC_RESPONSE 0x00004552
+#define TSG_CAPABILITY_TYPE_NAP 0x00000001
+#define TSG_PACKET_TYPE_CAPS_RESPONSE 0x00004350
+#define TSG_PACKET_TYPE_MSGREQUEST_PACKET 0x00004752
+#define TSG_PACKET_TYPE_MESSAGE_PACKET 0x00004750
+#define TSG_PACKET_TYPE_AUTH 0x00004054
+#define TSG_PACKET_TYPE_REAUTH 0x00005250
+#define TSG_ASYNC_MESSAGE_CONSENT_MESSAGE 0x00000001
+#define TSG_ASYNC_MESSAGE_SERVICE_MESSAGE 0x00000002
+#define TSG_ASYNC_MESSAGE_REAUTH 0x00000003
+#define TSG_TUNNEL_CALL_ASYNC_MSG_REQUEST 0x00000001
+#define TSG_TUNNEL_CANCEL_ASYNC_MSG_REQUEST 0x00000002
+
+#define TSG_NAP_CAPABILITY_QUAR_SOH 0x00000001
+#define TSG_NAP_CAPABILITY_IDLE_TIMEOUT 0x00000002
+#define TSG_MESSAGING_CAP_CONSENT_SIGN 0x00000004
+#define TSG_MESSAGING_CAP_SERVICE_MSG 0x00000008
+#define TSG_MESSAGING_CAP_REAUTH 0x00000010
+
+typedef struct _TSG_PACKET_HEADER
+{
+ unsigned short ComponentId;
+ unsigned short PacketId;
+} TSG_PACKET_HEADER, *PTSG_PACKET_HEADER;
+
+typedef struct _TSG_CAPABILITY_NAP
+{
+ unsigned long capabilities;
+} TSG_CAPABILITY_NAP, *PTSG_CAPABILITY_NAP;
+
+typedef union
+{
+ TSG_CAPABILITY_NAP tsgCapNap;
+} TSG_CAPABILITIES_UNION, *PTSG_CAPABILITIES_UNION;
+
+typedef struct _TSG_PACKET_CAPABILITIES
+{
+ unsigned long capabilityType;
+ TSG_CAPABILITIES_UNION tsgPacket;
+} TSG_PACKET_CAPABILITIES, *PTSG_PACKET_CAPABILITIES;
+
+typedef struct _TSG_PACKET_VERSIONCAPS
+{
+ TSG_PACKET_HEADER tsgHeader;
+ PTSG_PACKET_CAPABILITIES tsgCaps;
+ unsigned long numCapabilities;
+ unsigned short majorVersion;
+ unsigned short minorVersion;
+ unsigned short quarantineCapabilities;
+} TSG_PACKET_VERSIONCAPS, *PTSG_PACKET_VERSIONCAPS;
+
+typedef struct _TSG_PACKET_QUARCONFIGREQUEST
+{
+ unsigned long flags;
+} TSG_PACKET_QUARCONFIGREQUEST, *PTSG_PACKET_QUARCONFIGREQUEST;
+
+typedef struct _TSG_PACKET_QUARREQUEST
+{
+ unsigned long flags;
+ wchar_t* machineName;
+ unsigned long nameLength;
+ byte* data;
+ unsigned long dataLen;
+} TSG_PACKET_QUARREQUEST, *PTSG_PACKET_QUARREQUEST;
+
+typedef struct _TSG_REDIRECTION_FLAGS
+{
+ BOOL enableAllRedirections;
+ BOOL disableAllRedirections;
+ BOOL driveRedirectionDisabled;
+ BOOL printerRedirectionDisabled;
+ BOOL portRedirectionDisabled;
+ BOOL reserved;
+ BOOL clipboardRedirectionDisabled;
+ BOOL pnpRedirectionDisabled;
+} TSG_REDIRECTION_FLAGS, *PTSG_REDIRECTION_FLAGS;
+
+typedef struct _TSG_PACKET_RESPONSE
+{
+ unsigned long flags;
+ unsigned long reserved;
+ byte* responseData;
+ unsigned long responseDataLen;
+ TSG_REDIRECTION_FLAGS redirectionFlags;
+} TSG_PACKET_RESPONSE, *PTSG_PACKET_RESPONSE;
+
+typedef struct _TSG_PACKET_QUARENC_RESPONSE
+{
+ unsigned long flags;
+ unsigned long certChainLen;
+ wchar_t* certChainData;
+ GUID nonce;
+ PTSG_PACKET_VERSIONCAPS versionCaps;
+} TSG_PACKET_QUARENC_RESPONSE, *PTSG_PACKET_QUARENC_RESPONSE;
+
+typedef struct TSG_PACKET_STRING_MESSAGE
+{
+ long isDisplayMandatory;
+ long isConsentMandatory;
+ unsigned long msgBytes;
+ wchar_t* msgBuffer;
+} TSG_PACKET_STRING_MESSAGE, *PTSG_PACKET_STRING_MESSAGE;
+
+typedef struct TSG_PACKET_REAUTH_MESSAGE
+{
+ unsigned __int64 tunnelContext;
+} TSG_PACKET_REAUTH_MESSAGE, *PTSG_PACKET_REAUTH_MESSAGE;
+
+typedef union
+{
+ PTSG_PACKET_STRING_MESSAGE consentMessage;
+ PTSG_PACKET_STRING_MESSAGE serviceMessage;
+ PTSG_PACKET_REAUTH_MESSAGE reauthMessage;
+} TSG_PACKET_TYPE_MESSAGE_UNION, *PTSG_PACKET_TYPE_MESSAGE_UNION;
+
+typedef struct _TSG_PACKET_MSG_RESPONSE
+{
+ unsigned long msgID;
+ unsigned long msgType;
+ long isMsgPresent;
+ TSG_PACKET_TYPE_MESSAGE_UNION messagePacket;
+} TSG_PACKET_MSG_RESPONSE, *PTSG_PACKET_MSG_RESPONSE;
+
+typedef struct TSG_PACKET_CAPS_RESPONSE
+{
+ TSG_PACKET_QUARENC_RESPONSE pktQuarEncResponse;
+ TSG_PACKET_MSG_RESPONSE pktConsentMessage;
+} TSG_PACKET_CAPS_RESPONSE, *PTSG_PACKET_CAPS_RESPONSE;
+
+typedef struct TSG_PACKET_MSG_REQUEST
+{
+ unsigned long maxMessagesPerBatch;
+} TSG_PACKET_MSG_REQUEST, *PTSG_PACKET_MSG_REQUEST;
+
+typedef struct _TSG_PACKET_AUTH
+{
+ TSG_PACKET_VERSIONCAPS tsgVersionCaps;
+ unsigned long cookieLen;
+ byte* cookie;
+} TSG_PACKET_AUTH, *PTSG_PACKET_AUTH;
+
+typedef union
+{
+ PTSG_PACKET_VERSIONCAPS packetVersionCaps;
+ PTSG_PACKET_AUTH packetAuth;
+} TSG_INITIAL_PACKET_TYPE_UNION, *PTSG_INITIAL_PACKET_TYPE_UNION;
+
+typedef struct TSG_PACKET_REAUTH
+{
+ unsigned __int64 tunnelContext;
+ unsigned long packetId;
+ TSG_INITIAL_PACKET_TYPE_UNION tsgInitialPacket;
+} TSG_PACKET_REAUTH, *PTSG_PACKET_REAUTH;
+
+typedef union
+{
+ PTSG_PACKET_HEADER packetHeader;
+ PTSG_PACKET_VERSIONCAPS packetVersionCaps;
+ PTSG_PACKET_QUARCONFIGREQUEST packetQuarConfigRequest;
+ PTSG_PACKET_QUARREQUEST packetQuarRequest;
+ PTSG_PACKET_RESPONSE packetResponse;
+ PTSG_PACKET_QUARENC_RESPONSE packetQuarEncResponse;
+ PTSG_PACKET_CAPS_RESPONSE packetCapsResponse;
+ PTSG_PACKET_MSG_REQUEST packetMsgRequest;
+ PTSG_PACKET_MSG_RESPONSE packetMsgResponse;
+ PTSG_PACKET_AUTH packetAuth;
+ PTSG_PACKET_REAUTH packetReauth;
+} TSG_PACKET_TYPE_UNION;
+
+typedef struct _TSG_PACKET
+{
+ unsigned long packetId;
+ TSG_PACKET_TYPE_UNION tsgPacket;
+} TSG_PACKET, *PTSG_PACKET;
+
+void Opnum0NotUsedOnWire(handle_t IDL_handle);
+
+HRESULT TsProxyCreateTunnel(PTSG_PACKET tsgPacket, PTSG_PACKET* tsgPacketResponse,
+ PTUNNEL_CONTEXT_HANDLE_SERIALIZE* tunnelContext, unsigned long* tunnelId);
+
+HRESULT TsProxyAuthorizeTunnel(PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnelContext,
+ PTSG_PACKET tsgPacket, PTSG_PACKET* tsgPacketResponse);
+
+HRESULT TsProxyMakeTunnelCall(PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnelContext,
+ unsigned long procId, PTSG_PACKET tsgPacket, PTSG_PACKET* tsgPacketResponse);
+
+HRESULT TsProxyCreateChannel(PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnelContext,
+ PTSENDPOINTINFO tsEndPointInfo, PCHANNEL_CONTEXT_HANDLE_SERIALIZE* channelContext, unsigned long* channelId);
+
+void Opnum5NotUsedOnWire(handle_t IDL_handle);
+
+HRESULT TsProxyCloseChannel(PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE* context);
+
+HRESULT TsProxyCloseTunnel(PTUNNEL_CONTEXT_HANDLE_SERIALIZE* context);
+
+DWORD TsProxySetupReceivePipe(handle_t IDL_handle, byte pRpcMessage[]);
+
+DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], uint32 count, uint32* lengths);
+
+boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port);
+
+int tsg_write(rdpTsg* tsg, uint8* data, uint32 length);
+int tsg_read(rdpTsg* tsg, uint8* data, uint32 length);
+
+rdpTsg* tsg_new(rdpTransport* transport);
+void tsg_free(rdpTsg* tsg);
+
+#ifdef WITH_DEBUG_TSG
+#define DEBUG_TSG(fmt, ...) DEBUG_CLASS(TSG, fmt, ## __VA_ARGS__)
+#else
+#define DEBUG_TSG(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
+#endif
+
+#endif /* FREERDP_CORE_TSG_H */