diff options
Diffstat (limited to 'include/freerdp')
174 files changed, 23989 insertions, 0 deletions
diff --git a/include/freerdp/addin.h b/include/freerdp/addin.h new file mode 100644 index 0000000..cec491a --- /dev/null +++ b/include/freerdp/addin.h @@ -0,0 +1,81 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Addin Loader + * + * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_COMMON_ADDIN_H +#define FREERDP_COMMON_ADDIN_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#define FREERDP_ADDIN_CLIENT 0x00000001 +#define FREERDP_ADDIN_SERVER 0x00000002 + +#define FREERDP_ADDIN_STATIC 0x00000010 +#define FREERDP_ADDIN_DYNAMIC 0x00000020 + +#define FREERDP_ADDIN_NAME 0x00000100 +#define FREERDP_ADDIN_SUBSYSTEM 0x00000200 +#define FREERDP_ADDIN_TYPE 0x00000400 + +#define FREERDP_ADDIN_CHANNEL_STATIC 0x00001000 +#define FREERDP_ADDIN_CHANNEL_DYNAMIC 0x00002000 +#define FREERDP_ADDIN_CHANNEL_DEVICE 0x00004000 +#define FREERDP_ADDIN_CHANNEL_ENTRYEX 0x00008000 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + DWORD dwFlags; + CHAR cName[16]; + CHAR cType[16]; + CHAR cSubsystem[16]; + } FREERDP_ADDIN; + + typedef PVIRTUALCHANNELENTRY (*FREERDP_LOAD_CHANNEL_ADDIN_ENTRY_FN)(LPCSTR pszName, + LPCSTR pszSubsystem, + LPCSTR pszType, + DWORD dwFlags); + + FREERDP_API LPSTR freerdp_get_library_install_path(void); + FREERDP_API LPSTR freerdp_get_dynamic_addin_install_path(void); + + FREERDP_API int freerdp_register_addin_provider(FREERDP_LOAD_CHANNEL_ADDIN_ENTRY_FN provider, + DWORD dwFlags); + FREERDP_API FREERDP_LOAD_CHANNEL_ADDIN_ENTRY_FN freerdp_get_current_addin_provider(void); + + FREERDP_API PVIRTUALCHANNELENTRY freerdp_load_dynamic_addin(LPCSTR pszFileName, LPCSTR pszPath, + LPCSTR pszEntryName); + FREERDP_API PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, + LPCSTR pszSubsystem, + LPCSTR pszType, + DWORD dwFlags); + FREERDP_API PVIRTUALCHANNELENTRY freerdp_load_channel_addin_entry(LPCSTR pszName, + LPCSTR pszSubsystem, + LPCSTR pszType, + DWORD dwFlags); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_COMMON_ADDIN_H */ diff --git a/include/freerdp/altsec.h b/include/freerdp/altsec.h new file mode 100644 index 0000000..348662c --- /dev/null +++ b/include/freerdp/altsec.h @@ -0,0 +1,210 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Alternate Secondary Drawing Orders Interface API + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_UPDATE_ALTSEC_H +#define FREERDP_UPDATE_ALTSEC_H + +#include <freerdp/types.h> + +#define DSDNG_STRETCH 0x00000001 +#define DSDNG_TILE 0x00000002 +#define DSDNG_PERPIXELALPHA 0x00000004 +#define DSDNG_TRANSPARENT 0x00000008 +#define DSDNG_MUSTFLIP 0x00000010 +#define DSDNG_TRUESIZE 0x00000020 + +#define FRAME_START 0x00000000 +#define FRAME_END 0x00000001 + +#define STREAM_BITMAP_END 0x01 +#define STREAM_BITMAP_COMPRESSED 0x02 +#define STREAM_BITMAP_V2 0x04 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + UINT32 sIndices; + UINT32 cIndices; + UINT16* indices; + } OFFSCREEN_DELETE_LIST; + + typedef struct + { + UINT32 id; + UINT32 cx; + UINT32 cy; + OFFSCREEN_DELETE_LIST deleteList; + } CREATE_OFFSCREEN_BITMAP_ORDER; + + typedef struct + { + UINT32 bitmapId; + } SWITCH_SURFACE_ORDER; + + typedef struct + { + UINT32 flFlags; + UINT32 ulLeftWidth; + UINT32 ulRightWidth; + UINT32 ulTopHeight; + UINT32 ulBottomHeight; + UINT32 crTransparent; + } NINE_GRID_BITMAP_INFO; + + typedef struct + { + UINT32 bitmapBpp; + UINT32 bitmapId; + UINT32 cx; + UINT32 cy; + NINE_GRID_BITMAP_INFO nineGridInfo; + } CREATE_NINE_GRID_BITMAP_ORDER; + + typedef struct + { + UINT32 action; + } FRAME_MARKER_ORDER; + + typedef struct + { + UINT32 bitmapFlags; + UINT32 bitmapBpp; + UINT32 bitmapType; + UINT32 bitmapWidth; + UINT32 bitmapHeight; + UINT32 bitmapSize; + UINT32 bitmapBlockSize; + BYTE* bitmapBlock; + } STREAM_BITMAP_FIRST_ORDER; + + typedef struct + { + UINT32 bitmapFlags; + UINT32 bitmapType; + UINT32 bitmapBlockSize; + BYTE* bitmapBlock; + } STREAM_BITMAP_NEXT_ORDER; + + typedef struct + { + UINT32 cbSize; + UINT32 cbTotalSize; + UINT32 cbTotalEmfSize; + BYTE* emfRecords; + } DRAW_GDIPLUS_FIRST_ORDER; + + typedef struct + { + UINT32 cbSize; + BYTE* emfRecords; + } DRAW_GDIPLUS_NEXT_ORDER; + + typedef struct + { + UINT32 cbSize; + UINT32 cbTotalSize; + UINT32 cbTotalEmfSize; + BYTE* emfRecords; + } DRAW_GDIPLUS_END_ORDER; + + typedef struct + { + UINT32 flags; + UINT32 cacheType; + UINT32 cacheIndex; + UINT32 cbSize; + UINT32 cbTotalSize; + BYTE* emfRecords; + } DRAW_GDIPLUS_CACHE_FIRST_ORDER; + + typedef struct + { + UINT32 flags; + UINT32 cacheType; + UINT32 cacheIndex; + UINT32 cbSize; + BYTE* emfRecords; + } DRAW_GDIPLUS_CACHE_NEXT_ORDER; + + typedef struct + { + UINT32 flags; + UINT32 cacheType; + UINT32 cacheIndex; + UINT32 cbSize; + UINT32 cbTotalSize; + BYTE* emfRecords; + } DRAW_GDIPLUS_CACHE_END_ORDER; + + typedef BOOL (*pCreateOffscreenBitmap)( + rdpContext* context, const CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap); + typedef BOOL (*pSwitchSurface)(rdpContext* context, const SWITCH_SURFACE_ORDER* switch_surface); + typedef BOOL (*pCreateNineGridBitmap)( + rdpContext* context, const CREATE_NINE_GRID_BITMAP_ORDER* create_nine_grid_bitmap); + typedef BOOL (*pFrameMarker)(rdpContext* context, const FRAME_MARKER_ORDER* frame_marker); + typedef BOOL (*pStreamBitmapFirst)(rdpContext* context, + const STREAM_BITMAP_FIRST_ORDER* stream_bitmap_first); + typedef BOOL (*pStreamBitmapNext)(rdpContext* context, + const STREAM_BITMAP_NEXT_ORDER* stream_bitmap_next); + typedef BOOL (*pDrawGdiPlusFirst)(rdpContext* context, + const DRAW_GDIPLUS_FIRST_ORDER* draw_gdiplus_first); + typedef BOOL (*pDrawGdiPlusNext)(rdpContext* context, + const DRAW_GDIPLUS_NEXT_ORDER* draw_gdiplus_next); + typedef BOOL (*pDrawGdiPlusEnd)(rdpContext* context, + const DRAW_GDIPLUS_END_ORDER* draw_gdiplus_end); + typedef BOOL (*pDrawGdiPlusCacheFirst)( + rdpContext* context, const DRAW_GDIPLUS_CACHE_FIRST_ORDER* draw_gdiplus_cache_first); + typedef BOOL (*pDrawGdiPlusCacheNext)( + rdpContext* context, const DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next); + typedef BOOL (*pDrawGdiPlusCacheEnd)( + rdpContext* context, const DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end); + typedef BOOL (*pDrawOrderInfo)(rdpContext* context, UINT8 orderType, const char* orderName); + + struct rdp_altsec_update + { + rdpContext* context; /* 0 */ + UINT32 paddingA[16 - 1]; /* 1 */ + + pCreateOffscreenBitmap CreateOffscreenBitmap; /* 16 */ + pSwitchSurface SwitchSurface; /* 17 */ + pCreateNineGridBitmap CreateNineGridBitmap; /* 18 */ + pFrameMarker FrameMarker; /* 19 */ + pStreamBitmapFirst StreamBitmapFirst; /* 20 */ + pStreamBitmapNext StreamBitmapNext; /* 21 */ + pDrawGdiPlusFirst DrawGdiPlusFirst; /* 22 */ + pDrawGdiPlusNext DrawGdiPlusNext; /* 23 */ + pDrawGdiPlusEnd DrawGdiPlusEnd; /* 24 */ + pDrawGdiPlusCacheFirst DrawGdiPlusCacheFirst; /* 25 */ + pDrawGdiPlusCacheNext DrawGdiPlusCacheNext; /* 26 */ + pDrawGdiPlusCacheEnd DrawGdiPlusCacheEnd; /* 27 */ + /* Statistics callback */ + pDrawOrderInfo DrawOrderInfo; /* 28 */ + UINT32 paddingB[32 - 29]; /* 29 */ + }; + typedef struct rdp_altsec_update rdpAltSecUpdate; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UPDATE_ALTSEC_H */ diff --git a/include/freerdp/api.h b/include/freerdp/api.h new file mode 100644 index 0000000..aa25555 --- /dev/null +++ b/include/freerdp/api.h @@ -0,0 +1,116 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Interface + * + * Copyright 2009-2011 Jay Sorg + * + * 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_API_H +#define FREERDP_API_H + +#include <winpr/winpr.h> +#include <winpr/wlog.h> +#include <winpr/platform.h> + +/* To silence missing prototype warnings for library entry points use this macro. + * It first declares the function as prototype and then again as function implementation + */ +#define FREERDP_ENTRY_POINT(fkt) \ + fkt; \ + fkt + +#ifdef _WIN32 +#define FREERDP_CC __cdecl +#else +#define FREERDP_CC +#endif + +#if defined _WIN32 || defined __CYGWIN__ +#ifdef FREERDP_EXPORTS +#ifdef __GNUC__ +#define FREERDP_API __attribute__((dllexport)) +#else +#define FREERDP_API __declspec(dllexport) +#endif +#else +#ifdef __GNUC__ +#define FREERDP_API __attribute__((dllimport)) +#else +#define FREERDP_API __declspec(dllimport) +#endif +#endif +#else +#if defined(__GNUC__) && (__GNUC__ >= 4) +#define FREERDP_API __attribute__((visibility("default"))) +#else +#define FREERDP_API +#endif +#endif + +#if defined(EXPORT_ALL_SYMBOLS) +#define FREERDP_LOCAL FREERDP_API +#else +#if defined _WIN32 || defined __CYGWIN__ +#define FREERDP_LOCAL +#else +#if defined(__GNUC__) && (__GNUC__ >= 4) +#define FREERDP_LOCAL __attribute__((visibility("hidden"))) +#else +#define FREERDP_LOCAL +#endif +#endif +#endif + +#define IFCALL(_cb, ...) \ + do \ + { \ + if (_cb != NULL) \ + _cb(__VA_ARGS__); \ + else \ + WLog_VRB("com.freerdp.api", "IFCALL(" #_cb ") == NULL"); \ + } while (0) +#define IFCALLRET(_cb, _ret, ...) \ + do \ + { \ + if (_cb != NULL) \ + _ret = _cb(__VA_ARGS__); \ + else \ + WLog_VRB("com.freerdp.api", "IFCALLRET(" #_cb ") == NULL"); \ + } while (0) + +#if 0 // defined(__GNUC__) +#define IFCALLRESULT(_default_return, _cb, ...) \ + ({ \ + (_cb != NULL) ? _cb(__VA_ARGS__) : ({ \ + WLog_VRB("com.freerdp.api", "IFCALLRESULT(" #_cb ") == NULL"); \ + (_default_return); \ + }); \ + }) +#else +#define IFCALLRESULT(_default_return, _cb, ...) \ + ((_cb != NULL) ? _cb(__VA_ARGS__) : (_default_return)) +#endif + +#if defined(__GNUC__) +#define ALIGN64 __attribute__((aligned(8))) +#else +#ifdef _WIN32 +#define ALIGN64 __declspec(align(8)) +#else +#define ALIGN64 +#endif +#endif + +#endif /* FREERDP_API */ diff --git a/include/freerdp/assistance.h b/include/freerdp/assistance.h new file mode 100644 index 0000000..f6e9aa9 --- /dev/null +++ b/include/freerdp/assistance.h @@ -0,0 +1,69 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Remote Assistance + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_REMOTE_ASSISTANCE_H +#define FREERDP_REMOTE_ASSISTANCE_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/settings.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_assistance_file rdpAssistanceFile; + + FREERDP_API BYTE* freerdp_assistance_hex_string_to_bin(const void* str, size_t* size); + FREERDP_API char* freerdp_assistance_bin_to_hex_string(const void* data, size_t size); + + FREERDP_API char* freerdp_assistance_generate_pass_stub(DWORD flags); + FREERDP_API char* freerdp_assistance_construct_expert_blob(const char* name, const char* pass); + FREERDP_API BYTE* freerdp_assistance_encrypt_pass_stub(const char* password, + const char* passStub, + size_t* pEncryptedSize); + + FREERDP_API int freerdp_assistance_set_connection_string2(rdpAssistanceFile* file, + const char* string, + const char* password); + + FREERDP_API int freerdp_assistance_parse_file_buffer(rdpAssistanceFile* file, + const char* buffer, size_t size, + const char* password); + FREERDP_API int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, + const char* password); + + FREERDP_API BOOL freerdp_assistance_populate_settings_from_assistance_file( + rdpAssistanceFile* file, rdpSettings* settings); + FREERDP_API BOOL freerdp_assistance_get_encrypted_pass_stub(rdpAssistanceFile* file, + const char** pwd, size_t* size); + + FREERDP_API void freerdp_assistance_file_free(rdpAssistanceFile* file); + + WINPR_ATTR_MALLOC(freerdp_assistance_file_free, 1) + FREERDP_API rdpAssistanceFile* freerdp_assistance_file_new(void); + + FREERDP_API void freerdp_assistance_print_file(rdpAssistanceFile* file, wLog* log, DWORD level); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_REMOTE_ASSISTANCE_H */ diff --git a/include/freerdp/autodetect.h b/include/freerdp/autodetect.h new file mode 100644 index 0000000..b855148 --- /dev/null +++ b/include/freerdp/autodetect.h @@ -0,0 +1,144 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Auto-Detect PDUs + * + * Copyright 2014 Dell Software <Mike.McDonald@software.dell.com> + * Copyright 2014 Vic Lee + * + * 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_AUTODETECT_H +#define FREERDP_AUTODETECT_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + FREERDP_AUTODETECT_STATE_INITIAL, + FREERDP_AUTODETECT_STATE_REQUEST, + FREERDP_AUTODETECT_STATE_RESPONSE, + FREERDP_AUTODETECT_STATE_COMPLETE, + FREERDP_AUTODETECT_STATE_FAIL + } FREERDP_AUTODETECT_STATE; + + typedef enum + { + RDP_NETCHAR_RESERVED = 0x0000U, + /* The baseRTT and averageRTT fields are valid */ + RDP_NETCHAR_RESULT_TYPE_BASE_RTT_AVG_RTT = 0x0840U, + /* The bandwidth and averageRTT fields are valid */ + RDP_NETCHAR_RESULT_TYPE_BW_AVG_RTT = 0x0880U, + /* The baseRTT, bandwidth and averageRTT fields are valid */ + RDP_NETCHAR_RESULT_TYPE_BASE_RTT_BW_AVG_RTT = 0x08C0U + } RDP_NETCHAR_RESULT_TYPE; + + typedef enum + { + RDP_BW_RESULTS_RESPONSE_TYPE_CONNECTTIME = 0x0003, + RDP_BW_RESULTS_RESPONSE_TYPE_CONTINUOUS = 0x000B + } RDP_BW_RESULTS_RESPONSE_TYPE; + + typedef struct rdp_autodetect rdpAutoDetect; + typedef struct rdp_network_characteristics_result rdpNetworkCharacteristicsResult; + + typedef BOOL (*pRTTMeasureRequest)(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport, + UINT16 sequenceNumber); + typedef BOOL (*pRTTMeasureResponse)(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport, + UINT16 sequenceNumber); + typedef BOOL (*pBandwidthMeasureStart)(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport, + UINT16 sequenceNumber); + typedef BOOL (*pBandwidthMeasurePayload)(rdpAutoDetect* autodetect, + RDP_TRANSPORT_TYPE transport, UINT16 sequenceNumber, + UINT16 payloadLength); + typedef BOOL (*pBandwidthMeasureStop)(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport, + UINT16 sequenceNumber, UINT16 payloadLength); + typedef BOOL (*pBandwidthMeasureResults)(rdpAutoDetect* autodetect, + RDP_TRANSPORT_TYPE transport, UINT16 sequenceNumber, + UINT16 responseType, UINT32 timeDelta, + UINT32 byteCount); + typedef BOOL (*pNetworkCharacteristicsResult)(rdpAutoDetect* autodetect, + RDP_TRANSPORT_TYPE transport, + UINT16 sequenceNumber, + const rdpNetworkCharacteristicsResult* result); + typedef BOOL (*pClientBandwidthMeasureResult)(rdpAutoDetect* autodetect, + RDP_TRANSPORT_TYPE transport, UINT16 responseType, + UINT16 sequenceNumber, UINT32 timeDelta, + UINT32 byteCount); + typedef BOOL (*pNetworkCharacteristicsSync)(rdpAutoDetect* autodetect, + RDP_TRANSPORT_TYPE transport, UINT16 sequenceNumber, + UINT32 bandwidth, UINT32 rtt); + typedef BOOL (*pRxTxReceived)(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport, + UINT16 requestType, UINT16 sequenceNumber); + typedef FREERDP_AUTODETECT_STATE (*pOnConnectTimeAutoDetect)(rdpAutoDetect* autodetect); + + struct rdp_network_characteristics_result + { + /* Specifies, which fields are valid */ + RDP_NETCHAR_RESULT_TYPE type; + + /* Lowest detected round-trip time in milliseconds. */ + UINT32 baseRTT; + /* Current average round-trip time in milliseconds. */ + UINT32 averageRTT; + /* Current bandwidth in kilobits per second. */ + UINT32 bandwidth; + }; + + struct rdp_autodetect + { + ALIGN64 rdpContext* context; /* 0 */ + /* RTT measurement */ + ALIGN64 UINT64 rttMeasureStartTime; /* 1 */ + /* Bandwidth measurement */ + ALIGN64 UINT64 bandwidthMeasureStartTime; /* 2 */ + ALIGN64 UINT64 bandwidthMeasureTimeDelta; /* 3 */ + ALIGN64 UINT32 bandwidthMeasureByteCount; /* 4 */ + /* Network characteristics (as reported by server) */ + ALIGN64 UINT32 netCharBandwidth; /* 5 */ + ALIGN64 UINT32 netCharBaseRTT; /* 6 */ + ALIGN64 UINT32 netCharAverageRTT; /* 7 */ + ALIGN64 BOOL bandwidthMeasureStarted; /* 8 */ + ALIGN64 FREERDP_AUTODETECT_STATE state; /* 9 */ + ALIGN64 void* custom; /* 10 */ + ALIGN64 wLog* log; /* 11 */ + UINT64 paddingA[16 - 12]; /* 12 */ + + ALIGN64 pRTTMeasureRequest RTTMeasureRequest; /* 16 */ + ALIGN64 pRTTMeasureResponse RTTMeasureResponse; /* 17 */ + ALIGN64 pBandwidthMeasureStart BandwidthMeasureStart; /* 18 */ + ALIGN64 pBandwidthMeasurePayload BandwidthMeasurePayload; /* 19 */ + ALIGN64 pBandwidthMeasureStop BandwidthMeasureStop; /* 20 */ + ALIGN64 pBandwidthMeasureResults BandwidthMeasureResults; /* 21 */ + ALIGN64 pNetworkCharacteristicsResult NetworkCharacteristicsResult; /* 22 */ + ALIGN64 pClientBandwidthMeasureResult ClientBandwidthMeasureResult; /* 23 */ + ALIGN64 pNetworkCharacteristicsSync NetworkCharacteristicsSync; /* 24 */ + ALIGN64 pRxTxReceived RequestReceived; /* 25 */ + ALIGN64 pRxTxReceived ResponseReceived; /* 26 */ + ALIGN64 pOnConnectTimeAutoDetect OnConnectTimeAutoDetectBegin; /* 27 */ + ALIGN64 pOnConnectTimeAutoDetect OnConnectTimeAutoDetectProgress; /* 28 */ + UINT64 paddingB[32 - 29]; /* 29 */ + }; + FREERDP_API rdpAutoDetect* autodetect_get(rdpContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_AUTODETECT_H */ diff --git a/include/freerdp/cache/persistent.h b/include/freerdp/cache/persistent.h new file mode 100644 index 0000000..a36595b --- /dev/null +++ b/include/freerdp/cache/persistent.h @@ -0,0 +1,100 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Persistent Bitmap Cache + * + * Copyright 2016 Marc-Andre Moreau <marcandre.moreau@gmail.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_PERSISTENT_CACHE_H +#define FREERDP_PERSISTENT_CACHE_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/update.h> + +#include <winpr/crt.h> +#include <winpr/stream.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_persistent_cache rdpPersistentCache; + +#pragma pack(push, 1) + +/* 12 bytes */ + + typedef struct + { + BYTE sig[8]; + UINT32 flags; /* 0x00000003, 0x00000006 */ + } PERSISTENT_CACHE_HEADER_V3; + +/* 12 bytes */ + + typedef struct + { + UINT64 key64; + UINT16 width; + UINT16 height; + } PERSISTENT_CACHE_ENTRY_V3; + +/* 20 bytes */ + + typedef struct + { + UINT64 key64; + UINT16 width; + UINT16 height; + UINT32 size; + UINT32 flags; /* 0x00000011 */ + } PERSISTENT_CACHE_ENTRY_V2; + +#pragma pack(pop) + + typedef struct + { + UINT64 key64; + UINT16 width; + UINT16 height; + UINT32 size; + UINT32 flags; + BYTE* data; + } PERSISTENT_CACHE_ENTRY; + + FREERDP_API int persistent_cache_get_version(rdpPersistentCache* persistent); + FREERDP_API int persistent_cache_get_count(rdpPersistentCache* persistent); + + FREERDP_API int persistent_cache_read_entry(rdpPersistentCache* persistent, + PERSISTENT_CACHE_ENTRY* entry); + FREERDP_API int persistent_cache_write_entry(rdpPersistentCache* persistent, + const PERSISTENT_CACHE_ENTRY* entry); + + FREERDP_API int persistent_cache_open(rdpPersistentCache* persistent, const char* filename, + BOOL write, UINT32 version); + FREERDP_API int persistent_cache_close(rdpPersistentCache* persistent); + + FREERDP_API void persistent_cache_free(rdpPersistentCache* persistent); + + WINPR_ATTR_MALLOC(persistent_cache_free, 1) + FREERDP_API rdpPersistentCache* persistent_cache_new(void); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_PERSISTENT_CACHE_H */ diff --git a/include/freerdp/channels/ainput.h b/include/freerdp/channels/ainput.h new file mode 100644 index 0000000..aea73bc --- /dev/null +++ b/include/freerdp/channels/ainput.h @@ -0,0 +1,70 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Audio Input Redirection Virtual Channel + * + * Copyright 2022 Armin Novak <anovak@thincast.com> + * Copyright 2022 Thincast Technologies GmbH + * + * 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_CHANNEL_AINPUT_H +#define FREERDP_CHANNEL_AINPUT_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define AINPUT_CHANNEL_NAME "ainput" +#define AINPUT_DVC_CHANNEL_NAME "FreeRDP::Advanced::Input" + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + MSG_AINPUT_VERSION = 0x01, + MSG_AINPUT_MOUSE = 0x02 + } eAInputMsgType; + + typedef enum + { + AINPUT_FLAGS_WHEEL = 0x0001, + AINPUT_FLAGS_MOVE = 0x0004, + AINPUT_FLAGS_DOWN = 0x0008, + + AINPUT_FLAGS_REL = 0x0010, + AINPUT_FLAGS_HAVE_REL = 0x0020, + + /* Pointer Flags */ + AINPUT_FLAGS_BUTTON1 = 0x1000, /* left */ + AINPUT_FLAGS_BUTTON2 = 0x2000, /* right */ + AINPUT_FLAGS_BUTTON3 = 0x4000, /* middle */ + + /* Extended Pointer Flags */ + AINPUT_XFLAGS_BUTTON1 = 0x0100, + AINPUT_XFLAGS_BUTTON2 = 0x0200 + } AInputEventFlags; + + typedef struct ainput_client_context AInputClientContext; + +#define AINPUT_VERSION_MAJOR 1 +#define AINPUT_VERSION_MINOR 0 + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_AINPUT_H */ diff --git a/include/freerdp/channels/audin.h b/include/freerdp/channels/audin.h new file mode 100644 index 0000000..17254e6 --- /dev/null +++ b/include/freerdp/channels/audin.h @@ -0,0 +1,124 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Audio Input Redirection Virtual Channel + * + * Copyright 2010-2011 Vic Lee + * Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_AUDIN_H +#define FREERDP_CHANNEL_AUDIN_H + +#include <freerdp/api.h> +#include <freerdp/codec/audio.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define AUDIN_CHANNEL_NAME "audin" +#define AUDIN_DVC_CHANNEL_NAME "AUDIO_INPUT" + +typedef struct +{ + BYTE MessageId; +} SNDIN_PDU; + +typedef enum +{ + SNDIN_VERSION_Version_1 = 0x00000001, + SNDIN_VERSION_Version_2 = 0x00000002, +} SNDIN_VERSION_Version; + +typedef struct +{ + SNDIN_PDU Header; + SNDIN_VERSION_Version Version; +} SNDIN_VERSION; + +typedef struct +{ + SNDIN_PDU Header; + UINT32 NumFormats; + UINT32 cbSizeFormatsPacket; + AUDIO_FORMAT* SoundFormats; + size_t ExtraDataSize; +} SNDIN_FORMATS; + +typedef enum +{ + SPEAKER_FRONT_LEFT = 0x00000001, + SPEAKER_FRONT_RIGHT = 0x00000002, + SPEAKER_FRONT_CENTER = 0x00000004, + SPEAKER_LOW_FREQUENCY = 0x00000008, + SPEAKER_BACK_LEFT = 0x00000010, + SPEAKER_BACK_RIGHT = 0x00000020, + SPEAKER_FRONT_LEFT_OF_CENTER = 0x00000040, + SPEAKER_FRONT_RIGHT_OF_CENTER = 0x00000080, + SPEAKER_BACK_CENTER = 0x00000100, + SPEAKER_SIDE_LEFT = 0x00000200, + SPEAKER_SIDE_RIGHT = 0x00000400, + SPEAKER_TOP_CENTER = 0x00000800, + SPEAKER_TOP_FRONT_LEFT = 0x00001000, + SPEAKER_TOP_FRONT_CENTER = 0x00002000, + SPEAKER_TOP_FRONT_RIGHT = 0x00004000, + SPEAKER_TOP_BACK_LEFT = 0x00008000, + SPEAKER_TOP_BACK_CENTER = 0x00010000, + SPEAKER_TOP_BACK_RIGHT = 0x00020000, +} AUDIN_SPEAKER; + +typedef struct +{ + union + { + UINT16 wValidBitsPerSample; + UINT16 wSamplesPerBlock; + UINT16 wReserved; + } Samples; + AUDIN_SPEAKER dwChannelMask; + GUID SubFormat; +} WAVEFORMAT_EXTENSIBLE; + +typedef struct +{ + SNDIN_PDU Header; + UINT32 FramesPerPacket; + UINT32 initialFormat; + AUDIO_FORMAT captureFormat; + WAVEFORMAT_EXTENSIBLE* ExtraFormatData; +} SNDIN_OPEN; + +typedef struct +{ + SNDIN_PDU Header; + UINT32 Result; +} SNDIN_OPEN_REPLY; + +typedef struct +{ + SNDIN_PDU Header; +} SNDIN_DATA_INCOMING; + +typedef struct +{ + SNDIN_PDU Header; + wStream* Data; +} SNDIN_DATA; + +typedef struct +{ + SNDIN_PDU Header; + UINT32 NewFormat; +} SNDIN_FORMATCHANGE; + +#endif /* FREERDP_CHANNEL_AUDIN_H */ diff --git a/include/freerdp/channels/channels.h b/include/freerdp/channels/channels.h new file mode 100644 index 0000000..df96819 --- /dev/null +++ b/include/freerdp/channels/channels.h @@ -0,0 +1,68 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Virtual Channel Manager + * + * Copyright 2009-2011 Jay Sorg + * Copyright 2010-2011 Vic Lee + * + * 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_CHANNELS_H +#define FREERDP_CHANNELS_H + +#include <winpr/crt.h> +#include <winpr/wtsapi.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/settings.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, + PVIRTUALCHANNELENTRY entry, void* data); + FREERDP_API int freerdp_channels_client_load_ex(rdpChannels* channels, rdpSettings* settings, + PVIRTUALCHANNELENTRYEX entryEx, void* data); + FREERDP_API int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, + const char* name, void* data); +#if defined(WITH_FREERDP_DEPRECATED) + FREERDP_API WINPR_DEPRECATED_VAR( + "Use freerdp_channels_get_event_handle", + BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds, + int* read_count, void** write_fds, int* write_count)); +#endif + FREERDP_API BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance); + + FREERDP_API void* freerdp_channels_get_static_channel_interface(rdpChannels* channels, + const char* name); + + FREERDP_API HANDLE freerdp_channels_get_event_handle(freerdp* instance); + FREERDP_API int freerdp_channels_process_pending_messages(freerdp* instance); + + FREERDP_API BOOL freerdp_channels_data(freerdp* instance, UINT16 channelId, const BYTE* data, + size_t dataSize, UINT32 flags, size_t totalSize); + + FREERDP_API UINT16 freerdp_channels_get_id_by_name(freerdp* instance, const char* channel_name); + FREERDP_API const char* freerdp_channels_get_name_by_id(freerdp* instance, UINT16 channelId); + + FREERDP_API const WtsApiFunctionTable* FreeRDP_InitWtsApi(void); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNELS_H */ diff --git a/include/freerdp/channels/cliprdr.h b/include/freerdp/channels/cliprdr.h new file mode 100644 index 0000000..297a977 --- /dev/null +++ b/include/freerdp/channels/cliprdr.h @@ -0,0 +1,208 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Clipboard Virtual Channel Extension + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.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_CHANNEL_CLIPRDR_H +#define FREERDP_CHANNEL_CLIPRDR_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/utils/cliprdr_utils.h> + +#include <winpr/shell.h> + +#define CLIPRDR_CHANNEL_NAME "cliprdr" +#define CLIPRDR_SVC_CHANNEL_NAME "cliprdr" + +/* CLIPRDR_HEADER.msgType */ +typedef enum +{ + CB_MONITOR_READY = 0x0001, + CB_FORMAT_LIST = 0x0002, + CB_FORMAT_LIST_RESPONSE = 0x0003, + CB_FORMAT_DATA_REQUEST = 0x0004, + CB_FORMAT_DATA_RESPONSE = 0x0005, + CB_TEMP_DIRECTORY = 0x0006, + CB_CLIP_CAPS = 0x0007, + CB_FILECONTENTS_REQUEST = 0x0008, + CB_FILECONTENTS_RESPONSE = 0x0009, + CB_LOCK_CLIPDATA = 0x000A, + CB_UNLOCK_CLIPDATA = 0x000B +} CliprdrMsgType; + +/* CLIPRDR_HEADER.msgFlags */ +#define CB_RESPONSE_OK 0x0001 +#define CB_RESPONSE_FAIL 0x0002 +#define CB_ASCII_NAMES 0x0004 + +/* CLIPRDR_CAPS_SET.capabilitySetType */ +#define CB_CAPSTYPE_GENERAL 0x0001 + +/* CLIPRDR_GENERAL_CAPABILITY.lengthCapability */ +#define CB_CAPSTYPE_GENERAL_LEN 12 + +/* CLIPRDR_GENERAL_CAPABILITY.version */ +#define CB_CAPS_VERSION_1 0x00000001 +#define CB_CAPS_VERSION_2 0x00000002 + +/* CLIPRDR_GENERAL_CAPABILITY.generalFlags */ +#define CB_USE_LONG_FORMAT_NAMES 0x00000002 +#define CB_STREAM_FILECLIP_ENABLED 0x00000004 +#define CB_FILECLIP_NO_FILE_PATHS 0x00000008 +#define CB_CAN_LOCK_CLIPDATA 0x00000010 +#define CB_HUGE_FILE_SUPPORT_ENABLED 0x00000020 + +/* File Contents Request Flags */ +#define FILECONTENTS_SIZE 0x00000001 +#define FILECONTENTS_RANGE 0x00000002 + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* Special Clipboard Response Formats */ + + typedef struct + { + UINT32 mappingMode; + UINT32 xExt; + UINT32 yExt; + UINT32 metaFileSize; + BYTE* metaFileData; + } CLIPRDR_MFPICT; + + /* Clipboard Messages */ + + typedef struct + { + UINT16 msgType; + UINT16 msgFlags; + UINT32 dataLen; + } CLIPRDR_HEADER; + + typedef struct + { + UINT16 capabilitySetType; + UINT16 capabilitySetLength; + } CLIPRDR_CAPABILITY_SET; + + typedef struct + { + UINT16 capabilitySetType; + UINT16 capabilitySetLength; + + UINT32 version; + UINT32 generalFlags; + } CLIPRDR_GENERAL_CAPABILITY_SET; + + typedef struct + { + CLIPRDR_HEADER common; + + UINT32 cCapabilitiesSets; + CLIPRDR_CAPABILITY_SET* capabilitySets; + } CLIPRDR_CAPABILITIES; + + typedef struct + { + CLIPRDR_HEADER common; + } CLIPRDR_MONITOR_READY; + + typedef struct + { + CLIPRDR_HEADER common; + + char szTempDir[520]; + } CLIPRDR_TEMP_DIRECTORY; + + typedef struct + { + UINT32 formatId; + char* formatName; + } CLIPRDR_FORMAT; + + typedef struct + { + CLIPRDR_HEADER common; + + UINT32 numFormats; + CLIPRDR_FORMAT* formats; + } CLIPRDR_FORMAT_LIST; + + typedef struct + { + CLIPRDR_HEADER common; + } CLIPRDR_FORMAT_LIST_RESPONSE; + + typedef struct + { + CLIPRDR_HEADER common; + + UINT32 clipDataId; + } CLIPRDR_LOCK_CLIPBOARD_DATA; + + typedef struct + { + CLIPRDR_HEADER common; + + UINT32 clipDataId; + } CLIPRDR_UNLOCK_CLIPBOARD_DATA; + + typedef struct + { + CLIPRDR_HEADER common; + + UINT32 requestedFormatId; + } CLIPRDR_FORMAT_DATA_REQUEST; + + typedef struct + { + CLIPRDR_HEADER common; + + const BYTE* requestedFormatData; + } CLIPRDR_FORMAT_DATA_RESPONSE; + + typedef struct + { + CLIPRDR_HEADER common; + + UINT32 streamId; + UINT32 listIndex; + UINT32 dwFlags; + UINT32 nPositionLow; + UINT32 nPositionHigh; + UINT32 cbRequested; + BOOL haveClipDataId; + UINT32 clipDataId; + } CLIPRDR_FILE_CONTENTS_REQUEST; + + typedef struct + { + CLIPRDR_HEADER common; + + UINT32 streamId; + UINT32 cbRequested; + const BYTE* requestedData; + } CLIPRDR_FILE_CONTENTS_RESPONSE; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_CLIPRDR_H */ diff --git a/include/freerdp/channels/disp.h b/include/freerdp/channels/disp.h new file mode 100644 index 0000000..8e08bf2 --- /dev/null +++ b/include/freerdp/channels/disp.h @@ -0,0 +1,89 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDPEDISP Virtual Channel Extension + * + * Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.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_CHANNEL_DISP_H +#define FREERDP_CHANNEL_DISP_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#define DISPLAY_CONTROL_PDU_TYPE_CAPS 0x00000005 +#define DISPLAY_CONTROL_PDU_TYPE_MONITOR_LAYOUT 0x00000002 +#define DISPLAY_CONTROL_MONITOR_LAYOUT_SIZE 40 + +#define DISP_CHANNEL_NAME "disp" + +#define DISP_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::DisplayControl" +#define ORIENTATION_LANDSCAPE 0 +#define ORIENTATION_PORTRAIT 90 +#define ORIENTATION_LANDSCAPE_FLIPPED 180 +#define ORIENTATION_PORTRAIT_FLIPPED 270 + +#define DISPLAY_CONTROL_MONITOR_PRIMARY 0x00000001 +#define DISPLAY_CONTROL_HEADER_LENGTH 0x00000008 + +#define DISPLAY_CONTROL_MIN_MONITOR_WIDTH 200 +#define DISPLAY_CONTROL_MAX_MONITOR_WIDTH 8192 + +#define DISPLAY_CONTROL_MIN_MONITOR_HEIGHT 200 +#define DISPLAY_CONTROL_MAX_MONITOR_HEIGHT 8192 + +#define DISPLAY_CONTROL_MIN_PHYSICAL_MONITOR_WIDTH 10 +#define DISPLAY_CONTROL_MAX_PHYSICAL_MONITOR_WIDTH 10000 + +#define DISPLAY_CONTROL_MIN_PHYSICAL_MONITOR_HEIGHT 10 +#define DISPLAY_CONTROL_MAX_PHYSICAL_MONITOR_HEIGHT 10000 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + UINT32 type; + UINT32 length; + } DISPLAY_CONTROL_HEADER; + + typedef struct + { + UINT32 Flags; + INT32 Left; + INT32 Top; + UINT32 Width; + UINT32 Height; + UINT32 PhysicalWidth; + UINT32 PhysicalHeight; + UINT32 Orientation; + UINT32 DesktopScaleFactor; + UINT32 DeviceScaleFactor; + } DISPLAY_CONTROL_MONITOR_LAYOUT; + + typedef struct + { + UINT32 MonitorLayoutSize; + UINT32 NumMonitors; + DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors; + } DISPLAY_CONTROL_MONITOR_LAYOUT_PDU; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_DISP_H */ diff --git a/include/freerdp/channels/drdynvc.h b/include/freerdp/channels/drdynvc.h new file mode 100644 index 0000000..5afc3b2 --- /dev/null +++ b/include/freerdp/channels/drdynvc.h @@ -0,0 +1,68 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Dynamic Virtual Channel Virtual Channel + * + * Copyright 2021 Armin Novak <anovak@thincast.com> + * Copyright 2021 Thincast Technologies GmbH + * + * 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_CHANNEL_DRDYNVC_H +#define FREERDP_CHANNEL_DRDYNVC_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define DRDYNVC_CHANNEL_NAME "drdynvc" +#define DRDYNVC_SVC_CHANNEL_NAME "drdynvc" + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* defined in MS-RDPEDYC 2.2.5.1 Soft-Sync Request PDU (DYNVC_SOFT_SYNC_REQUEST) */ + enum + { + SOFT_SYNC_TCP_FLUSHED = 0x01, + SOFT_SYNC_CHANNEL_LIST_PRESENT = 0x02 + }; + + /* define in MS-RDPEDYC 2.2.5.1.1 Soft-Sync Channel List (DYNVC_SOFT_SYNC_CHANNEL_LIST) */ + enum + { + TUNNELTYPE_UDPFECR = 0x00000001, + TUNNELTYPE_UDPFECL = 0x00000003 + }; + + /* @brief dynamic channel commands */ + typedef enum + { + CREATE_REQUEST_PDU = 0x01, + DATA_FIRST_PDU = 0x02, + DATA_PDU = 0x03, + CLOSE_REQUEST_PDU = 0x04, + CAPABILITY_REQUEST_PDU = 0x05, + DATA_FIRST_COMPRESSED_PDU = 0x06, + DATA_COMPRESSED_PDU = 0x07, + SOFT_SYNC_REQUEST_PDU = 0x08, + SOFT_SYNC_RESPONSE_PDU = 0x09 + } DynamicChannelPDU; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_DRDYNVC_H */ diff --git a/include/freerdp/channels/echo.h b/include/freerdp/channels/echo.h new file mode 100644 index 0000000..263de65 --- /dev/null +++ b/include/freerdp/channels/echo.h @@ -0,0 +1,38 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Audio Input Redirection Virtual Channel + * + * Copyright 2020 Armin Novak <anovak@thincast.com> + * Copyright 2020 Thincast Technologies GmbH + * + * 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_CHANNEL_ECHO_H +#define FREERDP_CHANNEL_ECHO_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define ECHO_CHANNEL_NAME "echo" +#define ECHO_DVC_CHANNEL_NAME "ECHO" + +#ifdef __cplusplus +extern "C" +{ +#endif +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_CHANNEL_ECHO_H */ diff --git a/include/freerdp/channels/encomsp.h b/include/freerdp/channels/encomsp.h new file mode 100644 index 0000000..7fde773 --- /dev/null +++ b/include/freerdp/channels/encomsp.h @@ -0,0 +1,182 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Multiparty Virtual Channel + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_CHANNEL_ENCOMSP_H +#define FREERDP_CHANNEL_ENCOMSP_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define ENCOMSP_CHANNEL_NAME "encomsp" +#define ENCOMSP_SVC_CHANNEL_NAME "encomsp" + +typedef struct +{ + UINT16 cchString; + WCHAR wString[1024]; +} ENCOMSP_UNICODE_STRING; + +/* Filter Updated PDU Flags */ + +#define ENCOMSP_FILTER_ENABLED 0x0001 + +/* Application Created PDU Flags */ + +#define ENCOMSP_APPLICATION_SHARED 0x0001 + +/* Window Created PDU Flags */ + +#define ENCOMSP_WINDOW_SHARED 0x0001 + +/* Participant Created PDU Flags */ + +#define ENCOMSP_MAY_VIEW 0x0001 +#define ENCOMSP_MAY_INTERACT 0x0002 +#define ENCOMSP_IS_PARTICIPANT 0x0004 + +/* Participant Removed PDU Disconnection Types */ + +#define ENCOMSP_PARTICIPANT_DISCONNECTION_REASON_APP 0x00000000 +#define ENCOMSP_PARTICIPANT_DISCONNECTION_REASON_CLI 0x00000002 + +/* Change Participant Control Level PDU Flags */ + +#define ENCOMSP_REQUEST_VIEW 0x0001 +#define ENCOMSP_REQUEST_INTERACT 0x0002 +#define ENCOMSP_ALLOW_CONTROL_REQUESTS 0x0008 + +/* PDU Order Types */ + +#define ODTYPE_FILTER_STATE_UPDATED 0x0001 +#define ODTYPE_APP_REMOVED 0x0002 +#define ODTYPE_APP_CREATED 0x0003 +#define ODTYPE_WND_REMOVED 0x0004 +#define ODTYPE_WND_CREATED 0x0005 +#define ODTYPE_WND_SHOW 0x0006 +#define ODTYPE_PARTICIPANT_REMOVED 0x0007 +#define ODTYPE_PARTICIPANT_CREATED 0x0008 +#define ODTYPE_PARTICIPANT_CTRL_CHANGED 0x0009 +#define ODTYPE_GRAPHICS_STREAM_PAUSED 0x000A +#define ODTYPE_GRAPHICS_STREAM_RESUMED 0x000B + +#define DEFINE_ENCOMSP_HEADER_COMMON() \ + UINT16 Type; \ + UINT16 Length + +#define ENCOMSP_ORDER_HEADER_SIZE 4 + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); +} ENCOMSP_ORDER_HEADER; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); + + BYTE Flags; +} ENCOMSP_FILTER_UPDATED_PDU; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); + + UINT16 Flags; + UINT32 AppId; + ENCOMSP_UNICODE_STRING Name; +} ENCOMSP_APPLICATION_CREATED_PDU; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); + + UINT32 AppId; +} ENCOMSP_APPLICATION_REMOVED_PDU; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); + + UINT16 Flags; + UINT32 AppId; + UINT32 WndId; + ENCOMSP_UNICODE_STRING Name; +} ENCOMSP_WINDOW_CREATED_PDU; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); + + UINT32 WndId; +} ENCOMSP_WINDOW_REMOVED_PDU; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); + + UINT32 WndId; +} ENCOMSP_SHOW_WINDOW_PDU; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); + + UINT32 ParticipantId; + UINT32 GroupId; + UINT16 Flags; + ENCOMSP_UNICODE_STRING FriendlyName; +} ENCOMSP_PARTICIPANT_CREATED_PDU; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); + + UINT32 ParticipantId; + UINT32 DiscType; + UINT32 DiscCode; +} ENCOMSP_PARTICIPANT_REMOVED_PDU; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); + + UINT16 Flags; + UINT32 ParticipantId; +} ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); +} ENCOMSP_GRAPHICS_STREAM_PAUSED_PDU; + +typedef struct +{ + DEFINE_ENCOMSP_HEADER_COMMON(); +} ENCOMSP_GRAPHICS_STREAM_RESUMED_PDU; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_ENCOMSP_H */ diff --git a/include/freerdp/channels/geometry.h b/include/freerdp/channels/geometry.h new file mode 100644 index 0000000..1b00f0f --- /dev/null +++ b/include/freerdp/channels/geometry.h @@ -0,0 +1,69 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Geometry tracking Virtual Channel Extension + * + * Copyright 2017 David Fort <contact@hardening-consulting.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_CHANNEL_GEOMETRY_H +#define FREERDP_CHANNEL_GEOMETRY_H + +#include <winpr/wtypes.h> +#include <freerdp/types.h> + +#define GEOMETRY_CHANNEL_NAME "geometry" +#define GEOMETRY_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Geometry::v08.01" + +#ifdef __cplusplus +extern "C" +{ +#endif + + enum + { + GEOMETRY_UPDATE = 1, + GEOMETRY_CLEAR = 2 + }; + + enum + { + RDH_RECTANGLE = 1 + }; + + typedef struct + { + RDP_RECT boundingRect; + UINT32 nRectCount; + RDP_RECT* rects; + } FREERDP_RGNDATA; + + typedef struct + { + UINT32 version; + UINT64 mappingId; + UINT32 updateType; + UINT64 topLevelId; + INT32 left, top, right, bottom; + INT32 topLevelLeft, topLevelTop, topLevelRight, topLevelBottom; + UINT32 geometryType; + + FREERDP_RGNDATA geometry; + } MAPPED_GEOMETRY_PACKET; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_GEOMETRY_H */ diff --git a/include/freerdp/channels/gfxredir.h b/include/freerdp/channels/gfxredir.h new file mode 100644 index 0000000..b21bcc8 --- /dev/null +++ b/include/freerdp/channels/gfxredir.h @@ -0,0 +1,165 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDPXXXX Remote App Graphics Redirection Virtual Channel Extension + * + * Copyright 2020 Hideyuki Nagase <hideyukn@microsoft.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_CHANNEL_GFXREDIR_H +#define FREERDP_CHANNEL_GFXREDIR_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define GFXREDIR_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::RemoteAppGraphicsRedirection" + +/* GFXREDIR_LEGACY_CAPS_PDU.version */ +#define GFXREDIR_CHANNEL_VERSION_LEGACY 1 + +#define GFXREDIR_CHANNEL_VERSION_MAJOR 2 +#define GFXREDIR_CHANNEL_VERSION_MINOR 0 + +/* GFXREDIR_CAPS_VERSION1 */ +#define GFXREDIR_CMDID_LEGACY_CAPS 0x00000001 +#define GFXREDIR_CMDID_ERROR 0x00000006 +#define GFXREDIR_CMDID_CAPS_ADVERTISE 0x00000008 +#define GFXREDIR_CMDID_CAPS_CONFIRM 0x00000009 +/* GFXREDIR_CAPS_VERSION2_0 */ +#define GFXREDIR_CMDID_OPEN_POOL 0x0000000a +#define GFXREDIR_CMDID_CLOSE_POOL 0x0000000b +#define GFXREDIR_CMDID_CREATE_BUFFER 0x0000000c +#define GFXREDIR_CMDID_DESTROY_BUFFER 0x0000000d +#define GFXREDIR_CMDID_PRESENT_BUFFER 0x0000000e +#define GFXREDIR_CMDID_PRESENT_BUFFER_ACK 0x0000000f + +/* GFXREDIR_HEADER */ +#define GFXREDIR_HEADER_SIZE 8 + +/* GFXREDIR_CAPS_HEADER */ +#define GFXREDIR_CAPS_HEADER_SIZE 12 +/* GFXREDIR_CAPS_HEADER.signature */ +#define GFXREDIR_CAPS_SIGNATURE 0x53504143 /* = 'SPAC' */ +/* GFXREDIR_CAPS_HEADER.version */ +#define GFXREDIR_CAPS_VERSION1 0x1 +#define GFXREDIR_CAPS_VERSION2_0 0x2000 + +/* GFXREDIR_CREATE_BUFFER_PDU.format */ +#define GFXREDIR_BUFFER_PIXEL_FORMAT_XRGB_8888 1 +#define GFXREDIR_BUFFER_PIXEL_FORMAT_ARGB_8888 2 + +/* GFXREDIR_PRESENT_BUFFER_PDU.numOpaqueRects */ +#define GFXREDIR_MAX_OPAQUE_RECTS 0x10 + +typedef struct +{ + UINT32 cmdId; + UINT32 length; +} GFXREDIR_HEADER; + +typedef struct +{ + UINT16 version; // GFXREDIR_CHANNEL_VERSION_LEGACY +} GFXREDIR_LEGACY_CAPS_PDU; + +typedef struct +{ + UINT32 signature; // GFXREDIR_CAPS_SIGNATURE + UINT32 version; // GFXREDIR_CAPS_VERSION + UINT32 length; // GFXREDIR_CAPS_HEADER_SIZE + size of capsData +} GFXREDIR_CAPS_HEADER; + +typedef struct +{ + GFXREDIR_CAPS_HEADER header; + UINT32 supportedFeatures; /* Reserved for future extensions */ +} GFXREDIR_CAPS_V2_0_PDU; + +typedef struct +{ + UINT32 errorCode; +} GFXREDIR_ERROR_PDU; + +typedef struct +{ + UINT32 length; // length of caps; + const BYTE* caps; // points variable length array of GFXREDIR_CAPS_HEADER. +} GFXREDIR_CAPS_ADVERTISE_PDU; + +typedef struct +{ + UINT32 version; // confirmed version, must be one of advertised by client. + UINT32 length; // GFXREDIR_CAPS_HEADER_SIZE + size of capsData. + const BYTE* capsData; // confirmed capsData from selected GFXREDIR_CAPS_HEADER.capsData. +} GFXREDIR_CAPS_CONFIRM_PDU; + +typedef struct +{ + UINT64 poolId; + UINT64 poolSize; + UINT32 sectionNameLength; // number of charactor, must include null terminated char. + const unsigned short* sectionName; // Windows-style 2 bytes wchar_t with null-terminated. +} GFXREDIR_OPEN_POOL_PDU; + +typedef struct +{ + UINT64 poolId; +} GFXREDIR_CLOSE_POOL_PDU; + +typedef struct +{ + UINT64 poolId; + UINT64 bufferId; + UINT64 offset; + UINT32 stride; + UINT32 width; + UINT32 height; + UINT32 format; // GFXREDIR_BUFFER_PIXEL_FORMAT_ +} GFXREDIR_CREATE_BUFFER_PDU; + +typedef struct +{ + UINT64 bufferId; +} GFXREDIR_DESTROY_BUFFER_PDU; + +typedef struct +{ + UINT64 timestamp; + UINT64 presentId; + UINT64 windowId; + UINT64 bufferId; + UINT32 orientation; // 0, 90, 180 or 270. + UINT32 targetWidth; + UINT32 targetHeight; + RECTANGLE_32 dirtyRect; + UINT32 numOpaqueRects; + RECTANGLE_32* opaqueRects; +} GFXREDIR_PRESENT_BUFFER_PDU; + +typedef struct +{ + UINT64 windowId; + UINT64 presentId; +} GFXREDIR_PRESENT_BUFFER_ACK_PDU; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_GFXREDIR_H */ diff --git a/include/freerdp/channels/location.h b/include/freerdp/channels/location.h new file mode 100644 index 0000000..5b91ea4 --- /dev/null +++ b/include/freerdp/channels/location.h @@ -0,0 +1,114 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Location Virtual Channel Extension + * + * Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_LOCATION_H +#define FREERDP_CHANNEL_LOCATION_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define LOCATION_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Location" + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + PDUTYPE_LOC_RESERVED = 0x0000, + PDUTYPE_SERVER_READY = 0x0001, + PDUTYPE_CLIENT_READY = 0x0002, + PDUTYPE_BASE_LOCATION3D = 0x0003, + PDUTYPE_LOCATION2D_DELTA = 0x0004, + PDUTYPE_LOCATION3D_DELTA = 0x0005, + } LOCATION_PDUTYPE; + +#define LOCATION_HEADER_SIZE 6 + + typedef struct + { + LOCATION_PDUTYPE pduType; + UINT32 pduLength; + } RDPLOCATION_HEADER; + + typedef enum + { + RDPLOCATION_PROTOCOL_VERSION_100 = 0x00010000, + RDPLOCATION_PROTOCOL_VERSION_200 = 0x00020000, + } RDPLOCATION_PROTOCOL_VERSION; + + typedef struct + { + RDPLOCATION_HEADER header; + RDPLOCATION_PROTOCOL_VERSION protocolVersion; + UINT32 flags; + } RDPLOCATION_SERVER_READY_PDU; + + typedef struct + { + RDPLOCATION_HEADER header; + RDPLOCATION_PROTOCOL_VERSION protocolVersion; + UINT32 flags; + } RDPLOCATION_CLIENT_READY_PDU; + + typedef enum + { + LOCATIONSOURCE_IP = 0x00, + LOCATIONSOURCE_WIFI = 0x01, + LOCATIONSOURCE_CELL = 0x02, + LOCATIONSOURCE_GNSS = 0x03, + } LOCATIONSOURCE; + + typedef struct + { + RDPLOCATION_HEADER header; + double latitude; + double longitude; + INT32 altitude; + double* speed; + double* heading; + double* horizontalAccuracy; + LOCATIONSOURCE* source; + } RDPLOCATION_BASE_LOCATION3D_PDU; + + typedef struct + { + RDPLOCATION_HEADER header; + double latitudeDelta; + double longitudeDelta; + double* speedDelta; + double* headingDelta; + } RDPLOCATION_LOCATION2D_DELTA_PDU; + + typedef struct + { + RDPLOCATION_HEADER header; + double latitudeDelta; + double longitudeDelta; + INT32 altitudeDelta; + double* speedDelta; + double* headingDelta; + } RDPLOCATION_LOCATION3D_DELTA_PDU; + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_CHANNEL_LOCATION_H */ diff --git a/include/freerdp/channels/log.h b/include/freerdp/channels/log.h new file mode 100644 index 0000000..36934e6 --- /dev/null +++ b/include/freerdp/channels/log.h @@ -0,0 +1,35 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Channel log defines + * + * Copyright 2014 Armin Novak <armin.novak@gmail.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_CHANNELS_LOG_H +#define FREERDP_CHANNELS_LOG_H + +#include <winpr/wlog.h> +#include <freerdp/log.h> + +#define CHANNELS_TAG(tag) FREERDP_TAG("channels.") tag + +#ifdef __cplusplus +extern "C" +{ +#endif +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_UTILS_DEBUG_H */ diff --git a/include/freerdp/channels/rail.h b/include/freerdp/channels/rail.h new file mode 100644 index 0000000..b8d6b46 --- /dev/null +++ b/include/freerdp/channels/rail.h @@ -0,0 +1,26 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Remote Applications Integrated Locally (RAIL) + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.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_CHANNEL_RAIL_H +#define FREERDP_CHANNEL_RAIL_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#endif /* FREERDP_CHANNEL_RAIL_H */ diff --git a/include/freerdp/channels/rdp2tcp.h b/include/freerdp/channels/rdp2tcp.h new file mode 100644 index 0000000..24375e5 --- /dev/null +++ b/include/freerdp/channels/rdp2tcp.h @@ -0,0 +1,38 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * TCP redirection Virtual Channel + * + * Copyright 2021 Armin Novak <anovak@thincast.com> + * Copyright 2021 Thincast Technologies GmbH + * + * 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_CHANNEL_RDP2TCP_H +#define FREERDP_CHANNEL_RDP2TCP_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define RDP2TCP_DVC_CHANNEL_NAME "rdp2tcp" + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_CHANNEL_RDP2TCP_H */ diff --git a/include/freerdp/channels/rdpdr.h b/include/freerdp/channels/rdpdr.h new file mode 100644 index 0000000..6315ab7 --- /dev/null +++ b/include/freerdp/channels/rdpdr.h @@ -0,0 +1,392 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel + * + * Copyright 2010-2011 Vic Lee + * Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_RDPDR_H +#define FREERDP_CHANNEL_RDPDR_H + +#include <winpr/nt.h> +#include <winpr/io.h> +#include <winpr/crt.h> +#include <winpr/file.h> +#include <winpr/synch.h> +#include <winpr/thread.h> +#include <winpr/stream.h> +#include <winpr/interlocked.h> +#include <winpr/collections.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/settings.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define RDPDR_CHANNEL_NAME "rdpdr" +#define RDPDR_SVC_CHANNEL_NAME "rdpdr" + +#define RDPDR_DEVICE_IO_REQUEST_LENGTH 24 +#define RDPDR_DEVICE_IO_RESPONSE_LENGTH 16 + +#define RDPDR_DEVICE_IO_CONTROL_REQ_HDR_LENGTH 32 +#define RDPDR_DEVICE_IO_CONTROL_RSP_HDR_LENGTH 4 + +#define RDPDR_VERSION_MAJOR 0x0001 + +#define RDPDR_VERSION_MINOR_RDP50 0x0002 +#define RDPDR_VERSION_MINOR_RDP51 0x0005 +#define RDPDR_VERSION_MINOR_RDP52 0x000A +#define RDPDR_VERSION_MINOR_RDP6X 0x000C +#define RDPDR_VERSION_MINOR_RDP10X 0x000D + +/* RDPDR_HEADER.Component */ +enum RDPDR_CTYP +{ + RDPDR_CTYP_CORE = 0x4472, + RDPDR_CTYP_PRN = 0x5052 +}; + +/* RDPDR_HEADER.PacketId */ +enum RDPDR_PAKID +{ + PAKID_CORE_SERVER_ANNOUNCE = 0x496E, + PAKID_CORE_CLIENTID_CONFIRM = 0x4343, + PAKID_CORE_CLIENT_NAME = 0x434E, + PAKID_CORE_DEVICELIST_ANNOUNCE = 0x4441, + PAKID_CORE_DEVICE_REPLY = 0x6472, + PAKID_CORE_DEVICE_IOREQUEST = 0x4952, + PAKID_CORE_DEVICE_IOCOMPLETION = 0x4943, + PAKID_CORE_SERVER_CAPABILITY = 0x5350, + PAKID_CORE_CLIENT_CAPABILITY = 0x4350, + PAKID_CORE_DEVICELIST_REMOVE = 0x444D, + PAKID_CORE_USER_LOGGEDON = 0x554C, + PAKID_PRN_CACHE_DATA = 0x5043, + PAKID_PRN_USING_XPS = 0x5543 +}; + +/* CAPABILITY_HEADER.CapabilityType */ +enum RDPDR_CAP_TYPE +{ + CAP_GENERAL_TYPE = 0x0001, + CAP_PRINTER_TYPE = 0x0002, + CAP_PORT_TYPE = 0x0003, + CAP_DRIVE_TYPE = 0x0004, + CAP_SMARTCARD_TYPE = 0x0005 +}; + +/* CAPABILITY_HEADER.Version */ +enum RDPDR_CAP_VERSION +{ + GENERAL_CAPABILITY_VERSION_01 = 0x00000001, + GENERAL_CAPABILITY_VERSION_02 = 0x00000002, + PRINT_CAPABILITY_VERSION_01 = 0x00000001, + PORT_CAPABILITY_VERSION_01 = 0x00000001, + DRIVE_CAPABILITY_VERSION_01 = 0x00000001, + DRIVE_CAPABILITY_VERSION_02 = 0x00000002, + SMARTCARD_CAPABILITY_VERSION_01 = 0x00000001 +}; + +/* DR_DEVICE_IOREQUEST.MajorFunction */ +enum IRP_MJ +{ + IRP_MJ_CREATE = 0x00000000, + IRP_MJ_CLOSE = 0x00000002, + IRP_MJ_READ = 0x00000003, + IRP_MJ_WRITE = 0x00000004, + IRP_MJ_DEVICE_CONTROL = 0x0000000E, + IRP_MJ_QUERY_VOLUME_INFORMATION = 0x0000000A, + IRP_MJ_SET_VOLUME_INFORMATION = 0x0000000B, + IRP_MJ_QUERY_INFORMATION = 0x00000005, + IRP_MJ_SET_INFORMATION = 0x00000006, + IRP_MJ_DIRECTORY_CONTROL = 0x0000000C, + IRP_MJ_LOCK_CONTROL = 0x00000011 +}; + +/* DR_DEVICE_IOREQUEST.MinorFunction */ +enum IRP_MN +{ + IRP_MN_QUERY_DIRECTORY = 0x00000001, + IRP_MN_NOTIFY_CHANGE_DIRECTORY = 0x00000002 +}; + +/* DR_CREATE_REQ.CreateDisposition */ + +/* DR_CREATE_REQ.CreateOptions [MS-SMB2] */ + +/* DR_CREATE_REQ.DesiredAccess [MS-SMB2] */ + +/* DR_CREATE_RSP.Information */ +/* DR_DRIVE_CREATE_RSP.DeviceCreateResponse */ + + +/* DR_CORE_CLIENT_ANNOUNCE_RSP.VersionMinor */ +#define RDPDR_MAJOR_RDP_VERSION 1 +enum RDPDR_MINOR_RDP_VERSION +{ + RDPDR_MINOR_RDP_VERSION_5_0 = 0x0002, + RDPDR_MINOR_RDP_VERSION_5_1 = 0x0005, + RDPDR_MINOR_RDP_VERSION_5_2 = 0x000A, + RDPDR_MINOR_RDP_VERSION_6_X = 0x000C, + RDPDR_MINOR_RDP_VERSION_13 = 0x000D +}; + +/* DR_CORE_CLIENT_NAME_REQ.UnicodeFlag */ +enum RDPDR_CLIENT_NAME_FLAG +{ + RDPDR_CLIENT_NAME_UNICODE = 0x00000001, + RDPDR_CLIENT_NAME_ASCII = 0x00000000 +}; + +/* GENERAL_CAPS_SET.ioCode1 */ +enum RDPDR_CAPS_IRP_MJ +{ + RDPDR_IRP_MJ_CREATE = 0x00000001, + RDPDR_IRP_MJ_CLEANUP = 0x00000002, + RDPDR_IRP_MJ_CLOSE = 0x00000004, + RDPDR_IRP_MJ_READ = 0x00000008, + RDPDR_IRP_MJ_WRITE = 0x00000010, + RDPDR_IRP_MJ_FLUSH_BUFFERS = 0x00000020, + RDPDR_IRP_MJ_SHUTDOWN = 0x00000040, + RDPDR_IRP_MJ_DEVICE_CONTROL = 0x00000080, + RDPDR_IRP_MJ_QUERY_VOLUME_INFORMATION = 0x00000100, + RDPDR_IRP_MJ_SET_VOLUME_INFORMATION = 0x00000200, + RDPDR_IRP_MJ_QUERY_INFORMATION = 0x00000400, + RDPDR_IRP_MJ_SET_INFORMATION = 0x00000800, + RDPDR_IRP_MJ_DIRECTORY_CONTROL = 0x00001000, + RDPDR_IRP_MJ_LOCK_CONTROL = 0x00002000, + RDPDR_IRP_MJ_QUERY_SECURITY = 0x00004000, + RDPDR_IRP_MJ_SET_SECURITY = 0x00008000 +}; + +/* GENERAL_CAPS_SET.extendedPDU */ +enum RDPDR_CAPS_PDU +{ + RDPDR_DEVICE_REMOVE_PDUS = 0x00000001, + RDPDR_CLIENT_DISPLAY_NAME_PDU = 0x00000002, + RDPDR_USER_LOGGEDON_PDU = 0x00000004 +}; + +/* GENERAL_CAPS_SET.extraFlags1 */ +enum RDPDR_CAPS_FLAG +{ + ENABLE_ASYNCIO = 0x00000001 +}; + +/* DR_DRIVE_LOCK_REQ.Operation */ +enum RDP_LOWIO_OP +{ + RDP_LOWIO_OP_SHAREDLOCK = 0x00000002, + RDP_LOWIO_OP_EXCLUSIVELOCK = 0x00000003, + RDP_LOWIO_OP_UNLOCK = 0x00000004, + RDP_LOWIO_OP_UNLOCK_MULTIPLE = 0x00000005 +}; + +enum RDPDR_PRINTER_ANNOUNCE_FLAG +{ + RDPDR_PRINTER_ANNOUNCE_FLAG_ASCII = 0x00000001, + RDPDR_PRINTER_ANNOUNCE_FLAG_DEFAULTPRINTER = 0x00000002, + RDPDR_PRINTER_ANNOUNCE_FLAG_NETWORKPRINTER = 0x00000004, + RDPDR_PRINTER_ANNOUNCE_FLAG_TSPRINTER = 0x00000008, + RDPDR_PRINTER_ANNOUNCE_FLAG_XPSFORMAT = 0x00000010 +}; + +/* [MS-FSCC] FileAttributes */ + +/* Included with winpr/file.h */ + +/* [MS-FSCC] FSCTL Structures */ + +#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600)) +#define FSCTL_LMR_SET_LINK_TRACKING_INFORMATION 0x1400ec +#define FSCTL_PIPE_PEEK 0x11400c +#define FSCTL_PIPE_TRANSCEIVE 0x11c017 +#define FSCTL_PIPE_WAIT 0x110018 +#define FSCTL_QUERY_ON_DISK_VOLUME_INFO 0x9013c +#define FSCTL_QUERY_SPARING_INFO 0x90138 +#endif + +#ifndef _WIN32 +#define FSCTL_CREATE_OR_GET_OBJECT_ID 0x900c0 +#define FSCTL_GET_REPARSE_POINT 0x900a8 +#define FSCTL_GET_RETRIEVAL_POINTERS 0x90073 +#define FSCTL_IS_PATHNAME_VALID 0x9002c +#define FSCTL_READ_FILE_USN_DATA 0x900eb +#define FSCTL_RECALL_FILE 0x90117 +#define FSCTL_QUERY_FAT_BPB 0x90058 +#define FSCTL_QUERY_ALLOCATED_RANGES 0x940cf +#define FSCTL_SET_COMPRESSION 0x9c040 +#define FSCTL_SET_ENCRYPTION 0x900D7 +#define FSCTL_SET_OBJECT_ID 0x90098 +#define FSCTL_SET_OBJECT_ID_EXTENDED 0x900bc +#define FSCTL_SET_REPARSE_POINT 0x900a4 +#define FSCTL_SET_SPARSE 0x900c4 +#define FSCTL_SET_ZERO_DATA 0x980c8 +#define FSCTL_SIS_COPYFILE 0x90100 +#define FSCTL_WRITE_USN_CLOSE_RECORD 0x900ef +#endif + +#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600)) +#define FSCTL_SET_DEFECT_MANAGEMENT 0x98134 +#define FSCTL_SET_ZERO_ON_DEALLOCATION 0x90194 +#endif + +/* [MS-FSCC] FileFsAttributeInformation.FileSystemAttributes */ + +#ifndef _WIN32 + +#define FILE_SUPPORTS_USN_JOURNAL 0x02000000 +#define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000 +#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000 +#define FILE_SUPPORTS_HARD_LINKS 0x00400000 +#define FILE_SUPPORTS_TRANSACTIONS 0x00200000 +#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000 +#define FILE_READ_ONLY_VOLUME 0x00080000 +#define FILE_NAMED_STREAMS 0x00040000 +#define FILE_SUPPORTS_ENCRYPTION 0x00020000 +#define FILE_SUPPORTS_OBJECT_IDS 0x00010000 +#define FILE_VOLUME_IS_COMPRESSED 0x00008000 +#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 +#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 +#define FILE_SUPPORTS_SPARSE_FILES 0x00000040 +#define FILE_VOLUME_QUOTAS 0x00000020 +#define FILE_FILE_COMPRESSION 0x00000010 +#define FILE_PERSISTENT_ACLS 0x00000008 +#define FILE_UNICODE_ON_DISK 0x00000004 +#define FILE_CASE_PRESERVED_NAMES 0x00000002 +#define FILE_CASE_SENSITIVE_SEARCH 0x00000001 + +#endif + +/* [MS-FSCC] FileFsDeviceInformation.DeviceType */ + +#ifndef FILE_DEVICE_CD_ROM +#define FILE_DEVICE_CD_ROM 0x00000002 +#endif + +#ifndef FILE_DEVICE_DISK +#define FILE_DEVICE_DISK 0x00000007 +#endif + +/* [MS-FSCC] FileFsDeviceInformation.Characteristics */ +enum FILE_FS_DEVICE_FLAG +{ + FILE_REMOVABLE_MEDIA = 0x00000001, + FILE_READ_ONLY_DEVICE = 0x00000002, + FILE_FLOPPY_DISKETTE = 0x00000004, + FILE_WRITE_ONCE_MEDIA = 0x00000008, + FILE_REMOTE_DEVICE = 0x00000010, + FILE_DEVICE_IS_MOUNTED = 0x00000020, + FILE_VIRTUAL_VOLUME = 0x00000040, + FILE_DEVICE_SECURE_OPEN = 0x00000100 +}; + +#ifndef __MINGW32__ +enum FILE_FS_INFORMATION_CLASS +{ + FileFsVolumeInformation = 1, + FileFsLabelInformation, + FileFsSizeInformation, + FileFsDeviceInformation, + FileFsAttributeInformation, + FileFsControlInformation, + FileFsFullSizeInformation, + FileFsObjectIdInformation, + FileFsDriverPathInformation, + FileFsMaximumInformation +}; +#endif + +typedef struct S_DEVICE DEVICE; +typedef struct S_IRP IRP; +typedef struct S_DEVMAN DEVMAN; + +typedef UINT (*pcCustomComponentRequest)(DEVICE* device, UINT16 component, UINT16 packetId, + wStream* s); +typedef UINT (*pcIRPRequest)(DEVICE* device, IRP* irp); +typedef UINT (*pcInitDevice)(DEVICE* device); +typedef UINT (*pcFreeDevice)(DEVICE* device); + +struct S_DEVICE +{ + UINT32 id; + + UINT32 type; + const char* name; + wStream* data; + + pcCustomComponentRequest CustomComponentRequest; + pcIRPRequest IRPRequest; + pcInitDevice Init; + pcFreeDevice Free; +}; + +typedef UINT (*pcIRPResponse)(IRP* irp); + +struct S_IRP +{ + WINPR_SLIST_ENTRY ItemEntry; + + DEVICE* device; + DEVMAN* devman; + UINT32 FileId; + UINT32 CompletionId; + UINT32 MajorFunction; + UINT32 MinorFunction; + wStream* input; + + UINT32 IoStatus; + wStream* output; + + pcIRPResponse Complete; + pcIRPResponse Discard; + + HANDLE thread; + BOOL cancelled; +}; + +struct S_DEVMAN +{ + void* plugin; + UINT32 id_sequence; + wListDictionary* devices; +}; + +typedef UINT (*pcRegisterDevice)(DEVMAN* devman, DEVICE* device); + +typedef struct +{ + DEVMAN* devman; + + pcRegisterDevice RegisterDevice; + RDPDR_DEVICE* device; + rdpContext* rdpcontext; +} DEVICE_SERVICE_ENTRY_POINTS; +typedef DEVICE_SERVICE_ENTRY_POINTS* PDEVICE_SERVICE_ENTRY_POINTS; + +typedef UINT (*PDEVICE_SERVICE_ENTRY)(PDEVICE_SERVICE_ENTRY_POINTS); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RDPDR_H */ diff --git a/include/freerdp/channels/rdpecam.h b/include/freerdp/channels/rdpecam.h new file mode 100644 index 0000000..2e41efc --- /dev/null +++ b/include/freerdp/channels/rdpecam.h @@ -0,0 +1,345 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Video Capture Virtual Channel Extension + * + * Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_RDPECAM_H +#define FREERDP_CHANNEL_RDPECAM_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define RDPECAM_CHANNEL_NAME "rdpecam" +#define RDPECAM_DVC_CHANNEL_NAME "rdpecam" +#define RDPECAM_CONTROL_DVC_CHANNEL_NAME "RDCamera_Device_Enumerator" + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + CAM_MSG_ID_SuccessResponse = 0x01, + CAM_MSG_ID_ErrorResponse = 0x02, + CAM_MSG_ID_SelectVersionRequest = 0x03, + CAM_MSG_ID_SelectVersionResponse = 0x04, + CAM_MSG_ID_DeviceAddedNotification = 0x05, + CAM_MSG_ID_DeviceRemovedNotification = 0x06, + CAM_MSG_ID_ActivateDeviceRequest = 0x07, + CAM_MSG_ID_DeactivateDeviceRequest = 0x08, + CAM_MSG_ID_StreamListRequest = 0x09, + CAM_MSG_ID_StreamListResponse = 0x0A, + CAM_MSG_ID_MediaTypeListRequest = 0x0B, + CAM_MSG_ID_MediaTypeListResponse = 0x0C, + CAM_MSG_ID_CurrentMediaTypeRequest = 0x0D, + CAM_MSG_ID_CurrentMediaTypeResponse = 0x0E, + CAM_MSG_ID_StartStreamsRequest = 0x0F, + CAM_MSG_ID_StopStreamsRequest = 0x10, + CAM_MSG_ID_SampleRequest = 0x11, + CAM_MSG_ID_SampleResponse = 0x12, + CAM_MSG_ID_SampleErrorResponse = 0x13, + CAM_MSG_ID_PropertyListRequest = 0x14, + CAM_MSG_ID_PropertyListResponse = 0x15, + CAM_MSG_ID_PropertyValueRequest = 0x16, + CAM_MSG_ID_PropertyValueResponse = 0x17, + CAM_MSG_ID_SetPropertyValueRequest = 0x18, + } CAM_MSG_ID; + +#define CAM_HEADER_SIZE 2 + +typedef struct +{ + BYTE Version; + CAM_MSG_ID MessageId; +} CAM_SHARED_MSG_HEADER; + +/* Messages Exchanged on the Device Enumeration Channel (2.2.2) */ + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; +} CAM_SELECT_VERSION_REQUEST; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; +} CAM_SELECT_VERSION_RESPONSE; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + WCHAR* DeviceName; + char* VirtualChannelName; +} CAM_DEVICE_ADDED_NOTIFICATION; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + char* VirtualChannelName; +} CAM_DEVICE_REMOVED_NOTIFICATION; + +/* Messages Exchanged on Device Channels (2.2.3) */ + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; +} CAM_SUCCESS_RESPONSE; + +typedef enum +{ + CAM_ERROR_CODE_UnexpectedError = 0x00000001, + CAM_ERROR_CODE_InvalidMessage = 0x00000002, + CAM_ERROR_CODE_NotInitialized = 0x00000003, + CAM_ERROR_CODE_InvalidRequest = 0x00000004, + CAM_ERROR_CODE_InvalidStreamNumber = 0x00000005, + CAM_ERROR_CODE_InvalidMediaType = 0x00000006, + CAM_ERROR_CODE_OutOfMemory = 0x00000007, + CAM_ERROR_CODE_ItemNotFound = 0x00000008, + CAM_ERROR_CODE_SetNotFound = 0x00000009, + CAM_ERROR_CODE_OperationNotSupported = 0x0000000A, +} CAM_ERROR_CODE; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + CAM_ERROR_CODE ErrorCode; +} CAM_ERROR_RESPONSE; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; +} CAM_ACTIVATE_DEVICE_REQUEST; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; +} CAM_DEACTIVATE_DEVICE_REQUEST; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; +} CAM_STREAM_LIST_REQUEST; + +typedef enum +{ + CAM_STREAM_FRAME_SOURCE_TYPE_Color = 0x0001, + CAM_STREAM_FRAME_SOURCE_TYPE_Infrared = 0x0002, + CAM_STREAM_FRAME_SOURCE_TYPE_Custom = 0x0008, +} CAM_STREAM_FRAME_SOURCE_TYPES; + +typedef enum +{ + CAM_STREAM_CATEGORY_Capture = 0x01, +} CAM_STREAM_CATEGORY; + +typedef struct +{ + CAM_STREAM_FRAME_SOURCE_TYPES FrameSourceTypes; + CAM_STREAM_CATEGORY StreamCategory; + BYTE Selected; + BYTE CanBeShared; +} CAM_STREAM_DESCRIPTION; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + BYTE N_Descriptions; + CAM_STREAM_DESCRIPTION StreamDescriptions[255]; +} CAM_STREAM_LIST_RESPONSE; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + BYTE StreamIndex; +} CAM_MEDIA_TYPE_LIST_REQUEST; + +typedef enum +{ + CAM_MEDIA_FORMAT_H264 = 0x01, + CAM_MEDIA_FORMAT_MJPG = 0x02, + CAM_MEDIA_FORMAT_YUY2 = 0x03, + CAM_MEDIA_FORMAT_NV12 = 0x04, + CAM_MEDIA_FORMAT_I420 = 0x05, + CAM_MEDIA_FORMAT_RGB24 = 0x06, + CAM_MEDIA_FORMAT_RGB32 = 0x07, +} CAM_MEDIA_FORMAT; + +typedef enum +{ + CAM_MEDIA_TYPE_DESCRIPTION_FLAG_DecodingRequired = 0x01, + CAM_MEDIA_TYPE_DESCRIPTION_FLAG_BottomUpImage = 0x02, +} CAM_MEDIA_TYPE_DESCRIPTION_FLAGS; + +typedef struct +{ + CAM_MEDIA_FORMAT Format; + UINT32 Width; + UINT32 Height; + UINT32 FrameRateNumerator; + UINT32 FrameRateDenominator; + UINT32 PixelAspectRatioNumerator; + UINT32 PixelAspectRatioDenominator; + CAM_MEDIA_TYPE_DESCRIPTION_FLAGS Flags; +} CAM_MEDIA_TYPE_DESCRIPTION; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + size_t N_Descriptions; + CAM_MEDIA_TYPE_DESCRIPTION* MediaTypeDescriptions; +} CAM_MEDIA_TYPE_LIST_RESPONSE; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + BYTE StreamIndex; +} CAM_CURRENT_MEDIA_TYPE_REQUEST; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + CAM_MEDIA_TYPE_DESCRIPTION MediaTypeDescription; +} CAM_CURRENT_MEDIA_TYPE_RESPONSE; + +typedef struct +{ + BYTE StreamIndex; + CAM_MEDIA_TYPE_DESCRIPTION MediaTypeDescription; +} CAM_START_STREAM_INFO; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + BYTE N_Infos; + CAM_START_STREAM_INFO StartStreamsInfo[255]; +} CAM_START_STREAMS_REQUEST; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; +} CAM_STOP_STREAMS_REQUEST; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + BYTE StreamIndex; +} CAM_SAMPLE_REQUEST; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + BYTE StreamIndex; + size_t SampleSize; + BYTE* Sample; +} CAM_SAMPLE_RESPONSE; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + BYTE StreamIndex; + CAM_ERROR_CODE ErrorCode; +} CAM_SAMPLE_ERROR_RESPONSE; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; +} CAM_PROPERTY_LIST_REQUEST; + +typedef enum +{ + CAM_PROPERTY_SET_CameraControl = 0x01, + CAM_PROPERTY_SET_VideoProcAmp = 0x02, +} CAM_PROPERTY_SET; + +/* CameraControl properties */ +#define CAM_PROPERTY_ID_CAMERA_CONTROL_Exposure 0x01 +#define CAM_PROPERTY_ID_CAMERA_CONTROL_Focus 0x02 +#define CAM_PROPERTY_ID_CAMERA_CONTROL_Pan 0x03 +#define CAM_PROPERTY_ID_CAMERA_CONTROL_Roll 0x04 +#define CAM_PROPERTY_ID_CAMERA_CONTROL_Tilt 0x05 +#define CAM_PROPERTY_ID_CAMERA_CONTROL_Zoom 0x06 + +/* VideoProcAmp properties */ +#define CAM_PROPERTY_ID_VIDEO_PROC_AMP_BacklightCompensation 0x01 +#define CAM_PROPERTY_ID_VIDEO_PROC_AMP_Brightness 0x02 +#define CAM_PROPERTY_ID_VIDEO_PROC_AMP_Contrast 0x03 +#define CAM_PROPERTY_ID_VIDEO_PROC_AMP_Hue 0x04 +#define CAM_PROPERTY_ID_VIDEO_PROC_AMP_WhiteBalance 0x05 + +typedef enum +{ + CAM_PROPERTY_CAPABILITY_Manual = 0x01, + CAM_PROPERTY_CAPABILITY_Auto = 0x02, +} CAM_PROPERTY_CAPABILITIES; + +typedef struct +{ + CAM_PROPERTY_SET PropertySet; + BYTE PropertyId; + CAM_PROPERTY_CAPABILITIES Capabilities; + INT32 MinValue; + INT32 MaxValue; + INT32 Step; + INT32 DefaultValue; +} CAM_PROPERTY_DESCRIPTION; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + size_t N_Properties; + CAM_PROPERTY_DESCRIPTION* Properties; +} CAM_PROPERTY_LIST_RESPONSE; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + CAM_PROPERTY_SET PropertySet; + BYTE PropertyId; +} CAM_PROPERTY_VALUE_REQUEST; + +typedef enum +{ + CAM_PROPERTY_MODE_Manual = 0x01, + CAM_PROPERTY_MODE_Auto = 0x02, +} CAM_PROPERTY_MODE; + +typedef struct +{ + CAM_PROPERTY_MODE Mode; + INT32 Value; +} CAM_PROPERTY_VALUE; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + CAM_PROPERTY_VALUE PropertyValue; +} CAM_PROPERTY_VALUE_RESPONSE; + +typedef struct +{ + CAM_SHARED_MSG_HEADER Header; + CAM_PROPERTY_SET PropertySet; + BYTE PropertyId; + CAM_PROPERTY_VALUE PropertyValue; +} CAM_SET_PROPERTY_VALUE_REQUEST; + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_CHANNEL_RDPECAM_H */ diff --git a/include/freerdp/channels/rdpei.h b/include/freerdp/channels/rdpei.h new file mode 100644 index 0000000..1c4fca5 --- /dev/null +++ b/include/freerdp/channels/rdpei.h @@ -0,0 +1,166 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Extended Input channel common definitions + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2014 Thincast Technologies Gmbh. + * Copyright 2014 David FORT <contact@hardening-consulting.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_CHANNEL_RDPEI_H +#define FREERDP_CHANNEL_RDPEI_H + +#include <winpr/wtypes.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define RDPINPUT_HEADER_LENGTH 6 + +#define RDPEI_CHANNEL_NAME "rdpei" +#define RDPEI_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Input" + +/** @brief protocol version */ +enum +{ + RDPINPUT_PROTOCOL_V10 = 0x00010000, + RDPINPUT_PROTOCOL_V101 = 0x00010001, + RDPINPUT_PROTOCOL_V200 = 0x00020000, + RDPINPUT_PROTOCOL_V300 = 0x00030000 +}; + +/* Server feature flags */ +#define SC_READY_MULTIPEN_INJECTION_SUPPORTED 0x0001 + +/* Client Ready Flags */ +#define CS_READY_FLAGS_SHOW_TOUCH_VISUALS 0x00000001 +#define CS_READY_FLAGS_DISABLE_TIMESTAMP_INJECTION 0x00000002 +#define CS_READY_FLAGS_ENABLE_MULTIPEN_INJECTION 0x00000004 + +/* 2.2.3.3.1.1 RDPINPUT_TOUCH_CONTACT */ +#define CONTACT_DATA_CONTACTRECT_PRESENT 0x0001 +#define CONTACT_DATA_ORIENTATION_PRESENT 0x0002 +#define CONTACT_DATA_PRESSURE_PRESENT 0x0004 + +typedef enum +{ + RDPINPUT_PEN_CONTACT_PENFLAGS_PRESENT = 0x0001, + RDPINPUT_PEN_CONTACT_PRESSURE_PRESENT = 0x0002, + RDPINPUT_PEN_CONTACT_ROTATION_PRESENT = 0x0004, + RDPINPUT_PEN_CONTACT_TILTX_PRESENT = 0x0008, + RDPINPUT_PEN_CONTACT_TILTY_PRESENT = 0x0010 +} RDPINPUT_PEN_FIELDS_PRESENT; + +/* + * Valid combinations of RDPINPUT_CONTACT_FLAGS: + * + * See [MS-RDPEI] 2.2.3.3.1.1 RDPINPUT_TOUCH_CONTACT and 3.1.1.1 Touch Contact State Transitions + * + * UP + * UP | CANCELED + * UPDATE + * UPDATE | CANCELED + * DOWN | INRANGE | INCONTACT + * UPDATE | INRANGE | INCONTACT + * UP | INRANGE + * UPDATE | INRANGE + */ +typedef enum +{ + RDPINPUT_CONTACT_FLAG_DOWN = 0x0001, + RDPINPUT_CONTACT_FLAG_UPDATE = 0x0002, + RDPINPUT_CONTACT_FLAG_UP = 0x0004, + RDPINPUT_CONTACT_FLAG_INRANGE = 0x0008, + RDPINPUT_CONTACT_FLAG_INCONTACT = 0x0010, + RDPINPUT_CONTACT_FLAG_CANCELED = 0x0020 +} RDPINPUT_CONTACT_FLAGS; + +typedef enum +{ + RDPINPUT_PEN_FLAG_BARREL_PRESSED = 0x0001, + RDPINPUT_PEN_FLAG_ERASER_PRESSED = 0x0002, + RDPINPUT_PEN_FLAG_INVERTED = 0x0004 +} RDPINPUT_PEN_FLAGS; + +/** @brief a contact point */ +typedef struct +{ + UINT32 contactId; + UINT16 fieldsPresent; /* Mask of CONTACT_DATA_*_PRESENT values */ + INT32 x; + INT32 y; + UINT32 contactFlags; /* See RDPINPUT_CONTACT_FLAG* */ + INT16 contactRectLeft; /* Present if CONTACT_DATA_CONTACTRECT_PRESENT */ + INT16 contactRectTop; /* Present if CONTACT_DATA_CONTACTRECT_PRESENT */ + INT16 contactRectRight; /* Present if CONTACT_DATA_CONTACTRECT_PRESENT */ + INT16 contactRectBottom; /* Present if CONTACT_DATA_CONTACTRECT_PRESENT */ + UINT32 orientation; /* Present if CONTACT_DATA_ORIENTATION_PRESENT, values in degree, [0-359] */ + UINT32 pressure; /* Present if CONTACT_DATA_PRESSURE_PRESENT, normalized value [0-1024] */ +} RDPINPUT_CONTACT_DATA; + +/** @brief a frame containing contact points */ +typedef struct +{ + UINT16 contactCount; + UINT64 frameOffset; + RDPINPUT_CONTACT_DATA* contacts; +} RDPINPUT_TOUCH_FRAME; + +/** @brief a touch event with some frames*/ +typedef struct +{ + UINT32 encodeTime; + UINT16 frameCount; + RDPINPUT_TOUCH_FRAME* frames; +} RDPINPUT_TOUCH_EVENT; + +typedef struct +{ + UINT8 deviceId; + UINT16 fieldsPresent; /* Mask of RDPINPUT_PEN_FIELDS_PRESENT values */ + INT32 x; + INT32 y; + UINT32 contactFlags; /* See RDPINPUT_CONTACT_FLAG* */ + UINT32 penFlags; /* Present if RDPINPUT_PEN_CONTACT_PENFLAGS_PRESENT, values see + RDPINPUT_PEN_FLAGS */ + UINT16 rotation; /* Present if RDPINPUT_PEN_CONTACT_ROTATION_PRESENT, In degree, [0-359] */ + UINT32 + pressure; /* Present if RDPINPUT_PEN_CONTACT_PRESSURE_PRESENT, normalized value [0-1024] */ + INT16 tiltX; /* Present if PEN_CONTACT_TILTX_PRESENT, range [-90, 90] */ + INT16 tiltY; /* Present if PEN_CONTACT_TILTY_PRESENT, range [-90, 90] */ +} RDPINPUT_PEN_CONTACT; + +typedef struct +{ + UINT16 contactCount; + UINT64 frameOffset; + RDPINPUT_PEN_CONTACT* contacts; +} RDPINPUT_PEN_FRAME; + +/** @brief a touch event with some frames*/ +typedef struct +{ + UINT32 encodeTime; + UINT16 frameCount; + RDPINPUT_PEN_FRAME* frames; +} RDPINPUT_PEN_EVENT; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RDPEI_H */ diff --git a/include/freerdp/channels/rdpemsc.h b/include/freerdp/channels/rdpemsc.h new file mode 100644 index 0000000..4620358 --- /dev/null +++ b/include/freerdp/channels/rdpemsc.h @@ -0,0 +1,138 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Mouse Cursor Virtual Channel Extension + * + * Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_RDPEMSC_H +#define FREERDP_CHANNEL_RDPEMSC_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define RDPEMSC_CHANNEL_NAME "mousecursor" +#define RDPEMSC_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::MouseCursor" + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + PDUTYPE_EMSC_RESERVED = 0x00, + PDUTYPE_CS_CAPS_ADVERTISE = 0x01, + PDUTYPE_SC_CAPS_CONFIRM = 0x02, + PDUTYPE_SC_MOUSEPTR_UPDATE = 0x03, + } RDP_MOUSE_CURSOR_PDUTYPE; + + typedef enum + { + TS_UPDATETYPE_MOUSEPTR_SYSTEM_NULL = 0x05, + TS_UPDATETYPE_MOUSEPTR_SYSTEM_DEFAULT = 0x06, + TS_UPDATETYPE_MOUSEPTR_POSITION = 0x08, + TS_UPDATETYPE_MOUSEPTR_CACHED = 0x0A, + TS_UPDATETYPE_MOUSEPTR_POINTER = 0x0B, + TS_UPDATETYPE_MOUSEPTR_LARGE_POINTER = 0x0C, + } TS_UPDATETYPE_MOUSEPTR; + +#define RDPEMSC_HEADER_SIZE 4 + + typedef struct + { + RDP_MOUSE_CURSOR_PDUTYPE pduType; + TS_UPDATETYPE_MOUSEPTR updateType; + UINT16 reserved; + } RDP_MOUSE_CURSOR_HEADER; + + typedef enum + { + RDP_MOUSE_CURSOR_CAPVERSION_INVALID = 0x00000000, + RDP_MOUSE_CURSOR_CAPVERSION_1 = 0x00000001, + } RDP_MOUSE_CURSOR_CAPVERSION; + + typedef struct + { + UINT32 signature; + RDP_MOUSE_CURSOR_CAPVERSION version; + UINT32 size; + } RDP_MOUSE_CURSOR_CAPSET; + + typedef struct + { + RDP_MOUSE_CURSOR_CAPSET capsetHeader; + } RDP_MOUSE_CURSOR_CAPSET_VERSION1; + + typedef struct + { + RDP_MOUSE_CURSOR_HEADER header; + wArrayList* capsSets; + } RDP_MOUSE_CURSOR_CAPS_ADVERTISE_PDU; + + typedef struct + { + RDP_MOUSE_CURSOR_HEADER header; + RDP_MOUSE_CURSOR_CAPSET* capsSet; + } RDP_MOUSE_CURSOR_CAPS_CONFIRM_PDU; + + typedef struct + { + UINT16 xPos; + UINT16 yPos; + } TS_POINT16; + + typedef struct + { + UINT16 xorBpp; + UINT16 cacheIndex; + TS_POINT16 hotSpot; + UINT16 width; + UINT16 height; + UINT16 lengthAndMask; + UINT16 lengthXorMask; + BYTE* xorMaskData; + BYTE* andMaskData; + BYTE pad; + } TS_POINTERATTRIBUTE; + + typedef struct + { + UINT16 xorBpp; + UINT16 cacheIndex; + TS_POINT16 hotSpot; + UINT16 width; + UINT16 height; + UINT32 lengthAndMask; + UINT32 lengthXorMask; + BYTE* xorMaskData; + BYTE* andMaskData; + BYTE pad; + } TS_LARGEPOINTERATTRIBUTE; + + typedef struct + { + RDP_MOUSE_CURSOR_HEADER header; + TS_POINT16* position; + UINT16* cachedPointerIndex; + TS_POINTERATTRIBUTE* pointerAttribute; + TS_LARGEPOINTERATTRIBUTE* largePointerAttribute; + } RDP_MOUSE_CURSOR_MOUSEPTR_UPDATE_PDU; + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_CHANNEL_RDPEMSC_H */ diff --git a/include/freerdp/channels/rdpewa.h b/include/freerdp/channels/rdpewa.h new file mode 100644 index 0000000..a056f9d --- /dev/null +++ b/include/freerdp/channels/rdpewa.h @@ -0,0 +1,39 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Video Capture Virtual Channel Extension + * + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_CHANNEL_RDPEWA_H +#define FREERDP_CHANNEL_RDPEWA_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define RDPEWA_CHANNEL_NAME "rdpewa" +#define RDPEWA_DVC_CHANNEL_NAME "rdpewa" + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_CHANNEL_RDPEWA_H */ diff --git a/include/freerdp/channels/rdpgfx.h b/include/freerdp/channels/rdpgfx.h new file mode 100644 index 0000000..b608e0f --- /dev/null +++ b/include/freerdp/channels/rdpgfx.h @@ -0,0 +1,409 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Graphics Pipeline Extension + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.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_CHANNEL_RDPGFX_H +#define FREERDP_CHANNEL_RDPGFX_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define RDPGFX_CHANNEL_NAME "rdpgfx" +#define RDPGFX_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Graphics" + +#ifdef __cplusplus +extern "C" +{ +#endif + /** + * Common Data Types + */ + + typedef struct + { + UINT16 x; + UINT16 y; + } RDPGFX_POINT16; + + typedef struct + { + BYTE B; + BYTE G; + BYTE R; + BYTE XA; + } RDPGFX_COLOR32; + +#define GFX_PIXEL_FORMAT_XRGB_8888 0x20 +#define GFX_PIXEL_FORMAT_ARGB_8888 0x21 + +typedef BYTE RDPGFX_PIXELFORMAT; + +#define RDPGFX_CMDID_UNUSED_0000 0x0000 +#define RDPGFX_CMDID_WIRETOSURFACE_1 0x0001 +#define RDPGFX_CMDID_WIRETOSURFACE_2 0x0002 +#define RDPGFX_CMDID_DELETEENCODINGCONTEXT 0x0003 +#define RDPGFX_CMDID_SOLIDFILL 0x0004 +#define RDPGFX_CMDID_SURFACETOSURFACE 0x0005 +#define RDPGFX_CMDID_SURFACETOCACHE 0x0006 +#define RDPGFX_CMDID_CACHETOSURFACE 0x0007 +#define RDPGFX_CMDID_EVICTCACHEENTRY 0x0008 +#define RDPGFX_CMDID_CREATESURFACE 0x0009 +#define RDPGFX_CMDID_DELETESURFACE 0x000A +#define RDPGFX_CMDID_STARTFRAME 0x000B +#define RDPGFX_CMDID_ENDFRAME 0x000C +#define RDPGFX_CMDID_FRAMEACKNOWLEDGE 0x000D +#define RDPGFX_CMDID_RESETGRAPHICS 0x000E +#define RDPGFX_CMDID_MAPSURFACETOOUTPUT 0x000F +#define RDPGFX_CMDID_CACHEIMPORTOFFER 0x0010 +#define RDPGFX_CMDID_CACHEIMPORTREPLY 0x0011 +#define RDPGFX_CMDID_CAPSADVERTISE 0x0012 +#define RDPGFX_CMDID_CAPSCONFIRM 0x0013 +#define RDPGFX_CMDID_UNUSED_0014 0x0014 +#define RDPGFX_CMDID_MAPSURFACETOWINDOW 0x0015 +#define RDPGFX_CMDID_QOEFRAMEACKNOWLEDGE 0x0016 +#define RDPGFX_CMDID_MAPSURFACETOSCALEDOUTPUT 0x0017 +#define RDPGFX_CMDID_MAPSURFACETOSCALEDWINDOW 0x0018 + +#define RDPGFX_HEADER_SIZE 8 + +typedef struct +{ + UINT16 cmdId; + UINT16 flags; + UINT32 pduLength; +} RDPGFX_HEADER; + +/** + * Capability Sets [MS-RDPEGFX] 2.2.3 + */ + +#define RDPGFX_CAPVERSION_8 0x00080004 /** [MS-RDPEGFX] 2.2.3.1 */ +#define RDPGFX_CAPVERSION_81 0x00080105 /** [MS-RDPEGFX] 2.2.3.2 */ +#define RDPGFX_CAPVERSION_10 0x000A0002 /** [MS-RDPEGFX] 2.2.3.3 */ +#define RDPGFX_CAPVERSION_101 0x000A0100 /** [MS-RDPEGFX] 2.2.3.4 */ +#define RDPGFX_CAPVERSION_102 0x000A0200 /** [MS-RDPEGFX] 2.2.3.5 */ +#define RDPGFX_CAPVERSION_103 0x000A0301 /** [MS-RDPEGFX] 2.2.3.6 */ +#define RDPGFX_CAPVERSION_104 0x000A0400 /** [MS-RDPEGFX] 2.2.3.7 */ +#define RDPGFX_CAPVERSION_105 0x000A0502 /** [MS-RDPEGFX] 2.2.3.8 */ +#define RDPGFX_CAPVERSION_106 \ + 0x000A0600 /** [MS-RDPEGFX] 2.2.3.9 (the value in the doc is wrong, see \ + * [MS-RDPEGFX]-180912-errata] \ + * Since this is/was documented for a long time, also define \ + * the incorrect value in case some server actually uses it. \ + */ +#define RDPGFX_CAPVERSION_106_ERR 0x000A0601 +#define RDPGFX_CAPVERSION_107 0x000A0701 /** [MS-RDPEGFX] 2.2.3.10 */ + +#define RDPGFX_NUMBER_CAPSETS 11 +#define RDPGFX_CAPSET_BASE_SIZE 8 + +typedef struct +{ + UINT32 version; + UINT32 length; + UINT32 flags; +} RDPGFX_CAPSET; + +#define RDPGFX_CAPS_FLAG_THINCLIENT 0x00000001U /* 8.0+ */ +#define RDPGFX_CAPS_FLAG_SMALL_CACHE 0x00000002U /* 8.0+ */ +#define RDPGFX_CAPS_FLAG_AVC420_ENABLED 0x00000010U /* 8.1+ */ +#define RDPGFX_CAPS_FLAG_AVC_DISABLED 0x00000020U /* 10.0+ */ +#define RDPGFX_CAPS_FLAG_AVC_THINCLIENT 0x00000040U /* 10.3+ */ +#define RDPGFX_CAPS_FLAG_SCALEDMAP_DISABLE 0x00000080U /* 10.7+ */ + +typedef struct +{ + UINT32 version; + UINT32 capsDataLength; + UINT32 flags; +} RDPGFX_CAPSET_VERSION8; + +typedef struct +{ + UINT32 version; + UINT32 capsDataLength; + UINT32 flags; +} RDPGFX_CAPSET_VERSION81; + +typedef struct +{ + UINT32 version; + UINT32 capsDataLength; + UINT32 flags; +} RDPGFX_CAPSET_VERSION10; + +/** + * Graphics Messages + */ + +#define RDPGFX_CODECID_UNCOMPRESSED 0x0000 +#define RDPGFX_CODECID_CAVIDEO 0x0003 +#define RDPGFX_CODECID_CLEARCODEC 0x0008 +#define RDPGFX_CODECID_PLANAR 0x000A +#define RDPGFX_CODECID_AVC420 0x000B +#define RDPGFX_CODECID_ALPHA 0x000C +#define RDPGFX_CODECID_AVC444 0x000E +#define RDPGFX_CODECID_AVC444v2 0x000F + +#define RDPGFX_WIRE_TO_SURFACE_PDU_1_SIZE 17 + +typedef struct +{ + UINT16 surfaceId; + UINT16 codecId; + RDPGFX_PIXELFORMAT pixelFormat; + RECTANGLE_16 destRect; + UINT32 bitmapDataLength; + BYTE* bitmapData; +} RDPGFX_WIRE_TO_SURFACE_PDU_1; + +#define RDPGFX_CODECID_CAPROGRESSIVE 0x0009 +#define RDPGFX_CODECID_CAPROGRESSIVE_V2 0x000D + +#define RDPGFX_WIRE_TO_SURFACE_PDU_2_SIZE 13 + +typedef struct +{ + UINT16 surfaceId; + UINT16 codecId; + UINT32 codecContextId; + RDPGFX_PIXELFORMAT pixelFormat; + UINT32 bitmapDataLength; + BYTE* bitmapData; +} RDPGFX_WIRE_TO_SURFACE_PDU_2; + +typedef struct +{ + UINT32 surfaceId; + UINT32 codecId; + UINT32 contextId; + UINT32 format; /* FreeRDP color format. @see freerdp/codec/color.h */ + UINT32 left; + UINT32 top; + UINT32 right; + UINT32 bottom; + UINT32 width; + UINT32 height; + UINT32 length; + BYTE* data; + void* extra; +} RDPGFX_SURFACE_COMMAND; + +typedef struct +{ + UINT16 surfaceId; + UINT32 codecContextId; +} RDPGFX_DELETE_ENCODING_CONTEXT_PDU; + +typedef struct +{ + UINT16 surfaceId; + RDPGFX_COLOR32 fillPixel; + UINT16 fillRectCount; + RECTANGLE_16* fillRects; +} RDPGFX_SOLID_FILL_PDU; + +typedef struct +{ + UINT16 surfaceIdSrc; + UINT16 surfaceIdDest; + RECTANGLE_16 rectSrc; + UINT16 destPtsCount; + RDPGFX_POINT16* destPts; +} RDPGFX_SURFACE_TO_SURFACE_PDU; + +typedef struct +{ + UINT16 surfaceId; + UINT64 cacheKey; + UINT16 cacheSlot; + RECTANGLE_16 rectSrc; +} RDPGFX_SURFACE_TO_CACHE_PDU; + +typedef struct +{ + UINT16 cacheSlot; + UINT16 surfaceId; + UINT16 destPtsCount; + RDPGFX_POINT16* destPts; +} RDPGFX_CACHE_TO_SURFACE_PDU; + +typedef struct +{ + UINT16 cacheSlot; +} RDPGFX_EVICT_CACHE_ENTRY_PDU; + +typedef struct +{ + UINT16 surfaceId; + UINT16 width; + UINT16 height; + RDPGFX_PIXELFORMAT pixelFormat; +} RDPGFX_CREATE_SURFACE_PDU; + +typedef struct +{ + UINT16 surfaceId; +} RDPGFX_DELETE_SURFACE_PDU; + +#define RDPGFX_START_FRAME_PDU_SIZE 8 + +typedef struct +{ + UINT32 timestamp; + UINT32 frameId; +} RDPGFX_START_FRAME_PDU; + +#define RDPGFX_END_FRAME_PDU_SIZE 4 + +typedef struct +{ + UINT32 frameId; +} RDPGFX_END_FRAME_PDU; + +#define QUEUE_DEPTH_UNAVAILABLE 0x00000000 +#define SUSPEND_FRAME_ACKNOWLEDGEMENT 0xFFFFFFFF + +typedef struct +{ + UINT32 queueDepth; + UINT32 frameId; + UINT32 totalFramesDecoded; +} RDPGFX_FRAME_ACKNOWLEDGE_PDU; + +typedef struct +{ + UINT32 width; + UINT32 height; + UINT32 monitorCount; + MONITOR_DEF* monitorDefArray; +} RDPGFX_RESET_GRAPHICS_PDU; + +typedef struct +{ + UINT16 surfaceId; + UINT16 reserved; + UINT32 outputOriginX; + UINT32 outputOriginY; +} RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU; + +typedef struct +{ + UINT16 surfaceId; + UINT16 reserved; + UINT32 outputOriginX; + UINT32 outputOriginY; + UINT32 targetWidth; + UINT32 targetHeight; +} RDPGFX_MAP_SURFACE_TO_SCALED_OUTPUT_PDU; + +typedef struct +{ + UINT64 cacheKey; + UINT32 bitmapLength; +} RDPGFX_CACHE_ENTRY_METADATA; + +#define RDPGFX_CACHE_ENTRY_MAX_COUNT 5462 + +typedef struct +{ + UINT16 cacheEntriesCount; + RDPGFX_CACHE_ENTRY_METADATA cacheEntries[RDPGFX_CACHE_ENTRY_MAX_COUNT]; +} RDPGFX_CACHE_IMPORT_OFFER_PDU; + +typedef struct +{ + UINT16 importedEntriesCount; + UINT16 cacheSlots[RDPGFX_CACHE_ENTRY_MAX_COUNT]; +} RDPGFX_CACHE_IMPORT_REPLY_PDU; + +typedef struct +{ + UINT16 capsSetCount; + RDPGFX_CAPSET* capsSets; +} RDPGFX_CAPS_ADVERTISE_PDU; + +typedef struct +{ + RDPGFX_CAPSET* capsSet; +} RDPGFX_CAPS_CONFIRM_PDU; + +typedef struct +{ + UINT16 surfaceId; + UINT64 windowId; + UINT32 mappedWidth; + UINT32 mappedHeight; +} RDPGFX_MAP_SURFACE_TO_WINDOW_PDU; + +typedef struct +{ + UINT16 surfaceId; + UINT64 windowId; + UINT32 mappedWidth; + UINT32 mappedHeight; + UINT32 targetWidth; + UINT32 targetHeight; +} RDPGFX_MAP_SURFACE_TO_SCALED_WINDOW_PDU; + +/* H264 */ + +typedef struct +{ + BYTE qpVal; + BYTE qualityVal; + + BYTE qp; + BYTE r; + BYTE p; +} RDPGFX_H264_QUANT_QUALITY; + +typedef struct +{ + UINT32 numRegionRects; + RECTANGLE_16* regionRects; + RDPGFX_H264_QUANT_QUALITY* quantQualityVals; +} RDPGFX_H264_METABLOCK; + +typedef struct +{ + RDPGFX_H264_METABLOCK meta; + UINT32 length; + BYTE* data; +} RDPGFX_AVC420_BITMAP_STREAM; + +typedef struct +{ + UINT32 cbAvc420EncodedBitstream1; + BYTE LC; + RDPGFX_AVC420_BITMAP_STREAM bitstream[2]; +} RDPGFX_AVC444_BITMAP_STREAM; + +typedef struct +{ + UINT32 frameId; + UINT32 timestamp; + UINT16 timeDiffSE; + UINT16 timeDiffEDR; +} RDPGFX_QOE_FRAME_ACKNOWLEDGE_PDU; + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_CHANNEL_RDPGFX_H */ diff --git a/include/freerdp/channels/rdpsnd.h b/include/freerdp/channels/rdpsnd.h new file mode 100644 index 0000000..e5c6c6f --- /dev/null +++ b/include/freerdp/channels/rdpsnd.h @@ -0,0 +1,32 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Audio Virtual Channel Types + * + * Copyright 2012 Vic Lee + * + * 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_CHANNEL_RDPSND_H +#define FREERDP_CHANNEL_RDPSND_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codec/audio.h> + +#define RDPSND_CHANNEL_NAME "rdpsnd" +#define RDPSND_DVC_CHANNEL_NAME "AUDIO_PLAYBACK_DVC" +#define RDPSND_LOSSY_DVC_CHANNEL_NAME "AUDIO_PLAYBACK_LOSSY_DVC" + +#endif /* FREERDP_CHANNEL_RDPSND_H */ diff --git a/include/freerdp/channels/remdesk.h b/include/freerdp/channels/remdesk.h new file mode 100644 index 0000000..281317a --- /dev/null +++ b/include/freerdp/channels/remdesk.h @@ -0,0 +1,161 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Remote Assistance Virtual Channel + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_CHANNEL_REMDESK_H +#define FREERDP_CHANNEL_REMDESK_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define REMDESK_CHANNEL_NAME "remdesk" +#define REMDESK_SVC_CHANNEL_NAME "remdesk" + +#define REMDESK_ERROR_NOERROR 0 +#define REMDESK_ERROR_NOINFO 1 +#define REMDESK_ERROR_LOCALNOTERROR 3 +#define REMDESK_ERROR_REMOTEBYUSER 4 +#define REMDESK_ERROR_BYSERVER 5 +#define REMDESK_ERROR_DNSLOOKUPFAILED 6 +#define REMDESK_ERROR_OUTOFMEMORY 7 +#define REMDESK_ERROR_CONNECTIONTIMEDOUT 8 +#define REMDESK_ERROR_SOCKETCONNECTFAILED 9 +#define REMDESK_ERROR_HOSTNOTFOUND 11 +#define REMDESK_ERROR_WINSOCKSENDFAILED 12 +#define REMDESK_ERROR_INVALIDIPADDR 14 +#define REMDESK_ERROR_SOCKETRECVFAILED 15 +#define REMDESK_ERROR_INVALIDENCRYPTION 18 +#define REMDESK_ERROR_GETHOSTBYNAMEFAILED 20 +#define REMDESK_ERROR_LICENSINGFAILED 21 +#define REMDESK_ERROR_ENCRYPTIONERROR 22 +#define REMDESK_ERROR_DECRYPTIONERROR 23 +#define REMDESK_ERROR_INVALIDPARAMETERSTRING 24 +#define REMDESK_ERROR_HELPSESSIONNOTFOUND 25 +#define REMDESK_ERROR_INVALIDPASSWORD 26 +#define REMDESK_ERROR_HELPSESSIONEXPIRED 27 +#define REMDESK_ERROR_CANTOPENRESOLVER 28 +#define REMDESK_ERROR_UNKNOWNSESSMGRERROR 29 +#define REMDESK_ERROR_CANTFORMLINKTOUSERSESSION 30 +#define REMDESK_ERROR_RCPROTOCOLERROR 32 +#define REMDESK_ERROR_RCUNKNOWNERROR 33 +#define REMDESK_ERROR_INTERNALERROR 34 +#define REMDESK_ERROR_HELPEERESPONSEPENDING 35 +#define REMDESK_ERROR_HELPEESAIDYES 36 +#define REMDESK_ERROR_HELPEEALREADYBEINGHELPED 37 +#define REMDESK_ERROR_HELPEECONSIDERINGHELP 38 +#define REMDESK_ERROR_HELPEENEVERRESPONDED 40 +#define REMDESK_ERROR_HELPEESAIDNO 41 +#define REMDESK_ERROR_HELPSESSIONACCESSDENIED 42 +#define REMDESK_ERROR_USERNOTFOUND 43 +#define REMDESK_ERROR_SESSMGRERRORNOTINIT 44 +#define REMDESK_ERROR_SELFHELPNOTSUPPORTED 45 +#define REMDESK_ERROR_INCOMPATIBLEVERSION 47 +#define REMDESK_ERROR_SESSIONNOTCONNECTED 48 +#define REMDESK_ERROR_SYSTEMSHUTDOWN 50 +#define REMDESK_ERROR_STOPLISTENBYUSER 51 +#define REMDESK_ERROR_WINSOCK_FAILED 52 +#define REMDESK_ERROR_MISMATCHPARMS 53 +#define REMDESK_ERROR_PASSWORDS_DONT_MATCH 61 +#define REMDESK_ERROR_SHADOWEND_BASE 300 +#define REMDESK_ERROR_SHADOWEND_CONFIGCHANGE 301 +#define REMDESK_ERROR_SHADOWEND_UNKNOWN 302 + +typedef struct +{ + UINT32 DataLength; + char ChannelName[32]; +} REMDESK_CHANNEL_HEADER; + +#define REMDESK_CHANNEL_CTL_NAME "RC_CTL" +#define REMDESK_CHANNEL_CTL_SIZE 22 + +typedef struct +{ + REMDESK_CHANNEL_HEADER ch; + + UINT32 msgType; +} REMDESK_CTL_HEADER; + +#define REMDESK_CTL_REMOTE_CONTROL_DESKTOP 1 +#define REMDESK_CTL_RESULT 2 +#define REMDESK_CTL_AUTHENTICATE 3 +#define REMDESK_CTL_SERVER_ANNOUNCE 4 +#define REMDESK_CTL_DISCONNECT 5 +#define REMDESK_CTL_VERSIONINFO 6 +#define REMDESK_CTL_ISCONNECTED 7 +#define REMDESK_CTL_VERIFY_PASSWORD 8 +#define REMDESK_CTL_EXPERT_ON_VISTA 9 +#define REMDESK_CTL_RANOVICE_NAME 10 +#define REMDESK_CTL_RAEXPERT_NAME 11 +#define REMDESK_CTL_TOKEN 12 + +typedef struct +{ + REMDESK_CTL_HEADER ctlHeader; + + UINT32 result; +} REMDESK_CTL_RESULT_PDU; + +typedef struct +{ + REMDESK_CTL_HEADER ctlHeader; + + UINT32 versionMajor; + UINT32 versionMinor; +} REMDESK_CTL_VERSION_INFO_PDU; + +typedef struct +{ + REMDESK_CTL_HEADER ctlHeader; + + char* raConnectionString; + char* expertBlob; +} REMDESK_CTL_AUTHENTICATE_PDU; + +typedef struct +{ + REMDESK_CTL_HEADER ctlHeader; + + char* raConnectionString; +} REMDESK_CTL_REMOTE_CONTROL_DESKTOP_PDU; + +typedef struct +{ + REMDESK_CTL_HEADER ctlHeader; + + char* expertBlob; +} REMDESK_CTL_VERIFY_PASSWORD_PDU; + +typedef struct +{ + REMDESK_CTL_HEADER ctlHeader; + + BYTE* EncryptedPassword; + UINT32 EncryptedPasswordLength; +} REMDESK_CTL_EXPERT_ON_VISTA_PDU; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_REMDESK_H */ diff --git a/include/freerdp/channels/scard.h b/include/freerdp/channels/scard.h new file mode 100644 index 0000000..d83e2c8 --- /dev/null +++ b/include/freerdp/channels/scard.h @@ -0,0 +1,500 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Smartcard Redirection Virtual Channel + * + * Copyright 2021 Armin Novak <anovak@thincast.com> + * Copyright 2021 Thincast Technologies GmbH + * + * 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_CHANNEL_SCARD_H +#define FREERDP_CHANNEL_SCARD_H + +#include <winpr/crt.h> +#include <winpr/smartcard.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define RDP_SCARD_CTL_CODE(code) \ + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, (code), METHOD_BUFFERED, FILE_ANY_ACCESS) + +#define SCARD_IOCTL_ESTABLISHCONTEXT RDP_SCARD_CTL_CODE(5) /* SCardEstablishContext */ +#define SCARD_IOCTL_RELEASECONTEXT RDP_SCARD_CTL_CODE(6) /* SCardReleaseContext */ +#define SCARD_IOCTL_ISVALIDCONTEXT RDP_SCARD_CTL_CODE(7) /* SCardIsValidContext */ +#define SCARD_IOCTL_LISTREADERGROUPSA RDP_SCARD_CTL_CODE(8) /* SCardListReaderGroupsA */ +#define SCARD_IOCTL_LISTREADERGROUPSW RDP_SCARD_CTL_CODE(9) /* SCardListReaderGroupsW */ +#define SCARD_IOCTL_LISTREADERSA RDP_SCARD_CTL_CODE(10) /* SCardListReadersA */ +#define SCARD_IOCTL_LISTREADERSW RDP_SCARD_CTL_CODE(11) /* SCardListReadersW */ +#define SCARD_IOCTL_INTRODUCEREADERGROUPA RDP_SCARD_CTL_CODE(20) /* SCardIntroduceReaderGroupA */ +#define SCARD_IOCTL_INTRODUCEREADERGROUPW RDP_SCARD_CTL_CODE(21) /* SCardIntroduceReaderGroupW */ +#define SCARD_IOCTL_FORGETREADERGROUPA RDP_SCARD_CTL_CODE(22) /* SCardForgetReaderGroupA */ +#define SCARD_IOCTL_FORGETREADERGROUPW RDP_SCARD_CTL_CODE(23) /* SCardForgetReaderGroupW */ +#define SCARD_IOCTL_INTRODUCEREADERA RDP_SCARD_CTL_CODE(24) /* SCardIntroduceReaderA */ +#define SCARD_IOCTL_INTRODUCEREADERW RDP_SCARD_CTL_CODE(25) /* SCardIntroduceReaderW */ +#define SCARD_IOCTL_FORGETREADERA RDP_SCARD_CTL_CODE(26) /* SCardForgetReaderA */ +#define SCARD_IOCTL_FORGETREADERW RDP_SCARD_CTL_CODE(27) /* SCardForgetReaderW */ +#define SCARD_IOCTL_ADDREADERTOGROUPA RDP_SCARD_CTL_CODE(28) /* SCardAddReaderToGroupA */ +#define SCARD_IOCTL_ADDREADERTOGROUPW RDP_SCARD_CTL_CODE(29) /* SCardAddReaderToGroupW */ +#define SCARD_IOCTL_REMOVEREADERFROMGROUPA \ + RDP_SCARD_CTL_CODE(30) /* SCardRemoveReaderFromGroupA \ + */ +#define SCARD_IOCTL_REMOVEREADERFROMGROUPW \ + RDP_SCARD_CTL_CODE(31) /* SCardRemoveReaderFromGroupW \ + */ +#define SCARD_IOCTL_LOCATECARDSA RDP_SCARD_CTL_CODE(38) /* SCardLocateCardsA */ +#define SCARD_IOCTL_LOCATECARDSW RDP_SCARD_CTL_CODE(39) /* SCardLocateCardsW */ +#define SCARD_IOCTL_GETSTATUSCHANGEA RDP_SCARD_CTL_CODE(40) /* SCardGetStatusChangeA */ +#define SCARD_IOCTL_GETSTATUSCHANGEW RDP_SCARD_CTL_CODE(41) /* SCardGetStatusChangeW */ +#define SCARD_IOCTL_CANCEL RDP_SCARD_CTL_CODE(42) /* SCardCancel */ +#define SCARD_IOCTL_CONNECTA RDP_SCARD_CTL_CODE(43) /* SCardConnectA */ +#define SCARD_IOCTL_CONNECTW RDP_SCARD_CTL_CODE(44) /* SCardConnectW */ +#define SCARD_IOCTL_RECONNECT RDP_SCARD_CTL_CODE(45) /* SCardReconnect */ +#define SCARD_IOCTL_DISCONNECT RDP_SCARD_CTL_CODE(46) /* SCardDisconnect */ +#define SCARD_IOCTL_BEGINTRANSACTION RDP_SCARD_CTL_CODE(47) /* SCardBeginTransaction */ +#define SCARD_IOCTL_ENDTRANSACTION RDP_SCARD_CTL_CODE(48) /* SCardEndTransaction */ +#define SCARD_IOCTL_STATE RDP_SCARD_CTL_CODE(49) /* SCardState */ +#define SCARD_IOCTL_STATUSA RDP_SCARD_CTL_CODE(50) /* SCardStatusA */ +#define SCARD_IOCTL_STATUSW RDP_SCARD_CTL_CODE(51) /* SCardStatusW */ +#define SCARD_IOCTL_TRANSMIT RDP_SCARD_CTL_CODE(52) /* SCardTransmit */ +#define SCARD_IOCTL_CONTROL RDP_SCARD_CTL_CODE(53) /* SCardControl */ +#define SCARD_IOCTL_GETATTRIB RDP_SCARD_CTL_CODE(54) /* SCardGetAttrib */ +#define SCARD_IOCTL_SETATTRIB RDP_SCARD_CTL_CODE(55) /* SCardSetAttrib */ +#define SCARD_IOCTL_ACCESSSTARTEDEVENT RDP_SCARD_CTL_CODE(56) /* SCardAccessStartedEvent */ +#define SCARD_IOCTL_RELEASETARTEDEVENT RDP_SCARD_CTL_CODE(57) /* SCardReleaseStartedEvent */ +#define SCARD_IOCTL_LOCATECARDSBYATRA RDP_SCARD_CTL_CODE(58) /* SCardLocateCardsByATRA */ +#define SCARD_IOCTL_LOCATECARDSBYATRW RDP_SCARD_CTL_CODE(59) /* SCardLocateCardsByATRW */ +#define SCARD_IOCTL_READCACHEA RDP_SCARD_CTL_CODE(60) /* SCardReadCacheA */ +#define SCARD_IOCTL_READCACHEW RDP_SCARD_CTL_CODE(61) /* SCardReadCacheW */ +#define SCARD_IOCTL_WRITECACHEA RDP_SCARD_CTL_CODE(62) /* SCardWriteCacheA */ +#define SCARD_IOCTL_WRITECACHEW RDP_SCARD_CTL_CODE(63) /* SCardWriteCacheW */ +#define SCARD_IOCTL_GETTRANSMITCOUNT RDP_SCARD_CTL_CODE(64) /* SCardGetTransmitCount */ +#define SCARD_IOCTL_GETREADERICON RDP_SCARD_CTL_CODE(65) /* SCardGetReaderIconA */ +#define SCARD_IOCTL_GETDEVICETYPEID RDP_SCARD_CTL_CODE(66) /* SCardGetDeviceTypeIdA */ + +#pragma pack(push, 1) + +/* interface type_scard_pack */ +/* [unique][version][uuid] */ + +typedef struct +{ + /* [range] */ DWORD cbContext; + /* [size_is][unique] */ BYTE pbContext[8]; +} REDIR_SCARDCONTEXT; + +typedef struct +{ + /* [range] */ DWORD cbHandle; + /* [size_is] */ BYTE pbHandle[8]; +} REDIR_SCARDHANDLE; + +typedef struct +{ + LONG ReturnCode; +} Long_Return; + +typedef struct +{ + LONG ReturnCode; + /* [range] */ DWORD cBytes; + /* [size_is][unique] */ BYTE* msz; +} ListReaderGroups_Return, ListReaders_Return; + +typedef struct +{ + LONG ReturnCode; + REDIR_SCARDCONTEXT hContext; +} EstablishContext_Return; + +typedef struct +{ + DWORD dwCurrentState; + DWORD dwEventState; + /* [range] */ DWORD cbAtr; + BYTE rgbAtr[36]; +} ReaderState_Return; + +typedef struct +{ + /* [range] */ DWORD cbAtr; + BYTE rgbAtr[36]; + BYTE rgbMask[36]; +} LocateCards_ATRMask; + +typedef struct +{ + LONG ReturnCode; + /* [range] */ DWORD cReaders; + /* [size_is] */ ReaderState_Return* rgReaderStates; +} LocateCards_Return, GetStatusChange_Return; + +typedef struct +{ + LONG ReturnCode; + ULONG cbDataLen; + BYTE* pbData; +} GetReaderIcon_Return; + +typedef struct +{ + LONG ReturnCode; + ULONG dwDeviceId; +} GetDeviceTypeId_Return; + +typedef struct +{ + LONG ReturnCode; + REDIR_SCARDCONTEXT hContext; + REDIR_SCARDHANDLE hCard; + DWORD dwActiveProtocol; +} Connect_Return; + +typedef struct +{ + LONG ReturnCode; + DWORD dwActiveProtocol; +} Reconnect_Return; + +typedef struct +{ + LONG ReturnCode; + DWORD dwState; + DWORD dwProtocol; + /* [range] */ DWORD cbAtrLen; + /* [size_is][unique] */ BYTE rgAtr[36]; +} State_Return; + +typedef struct +{ + LONG ReturnCode; + /* [range] */ DWORD cBytes; + /* [size_is][unique] */ BYTE* mszReaderNames; + DWORD dwState; + DWORD dwProtocol; + BYTE pbAtr[32]; + /* [range] */ DWORD cbAtrLen; +} Status_Return; + +typedef struct +{ + DWORD dwProtocol; + /* [range] */ DWORD cbExtraBytes; + /* [size_is][unique] */ BYTE* pbExtraBytes; +} SCardIO_Request; + +typedef struct +{ + LONG ReturnCode; + /* [unique] */ LPSCARD_IO_REQUEST pioRecvPci; + /* [range] */ DWORD cbRecvLength; + /* [size_is][unique] */ BYTE* pbRecvBuffer; +} Transmit_Return; + +typedef struct +{ + LONG ReturnCode; + DWORD cTransmitCount; +} GetTransmitCount_Return; + +typedef struct +{ + LONG ReturnCode; + /* [range] */ DWORD cbOutBufferSize; + /* [size_is][unique] */ BYTE* pvOutBuffer; +} Control_Return; + +typedef struct +{ + LONG ReturnCode; + /* [range] */ DWORD cbAttrLen; + /* [size_is][unique] */ BYTE* pbAttr; +} GetAttrib_Return; + +typedef struct +{ + LONG ReturnCode; + /* [range] */ DWORD cbDataLen; + /* [size_is][unique] */ BYTE* pbData; +} ReadCache_Return; +#pragma pack(pop) + +typedef struct +{ + REDIR_SCARDCONTEXT hContext; + REDIR_SCARDHANDLE hCard; +} Handles_Call; + +typedef struct +{ + Handles_Call handles; + LONG fmszGroupsIsNULL; + DWORD cchGroups; +} ListReaderGroups_Call; + +typedef struct +{ + Handles_Call handles; + /* [range] */ DWORD cBytes; + /* [size_is][unique] */ BYTE* mszGroups; + LONG fmszReadersIsNULL; + DWORD cchReaders; +} ListReaders_Call; + +typedef struct +{ + Handles_Call handles; + DWORD dwTimeOut; + /* [range] */ DWORD cReaders; + /* [size_is] */ LPSCARD_READERSTATEA rgReaderStates; +} GetStatusChangeA_Call; + +typedef struct +{ + Handles_Call handles; + /* [range] */ DWORD cBytes; + /* [size_is] */ CHAR* mszCards; + /* [range] */ DWORD cReaders; + /* [size_is] */ LPSCARD_READERSTATEA rgReaderStates; +} LocateCardsA_Call; + +typedef struct +{ + Handles_Call handles; + /* [range] */ DWORD cBytes; + /* [size_is] */ WCHAR* mszCards; + /* [range] */ DWORD cReaders; + /* [size_is] */ LPSCARD_READERSTATEW rgReaderStates; +} LocateCardsW_Call; + +typedef struct +{ + Handles_Call handles; + /* [range] */ DWORD cAtrs; + /* [size_is] */ LocateCards_ATRMask* rgAtrMasks; + /* [range] */ DWORD cReaders; + /* [size_is] */ LPSCARD_READERSTATEA rgReaderStates; +} LocateCardsByATRA_Call; + +typedef struct +{ + Handles_Call handles; + /* [range] */ DWORD cAtrs; + /* [size_is] */ LocateCards_ATRMask* rgAtrMasks; + /* [range] */ DWORD cReaders; + /* [size_is] */ LPSCARD_READERSTATEW rgReaderStates; +} LocateCardsByATRW_Call; + +typedef struct +{ + Handles_Call handles; + DWORD dwTimeOut; + /* [range] */ DWORD cReaders; + /* [size_is] */ LPSCARD_READERSTATEW rgReaderStates; +} GetStatusChangeW_Call; + +typedef struct +{ + Handles_Call handles; + WCHAR* szReaderName; +} GetReaderIcon_Call; + +typedef struct +{ + Handles_Call handles; + WCHAR* szReaderName; +} GetDeviceTypeId_Call; + +typedef struct +{ + Handles_Call handles; + DWORD dwShareMode; + DWORD dwPreferredProtocols; +} Connect_Common_Call; + +typedef struct +{ + Connect_Common_Call Common; + /* [string] */ CHAR* szReader; +} ConnectA_Call; + +typedef struct +{ + Connect_Common_Call Common; + /* [string] */ WCHAR* szReader; +} ConnectW_Call; + +typedef struct +{ + Handles_Call handles; + DWORD dwShareMode; + DWORD dwPreferredProtocols; + DWORD dwInitialization; +} Reconnect_Call; + +typedef struct +{ + Handles_Call handles; + DWORD dwDisposition; +} HCardAndDisposition_Call; + +typedef struct +{ + Handles_Call handles; + LONG fpbAtrIsNULL; + DWORD cbAtrLen; +} State_Call; + +typedef struct +{ + Handles_Call handles; + LONG fmszReaderNamesIsNULL; + DWORD cchReaderLen; + DWORD cbAtrLen; +} Status_Call; + +typedef struct +{ + Handles_Call handles; + LPSCARD_IO_REQUEST pioSendPci; + /* [range] */ DWORD cbSendLength; + /* [size_is] */ BYTE* pbSendBuffer; + /* [unique] */ LPSCARD_IO_REQUEST pioRecvPci; + LONG fpbRecvBufferIsNULL; + DWORD cbRecvLength; +} Transmit_Call; + +typedef struct +{ + Handles_Call handles; + LONG LongValue; +} Long_Call; + +typedef struct +{ + Handles_Call handles; +} Context_Call; + +typedef struct +{ + Handles_Call handles; + /* [string] */ char* sz; +} ContextAndStringA_Call; + +typedef struct +{ + Handles_Call handles; + /* [string] */ WCHAR* sz; +} ContextAndStringW_Call; + +typedef struct +{ + Handles_Call handles; + /* [string] */ char* sz1; + /* [string] */ char* sz2; +} ContextAndTwoStringA_Call; + +typedef struct +{ + Handles_Call handles; + /* [string] */ WCHAR* sz1; + /* [string] */ WCHAR* sz2; +} ContextAndTwoStringW_Call; + +typedef struct +{ + Handles_Call handles; + DWORD dwScope; +} EstablishContext_Call; + +typedef struct +{ + Handles_Call handles; +} GetTransmitCount_Call; + +typedef struct +{ + Handles_Call handles; + DWORD dwControlCode; + /* [range] */ DWORD cbInBufferSize; + /* [size_is][unique] */ BYTE* pvInBuffer; + LONG fpvOutBufferIsNULL; + DWORD cbOutBufferSize; +} Control_Call; + +typedef struct +{ + Handles_Call handles; + DWORD dwAttrId; + LONG fpbAttrIsNULL; + DWORD cbAttrLen; +} GetAttrib_Call; + +typedef struct +{ + Handles_Call handles; + DWORD dwAttrId; + /* [range] */ DWORD cbAttrLen; + /* [size_is] */ BYTE* pbAttr; +} SetAttrib_Call; + +typedef struct +{ + Handles_Call handles; + UUID* CardIdentifier; + DWORD FreshnessCounter; + LONG fPbDataIsNULL; + DWORD cbDataLen; +} ReadCache_Common; + +typedef struct +{ + ReadCache_Common Common; + /* [string] */ char* szLookupName; +} ReadCacheA_Call; + +typedef struct +{ + ReadCache_Common Common; + /* [string] */ WCHAR* szLookupName; +} ReadCacheW_Call; + +typedef struct +{ + Handles_Call handles; + UUID* CardIdentifier; + DWORD FreshnessCounter; + /* [range] */ DWORD cbDataLen; + /* [size_is][unique] */ BYTE* pbData; +} WriteCache_Common; + +typedef struct +{ + WriteCache_Common Common; + /* [string] */ char* szLookupName; +} WriteCacheA_Call; + +typedef struct +{ + WriteCache_Common Common; + /* [string] */ WCHAR* szLookupName; +} WriteCacheW_Call; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_SCARD_H */ diff --git a/include/freerdp/channels/telemetry.h b/include/freerdp/channels/telemetry.h new file mode 100644 index 0000000..cf96d6d --- /dev/null +++ b/include/freerdp/channels/telemetry.h @@ -0,0 +1,47 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Telemetry Virtual Channel Extension + * + * Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_TELEMETRY_H +#define FREERDP_CHANNEL_TELEMETRY_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define TELEMETRY_CHANNEL_NAME "telemetry" +#define TELEMETRY_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Telemetry" + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + UINT32 PromptForCredentialsMillis; + UINT32 PromptForCredentialsDoneMillis; + UINT32 GraphicsChannelOpenedMillis; + UINT32 FirstGraphicsReceivedMillis; + } TELEMETRY_RDP_TELEMETRY_PDU; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_TELEMETRY_H */ diff --git a/include/freerdp/channels/tsmf.h b/include/freerdp/channels/tsmf.h new file mode 100644 index 0000000..aa943c9 --- /dev/null +++ b/include/freerdp/channels/tsmf.h @@ -0,0 +1,36 @@ +/* + * FreeRDP: A Remote Desktop Protocol Implementation + * Video Redirection Virtual Channel - Callback interface + * + * (C) Copyright 2014 Thincast Technologies GmbH + * (C) Copyright 2014 Armin Novak <armin.novak@thincast.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. + */ + +/* DEPRECATION WARNING: + * + * This channel is unmaintained and not used since windows 7. + * Only compile and use it if absolutely necessary, otherwise + * deactivate it or use the newer [MS-RDPEVOR] video redirection. + */ + +#ifndef FREERDP_CHANNEL_TSMF_H +#define FREERDP_CHANNEL_TSMF_H + +#include <freerdp/types.h> + +#define TSMF_CHANNEL_NAME "tsmf" +#define TSMF_DVC_CHANNEL_NAME "TSMF" + +#endif /* FREERDP_CHANNEL_TSMF_H */ diff --git a/include/freerdp/channels/urbdrc.h b/include/freerdp/channels/urbdrc.h new file mode 100644 index 0000000..f3d918d --- /dev/null +++ b/include/freerdp/channels/urbdrc.h @@ -0,0 +1,31 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Server USB redirection Virtual Channel + * + * Copyright 2019 Armin Novak <armin.novak@thincast.com> + * Copyright 2019 Thincast Technologies GmbH + * + * 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_CHANNEL_URBDRC_H +#define FREERDP_CHANNEL_URBDRC_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/types.h> + +#define URBDRC_CHANNEL_NAME "urbdrc" +#define URBDRC_DVC_CHANNEL_NAME "urbdrc" + +#endif /* FREERDP_CHANNEL_URBDRC_H */ diff --git a/include/freerdp/channels/video.h b/include/freerdp/channels/video.h new file mode 100644 index 0000000..b552475 --- /dev/null +++ b/include/freerdp/channels/video.h @@ -0,0 +1,122 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Video Optimized Remoting Virtual Channel Extension + * + * Copyright 2018 David Fort <contact@hardening-consulting.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_CHANNEL_VIDEO_H +#define FREERDP_CHANNEL_VIDEO_H + +#include <winpr/wtypes.h> +#include <freerdp/types.h> + +#define VIDEO_CHANNEL_NAME "video" +#define VIDEO_CONTROL_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Video::Control::v08.01" +#define VIDEO_DATA_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::Video::Data::v08.01" + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** @brief TSNM packet type */ + enum + { + TSMM_PACKET_TYPE_PRESENTATION_REQUEST = 1, + TSMM_PACKET_TYPE_PRESENTATION_RESPONSE = 2, + TSMM_PACKET_TYPE_CLIENT_NOTIFICATION = 3, + TSMM_PACKET_TYPE_VIDEO_DATA = 4 + }; + + /** @brief TSMM_PRESENTATION_REQUEST commands */ + enum + { + TSMM_START_PRESENTATION = 1, + TSMM_STOP_PRESENTATION = 2 + }; + + /** @brief presentation request struct */ + typedef struct + { + BYTE PresentationId; + BYTE Version; + BYTE Command; + BYTE FrameRate; + UINT32 SourceWidth, SourceHeight; + UINT32 ScaledWidth, ScaledHeight; + UINT64 hnsTimestampOffset; + UINT64 GeometryMappingId; + BYTE VideoSubtypeId[16]; + UINT32 cbExtra; + BYTE* pExtraData; + } TSMM_PRESENTATION_REQUEST; + + /** @brief response to a TSMM_PRESENTATION_REQUEST */ + typedef struct + { + BYTE PresentationId; + } TSMM_PRESENTATION_RESPONSE; + + /** @brief TSMM_VIDEO_DATA flags */ + enum + { + TSMM_VIDEO_DATA_FLAG_HAS_TIMESTAMPS = 0x01, + TSMM_VIDEO_DATA_FLAG_KEYFRAME = 0x02, + TSMM_VIDEO_DATA_FLAG_NEW_FRAMERATE = 0x04 + }; + + /** @brief a video data packet */ + typedef struct + { + BYTE PresentationId; + BYTE Version; + BYTE Flags; + UINT64 hnsTimestamp; + UINT64 hnsDuration; + UINT16 CurrentPacketIndex; + UINT16 PacketsInSample; + UINT32 SampleNumber; + UINT32 cbSample; + BYTE* pSample; + } TSMM_VIDEO_DATA; + + /** @brief values for NotificationType in TSMM_CLIENT_NOTIFICATION */ + enum + { + TSMM_CLIENT_NOTIFICATION_TYPE_NETWORK_ERROR = 1, + TSMM_CLIENT_NOTIFICATION_TYPE_FRAMERATE_OVERRIDE = 2 + }; + + /** @brief struct used when NotificationType is FRAMERATE_OVERRIDE */ + typedef struct + { + UINT32 Flags; + UINT32 DesiredFrameRate; + } TSMM_CLIENT_NOTIFICATION_FRAMERATE_OVERRIDE; + + /** @brief a client to server notification struct */ + typedef struct + { + BYTE PresentationId; + BYTE NotificationType; + TSMM_CLIENT_NOTIFICATION_FRAMERATE_OVERRIDE FramerateOverride; + } TSMM_CLIENT_NOTIFICATION; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_VIDEO_H */ diff --git a/include/freerdp/channels/wtsvc.h b/include/freerdp/channels/wtsvc.h new file mode 100644 index 0000000..db7feac --- /dev/null +++ b/include/freerdp/channels/wtsvc.h @@ -0,0 +1,98 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Server Virtual Channel Interface + * + * Copyright 2011-2012 Vic Lee + * + * 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. + */ + +/** + * The server-side virtual channel API follows the Microsoft Remote Desktop + * Services API functions WTSVirtualChannel* defined in: + * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383464.aspx + * + * Difference between the MS API are documented in this header. All functions + * are implemented in and integrated with libfreerdp-channels. + * + * Unlike MS API, all functions except WTSVirtualChannelOpenEx in this + * implementation are thread-safe. + */ + +#ifndef FREERDP_WTSVC_H +#define FREERDP_WTSVC_H + +#include <freerdp/types.h> +#include <freerdp/peer.h> + +#include <winpr/winpr.h> +#include <winpr/wtypes.h> +#include <winpr/wtsapi.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + enum + { + DRDYNVC_STATE_NONE = 0, + DRDYNVC_STATE_INITIALIZED = 1, + DRDYNVC_STATE_READY = 2, + DRDYNVC_STATE_FAILED = 3 + }; + + typedef BOOL (*psDVCCreationStatusCallback)(void* userdata, UINT32 channelId, + INT32 creationStatus); + + /** + * WTSVirtualChannelManager functions are FreeRDP extensions to the API. + */ +#if defined(WITH_FREERDP_DEPRECATED) + FREERDP_API WINPR_DEPRECATED_VAR( + "Use WTSVirtualChannelManagerGetEventHandle", + void WTSVirtualChannelManagerGetFileDescriptor(HANDLE hServer, void** fds, int* fds_count)); +#endif + FREERDP_API BOOL WTSVirtualChannelManagerOpen(HANDLE hServer); + FREERDP_API BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer); + FREERDP_API BOOL WTSVirtualChannelManagerCheckFileDescriptorEx(HANDLE hServer, BOOL autoOpen); + FREERDP_API HANDLE WTSVirtualChannelManagerGetEventHandle(HANDLE hServer); + FREERDP_API BOOL WTSVirtualChannelManagerIsChannelJoined(HANDLE hServer, const char* name); + FREERDP_API BYTE WTSVirtualChannelManagerGetDrdynvcState(HANDLE hServer); + FREERDP_API void WTSVirtualChannelManagerSetDVCCreationCallback(HANDLE hServer, + psDVCCreationStatusCallback cb, + void* userdata); + + /** + * Extended FreeRDP WTS functions for channel handling + */ + FREERDP_API UINT16 WTSChannelGetId(freerdp_peer* client, const char* channel_name); + FREERDP_API BOOL WTSIsChannelJoinedByName(freerdp_peer* client, const char* channel_name); + FREERDP_API BOOL WTSIsChannelJoinedById(freerdp_peer* client, const UINT16 channel_id); + FREERDP_API BOOL WTSChannelSetHandleByName(freerdp_peer* client, const char* channel_name, + void* handle); + FREERDP_API BOOL WTSChannelSetHandleById(freerdp_peer* client, const UINT16 channel_id, + void* handle); + FREERDP_API void* WTSChannelGetHandleByName(freerdp_peer* client, const char* channel_name); + FREERDP_API void* WTSChannelGetHandleById(freerdp_peer* client, const UINT16 channel_id); + FREERDP_API const char* WTSChannelGetName(freerdp_peer* client, UINT16 channel_id); + FREERDP_API char** WTSGetAcceptedChannelNames(freerdp_peer* client, size_t* count); + FREERDP_API INT64 WTSChannelGetOptions(freerdp_peer* client, UINT16 channel_id); + + FREERDP_API UINT32 WTSChannelGetIdByHandle(HANDLE hChannelHandle); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_WTSVC_H */ diff --git a/include/freerdp/client.h b/include/freerdp/client.h new file mode 100644 index 0000000..d30c417 --- /dev/null +++ b/include/freerdp/client.h @@ -0,0 +1,302 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Client Interface + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.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_CLIENT_H +#define FREERDP_CLIENT_H + +#include <freerdp/config.h> +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/event.h> +#include <freerdp/freerdp.h> + +#if defined(CHANNEL_AINPUT_CLIENT) +#include <freerdp/client/ainput.h> +#endif + +#if defined(CHANNEL_RDPEI_CLIENT) +#include <freerdp/client/rdpei.h> +#endif + +#if defined(CHANNEL_ENCOMSP_CLIENT) +#include <freerdp/client/encomsp.h> +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Client Entry Points + */ + + typedef BOOL (*pRdpGlobalInit)(void); + typedef void (*pRdpGlobalUninit)(void); + + typedef BOOL (*pRdpClientNew)(freerdp* instance, rdpContext* context); + typedef void (*pRdpClientFree)(freerdp* instance, rdpContext* context); + + typedef int (*pRdpClientStart)(rdpContext* context); + typedef int (*pRdpClientStop)(rdpContext* context); + + struct rdp_client_entry_points_v1 + { + DWORD Size; + DWORD Version; + + rdpSettings* settings; + + pRdpGlobalInit GlobalInit; + pRdpGlobalUninit GlobalUninit; + + DWORD ContextSize; + pRdpClientNew ClientNew; + pRdpClientFree ClientFree; + + pRdpClientStart ClientStart; + pRdpClientStop ClientStop; + }; + +#define RDP_CLIENT_INTERFACE_VERSION 1 +#define RDP_CLIENT_ENTRY_POINT_NAME "RdpClientEntry" + + typedef int (*pRdpClientEntry)(RDP_CLIENT_ENTRY_POINTS* pEntryPoints); + + /* Common Client Interface */ +#define FREERDP_MAX_TOUCH_CONTACTS 10 + + typedef struct + { + ALIGN64 INT32 id; + ALIGN64 UINT32 count; + ALIGN64 INT32 x; + ALIGN64 INT32 y; + ALIGN64 UINT32 flags; + ALIGN64 UINT32 pressure; + } FreeRDP_TouchContact; + +#define FREERDP_MAX_PEN_DEVICES 10 + + typedef struct pen_device + { + ALIGN64 INT32 deviceid; + ALIGN64 UINT32 flags; + ALIGN64 double max_pressure; + ALIGN64 BOOL hovering; + ALIGN64 BOOL pressed; + ALIGN64 INT32 last_x; + ALIGN64 INT32 last_y; + } FreeRDP_PenDevice; + + struct rdp_client_context + { + rdpContext context; + ALIGN64 HANDLE thread; /**< (offset 0) */ +#if defined(CHANNEL_AINPUT_CLIENT) + ALIGN64 AInputClientContext* ainput; /**< (offset 1) */ +#else + UINT64 reserved1; +#endif + +#if defined(CHANNEL_RDPEI_CLIENT) + ALIGN64 RdpeiClientContext* rdpei; /**< (offset 2) */ +#else + UINT64 reserved2; +#endif + + ALIGN64 INT32 lastX; /**< (offset 3) */ + ALIGN64 INT32 lastY; /**< (offset 4) */ + ALIGN64 BOOL mouse_grabbed; /** < (offset 5) */ + +#if defined(CHANNEL_ENCOMSP_CLIENT) + ALIGN64 EncomspClientContext* encomsp; /** < (offset 6) */ + ALIGN64 BOOL controlToggle; /**< (offset 7) */ +#else + UINT64 reserved3[2]; +#endif + ALIGN64 FreeRDP_TouchContact contacts[FREERDP_MAX_TOUCH_CONTACTS]; /**< (offset 8) */ + ALIGN64 FreeRDP_PenDevice pens[FREERDP_MAX_PEN_DEVICES]; /**< (offset 9) */ + UINT64 reserved[128 - 9]; /**< (offset 9) */ + }; + + /* Common client functions */ + + FREERDP_API void freerdp_client_context_free(rdpContext* context); + + WINPR_ATTR_MALLOC(freerdp_client_context_free, 1) + FREERDP_API rdpContext* freerdp_client_context_new(const RDP_CLIENT_ENTRY_POINTS* pEntryPoints); + + FREERDP_API int freerdp_client_start(rdpContext* context); + FREERDP_API int freerdp_client_stop(rdpContext* context); + + FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* context); + FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context); + + FREERDP_API int freerdp_client_settings_parse_command_line(rdpSettings* settings, int argc, + char** argv, BOOL allowUnknown); + + FREERDP_API int freerdp_client_settings_parse_connection_file(rdpSettings* settings, + const char* filename); + FREERDP_API int freerdp_client_settings_parse_connection_file_buffer(rdpSettings* settings, + const BYTE* buffer, + size_t size); + FREERDP_API int freerdp_client_settings_write_connection_file(const rdpSettings* settings, + const char* filename, + BOOL unicode); + + FREERDP_API int freerdp_client_settings_parse_assistance_file(rdpSettings* settings, int argc, + char* argv[]); + + FREERDP_API BOOL client_cli_authenticate_ex(freerdp* instance, char** username, char** password, + char** domain, rdp_auth_reason reason); + + FREERDP_API BOOL client_cli_choose_smartcard(freerdp* instance, SmartcardCertInfo** cert_list, + DWORD count, DWORD* choice, BOOL gateway); + + FREERDP_API int client_cli_logon_error_info(freerdp* instance, UINT32 data, UINT32 type); + + FREERDP_API BOOL client_cli_get_access_token(freerdp* instance, AccessTokenType tokenType, + char** token, size_t count, ...); + FREERDP_API BOOL client_common_get_access_token(freerdp* instance, const char* request, + char** token); + + FREERDP_API SSIZE_T client_common_retry_dialog(freerdp* instance, const char* what, + size_t current, void* userarg); + + FREERDP_API void + freerdp_client_OnChannelConnectedEventHandler(void* context, + const ChannelConnectedEventArgs* e); + FREERDP_API void + freerdp_client_OnChannelDisconnectedEventHandler(void* context, + const ChannelDisconnectedEventArgs* e); + +#if defined(WITH_FREERDP_DEPRECATED) + FREERDP_API WINPR_DEPRECATED_VAR("Use client_cli_authenticate_ex", + BOOL client_cli_authenticate(freerdp* instance, + char** username, char** password, + char** domain)); + FREERDP_API + WINPR_DEPRECATED_VAR("Use client_cli_authenticate_ex", + BOOL client_cli_gw_authenticate(freerdp* instance, char** username, + char** password, char** domain)); + + FREERDP_API WINPR_DEPRECATED_VAR( + "Use client_cli_verify_certificate_ex", + DWORD client_cli_verify_certificate(freerdp* instance, const char* common_name, + const char* subject, const char* issuer, + const char* fingerprint, BOOL host_mismatch)); +#endif + + FREERDP_API DWORD client_cli_verify_certificate_ex(freerdp* instance, const char* host, + UINT16 port, const char* common_name, + const char* subject, const char* issuer, + const char* fingerprint, DWORD flags); + +#if defined(WITH_FREERDP_DEPRECATED) + FREERDP_API WINPR_DEPRECATED_VAR("Use client_cli_verify_changed_certificate_ex", + DWORD client_cli_verify_changed_certificate( + freerdp* instance, const char* common_name, + const char* subject, const char* issuer, + const char* fingerprint, const char* old_subject, + const char* old_issuer, const char* old_fingerprint)); +#endif + + FREERDP_API DWORD client_cli_verify_changed_certificate_ex( + freerdp* instance, const char* host, UINT16 port, const char* common_name, + const char* subject, const char* issuer, const char* fingerprint, const char* old_subject, + const char* old_issuer, const char* old_fingerprint, DWORD flags); + + FREERDP_API BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, + BOOL isDisplayMandatory, + BOOL isConsentMandatory, size_t length, + const WCHAR* message); + + FREERDP_API BOOL client_auto_reconnect(freerdp* instance); + FREERDP_API BOOL client_auto_reconnect_ex(freerdp* instance, + BOOL (*window_events)(freerdp* instance)); + + typedef enum + { + FREERDP_TOUCH_DOWN = 0x01, + FREERDP_TOUCH_UP = 0x02, + FREERDP_TOUCH_MOTION = 0x04, + FREERDP_TOUCH_HAS_PRESSURE = 0x100 + } FreeRDPTouchEventType; + + FREERDP_API BOOL freerdp_client_handle_touch(rdpClientContext* cctx, UINT32 flags, INT32 finger, + UINT32 pressure, INT32 x, INT32 y); + + typedef enum + { + FREERDP_PEN_REGISTER = 0x01, + FREERDP_PEN_ERASER_PRESSED = 0x02, + FREERDP_PEN_PRESS = 0x04, + FREERDP_PEN_MOTION = 0x08, + FREERDP_PEN_RELEASE = 0x10, + FREERDP_PEN_BARREL_PRESSED = 0x20, + FREERDP_PEN_HAS_PRESSURE = 0x40, + FREERDP_PEN_HAS_ROTATION = 0x80, + FREERDP_PEN_HAS_TILTX = 0x100, + FREERDP_PEN_HAS_TILTY = 0x200, + FREERDP_PEN_IS_INVERTED = 0x400 + } FreeRDPPenEventType; + + FREERDP_API BOOL freerdp_client_handle_pen(rdpClientContext* cctx, UINT32 flags, INT32 deviceid, + ...); + FREERDP_API BOOL freerdp_client_is_pen(rdpClientContext* cctx, INT32 deviceid); + + FREERDP_API BOOL freerdp_client_pen_cancel_all(rdpClientContext* cctx); + + FREERDP_API BOOL freerdp_client_send_wheel_event(rdpClientContext* cctx, UINT16 mflags); + + FREERDP_API BOOL freerdp_client_send_mouse_event(rdpClientContext* cctx, UINT64 mflags, INT32 x, + INT32 y); + + /** @brief this function checks if relative mouse events are supported and enabled for this + * session. + * + * @param cctx The \b rdpClientContext to check + * + * @return \b TRUE if relative mouse events are to be sent, \b FALSE otherwise + */ + FREERDP_API BOOL freerdp_client_use_relative_mouse_events(rdpClientContext* cctx); + + FREERDP_API BOOL freerdp_client_send_button_event(rdpClientContext* cctx, BOOL relative, + UINT16 mflags, INT32 x, INT32 y); + + FREERDP_API BOOL freerdp_client_send_extended_button_event(rdpClientContext* cctx, + BOOL relative, UINT16 mflags, + INT32 x, INT32 y); + + FREERDP_API int freerdp_client_common_stop(rdpContext* context); + + FREERDP_API BOOL freerdp_client_load_channels(freerdp* instance); + +#if defined(CHANNEL_ENCOMSP_CLIENT) + FREERDP_API BOOL freerdp_client_encomsp_toggle_control(EncomspClientContext* encomsp); + FREERDP_API BOOL freerdp_client_encomsp_set_control(EncomspClientContext* encomsp, + BOOL control); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CLIENT_H */ diff --git a/include/freerdp/client/ainput.h b/include/freerdp/client/ainput.h new file mode 100644 index 0000000..c432677 --- /dev/null +++ b/include/freerdp/client/ainput.h @@ -0,0 +1,48 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Display Update Virtual Channel Extension + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_AINPUT_CLIENT_AINPUT_H +#define FREERDP_CHANNEL_AINPUT_CLIENT_AINPUT_H + +#include <winpr/assert.h> +#include <freerdp/channels/ainput.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef UINT (*pcAInputSendInputEvent)(AInputClientContext* context, UINT64 flags, INT32 x, + INT32 y); + + struct ainput_client_context + { + void* handle; + void* custom; + + pcAInputSendInputEvent AInputSendInputEvent; + }; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_AINPUT_CLIENT_AINPUT_H */ diff --git a/include/freerdp/client/audin.h b/include/freerdp/client/audin.h new file mode 100644 index 0000000..604b60e --- /dev/null +++ b/include/freerdp/client/audin.h @@ -0,0 +1,73 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Audio Input Redirection Virtual Channel + * + * Copyright 2010-2011 Vic Lee + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_AUDIN_CLIENT_AUDIN_H +#define FREERDP_CHANNEL_AUDIN_CLIENT_AUDIN_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/channels/audin.h> +#include <freerdp/codec/audio.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Subsystem Interface + */ + + typedef UINT (*AudinReceive)(const AUDIO_FORMAT* format, const BYTE* data, size_t size, + void* userData); + + typedef struct s_IAudinDevice IAudinDevice; + struct s_IAudinDevice + { + UINT (*Open)(IAudinDevice* devplugin, AudinReceive receive, void* userData); + BOOL (*FormatSupported)(IAudinDevice* devplugin, const AUDIO_FORMAT* format); + UINT(*SetFormat) + (IAudinDevice* devplugin, const AUDIO_FORMAT* format, UINT32 FramesPerPacket); + UINT (*Close)(IAudinDevice* devplugin); + UINT (*Free)(IAudinDevice* devplugin); + }; + +#define AUDIN_DEVICE_EXPORT_FUNC_NAME "freerdp_audin_client_subsystem_entry" + +typedef UINT (*PREGISTERAUDINDEVICE)(IWTSPlugin* plugin, IAudinDevice* device); + +typedef struct +{ + IWTSPlugin* plugin; + PREGISTERAUDINDEVICE pRegisterAudinDevice; + const ADDIN_ARGV* args; + rdpContext* rdpcontext; +} FREERDP_AUDIN_DEVICE_ENTRY_POINTS; +typedef FREERDP_AUDIN_DEVICE_ENTRY_POINTS* PFREERDP_AUDIN_DEVICE_ENTRY_POINTS; + +typedef UINT (*PFREERDP_AUDIN_DEVICE_ENTRY)(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_AUDIN_CLIENT_AUDIN_H */ diff --git a/include/freerdp/client/channels.h b/include/freerdp/client/channels.h new file mode 100644 index 0000000..cfdc866 --- /dev/null +++ b/include/freerdp/client/channels.h @@ -0,0 +1,94 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Client Channels + * + * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_CHANNELS_CLIENT_H +#define FREERDP_CHANNELS_CLIENT_H + +#include <freerdp/api.h> +#include <freerdp/dvc.h> +#include <freerdp/config.h> +#include <freerdp/addin.h> +#include <freerdp/channels/channels.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + IWTSVirtualChannelCallback iface; + IWTSPlugin* plugin; + IWTSVirtualChannelManager* channel_mgr; + IWTSVirtualChannel* channel; + } GENERIC_CHANNEL_CALLBACK; + + typedef struct + { + IWTSListenerCallback iface; + IWTSPlugin* plugin; + IWTSVirtualChannelManager* channel_mgr; + IWTSVirtualChannel* channel; + GENERIC_CHANNEL_CALLBACK* channel_callback; + } GENERIC_LISTENER_CALLBACK; + + typedef struct GENERIC_DYNVC_PLUGIN GENERIC_DYNVC_PLUGIN; + typedef UINT (*DYNVC_PLUGIN_INIT_FN)(GENERIC_DYNVC_PLUGIN* plugin, rdpContext* context, + rdpSettings* settings); + typedef void (*DYNVC_PLUGIN_TERMINATE_FN)(GENERIC_DYNVC_PLUGIN* plugin); + + struct GENERIC_DYNVC_PLUGIN + { + IWTSPlugin iface; + GENERIC_LISTENER_CALLBACK* listener_callback; + IWTSListener* listener; + BOOL attached; + BOOL initialized; + wLog* log; + char* dynvc_name; + size_t channelCallbackSize; + const IWTSVirtualChannelCallback* channel_callbacks; + DYNVC_PLUGIN_TERMINATE_FN terminatePluginFn; + }; + +#if defined(WITH_CHANNELS) + FREERDP_API void* freerdp_channels_client_find_static_entry(const char* name, + const char* identifier); + FREERDP_API PVIRTUALCHANNELENTRY freerdp_channels_load_static_addin_entry(LPCSTR pszName, + LPCSTR pszSubsystem, + LPCSTR pszType, + DWORD dwFlags); + + FREERDP_API FREERDP_ADDIN** freerdp_channels_list_addins(LPCSTR lpName, LPCSTR lpSubsystem, + LPCSTR lpType, DWORD dwFlags); + FREERDP_API void freerdp_channels_addin_list_free(FREERDP_ADDIN** ppAddins); + + FREERDP_API BOOL freerdp_initialize_generic_dynvc_plugin(GENERIC_DYNVC_PLUGIN* plugin); + FREERDP_API UINT freerdp_generic_DVCPluginEntry( + IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* logTag, const char* name, + size_t pluginSize, size_t channelCallbackSize, + const IWTSVirtualChannelCallback* channel_callbacks, DYNVC_PLUGIN_INIT_FN initPluginFn, + DYNVC_PLUGIN_TERMINATE_FN terminatePluginFn); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNELS_CLIENT_H */ diff --git a/include/freerdp/client/client_cliprdr_file.h b/include/freerdp/client/client_cliprdr_file.h new file mode 100644 index 0000000..6dca587 --- /dev/null +++ b/include/freerdp/client/client_cliprdr_file.h @@ -0,0 +1,105 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * X11 Clipboard Redirection + * + * Copyright 2010-2011 Vic Lee + * Copyright 2023 Armin Novak <armin.novak@thincst.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_CLIENT_X11_CLIPRDR_FILE_H +#define FREERDP_CLIENT_X11_CLIPRDR_FILE_H + +#include <winpr/clipboard.h> + +#include <freerdp/client/cliprdr.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct cliprdr_file_context CliprdrFileContext; + + FREERDP_API void cliprdr_file_context_free(CliprdrFileContext* file); + + WINPR_ATTR_MALLOC(cliprdr_file_context_free, 1) + FREERDP_API CliprdrFileContext* cliprdr_file_context_new(void* context); + + /**! \brief returns if the implementation supports pasting files in a client file browser. + * + * \param file the file context to query + * + * \return \b TRUE if files can be pasted locally, \b FALSE if not (e.g. no FUSE, ...) + */ + FREERDP_API BOOL cliprdr_file_context_has_local_support(CliprdrFileContext* file); + + /**! \brief sets state of local file paste support + * + * \param file the file context to update + * \param available \b TRUE if the client supports pasting files to local file browsers, \b + * FALSE otherwise + * + * \return \b TRUE for success, \b FALSE otherwise + */ + FREERDP_API BOOL cliprdr_file_context_set_locally_available(CliprdrFileContext* file, + BOOL available); + FREERDP_API BOOL cliprdr_file_context_remote_set_flags(CliprdrFileContext* file, UINT32 flags); + FREERDP_API UINT32 cliprdr_file_context_remote_get_flags(CliprdrFileContext* file); + + FREERDP_API UINT32 cliprdr_file_context_current_flags(CliprdrFileContext* file); + + FREERDP_API void* cliprdr_file_context_get_context(CliprdrFileContext* file); + + FREERDP_API BOOL cliprdr_file_context_init(CliprdrFileContext* file, + CliprdrClientContext* cliprdr); + FREERDP_API BOOL cliprdr_file_context_uninit(CliprdrFileContext* file, + CliprdrClientContext* cliprdr); + + FREERDP_API BOOL cliprdr_file_context_clear(CliprdrFileContext* file); + + FREERDP_API UINT + cliprdr_file_context_notify_new_server_format_list(CliprdrFileContext* file_context); + + FREERDP_API UINT + cliprdr_file_context_notify_new_client_format_list(CliprdrFileContext* file_context); + + /** \brief updates the files the client announces to the server + * + * \param file the file context to update + * \param data the file list + * \param count the length of the file list + * + * \return \b TRUE for success, \b FALSE otherwise + */ + FREERDP_API BOOL cliprdr_file_context_update_client_data(CliprdrFileContext* file, + const char* data, size_t count); + /** \brief updates the files the server announces to the client + * + * \param file the file context to update + * \param clip the clipboard instance to use + * \param data the file list [MS-RDPECLIP] 2.2.5.2.3 Packed File List (CLIPRDR_FILELIST) + * \param size the length of the file list + * + * \return \b TRUE for success, \b FALSE otherwise + */ + FREERDP_API BOOL cliprdr_file_context_update_server_data(CliprdrFileContext* file, + wClipboard* clip, const void* data, + size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CLIENT_X11_CLIPRDR_FILE_H */ diff --git a/include/freerdp/client/cliprdr.h b/include/freerdp/client/cliprdr.h new file mode 100644 index 0000000..5d1073b --- /dev/null +++ b/include/freerdp/client/cliprdr.h @@ -0,0 +1,201 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Clipboard Virtual Channel Extension + * + * Copyright 2011 Vic Lee + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_CLIPRDR_CLIENT_CLIPRDR_H +#define FREERDP_CHANNEL_CLIPRDR_CLIENT_CLIPRDR_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/message.h> +#include <freerdp/channels/cliprdr.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Client Interface + */ + + typedef struct s_cliprdr_client_context CliprdrClientContext; + + typedef UINT (*pcCliprdrServerCapabilities)(CliprdrClientContext* context, + const CLIPRDR_CAPABILITIES* capabilities); + typedef UINT (*pcCliprdrClientCapabilities)(CliprdrClientContext* context, + const CLIPRDR_CAPABILITIES* capabilities); + typedef UINT (*pcCliprdrMonitorReady)(CliprdrClientContext* context, + const CLIPRDR_MONITOR_READY* monitorReady); + typedef UINT (*pcCliprdrTempDirectory)(CliprdrClientContext* context, + const CLIPRDR_TEMP_DIRECTORY* tempDirectory); + typedef UINT (*pcCliprdrClientFormatList)(CliprdrClientContext* context, + const CLIPRDR_FORMAT_LIST* formatList); + typedef UINT (*pcCliprdrServerFormatList)(CliprdrClientContext* context, + const CLIPRDR_FORMAT_LIST* formatList); + typedef UINT (*pcCliprdrClientFormatListResponse)( + CliprdrClientContext* context, const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse); + typedef UINT (*pcCliprdrServerFormatListResponse)( + CliprdrClientContext* context, const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse); + typedef UINT (*pcCliprdrClientLockClipboardData)( + CliprdrClientContext* context, const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData); + typedef UINT (*pcCliprdrServerLockClipboardData)( + CliprdrClientContext* context, const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData); + typedef UINT (*pcCliprdrClientUnlockClipboardData)( + CliprdrClientContext* context, const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData); + typedef UINT (*pcCliprdrServerUnlockClipboardData)( + CliprdrClientContext* context, const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData); + typedef UINT (*pcCliprdrClientFormatDataRequest)( + CliprdrClientContext* context, const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest); + typedef UINT (*pcCliprdrServerFormatDataRequest)( + CliprdrClientContext* context, const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest); + typedef UINT (*pcCliprdrClientFormatDataResponse)( + CliprdrClientContext* context, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse); + typedef UINT (*pcCliprdrServerFormatDataResponse)( + CliprdrClientContext* context, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse); + typedef UINT (*pcCliprdrClientFileContentsRequest)( + CliprdrClientContext* context, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest); + typedef UINT (*pcCliprdrServerFileContentsRequest)( + CliprdrClientContext* context, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest); + typedef UINT (*pcCliprdrClientFileContentsResponse)( + CliprdrClientContext* context, const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse); + typedef UINT (*pcCliprdrServerFileContentsResponse)( + CliprdrClientContext* context, const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse); + + struct s_cliprdr_client_context + { + void* handle; + void* custom; + + pcCliprdrServerCapabilities ServerCapabilities; + pcCliprdrClientCapabilities ClientCapabilities; + pcCliprdrMonitorReady MonitorReady; + pcCliprdrTempDirectory TempDirectory; + pcCliprdrClientFormatList ClientFormatList; + pcCliprdrServerFormatList ServerFormatList; + pcCliprdrClientFormatListResponse ClientFormatListResponse; + pcCliprdrServerFormatListResponse ServerFormatListResponse; + pcCliprdrClientLockClipboardData ClientLockClipboardData; + pcCliprdrServerLockClipboardData ServerLockClipboardData; + pcCliprdrClientUnlockClipboardData ClientUnlockClipboardData; + pcCliprdrServerUnlockClipboardData ServerUnlockClipboardData; + pcCliprdrClientFormatDataRequest ClientFormatDataRequest; + pcCliprdrServerFormatDataRequest ServerFormatDataRequest; + pcCliprdrClientFormatDataResponse ClientFormatDataResponse; + pcCliprdrServerFormatDataResponse ServerFormatDataResponse; + pcCliprdrClientFileContentsRequest ClientFileContentsRequest; + pcCliprdrServerFileContentsRequest ServerFileContentsRequest; + pcCliprdrClientFileContentsResponse ClientFileContentsResponse; + pcCliprdrServerFileContentsResponse ServerFileContentsResponse; + + UINT32 lastRequestedFormatId; + rdpContext* rdpcontext; + }; + + typedef struct + { + UINT32 id; + char* name; + int length; + } CLIPRDR_FORMAT_NAME; + + /** + * Clipboard Events + */ + + typedef struct + { + wMessage event; + UINT32 capabilities; + } RDP_CB_CLIP_CAPS; + + typedef struct + { + wMessage event; + UINT32 capabilities; + } RDP_CB_MONITOR_READY_EVENT; + + typedef struct + { + wMessage event; + UINT32* formats; + UINT16 num_formats; + BYTE* raw_format_data; + UINT32 raw_format_data_size; + BOOL raw_format_unicode; + } RDP_CB_FORMAT_LIST_EVENT; + + typedef struct + { + wMessage event; + UINT32 format; + } RDP_CB_DATA_REQUEST_EVENT; + + typedef struct + { + wMessage event; + BYTE* data; + UINT32 size; + } RDP_CB_DATA_RESPONSE_EVENT; + + typedef struct + { + wMessage event; + UINT32 streamId; + UINT32 lindex; + UINT32 dwFlags; + UINT32 nPositionLow; + UINT32 nPositionHigh; + UINT32 cbRequested; + UINT32 clipDataId; + } RDP_CB_FILECONTENTS_REQUEST_EVENT; + + typedef struct + { + wMessage event; + BYTE* data; + UINT32 size; + UINT32 streamId; + } RDP_CB_FILECONTENTS_RESPONSE_EVENT; + + typedef struct + { + wMessage event; + UINT32 clipDataId; + } RDP_CB_LOCK_CLIPDATA_EVENT; + + typedef struct + { + wMessage event; + UINT32 clipDataId; + } RDP_CB_UNLOCK_CLIPDATA_EVENT; + + typedef struct + { + wMessage event; + char dirname[520]; + } RDP_CB_TEMPDIR_EVENT; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_CLIPRDR_CLIENT_CLIPRDR_H */ diff --git a/include/freerdp/client/cmdline.h b/include/freerdp/client/cmdline.h new file mode 100644 index 0000000..36c8499 --- /dev/null +++ b/include/freerdp/client/cmdline.h @@ -0,0 +1,103 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Client Command-Line Interface + * + * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_CLIENT_CMDLINE_H +#define FREERDP_CLIENT_CMDLINE_H + +#include <winpr/cmdline.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/settings.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** \brief parses command line arguments to appropriate settings values. + * + * \param settings The settings instance to store the parsed values to + * \param argc the number of argv values + * \param argv an array of strings (char pointer) + * \param allowUnknown Allow unknown command line arguments or \b FALSE if not. + * + * \return \b 0 in case of success, a negative number in case of failure. + */ + FREERDP_API int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, + int argc, char** argv, + BOOL allowUnknown); + + /** \brief parses command line arguments to appropriate settings values. Additionally allows + * supplying custom command line arguments and a handler function. + * + * \param settings The settings instance to store the parsed values to + * \param argc the number of argv values + * \param argv an array of strings (char pointer) + * \param allowUnknown Allow unknown command line arguments or \b FALSE if not. + * \param args Pointer to the custom arguments + * \param count The number of custom arguments + * \param handle_option the handler function for custom arguments. + * \param handle_userdata custom data supplied to \b handle_option as context + * + * \return \b 0 in case of success, a negative number in case of failure. + */ + FREERDP_API int freerdp_client_settings_parse_command_line_arguments_ex( + rdpSettings* settings, int argc, char** argv, BOOL allowUnknown, + COMMAND_LINE_ARGUMENT_A* args, size_t count, + int (*handle_option)(const COMMAND_LINE_ARGUMENT* arg, void* custom), + void* handle_userdata); + + FREERDP_API int freerdp_client_settings_command_line_status_print(rdpSettings* settings, + int status, int argc, + char** argv); + FREERDP_API int + freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings, int status, + int argc, char** argv, + const COMMAND_LINE_ARGUMENT_A* custom); + FREERDP_API BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings); + + FREERDP_API void freerdp_client_warn_unmaintained(int argc, char* argv[]); + FREERDP_API void freerdp_client_warn_experimental(int argc, char* argv[]); + FREERDP_API void freerdp_client_warn_deprecated(int argc, char* argv[]); + + FREERDP_API BOOL freerdp_client_print_version(void); + FREERDP_API BOOL freerdp_client_print_buildconfig(void); + FREERDP_API BOOL freerdp_client_print_command_line_help(int argc, char** argv); + FREERDP_API BOOL freerdp_client_print_command_line_help_ex( + int argc, char** argv, const COMMAND_LINE_ARGUMENT_A* custom); + + FREERDP_API BOOL freerdp_parse_username(const char* username, char** user, char** domain); + FREERDP_API BOOL freerdp_parse_hostname(const char* hostname, char** host, int* port); + FREERDP_API BOOL freerdp_set_connection_type(rdpSettings* settings, UINT32 type); + + FREERDP_API BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count, + const char** params); + FREERDP_API BOOL freerdp_client_add_static_channel(rdpSettings* settings, size_t count, + const char** params); + FREERDP_API BOOL freerdp_client_del_static_channel(rdpSettings* settings, const char* name); + FREERDP_API BOOL freerdp_client_add_dynamic_channel(rdpSettings* settings, size_t count, + const char** params); + FREERDP_API BOOL freerdp_client_del_dynamic_channel(rdpSettings* settings, const char* name); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CLIENT_CMDLINE_H */ diff --git a/include/freerdp/client/disp.h b/include/freerdp/client/disp.h new file mode 100644 index 0000000..26eff27 --- /dev/null +++ b/include/freerdp/client/disp.h @@ -0,0 +1,52 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Display Update Virtual Channel Extension + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_DISP_CLIENT_DISP_H +#define FREERDP_CHANNEL_DISP_CLIENT_DISP_H + +#include <freerdp/channels/disp.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_disp_client_context DispClientContext; + + typedef UINT (*pcDispCaps)(DispClientContext* context, UINT32 MaxNumMonitors, + UINT32 MaxMonitorAreaFactorA, UINT32 MaxMonitorAreaFactorB); + typedef UINT (*pcDispSendMonitorLayout)(DispClientContext* context, UINT32 NumMonitors, + DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors); + + struct s_disp_client_context + { + void* handle; + void* custom; + + pcDispCaps DisplayControlCaps; + pcDispSendMonitorLayout SendMonitorLayout; + }; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_DISP_CLIENT_DISP_H */ diff --git a/include/freerdp/client/drdynvc.h b/include/freerdp/client/drdynvc.h new file mode 100644 index 0000000..897f9dd --- /dev/null +++ b/include/freerdp/client/drdynvc.h @@ -0,0 +1,62 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Dynamic Virtual Channel Extension + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_DRDYNVC_CLIENT_DRDYNVC_H +#define FREERDP_CHANNEL_DRDYNVC_CLIENT_DRDYNVC_H + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Client Interface + */ + + typedef struct s_drdynvc_client_context DrdynvcClientContext; + + typedef int (*pcDrdynvcGetVersion)(DrdynvcClientContext* context); + typedef UINT (*pcDrdynvcOnChannelConnected)(DrdynvcClientContext* context, const char* name, + void* pInterface); + typedef UINT (*pcDrdynvcOnChannelDisconnected)(DrdynvcClientContext* context, const char* name, + void* pInterface); + typedef UINT (*pcDrdynvcOnChannelAttached)(DrdynvcClientContext* context, const char* name, + void* pInterface); + typedef UINT (*pcDrdynvcOnChannelDetached)(DrdynvcClientContext* context, const char* name, + void* pInterface); + + struct s_drdynvc_client_context + { + void* handle; + void* custom; + + pcDrdynvcGetVersion GetVersion; + pcDrdynvcOnChannelConnected OnChannelConnected; + pcDrdynvcOnChannelDisconnected OnChannelDisconnected; + pcDrdynvcOnChannelAttached OnChannelAttached; + pcDrdynvcOnChannelDetached OnChannelDetached; + }; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_DRDYNVC_CLIENT_DRDYNVC_H */ diff --git a/include/freerdp/client/encomsp.h b/include/freerdp/client/encomsp.h new file mode 100644 index 0000000..005c8b3 --- /dev/null +++ b/include/freerdp/client/encomsp.h @@ -0,0 +1,88 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Multiparty Virtual Channel + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_ENCOMSP_CLIENT_ENCOMSP_H +#define FREERDP_CHANNEL_ENCOMSP_CLIENT_ENCOMSP_H + +#include <freerdp/channels/encomsp.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Client Interface + */ + + typedef struct s_encomsp_client_context EncomspClientContext; + + typedef UINT (*pcEncomspFilterUpdated)(EncomspClientContext* context, + const ENCOMSP_FILTER_UPDATED_PDU* filterUpdated); + typedef UINT (*pcEncomspApplicationCreated)( + EncomspClientContext* context, const ENCOMSP_APPLICATION_CREATED_PDU* applicationCreated); + typedef UINT (*pcEncomspApplicationRemoved)( + EncomspClientContext* context, const ENCOMSP_APPLICATION_REMOVED_PDU* applicationRemoved); + typedef UINT (*pcEncomspWindowCreated)(EncomspClientContext* context, + const ENCOMSP_WINDOW_CREATED_PDU* windowCreated); + typedef UINT (*pcEncomspWindowRemoved)(EncomspClientContext* context, + const ENCOMSP_WINDOW_REMOVED_PDU* windowRemoved); + typedef UINT (*pcEncomspShowWindow)(EncomspClientContext* context, + const ENCOMSP_SHOW_WINDOW_PDU* showWindow); + typedef UINT (*pcEncomspParticipantCreated)( + EncomspClientContext* context, const ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated); + typedef UINT (*pcEncomspParticipantRemoved)( + EncomspClientContext* context, const ENCOMSP_PARTICIPANT_REMOVED_PDU* participantRemoved); + typedef UINT (*pcEncomspChangeParticipantControlLevel)( + EncomspClientContext* context, + const ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* changeParticipantControlLevel); + typedef UINT (*pcEncomspGraphicsStreamPaused)( + EncomspClientContext* context, + const ENCOMSP_GRAPHICS_STREAM_PAUSED_PDU* graphicsStreamPaused); + typedef UINT (*pcEncomspGraphicsStreamResumed)( + EncomspClientContext* context, + const ENCOMSP_GRAPHICS_STREAM_RESUMED_PDU* graphicsStreamResumed); + + struct s_encomsp_client_context + { + void* handle; + void* custom; + + pcEncomspFilterUpdated FilterUpdated; + pcEncomspApplicationCreated ApplicationCreated; + pcEncomspApplicationRemoved ApplicationRemoved; + pcEncomspWindowCreated WindowCreated; + pcEncomspWindowRemoved WindowRemoved; + pcEncomspShowWindow ShowWindow; + pcEncomspParticipantCreated ParticipantCreated; + pcEncomspParticipantRemoved ParticipantRemoved; + pcEncomspChangeParticipantControlLevel ChangeParticipantControlLevel; + pcEncomspGraphicsStreamPaused GraphicsStreamPaused; + pcEncomspGraphicsStreamResumed GraphicsStreamResumed; + + UINT32 participantId; + }; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_ENCOMSP_CLIENT_ENCOMSP_H */ diff --git a/include/freerdp/client/file.h b/include/freerdp/client/file.h new file mode 100644 index 0000000..30c6543 --- /dev/null +++ b/include/freerdp/client/file.h @@ -0,0 +1,82 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * .rdp file + * + * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_CLIENT_RDP_FILE_H +#define FREERDP_CLIENT_RDP_FILE_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/settings.h> + +/* Ignore invalid integer values */ +#define RDP_FILE_FLAG_PARSE_INT_RELAXED 1 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_file rdpFile; + typedef BOOL (*rdp_file_fkt_parse)(void* context, const char* key, char type, + const char* value); + + /* When using freerdp_client_parse_rdp_file_ex or freerdp_client_parse_rdp_file_buffer_ex + * set the context for the callback with this function. */ + FREERDP_API void freerdp_client_rdp_file_set_callback_context(rdpFile* file, void* context); + + FREERDP_API BOOL freerdp_client_parse_rdp_file(rdpFile* file, const char* name); + FREERDP_API BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name, + rdp_file_fkt_parse parse); + FREERDP_API BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, const BYTE* buffer, + size_t size); + FREERDP_API BOOL freerdp_client_parse_rdp_file_buffer_ex(rdpFile* file, const BYTE* buffer, + size_t size, rdp_file_fkt_parse parse); + FREERDP_API BOOL freerdp_client_populate_settings_from_rdp_file(const rdpFile* file, + rdpSettings* settings); + + FREERDP_API BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, + const rdpSettings* settings); + FREERDP_API BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, + BOOL unicode); + FREERDP_API size_t freerdp_client_write_rdp_file_buffer(const rdpFile* file, char* buffer, + size_t size); + + FREERDP_API int freerdp_client_rdp_file_set_string_option(rdpFile* file, const char* name, + const char* value); + FREERDP_API const char* freerdp_client_rdp_file_get_string_option(const rdpFile* file, + const char* name); + + FREERDP_API int freerdp_client_rdp_file_set_integer_option(rdpFile* file, const char* name, + int value); + FREERDP_API int freerdp_client_rdp_file_get_integer_option(const rdpFile* file, + const char* name); + + FREERDP_API void freerdp_client_rdp_file_free(rdpFile* file); + + WINPR_ATTR_MALLOC(freerdp_client_rdp_file_free, 1) + FREERDP_API rdpFile* freerdp_client_rdp_file_new(void); + + WINPR_ATTR_MALLOC(freerdp_client_rdp_file_free, 1) + FREERDP_API rdpFile* freerdp_client_rdp_file_new_ex(DWORD flags); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CLIENT_RDP_FILE_H */ diff --git a/include/freerdp/client/geometry.h b/include/freerdp/client/geometry.h new file mode 100644 index 0000000..f1c4e7b --- /dev/null +++ b/include/freerdp/client/geometry.h @@ -0,0 +1,76 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Geometry tracking Virtual Channel Extension + * + * Copyright 2017 David Fort <contact@hardening-consulting.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_CHANNELS_CLIENT_GEOMETRY_H +#define FREERDP_CHANNELS_CLIENT_GEOMETRY_H + +#include <winpr/collections.h> +#include <freerdp/api.h> +#include <freerdp/channels/geometry.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Client Interface + */ + typedef struct s_geometry_client_context GeometryClientContext; + + typedef struct S_MAPPED_GEOMETRY MAPPED_GEOMETRY; + typedef BOOL (*pcMappedGeometryAdded)(GeometryClientContext* context, + MAPPED_GEOMETRY* geometry); + typedef BOOL (*pcMappedGeometryUpdate)(MAPPED_GEOMETRY* geometry); + typedef BOOL (*pcMappedGeometryClear)(MAPPED_GEOMETRY* geometry); + + /** @brief a geometry record tracked by the geometry channel */ + struct S_MAPPED_GEOMETRY + { + volatile LONG refCounter; + UINT64 mappingId; + UINT64 topLevelId; + INT32 left, top, right, bottom; + INT32 topLevelLeft, topLevelTop, topLevelRight, topLevelBottom; + FREERDP_RGNDATA geometry; + + void* custom; + pcMappedGeometryUpdate MappedGeometryUpdate; + pcMappedGeometryClear MappedGeometryClear; + }; + + /** @brief the geometry context for client channel */ + struct s_geometry_client_context + { + wHashTable* geometries; + void* handle; + void* custom; + + pcMappedGeometryAdded MappedGeometryAdded; + UINT32 remoteVersion; + }; + + FREERDP_API void mappedGeometryRef(MAPPED_GEOMETRY* g); + FREERDP_API void mappedGeometryUnref(MAPPED_GEOMETRY* g); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNELS_CLIENT_GEOMETRY_H */ diff --git a/include/freerdp/client/printer.h b/include/freerdp/client/printer.h new file mode 100644 index 0000000..fd44345 --- /dev/null +++ b/include/freerdp/client/printer.h @@ -0,0 +1,89 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Print Virtual Channel + * + * Copyright 2010-2011 Vic Lee + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com> + * Copyright 2016 Armin Novak <armin.novak@gmail.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_CHANNEL_PRINTER_CLIENT_PRINTER_H +#define FREERDP_CHANNEL_PRINTER_CLIENT_PRINTER_H + +#include <freerdp/channels/rdpdr.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_printer_driver rdpPrinterDriver; + typedef struct rdp_printer rdpPrinter; + typedef struct rdp_print_job rdpPrintJob; + + typedef void (*pcReferencePrinterDriver)(rdpPrinterDriver* driver); + typedef rdpPrinter** (*pcEnumPrinters)(rdpPrinterDriver* driver); + typedef void (*pcReleaseEnumPrinters)(rdpPrinter** printers); + + typedef rdpPrinter* (*pcGetPrinter)(rdpPrinterDriver* driver, const char* name, + const char* driverName, BOOL isDefault); + typedef void (*pcReferencePrinter)(rdpPrinter* printer); + + struct rdp_printer_driver + { + pcEnumPrinters EnumPrinters; + pcReleaseEnumPrinters ReleaseEnumPrinters; + pcGetPrinter GetPrinter; + + pcReferencePrinterDriver AddRef; + pcReferencePrinterDriver ReleaseRef; + }; + + typedef rdpPrintJob* (*pcCreatePrintJob)(rdpPrinter* printer, UINT32 id); + typedef rdpPrintJob* (*pcFindPrintJob)(rdpPrinter* printer, UINT32 id); + + struct rdp_printer + { + size_t id; + char* name; + char* driver; + BOOL is_default; + + size_t references; + rdpPrinterDriver* backend; + pcCreatePrintJob CreatePrintJob; + pcFindPrintJob FindPrintJob; + pcReferencePrinter AddRef; + pcReferencePrinter ReleaseRef; + }; + + typedef UINT (*pcWritePrintJob)(rdpPrintJob* printjob, const BYTE* data, size_t size); + typedef void (*pcClosePrintJob)(rdpPrintJob* printjob); + + struct rdp_print_job + { + UINT32 id; + rdpPrinter* printer; + + pcWritePrintJob Write; + pcClosePrintJob Close; + }; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_PRINTER_CLIENT_PRINTER_H */ diff --git a/include/freerdp/client/rail.h b/include/freerdp/client/rail.h new file mode 100644 index 0000000..18582b9 --- /dev/null +++ b/include/freerdp/client/rail.h @@ -0,0 +1,143 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Remote Applications Integrated Locally (RAIL) + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.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_CHANNEL_RAIL_CLIENT_RAIL_H +#define FREERDP_CHANNEL_RAIL_CLIENT_RAIL_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/rail.h> +#include <freerdp/message.h> +#include <freerdp/channels/rail.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Client Interface + */ + + typedef struct s_rail_client_context RailClientContext; + + typedef UINT (*pcRailOnOpen)(RailClientContext* context, BOOL* sendHandshake); + + typedef UINT (*pcRailClientExecute)(RailClientContext* context, const RAIL_EXEC_ORDER* exec); + typedef UINT (*pcRailClientActivate)(RailClientContext* context, + const RAIL_ACTIVATE_ORDER* activate); + typedef UINT (*pcRailClientSystemParam)(RailClientContext* context, + const RAIL_SYSPARAM_ORDER* sysparam); + typedef UINT (*pcRailServerSystemParam)(RailClientContext* context, + const RAIL_SYSPARAM_ORDER* sysparam); + typedef UINT (*pcRailClientSystemCommand)(RailClientContext* context, + const RAIL_SYSCOMMAND_ORDER* syscommand); + typedef UINT (*pcRailClientHandshake)(RailClientContext* context, + const RAIL_HANDSHAKE_ORDER* handshake); + typedef UINT (*pcRailServerHandshake)(RailClientContext* context, + const RAIL_HANDSHAKE_ORDER* handshake); + typedef UINT (*pcRailServerHandshakeEx)(RailClientContext* context, + const RAIL_HANDSHAKE_EX_ORDER* handshakeEx); + typedef UINT (*pcRailClientNotifyEvent)(RailClientContext* context, + const RAIL_NOTIFY_EVENT_ORDER* notifyEvent); + typedef UINT (*pcRailClientWindowMove)(RailClientContext* context, + const RAIL_WINDOW_MOVE_ORDER* windowMove); + typedef UINT (*pcRailServerLocalMoveSize)(RailClientContext* context, + const RAIL_LOCALMOVESIZE_ORDER* localMoveSize); + typedef UINT (*pcRailServerMinMaxInfo)(RailClientContext* context, + const RAIL_MINMAXINFO_ORDER* minMaxInfo); + typedef UINT (*pcRailClientInformation)(RailClientContext* context, + const RAIL_CLIENT_STATUS_ORDER* clientStatus); + typedef UINT (*pcRailClientSystemMenu)(RailClientContext* context, + const RAIL_SYSMENU_ORDER* sysmenu); + typedef UINT (*pcRailServerTaskBarInfo)(RailClientContext* context, + const RAIL_TASKBAR_INFO_ORDER* taskBarInfo); + typedef UINT (*pcRailClientLanguageBarInfo)(RailClientContext* context, + const RAIL_LANGBAR_INFO_ORDER* langBarInfo); + typedef UINT (*pcRailServerLanguageBarInfo)(RailClientContext* context, + const RAIL_LANGBAR_INFO_ORDER* langBarInfo); + typedef UINT (*pcRailClientLanguageIMEInfo)(RailClientContext* context, + const RAIL_LANGUAGEIME_INFO_ORDER* langImeInfo); + typedef UINT (*pcRailServerExecuteResult)(RailClientContext* context, + const RAIL_EXEC_RESULT_ORDER* execResult); + typedef UINT (*pcRailClientGetAppIdRequest)(RailClientContext* context, + const RAIL_GET_APPID_REQ_ORDER* getAppIdReq); + typedef UINT (*pcRailServerGetAppIdResponse)(RailClientContext* context, + const RAIL_GET_APPID_RESP_ORDER* getAppIdResp); + typedef UINT (*pcRailServerZOrderSync)(RailClientContext* context, + const RAIL_ZORDER_SYNC* zorder); + typedef UINT (*pcRailServerCloak)(RailClientContext* context, const RAIL_CLOAK* cloak); + typedef UINT (*pcRailClientCloak)(RailClientContext* context, const RAIL_CLOAK* cloak); + typedef UINT (*pcRailServerPowerDisplayRequest)(RailClientContext* context, + const RAIL_POWER_DISPLAY_REQUEST* power); + typedef UINT (*pcRailClientSnapArrange)(RailClientContext* context, + const RAIL_SNAP_ARRANGE* snap); + typedef UINT (*pcRailServerGetAppidResponseExtended)(RailClientContext* context, + const RAIL_GET_APPID_RESP_EX* id); + typedef UINT (*pcRailClientCompartmentInfo)(RailClientContext* context, + const RAIL_COMPARTMENT_INFO_ORDER* compartmentInfo); + typedef UINT (*pcRailClientTextScale)(RailClientContext* context, UINT32 TextScale); + typedef UINT (*pcRailClientCaretBlinkRate)(RailClientContext* context, UINT32 CaretBlinkRate); + + struct s_rail_client_context + { + void* handle; + void* custom; + + pcRailClientExecute ClientExecute; + pcRailClientActivate ClientActivate; + pcRailClientSystemParam ClientSystemParam; + pcRailServerSystemParam ServerSystemParam; + pcRailClientSystemCommand ClientSystemCommand; + pcRailClientHandshake ClientHandshake; + pcRailServerHandshake ServerHandshake; + pcRailServerHandshakeEx ServerHandshakeEx; + pcRailClientNotifyEvent ClientNotifyEvent; + pcRailClientWindowMove ClientWindowMove; + pcRailServerLocalMoveSize ServerLocalMoveSize; + pcRailServerMinMaxInfo ServerMinMaxInfo; + pcRailClientInformation ClientInformation; + pcRailClientSystemMenu ClientSystemMenu; + pcRailServerTaskBarInfo ServerTaskBarInfo; + pcRailClientLanguageBarInfo ClientLanguageBarInfo; + pcRailServerLanguageBarInfo ServerLanguageBarInfo; + pcRailClientLanguageIMEInfo ClientLanguageIMEInfo; + pcRailServerExecuteResult ServerExecuteResult; + pcRailClientGetAppIdRequest ClientGetAppIdRequest; + pcRailServerGetAppIdResponse ServerGetAppIdResponse; + pcRailServerZOrderSync ServerZOrderSync; + pcRailClientCloak ClientCloak; + pcRailServerCloak ServerCloak; + pcRailServerPowerDisplayRequest ServerPowerDisplayRequest; + pcRailClientSnapArrange ClientSnapArrange; + pcRailServerGetAppidResponseExtended ServerGetAppidResponseExtended; + pcRailClientCompartmentInfo ClientCompartmentInfo; + pcRailOnOpen OnOpen; + pcRailClientTextScale ClientTextScale; + pcRailClientCaretBlinkRate ClientCaretBlinkRate; + }; + + FREERDP_API UINT client_rail_server_start_cmd(RailClientContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RAIL_CLIENT_RAIL_H */ diff --git a/include/freerdp/client/rdpei.h b/include/freerdp/client/rdpei.h new file mode 100644 index 0000000..50624f4 --- /dev/null +++ b/include/freerdp/client/rdpei.h @@ -0,0 +1,110 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Dynamic Virtual Channel Extension + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_RDPEI_CLIENT_RDPEI_H +#define FREERDP_CHANNEL_RDPEI_CLIENT_RDPEI_H + +#include <freerdp/channels/rdpei.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Client Interface + */ + + typedef struct s_rdpei_client_context RdpeiClientContext; + + typedef UINT32 (*pcRdpeiGetVersion)(RdpeiClientContext* context); + typedef UINT32 (*pcRdpeiGetFeatures)(RdpeiClientContext* context); + + typedef UINT (*pcRdpeiAddContact)(RdpeiClientContext* context, + const RDPINPUT_CONTACT_DATA* contact); + + typedef UINT (*pcRdpeiTouchEvent)(RdpeiClientContext* context, INT32 externalId, INT32 x, + INT32 y, INT32* contactId); + typedef UINT (*pcRdpeiTouchRawEvent)(RdpeiClientContext* context, INT32 externalId, INT32 x, + INT32 y, INT32* contactId, UINT32 contactFlags, + UINT32 fieldFlags, ...); + typedef UINT (*pcRdpeiTouchRawEventVA)(RdpeiClientContext* context, INT32 externalId, INT32 x, + INT32 y, INT32* contactId, UINT32 contactFlags, + UINT32 fieldFlags, va_list args); + + typedef UINT (*pcRdpeiAddPen)(RdpeiClientContext* context, INT32 externalId, + const RDPINPUT_PEN_CONTACT* contact); + + typedef UINT (*pcRdpeiPen)(RdpeiClientContext* context, INT32 externalId, UINT32 fieldFlags, + INT32 x, INT32 y, ...); + + typedef UINT (*pcRdpeiPenRawEvent)(RdpeiClientContext* context, INT32 externalId, + UINT32 contactFlags, UINT32 fieldFlags, INT32 x, INT32 y, + ...); + typedef UINT (*pcRdpeiPenRawEventVA)(RdpeiClientContext* context, INT32 externalId, + UINT32 contactFlags, UINT32 fieldFlags, INT32 x, INT32 y, + va_list args); + + typedef UINT (*pcRdpeiSuspendTouch)(RdpeiClientContext* context); + typedef UINT (*pcRdpeiResumeTouch)(RdpeiClientContext* context); + + struct s_rdpei_client_context + { + void* handle; + void* custom; + + pcRdpeiGetVersion GetVersion; + pcRdpeiGetFeatures GetFeatures; + + pcRdpeiAddContact AddContact; + + pcRdpeiTouchEvent TouchBegin; + pcRdpeiTouchEvent TouchUpdate; + pcRdpeiTouchEvent TouchEnd; + + pcRdpeiAddPen AddPen; + + pcRdpeiPen PenBegin; + pcRdpeiPen PenUpdate; + pcRdpeiPen PenEnd; + pcRdpeiPen PenHoverBegin; + pcRdpeiPen PenHoverUpdate; + pcRdpeiPen PenHoverCancel; + + pcRdpeiSuspendTouch SuspendTouch; + pcRdpeiResumeTouch ResumeTouch; + + pcRdpeiTouchEvent TouchCancel; + pcRdpeiTouchRawEvent TouchRawEvent; + pcRdpeiTouchRawEventVA TouchRawEventVA; + + pcRdpeiPen PenCancel; + pcRdpeiPenRawEvent PenRawEvent; + pcRdpeiPenRawEventVA PenRawEventVA; + + UINT32 clientFeaturesMask; + }; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RDPEI_CLIENT_RDPEI_H */ diff --git a/include/freerdp/client/rdpgfx.h b/include/freerdp/client/rdpgfx.h new file mode 100644 index 0000000..df9e2a7 --- /dev/null +++ b/include/freerdp/client/rdpgfx.h @@ -0,0 +1,189 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Graphics Pipeline Extension + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_RDPGFX_CLIENT_RDPGFX_H +#define FREERDP_CHANNEL_RDPGFX_CLIENT_RDPGFX_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codecs.h> + +#include <freerdp/channels/rdpgfx.h> +#include <freerdp/utils/profiler.h> + +#include <freerdp/cache/persistent.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Client Interface + */ + typedef struct gdi_gfx_surface gdiGfxSurface; + typedef struct s_rdpgfx_client_context RdpgfxClientContext; + + typedef UINT (*pcRdpgfxResetGraphics)(RdpgfxClientContext* context, + const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics); + typedef UINT (*pcRdpgfxStartFrame)(RdpgfxClientContext* context, + const RDPGFX_START_FRAME_PDU* startFrame); + typedef UINT (*pcRdpgfxEndFrame)(RdpgfxClientContext* context, + const RDPGFX_END_FRAME_PDU* endFrame); + typedef UINT (*pcRdpgfxSurfaceCommand)(RdpgfxClientContext* context, + const RDPGFX_SURFACE_COMMAND* cmd); + typedef UINT (*pcRdpgfxDeleteEncodingContext)( + RdpgfxClientContext* context, + const RDPGFX_DELETE_ENCODING_CONTEXT_PDU* deleteEncodingContext); + typedef UINT (*pcRdpgfxCreateSurface)(RdpgfxClientContext* context, + const RDPGFX_CREATE_SURFACE_PDU* createSurface); + typedef UINT (*pcRdpgfxDeleteSurface)(RdpgfxClientContext* context, + const RDPGFX_DELETE_SURFACE_PDU* deleteSurface); + typedef UINT (*pcRdpgfxSolidFill)(RdpgfxClientContext* context, + const RDPGFX_SOLID_FILL_PDU* solidFill); + typedef UINT (*pcRdpgfxSurfaceToSurface)(RdpgfxClientContext* context, + const RDPGFX_SURFACE_TO_SURFACE_PDU* surfaceToSurface); + typedef UINT (*pcRdpgfxSurfaceToCache)(RdpgfxClientContext* context, + const RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache); + typedef UINT (*pcRdpgfxCacheToSurface)(RdpgfxClientContext* context, + const RDPGFX_CACHE_TO_SURFACE_PDU* cacheToSurface); + typedef UINT (*pcRdpgfxCacheImportOffer)(RdpgfxClientContext* context, + const RDPGFX_CACHE_IMPORT_OFFER_PDU* cacheImportOffer); + typedef UINT (*pcRdpgfxCacheImportReply)(RdpgfxClientContext* context, + const RDPGFX_CACHE_IMPORT_REPLY_PDU* cacheImportReply); + typedef UINT (*pcRdpgfxEvictCacheEntry)(RdpgfxClientContext* context, + const RDPGFX_EVICT_CACHE_ENTRY_PDU* evictCacheEntry); + typedef UINT (*pcRdpgfxImportCacheEntry)(RdpgfxClientContext* context, UINT16 cacheSlot, + const PERSISTENT_CACHE_ENTRY* importCacheEntry); + typedef UINT (*pcRdpgfxExportCacheEntry)(RdpgfxClientContext* context, UINT16 cacheSlot, + PERSISTENT_CACHE_ENTRY* importCacheEntry); + typedef UINT (*pcRdpgfxMapSurfaceToOutput)( + RdpgfxClientContext* context, const RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU* surfaceToOutput); + typedef UINT (*pcRdpgfxMapSurfaceToScaledOutput)( + RdpgfxClientContext* context, + const RDPGFX_MAP_SURFACE_TO_SCALED_OUTPUT_PDU* surfaceToOutput); + typedef UINT (*pcRdpgfxMapSurfaceToWindow)( + RdpgfxClientContext* context, const RDPGFX_MAP_SURFACE_TO_WINDOW_PDU* surfaceToWindow); + typedef UINT (*pcRdpgfxMapSurfaceToScaledWindow)( + RdpgfxClientContext* context, + const RDPGFX_MAP_SURFACE_TO_SCALED_WINDOW_PDU* surfaceToWindow); + typedef UINT (*pcRdpgfxSetSurfaceData)(RdpgfxClientContext* context, UINT16 surfaceId, + void* pData); + typedef void* (*pcRdpgfxGetSurfaceData)(RdpgfxClientContext* context, UINT16 surfaceId); + typedef UINT (*pcRdpgfxGetSurfaceIds)(RdpgfxClientContext* context, UINT16** ppSurfaceIds, + UINT16* count); + typedef UINT (*pcRdpgfxSetCacheSlotData)(RdpgfxClientContext* context, UINT16 cacheSlot, + void* pData); + typedef void* (*pcRdpgfxGetCacheSlotData)(RdpgfxClientContext* context, UINT16 cacheSlot); + + typedef UINT (*pcRdpgfxUpdateSurfaces)(RdpgfxClientContext* context); + + typedef UINT (*pcRdpgfxUpdateWindowFromSurface)(RdpgfxClientContext* context, + gdiGfxSurface* surface); + + typedef UINT (*pcRdpgfxUpdateSurfaceArea)(RdpgfxClientContext* context, UINT16 surfaceId, + UINT32 nrRects, const RECTANGLE_16* rects); + + typedef UINT (*pcRdpgfxOnOpen)(RdpgfxClientContext* context, BOOL* do_caps_advertise, + BOOL* do_frame_acks); + typedef UINT (*pcRdpgfxOnClose)(RdpgfxClientContext* context); + typedef UINT (*pcRdpgfxCapsAdvertise)(RdpgfxClientContext* context, + const RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise); + typedef UINT (*pcRdpgfxCapsConfirm)(RdpgfxClientContext* context, + const RDPGFX_CAPS_CONFIRM_PDU* capsConfirm); + typedef UINT (*pcRdpgfxFrameAcknowledge)(RdpgfxClientContext* context, + const RDPGFX_FRAME_ACKNOWLEDGE_PDU* frameAcknowledge); + typedef UINT (*pcRdpgfxQoeFrameAcknowledge)( + RdpgfxClientContext* context, const RDPGFX_QOE_FRAME_ACKNOWLEDGE_PDU* qoeFrameAcknowledge); + + typedef UINT (*pcRdpgfxMapWindowForSurface)(RdpgfxClientContext* context, UINT16 surfaceID, + UINT64 windowID); + typedef UINT (*pcRdpgfxUnmapWindowForSurface)(RdpgfxClientContext* context, UINT64 windowID); + + struct s_rdpgfx_client_context + { + void* handle; + void* custom; + + /* Implementations require locking */ + pcRdpgfxResetGraphics ResetGraphics; + pcRdpgfxStartFrame StartFrame; + pcRdpgfxEndFrame EndFrame; + pcRdpgfxSurfaceCommand SurfaceCommand; + pcRdpgfxDeleteEncodingContext DeleteEncodingContext; + pcRdpgfxCreateSurface CreateSurface; + pcRdpgfxDeleteSurface DeleteSurface; + pcRdpgfxSolidFill SolidFill; + pcRdpgfxSurfaceToSurface SurfaceToSurface; + pcRdpgfxSurfaceToCache SurfaceToCache; + pcRdpgfxCacheToSurface CacheToSurface; + pcRdpgfxCacheImportOffer CacheImportOffer; + pcRdpgfxCacheImportReply CacheImportReply; + pcRdpgfxImportCacheEntry ImportCacheEntry; + pcRdpgfxExportCacheEntry ExportCacheEntry; + pcRdpgfxEvictCacheEntry EvictCacheEntry; + pcRdpgfxMapSurfaceToOutput MapSurfaceToOutput; + pcRdpgfxMapSurfaceToScaledOutput MapSurfaceToScaledOutput; + pcRdpgfxMapSurfaceToWindow MapSurfaceToWindow; + pcRdpgfxMapSurfaceToScaledWindow MapSurfaceToScaledWindow; + + pcRdpgfxGetSurfaceIds GetSurfaceIds; + pcRdpgfxSetSurfaceData SetSurfaceData; + pcRdpgfxGetSurfaceData GetSurfaceData; + pcRdpgfxSetCacheSlotData SetCacheSlotData; + pcRdpgfxGetCacheSlotData GetCacheSlotData; + + /* Proxy callbacks */ + pcRdpgfxOnOpen OnOpen; + pcRdpgfxOnClose OnClose; + pcRdpgfxCapsAdvertise CapsAdvertise; + pcRdpgfxCapsConfirm CapsConfirm; + pcRdpgfxFrameAcknowledge FrameAcknowledge; + pcRdpgfxQoeFrameAcknowledge QoeFrameAcknowledge; + + /* No locking required */ + pcRdpgfxUpdateSurfaces UpdateSurfaces; + pcRdpgfxUpdateSurfaceArea UpdateSurfaceArea; + pcRdpgfxUpdateWindowFromSurface UpdateWindowFromSurface; + + /* These callbacks allow creating/destroying a window directly + * mapped to a surface. + * NOTE: The surface is already locked. + */ + pcRdpgfxMapWindowForSurface MapWindowForSurface; + pcRdpgfxUnmapWindowForSurface UnmapWindowForSurface; + + CRITICAL_SECTION mux; + rdpCodecs* codecs; + PROFILER_DEFINE(SurfaceProfiler) + }; + + FREERDP_API void rdpgfx_client_context_free(RdpgfxClientContext* context); + + WINPR_ATTR_MALLOC(rdpgfx_client_context_free, 1) + FREERDP_API RdpgfxClientContext* rdpgfx_client_context_new(rdpContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RDPGFX_CLIENT_RDPGFX_H */ diff --git a/include/freerdp/client/rdpsnd.h b/include/freerdp/client/rdpsnd.h new file mode 100644 index 0000000..7a77a2c --- /dev/null +++ b/include/freerdp/client/rdpsnd.h @@ -0,0 +1,90 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Audio Output Virtual Channel + * + * Copyright 2010-2011 Vic Lee + * Copyright 2012-2013 Marc-Andre Moreau <marcandre.moreau@gmail.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_CHANNEL_RDPSND_CLIENT_RDPSND_H +#define FREERDP_CHANNEL_RDPSND_CLIENT_RDPSND_H + +#include <freerdp/channels/rdpsnd.h> +#include <freerdp/settings.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Subsystem Interface + */ + typedef struct rdpsnd_plugin rdpsndPlugin; + + typedef struct rdpsnd_device_plugin rdpsndDevicePlugin; + + typedef BOOL (*pcFormatSupported)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* format); + typedef BOOL (*pcOpen)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* format, UINT32 latency); + typedef UINT32 (*pcGetVolume)(rdpsndDevicePlugin* device); + typedef BOOL (*pcSetVolume)(rdpsndDevicePlugin* device, UINT32 value); + typedef UINT (*pcPlay)(rdpsndDevicePlugin* device, const BYTE* data, size_t size); + typedef UINT (*pcPlayEx)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* format, + const BYTE* data, size_t size); + typedef void (*pcStart)(rdpsndDevicePlugin* device); + typedef void (*pcClose)(rdpsndDevicePlugin* device); + typedef void (*pcFree)(rdpsndDevicePlugin* device); + typedef BOOL (*pcDefaultFormat)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* desired, + AUDIO_FORMAT* defaultFormat); + typedef UINT (*pcServerFormatAnnounce)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* formats, + size_t count); + + struct rdpsnd_device_plugin + { + rdpsndPlugin* rdpsnd; + + pcFormatSupported FormatSupported; + pcOpen Open; + pcGetVolume GetVolume; + pcSetVolume SetVolume; + pcPlay Play; + pcStart Start; /* Deprecated, unused. */ + pcClose Close; + pcFree Free; + pcDefaultFormat DefaultFormat; + pcServerFormatAnnounce ServerFormatAnnounce; + pcPlayEx PlayEx; + }; + +#define RDPSND_DEVICE_EXPORT_FUNC_NAME "freerdp_rdpsnd_client_subsystem_entry" + +typedef void (*PREGISTERRDPSNDDEVICE)(rdpsndPlugin* rdpsnd, rdpsndDevicePlugin* device); + +typedef struct +{ + rdpsndPlugin* rdpsnd; + PREGISTERRDPSNDDEVICE pRegisterRdpsndDevice; + const ADDIN_ARGV* args; +} FREERDP_RDPSND_DEVICE_ENTRY_POINTS; +typedef FREERDP_RDPSND_DEVICE_ENTRY_POINTS* PFREERDP_RDPSND_DEVICE_ENTRY_POINTS; + +typedef UINT (*PFREERDP_RDPSND_DEVICE_ENTRY)(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints); + +FREERDP_API rdpContext* freerdp_rdpsnd_get_context(rdpsndPlugin* plugin); + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_CHANNEL_RDPSND_CLIENT_RDPSND_H */ diff --git a/include/freerdp/client/remdesk.h b/include/freerdp/client/remdesk.h new file mode 100644 index 0000000..cc9799d --- /dev/null +++ b/include/freerdp/client/remdesk.h @@ -0,0 +1,44 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Remote Assistance Virtual Channel + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_CHANNEL_REMDESK_CLIENT_REMDESK_H +#define FREERDP_CHANNEL_REMDESK_CLIENT_REMDESK_H + +#include <freerdp/channels/remdesk.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Client Interface + */ + + typedef struct + { + void* handle; + void* custom; + } RemdeskClientContext; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_REMDESK_CLIENT_REMDESK_H */ diff --git a/include/freerdp/client/sshagent.h b/include/freerdp/client/sshagent.h new file mode 100644 index 0000000..c3404d1 --- /dev/null +++ b/include/freerdp/client/sshagent.h @@ -0,0 +1,95 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * SSH Agent Virtual Channel Extension + * + * Copyright 2017 Ben Cohen + * + * 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_CHANNEL_CLIENT_SSHAGENT_H +#define FREERDP_CHANNEL_CLIENT_SSHAGENT_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/message.h> +#include <freerdp/channels/cliprdr.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + int ProtocolVersion; + int MaxConnections; + } SSHAgentClientContext; + + /* + * The channel is defined by the sshagent channel in xrdp as follows. + * + * Server to client commands + * ------------------------- + * + * Capabilities (at start of channel stream): + * + * INT32 SA_TAG_CAPABILITY + * INT32 SSHAGENT_CHAN_PROT_VERSION := 1 + * INT32 SSHAGENT_MAX_CONNECTIONS + * + * Open connection: + * + * INT32 SA_TAG_OPEN + * INT32 Connection id (0, ..., SSHAGENT_MAX_CONNECTIONS - 1) + * + * Send data: + * + * INT32 SA_TAG_WRITE + * INT32 Connection id (0, ..., SSHAGENT_MAX_CONNECTIONS - 1) + * INT32 Data length + * DATA ... + * + * Close connection: + * + * INT32 SA_TAG_CLOSE + * INT32 Connection id (0, ..., SSHAGENT_MAX_CONNECTIONS - 1) + * + * Client to server commands + * ------------------------- + * + * Capabilities (in reply to server capabilities): + * + * INT32 SA_TAG_CAPABILITY + * INT32 SSHAGENT_CHAN_PROT_VERSION := 1 + * INT32 SSHAGENT_MAX_CONNECTIONS + * + * Send data: + * + * INT32 SA_TAG_WRITE + * INT32 Connection id (0, ..., SSHAGENT_MAX_CONNECTIONS - 1) + * INT32 Data length + * DATA ... + * + * Close connection (abnormal): + * + * INT32 SA_TAG_CLOSE + * INT32 Connection id (0, ..., SSHAGENT_MAX_CONNECTIONS - 1) + */ + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_CLIENT_SSHAGENT_H */ diff --git a/include/freerdp/client/tsmf.h b/include/freerdp/client/tsmf.h new file mode 100644 index 0000000..e9cff3c --- /dev/null +++ b/include/freerdp/client/tsmf.h @@ -0,0 +1,79 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Multimedia Redirection Virtual Channel Types + * + * Copyright 2011 Vic Lee + * + * 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. + */ + +/* DEPRECATION WARNING: + * + * This channel is unmaintained and not used since windows 7. + * Only compile and use it if absolutely necessary, otherwise + * deactivate it or use the newer [MS-RDPEVOR] video redirection. + */ + +#ifndef FREERDP_CHANNEL_TSMF_CLIENT_TSMF_H +#define FREERDP_CHANNEL_TSMF_CLIENT_TSMF_H + +#include <freerdp/codec/region.h> + +#include <freerdp/channels/tsmf.h> + +/* RDP_VIDEO_FRAME_EVENT.frame_pixfmt */ +/* http://www.fourcc.org/yuv.php */ +#define RDP_PIXFMT_I420 0x30323449 +#define RDP_PIXFMT_YV12 0x32315659 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + BYTE* frameData; + UINT32 frameSize; + UINT32 framePixFmt; + INT16 frameWidth; + INT16 frameHeight; + INT16 x; + INT16 y; + INT16 width; + INT16 height; + UINT16 numVisibleRects; + RECTANGLE_16* visibleRects; + } TSMF_VIDEO_FRAME_EVENT; + + /** + * Client Interface + */ + + typedef struct s_tsmf_client_context TsmfClientContext; + + typedef int (*pcTsmfFrameEvent)(TsmfClientContext* context, TSMF_VIDEO_FRAME_EVENT* event); + + struct s_tsmf_client_context + { + void* handle; + void* custom; + + pcTsmfFrameEvent FrameEvent; + }; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_TSMF_CLIENT_TSMF_H */ diff --git a/include/freerdp/client/utils/smartcard_cli.h b/include/freerdp/client/utils/smartcard_cli.h new file mode 100644 index 0000000..4aec92b --- /dev/null +++ b/include/freerdp/client/utils/smartcard_cli.h @@ -0,0 +1,37 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Smartcard client functions + * + * Copyright 2021 David Fort <contact@hardening-consulting.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 UTILS_SMARTCARD_CLI_H__ +#define UTILS_SMARTCARD_CLI_H__ + +#include <freerdp/api.h> +#include <freerdp/settings.h> + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + FREERDP_API BOOL freerdp_smartcard_list(const rdpSettings* settings); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* UTILS_SMARTCARD_CLI_H__ */ diff --git a/include/freerdp/client/video.h b/include/freerdp/client/video.h new file mode 100644 index 0000000..e520e98 --- /dev/null +++ b/include/freerdp/client/video.h @@ -0,0 +1,74 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Video Optimized Remoting Virtual Channel Extension + * + * Copyright 2017 David Fort <contact@hardening-consulting.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_CHANNELS_CLIENT_VIDEO_H +#define FREERDP_CHANNELS_CLIENT_VIDEO_H + +#include <freerdp/client/geometry.h> +#include <freerdp/channels/video.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_VideoClientContext VideoClientContext; + typedef struct s_VideoClientContextPriv VideoClientContextPriv; + + /** @brief an implementation of surface used by the video channel */ + typedef struct + { + UINT32 x, y, w, h; + UINT32 alignedWidth, alignedHeight; + BYTE* data; + DWORD format; + UINT32 scanline; + } VideoSurface; + + typedef void (*pcVideoTimer)(VideoClientContext* video, UINT64 now); + typedef void (*pcVideoSetGeometry)(VideoClientContext* video, GeometryClientContext* geometry); + typedef VideoSurface* (*pcVideoCreateSurface)(VideoClientContext* video, UINT32 x, UINT32 y, + UINT32 width, UINT32 height); + typedef BOOL (*pcVideoShowSurface)(VideoClientContext* video, const VideoSurface* surface, + UINT32 destinationWidth, UINT32 destinationHeight); + typedef BOOL (*pcVideoDeleteSurface)(VideoClientContext* video, VideoSurface* surface); + + /** @brief context for the video (MS-RDPEVOR) channel */ + struct s_VideoClientContext + { + void* handle; + void* custom; + VideoClientContextPriv* priv; + + pcVideoSetGeometry setGeometry; + pcVideoTimer timer; + pcVideoCreateSurface createSurface; + pcVideoShowSurface showSurface; + pcVideoDeleteSurface deleteSurface; + }; + + FREERDP_API VideoSurface* VideoClient_CreateCommonContext(size_t size, UINT32 x, UINT32 y, + UINT32 w, UINT32 h); + FREERDP_API void VideoClient_DestroyCommonContext(VideoSurface* surface); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNELS_CLIENT_VIDEO_H */ diff --git a/include/freerdp/codec/audio.h b/include/freerdp/codec/audio.h new file mode 100644 index 0000000..08be77d --- /dev/null +++ b/include/freerdp/codec/audio.h @@ -0,0 +1,228 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Audio Formats + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.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_CODEC_AUDIO_H +#define FREERDP_CODEC_AUDIO_H + +#include <winpr/wlog.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + struct AUDIO_FORMAT + { + UINT16 wFormatTag; + UINT16 nChannels; + UINT32 nSamplesPerSec; + UINT32 nAvgBytesPerSec; + UINT16 nBlockAlign; + UINT16 wBitsPerSample; + UINT16 cbSize; + BYTE* data; + }; + typedef struct AUDIO_FORMAT AUDIO_FORMAT; + +#define SNDC_CLOSE 1 +#define SNDC_WAVE 2 +#define SNDC_SETVOLUME 3 +#define SNDC_SETPITCH 4 +#define SNDC_WAVECONFIRM 5 +#define SNDC_TRAINING 6 +#define SNDC_FORMATS 7 +#define SNDC_CRYPTKEY 8 +#define SNDC_WAVEENCRYPT 9 +#define SNDC_UDPWAVE 10 +#define SNDC_UDPWAVELAST 11 +#define SNDC_QUALITYMODE 12 +#define SNDC_WAVE2 13 + +#define TSSNDCAPS_ALIVE 1 +#define TSSNDCAPS_VOLUME 2 +#define TSSNDCAPS_PITCH 4 + +#define DYNAMIC_QUALITY 0x0000 +#define MEDIUM_QUALITY 0x0001 +#define HIGH_QUALITY 0x0002 + + /* + * Format Tags: + * http://tools.ietf.org/html/rfc2361 + */ + +#ifndef WAVE_FORMAT_UNKNOWN +#define WAVE_FORMAT_UNKNOWN 0x0000 +#endif /* !WAVE_FORMAT_UNKNOWN */ + +#ifndef WAVE_FORMAT_PCM +#define WAVE_FORMAT_PCM 0x0001 +#endif /* !WAVE_FORMAT_PCM */ + +#ifndef WAVE_FORMAT_ADPCM +#define WAVE_FORMAT_ADPCM 0x0002 +#define WAVE_FORMAT_IEEE_FLOAT 0x0003 +#define WAVE_FORMAT_VSELP 0x0004 +#define WAVE_FORMAT_IBM_CVSD 0x0005 +#define WAVE_FORMAT_ALAW 0x0006 +#define WAVE_FORMAT_MULAW 0x0007 +#define WAVE_FORMAT_OKI_ADPCM 0x0010 +#define WAVE_FORMAT_DVI_ADPCM 0x0011 +#define WAVE_FORMAT_MEDIASPACE_ADPCM 0x0012 +#define WAVE_FORMAT_SIERRA_ADPCM 0x0013 +#define WAVE_FORMAT_G723_ADPCM 0x0014 +#define WAVE_FORMAT_DIGISTD 0x0015 +#define WAVE_FORMAT_DIGIFIX 0x0016 +#define WAVE_FORMAT_DIALOGIC_OKI_ADPCM 0x0017 +#define WAVE_FORMAT_MEDIAVISION_ADPCM 0x0018 +#define WAVE_FORMAT_CU_CODEC 0x0019 +#define WAVE_FORMAT_YAMAHA_ADPCM 0x0020 +#define WAVE_FORMAT_SONARC 0x0021 +#define WAVE_FORMAT_DSPGROUP_TRUESPEECH 0x0022 +#define WAVE_FORMAT_ECHOSC1 0x0023 +#define WAVE_FORMAT_AUDIOFILE_AF36 0x0024 +#define WAVE_FORMAT_APTX 0x0025 +#define WAVE_FORMAT_AUDIOFILE_AF10 0x0026 +#define WAVE_FORMAT_PROSODY_1612 0x0027 +#define WAVE_FORMAT_LRC 0x0028 +#define WAVE_FORMAT_DOLBY_AC2 0x0030 +#define WAVE_FORMAT_GSM610 0x0031 +#define WAVE_FORMAT_MSNAUDIO 0x0032 +#define WAVE_FORMAT_ANTEX_ADPCME 0x0033 +#define WAVE_FORMAT_CONTROL_RES_VQLPC 0x0034 +#define WAVE_FORMAT_DIGIREAL 0x0035 +#define WAVE_FORMAT_DIGIADPCM 0x0036 +#define WAVE_FORMAT_CONTROL_RES_CR10 0x0037 +#define WAVE_FORMAT_NMS_VBXADPCM 0x0038 +#define WAVE_FORMAT_ROLAND_RDAC 0x0039 +#define WAVE_FORMAT_ECHOSC3 0x003A +#define WAVE_FORMAT_ROCKWELL_ADPCM 0x003B +#define WAVE_FORMAT_ROCKWELL_DIGITALK 0x003C +#define WAVE_FORMAT_XEBEC 0x003D +#define WAVE_FORMAT_G721_ADPCM 0x0040 +#define WAVE_FORMAT_G728_CELP 0x0041 +#define WAVE_FORMAT_MSG723 0x0042 +#define WAVE_FORMAT_MPEG 0x0050 +#define WAVE_FORMAT_RT24 0x0052 +#define WAVE_FORMAT_PAC 0x0053 +#endif /* !WAVE_FORMAT_ADPCM */ + +#ifndef WAVE_FORMAT_MPEGLAYER3 +#define WAVE_FORMAT_MPEGLAYER3 0x0055 +#endif + +#ifndef WAVE_FORMAT_LUCENT_G723 +#define WAVE_FORMAT_LUCENT_G723 0x0059 +#define WAVE_FORMAT_CIRRUS 0x0060 +#define WAVE_FORMAT_ESPCM 0x0061 +#define WAVE_FORMAT_VOXWARE 0x0062 +#define WAVE_FORMAT_CANOPUS_ATRAC 0x0063 +#define WAVE_FORMAT_G726_ADPCM 0x0064 +#define WAVE_FORMAT_G722_ADPCM 0x0065 +#define WAVE_FORMAT_DSAT 0x0066 +#define WAVE_FORMAT_DSAT_DISPLAY 0x0067 +#define WAVE_FORMAT_VOXWARE_BYTE_ALIGNED 0x0069 +#define WAVE_FORMAT_VOXWARE_AC8 0x0070 +#define WAVE_FORMAT_VOXWARE_AC10 0x0071 +#define WAVE_FORMAT_VOXWARE_AC16 0x0072 +#define WAVE_FORMAT_VOXWARE_AC20 0x0073 +#define WAVE_FORMAT_VOXWARE_RT24 0x0074 +#define WAVE_FORMAT_VOXWARE_RT29 0x0075 +#define WAVE_FORMAT_VOXWARE_RT29HW 0x0076 +#define WAVE_FORMAT_VOXWARE_VR12 0x0077 +#define WAVE_FORMAT_VOXWARE_VR18 0x0078 +#define WAVE_FORMAT_VOXWARE_TQ40 0x0079 +#define WAVE_FORMAT_SOFTSOUND 0x0080 +#define WAVE_FORMAT_VOXWARE_TQ60 0x0081 +#define WAVE_FORMAT_MSRT24 0x0082 +#define WAVE_FORMAT_G729A 0x0083 +#define WAVE_FORMAT_MVI_MV12 0x0084 +#define WAVE_FORMAT_DF_G726 0x0085 +#define WAVE_FORMAT_DF_GSM610 0x0086 +#define WAVE_FORMAT_ISIAUDIO 0x0088 +#define WAVE_FORMAT_ONLIVE 0x0089 +#define WAVE_FORMAT_SBC24 0x0091 +#define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 +#define WAVE_FORMAT_ZYXEL_ADPCM 0x0097 +#define WAVE_FORMAT_PHILIPS_LPCBB 0x0098 +#define WAVE_FORMAT_PACKED 0x0099 +#define WAVE_FORMAT_RHETOREX_ADPCM 0x0100 +#define WAVE_FORMAT_IRAT 0x0101 +#define WAVE_FORMAT_VIVO_G723 0x0111 +#define WAVE_FORMAT_VIVO_SIREN 0x0112 +#define WAVE_FORMAT_DIGITAL_G723 0x0123 +#define WAVE_FORMAT_WMAUDIO2 0x0161 +#define WAVE_FORMAT_WMAUDIO3 0x0162 +#define WAVE_FORMAT_WMAUDIO_LOSSLESS 0x0163 +#define WAVE_FORMAT_CREATIVE_ADPCM 0x0200 +#define WAVE_FORMAT_CREATIVE_FASTSPEECH8 0x0202 +#define WAVE_FORMAT_CREATIVE_FASTSPEECH10 0x0203 +#define WAVE_FORMAT_QUARTERDECK 0x0220 +#define WAVE_FORMAT_FM_TOWNS_SND 0x0300 +#define WAVE_FORMAT_BTV_DIGITAL 0x0400 +#define WAVE_FORMAT_VME_VMPCM 0x0680 +#define WAVE_FORMAT_OLIGSM 0x1000 +#define WAVE_FORMAT_OLIADPCM 0x1001 +#define WAVE_FORMAT_OLICELP 0x1002 +#define WAVE_FORMAT_OLISBC 0x1003 +#define WAVE_FORMAT_OLIOPR 0x1004 +#define WAVE_FORMAT_LH_CODEC 0x1100 +#define WAVE_FORMAT_NORRIS 0x1400 +#define WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS 0x1500 +#define WAVE_FORMAT_DVM 0x2000 +#endif /* !WAVE_FORMAT_LUCENT_G723 */ +#define WAVE_FORMAT_OPUS 0x704F +#define WAVE_FORMAT_AAC_MS 0xA106 + +#define WAVE_FORMAT_EXTENSIBLE 0xFFFE + + /** + * Audio Format Functions + */ + + FREERDP_API UINT32 audio_format_compute_time_length(const AUDIO_FORMAT* format, size_t size); + + FREERDP_API char* audio_format_get_tag_string(UINT16 wFormatTag); + + FREERDP_API void audio_format_print(wLog* log, DWORD level, const AUDIO_FORMAT* format); + FREERDP_API void audio_formats_print(wLog* log, DWORD level, const AUDIO_FORMAT* formats, + UINT16 count); + + FREERDP_API BOOL audio_format_read(wStream* s, AUDIO_FORMAT* format); + FREERDP_API BOOL audio_format_write(wStream* s, const AUDIO_FORMAT* format); + FREERDP_API BOOL audio_format_copy(const AUDIO_FORMAT* srcFormat, AUDIO_FORMAT* dstFormat); + FREERDP_API BOOL audio_format_compatible(const AUDIO_FORMAT* with, const AUDIO_FORMAT* what); + + FREERDP_API void audio_format_free(AUDIO_FORMAT* format); + FREERDP_API void audio_formats_free(AUDIO_FORMAT* formats, size_t count); + + WINPR_ATTR_MALLOC(audio_formats_free, 1) + FREERDP_API AUDIO_FORMAT* audio_format_new(void); + + WINPR_ATTR_MALLOC(audio_formats_free, 1) + FREERDP_API AUDIO_FORMAT* audio_formats_new(size_t count); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_AUDIO_H */ diff --git a/include/freerdp/codec/bitmap.h b/include/freerdp/codec/bitmap.h new file mode 100644 index 0000000..d64bbef --- /dev/null +++ b/include/freerdp/codec/bitmap.h @@ -0,0 +1,44 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Compressed Bitmap + * + * Copyright 2011 Jay Sorg <jay.sorg@gmail.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_CODEC_BITMAP_H +#define FREERDP_CODEC_BITMAP_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codec/color.h> + +#include <winpr/crt.h> +#include <winpr/stream.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API SSIZE_T freerdp_bitmap_compress(const void* in_data, UINT32 width, UINT32 height, + wStream* s, UINT32 bpp, UINT32 byte_limit, + UINT32 start_line, wStream* temp_s, UINT32 e); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_BITMAP_H */ diff --git a/include/freerdp/codec/bulk.h b/include/freerdp/codec/bulk.h new file mode 100644 index 0000000..6f20c80 --- /dev/null +++ b/include/freerdp/codec/bulk.h @@ -0,0 +1,39 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Bulk Data Compression + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_CODEC_BULK_H +#define FREERDP_CODEC_BULK_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +/* Level-2 Compression Flags */ + +#define PACKET_COMPRESSED 0x20 +#define PACKET_AT_FRONT 0x40 +#define PACKET_FLUSHED 0x80 + +/* Level-1 Compression Flags */ + +#define L1_PACKET_AT_FRONT 0x04 +#define L1_NO_COMPRESSION 0x02 +#define L1_COMPRESSED 0x01 +#define L1_INNER_COMPRESSION 0x10 + +#endif /* FREERDP_CODEC_BULK_H */ diff --git a/include/freerdp/codec/clear.h b/include/freerdp/codec/clear.h new file mode 100644 index 0000000..4f6ab2a --- /dev/null +++ b/include/freerdp/codec/clear.h @@ -0,0 +1,56 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * ClearCodec Bitmap Compression + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_CODEC_CLEAR_H +#define FREERDP_CODEC_CLEAR_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codec/nsc.h> +#include <freerdp/codec/color.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_CLEAR_CONTEXT CLEAR_CONTEXT; + + FREERDP_API int clear_compress(CLEAR_CONTEXT* clear, const BYTE* pSrcData, UINT32 SrcSize, + BYTE** ppDstData, UINT32* pDstSize); + + FREERDP_API INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData, UINT32 SrcSize, + UINT32 nWidth, UINT32 nHeight, BYTE* pDstData, + UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, + UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, + const gdiPalette* palette); + + FREERDP_API BOOL clear_context_reset(CLEAR_CONTEXT* clear); + + FREERDP_API void clear_context_free(CLEAR_CONTEXT* clear); + + WINPR_ATTR_MALLOC(clear_context_free, 1) + FREERDP_API CLEAR_CONTEXT* clear_context_new(BOOL Compressor); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_CLEAR_H */ diff --git a/include/freerdp/codec/color.h b/include/freerdp/codec/color.h new file mode 100644 index 0000000..10b35ef --- /dev/null +++ b/include/freerdp/codec/color.h @@ -0,0 +1,428 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Color Conversion Routines + * + * Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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_CODEC_COLOR_H +#define FREERDP_CODEC_COLOR_H + +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define FREERDP_PIXEL_FORMAT_TYPE_A 0 +#define FREERDP_PIXEL_FORMAT_TYPE_ARGB 1 +#define FREERDP_PIXEL_FORMAT_TYPE_ABGR 2 +#define FREERDP_PIXEL_FORMAT_TYPE_RGBA 3 +#define FREERDP_PIXEL_FORMAT_TYPE_BGRA 4 + +#define FREERDP_PIXEL_FORMAT_IS_ABGR(_format) \ + (FREERDP_PIXEL_FORMAT_TYPE(_format) == FREERDP_PIXEL_FORMAT_TYPE_ABGR) + +enum FREERDP_IMAGE_FLAGS +{ + FREERDP_FLIP_NONE = 0, + FREERDP_FLIP_VERTICAL = 1, + FREERDP_FLIP_HORIZONTAL = 2, + FREERDP_KEEP_DST_ALPHA = 4 +}; + +#define FREERDP_PIXEL_FORMAT(_bpp, _type, _a, _r, _g, _b) \ + ((_bpp << 24) | (_type << 16) | (_a << 12) | (_r << 8) | (_g << 4) | (_b)) + +#define FREERDP_PIXEL_FORMAT_TYPE(_format) (((_format) >> 16) & 0x07) + +/*** Design considerations + * + * The format naming scheme is based on byte position in memory. + * RGBA for example names a byte array with red on positon 0, green on 1 etc. + * + * To read and write the appropriate format from / to memory use FreeRDPReadColor and + * FreeRDPWriteColor. + * + * The single pixel manipulation functions use an intermediate integer representation + * that must not be interpreted outside the functions as it is platform dependent. + * + * X for alpha channel denotes unused (but existing) alpha channel data. + */ + +/* 32bpp formats */ +#define PIXEL_FORMAT_ARGB32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 8, 8, 8, 8) +#define PIXEL_FORMAT_XRGB32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8) +#define PIXEL_FORMAT_ABGR32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 8, 8, 8, 8) +#define PIXEL_FORMAT_XBGR32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8) +#define PIXEL_FORMAT_BGRA32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 8, 8, 8, 8) +#define PIXEL_FORMAT_BGRX32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 0, 8, 8, 8) +#define PIXEL_FORMAT_RGBA32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 8, 8, 8, 8) +#define PIXEL_FORMAT_RGBX32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 0, 8, 8, 8) +#define PIXEL_FORMAT_BGRX32_DEPTH30 \ + FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 0, 10, 10, 10) +#define PIXEL_FORMAT_RGBX32_DEPTH30 \ + FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 0, 10, 10, 10) + +/* 24bpp formats */ +#define PIXEL_FORMAT_RGB24 FREERDP_PIXEL_FORMAT(24, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8) +#define PIXEL_FORMAT_BGR24 FREERDP_PIXEL_FORMAT(24, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8) + +/* 16bpp formats */ +#define PIXEL_FORMAT_RGB16 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 6, 5) +#define PIXEL_FORMAT_BGR16 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 6, 5) +#define PIXEL_FORMAT_ARGB15 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 1, 5, 5, 5) +#define PIXEL_FORMAT_RGB15 FREERDP_PIXEL_FORMAT(15, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 5, 5) +#define PIXEL_FORMAT_ABGR15 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 1, 5, 5, 5) +#define PIXEL_FORMAT_BGR15 FREERDP_PIXEL_FORMAT(15, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 5, 5) + +/* 8bpp formats */ +#define PIXEL_FORMAT_RGB8 FREERDP_PIXEL_FORMAT(8, FREERDP_PIXEL_FORMAT_TYPE_A, 8, 0, 0, 0) + +/* 4 bpp formats */ +#define PIXEL_FORMAT_A4 FREERDP_PIXEL_FORMAT(4, FREERDP_PIXEL_FORMAT_TYPE_A, 4, 0, 0, 0) + +/* 1bpp formats */ +#define PIXEL_FORMAT_MONO FREERDP_PIXEL_FORMAT(1, FREERDP_PIXEL_FORMAT_TYPE_A, 1, 0, 0, 0) + +struct gdi_palette +{ + UINT32 format; + UINT32 palette[256]; +}; +typedef struct gdi_palette gdiPalette; + + /* Compare two color formats but ignore differences in alpha channel. + */ + FREERDP_API DWORD FreeRDPAreColorFormatsEqualNoAlpha(DWORD first, DWORD second); + + /* Color Space Conversions: http://msdn.microsoft.com/en-us/library/ff566496/ */ + + /*** + * + * Get a string representation of a color + * + * @param format The pixel color format + * + * @return A string representation of format + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define GetColorFormatName(...) FreeRDPGetColorFormatName(__VA_ARGS__) +#endif + FREERDP_API const char* FreeRDPGetColorFormatName(UINT32 format); + + /*** + * + * Converts a pixel color in internal representation to its red, green, blue + * and alpha components. + * + * @param color The color in format internal representation + * @param format one of PIXEL_FORMAT_* color format defines + * @param _r red color value + * @param _g green color value + * @param _b blue color value + * @param _a alpha color value + * @param palette pallete to use (only used for 8 bit color!) + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define SplitColor(...) FreeRDPSplitColor(__VA_ARGS__) +#endif + FREERDP_API void FreeRDPSplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g, BYTE* _b, + BYTE* _a, const gdiPalette* palette); + + /*** + * + * Converts red, green, blue and alpha values to internal representation. + * + * @param format one of PIXEL_FORMAT_* color format defines + * @param r red color value + * @param g green color value + * @param b blue color value + * @param a alpha color value + * + * @return The pixel color in the desired format. Value is in internal + * representation. + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define GetColor(...) FreeRDPGetColor(__VA_ARGS__) +#endif + FREERDP_API UINT32 FreeRDPGetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a); + + /*** + * + * Returns the number of bits the format format uses. + * + * @param format One of PIXEL_FORMAT_* defines + * + * @return The number of bits the format requires per pixel. + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define GetBitsPerPixel(...) FreeRDPGetBitsPerPixel(__VA_ARGS__) +#endif + static INLINE UINT32 FreeRDPGetBitsPerPixel(UINT32 format) + { + return (((format) >> 24) & 0x3F); + } + + /*** + * @param format one of PIXEL_FORMAT_* color format defines + * + * @return TRUE if the format has an alpha channel, FALSE otherwise. + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define ColorHasAlpha(...) FreeRDPColorHasAlpha(__VA_ARGS__) +#endif + static INLINE BOOL FreeRDPColorHasAlpha(UINT32 format) + { + UINT32 alpha = (((format) >> 12) & 0x0F); + + if (alpha == 0) + return FALSE; + + return TRUE; + } + + /*** + * + * Read a pixel from memory to internal representation + * + * @param src The source buffer + * @param format The PIXEL_FORMAT_* define the source buffer uses for encoding + * + * @return The pixel color in internal representation + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define ReadColor(...) FreeRDPReadColor(__VA_ARGS__) +#endif + FREERDP_API UINT32 FreeRDPReadColor(const BYTE* WINPR_RESTRICT src, UINT32 format); + + /*** + * + * Write a pixel from internal representation to memory + * + * @param dst The destination buffer + * @param format The PIXEL_FORMAT_* define for encoding + * @param color The pixel color in internal representation + * + * @return TRUE if successful, FALSE otherwise + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define WriteColor(...) FreeRDPWriteColor(__VA_ARGS__) +#define WriteColorIgnoreAlpha(...) FreeRDPWriteColorIgnoreAlpha(__VA_ARGS__) +#endif + FREERDP_API BOOL FreeRDPWriteColor(BYTE* WINPR_RESTRICT dst, UINT32 format, UINT32 color); + FREERDP_API BOOL FreeRDPWriteColorIgnoreAlpha(BYTE* WINPR_RESTRICT dst, UINT32 format, + UINT32 color); + + /*** + * + * Converts a pixel in internal representation format srcFormat to internal + * representation format dstFormat + * + * @param color The pixel color in srcFormat representation + * @param srcFormat The PIXEL_FORMAT_* of color + * @param dstFormat The PIXEL_FORMAT_* of the return. + * @param palette pallete to use (only used for 8 bit color!) + * + * @return The converted pixel color in dstFormat representation + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define ConvertColor(...) FreeRDPConvertColor(__VA_ARGS__) +#endif + static INLINE UINT32 FreeRDPConvertColor(UINT32 color, UINT32 srcFormat, UINT32 dstFormat, + const gdiPalette* palette) + { + BYTE r = 0; + BYTE g = 0; + BYTE b = 0; + BYTE a = 0; + FreeRDPSplitColor(color, srcFormat, &r, &g, &b, &a, palette); + return FreeRDPGetColor(dstFormat, r, g, b, a); + } + + /*** + * + * Returns the number of bytes the format format uses. + * + * @param format One of PIXEL_FORMAT_* defines + * + * @return The number of bytes the format requires per pixel. + */ +#if defined(WITH_FREERDP_DEPRECATED) +#define GetBytesPerPixel(...) FreeRDPGetBytesPerPixel(__VA_ARGS__) +#endif + static INLINE UINT32 FreeRDPGetBytesPerPixel(UINT32 format) + { + return (FreeRDPGetBitsPerPixel(format) + 7) / 8; + } + + /*** + * + * @param width width to copy in pixels + * @param height height to copy in pixels + * @param data source buffer, must be (nWidth + 7) / 8 bytes long + * + * @return A buffer allocated with winpr_aligned_malloc(width * height, 16) + * if successful, NULL otherwise. + */ + FREERDP_API BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height, const BYTE* data); + + /*** + * + * @param pDstData destination buffer + * @param DstFormat destination buffer format + * @param nDstStep destination buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nWidth width to copy in pixels + * @param nHeight height to copy in pixels + * @param pSrcData source buffer, must be (nWidth + 7) / 8 bytes long + * @param backColor The background color in internal representation format + * @param foreColor The foreground color in internal representation format + * @param palette palette to use (only used for 8 bit color!) + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_copy_from_monochrome( + BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, + UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT pSrcData, + UINT32 backColor, UINT32 foreColor, const gdiPalette* WINPR_RESTRICT palette); + + /*** + * + * @param pDstData destination buffer + * @param DstFormat destination buffer format + * @param nDstStep destination buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nWidth width to copy in pixels + * @param nHeight height to copy in pixels + * @param bitsColor icon's image data buffer + * @param cbBitsColor length of the image data buffer in bytes + * @param bitsMask icon's 1bpp image mask buffer + * @param cbBitsMask length of the image mask buffer in bytes + * @param colorTable icon's image color table + * @param cbColorTable length of the image color table buffer in bytes + * @param bpp color image data bits per pixel + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_copy_from_icon_data( + BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, + UINT32 nYDst, UINT16 nWidth, UINT16 nHeight, const BYTE* WINPR_RESTRICT bitsColor, + UINT16 cbBitsColor, const BYTE* WINPR_RESTRICT bitsMask, UINT16 cbBitsMask, + const BYTE* WINPR_RESTRICT colorTable, UINT16 cbColorTable, UINT32 bpp); + + /*** + * + * @param pDstData destination buffer + * @param DstFormat destination buffer format + * @param nDstStep destination buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nWidth width to copy in pixels + * @param nHeight height to copy in pixels + * @param xorMask XOR mask buffer + * @param xorMaskLength XOR mask length in bytes + * @param andMask AND mask buffer + * @param andMaskLength AND mask length in bytes + * @param xorBpp XOR bits per pixel + * @param palette palette to use (only used for 8 bit color!) + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_copy_from_pointer_data( + BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, + UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT xorMask, + UINT32 xorMaskLength, const BYTE* WINPR_RESTRICT andMask, UINT32 andMaskLength, + UINT32 xorBpp, const gdiPalette* WINPR_RESTRICT palette); + + /*** + * + * @param pDstData destination buffer + * @param DstFormat destination buffer format + * @param nDstStep destination buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nWidth width to copy in pixels + * @param nHeight height to copy in pixels + * @param pSrcData source buffer + * @param SrcFormat source buffer format + * @param nSrcStep source buffer stride (line in bytes) 0 for default + * @param nXSrc source buffer x offset in pixels + * @param nYSrc source buffer y offset in pixels + * @param palette palette to use (only used for 8 bit color!) + * @param flags Image flipping flags FREERDP_FLIP_NONE et al + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep, + UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, + const BYTE* pSrcData, DWORD SrcFormat, UINT32 nSrcStep, + UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette, + UINT32 flags); + + /*** + * + * @param pDstData destination buffer + * @param DstFormat destination buffer format + * @param nDstStep destination buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nDstWidth width of destination in pixels + * @param nDstHeight height of destination in pixels + * @param pSrcData source buffer + * @param SrcFormat source buffer format + * @param nSrcStep source buffer stride (line in bytes) 0 for default + * @param nXSrc source buffer x offset in pixels + * @param nYSrc source buffer y offset in pixels + * @param nSrcWidth width of source in pixels + * @param nSrcHeight height of source in pixels + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_scale(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat, + UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, + UINT32 nDstWidth, UINT32 nDstHeight, + const BYTE* WINPR_RESTRICT pSrcData, DWORD SrcFormat, + UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, + UINT32 nSrcWidth, UINT32 nSrcHeight); + + /*** + * + * @param pDstData destionation buffer + * @param DstFormat destionation buffer format + * @param nDstStep destionation buffer stride (line in bytes) 0 for default + * @param nXDst destination buffer offset x + * @param nYDst destination buffer offset y + * @param nWidth width to copy in pixels + * @param nHeight height to copy in pixels + * @param color Pixel color in DstFormat (internal representation format, + * use FreeRDPGetColor to create) + * + * @return TRUE if success, FALSE otherwise + */ + FREERDP_API BOOL freerdp_image_fill(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat, + UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, + UINT32 nHeight, UINT32 color); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_COLOR_H */ diff --git a/include/freerdp/codec/dsp.h b/include/freerdp/codec/dsp.h new file mode 100644 index 0000000..8fbdad7 --- /dev/null +++ b/include/freerdp/codec/dsp.h @@ -0,0 +1,54 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Digital Sound Processing + * + * Copyright 2010-2011 Vic Lee + * + * 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_CODEC_DSP_H +#define FREERDP_CODEC_DSP_H + +#include <winpr/stream.h> + +#include <freerdp/api.h> +#include <freerdp/codec/audio.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_FREERDP_DSP_CONTEXT FREERDP_DSP_CONTEXT; + + FREERDP_API void freerdp_dsp_context_free(FREERDP_DSP_CONTEXT* context); + + WINPR_ATTR_MALLOC(freerdp_dsp_context_free, 1) + FREERDP_API FREERDP_DSP_CONTEXT* freerdp_dsp_context_new(BOOL encoder); + + FREERDP_API BOOL freerdp_dsp_supports_format(const AUDIO_FORMAT* format, BOOL encode); + FREERDP_API BOOL freerdp_dsp_encode(FREERDP_DSP_CONTEXT* context, const AUDIO_FORMAT* srcFormat, + const BYTE* data, size_t length, wStream* out); + FREERDP_API BOOL freerdp_dsp_decode(FREERDP_DSP_CONTEXT* context, const AUDIO_FORMAT* srcFormat, + const BYTE* data, size_t length, wStream* out); + + FREERDP_API BOOL freerdp_dsp_context_reset(FREERDP_DSP_CONTEXT* context, + const AUDIO_FORMAT* targetFormat, + UINT32 FramesPerPacket); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_DSP_H */ diff --git a/include/freerdp/codec/h264.h b/include/freerdp/codec/h264.h new file mode 100644 index 0000000..6ad96f9 --- /dev/null +++ b/include/freerdp/codec/h264.h @@ -0,0 +1,94 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * H.264 Bitmap Compression + * + * Copyright 2014 Mike McDonald <Mike.McDonald@software.dell.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_CODEC_H264_H +#define FREERDP_CODEC_H264_H + +#include <winpr/wlog.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/channels/rdpgfx.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_H264_CONTEXT_SUBSYSTEM H264_CONTEXT_SUBSYSTEM; + typedef struct S_H264_CONTEXT H264_CONTEXT; + typedef struct S_YUV_CONTEXT YUV_CONTEXT; + + typedef enum + { + H264_RATECONTROL_VBR = 0, + H264_RATECONTROL_CQP + } H264_RATECONTROL_MODE; + + typedef enum + { + H264_CONTEXT_OPTION_RATECONTROL, + H264_CONTEXT_OPTION_BITRATE, + H264_CONTEXT_OPTION_FRAMERATE, + H264_CONTEXT_OPTION_QP + } H264_CONTEXT_OPTION; + + FREERDP_API void free_h264_metablock(RDPGFX_H264_METABLOCK* meta); + + FREERDP_API BOOL h264_context_set_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option, + UINT32 value); + FREERDP_API UINT32 h264_context_get_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option); + + FREERDP_API INT32 avc420_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat, + UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight, + const RECTANGLE_16* regionRect, BYTE** ppDstData, + UINT32* pDstSize, RDPGFX_H264_METABLOCK* meta); + + FREERDP_API INT32 avc420_decompress(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSize, + BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep, + UINT32 nDstWidth, UINT32 nDstHeight, + const RECTANGLE_16* regionRects, UINT32 numRegionRect); + + FREERDP_API INT32 avc444_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat, + UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight, + BYTE version, const RECTANGLE_16* regionRect, BYTE* op, + BYTE** pDstData, UINT32* pDstSize, BYTE** pAuxDstData, + UINT32* pAuxDstSize, RDPGFX_H264_METABLOCK* meta, + RDPGFX_H264_METABLOCK* auxMeta); + + FREERDP_API INT32 avc444_decompress(H264_CONTEXT* h264, BYTE op, + const RECTANGLE_16* regionRects, UINT32 numRegionRect, + const BYTE* pSrcData, UINT32 SrcSize, + const RECTANGLE_16* auxRegionRects, UINT32 numAuxRegionRect, + const BYTE* pAuxSrcData, UINT32 AuxSrcSize, BYTE* pDstData, + DWORD DstFormat, UINT32 nDstStep, UINT32 nDstWidth, + UINT32 nDstHeight, UINT32 codecId); + + FREERDP_API BOOL h264_context_reset(H264_CONTEXT* h264, UINT32 width, UINT32 height); + + FREERDP_API void h264_context_free(H264_CONTEXT* h264); + + WINPR_ATTR_MALLOC(h264_context_free, 1) + FREERDP_API H264_CONTEXT* h264_context_new(BOOL Compressor); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_H264_H */ diff --git a/include/freerdp/codec/interleaved.h b/include/freerdp/codec/interleaved.h new file mode 100644 index 0000000..964fb04 --- /dev/null +++ b/include/freerdp/codec/interleaved.h @@ -0,0 +1,60 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Interleaved RLE Bitmap Codec + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_CODEC_INTERLEAVED_H +#define FREERDP_CODEC_INTERLEAVED_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codec/color.h> +#include <freerdp/codec/bitmap.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_BITMAP_INTERLEAVED_CONTEXT BITMAP_INTERLEAVED_CONTEXT; + + FREERDP_API BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, + const BYTE* pSrcData, UINT32 SrcSize, UINT32 nSrcWidth, + UINT32 nSrcHeight, UINT32 bpp, BYTE* pDstData, + UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, + UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, + const gdiPalette* palette); + + FREERDP_API BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pDstData, + UINT32* pDstSize, UINT32 nWidth, UINT32 nHeight, + const BYTE* pSrcData, UINT32 SrcFormat, UINT32 nSrcStep, + UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette, + UINT32 bpp); + + FREERDP_API BOOL bitmap_interleaved_context_reset(BITMAP_INTERLEAVED_CONTEXT* interleaved); + + FREERDP_API void bitmap_interleaved_context_free(BITMAP_INTERLEAVED_CONTEXT* interleaved); + + WINPR_ATTR_MALLOC(bitmap_interleaved_context_free, 1) + FREERDP_API BITMAP_INTERLEAVED_CONTEXT* bitmap_interleaved_context_new(BOOL Compressor); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_INTERLEAVED_H */ diff --git a/include/freerdp/codec/jpeg.h b/include/freerdp/codec/jpeg.h new file mode 100644 index 0000000..b9621fd --- /dev/null +++ b/include/freerdp/codec/jpeg.h @@ -0,0 +1,38 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Compressed Bitmap + * + * Copyright 2012 Jay Sorg <jay.sorg@gmail.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_CODEC_JPEG_H +#define FREERDP_CODEC_JPEG_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API BOOL jpeg_decompress(const BYTE* input, BYTE* output, int width, int height, + int size, int bpp); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_JPEG_H */ diff --git a/include/freerdp/codec/nsc.h b/include/freerdp/codec/nsc.h new file mode 100644 index 0000000..a0a266d --- /dev/null +++ b/include/freerdp/codec/nsc.h @@ -0,0 +1,78 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * NSCodec Codec + * + * Copyright 2011 Samsung, Author Jiten Pathy + * Copyright 2012 Vic Lee + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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_CODEC_NSCODEC_H +#define FREERDP_CODEC_NSCODEC_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/constants.h> + +#include <winpr/stream.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + NSC_COLOR_LOSS_LEVEL, + NSC_ALLOW_SUBSAMPLING, + NSC_DYNAMIC_COLOR_FIDELITY, + NSC_COLOR_FORMAT + } NSC_PARAMETER; + + typedef struct S_NSC_CONTEXT NSC_CONTEXT; + +#if defined(WITH_FREERDP_DEPRECATED) + FREERDP_API WINPR_DEPRECATED_VAR("Use nsc_context_set_parameters(NSC_COLOR_FORMAT)", + BOOL nsc_context_set_pixel_format(NSC_CONTEXT* context, + UINT32 pixel_format)); +#endif + + FREERDP_API BOOL nsc_context_set_parameters(NSC_CONTEXT* context, NSC_PARAMETER what, + UINT32 value); + + FREERDP_API BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp, UINT32 width, + UINT32 height, const BYTE* data, UINT32 length, + BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStride, + UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, + UINT32 flip); + FREERDP_API BOOL nsc_compose_message(NSC_CONTEXT* context, wStream* s, const BYTE* bmpdata, + UINT32 width, UINT32 height, UINT32 rowstride); + FREERDP_API BOOL nsc_decompose_message(NSC_CONTEXT* context, wStream* s, BYTE* bmpdata, + UINT32 x, UINT32 y, UINT32 width, UINT32 height, + UINT32 rowstride, UINT32 format, UINT32 flip); + + FREERDP_API BOOL nsc_context_reset(NSC_CONTEXT* context, UINT32 width, UINT32 height); + + FREERDP_API void nsc_context_free(NSC_CONTEXT* context); + + WINPR_ATTR_MALLOC(nsc_context_free, 1) + FREERDP_API NSC_CONTEXT* nsc_context_new(void); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_NSCODEC_H */ diff --git a/include/freerdp/codec/planar.h b/include/freerdp/codec/planar.h new file mode 100644 index 0000000..e29bce2 --- /dev/null +++ b/include/freerdp/codec/planar.h @@ -0,0 +1,75 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP6 Planar Codec + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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_CODEC_PLANAR_H +#define FREERDP_CODEC_PLANAR_H + +#include <winpr/crt.h> + +#include <freerdp/codec/color.h> +#include <freerdp/codec/bitmap.h> + +#define PLANAR_FORMAT_HEADER_CS (1 << 3) +#define PLANAR_FORMAT_HEADER_RLE (1 << 4) +#define PLANAR_FORMAT_HEADER_NA (1 << 5) +#define PLANAR_FORMAT_HEADER_CLL_MASK 0x07 + +#define PLANAR_CONTROL_BYTE(_nRunLength, _cRawBytes) \ + (_nRunLength & 0x0F) | ((_cRawBytes & 0x0F) << 4) + +#define PLANAR_CONTROL_BYTE_RUN_LENGTH(_controlByte) (_controlByte & 0x0F) +#define PLANAR_CONTROL_BYTE_RAW_BYTES(_controlByte) ((_controlByte >> 4) & 0x0F) + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_BITMAP_PLANAR_CONTEXT BITMAP_PLANAR_CONTEXT; + + FREERDP_API BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context, + const BYTE* data, UINT32 format, UINT32 width, + UINT32 height, UINT32 scanline, BYTE* dstData, + UINT32* pDstSize); + + FREERDP_API BOOL freerdp_bitmap_planar_context_reset(BITMAP_PLANAR_CONTEXT* context, + UINT32 width, UINT32 height); + + FREERDP_API void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context); + + WINPR_ATTR_MALLOC(freerdp_bitmap_planar_context_free, 1) + FREERDP_API BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(DWORD flags, UINT32 width, + UINT32 height); + + FREERDP_API void freerdp_planar_switch_bgr(BITMAP_PLANAR_CONTEXT* planar, BOOL bgr); + FREERDP_API void freerdp_planar_topdown_image(BITMAP_PLANAR_CONTEXT* planar, BOOL topdown); + + FREERDP_API BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar, const BYTE* pSrcData, + UINT32 SrcSize, UINT32 nSrcWidth, UINT32 nSrcHeight, + BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep, + UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, + UINT32 nDstHeight, BOOL vFlip); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_PLANAR_H */ diff --git a/include/freerdp/codec/progressive.h b/include/freerdp/codec/progressive.h new file mode 100644 index 0000000..6593e63 --- /dev/null +++ b/include/freerdp/codec/progressive.h @@ -0,0 +1,76 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Progressive Codec Bitmap Compression + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_CODEC_PROGRESSIVE_H +#define FREERDP_CODEC_PROGRESSIVE_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <winpr/wlog.h> +#include <winpr/collections.h> + +#include <freerdp/codec/rfx.h> +#include <freerdp/codec/color.h> +#include <freerdp/codec/region.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_PROGRESSIVE_CONTEXT PROGRESSIVE_CONTEXT; + + FREERDP_API int progressive_compress(PROGRESSIVE_CONTEXT* progressive, const BYTE* pSrcData, + UINT32 SrcSize, UINT32 SrcFormat, UINT32 Width, + UINT32 Height, UINT32 ScanLine, + const REGION16* invalidRegion, BYTE** ppDstData, + UINT32* pDstSize); + + FREERDP_API INT32 progressive_decompress(PROGRESSIVE_CONTEXT* progressive, const BYTE* pSrcData, + UINT32 SrcSize, BYTE* pDstData, UINT32 DstFormat, + UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, + REGION16* invalidRegion, UINT16 surfaceId, + UINT32 frameId); + + FREERDP_API INT32 progressive_create_surface_context(PROGRESSIVE_CONTEXT* progressive, + UINT16 surfaceId, UINT32 width, + UINT32 height); + FREERDP_API int progressive_delete_surface_context(PROGRESSIVE_CONTEXT* progressive, + UINT16 surfaceId); + + FREERDP_API BOOL progressive_context_reset(PROGRESSIVE_CONTEXT* progressive); + + FREERDP_API void progressive_context_free(PROGRESSIVE_CONTEXT* progressive); + + WINPR_ATTR_MALLOC(progressive_context_free, 1) + FREERDP_API PROGRESSIVE_CONTEXT* progressive_context_new(BOOL Compressor); + + WINPR_ATTR_MALLOC(progressive_context_free, 1) + FREERDP_API PROGRESSIVE_CONTEXT* progressive_context_new_ex(BOOL Compressor, + UINT32 ThreadingFlags); + + FREERDP_API BOOL progressive_rfx_write_message_progressive_simple( + PROGRESSIVE_CONTEXT* progressive, wStream* s, const RFX_MESSAGE* msg); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_PROGRESSIVE_H */ diff --git a/include/freerdp/codec/region.h b/include/freerdp/codec/region.h new file mode 100644 index 0000000..19239b6 --- /dev/null +++ b/include/freerdp/codec/region.h @@ -0,0 +1,148 @@ +/** + * Copyright © 2014 Thincast Technologies GmbH + * Copyright © 2014 Hardening <contact@hardening-consulting.com> + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef FREERDP_CODEC_REGION_H +#define FREERDP_CODEC_REGION_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_REGION16_DATA REGION16_DATA; + + typedef struct + { + RECTANGLE_16 extents; + REGION16_DATA* data; + } REGION16; + + /** computes if two rectangles are equal + * @param r1 first rectangle + * @param r2 second rectangle + * @return if the two rectangles are equal + */ + FREERDP_API BOOL rectangles_equal(const RECTANGLE_16* r1, const RECTANGLE_16* r2); + + /** computes if two rectangles intersect + * @param r1 first rectangle + * @param r2 second rectangle + * @return if the two rectangles intersect + */ + FREERDP_API BOOL rectangles_intersects(const RECTANGLE_16* r1, const RECTANGLE_16* r2); + + /** computes the intersection of two rectangles + * @param r1 first rectangle + * @param r2 second rectangle + * @param dst resulting intersection + * @return if the two rectangles intersect + */ + FREERDP_API BOOL rectangles_intersection(const RECTANGLE_16* r1, const RECTANGLE_16* r2, + RECTANGLE_16* dst); + + /** initialize a region16 + * @param region the region to initialise + */ + FREERDP_API void region16_init(REGION16* region); + + /** @return the number of rectangles of this region16 */ + FREERDP_API int region16_n_rects(const REGION16* region); + + /** returns a pointer to rectangles and the number of rectangles in this region. + * nbRects can be set to NULL if not interested in the number of rectangles. + * @param region the input region + * @param nbRects if non-NULL returns the number of rectangles + * @return a pointer on the rectangles + */ + FREERDP_API const RECTANGLE_16* region16_rects(const REGION16* region, UINT32* nbRects); + + /** @return the extents rectangle of this region */ + FREERDP_API const RECTANGLE_16* region16_extents(const REGION16* region); + + /** returns if the rectangle is empty + * @param rect the rectangle to check + * @return if the rectangle is empty + */ + FREERDP_API BOOL rectangle_is_empty(const RECTANGLE_16* rect); + + /** returns if the region is empty + * @param region the region to check + * @return if the region is empty + */ + FREERDP_API BOOL region16_is_empty(const REGION16* region); + + /** clears the region, the region is reset to a (0,0,0,0) region + * @param region the region to clear + */ + FREERDP_API void region16_clear(REGION16* region); + + /** dumps the region on stderr + * @param region the region to dump + */ + FREERDP_API void region16_print(const REGION16* region); + + /** copies the region to another region + * @param dst destination region + * @param src source region + * @return if the operation was successful (false meaning out-of-memory) + */ + FREERDP_API BOOL region16_copy(REGION16* dst, const REGION16* src); + + /** adds a rectangle in src and stores the resulting region in dst + * @param dst destination region + * @param src source region + * @param rect the rectangle to add + * @return if the operation was successful (false meaning out-of-memory) + */ + FREERDP_API BOOL region16_union_rect(REGION16* dst, const REGION16* src, + const RECTANGLE_16* rect); + + /** returns if a rectangle intersects the region + * @param src the region + * @param arg2 the rectangle + * @return if region and rectangle intersect + */ + FREERDP_API BOOL region16_intersects_rect(const REGION16* src, const RECTANGLE_16* arg2); + + /** computes the intersection between a region and a rectangle + * @param dst destination region + * @param src the source region + * @param arg2 the rectangle that intersects + * @return if the operation was successful (false meaning out-of-memory) + */ + FREERDP_API BOOL region16_intersect_rect(REGION16* dst, const REGION16* src, + const RECTANGLE_16* arg2); + + /** release internal data associated with this region + * @param region the region to release + */ + FREERDP_API void region16_uninit(REGION16* region); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_REGION_H */ diff --git a/include/freerdp/codec/rfx.h b/include/freerdp/codec/rfx.h new file mode 100644 index 0000000..2b122be --- /dev/null +++ b/include/freerdp/codec/rfx.h @@ -0,0 +1,144 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RemoteFX Codec + * + * Copyright 2011 Vic Lee + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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_CODEC_REMOTEFX_H +#define FREERDP_CODEC_REMOTEFX_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/constants.h> +#include <freerdp/codec/region.h> + +#include <winpr/stream.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + RLGR1, + RLGR3 + } RLGR_MODE; + + typedef struct + { + UINT16 x; + UINT16 y; + UINT16 width; + UINT16 height; + } RFX_RECT; + + typedef struct + { + UINT16 x; + UINT16 y; + UINT32 width; + UINT32 height; + BYTE* data; + UINT32 scanline; + BOOL allocated; + BYTE quantIdxY; + BYTE quantIdxCb; + BYTE quantIdxCr; + UINT16 xIdx; + UINT16 yIdx; + UINT16 YLen; + UINT16 CbLen; + UINT16 CrLen; + BYTE* YData; + BYTE* CbData; + BYTE* CrData; + BYTE* YCbCrData; + } RFX_TILE; + + typedef struct S_RFX_MESSAGE_LIST RFX_MESSAGE_LIST; + typedef struct S_RFX_MESSAGE RFX_MESSAGE; + typedef struct S_RFX_CONTEXT RFX_CONTEXT; + + FREERDP_API BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data, UINT32 length, + UINT32 left, UINT32 top, BYTE* dst, UINT32 dstFormat, + UINT32 dstStride, UINT32 dstHeight, + REGION16* invalidRegion); + + FREERDP_API UINT32 rfx_message_get_frame_idx(const RFX_MESSAGE* message); + FREERDP_API const UINT32* rfx_message_get_quants(const RFX_MESSAGE* message, + UINT16* numQuantVals); + + FREERDP_API const RFX_TILE** rfx_message_get_tiles(const RFX_MESSAGE* message, + UINT16* numTiles); + FREERDP_API UINT16 rfx_message_get_tile_count(const RFX_MESSAGE* message); + + FREERDP_API const RFX_RECT* rfx_message_get_rects(const RFX_MESSAGE* message, UINT16* numRects); + FREERDP_API UINT16 rfx_message_get_rect_count(const RFX_MESSAGE* message); + + FREERDP_API void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message); + + FREERDP_API BOOL rfx_compose_message(RFX_CONTEXT* context, wStream* s, const RFX_RECT* rects, + size_t num_rects, const BYTE* image_data, UINT32 width, + UINT32 height, UINT32 rowstride); + + FREERDP_API RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects, + size_t numRects, const BYTE* data, UINT32 width, + UINT32 height, size_t scanline); + + FREERDP_API RFX_MESSAGE_LIST* rfx_encode_messages(RFX_CONTEXT* context, const RFX_RECT* rects, + size_t numRects, const BYTE* data, + UINT32 width, UINT32 height, UINT32 scanline, + size_t* numMessages, size_t maxDataSize); + FREERDP_API void rfx_message_list_free(RFX_MESSAGE_LIST* messages); + + FREERDP_API const RFX_MESSAGE* rfx_message_list_get(const RFX_MESSAGE_LIST* messages, + size_t idx); + + FREERDP_API BOOL rfx_write_message(RFX_CONTEXT* context, wStream* s, + const RFX_MESSAGE* message); + + FREERDP_API void rfx_context_free(RFX_CONTEXT* context); + + WINPR_ATTR_MALLOC(rfx_context_free, 1) + FREERDP_API RFX_CONTEXT* rfx_context_new_ex(BOOL encoder, UINT32 ThreadingFlags); + + WINPR_ATTR_MALLOC(rfx_context_free, 1) + FREERDP_API RFX_CONTEXT* rfx_context_new(BOOL encoder); + + FREERDP_API BOOL rfx_context_reset(RFX_CONTEXT* context, UINT32 width, UINT32 height); + + FREERDP_API BOOL rfx_context_set_mode(RFX_CONTEXT* context, RLGR_MODE mode); + FREERDP_API RLGR_MODE rfx_context_get_mode(RFX_CONTEXT* context); + + FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* context, UINT32 pixel_format); + FREERDP_API UINT32 rfx_context_get_pixel_format(RFX_CONTEXT* context); + + FREERDP_API void rfx_context_set_palette(RFX_CONTEXT* context, const BYTE* palette); + FREERDP_API const BYTE* rfx_context_get_palette(RFX_CONTEXT* context); + + FREERDP_API UINT32 rfx_context_get_frame_idx(const RFX_CONTEXT* context); + + FREERDP_API BOOL rfx_write_message_progressive_simple(RFX_CONTEXT* rfx, wStream* s, + const RFX_MESSAGE* msg); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_REMOTEFX_H */ diff --git a/include/freerdp/codec/yuv.h b/include/freerdp/codec/yuv.h new file mode 100644 index 0000000..6a1ea17 --- /dev/null +++ b/include/freerdp/codec/yuv.h @@ -0,0 +1,65 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * YUV decoder + * + * Copyright 2017 David Fort <contact@hardening-consulting.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_CODEC_YUV_H +#define FREERDP_CODEC_YUV_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/constants.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_YUV_CONTEXT YUV_CONTEXT; + + FREERDP_API BOOL yuv420_context_decode(YUV_CONTEXT* context, const BYTE* pYUVData[3], + const UINT32 iStride[3], UINT32 yuvHeight, + DWORD DstFormat, BYTE* dest, UINT32 nDstStep, + const RECTANGLE_16* regionRects, UINT32 numRegionRects); + FREERDP_API BOOL yuv420_context_encode(YUV_CONTEXT* context, const BYTE* rgbData, + UINT32 srcStep, UINT32 srcFormat, + const UINT32 iStride[3], BYTE* yuvData[3], + const RECTANGLE_16* regionRects, UINT32 numRegionRects); + + FREERDP_API BOOL yuv444_context_decode(YUV_CONTEXT* context, BYTE type, const BYTE* pYUVData[3], + const UINT32 iStride[3], UINT32 srcYuvHeight, + BYTE* pYUVDstData[3], const UINT32 iDstStride[3], + DWORD DstFormat, BYTE* dest, UINT32 nDstStep, + const RECTANGLE_16* regionRects, UINT32 numRegionRects); + FREERDP_API BOOL yuv444_context_encode(YUV_CONTEXT* context, BYTE version, const BYTE* pSrcData, + UINT32 nSrcStep, UINT32 SrcFormat, + const UINT32 iStride[3], BYTE* pYUVLumaData[3], + BYTE* pYUVChromaData[3], const RECTANGLE_16* regionRects, + UINT32 numRegionRects); + + FREERDP_API BOOL yuv_context_reset(YUV_CONTEXT* context, UINT32 width, UINT32 height); + + FREERDP_API void yuv_context_free(YUV_CONTEXT* context); + + WINPR_ATTR_MALLOC(yuv_context_free, 1) + FREERDP_API YUV_CONTEXT* yuv_context_new(BOOL encoder, UINT32 ThreadingFlags); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_YUV_H */ diff --git a/include/freerdp/codec/zgfx.h b/include/freerdp/codec/zgfx.h new file mode 100644 index 0000000..53e211c --- /dev/null +++ b/include/freerdp/codec/zgfx.h @@ -0,0 +1,61 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * ZGFX (RDP8) Bulk Data Compression + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_CODEC_ZGFX_H +#define FREERDP_CODEC_ZGFX_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codec/bulk.h> + +#define ZGFX_SEGMENTED_SINGLE 0xE0 +#define ZGFX_SEGMENTED_MULTIPART 0xE1 + +#define ZGFX_PACKET_COMPR_TYPE_RDP8 0x04 + +#define ZGFX_SEGMENTED_MAXSIZE 65535 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_ZGFX_CONTEXT ZGFX_CONTEXT; + + FREERDP_API int zgfx_decompress(ZGFX_CONTEXT* zgfx, const BYTE* pSrcData, UINT32 SrcSize, + BYTE** ppDstData, UINT32* pDstSize, UINT32 flags); + FREERDP_API int zgfx_compress(ZGFX_CONTEXT* zgfx, const BYTE* pSrcData, UINT32 SrcSize, + BYTE** ppDstData, UINT32* pDstSize, UINT32* pFlags); + FREERDP_API int zgfx_compress_to_stream(ZGFX_CONTEXT* zgfx, wStream* sDst, + const BYTE* pUncompressed, UINT32 uncompressedSize, + UINT32* pFlags); + + FREERDP_API void zgfx_context_reset(ZGFX_CONTEXT* zgfx, BOOL flush); + + FREERDP_API void zgfx_context_free(ZGFX_CONTEXT* zgfx); + + WINPR_ATTR_MALLOC(zgfx_context_free, 1) + FREERDP_API ZGFX_CONTEXT* zgfx_context_new(BOOL Compressor); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_ZGFX_H */ diff --git a/include/freerdp/codecs.h b/include/freerdp/codecs.h new file mode 100644 index 0000000..1de39b5 --- /dev/null +++ b/include/freerdp/codecs.h @@ -0,0 +1,83 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP Codecs + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_CODECS_H +#define FREERDP_CODECS_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/codec/color.h> + +#include <freerdp/codec/rfx.h> +#include <freerdp/codec/nsc.h> +#include <freerdp/codec/h264.h> +#include <freerdp/codec/clear.h> +#include <freerdp/codec/planar.h> +#include <freerdp/codec/interleaved.h> +#include <freerdp/codec/progressive.h> + +typedef enum +{ + FREERDP_CODEC_INTERLEAVED = 0x00000001, + FREERDP_CODEC_PLANAR = 0x00000002, + FREERDP_CODEC_NSCODEC = 0x00000004, + FREERDP_CODEC_REMOTEFX = 0x00000008, + FREERDP_CODEC_CLEARCODEC = 0x00000010, + FREERDP_CODEC_ALPHACODEC = 0x00000020, + FREERDP_CODEC_PROGRESSIVE = 0x00000040, + FREERDP_CODEC_AVC420 = 0x00000080, + FREERDP_CODEC_AVC444 = 0x00000100, + FREERDP_CODEC_ALL = 0x7FFFFFFF /* C enum types are restricted to int */ +} FreeRDP_CodecFlags; + +#ifdef __cplusplus +extern "C" +{ +#endif + + struct rdp_codecs + { + rdpContext* context; + + RFX_CONTEXT* rfx; + NSC_CONTEXT* nsc; + H264_CONTEXT* h264; + CLEAR_CONTEXT* clear; + PROGRESSIVE_CONTEXT* progressive; + BITMAP_PLANAR_CONTEXT* planar; + BITMAP_INTERLEAVED_CONTEXT* interleaved; + }; + typedef struct rdp_codecs rdpCodecs; + + FREERDP_API BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width, + UINT32 height); + FREERDP_API BOOL freerdp_client_codecs_reset(rdpCodecs* codecs, UINT32 flags, UINT32 width, + UINT32 height); + + FREERDP_API void codecs_free(rdpCodecs* codecs); + + WINPR_ATTR_MALLOC(codecs_free, 1) + FREERDP_API rdpCodecs* codecs_new(rdpContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODECS_H */ diff --git a/include/freerdp/constants.h b/include/freerdp/constants.h new file mode 100644 index 0000000..b1cb0d7 --- /dev/null +++ b/include/freerdp/constants.h @@ -0,0 +1,70 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP Constants + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_CONSTANTS_H +#define FREERDP_CONSTANTS_H + +/** + * Codec IDs + */ +enum RDP_CODEC_ID +{ + RDP_CODEC_ID_NONE = 0x00, + RDP_CODEC_ID_NSCODEC = 0x01, + RDP_CODEC_ID_JPEG = 0x02, + RDP_CODEC_ID_REMOTEFX = 0x03, + RDP_CODEC_ID_IMAGE_REMOTEFX = 0x04 +}; + +/** + * CPU Optimization flags + */ +#define CPU_SSE2 0x1 + +/** + * OSMajorType + */ +#define OSMAJORTYPE_UNSPECIFIED 0x0000 +#define OSMAJORTYPE_WINDOWS 0x0001 +#define OSMAJORTYPE_OS2 0x0002 +#define OSMAJORTYPE_MACINTOSH 0x0003 +#define OSMAJORTYPE_UNIX 0x0004 +#define OSMAJORTYPE_IOS 0x0005 +#define OSMAJORTYPE_OSX 0x0006 +#define OSMAJORTYPE_ANDROID 0x0007 +#define OSMAJORTYPE_CHROME_OS 0x0008 + +/** + * OSMinorType + */ +#define OSMINORTYPE_UNSPECIFIED 0x0000 +#define OSMINORTYPE_WINDOWS_31X 0x0001 +#define OSMINORTYPE_WINDOWS_95 0x0002 +#define OSMINORTYPE_WINDOWS_NT 0x0003 +#define OSMINORTYPE_OS2_V21 0x0004 +#define OSMINORTYPE_POWER_PC 0x0005 +#define OSMINORTYPE_MACINTOSH 0x0006 +#define OSMINORTYPE_NATIVE_XSERVER 0x0007 +#define OSMINORTYPE_PSEUDO_XSERVER 0x0008 +#define OSMINORTYPE_WINDOWS_RT 0x0009 +/* As of 2022-03-29 the following does not exist officially in [MS-RDPBCGR] */ +#define OSMINORTYPE_NATIVE_WAYLAND (0xFFFF - 1) +#define OSMINORTYPE_NATIVE_SDL (0xFFFF - 2) + +#endif /* FREERDP_CONSTANTS_H */ diff --git a/include/freerdp/crypto/ber.h b/include/freerdp/crypto/ber.h new file mode 100644 index 0000000..072517c --- /dev/null +++ b/include/freerdp/crypto/ber.h @@ -0,0 +1,106 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * ASN.1 Basic Encoding Rules (BER) + * + * Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_CRYPTO_BER_H +#define FREERDP_CRYPTO_BER_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <winpr/stream.h> + +/* BER type */ + +/* Class - bits 8 and 7 */ +#define BER_CLASS_MASK 0xC0 +#define BER_CLASS_UNIV 0x00 /* 0 0 */ +#define BER_CLASS_APPL 0x40 /* 0 1 */ +#define BER_CLASS_CTXT 0x80 /* 1 0 */ +#define BER_CLASS_PRIV 0xC0 /* 1 1 */ + +/* P/C - bit 6 */ +#define BER_PC_MASK 0x20 +#define BER_PRIMITIVE 0x00 /* 0 */ +#define BER_CONSTRUCT 0x20 /* 1 */ + +/* Tag - bits 5 to 1 */ +#define BER_TAG_MASK 0x1F +#define BER_TAG_BOOLEAN 0x01 +#define BER_TAG_INTEGER 0x02 +#define BER_TAG_BIT_STRING 0x03 +#define BER_TAG_OCTET_STRING 0x04 +#define BER_TAG_OBJECT_IDENFIER 0x06 +#define BER_TAG_ENUMERATED 0x0A +#define BER_TAG_SEQUENCE 0x10 +#define BER_TAG_SEQUENCE_OF 0x10 + +#define BER_PC(_pc) (_pc ? BER_CONSTRUCT : BER_PRIMITIVE) + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API BOOL ber_read_length(wStream* s, size_t* length); + FREERDP_API size_t ber_write_length(wStream* s, size_t length); + FREERDP_API size_t _ber_sizeof_length(size_t length); + FREERDP_API BOOL ber_read_universal_tag(wStream* s, BYTE tag, BOOL pc); + FREERDP_API size_t ber_write_universal_tag(wStream* s, BYTE tag, BOOL pc); + FREERDP_API BOOL ber_read_application_tag(wStream* s, BYTE tag, size_t* length); + FREERDP_API void ber_write_application_tag(wStream* s, BYTE tag, size_t length); + FREERDP_API BOOL ber_read_enumerated(wStream* s, BYTE* enumerated, BYTE count); + FREERDP_API void ber_write_enumerated(wStream* s, BYTE enumerated, BYTE count); + FREERDP_API BOOL ber_read_contextual_tag(wStream* s, BYTE tag, size_t* length, BOOL pc); + FREERDP_API size_t ber_write_contextual_tag(wStream* s, BYTE tag, size_t length, BOOL pc); + FREERDP_API size_t ber_sizeof_contextual_tag(size_t length); + FREERDP_API BOOL ber_read_sequence_tag(wStream* s, size_t* length); + FREERDP_API size_t ber_write_sequence_tag(wStream* s, size_t length); + FREERDP_API size_t ber_sizeof_sequence(size_t length); + FREERDP_API size_t ber_sizeof_sequence_tag(size_t length); + FREERDP_API BOOL ber_read_bit_string(wStream* s, size_t* length, BYTE* padding); + + FREERDP_API BOOL ber_read_octet_string_tag(wStream* s, size_t* length); + FREERDP_API BOOL ber_read_octet_string(wStream* s, BYTE** content, size_t* length); + FREERDP_API size_t ber_write_octet_string_tag(wStream* s, size_t length); + FREERDP_API size_t ber_sizeof_octet_string(size_t length); + FREERDP_API size_t ber_sizeof_contextual_octet_string(size_t length); + FREERDP_API size_t ber_write_char_to_unicode_octet_string(wStream* s, const char* str); + FREERDP_API size_t ber_write_contextual_char_to_unicode_octet_string(wStream* s, BYTE tag, + const char* oct_str); + FREERDP_API size_t ber_write_octet_string(wStream* s, const BYTE* oct_str, size_t length); + FREERDP_API BOOL ber_read_char_from_unicode_octet_string(wStream* s, char** str); + FREERDP_API BOOL ber_read_unicode_octet_string(wStream* s, LPWSTR* str); + FREERDP_API size_t ber_write_contextual_octet_string(wStream* s, BYTE tag, const BYTE* oct_str, + size_t length); + FREERDP_API size_t ber_write_contextual_unicode_octet_string(wStream* s, BYTE tag, LPWSTR str); + + FREERDP_API BOOL ber_read_BOOL(wStream* s, BOOL* value); + FREERDP_API void ber_write_BOOL(wStream* s, BOOL value); + FREERDP_API BOOL ber_read_integer(wStream* s, UINT32* value); + FREERDP_API size_t ber_write_integer(wStream* s, UINT32 value); + FREERDP_API size_t ber_write_contextual_integer(wStream* s, BYTE tag, UINT32 value); + FREERDP_API BOOL ber_read_integer_length(wStream* s, size_t* length); + FREERDP_API size_t ber_sizeof_integer(UINT32 value); + FREERDP_API size_t ber_sizeof_contextual_integer(UINT32 value); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CRYPTO_BER_H */ diff --git a/include/freerdp/crypto/certificate.h b/include/freerdp/crypto/certificate.h new file mode 100644 index 0000000..d16f903 --- /dev/null +++ b/include/freerdp/crypto/certificate.h @@ -0,0 +1,103 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Certificate Handling + * + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_CRYPTO_CERTIFICATE_H +#define FREERDP_CRYPTO_CERTIFICATE_H + +#include <winpr/crypto.h> + +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + enum FREERDP_CERT_PARAM + { + FREERDP_CERT_RSA_E, + FREERDP_CERT_RSA_N + }; + + typedef struct rdp_certificate rdpCertificate; + + FREERDP_API void freerdp_certificate_free(rdpCertificate* certificate); + + WINPR_ATTR_MALLOC(freerdp_certificate_free, 1) + FREERDP_API rdpCertificate* freerdp_certificate_new(void); + + WINPR_ATTR_MALLOC(freerdp_certificate_free, 1) + FREERDP_API rdpCertificate* freerdp_certificate_new_from_file(const char* file); + + WINPR_ATTR_MALLOC(freerdp_certificate_free, 1) + FREERDP_API rdpCertificate* freerdp_certificate_new_from_pem(const char* pem); + + WINPR_ATTR_MALLOC(freerdp_certificate_free, 1) + FREERDP_API rdpCertificate* freerdp_certificate_new_from_der(const BYTE* data, size_t length); + + FREERDP_API BOOL freerdp_certificate_is_rsa(const rdpCertificate* certificate); + + FREERDP_API char* freerdp_certificate_get_hash(const rdpCertificate* certificate, + const char* hash, size_t* plength); + + FREERDP_API char* freerdp_certificate_get_fingerprint_by_hash(const rdpCertificate* certificate, + const char* hash); + FREERDP_API char* + freerdp_certificate_get_fingerprint_by_hash_ex(const rdpCertificate* certificate, + const char* hash, BOOL separator); + FREERDP_API char* freerdp_certificate_get_fingerprint(const rdpCertificate* certificate); + FREERDP_API char* freerdp_certificate_get_pem(const rdpCertificate* certificate, + size_t* pLength); + FREERDP_API BYTE* freerdp_certificate_get_der(const rdpCertificate* certificate, + size_t* pLength); + + FREERDP_API char* freerdp_certificate_get_subject(const rdpCertificate* certificate); + FREERDP_API char* freerdp_certificate_get_issuer(const rdpCertificate* certificate); + + FREERDP_API char* freerdp_certificate_get_upn(const rdpCertificate* certificate); + FREERDP_API char* freerdp_certificate_get_email(const rdpCertificate* certificate); + + FREERDP_API WINPR_MD_TYPE freerdp_certificate_get_signature_alg(const rdpCertificate* cert); + + FREERDP_API char* freerdp_certificate_get_common_name(const rdpCertificate* cert, + size_t* plength); + FREERDP_API char** freerdp_certificate_get_dns_names(const rdpCertificate* cert, size_t* pcount, + size_t** pplengths); + FREERDP_API void freerdp_certificate_free_dns_names(size_t count, size_t* lengths, + char** names); + + FREERDP_API BOOL freerdp_certificate_check_eku(const rdpCertificate* certificate, int nid); + + FREERDP_API BOOL freerdp_certificate_get_public_key(const rdpCertificate* cert, + BYTE** PublicKey, DWORD* PublicKeyLength); + + FREERDP_API BOOL freerdp_certificate_verify(const rdpCertificate* cert, + const char* certificate_store_path); + + FREERDP_API BOOL freerdp_certificate_is_rdp_security_compatible(const rdpCertificate* cert); + + FREERDP_API char* freerdp_certificate_get_param(const rdpCertificate* cert, + enum FREERDP_CERT_PARAM what, size_t* psize); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CRYPTO_CERTIFICATE_H */ diff --git a/include/freerdp/crypto/certificate_data.h b/include/freerdp/crypto/certificate_data.h new file mode 100644 index 0000000..275d654 --- /dev/null +++ b/include/freerdp/crypto/certificate_data.h @@ -0,0 +1,72 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Certificate Handling + * + * Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_CRYPTO_CERTIFICATE_DATA_H +#define FREERDP_CRYPTO_CERTIFICATE_DATA_H + +#include <freerdp/api.h> +#include <freerdp/settings.h> +#include <freerdp/crypto/certificate.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_certificate_data rdpCertificateData; + + FREERDP_API char* freerdp_certificate_data_hash(const char* hostname, UINT16 port); + + FREERDP_API void freerdp_certificate_data_free(rdpCertificateData* data); + + WINPR_ATTR_MALLOC(freerdp_certificate_data_free, 1) + FREERDP_API rdpCertificateData* freerdp_certificate_data_new(const char* hostname, UINT16 port, + const rdpCertificate* xcert); + + WINPR_ATTR_MALLOC(freerdp_certificate_data_free, 1) + FREERDP_API rdpCertificateData* freerdp_certificate_data_new_from_pem(const char* hostname, + UINT16 port, + const char* pem, + size_t length); + + WINPR_ATTR_MALLOC(freerdp_certificate_data_free, 1) + FREERDP_API rdpCertificateData* + freerdp_certificate_data_new_from_file(const char* hostname, UINT16 port, const char* file); + + FREERDP_API BOOL freerdp_certificate_data_equal(const rdpCertificateData* a, + const rdpCertificateData* b); + + FREERDP_API const char* freerdp_certificate_data_get_hash(const rdpCertificateData* cert); + + FREERDP_API const char* freerdp_certificate_data_get_host(const rdpCertificateData* cert); + FREERDP_API UINT16 freerdp_certificate_data_get_port(const rdpCertificateData* cert); + + FREERDP_API const char* freerdp_certificate_data_get_pem(const rdpCertificateData* cert); + FREERDP_API const char* freerdp_certificate_data_get_subject(const rdpCertificateData* cert); + FREERDP_API const char* freerdp_certificate_data_get_issuer(const rdpCertificateData* cert); + FREERDP_API const char* + freerdp_certificate_data_get_fingerprint(const rdpCertificateData* cert); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CRYPTO_CERTIFICATE_DATA_H */ diff --git a/include/freerdp/crypto/certificate_store.h b/include/freerdp/crypto/certificate_store.h new file mode 100644 index 0000000..e7e43e1 --- /dev/null +++ b/include/freerdp/crypto/certificate_store.h @@ -0,0 +1,72 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Certificate Handling + * + * Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_CRYPTO_CERTIFICATE_STORE_H +#define FREERDP_CRYPTO_CERTIFICATE_STORE_H + +#include <freerdp/api.h> +#include <freerdp/settings.h> +#include <freerdp/crypto/certificate_data.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_certificate_store rdpCertificateStore; + + typedef enum + { + CERT_STORE_NOT_FOUND = 1, + CERT_STORE_MATCH = 0, + CERT_STORE_MISMATCH = -1 + } freerdp_certificate_store_result; + + FREERDP_API void freerdp_certificate_store_free(rdpCertificateStore* store); + + WINPR_ATTR_MALLOC(freerdp_certificate_store_free, 1) + FREERDP_API rdpCertificateStore* freerdp_certificate_store_new(const rdpSettings* settings); + + FREERDP_API freerdp_certificate_store_result freerdp_certificate_store_contains_data( + rdpCertificateStore* store, const rdpCertificateData* data); + + WINPR_ATTR_MALLOC(freerdp_certificate_data_free, 1) + FREERDP_API rdpCertificateData* + freerdp_certificate_store_load_data(rdpCertificateStore* store, const char* host, UINT16 port); + + FREERDP_API BOOL freerdp_certificate_store_save_data(rdpCertificateStore* store, + const rdpCertificateData* data); + FREERDP_API BOOL freerdp_certificate_store_remove_data(rdpCertificateStore* store, + const rdpCertificateData* data); + + FREERDP_API const char* + freerdp_certificate_store_get_certs_path(const rdpCertificateStore* store); + FREERDP_API const char* + freerdp_certificate_store_get_hosts_path(const rdpCertificateStore* store); + + FREERDP_API char* freerdp_certificate_store_get_cert_path(const rdpCertificateStore* store, + const char* host, UINT16 port); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CRYPTO_CERTIFICATE_STORE_H */ diff --git a/include/freerdp/crypto/crypto.h b/include/freerdp/crypto/crypto.h new file mode 100644 index 0000000..6137769 --- /dev/null +++ b/include/freerdp/crypto/crypto.h @@ -0,0 +1,58 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Cryptographic Abstraction Layer + * + * Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_CRYPTO_H +#define FREERDP_CRYPTO_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/crypto/certificate_data.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + struct rdp_CertInfo + { + BYTE* Modulus; + DWORD ModulusLength; + BYTE exponent[4]; + }; + typedef struct rdp_CertInfo rdpCertInfo; + + FREERDP_API char* crypto_base64_encode(const BYTE* data, size_t length); + FREERDP_API char* crypto_base64_encode_ex(const BYTE* data, size_t length, BOOL withCrLf); + + FREERDP_API void crypto_base64_decode(const char* enc_data, size_t length, BYTE** dec_data, + size_t* res_length); + + FREERDP_API char* crypto_base64url_encode(const BYTE* data, size_t length); + FREERDP_API void crypto_base64url_decode(const char* enc_data, size_t length, BYTE** dec_data, + size_t* res_length); + + FREERDP_API char* crypto_read_pem(const char* filename, size_t* plength); + FREERDP_API BOOL crypto_write_pem(const char* filename, const char* pem, size_t length); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CRYPTO_H */ diff --git a/include/freerdp/crypto/der.h b/include/freerdp/crypto/der.h new file mode 100644 index 0000000..8ec27f0 --- /dev/null +++ b/include/freerdp/crypto/der.h @@ -0,0 +1,44 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * ASN.1 Basic Encoding Rules (DER) + * + * Copyright 2011 Samsung, Author Jiten Pathy + * + * 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_CRYPTO_DER_H +#define FREERDP_CRYPTO_DER_H + +#include <freerdp/crypto/er.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API int _der_skip_length(int length); + FREERDP_API int der_write_length(wStream* s, int length); + FREERDP_API int der_get_content_length(int length); + FREERDP_API int der_skip_octet_string(int length); + FREERDP_API int der_skip_sequence_tag(int length); + FREERDP_API int der_write_sequence_tag(wStream* s, int length); + FREERDP_API int der_skip_contextual_tag(int length); + FREERDP_API int der_write_contextual_tag(wStream* s, BYTE tag, int length, BOOL pc); + FREERDP_API void der_write_octet_string(wStream* s, BYTE* oct_str, int length); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CRYPTO_DER_H */ diff --git a/include/freerdp/crypto/er.h b/include/freerdp/crypto/er.h new file mode 100644 index 0000000..d981b4e --- /dev/null +++ b/include/freerdp/crypto/er.h @@ -0,0 +1,97 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * ASN.1 Encoding Rules (BER/DER common functions) + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Modified by Jiten Pathy + * + * 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_CRYPTO_ER_H +#define FREERDP_CRYPTO_ER_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <winpr/stream.h> + +/* ER type */ + +/* Class - bits 8 and 7 */ +#define ER_CLASS_MASK 0xC0 +#define ER_CLASS_UNIV 0x00 /* 0 0 */ +#define ER_CLASS_APPL 0x40 /* 0 1 */ +#define ER_CLASS_CTXT 0x80 /* 1 0 */ +#define ER_CLASS_PRIV 0xC0 /* 1 1 */ + +/* P/C - bit 6 */ +#define ER_PC_MASK 0x20 +#define ER_PRIMITIVE 0x00 /* 0 */ +#define ER_CONSTRUCT 0x20 /* 1 */ + +/* Tag - bits 5 to 1 */ +#define ER_TAG_MASK 0x1F +#define ER_TAG_BOOLEAN 0x01 +#define ER_TAG_INTEGER 0x02 +#define ER_TAG_BIT_STRING 0x03 +#define ER_TAG_OCTET_STRING 0x04 +#define ER_TAG_OBJECT_IDENTIFIER 0x06 +#define ER_TAG_ENUMERATED 0x0A +#define ER_TAG_SEQUENCE 0x10 +#define ER_TAG_SEQUENCE_OF 0x10 +#define ER_TAG_GENERAL_STRING 0x1B +#define ER_TAG_GENERALIZED_TIME 0x18 + +#define ER_PC(_pc) (_pc ? ER_CONSTRUCT : ER_PRIMITIVE) + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API void er_read_length(wStream* s, int* length); + FREERDP_API int er_write_length(wStream* s, int length, BOOL flag); + FREERDP_API int _er_skip_length(int length); + FREERDP_API int er_get_content_length(int length); + FREERDP_API BOOL er_read_universal_tag(wStream* s, BYTE tag, BOOL pc); + FREERDP_API void er_write_universal_tag(wStream* s, BYTE tag, BOOL pc); + FREERDP_API BOOL er_read_application_tag(wStream* s, BYTE tag, int* length); + FREERDP_API void er_write_application_tag(wStream* s, BYTE tag, int length, BOOL flag); + FREERDP_API BOOL er_read_enumerated(wStream* s, BYTE* enumerated, BYTE count); + FREERDP_API void er_write_enumerated(wStream* s, BYTE enumerated, BYTE count, BOOL flag); + FREERDP_API BOOL er_read_contextual_tag(wStream* s, BYTE tag, int* length, BOOL pc); + FREERDP_API int er_write_contextual_tag(wStream* s, BYTE tag, int length, BOOL pc, BOOL flag); + FREERDP_API int er_skip_contextual_tag(int length); + FREERDP_API BOOL er_read_sequence_tag(wStream* s, int* length); + FREERDP_API int er_write_sequence_tag(wStream* s, int length, BOOL flag); + FREERDP_API int er_skip_sequence(int length); + FREERDP_API int er_skip_sequence_tag(int length); + FREERDP_API BOOL er_read_bit_string(wStream* s, int* length, BYTE* padding); + FREERDP_API BOOL er_write_bit_string_tag(wStream* s, UINT32 length, BYTE padding, BOOL flag); + FREERDP_API BOOL er_read_octet_string(wStream* s, int* length); + FREERDP_API void er_write_octet_string(wStream* s, BYTE* oct_str, int length, BOOL flag); + FREERDP_API int er_write_octet_string_tag(wStream* s, int length, BOOL flag); + FREERDP_API int er_skip_octet_string(int length); + FREERDP_API BOOL er_read_BOOL(wStream* s, BOOL* value); + FREERDP_API void er_write_BOOL(wStream* s, BOOL value); + FREERDP_API BOOL er_read_integer(wStream* s, UINT32* value); + FREERDP_API int er_write_integer(wStream* s, INT32 value); + FREERDP_API BOOL er_read_integer_length(wStream* s, int* length); + FREERDP_API int er_skip_integer(INT32 value); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CRYPTO_ER_H */ diff --git a/include/freerdp/crypto/per.h b/include/freerdp/crypto/per.h new file mode 100644 index 0000000..087a17f --- /dev/null +++ b/include/freerdp/crypto/per.h @@ -0,0 +1,62 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * ASN.1 Packed Encoding Rules (BER) + * + * Copyright 2011-2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_CRYPTO_PER_H +#define FREERDP_CRYPTO_PER_H + +#include <freerdp/api.h> + +#include <winpr/stream.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API BOOL per_read_length(wStream* s, UINT16* length); + FREERDP_API BOOL per_write_length(wStream* s, UINT16 length); + FREERDP_API BOOL per_read_choice(wStream* s, BYTE* choice); + FREERDP_API BOOL per_write_choice(wStream* s, BYTE choice); + FREERDP_API BOOL per_read_selection(wStream* s, BYTE* selection); + FREERDP_API BOOL per_write_selection(wStream* s, BYTE selection); + FREERDP_API BOOL per_read_number_of_sets(wStream* s, BYTE* number); + FREERDP_API BOOL per_write_number_of_sets(wStream* s, BYTE number); + FREERDP_API BOOL per_read_padding(wStream* s, UINT16 length); + FREERDP_API BOOL per_write_padding(wStream* s, UINT16 length); + FREERDP_API BOOL per_read_integer(wStream* s, UINT32* integer); + FREERDP_API BOOL per_read_integer16(wStream* s, UINT16* integer, UINT16 min); + FREERDP_API BOOL per_write_integer(wStream* s, UINT32 integer); + FREERDP_API BOOL per_write_integer16(wStream* s, UINT16 integer, UINT16 min); + FREERDP_API BOOL per_read_enumerated(wStream* s, BYTE* enumerated, BYTE count); + FREERDP_API BOOL per_write_enumerated(wStream* s, BYTE enumerated, BYTE count); + FREERDP_API BOOL per_write_object_identifier(wStream* s, const BYTE oid[6]); + FREERDP_API BOOL per_read_object_identifier(wStream* s, const BYTE oid[6]); + FREERDP_API BOOL per_read_octet_string(wStream* s, const BYTE* oct_str, UINT16 length, + UINT16 min); + FREERDP_API BOOL per_write_octet_string(wStream* s, const BYTE* oct_str, UINT16 length, + UINT16 min); + FREERDP_API BOOL per_read_numeric_string(wStream* s, UINT16 min); + FREERDP_API BOOL per_write_numeric_string(wStream* s, const BYTE* num_str, UINT16 length, + UINT16 min); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CRYPTO_PER_H */ diff --git a/include/freerdp/crypto/privatekey.h b/include/freerdp/crypto/privatekey.h new file mode 100644 index 0000000..58fd94b --- /dev/null +++ b/include/freerdp/crypto/privatekey.h @@ -0,0 +1,52 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Private key Handling + * + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_CRYPTO_PRIVATEKEY_H +#define FREERDP_CRYPTO_PRIVATEKEY_H + +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_private_key rdpPrivateKey; + + FREERDP_API void freerdp_key_free(rdpPrivateKey* key); + + WINPR_ATTR_MALLOC(freerdp_key_free, 1) + FREERDP_API rdpPrivateKey* freerdp_key_new(void); + + WINPR_ATTR_MALLOC(freerdp_key_free, 1) + FREERDP_API rdpPrivateKey* freerdp_key_new_from_file(const char* keyfile); + + WINPR_ATTR_MALLOC(freerdp_key_free, 1) + FREERDP_API rdpPrivateKey* freerdp_key_new_from_pem(const char* pem); + + FREERDP_API BOOL freerdp_key_is_rsa(const rdpPrivateKey* key); + + FREERDP_API size_t freerdp_key_get_bits(const rdpPrivateKey* key); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CRYPTO_PRIVATEKEY_H */ diff --git a/include/freerdp/display.h b/include/freerdp/display.h new file mode 100644 index 0000000..33ae6c7 --- /dev/null +++ b/include/freerdp/display.h @@ -0,0 +1,39 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Display update notifications + * + * Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.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_DISPLAY_H +#define FREERDP_DISPLAY_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/settings.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API BOOL freerdp_display_send_monitor_layout(rdpContext* context, UINT32 monitorCount, + const MONITOR_DEF* monitorDefArray); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_DISPLAY_UPDATE_H */ diff --git a/include/freerdp/dvc.h b/include/freerdp/dvc.h new file mode 100644 index 0000000..427d086 --- /dev/null +++ b/include/freerdp/dvc.h @@ -0,0 +1,180 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Dynamic Virtual Channel Interface + * + * Copyright 2010-2011 Vic Lee + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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. + */ + +/** + * DVC Plugin API: See the original MS DVC Client API: + * http://msdn.microsoft.com/en-us/library/bb540880%28v=VS.85%29.aspx + * + * The FreeRDP DVC Plugin API is a simulation of the MS DVC Client API in C. + * The main difference is that every interface method must take an instance + * pointer as the first parameter. + */ + +/** + * Implemented by DRDYNVC: + * o IWTSVirtualChannelManager + * o IWTSListener + * o IWTSVirtualChannel + * + * Implemented by DVC plugin: + * o IWTSPlugin + * o IWTSListenerCallback + * o IWTSVirtualChannelCallback + * + * A basic DVC plugin implementation: + * 1. DVCPluginEntry: + * The plugin entry point, which creates and initializes a new IWTSPlugin + * instance + * 2. IWTSPlugin.Initialize: + * Call IWTSVirtualChannelManager.CreateListener with a newly created + * IWTSListenerCallback instance + * 3. IWTSListenerCallback.OnNewChannelConnection: + * Create IWTSVirtualChannelCallback instance if the new channel is accepted + */ + +#ifndef FREERDP_DVC_H +#define FREERDP_DVC_H + +#include <freerdp/types.h> +#include <freerdp/addin.h> +#include <freerdp/settings.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_IWTSVirtualChannelManager IWTSVirtualChannelManager; + typedef struct s_IWTSListener IWTSListener; + typedef struct s_IWTSVirtualChannel IWTSVirtualChannel; + + typedef struct s_IWTSPlugin IWTSPlugin; + typedef struct s_IWTSListenerCallback IWTSListenerCallback; + typedef struct s_IWTSVirtualChannelCallback IWTSVirtualChannelCallback; + + struct s_IWTSListener + { + /* Retrieves the listener-specific configuration. */ + UINT (*GetConfiguration)(IWTSListener* pListener, void** ppPropertyBag); + + void* pInterface; + }; + + struct s_IWTSVirtualChannel + { + /* Starts a write request on the channel. */ + UINT(*Write) + (IWTSVirtualChannel* pChannel, ULONG cbSize, const BYTE* pBuffer, void* pReserved); + /* Closes the channel. */ + UINT (*Close)(IWTSVirtualChannel* pChannel); + }; + + struct s_IWTSVirtualChannelManager + { + /* Returns an instance of a listener object that listens on a specific + endpoint, or creates a static channel. */ + UINT(*CreateListener) + (IWTSVirtualChannelManager* pChannelMgr, const char* pszChannelName, ULONG ulFlags, + IWTSListenerCallback* pListenerCallback, IWTSListener** ppListener); + /* Find the channel or ID to send data to a specific endpoint. */ + UINT32 (*GetChannelId)(IWTSVirtualChannel* channel); + IWTSVirtualChannel* (*FindChannelById)(IWTSVirtualChannelManager* pChannelMgr, + UINT32 ChannelId); + const char* (*GetChannelName)(IWTSVirtualChannel* channel); + UINT (*DestroyListener)(IWTSVirtualChannelManager* pChannelMgr, IWTSListener* ppListener); + }; + + struct s_IWTSPlugin + { + /* Used for the first call that is made from the client to the plug-in. */ + UINT (*Initialize)(IWTSPlugin* pPlugin, IWTSVirtualChannelManager* pChannelMgr); + /* Notifies the plug-in that the Remote Desktop Connection (RDC) client + has successfully connected to the Remote Desktop Session Host (RD + Session Host) server. */ + UINT (*Connected)(IWTSPlugin* pPlugin); + /* Notifies the plug-in that the Remote Desktop Connection (RDC) client + has disconnected from the RD Session Host server. */ + UINT (*Disconnected)(IWTSPlugin* pPlugin, DWORD dwDisconnectCode); + /* Notifies the plug-in that the Remote Desktop Connection (RDC) client + has terminated. */ + UINT (*Terminated)(IWTSPlugin* pPlugin); + + UINT (*Attached)(IWTSPlugin* pPlugin); + + UINT (*Detached)(IWTSPlugin* pPlugin); + + /* Extended */ + + void* pInterface; + }; + + struct s_IWTSListenerCallback + { + /* Accepts or denies a connection request for an incoming connection to + the associated listener. */ + UINT(*OnNewChannelConnection) + (IWTSListenerCallback* pListenerCallback, IWTSVirtualChannel* pChannel, BYTE* Data, + BOOL* pbAccept, IWTSVirtualChannelCallback** ppCallback); + + void* pInterface; + }; + + struct s_IWTSVirtualChannelCallback + { + UINT(*OnDataReceived) + (IWTSVirtualChannelCallback* pChannelCallback, + wStream* data); /**< Notifies the user about data that is being received. */ + UINT(*OnOpen) + (IWTSVirtualChannelCallback* + pChannelCallback); /**< Notifies the user that the channel has been opened. */ + UINT(*OnClose) + (IWTSVirtualChannelCallback* + pChannelCallback); /**< Notifies the user that the channel has been closed. */ + + void* pInterface; + }; + + /* The DVC Plugin entry points */ + typedef struct rdp_context rdpContext; /* forward declaration, necessary to avoid + * circular includes */ + + typedef struct S_IDRDYNVC_ENTRY_POINTS IDRDYNVC_ENTRY_POINTS; + struct S_IDRDYNVC_ENTRY_POINTS + { + UINT(*RegisterPlugin) + (IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* name, IWTSPlugin* pPlugin); + IWTSPlugin* (*GetPlugin)(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* name); + const ADDIN_ARGV* (*GetPluginData)(IDRDYNVC_ENTRY_POINTS* pEntryPoints); + rdpSettings* (*GetRdpSettings)(IDRDYNVC_ENTRY_POINTS* pEntryPoints); + rdpContext* (*GetRdpContext)(IDRDYNVC_ENTRY_POINTS* pEntryPoints); + }; + + typedef UINT (*PDVC_PLUGIN_ENTRY)(IDRDYNVC_ENTRY_POINTS*); + + void* get_callback_by_name(const char* name, void** context); + void add_callback_by_name(const char* name, void* fkt, void* context); + void remove_callback_by_name(const char* name, void* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_DVC_H */ diff --git a/include/freerdp/emulate/scard/smartcard_emulate.h b/include/freerdp/emulate/scard/smartcard_emulate.h new file mode 100644 index 0000000..c2865b4 --- /dev/null +++ b/include/freerdp/emulate/scard/smartcard_emulate.h @@ -0,0 +1,363 @@ +/** + * WinPR: Windows Portable Runtime + * Smart Card API emulation + * + * Copyright 2021 Armin Novak <armin.novak@thincast.com> + * Copyright 2021 Thincast Technologies GmbH + * + * 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 WINPR_SMARTCARD_EMULATE_PRIVATE_H +#define WINPR_SMARTCARD_EMULATE_PRIVATE_H + +#include <winpr/platform.h> +#include <winpr/smartcard.h> + +#include <freerdp/api.h> +#include <freerdp/settings.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct smartcard_emulation_context SmartcardEmulationContext; + + FREERDP_API void Emulate_Free(SmartcardEmulationContext* context); + + WINPR_ATTR_MALLOC(Emulate_Free, 1) + FREERDP_API SmartcardEmulationContext* Emulate_New(const rdpSettings* settings); + + FREERDP_API BOOL Emulate_IsConfigured(SmartcardEmulationContext* context); + + FREERDP_API LONG WINAPI Emulate_SCardEstablishContext(SmartcardEmulationContext* smartcard, + DWORD dwScope, LPCVOID pvReserved1, + LPCVOID pvReserved2, + LPSCARDCONTEXT phContext); + + FREERDP_API LONG WINAPI Emulate_SCardReleaseContext(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext); + + FREERDP_API LONG WINAPI Emulate_SCardIsValidContext(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext); + + FREERDP_API LONG WINAPI Emulate_SCardListReaderGroupsA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPSTR mszGroups, + LPDWORD pcchGroups); + + FREERDP_API LONG WINAPI Emulate_SCardListReaderGroupsW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPWSTR mszGroups, + LPDWORD pcchGroups); + + FREERDP_API LONG WINAPI Emulate_SCardListReadersA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCSTR mszGroups, + LPSTR mszReaders, LPDWORD pcchReaders); + + FREERDP_API LONG WINAPI Emulate_SCardListReadersW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCWSTR mszGroups, + LPWSTR mszReaders, LPDWORD pcchReaders); + + FREERDP_API LONG WINAPI Emulate_SCardListCardsA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCBYTE pbAtr, + LPCGUID rgquidInterfaces, + DWORD cguidInterfaceCount, CHAR* mszCards, + LPDWORD pcchCards); + + FREERDP_API LONG WINAPI Emulate_SCardListCardsW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCBYTE pbAtr, + LPCGUID rgquidInterfaces, + DWORD cguidInterfaceCount, WCHAR* mszCards, + LPDWORD pcchCards); + + FREERDP_API LONG WINAPI Emulate_SCardListInterfacesA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCSTR szCard, + LPGUID pguidInterfaces, + LPDWORD pcguidInterfaces); + + FREERDP_API LONG WINAPI Emulate_SCardListInterfacesW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCWSTR szCard, + LPGUID pguidInterfaces, + LPDWORD pcguidInterfaces); + + FREERDP_API LONG WINAPI Emulate_SCardGetProviderIdA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCSTR szCard, + LPGUID pguidProviderId); + + FREERDP_API LONG WINAPI Emulate_SCardGetProviderIdW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCWSTR szCard, + LPGUID pguidProviderId); + + FREERDP_API LONG WINAPI Emulate_SCardGetCardTypeProviderNameA( + SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName, + DWORD dwProviderId, CHAR* szProvider, LPDWORD pcchProvider); + + FREERDP_API LONG WINAPI Emulate_SCardGetCardTypeProviderNameW( + SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName, + DWORD dwProviderId, WCHAR* szProvider, LPDWORD pcchProvider); + + FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderGroupA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPCSTR szGroupName); + + FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderGroupW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPCWSTR szGroupName); + + FREERDP_API LONG WINAPI Emulate_SCardForgetReaderGroupA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPCSTR szGroupName); + + FREERDP_API LONG WINAPI Emulate_SCardForgetReaderGroupW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPCWSTR szGroupName); + + FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPCSTR szReaderName, LPCSTR szDeviceName); + + FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPCWSTR szReaderName, + LPCWSTR szDeviceName); + + FREERDP_API LONG WINAPI Emulate_SCardForgetReaderA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCSTR szReaderName); + + FREERDP_API LONG WINAPI Emulate_SCardForgetReaderW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCWSTR szReaderName); + + FREERDP_API LONG WINAPI Emulate_SCardAddReaderToGroupA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPCSTR szReaderName, LPCSTR szGroupName); + + FREERDP_API LONG WINAPI Emulate_SCardAddReaderToGroupW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPCWSTR szReaderName, + LPCWSTR szGroupName); + + FREERDP_API LONG WINAPI + Emulate_SCardRemoveReaderFromGroupA(SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, + LPCSTR szReaderName, LPCSTR szGroupName); + + FREERDP_API LONG WINAPI + Emulate_SCardRemoveReaderFromGroupW(SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, + LPCWSTR szReaderName, LPCWSTR szGroupName); + + FREERDP_API LONG WINAPI Emulate_SCardIntroduceCardTypeA( + SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName, + LPCGUID pguidPrimaryProvider, LPCGUID rgguidInterfaces, DWORD dwInterfaceCount, + LPCBYTE pbAtr, LPCBYTE pbAtrMask, DWORD cbAtrLen); + + FREERDP_API LONG WINAPI Emulate_SCardIntroduceCardTypeW( + SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName, + LPCGUID pguidPrimaryProvider, LPCGUID rgguidInterfaces, DWORD dwInterfaceCount, + LPCBYTE pbAtr, LPCBYTE pbAtrMask, DWORD cbAtrLen); + + FREERDP_API LONG WINAPI Emulate_SCardSetCardTypeProviderNameA( + SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName, + DWORD dwProviderId, LPCSTR szProvider); + + FREERDP_API LONG WINAPI Emulate_SCardSetCardTypeProviderNameW( + SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName, + DWORD dwProviderId, LPCWSTR szProvider); + + FREERDP_API LONG WINAPI Emulate_SCardForgetCardTypeA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCSTR szCardName); + + FREERDP_API LONG WINAPI Emulate_SCardForgetCardTypeW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCWSTR szCardName); + + FREERDP_API LONG WINAPI Emulate_SCardFreeMemory(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPVOID pvMem); + + FREERDP_API HANDLE WINAPI Emulate_SCardAccessStartedEvent(SmartcardEmulationContext* smartcard); + + FREERDP_API void WINAPI Emulate_SCardReleaseStartedEvent(SmartcardEmulationContext* smartcard); + + FREERDP_API LONG WINAPI Emulate_SCardLocateCardsA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCSTR mszCards, + LPSCARD_READERSTATEA rgReaderStates, + DWORD cReaders); + + FREERDP_API LONG WINAPI Emulate_SCardLocateCardsW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCWSTR mszCards, + LPSCARD_READERSTATEW rgReaderStates, + DWORD cReaders); + + FREERDP_API LONG WINAPI Emulate_SCardLocateCardsByATRA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPSCARD_ATRMASK rgAtrMasks, DWORD cAtrs, + LPSCARD_READERSTATEA rgReaderStates, + DWORD cReaders); + + FREERDP_API LONG WINAPI Emulate_SCardLocateCardsByATRW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPSCARD_ATRMASK rgAtrMasks, DWORD cAtrs, + LPSCARD_READERSTATEW rgReaderStates, + DWORD cReaders); + + FREERDP_API LONG WINAPI Emulate_SCardGetStatusChangeA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, DWORD dwTimeout, + LPSCARD_READERSTATEA rgReaderStates, + DWORD cReaders); + + FREERDP_API LONG WINAPI Emulate_SCardGetStatusChangeW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, DWORD dwTimeout, + LPSCARD_READERSTATEW rgReaderStates, + DWORD cReaders); + + FREERDP_API LONG WINAPI Emulate_SCardCancel(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext); + + FREERDP_API LONG WINAPI Emulate_SCardConnectA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCSTR szReader, + DWORD dwShareMode, DWORD dwPreferredProtocols, + LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol); + + FREERDP_API LONG WINAPI Emulate_SCardConnectW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCWSTR szReader, + DWORD dwShareMode, DWORD dwPreferredProtocols, + LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol); + + FREERDP_API LONG WINAPI Emulate_SCardReconnect(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, DWORD dwShareMode, + DWORD dwPreferredProtocols, + DWORD dwInitialization, + LPDWORD pdwActiveProtocol); + + FREERDP_API LONG WINAPI Emulate_SCardDisconnect(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, DWORD dwDisposition); + + FREERDP_API LONG WINAPI Emulate_SCardBeginTransaction(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard); + + FREERDP_API LONG WINAPI Emulate_SCardEndTransaction(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, DWORD dwDisposition); + + FREERDP_API LONG WINAPI Emulate_SCardCancelTransaction(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard); + + FREERDP_API LONG WINAPI Emulate_SCardState(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, LPDWORD pdwState, + LPDWORD pdwProtocol, LPBYTE pbAtr, + LPDWORD pcbAtrLen); + + FREERDP_API LONG WINAPI Emulate_SCardStatusA(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, LPSTR mszReaderNames, + LPDWORD pcchReaderLen, LPDWORD pdwState, + LPDWORD pdwProtocol, LPBYTE pbAtr, + LPDWORD pcbAtrLen); + + FREERDP_API LONG WINAPI Emulate_SCardStatusW(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, LPWSTR mszReaderNames, + LPDWORD pcchReaderLen, LPDWORD pdwState, + LPDWORD pdwProtocol, LPBYTE pbAtr, + LPDWORD pcbAtrLen); + + FREERDP_API LONG WINAPI Emulate_SCardTransmit(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci, + LPCBYTE pbSendBuffer, DWORD cbSendLength, + LPSCARD_IO_REQUEST pioRecvPci, + LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength); + + FREERDP_API LONG WINAPI Emulate_SCardGetTransmitCount(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, + LPDWORD pcTransmitCount); + + FREERDP_API LONG WINAPI Emulate_SCardControl(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, DWORD dwControlCode, + LPCVOID lpInBuffer, DWORD cbInBufferSize, + LPVOID lpOutBuffer, DWORD cbOutBufferSize, + LPDWORD lpBytesReturned); + + FREERDP_API LONG WINAPI Emulate_SCardGetAttrib(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr, + LPDWORD pcbAttrLen); + + FREERDP_API LONG WINAPI Emulate_SCardSetAttrib(SmartcardEmulationContext* smartcard, + SCARDHANDLE hCard, DWORD dwAttrId, + LPCBYTE pbAttr, DWORD cbAttrLen); + + FREERDP_API LONG WINAPI Emulate_SCardUIDlgSelectCardA(SmartcardEmulationContext* smartcard, + LPOPENCARDNAMEA_EX pDlgStruc); + + FREERDP_API LONG WINAPI Emulate_SCardUIDlgSelectCardW(SmartcardEmulationContext* smartcard, + LPOPENCARDNAMEW_EX pDlgStruc); + + FREERDP_API LONG WINAPI Emulate_GetOpenCardNameA(SmartcardEmulationContext* smartcard, + LPOPENCARDNAMEA pDlgStruc); + + FREERDP_API LONG WINAPI Emulate_GetOpenCardNameW(SmartcardEmulationContext* smartcard, + LPOPENCARDNAMEW pDlgStruc); + + FREERDP_API LONG WINAPI Emulate_SCardDlgExtendedError(SmartcardEmulationContext* smartcard); + + FREERDP_API LONG WINAPI Emulate_SCardReadCacheA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, UUID* CardIdentifier, + DWORD FreshnessCounter, LPSTR LookupName, + PBYTE Data, DWORD* DataLen); + + FREERDP_API LONG WINAPI Emulate_SCardReadCacheW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, UUID* CardIdentifier, + DWORD FreshnessCounter, LPWSTR LookupName, + PBYTE Data, DWORD* DataLen); + + FREERDP_API LONG WINAPI Emulate_SCardWriteCacheA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, UUID* CardIdentifier, + DWORD FreshnessCounter, LPSTR LookupName, + PBYTE Data, DWORD DataLen); + + FREERDP_API LONG WINAPI Emulate_SCardWriteCacheW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, UUID* CardIdentifier, + DWORD FreshnessCounter, LPWSTR LookupName, + PBYTE Data, DWORD DataLen); + + FREERDP_API LONG WINAPI Emulate_SCardGetReaderIconA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCSTR szReaderName, + LPBYTE pbIcon, LPDWORD pcbIcon); + + FREERDP_API LONG WINAPI Emulate_SCardGetReaderIconW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, LPCWSTR szReaderName, + LPBYTE pbIcon, LPDWORD pcbIcon); + + FREERDP_API LONG WINAPI Emulate_SCardGetDeviceTypeIdA(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPCSTR szReaderName, + LPDWORD pdwDeviceTypeId); + FREERDP_API LONG WINAPI Emulate_SCardGetDeviceTypeIdW(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, + LPCWSTR szReaderName, + LPDWORD pdwDeviceTypeId); + + FREERDP_API LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdA( + SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szReaderName, + LPSTR szDeviceInstanceId, LPDWORD pcchDeviceInstanceId); + + FREERDP_API LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdW( + SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szReaderName, + LPWSTR szDeviceInstanceId, LPDWORD pcchDeviceInstanceId); + FREERDP_API LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdA( + SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szDeviceInstanceId, + LPSTR mszReaders, LPDWORD pcchReaders); + FREERDP_API LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdW( + SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szDeviceInstanceId, + LPWSTR mszReaders, LPDWORD pcchReaders); + FREERDP_API LONG WINAPI Emulate_SCardAudit(SmartcardEmulationContext* smartcard, + SCARDCONTEXT hContext, DWORD dwEvent); + +#ifdef __cplusplus +} +#endif + +#endif /* WINPR_SMARTCARD_EMULATE_PRIVATE_H */ diff --git a/include/freerdp/error.h b/include/freerdp/error.h new file mode 100644 index 0000000..58f9316 --- /dev/null +++ b/include/freerdp/error.h @@ -0,0 +1,360 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Error Codes + * + * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_ERROR_H +#define FREERDP_ERROR_H + +#include <winpr/crt.h> + +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Error categories */ +#define CAT_NONE "success" +#define CAT_USE "use" +#define CAT_BROKER "broker" +#define CAT_GATEWAY "gateway" +#define CAT_LICENSING "licensing" +#define CAT_SERVER "server" +#define CAT_CONFIG "config" +#define CAT_PROTOCOL "protocol" +#define CAT_ADMIN "administrative" + +/** + * Error Info Codes (Error Info PDU) + */ + +/* Protocol-independent codes */ +#define ERRINFO_RPC_INITIATED_DISCONNECT 0x00000001 +#define ERRINFO_RPC_INITIATED_LOGOFF 0x00000002 +#define ERRINFO_IDLE_TIMEOUT 0x00000003 +#define ERRINFO_LOGON_TIMEOUT 0x00000004 +#define ERRINFO_DISCONNECTED_BY_OTHER_CONNECTION 0x00000005 +#define ERRINFO_OUT_OF_MEMORY 0x00000006 +#define ERRINFO_SERVER_DENIED_CONNECTION 0x00000007 +#define ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES 0x00000009 +#define ERRINFO_SERVER_FRESH_CREDENTIALS_REQUIRED 0x0000000A +#define ERRINFO_RPC_INITIATED_DISCONNECT_BY_USER 0x0000000B +#define ERRINFO_LOGOFF_BY_USER 0x0000000C +#define ERRINFO_CLOSE_STACK_ON_DRIVER_NOT_READY 0x0000000F +#define ERRINFO_SERVER_DWM_CRASH 0x00000010 +#define ERRINFO_CLOSE_STACK_ON_DRIVER_FAILURE 0x00000011 +#define ERRINFO_CLOSE_STACK_ON_DRIVER_IFACE_FAILURE 0x00000012 +#define ERRINFO_SERVER_WINLOGON_CRASH 0x00000017 +#define ERRINFO_SERVER_CSRSS_CRASH 0x00000018 + +/* Protocol-independent licensing codes */ +#define ERRINFO_LICENSE_INTERNAL 0x00000100 +#define ERRINFO_LICENSE_NO_LICENSE_SERVER 0x00000101 +#define ERRINFO_LICENSE_NO_LICENSE 0x00000102 +#define ERRINFO_LICENSE_BAD_CLIENT_MSG 0x00000103 +#define ERRINFO_LICENSE_HWID_DOESNT_MATCH_LICENSE 0x00000104 +#define ERRINFO_LICENSE_BAD_CLIENT_LICENSE 0x00000105 +#define ERRINFO_LICENSE_CANT_FINISH_PROTOCOL 0x00000106 +#define ERRINFO_LICENSE_CLIENT_ENDED_PROTOCOL 0x00000107 +#define ERRINFO_LICENSE_BAD_CLIENT_ENCRYPTION 0x00000108 +#define ERRINFO_LICENSE_CANT_UPGRADE_LICENSE 0x00000109 +#define ERRINFO_LICENSE_NO_REMOTE_CONNECTIONS 0x0000010A + +/* Protocol-independent codes generated by the Connection Broker */ +#define ERRINFO_CB_DESTINATION_NOT_FOUND 0x0000400 +#define ERRINFO_CB_LOADING_DESTINATION 0x0000402 +#define ERRINFO_CB_REDIRECTING_TO_DESTINATION 0x0000404 +#define ERRINFO_CB_SESSION_ONLINE_VM_WAKE 0x0000405 +#define ERRINFO_CB_SESSION_ONLINE_VM_BOOT 0x0000406 +#define ERRINFO_CB_SESSION_ONLINE_VM_NO_DNS 0x0000407 +#define ERRINFO_CB_DESTINATION_POOL_NOT_FREE 0x0000408 +#define ERRINFO_CB_CONNECTION_CANCELLED 0x0000409 +#define ERRINFO_CB_CONNECTION_ERROR_INVALID_SETTINGS 0x0000410 +#define ERRINFO_CB_SESSION_ONLINE_VM_BOOT_TIMEOUT 0x0000411 +#define ERRINFO_CB_SESSION_ONLINE_VM_SESSMON_FAILED 0x0000412 + +/* RDP specific codes */ +#define ERRINFO_UNKNOWN_DATA_PDU_TYPE 0x000010C9 +#define ERRINFO_UNKNOWN_PDU_TYPE 0x000010CA +#define ERRINFO_DATA_PDU_SEQUENCE 0x000010CB +#define ERRINFO_CONTROL_PDU_SEQUENCE 0x000010CD +#define ERRINFO_INVALID_CONTROL_PDU_ACTION 0x000010CE +#define ERRINFO_INVALID_INPUT_PDU_TYPE 0x000010CF +#define ERRINFO_INVALID_INPUT_PDU_MOUSE 0x000010D0 +#define ERRINFO_INVALID_REFRESH_RECT_PDU 0x000010D1 +#define ERRINFO_CREATE_USER_DATA_FAILED 0x000010D2 +#define ERRINFO_CONNECT_FAILED 0x000010D3 +#define ERRINFO_CONFIRM_ACTIVE_HAS_WRONG_SHAREID 0x000010D4 +#define ERRINFO_CONFIRM_ACTIVE_HAS_WRONG_ORIGINATOR 0x000010D5 +#define ERRINFO_PERSISTENT_KEY_PDU_BAD_LENGTH 0x000010DA +#define ERRINFO_PERSISTENT_KEY_PDU_ILLEGAL_FIRST 0x000010DB +#define ERRINFO_PERSISTENT_KEY_PDU_TOO_MANY_TOTAL_KEYS 0x000010DC +#define ERRINFO_PERSISTENT_KEY_PDU_TOO_MANY_CACHE_KEYS 0x000010DD +#define ERRINFO_INPUT_PDU_BAD_LENGTH 0x000010DE +#define ERRINFO_BITMAP_CACHE_ERROR_PDU_BAD_LENGTH 0x000010DF +#define ERRINFO_SECURITY_DATA_TOO_SHORT 0x000010E0 +#define ERRINFO_VCHANNEL_DATA_TOO_SHORT 0x000010E1 +#define ERRINFO_SHARE_DATA_TOO_SHORT 0x000010E2 +#define ERRINFO_BAD_SUPPRESS_OUTPUT_PDU 0x000010E3 +#define ERRINFO_CONFIRM_ACTIVE_PDU_TOO_SHORT 0x000010E5 +#define ERRINFO_CAPABILITY_SET_TOO_SMALL 0x000010E7 +#define ERRINFO_CAPABILITY_SET_TOO_LARGE 0x000010E8 +#define ERRINFO_NO_CURSOR_CACHE 0x000010E9 +#define ERRINFO_BAD_CAPABILITIES 0x000010EA +#define ERRINFO_VIRTUAL_CHANNEL_DECOMPRESSION 0x000010EC +#define ERRINFO_INVALID_VC_COMPRESSION_TYPE 0x000010ED +#define ERRINFO_INVALID_CHANNEL_ID 0x000010EF +#define ERRINFO_VCHANNELS_TOO_MANY 0x000010F0 +#define ERRINFO_REMOTEAPP_NOT_ENABLED 0x000010F3 +#define ERRINFO_CACHE_CAP_NOT_SET 0x000010F4 +#define ERRINFO_BITMAP_CACHE_ERROR_PDU_BAD_LENGTH2 0x000010F5 +#define ERRINFO_OFFSCREEN_CACHE_ERROR_PDU_BAD_LENGTH 0x000010F6 +#define ERRINFO_DRAWNINEGRID_CACHE_ERROR_PDU_BAD_LENGTH 0x000010F7 +#define ERRINFO_GDIPLUS_PDU_BAD_LENGTH 0x000010F8 +#define ERRINFO_SECURITY_DATA_TOO_SHORT2 0x00001111 +#define ERRINFO_SECURITY_DATA_TOO_SHORT3 0x00001112 +#define ERRINFO_SECURITY_DATA_TOO_SHORT4 0x00001113 +#define ERRINFO_SECURITY_DATA_TOO_SHORT5 0x00001114 +#define ERRINFO_SECURITY_DATA_TOO_SHORT6 0x00001115 +#define ERRINFO_SECURITY_DATA_TOO_SHORT7 0x00001116 +#define ERRINFO_SECURITY_DATA_TOO_SHORT8 0x00001117 +#define ERRINFO_SECURITY_DATA_TOO_SHORT9 0x00001118 +#define ERRINFO_SECURITY_DATA_TOO_SHORT10 0x00001119 +#define ERRINFO_SECURITY_DATA_TOO_SHORT11 0x0000111A +#define ERRINFO_SECURITY_DATA_TOO_SHORT12 0x0000111B +#define ERRINFO_SECURITY_DATA_TOO_SHORT13 0x0000111C +#define ERRINFO_SECURITY_DATA_TOO_SHORT14 0x0000111D +#define ERRINFO_SECURITY_DATA_TOO_SHORT15 0x0000111E +#define ERRINFO_SECURITY_DATA_TOO_SHORT16 0x0000111F +#define ERRINFO_SECURITY_DATA_TOO_SHORT17 0x00001120 +#define ERRINFO_SECURITY_DATA_TOO_SHORT18 0x00001121 +#define ERRINFO_SECURITY_DATA_TOO_SHORT19 0x00001122 +#define ERRINFO_SECURITY_DATA_TOO_SHORT20 0x00001123 +#define ERRINFO_SECURITY_DATA_TOO_SHORT21 0x00001124 +#define ERRINFO_SECURITY_DATA_TOO_SHORT22 0x00001125 +#define ERRINFO_SECURITY_DATA_TOO_SHORT23 0x00001126 +#define ERRINFO_BAD_MONITOR_DATA 0x00001129 +#define ERRINFO_VC_DECOMPRESSED_REASSEMBLE_FAILED 0x0000112A +#define ERRINFO_VC_DATA_TOO_LONG 0x0000112B +#define ERRINFO_BAD_FRAME_ACK_DATA 0x0000112C +#define ERRINFO_GRAPHICS_MODE_NOT_SUPPORTED 0x0000112D +#define ERRINFO_GRAPHICS_SUBSYSTEM_RESET_FAILED 0x0000112E +#define ERRINFO_GRAPHICS_SUBSYSTEM_FAILED 0x0000112F +#define ERRINFO_TIMEZONE_KEY_NAME_LENGTH_TOO_SHORT 0x00001130 +#define ERRINFO_TIMEZONE_KEY_NAME_LENGTH_TOO_LONG 0x00001131 +#define ERRINFO_DYNAMIC_DST_DISABLED_FIELD_MISSING 0x00001132 +#define ERRINFO_VC_DECODING_ERROR 0x00001133 +#define ERRINFO_VIRTUALDESKTOPTOOLARGE 0x00001134 +#define ERRINFO_MONITORGEOMETRYVALIDATIONFAILED 0x00001135 +#define ERRINFO_INVALIDMONITORCOUNT 0x00001136 +#define ERRINFO_UPDATE_SESSION_KEY_FAILED 0x00001191 +#define ERRINFO_DECRYPT_FAILED 0x00001192 +#define ERRINFO_ENCRYPT_FAILED 0x00001193 +#define ERRINFO_ENCRYPTION_PACKAGE_MISMATCH 0x00001194 +#define ERRINFO_DECRYPT_FAILED2 0x00001195 +#define ERRINFO_PEER_DISCONNECTED 0x00001196 + +#define ERRINFO_SUCCESS 0x00000000 +#define ERRINFO_NONE 0xFFFFFFFF + + FREERDP_API const char* freerdp_get_error_info_string(UINT32 code); + FREERDP_API const char* freerdp_get_error_info_name(UINT32 code); + FREERDP_API const char* freerdp_get_error_info_category(UINT32 code); + + /** + * FreeRDP Context Error Codes + */ + +#define MAKE_FREERDP_ERROR(_class, _type) (((FREERDP_ERROR_##_class##_CLASS) << 16) | (_type)) + +#define GET_FREERDP_ERROR_CLASS(_errorCode) ((_errorCode >> 16) & 0xFFFF) + +#define GET_FREERDP_ERROR_TYPE(_errorCode) (_errorCode & 0xFFFF) + +#define GET_FREERDP_ERROR_SUBCODE + +#define FREERDP_ERROR_BASE 0 + +/** + * Error Base Codes + */ +#define FREERDP_ERROR_ERRBASE_CLASS (FREERDP_ERROR_BASE + 0) + +#define ERRBASE_SUCCESS ERRINFO_SUCCESS +#define ERRBASE_NONE ERRINFO_NONE + + FREERDP_API const char* freerdp_get_error_base_string(UINT32 code); + FREERDP_API const char* freerdp_get_error_base_name(UINT32 code); + FREERDP_API const char* freerdp_get_error_base_category(UINT32 code); + +#define FREERDP_ERROR_SUCCESS ERRINFO_SUCCESS +#define FREERDP_ERROR_NONE ERRINFO_NONE + + /* Error Info Codes */ + +#define FREERDP_ERROR_ERRINFO_CLASS (FREERDP_ERROR_BASE + 1) + +#define FREERDP_ERROR_RPC_INITIATED_DISCONNECT \ + MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_RPC_INITIATED_DISCONNECT) +#define FREERDP_ERROR_RPC_INITIATED_LOGOFF MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_RPC_INITIATED_LOGOFF) +#define FREERDP_ERROR_IDLE_TIMEOUT MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_IDLE_TIMEOUT) +#define FREERDP_ERROR_LOGON_TIMEOUT MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_LOGON_TIMEOUT) +#define FREERDP_ERROR_DISCONNECTED_BY_OTHER_CONNECTION \ + MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_DISCONNECTED_BY_OTHER_CONNECTION) +#define FREERDP_ERROR_OUT_OF_MEMORY MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_OUT_OF_MEMORY) +#define FREERDP_ERROR_SERVER_DENIED_CONNECTION \ + MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_DENIED_CONNECTION) +#define FREERDP_ERROR_SERVER_INSUFFICIENT_PRIVILEGES \ + MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES) +#define FREERDP_ERROR_SERVER_FRESH_CREDENTIALS_REQUIRED \ + MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_FRESH_CREDENTIALS_REQUIRED) +#define FREERDP_ERROR_RPC_INITIATED_DISCONNECT_BY_USER \ + MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_RPC_INITIATED_DISCONNECT_BY_USER) +#define FREERDP_ERROR_LOGOFF_BY_USER MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_LOGOFF_BY_USER) + +#define FREERDP_ERROR_CLOSE_STACK_ON_DRIVER_NOT_READY \ + MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_CLOSE_STACK_ON_DRIVER_NOT_READY) +#define FREERDP_ERROR_SERVER_DWM_CRASH MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_DWM_CRASH) +#define FREERDP_ERROR_CLOSE_STACK_ON_DRIVER_FAILURE \ + MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_CLOSE_STACK_ON_DRIVER_FAILURE) +#define FREERDP_ERROR_CLOSE_STACK_ON_DRIVER_IFACE_FAILURE \ + MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_CLOSE_STACK_ON_DRIVER_IFACE_FAILURE) +#define FREERDP_ERROR_SERVER_WINLOGON_CRASH \ + MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_WINLOGON_CRASH) +#define FREERDP_ERROR_SERVER_CSRSS_CRASH MAKE_FREERDP_ERROR(ERRINFO, ERRINFO_SERVER_CSRSS_CRASH) + +/* Connection Error Codes */ +#define ERRCONNECT_PRE_CONNECT_FAILED 0x00000001 +#define ERRCONNECT_CONNECT_UNDEFINED 0x00000002 +#define ERRCONNECT_POST_CONNECT_FAILED 0x00000003 +#define ERRCONNECT_DNS_ERROR 0x00000004 +#define ERRCONNECT_DNS_NAME_NOT_FOUND 0x00000005 +#define ERRCONNECT_CONNECT_FAILED 0x00000006 +#define ERRCONNECT_MCS_CONNECT_INITIAL_ERROR 0x00000007 +#define ERRCONNECT_TLS_CONNECT_FAILED 0x00000008 +#define ERRCONNECT_AUTHENTICATION_FAILED 0x00000009 +#define ERRCONNECT_INSUFFICIENT_PRIVILEGES 0x0000000A +#define ERRCONNECT_CONNECT_CANCELLED 0x0000000B +#define ERRCONNECT_SECURITY_NEGO_CONNECT_FAILED 0x0000000C +#define ERRCONNECT_CONNECT_TRANSPORT_FAILED 0x0000000D +#define ERRCONNECT_PASSWORD_EXPIRED 0x0000000E +/* For non-domain workstation where we can't contact a kerberos server */ +#define ERRCONNECT_PASSWORD_CERTAINLY_EXPIRED 0x0000000F +#define ERRCONNECT_CLIENT_REVOKED 0x00000010 +#define ERRCONNECT_KDC_UNREACHABLE 0x00000011 + +#define ERRCONNECT_ACCOUNT_DISABLED 0x00000012 +#define ERRCONNECT_PASSWORD_MUST_CHANGE 0x00000013 +#define ERRCONNECT_LOGON_FAILURE 0x00000014 +#define ERRCONNECT_WRONG_PASSWORD 0x00000015 +#define ERRCONNECT_ACCESS_DENIED 0x00000016 +#define ERRCONNECT_ACCOUNT_RESTRICTION 0x00000017 +#define ERRCONNECT_ACCOUNT_LOCKED_OUT 0x00000018 +#define ERRCONNECT_ACCOUNT_EXPIRED 0x00000019 +#define ERRCONNECT_LOGON_TYPE_NOT_GRANTED 0x0000001A +#define ERRCONNECT_NO_OR_MISSING_CREDENTIALS 0x0000001B +#define ERRCONNECT_ACTIVATION_TIMEOUT 0x0000001C + +#define ERRCONNECT_SUCCESS ERRINFO_SUCCESS +#define ERRCONNECT_NONE ERRINFO_NONE + + FREERDP_API const char* freerdp_get_error_connect_string(UINT32 code); + FREERDP_API const char* freerdp_get_error_connect_name(UINT32 code); + FREERDP_API const char* freerdp_get_error_connect_category(UINT32 code); + +#define FREERDP_ERROR_CONNECT_CLASS (FREERDP_ERROR_BASE + 2) + +#define FREERDP_ERROR_PRE_CONNECT_FAILED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_PRE_CONNECT_FAILED) + +#define FREERDP_ERROR_CONNECT_UNDEFINED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_CONNECT_UNDEFINED) + +#define FREERDP_ERROR_POST_CONNECT_FAILED \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_POST_CONNECT_FAILED) + +#define FREERDP_ERROR_DNS_ERROR MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_DNS_ERROR) + +#define FREERDP_ERROR_DNS_NAME_NOT_FOUND MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_DNS_NAME_NOT_FOUND) + +#define FREERDP_ERROR_CONNECT_FAILED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_CONNECT_FAILED) + +#define FREERDP_ERROR_MCS_CONNECT_INITIAL_ERROR \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_MCS_CONNECT_INITIAL_ERROR) + +#define FREERDP_ERROR_TLS_CONNECT_FAILED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_TLS_CONNECT_FAILED) + +#define FREERDP_ERROR_AUTHENTICATION_FAILED \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_AUTHENTICATION_FAILED) + +#define FREERDP_ERROR_INSUFFICIENT_PRIVILEGES \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_INSUFFICIENT_PRIVILEGES) + +#define FREERDP_ERROR_CONNECT_CANCELLED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_CONNECT_CANCELLED) + +#define FREERDP_ERROR_SECURITY_NEGO_CONNECT_FAILED \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_SECURITY_NEGO_CONNECT_FAILED) + +#define FREERDP_ERROR_CONNECT_TRANSPORT_FAILED \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_CONNECT_TRANSPORT_FAILED) + +#define FREERDP_ERROR_CONNECT_PASSWORD_EXPIRED \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_PASSWORD_EXPIRED) + +#define FREERDP_ERROR_CONNECT_PASSWORD_MUST_CHANGE \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_PASSWORD_MUST_CHANGE) + +#define FREERDP_ERROR_CONNECT_KDC_UNREACHABLE \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_KDC_UNREACHABLE) + +#define FREERDP_ERROR_CONNECT_ACCOUNT_DISABLED \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACCOUNT_DISABLED) + +#define FREERDP_ERROR_CONNECT_PASSWORD_CERTAINLY_EXPIRED \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_PASSWORD_CERTAINLY_EXPIRED) + +#define FREERDP_ERROR_CONNECT_CLIENT_REVOKED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_CLIENT_REVOKED) + +#define FREERDP_ERROR_CONNECT_LOGON_FAILURE MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_LOGON_FAILURE) + +#define FREERDP_ERROR_CONNECT_WRONG_PASSWORD MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_WRONG_PASSWORD) + +#define FREERDP_ERROR_CONNECT_ACCESS_DENIED MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACCESS_DENIED) + +#define FREERDP_ERROR_CONNECT_ACCOUNT_RESTRICTION \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACCOUNT_RESTRICTION) + +#define FREERDP_ERROR_CONNECT_ACCOUNT_LOCKED_OUT \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACCOUNT_LOCKED_OUT) + +#define FREERDP_ERROR_CONNECT_ACCOUNT_EXPIRED \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACCOUNT_EXPIRED) + +#define FREERDP_ERROR_CONNECT_LOGON_TYPE_NOT_GRANTED \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_LOGON_TYPE_NOT_GRANTED) + +#define FREERDP_ERROR_CONNECT_NO_OR_MISSING_CREDENTIALS \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_NO_OR_MISSING_CREDENTIALS) + +#define FREERDP_ERROR_CONNECT_ACTIVATION_TIMEOUT \ + MAKE_FREERDP_ERROR(CONNECT, ERRCONNECT_ACTIVATION_TIMEOUT) + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_ERROR_H */ diff --git a/include/freerdp/event.h b/include/freerdp/event.h new file mode 100644 index 0000000..41662d6 --- /dev/null +++ b/include/freerdp/event.h @@ -0,0 +1,133 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Event Definitions + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.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_EVENT_H +#define FREERDP_EVENT_H + +#include <freerdp/api.h> + +#include <winpr/collections.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define FREERDP_WINDOW_STATE_NORMAL 0 +#define FREERDP_WINDOW_STATE_MINIMIZED 1 +#define FREERDP_WINDOW_STATE_MAXIMIZED 2 +#define FREERDP_WINDOW_STATE_FULLSCREEN 3 +#define FREERDP_WINDOW_STATE_ACTIVE 4 + + DEFINE_EVENT_BEGIN(WindowStateChange) + int state; + DEFINE_EVENT_END(WindowStateChange) + + DEFINE_EVENT_BEGIN(ResizeWindow) + int width; + int height; + DEFINE_EVENT_END(ResizeWindow) + + DEFINE_EVENT_BEGIN(PanningChange) + int dx; + int dy; + DEFINE_EVENT_END(PanningChange) + + DEFINE_EVENT_BEGIN(ZoomingChange) + int dx; + int dy; + DEFINE_EVENT_END(ZoomingChange) + + DEFINE_EVENT_BEGIN(LocalResizeWindow) + int width; + int height; + DEFINE_EVENT_END(LocalResizeWindow) + + DEFINE_EVENT_BEGIN(EmbedWindow) + BOOL embed; + void* handle; + DEFINE_EVENT_END(EmbedWindow) + + DEFINE_EVENT_BEGIN(ErrorInfo) + UINT32 code; + DEFINE_EVENT_END(ErrorInfo) + + DEFINE_EVENT_BEGIN(Activated) + BOOL firstActivation; + DEFINE_EVENT_END(Activated) + + DEFINE_EVENT_BEGIN(ConnectionStateChange) + int state; + BOOL active; + DEFINE_EVENT_END(ConnectionStateChange) + + DEFINE_EVENT_BEGIN(Terminate) + int code; + DEFINE_EVENT_END(Terminate) + + DEFINE_EVENT_BEGIN(ConnectionResult) + int result; + DEFINE_EVENT_END(ConnectionResult) + + DEFINE_EVENT_BEGIN(ChannelConnected) + const char* name; + void* pInterface; + DEFINE_EVENT_END(ChannelConnected) + + DEFINE_EVENT_BEGIN(ChannelDisconnected) + const char* name; + void* pInterface; + DEFINE_EVENT_END(ChannelDisconnected) + + DEFINE_EVENT_BEGIN(ChannelAttached) + const char* name; + void* pInterface; + DEFINE_EVENT_END(ChannelAttached) + + DEFINE_EVENT_BEGIN(ChannelDetached) + const char* name; + void* pInterface; + DEFINE_EVENT_END(ChannelDetached) + + DEFINE_EVENT_BEGIN(MouseEvent) + UINT16 flags; + UINT16 x; + UINT16 y; + DEFINE_EVENT_END(MouseEvent) + + DEFINE_EVENT_BEGIN(MouseEventEx) + UINT16 flags; + UINT16 x; + UINT16 y; + DEFINE_EVENT_END(MouseEventEx) + + DEFINE_EVENT_BEGIN(Timer) + UINT64 now; + DEFINE_EVENT_END(Timer) + + DEFINE_EVENT_BEGIN(GraphicsReset) + UINT32 width; + UINT32 height; + DEFINE_EVENT_END(GraphicsReset) + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_EVENT_H */ diff --git a/include/freerdp/extension.h b/include/freerdp/extension.h new file mode 100644 index 0000000..1f9d4cb --- /dev/null +++ b/include/freerdp/extension.h @@ -0,0 +1,66 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP Extensions + * + * Copyright 2010-2011 Vic Lee + * + * 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_EXTENSION_H +#define FREERDP_EXTENSION_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#define FREERDP_EXT_EXPORT_FUNC_NAME "FreeRDPExtensionEntry" + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_ext_plugin rdpExtPlugin; + + struct rdp_ext_plugin + { + void* ext; + int (*init)(rdpExtPlugin* plugin, freerdp* instance); + int (*uninit)(rdpExtPlugin* plugin, freerdp* instance); + }; + + typedef UINT32(FREERDP_CC* PFREERDP_EXTENSION_HOOK)(rdpExtPlugin* plugin, freerdp* instance); + + typedef UINT32(FREERDP_CC* PREGISTEREXTENSION)(rdpExtPlugin* plugin); + typedef UINT32(FREERDP_CC* PREGISTERPRECONNECTHOOK)(rdpExtPlugin* plugin, + PFREERDP_EXTENSION_HOOK hook); + typedef UINT32(FREERDP_CC* PREGISTERPOSTCONNECTHOOK)(rdpExtPlugin* plugin, + PFREERDP_EXTENSION_HOOK hook); + + typedef struct + { + void* ext; /* Reference to internal instance */ + PREGISTEREXTENSION pRegisterExtension; + PREGISTERPRECONNECTHOOK pRegisterPreConnectHook; + PREGISTERPOSTCONNECTHOOK pRegisterPostConnectHook; + void* data; + } FREERDP_EXTENSION_ENTRY_POINTS; + typedef FREERDP_EXTENSION_ENTRY_POINTS* PFREERDP_EXTENSION_ENTRY_POINTS; + + typedef int(FREERDP_CC* PFREERDP_EXTENSION_ENTRY)(PFREERDP_EXTENSION_ENTRY_POINTS pEntryPoints); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_EXTENSION_H */ diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h new file mode 100644 index 0000000..cf0176f --- /dev/null +++ b/include/freerdp/freerdp.h @@ -0,0 +1,708 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Interface + * + * Copyright 2009-2011 Jay Sorg + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_H +#define FREERDP_H + +#include <winpr/stream.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/error.h> +#include <freerdp/event.h> + +#include <freerdp/settings.h> + +#include <freerdp/gdi/gdi.h> +#include <freerdp/codecs.h> +#include <freerdp/metrics.h> +#include <freerdp/extension.h> +#include <freerdp/heartbeat.h> +#include <freerdp/message.h> +#include <freerdp/autodetect.h> +#include <freerdp/streamdump.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_rdp rdpRdp; + typedef struct rdp_rail rdpRail; + typedef struct rdp_cache rdpCache; + + typedef struct rdp_client_context rdpClientContext; + typedef struct rdp_client_entry_points_v1 RDP_CLIENT_ENTRY_POINTS_V1; + typedef RDP_CLIENT_ENTRY_POINTS_V1 RDP_CLIENT_ENTRY_POINTS; + +#include <freerdp/utils/smartcardlogon.h> +#include <freerdp/update.h> +#include <freerdp/input.h> +#include <freerdp/graphics.h> + +#define MCS_BASE_CHANNEL_ID 1001 +#define MCS_GLOBAL_CHANNEL_ID 1003 + +/* Flags used by certificate callbacks */ +#define VERIFY_CERT_FLAG_NONE 0x00 +#define VERIFY_CERT_FLAG_LEGACY 0x02 +#define VERIFY_CERT_FLAG_REDIRECT 0x10 +#define VERIFY_CERT_FLAG_GATEWAY 0x20 +#define VERIFY_CERT_FLAG_CHANGED 0x40 +#define VERIFY_CERT_FLAG_MISMATCH 0x80 +#define VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1 0x100 +#define VERIFY_CERT_FLAG_FP_IS_PEM 0x200 + +/* Message types used by gateway messaging callback */ +#define GATEWAY_MESSAGE_CONSENT 1 +#define GATEWAY_MESSAGE_SERVICE 2 + + typedef enum + { + AUTH_NLA, + AUTH_TLS, + AUTH_RDP, + GW_AUTH_HTTP, + GW_AUTH_RDG, + GW_AUTH_RPC, + AUTH_SMARTCARD_PIN + } rdp_auth_reason; + + typedef BOOL (*pContextNew)(freerdp* instance, rdpContext* context); + typedef void (*pContextFree)(freerdp* instance, rdpContext* context); + + typedef BOOL (*pConnectCallback)(freerdp* instance); + typedef void (*pPostDisconnect)(freerdp* instance); + + /** \brief Authentication callback function pointer definition + * + * \param instance A pointer to the instance to work on + * \param username A pointer to the username string. On input the current username, on output + * the username that should be used. Must not be NULL. \param password A pointer to the password + * string. On input the current password, on output the password that sohould be used. Must not + * be NULL. \param domain A pointer to the domain string. On input the current domain, on output + * the domain that sohould be used. Must not be NULL. + * + * \return \b FALSE no valid credentials supplied, continue without \b TRUE valid credentials + * should be available. + */ + + typedef BOOL (*pAuthenticate)(freerdp* instance, char** username, char** password, + char** domain); + + /** \brief Extended authentication callback function pointer definition + * + * \param instance A pointer to the instance to work on + * \param username A pointer to the username string. On input the current username, on output + * the username that should be used. Must not be NULL. \param password A pointer to the password + * string. On input the current password, on output the password that sohould be used. Must not + * be NULL. \param domain A pointer to the domain string. On input the current domain, on output + * the domain that sohould be used. Must not be NULL. \param reason The reason the callback was + * called. (e.g. NLA, TLS, RDP, GATEWAY, ...) + * + * \return \b FALSE to abort the connection, \b TRUE otherwise. + * \note To not provide valid credentials and not abort the connection return \b TRUE and empty + * (as in empty string) credentials + */ + typedef BOOL (*pAuthenticateEx)(freerdp* instance, char** username, char** password, + char** domain, rdp_auth_reason reason); + typedef BOOL (*pChooseSmartcard)(freerdp* instance, SmartcardCertInfo** cert_list, DWORD count, + DWORD* choice, BOOL gateway); + + typedef enum + { + ACCESS_TOKEN_TYPE_AAD, /**!< oauth2 access token for RDS AAD authentication */ + ACCESS_TOKEN_TYPE_AVD /**!< oauth2 access token for Azure Virtual Desktop */ + } AccessTokenType; + + typedef BOOL (*pGetAccessToken)(freerdp* instance, AccessTokenType tokenType, char** token, + size_t count, ...); + + /** @brief Callback used to inform about a reconnection attempt + * + * @param instance The instance the information is for + * @param what A '\0' terminated string describing the module attempting to retry an operation + * @param current The current reconnection attempt, the first attempt will always have the + * value \b 0 + * @param userarg An optional custom argument + * + * @return \b -1 in case of failure (attempts exceeded, ...) or a \b delay in [ms] to wait + * before the next attempt + */ + typedef SSIZE_T (*pRetryDialog)(freerdp* instance, const char* what, size_t current, + void* userarg); + + /** @brief Callback used if user interaction is required to accept + * an unknown certificate. + * + * @deprecated Use pVerifyCertificateEx + * @param common_name The certificate registered hostname. + * @param subject The common name of the certificate. + * @param issuer The issuer of the certificate. + * @param fingerprint The fingerprint of the certificate (old) or the certificate in PEM + * format + * @param host_mismatch A flag indicating the certificate + * subject does not match the host connecting to. + * + * @return 1 to accept and store a certificate, 2 to accept + * a certificate only for this session, 0 otherwise. + */ +#if defined(WITH_FREERDP_DEPRECATED) + typedef WINPR_DEPRECATED_VAR( + "Use pVerifyCertificateEx", + DWORD (*pVerifyCertificate)(freerdp* instance, const char* common_name, const char* subject, + const char* issuer, const char* fingerprint, + BOOL host_mismatch)); +#endif + + /** @brief Callback used if user interaction is required to accept + * an unknown certificate. + * + * @param host The hostname connecting to. + * @param port The port connecting to. + * @param common_name The certificate registered hostname. + * @param subject The common name of the certificate. + * @param issuer The issuer of the certificate. + * @param fingerprint The fingerprint of the certificate (old) or the certificate in PEM + * format (VERIFY_CERT_FLAG_FP_IS_PEM set) + * @param flags Flags of type VERIFY_CERT_FLAG* + * + * @return 1 to accept and store a certificate, 2 to accept + * a certificate only for this session, 0 otherwise. + */ + typedef DWORD (*pVerifyCertificateEx)(freerdp* instance, const char* host, UINT16 port, + const char* common_name, const char* subject, + const char* issuer, const char* fingerprint, DWORD flags); + + /** @brief Callback used if user interaction is required to accept + * a changed certificate. + * + * @deprecated Use pVerifyChangedCertificateEx + * @param common_name The certificate registered hostname. + * @param subject The common name of the new certificate. + * @param issuer The issuer of the new certificate. + * @param new_fingerprint The fingerprint of the new certificate. + * @param old_subject The common name of the old certificate. + * @param old_issuer The issuer of the new certificate. + * @param old_fingerprint The fingerprint of the old certificate. + * + * @return 1 to accept and store a certificate, 2 to accept + * a certificate only for this session, 0 otherwise. + */ +#if defined(WITH_FREERDP_DEPRECATED) + typedef WINPR_DEPRECATED_VAR( + "Use pVerifyChangedCertificateEx", + DWORD (*pVerifyChangedCertificate)(freerdp* instance, const char* common_name, + const char* subject, const char* issuer, + const char* new_fingerprint, const char* old_subject, + const char* old_issuer, const char* old_fingerprint)); +#endif + + /** @brief Callback used if user interaction is required to accept + * a changed certificate. + * + * @param host The hostname connecting to. + * @param port The port connecting to. + * @param common_name The certificate registered hostname. + * @param subject The common name of the new certificate. + * @param issuer The issuer of the new certificate. + * @param new_fingerprint The fingerprint of the new certificate (old) or the certificate in + * PEM format (VERIFY_CERT_FLAG_FP_IS_PEM set) + * @param old_subject The common name of the old certificate. + * @param old_issuer The issuer of the new certificate. + * @param old_fingerprint The fingerprint of the old certificate (old) or the certificate in + * PEM format (VERIFY_CERT_FLAG_FP_IS_PEM set) + * @param flags Flags of type VERIFY_CERT_FLAG* + * + * @return 1 to accept and store a certificate, 2 to accept + * a certificate only for this session, 0 otherwise. + */ + + typedef DWORD (*pVerifyChangedCertificateEx)(freerdp* instance, const char* host, UINT16 port, + const char* common_name, const char* subject, + const char* issuer, const char* new_fingerprint, + const char* old_subject, const char* old_issuer, + const char* old_fingerprint, DWORD flags); + + /** @brief Callback used if user interaction is required to accept + * a certificate. + * + * @param instance Pointer to the freerdp instance. + * @param data Pointer to certificate data (full chain) in PEM format. + * @param length The length of the certificate data. + * @param hostname The hostname connecting to. + * @param port The port connecting to. + * @param flags Flags of type VERIFY_CERT_FLAG* + * + * @return 1 to accept and store a certificate, 2 to accept + * a certificate only for this session, 0 otherwise. + */ + typedef int (*pVerifyX509Certificate)(freerdp* instance, const BYTE* data, size_t length, + const char* hostname, UINT16 port, DWORD flags); + + typedef int (*pLogonErrorInfo)(freerdp* instance, UINT32 data, UINT32 type); + + typedef BOOL (*pSendChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data, + size_t size); + typedef BOOL (*pSendChannelPacket)(freerdp* instance, UINT16 channelId, size_t totalSize, + UINT32 flags, const BYTE* data, size_t chunkSize); + typedef BOOL (*pReceiveChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data, + size_t size, UINT32 flags, size_t totalSize); + + /* type can be one of the GATEWAY_MESSAGE_ type defines */ + typedef BOOL (*pPresentGatewayMessage)(freerdp* instance, UINT32 type, BOOL isDisplayMandatory, + BOOL isConsentMandatory, size_t length, + const WCHAR* message); + + /** + * Defines the context for a given instance of RDP connection. + * It is embedded in the rdp_freerdp structure, and allocated by a call to + * freerdp_context_new(). It is deallocated by a call to freerdp_context_free(). + */ + struct rdp_context + { + ALIGN64 freerdp* instance; /**< (offset 0) + Pointer to a rdp_freerdp structure. + This is a back-link to retrieve the freerdp instance from the context. + It is set by the freerdp_context_new() function */ + ALIGN64 freerdp_peer* peer; /**< (offset 1) + Pointer to the client peer. + This is set by a call to freerdp_peer_context_new() during peer + initialization. This field is used only on the server side. */ + ALIGN64 BOOL ServerMode; /**< (offset 2) true when context is in server mode */ + + ALIGN64 UINT32 LastError; /* 3 */ + + UINT64 paddingA[16 - 4]; /* 4 */ + + ALIGN64 int argc; /**< (offset 16) + Number of arguments given to the program at launch time. + Used to keep this data available and used later on, typically just before + connection initialization. + @see freerdp_parse_args() */ + ALIGN64 char** argv; /**< (offset 17) + List of arguments given to the program at launch time. + Used to keep this data available and used later on, typically just before + connection initialization. + @see freerdp_parse_args() */ + + ALIGN64 wPubSub* pubSub; /* (offset 18) */ + + ALIGN64 HANDLE channelErrorEvent; /* (offset 19)*/ + ALIGN64 UINT channelErrorNum; /*(offset 20)*/ + ALIGN64 char* errorDescription; /*(offset 21)*/ + + UINT64 paddingB[32 - 22]; /* 22 */ + + ALIGN64 rdpRdp* + rdp; /**< (offset 32) + Pointer to a rdp_rdp structure used to keep the connection's parameters. + It is allocated by freerdp_context_new() and deallocated by + freerdp_context_free(), at the same time that this rdp_context + structure - there is no need to specifically allocate/deallocate this. */ + ALIGN64 rdpGdi* gdi; /**< (offset 33) + Pointer to a rdp_gdi structure used to keep the gdi settings. + It is allocated by gdi_init() and deallocated by gdi_free(). + It must be deallocated before deallocating this rdp_context structure. */ + ALIGN64 rdpRail* rail; /* 34 */ + ALIGN64 rdpCache* cache; /* 35 */ + ALIGN64 rdpChannels* channels; /* 36 */ + ALIGN64 rdpGraphics* graphics; /* 37 */ + ALIGN64 rdpInput* input; /* 38 owned by rdpRdp */ + ALIGN64 rdpUpdate* update; /* 39 owned by rdpRdp */ + ALIGN64 rdpSettings* settings; /* 40 owned by rdpRdp */ + ALIGN64 rdpMetrics* metrics; /* 41 */ + ALIGN64 rdpCodecs* codecs; /* 42 */ + ALIGN64 rdpAutoDetect* autodetect; /* 43 owned by rdpRdp */ + UINT64 paddingC1[45 - 44]; /* 44 */ + ALIGN64 int disconnectUltimatum; /* 45 */ + UINT64 paddingC[64 - 46]; /* 46 */ + + ALIGN64 rdpStreamDumpContext* dump; /* 64 */ + ALIGN64 wLog* log; /* 65 */ + + UINT64 paddingD[96 - 66]; /* 66 */ + UINT64 paddingE[128 - 96]; /* 96 */ + }; + + /** + * Defines the possible disconnect reasons in the MCS Disconnect Provider + * Ultimatum PDU + */ + + enum Disconnect_Ultimatum + { + Disconnect_Ultimatum_domain_disconnected = 0, + Disconnect_Ultimatum_provider_initiated = 1, + Disconnect_Ultimatum_token_purged = 2, + Disconnect_Ultimatum_user_requested = 3, + Disconnect_Ultimatum_channel_purged = 4 + }; + +#include <freerdp/client.h> + + /** Defines the options for a given instance of RDP connection. + * This is built by the client and given to the FreeRDP library to create the connection + * with the expected options. + * It is allocated by a call to freerdp_new() and deallocated by a call to freerdp_free(). + * Some of its content need specific allocation/deallocation - see field description for + * details. + */ + struct rdp_freerdp + { + ALIGN64 + rdpContext* context; /**< (offset 0) + Pointer to a rdpContext structure. + Client applications can use the ContextSize field to register a + context bigger than the rdpContext structure. This allow clients to + use additional context information. When using this capability, client + application should ALWAYS declare their structure with the rdpContext + field first, and any additional content following it. Can be allocated + by a call to freerdp_context_new(). Must be deallocated by a call to + freerdp_context_free() before deallocating the current instance. */ + + ALIGN64 RDP_CLIENT_ENTRY_POINTS* pClientEntryPoints; + + UINT64 paddingA[16 - 2]; /* 2 */ + +#if defined(WITH_FREERDP_DEPRECATED) + WINPR_DEPRECATED_VAR("use rdpContext::input instead", ALIGN64 rdpInput* input;) /* (offset + 16) Input handle for the connection. Will be initialized by a call + to freerdp_context_new() owned by rdpRdp */ + WINPR_DEPRECATED_VAR("use rdpContext::update instead", + ALIGN64 rdpUpdate* update;) /* (offset 17) + Update display parameters. Used to register display events callbacks +and settings. Will be initialized by a call to freerdp_context_new() owned by rdpRdp */ + WINPR_DEPRECATED_VAR("use rdpContext::settings instead", + ALIGN64 rdpSettings* settings;) /**< (offset 18) + Pointer to a rdpSettings structure. Will be used to maintain the + required RDP settings. Will be + initialized by a call to freerdp_context_new() + owned by rdpRdp + */ + WINPR_DEPRECATED_VAR("use rdpContext::autodetect instead", + ALIGN64 rdpAutoDetect* autodetect;) /* (offset 19) + Auto-Detect handle for the connection. + Will be initialized by a call to freerdp_context_new() +owned by rdpRdp */ +#else + UINT64 paddingX[4]; +#endif + ALIGN64 rdpHeartbeat* heartbeat; /* (offset 21) owned by rdpRdp*/ + + UINT64 paddingB[32 - 21]; /* 21 */ + + ALIGN64 size_t + ContextSize; /* (offset 32) + Specifies the size of the 'context' field. freerdp_context_new() will use this + size to allocate the context buffer. freerdp_new() sets it to + sizeof(rdpContext). If modifying it, there should always be a minimum of + sizeof(rdpContext), as the freerdp library will assume it can use the 'context' + field to set the required informations in it. Clients will typically make it + bigger, and use a context structure embedding the rdpContext, and adding + additional information after that. + */ + + ALIGN64 pContextNew + ContextNew; /**< (offset 33) + Callback for context allocation + Can be set before calling freerdp_context_new() to have it executed after + allocation and initialization. Must be set to NULL if not needed. */ + + ALIGN64 pContextFree + ContextFree; /**< (offset 34) + Callback for context deallocation + Can be set before calling freerdp_context_free() to have it executed before + deallocation. Must be set to NULL if not needed. */ + UINT64 paddingC[47 - 35]; /* 35 */ + + ALIGN64 UINT ConnectionCallbackState; /* 47 */ + + ALIGN64 pConnectCallback + PreConnect; /**< (offset 48) + Callback for pre-connect operations. + Can be set before calling freerdp_connect() to have it executed before the + actual connection happens. Must be set to NULL if not needed. */ + + ALIGN64 pConnectCallback + PostConnect; /**< (offset 49) + Callback for post-connect operations. + Can be set before calling freerdp_connect() to have it executed after the + actual connection has succeeded. Must be set to NULL if not needed. */ + + ALIGN64 pAuthenticate Authenticate; /**< (offset 50) + Callback for authentication. + It is used to get the username/password when it was not + provided at connection time. */ +#if defined(WITH_FREERDP_DEPRECATED) + WINPR_DEPRECATED_VAR("Use VerifyCertificateEx or VerifyX509Certificate instead", + ALIGN64 pVerifyCertificate VerifyCertificate;) /**< (offset 51) */ + WINPR_DEPRECATED_VAR("Use VerifyChangedCertificateEx or VerifyX509Certificate instead", + ALIGN64 pVerifyChangedCertificate + VerifyChangedCertificate;) /**< (offset 52) */ +#else + ALIGN64 UINT64 reserved[2]; +#endif + ALIGN64 pVerifyX509Certificate + VerifyX509Certificate; /**< (offset 53) Callback for X509 certificate verification + (PEM format) */ + + ALIGN64 pLogonErrorInfo + LogonErrorInfo; /**< (offset 54) Callback for logon error info, important for logon + system messages with RemoteApp */ + + ALIGN64 pPostDisconnect + PostDisconnect; /**< (offset 55) + Callback for cleaning up + resources allocated by post connect callback. + + This will be called before disconnecting and cleaning up the + channels. + */ + + ALIGN64 pAuthenticate GatewayAuthenticate; /**< (offset 56) + Callback for gateway authentication. + It is used to get the username/password when it was not + provided at connection time. */ + + ALIGN64 pPresentGatewayMessage PresentGatewayMessage; /**< (offset 57) + Callback for gateway consent messages. + It is used to present consent messages to the user. */ + + ALIGN64 pConnectCallback Redirect; /**< (offset 58) + Callback for redirect operations. + Can be set after + rdp_client_disconnect_and_clear and applying redirection settings but before + rdp_client_connect() to have it executed after the actual connection has + succeeded. Must be set to NULL if not needed. */ + ALIGN64 pConnectCallback + LoadChannels; /**< (offset 59) + * callback for loading channel configuration. Might be called multiple + * times when redirection occurs. */ + + ALIGN64 pPostDisconnect + PostFinalDisconnect; /** < (offset 60) + * callback for cleaning up resources allocated in PreConnect + * + * This will be called after all instance related channels and + * threads have been stopped + */ + UINT64 paddingD[64 - 61]; /* 61 */ + + ALIGN64 pSendChannelData + SendChannelData; /* (offset 64) + Callback for sending data to a channel. + By default, it is set by freerdp_new() to freerdp_send_channel_data(), which + eventually calls freerdp_channel_send() */ + ALIGN64 pReceiveChannelData + ReceiveChannelData; /* (offset 65) + Callback for receiving data from a channel. + This is called by freerdp_channel_process() (if not NULL). + Clients will typically use a function that calls freerdp_channels_data() + to perform the needed tasks. */ + + ALIGN64 pVerifyCertificateEx + VerifyCertificateEx; /**< (offset 66) + Callback for certificate validation. + Used to verify that an unknown certificate is trusted. */ + ALIGN64 pVerifyChangedCertificateEx + VerifyChangedCertificateEx; /**< (offset 67) + Callback for changed certificate validation. + Used when a certificate differs from stored fingerprint. */ + ALIGN64 pSendChannelPacket + SendChannelPacket; /* (offset 68) + * Callback for sending RAW data to a channel. In contrast to + * SendChannelData data fragmentation is up to the user and this + * function sends data as is with the provided flags. + */ + ALIGN64 pAuthenticateEx AuthenticateEx; /**< (offset 69) + Callback for authentication. + It is used to get the username/password. The reason + argument tells why it was called. */ + ALIGN64 pChooseSmartcard + ChooseSmartcard; /* (offset 70) + Callback for choosing a smartcard for logon. + Used when multiple smartcards are available. Returns an index into a list + of SmartcardCertInfo pointers */ + ALIGN64 pGetAccessToken GetAccessToken; /* (offset 71) + Callback for obtaining an access token + for \b AccessTokenType authentication */ + ALIGN64 pRetryDialog RetryDialog; /* (offset 72) Callback for displaying a dialog in case of + something needs a retry */ + UINT64 paddingE[80 - 73]; /* 73 */ + }; + + struct rdp_channel_handles + { + wListDictionary* init; + wListDictionary* open; + }; + typedef struct rdp_channel_handles rdpChannelHandles; + + FREERDP_API void freerdp_context_free(freerdp* instance); + + FREERDP_API BOOL freerdp_context_new(freerdp* instance); + FREERDP_API BOOL freerdp_context_new_ex(freerdp* instance, rdpSettings* settings); + + FREERDP_API BOOL freerdp_context_reset(freerdp* instance); + + FREERDP_API BOOL freerdp_connect(freerdp* instance); + + WINPR_DEPRECATED_VAR("use freerdp_abort_connect_context instead", + FREERDP_API BOOL freerdp_abort_connect(freerdp* instance)); + + FREERDP_API BOOL freerdp_abort_connect_context(rdpContext* context); + FREERDP_API HANDLE freerdp_abort_event(rdpContext* context); + + WINPR_DEPRECATED_VAR("use freerdp_shall_disconnect_context instead", + FREERDP_API BOOL freerdp_shall_disconnect(freerdp* instance)); + + FREERDP_API BOOL freerdp_shall_disconnect_context(rdpContext* context); + FREERDP_API BOOL freerdp_disconnect(freerdp* instance); + + WINPR_DEPRECATED_VAR("use freerdp_disconnect_before_reconnect_context instead", + FREERDP_API BOOL freerdp_disconnect_before_reconnect(freerdp* instance)); + FREERDP_API BOOL freerdp_disconnect_before_reconnect_context(rdpContext* context); + + FREERDP_API BOOL freerdp_reconnect(freerdp* instance); + + FREERDP_API UINT freerdp_channels_attach(freerdp* instance); + FREERDP_API UINT freerdp_channels_detach(freerdp* instance); + +#if defined(WITH_FREERDP_DEPRECATED) + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_get_event_handles", + BOOL freerdp_get_fds(freerdp* instance, void** rfds, + int* rcount, void** wfds, int* wcount)); +#endif + + FREERDP_API BOOL freerdp_check_fds(freerdp* instance); + + FREERDP_API DWORD freerdp_get_event_handles(rdpContext* context, HANDLE* events, DWORD count); + FREERDP_API BOOL freerdp_check_event_handles(rdpContext* context); + + FREERDP_API wMessageQueue* freerdp_get_message_queue(freerdp* instance, DWORD id); + FREERDP_API HANDLE freerdp_get_message_queue_event_handle(freerdp* instance, DWORD id); + FREERDP_API int freerdp_message_queue_process_message(freerdp* instance, DWORD id, + wMessage* message); + FREERDP_API int freerdp_message_queue_process_pending_messages(freerdp* instance, DWORD id); + + FREERDP_API UINT32 freerdp_error_info(freerdp* instance); + FREERDP_API void freerdp_set_error_info(rdpRdp* rdp, UINT32 error); + FREERDP_API BOOL freerdp_send_error_info(rdpRdp* rdp); + FREERDP_API BOOL freerdp_get_stats(rdpRdp* rdp, UINT64* inBytes, UINT64* outBytes, + UINT64* inPackets, UINT64* outPackets); + + FREERDP_API void freerdp_get_version(int* major, int* minor, int* revision); + FREERDP_API const char* freerdp_get_version_string(void); + FREERDP_API const char* freerdp_get_build_revision(void); + FREERDP_API const char* freerdp_get_build_config(void); + + FREERDP_API void freerdp_free(freerdp* instance); + + WINPR_ATTR_MALLOC(freerdp_free, 1) + FREERDP_API freerdp* freerdp_new(void); + + FREERDP_API BOOL freerdp_focus_required(freerdp* instance); + FREERDP_API void freerdp_set_focus(freerdp* instance); + + FREERDP_API int freerdp_get_disconnect_ultimatum(rdpContext* context); + + FREERDP_API UINT32 freerdp_get_last_error(rdpContext* context); + FREERDP_API const char* freerdp_get_last_error_name(UINT32 error); + FREERDP_API const char* freerdp_get_last_error_string(UINT32 error); + FREERDP_API const char* freerdp_get_last_error_category(UINT32 error); + +#define freerdp_set_last_error(context, lastError) \ + freerdp_set_last_error_ex((context), (lastError), __func__, __FILE__, __LINE__) + +#define freerdp_set_last_error_if_not(context, lastError) \ + do \ + { \ + if (freerdp_get_last_error(context) == FREERDP_ERROR_SUCCESS) \ + freerdp_set_last_error_log(context, lastError); \ + } while (0) + +#define freerdp_set_last_error_log(context, lastError) \ + freerdp_set_last_error_ex((context), (lastError), __func__, __FILE__, __LINE__) + FREERDP_API void freerdp_set_last_error_ex(rdpContext* context, UINT32 lastError, + const char* fkt, const char* file, int line); + + FREERDP_API const char* freerdp_get_logon_error_info_type(UINT32 type); + FREERDP_API const char* freerdp_get_logon_error_info_type_ex(UINT32 type, char* buffer, + size_t size); + + FREERDP_API const char* freerdp_get_logon_error_info_data(UINT32 data); + FREERDP_API const char* freerdp_get_logon_error_info_data_ex(UINT32 data, char* buffer, + size_t size); + + FREERDP_API ULONG freerdp_get_transport_sent(rdpContext* context, BOOL resetCount); + + FREERDP_API BOOL freerdp_nla_impersonate(rdpContext* context); + FREERDP_API BOOL freerdp_nla_revert_to_self(rdpContext* context); + + FREERDP_API UINT32 freerdp_get_nla_sspi_error(rdpContext* context); + + FREERDP_API void clearChannelError(rdpContext* context); + FREERDP_API HANDLE getChannelErrorEventHandle(rdpContext* context); + FREERDP_API UINT getChannelError(rdpContext* context); + FREERDP_API const char* getChannelErrorDescription(rdpContext* context); + FREERDP_API void setChannelError(rdpContext* context, UINT errorNum, const char* format, ...); + FREERDP_API BOOL checkChannelErrorEvent(rdpContext* context); + + FREERDP_API const char* freerdp_nego_get_routing_token(rdpContext* context, DWORD* length); + + /** \brief returns the current \b CONNECTION_STATE of the context. + * + * \param context A pointer to the context to query state + * + * \return A \b CONNECTION_STATE the context is currently in + */ + FREERDP_API CONNECTION_STATE freerdp_get_state(const rdpContext* context); + + /** \brief returns a string representation of a \b CONNECTION_STATE + * + * \param state the \b CONNECTION_STATE to stringify + * + * \return The string representation of the \b CONNECTION_STATE + */ + FREERDP_API const char* freerdp_state_string(CONNECTION_STATE state); + + /** \brief Queries if the current \b CONNECTION_STATE of the context is an active connection. + * + * A connection is active, if the connection sequence has been passed, no disconnection requests + * have been received and no network or other errors have forced a disconnect. + * + * \param context A pointer to the context to query state + * + * \return \b TRUE if the connection state indicates an active connection, \b FALSE otherwise + */ + FREERDP_API BOOL freerdp_is_active_state(const rdpContext* context); + + FREERDP_API BOOL freerdp_channels_from_mcs(rdpSettings* settings, const rdpContext* context); + + FREERDP_API BOOL freerdp_is_valid_mcs_create_request(const BYTE* data, size_t size); + FREERDP_API BOOL freerdp_is_valid_mcs_create_response(const BYTE* data, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_H */ diff --git a/include/freerdp/gdi/bitmap.h b/include/freerdp/gdi/bitmap.h new file mode 100644 index 0000000..5f784f0 --- /dev/null +++ b/include/freerdp/gdi/bitmap.h @@ -0,0 +1,54 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * GDI Bitmap Functions + * + * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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_GDI_BITMAP_H +#define FREERDP_GDI_BITMAP_H + +#include <freerdp/api.h> +#include <freerdp/gdi/gdi.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API UINT32 gdi_GetPixel(HGDI_DC hdc, UINT32 nXPos, UINT32 nYPos); + FREERDP_API UINT32 gdi_SetPixel(HGDI_DC hdc, UINT32 X, UINT32 Y, UINT32 crColor); + FREERDP_API BYTE* gdi_GetPointer(HGDI_BITMAP hBmp, UINT32 X, UINT32 Y); + + FREERDP_API HGDI_BITMAP gdi_CreateBitmap(UINT32 nWidth, UINT32 nHeight, UINT32 format, + BYTE* data); + FREERDP_API HGDI_BITMAP gdi_CreateBitmapEx(UINT32 nWidth, UINT32 nHeight, UINT32 format, + UINT32 stride, BYTE* data, void (*fkt_free)(void*)); + FREERDP_API HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, UINT32 nWidth, UINT32 nHeight); + + FREERDP_API BOOL gdi_BitBlt(HGDI_DC hdcDest, INT32 nXDest, INT32 nYDest, INT32 nWidth, + INT32 nHeight, HGDI_DC hdcSrc, INT32 nXSrc, INT32 nYSrc, DWORD rop, + const gdiPalette* palette); + + typedef BOOL (*p_BitBlt)(HGDI_DC hdcDest, INT32 nXDest, INT32 nYDest, INT32 nWidth, + INT32 nHeight, HGDI_DC hdcSrc, INT32 nXSrc, INT32 nYSrc, DWORD rop); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_GDI_BITMAP_H */ diff --git a/include/freerdp/gdi/dc.h b/include/freerdp/gdi/dc.h new file mode 100644 index 0000000..d9b5c2b --- /dev/null +++ b/include/freerdp/gdi/dc.h @@ -0,0 +1,44 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * GDI Device Context Functions + * + * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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_GDI_DC_H +#define FREERDP_GDI_DC_H + +#include <freerdp/api.h> +#include <freerdp/gdi/gdi.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API HGDI_DC gdi_GetDC(void); + FREERDP_API HGDI_DC gdi_CreateDC(UINT32 format); + FREERDP_API HGDI_DC gdi_CreateCompatibleDC(HGDI_DC hdc); + FREERDP_API HGDIOBJECT gdi_SelectObject(HGDI_DC hdc, HGDIOBJECT hgdiobject); + FREERDP_API BOOL gdi_DeleteObject(HGDIOBJECT hgdiobject); + FREERDP_API BOOL gdi_DeleteDC(HGDI_DC hdc); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_GDI_DC_H */ diff --git a/include/freerdp/gdi/gdi.h b/include/freerdp/gdi/gdi.h new file mode 100644 index 0000000..ab6f172 --- /dev/null +++ b/include/freerdp/gdi/gdi.h @@ -0,0 +1,548 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * GDI Library + * + * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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_GDI_H +#define FREERDP_GDI_H + +#include <winpr/wlog.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/log.h> +#include <freerdp/types.h> +#include <freerdp/codec/color.h> +#include <freerdp/codec/region.h> + +#include <freerdp/client/rdpgfx.h> +#include <freerdp/client/geometry.h> +#include <freerdp/client/video.h> + +/* For more information, see [MS-RDPEGDI] */ + +/* Binary Raster Operations (ROP2) */ +#define GDI_R2_BLACK 0x01 /* D = 0 */ +#define GDI_R2_NOTMERGEPEN 0x02 /* D = ~(D | P) */ +#define GDI_R2_MASKNOTPEN 0x03 /* D = D & ~P */ +#define GDI_R2_NOTCOPYPEN 0x04 /* D = ~P */ +#define GDI_R2_MASKPENNOT 0x05 /* D = P & ~D */ +#define GDI_R2_NOT 0x06 /* D = ~D */ +#define GDI_R2_XORPEN 0x07 /* D = D ^ P */ +#define GDI_R2_NOTMASKPEN 0x08 /* D = ~(D & P) */ +#define GDI_R2_MASKPEN 0x09 /* D = D & P */ +#define GDI_R2_NOTXORPEN 0x0A /* D = ~(D ^ P) */ +#define GDI_R2_NOP 0x0B /* D = D */ +#define GDI_R2_MERGENOTPEN 0x0C /* D = D | ~P */ +#define GDI_R2_COPYPEN 0x0D /* D = P */ +#define GDI_R2_MERGEPENNOT 0x0E /* D = P | ~D */ +#define GDI_R2_MERGEPEN 0x0F /* D = P | D */ +#define GDI_R2_WHITE 0x10 /* D = 1 */ + +/* Ternary Raster Operations (ROP3) */ +#define GDI_BLACKNESS 0x00000042 +#define GDI_DPSoon 0x00010289 +#define GDI_DPSona 0x00020C89 +#define GDI_PSon 0x000300AA +#define GDI_SDPona 0x00040C88 +#define GDI_DPon 0x000500A9 +#define GDI_PDSxnon 0x00060865 +#define GDI_PDSaon 0x000702C5 +#define GDI_SDPnaa 0x00080F08 +#define GDI_PDSxon 0x00090245 +#define GDI_DPna 0x000A0329 +#define GDI_PSDnaon 0x000B0B2A +#define GDI_SPna 0x000C0324 +#define GDI_PDSnaon 0x000D0B25 +#define GDI_PDSonon 0x000E08A5 +#define GDI_Pn 0x000F0001 +#define GDI_PDSona 0x00100C85 +#define GDI_NOTSRCERASE 0x001100A6 +#define GDI_SDPxnon 0x00120868 +#define GDI_SDPaon 0x001302C8 +#define GDI_DPSxnon 0x00140869 +#define GDI_DPSaon 0x001502C9 +#define GDI_PSDPSanaxx 0x00165CCA +#define GDI_SSPxDSxaxn 0x00171D54 +#define GDI_SPxPDxa 0x00180D59 +#define GDI_SDPSanaxn 0x00191CC8 +#define GDI_PDSPaox 0x001A06C5 +#define GDI_SDPSxaxn 0x001B0768 +#define GDI_PSDPaox 0x001C06CA +#define GDI_DSPDxaxn 0x001D0766 +#define GDI_PDSox 0x001E01A5 +#define GDI_PDSoan 0x001F0385 +#define GDI_DPSnaa 0x00200F09 +#define GDI_SDPxon 0x00210248 +#define GDI_DSna 0x00220326 +#define GDI_SPDnaon 0x00230B24 +#define GDI_SPxDSxa 0x00240D55 +#define GDI_PDSPanaxn 0x00251CC5 +#define GDI_SDPSaox 0x002606C8 +#define GDI_SDPSxnox 0x00271868 +#define GDI_DPSxa 0x00280369 +#define GDI_PSDPSaoxxn 0x002916CA +#define GDI_DPSana 0x002A0CC9 +#define GDI_SSPxPDxaxn 0x002B1D58 +#define GDI_SPDSoax 0x002C0784 +#define GDI_PSDnox 0x002D060A +#define GDI_PSDPxox 0x002E064A +#define GDI_PSDnoan 0x002F0E2A +#define GDI_PSna 0x0030032A +#define GDI_SDPnaon 0x00310B28 +#define GDI_SDPSoox 0x00320688 +#define GDI_NOTSRCCOPY 0x00330008 +#define GDI_SPDSaox 0x003406C4 +#define GDI_SPDSxnox 0x00351864 +#define GDI_SDPox 0x003601A8 +#define GDI_SDPoan 0x00370388 +#define GDI_PSDPoax 0x0038078A +#define GDI_SPDnox 0x00390604 +#define GDI_SPDSxox 0x003A0644 +#define GDI_SPDnoan 0x003B0E24 +#define GDI_PSx 0x003C004A +#define GDI_SPDSonox 0x003D18A4 +#define GDI_SPDSnaox 0x003E1B24 +#define GDI_PSan 0x003F00EA +#define GDI_PSDnaa 0x00400F0A +#define GDI_DPSxon 0x00410249 +#define GDI_SDxPDxa 0x00420D5D +#define GDI_SPDSanaxn 0x00431CC4 +#define GDI_SRCERASE 0x00440328 +#define GDI_DPSnaon 0x00450B29 +#define GDI_DSPDaox 0x004606C6 +#define GDI_PSDPxaxn 0x0047076A +#define GDI_SDPxa 0x00480368 +#define GDI_PDSPDaoxxn 0x004916C5 +#define GDI_DPSDoax 0x004A0789 +#define GDI_PDSnox 0x004B0605 +#define GDI_SDPana 0x004C0CC8 +#define GDI_SSPxDSxoxn 0x004D1954 +#define GDI_PDSPxox 0x004E0645 +#define GDI_PDSnoan 0x004F0E25 +#define GDI_PDna 0x00500325 +#define GDI_DSPnaon 0x00510B26 +#define GDI_DPSDaox 0x005206C9 +#define GDI_SPDSxaxn 0x00530764 +#define GDI_DPSonon 0x005408A9 +#define GDI_DSTINVERT 0x00550009 +#define GDI_DPSox 0x005601A9 +#define GDI_DPSoan 0x00570389 +#define GDI_PDSPoax 0x00580785 +#define GDI_DPSnox 0x00590609 +#define GDI_PATINVERT 0x005A0049 +#define GDI_DPSDonox 0x005B18A9 +#define GDI_DPSDxox 0x005C0649 +#define GDI_DPSnoan 0x005D0E29 +#define GDI_DPSDnaox 0x005E1B29 +#define GDI_DPan 0x005F00E9 +#define GDI_PDSxa 0x00600365 +#define GDI_DSPDSaoxxn 0x006116C6 +#define GDI_DSPDoax 0x00620786 +#define GDI_SDPnox 0x00630608 +#define GDI_SDPSoax 0x00640788 +#define GDI_DSPnox 0x00650606 +#define GDI_SRCINVERT 0x00660046 +#define GDI_SDPSonox 0x006718A8 +#define GDI_DSPDSonoxxn 0x006858A6 +#define GDI_PDSxxn 0x00690145 +#define GDI_DPSax 0x006A01E9 +#define GDI_PSDPSoaxxn 0x006B178A +#define GDI_SDPax 0x006C01E8 +#define GDI_PDSPDoaxxn 0x006D1785 +#define GDI_SDPSnoax 0x006E1E28 +#define GDI_PDSxnan 0x006F0C65 +#define GDI_PDSana 0x00700CC5 +#define GDI_SSDxPDxaxn 0x00711D5C +#define GDI_SDPSxox 0x00720648 +#define GDI_SDPnoan 0x00730E28 +#define GDI_DSPDxox 0x00740646 +#define GDI_DSPnoan 0x00750E26 +#define GDI_SDPSnaox 0x00761B28 +#define GDI_DSan 0x007700E6 +#define GDI_PDSax 0x007801E5 +#define GDI_DSPDSoaxxn 0x00791786 +#define GDI_DPSDnoax 0x007A1E29 +#define GDI_SDPxnan 0x007B0C68 +#define GDI_SPDSnoax 0x007C1E24 +#define GDI_DPSxnan 0x007D0C69 +#define GDI_SPxDSxo 0x007E0955 +#define GDI_DPSaan 0x007F03C9 +#define GDI_DPSaa 0x008003E9 +#define GDI_SPxDSxon 0x00810975 +#define GDI_DPSxna 0x00820C49 +#define GDI_SPDSnoaxn 0x00831E04 +#define GDI_SDPxna 0x00840C48 +#define GDI_PDSPnoaxn 0x00851E05 +#define GDI_DSPDSoaxx 0x008617A6 +#define GDI_PDSaxn 0x008701C5 +#define GDI_SRCAND 0x008800C6 +#define GDI_SDPSnaoxn 0x00891B08 +#define GDI_DSPnoa 0x008A0E06 +#define GDI_DSPDxoxn 0x008B0666 +#define GDI_SDPnoa 0x008C0E08 +#define GDI_SDPSxoxn 0x008D0668 +#define GDI_SSDxPDxax 0x008E1D7C +#define GDI_PDSanan 0x008F0CE5 +#define GDI_PDSxna 0x00900C45 +#define GDI_SDPSnoaxn 0x00911E08 +#define GDI_DPSDPoaxx 0x009217A9 +#define GDI_SPDaxn 0x009301C4 +#define GDI_PSDPSoaxx 0x009417AA +#define GDI_DPSaxn 0x009501C9 +#define GDI_DPSxx 0x00960169 +#define GDI_PSDPSonoxx 0x0097588A +#define GDI_SDPSonoxn 0x00981888 +#define GDI_DSxn 0x00990066 +#define GDI_DPSnax 0x009A0709 +#define GDI_SDPSoaxn 0x009B07A8 +#define GDI_SPDnax 0x009C0704 +#define GDI_DSPDoaxn 0x009D07A6 +#define GDI_DSPDSaoxx 0x009E16E6 +#define GDI_PDSxan 0x009F0345 +#define GDI_DPa 0x00A000C9 +#define GDI_PDSPnaoxn 0x00A11B05 +#define GDI_DPSnoa 0x00A20E09 +#define GDI_DPSDxoxn 0x00A30669 +#define GDI_PDSPonoxn 0x00A41885 +#define GDI_PDxn 0x00A50065 +#define GDI_DSPnax 0x00A60706 +#define GDI_PDSPoaxn 0x00A707A5 +#define GDI_DPSoa 0x00A803A9 +#define GDI_DPSoxn 0x00A90189 +#define GDI_DSTCOPY 0x00AA0029 +#define GDI_DPSono 0x00AB0889 +#define GDI_SPDSxax 0x00AC0744 +#define GDI_DPSDaoxn 0x00AD06E9 +#define GDI_DSPnao 0x00AE0B06 +#define GDI_DPno 0x00AF0229 +#define GDI_PDSnoa 0x00B00E05 +#define GDI_PDSPxoxn 0x00B10665 +#define GDI_SSPxDSxox 0x00B21974 +#define GDI_SDPanan 0x00B30CE8 +#define GDI_PSDnax 0x00B4070A +#define GDI_DPSDoaxn 0x00B507A9 +#define GDI_DPSDPaoxx 0x00B616E9 +#define GDI_SDPxan 0x00B70348 +#define GDI_PSDPxax 0x00B8074A +#define GDI_DSPDaoxn 0x00B906E6 +#define GDI_DPSnao 0x00BA0B09 +#define GDI_MERGEPAINT 0x00BB0226 +#define GDI_SPDSanax 0x00BC1CE4 +#define GDI_SDxPDxan 0x00BD0D7D +#define GDI_DPSxo 0x00BE0269 +#define GDI_DPSano 0x00BF08C9 +#define GDI_MERGECOPY 0x00C000CA +#define GDI_SPDSnaoxn 0x00C11B04 +#define GDI_SPDSonoxn 0x00C21884 +#define GDI_PSxn 0x00C3006A +#define GDI_SPDnoa 0x00C40E04 +#define GDI_SPDSxoxn 0x00C50664 +#define GDI_SDPnax 0x00C60708 +#define GDI_PSDPoaxn 0x00C707AA +#define GDI_SDPoa 0x00C803A8 +#define GDI_SPDoxn 0x00C90184 +#define GDI_DPSDxax 0x00CA0749 +#define GDI_SPDSaoxn 0x00CB06E4 +#define GDI_SRCCOPY 0x00CC0020 +#define GDI_SDPono 0x00CD0888 +#define GDI_SDPnao 0x00CE0B08 +#define GDI_SPno 0x00CF0224 +#define GDI_PSDnoa 0x00D00E0A +#define GDI_PSDPxoxn 0x00D1066A +#define GDI_PDSnax 0x00D20705 +#define GDI_SPDSoaxn 0x00D307A4 +#define GDI_SSPxPDxax 0x00D41D78 +#define GDI_DPSanan 0x00D50CE9 +#define GDI_PSDPSaoxx 0x00D616EA +#define GDI_DPSxan 0x00D70349 +#define GDI_PDSPxax 0x00D80745 +#define GDI_SDPSaoxn 0x00D906E8 +#define GDI_DPSDanax 0x00DA1CE9 +#define GDI_SPxDSxan 0x00DB0D75 +#define GDI_SPDnao 0x00DC0B04 +#define GDI_SDno 0x00DD0228 +#define GDI_SDPxo 0x00DE0268 +#define GDI_SDPano 0x00DF08C8 +#define GDI_PDSoa 0x00E003A5 +#define GDI_PDSoxn 0x00E10185 +#define GDI_DSPDxax 0x00E20746 +#define GDI_PSDPaoxn 0x00E306EA +#define GDI_SDPSxax 0x00E40748 +#define GDI_PDSPaoxn 0x00E506E5 +#define GDI_SDPSanax 0x00E61CE8 +#define GDI_SPxPDxan 0x00E70D79 +#define GDI_SSPxDSxax 0x00E81D74 +#define GDI_DSPDSanaxxn 0x00E95CE6 +#define GDI_DPSao 0x00EA02E9 +#define GDI_DPSxno 0x00EB0849 +#define GDI_SDPao 0x00EC02E8 +#define GDI_SDPxno 0x00ED0848 +#define GDI_SRCPAINT 0x00EE0086 +#define GDI_SDPnoo 0x00EF0A08 +#define GDI_PATCOPY 0x00F00021 +#define GDI_PDSono 0x00F10885 +#define GDI_PDSnao 0x00F20B05 +#define GDI_PSno 0x00F3022A +#define GDI_PSDnao 0x00F40B0A +#define GDI_PDno 0x00F50225 +#define GDI_PDSxo 0x00F60265 +#define GDI_PDSano 0x00F708C5 +#define GDI_PDSao 0x00F802E5 +#define GDI_PDSxno 0x00F90845 +#define GDI_DPo 0x00FA0089 +#define GDI_PATPAINT 0x00FB0A09 +#define GDI_PSo 0x00FC008A +#define GDI_PSDnoo 0x00FD0A0A +#define GDI_DPSoo 0x00FE02A9 +#define GDI_WHITENESS 0x00FF0062 +#define GDI_GLYPH_ORDER 0xFFFFFFFF + +/* Brush Styles */ +#define GDI_BS_SOLID 0x00 +#define GDI_BS_NULL 0x01 +#define GDI_BS_HATCHED 0x02 +#define GDI_BS_PATTERN 0x03 + +/* Hatch Patterns */ +#define GDI_HS_HORIZONTAL 0x00 +#define GDI_HS_VERTICAL 0x01 +#define GDI_HS_FDIAGONAL 0x02 +#define GDI_HS_BDIAGONAL 0x03 +#define GDI_HS_CROSS 0x04 +#define GDI_HS_DIAGCROSS 0x05 + +/* Pen Styles */ +#define GDI_PS_SOLID 0x00 +#define GDI_PS_DASH 0x01 +#define GDI_PS_NULL 0x05 + +/* Background Modes */ +#define GDI_OPAQUE 0x00000001 +#define GDI_TRANSPARENT 0x00000002 + +/* Fill Modes */ +#define GDI_FILL_ALTERNATE 0x01 +#define GDI_FILL_WINDING 0x02 + +/* GDI Object Types */ +#define GDIOBJECT_BITMAP 0x00 +#define GDIOBJECT_PEN 0x01 +#define GDIOBJECT_PALETTE 0x02 +#define GDIOBJECT_BRUSH 0x03 +#define GDIOBJECT_RECT 0x04 +#define GDIOBJECT_REGION 0x05 + +/* Region return values */ +#ifndef NULLREGION +#define NULLREGION 0x01 +#define SIMPLEREGION 0x02 +#define COMPLEXREGION 0x03 +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + BYTE objectType; + } GDIOBJECT; + typedef GDIOBJECT* HGDIOBJECT; + + typedef struct + { + BYTE objectType; + INT32 left; + INT32 top; + INT32 right; + INT32 bottom; + } GDI_RECT; + typedef GDI_RECT* HGDI_RECT; + + typedef struct + { + BYTE objectType; + INT32 x; /* left */ + INT32 y; /* top */ + INT32 w; /* width */ + INT32 h; /* height */ + BOOL null; /* null region */ + } GDI_RGN; + typedef GDI_RGN* HGDI_RGN; + + typedef struct + { + BYTE objectType; + UINT32 format; + INT32 width; + INT32 height; + UINT32 scanline; + BYTE* data; + void (*free)(void*); + } GDI_BITMAP; + typedef GDI_BITMAP* HGDI_BITMAP; + + typedef struct + { + BYTE objectType; + UINT32 style; + INT32 width; + INT32 posX; + INT32 posY; + UINT32 color; + UINT32 format; + const gdiPalette* palette; + } GDI_PEN; + typedef GDI_PEN* HGDI_PEN; + + typedef struct + { + BYTE red; + BYTE green; + BYTE blue; + } GDI_PALETTEENTRY; + + typedef struct + { + UINT16 count; + GDI_PALETTEENTRY* entries; + } GDI_PALETTE; + typedef GDI_PALETTE* HGDI_PALETTE; + + typedef struct + { + INT32 x; + INT32 y; + } GDI_POINT; + typedef GDI_POINT* HGDI_POINT; + + typedef struct + { + BYTE objectType; + int style; + HGDI_BITMAP pattern; + UINT32 color; + INT32 nXOrg; + INT32 nYOrg; + } GDI_BRUSH; + typedef GDI_BRUSH* HGDI_BRUSH; + + typedef struct + { + UINT32 count; + INT32 ninvalid; + HGDI_RGN invalid; + HGDI_RGN cinvalid; + } GDI_WND; + typedef GDI_WND* HGDI_WND; + + typedef struct + { + HGDIOBJECT selectedObject; + UINT32 format; + UINT32 bkColor; + UINT32 textColor; + HGDI_BRUSH brush; + HGDI_RGN clip; + HGDI_PEN pen; + HGDI_WND hwnd; + INT32 drawMode; + INT32 bkMode; + } GDI_DC; + typedef GDI_DC* HGDI_DC; + + struct gdi_bitmap + { + rdpBitmap _p; + + HGDI_DC hdc; + HGDI_BITMAP bitmap; + HGDI_BITMAP org_bitmap; + }; + typedef struct gdi_bitmap gdiBitmap; + + struct gdi_glyph + { + rdpBitmap _p; + + HGDI_DC hdc; + HGDI_BITMAP bitmap; + HGDI_BITMAP org_bitmap; + }; + typedef struct gdi_glyph gdiGlyph; + + struct rdp_gdi + { + rdpContext* context; + + INT32 width; + INT32 height; + UINT32 stride; + UINT32 dstFormat; + UINT32 cursor_x; + UINT32 cursor_y; + + HGDI_DC hdc; + gdiBitmap* primary; + gdiBitmap* drawing; + UINT32 bitmap_size; + UINT32 bitmap_stride; + BYTE* primary_buffer; + gdiPalette palette; + gdiBitmap* image; + void (*free)(void*); + + BOOL inGfxFrame; + BOOL graphicsReset; /* deprecated, remove with FreeRDP v3 */ + BOOL suppressOutput; + UINT16 outputSurfaceId; + UINT32 frameId; + RdpgfxClientContext* gfx; + VideoClientContext* video; + GeometryClientContext* geometry; + + wLog* log; + }; + typedef struct rdp_gdi rdpGdi; + + FREERDP_API DWORD gdi_rop3_code(BYTE code); + FREERDP_API const char* gdi_rop3_code_string(BYTE code); + FREERDP_API const char* gdi_rop3_string(DWORD rop); + + FREERDP_API UINT32 gdi_get_pixel_format(UINT32 bitsPerPixel); + FREERDP_API BOOL gdi_decode_color(rdpGdi* gdi, const UINT32 srcColor, UINT32* color, + UINT32* format); + FREERDP_API BOOL gdi_resize(rdpGdi* gdi, UINT32 width, UINT32 height); + FREERDP_API BOOL gdi_resize_ex(rdpGdi* gdi, UINT32 width, UINT32 height, UINT32 stride, + UINT32 format, BYTE* buffer, void (*pfree)(void*)); + FREERDP_API BOOL gdi_init(freerdp* instance, UINT32 format); + FREERDP_API BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer, + void (*pfree)(void*)); + FREERDP_API void gdi_free(freerdp* instance); + + FREERDP_API BOOL gdi_send_suppress_output(rdpGdi* gdi, BOOL suppress); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_GDI_H */ diff --git a/include/freerdp/gdi/gfx.h b/include/freerdp/gdi/gfx.h new file mode 100644 index 0000000..4e731b3 --- /dev/null +++ b/include/freerdp/gdi/gfx.h @@ -0,0 +1,77 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * GDI Graphics Pipeline + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_GDI_GFX_H +#define FREERDP_GDI_GFX_H + +#include <freerdp/api.h> +#include <freerdp/gdi/gdi.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + struct gdi_gfx_surface + { + UINT16 surfaceId; + rdpCodecs* codecs; + H264_CONTEXT* h264; + UINT32 width; + UINT32 height; + UINT32 mappedWidth; + UINT32 mappedHeight; + BYTE* data; + UINT32 scanline; + UINT32 format; + BOOL outputMapped; + UINT32 outputOriginX; + UINT32 outputOriginY; + REGION16 invalidRegion; + UINT64 windowId; + UINT32 outputTargetWidth; + UINT32 outputTargetHeight; + BOOL windowMapped; + BOOL handleInUpdateSurfaceArea; + }; + typedef struct gdi_gfx_surface gdiGfxSurface; + + struct gdi_gfx_cache_entry + { + UINT64 cacheKey; + UINT32 width; + UINT32 height; + BYTE* data; + UINT32 scanline; + UINT32 format; + }; + typedef struct gdi_gfx_cache_entry gdiGfxCacheEntry; + + FREERDP_API BOOL gdi_graphics_pipeline_init(rdpGdi* gdi, RdpgfxClientContext* gfx); + FREERDP_API BOOL gdi_graphics_pipeline_init_ex(rdpGdi* gdi, RdpgfxClientContext* gfx, + pcRdpgfxMapWindowForSurface map, + pcRdpgfxUnmapWindowForSurface unmap, + pcRdpgfxUpdateSurfaceArea update); + FREERDP_API void gdi_graphics_pipeline_uninit(rdpGdi* gdi, RdpgfxClientContext* gfx); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_GDI_GFX_H */ diff --git a/include/freerdp/gdi/pen.h b/include/freerdp/gdi/pen.h new file mode 100644 index 0000000..880ef25 --- /dev/null +++ b/include/freerdp/gdi/pen.h @@ -0,0 +1,39 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * GDI Pen Functions + * + * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_GDI_PEN_H +#define FREERDP_GDI_PEN_H + +#include <freerdp/api.h> +#include <freerdp/gdi/gdi.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API HGDI_PEN gdi_CreatePen(UINT32 fnPenStyle, UINT32 nWidth, UINT32 crColor, + UINT32 format, const gdiPalette* palette); + FREERDP_API UINT32 gdi_GetPenColor(HGDI_PEN pen, UINT32 format); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_GDI_PEN_H */ diff --git a/include/freerdp/gdi/region.h b/include/freerdp/gdi/region.h new file mode 100644 index 0000000..d515b7b --- /dev/null +++ b/include/freerdp/gdi/region.h @@ -0,0 +1,64 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * GDI Region Functions + * + * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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_GDI_REGION_H +#define FREERDP_GDI_REGION_H + +#include <freerdp/api.h> +#include <freerdp/gdi/gdi.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API HGDI_RGN gdi_CreateRectRgn(INT32 nLeftRect, INT32 nTopRect, INT32 nRightRect, + INT32 nBottomRect); + FREERDP_API HGDI_RECT gdi_CreateRect(INT32 xLeft, INT32 yTop, INT32 xRight, INT32 yBottom); + FREERDP_API BOOL gdi_RectToRgn(const HGDI_RECT rect, HGDI_RGN rgn); + FREERDP_API BOOL gdi_CRectToRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, HGDI_RGN rgn); + FREERDP_API BOOL gdi_RectToCRgn(const HGDI_RECT rect, INT32* x, INT32* y, INT32* w, INT32* h); + FREERDP_API BOOL gdi_CRectToCRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, INT32* x, + INT32* y, INT32* w, INT32* h); + FREERDP_API BOOL gdi_RgnToRect(const HGDI_RGN rgn, HGDI_RECT rect); + FREERDP_API BOOL gdi_CRgnToRect(INT64 x, INT64 y, INT32 w, INT32 h, HGDI_RECT rect); + FREERDP_API BOOL gdi_RgnToCRect(const HGDI_RGN rgn, INT32* left, INT32* top, INT32* right, + INT32* bottom); + FREERDP_API BOOL gdi_CRgnToCRect(INT32 x, INT32 y, INT32 w, INT32 h, INT32* left, INT32* top, + INT32* right, INT32* bottom); + FREERDP_API BOOL gdi_CopyOverlap(INT32 x, INT32 y, INT32 width, INT32 height, INT32 srcx, + INT32 srcy); + FREERDP_API BOOL gdi_SetRect(HGDI_RECT rc, INT32 xLeft, INT32 yTop, INT32 xRight, + INT32 yBottom); + FREERDP_API BOOL gdi_SetRgn(HGDI_RGN hRgn, INT32 nXLeft, INT32 nYLeft, INT32 nWidth, + INT32 nHeight); + FREERDP_API BOOL gdi_SetRectRgn(HGDI_RGN hRgn, INT32 nLeftRect, INT32 nTopRect, + INT32 nRightRect, INT32 nBottomRect); + FREERDP_API BOOL gdi_EqualRgn(const HGDI_RGN hSrcRgn1, const HGDI_RGN hSrcRgn2); + FREERDP_API BOOL gdi_CopyRect(HGDI_RECT dst, const HGDI_RECT src); + FREERDP_API BOOL gdi_PtInRect(const HGDI_RECT rc, INT32 x, INT32 y); + FREERDP_API BOOL gdi_InvalidateRegion(HGDI_DC hdc, INT32 x, INT32 y, INT32 w, INT32 h); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_GDI_REGION_H */ diff --git a/include/freerdp/gdi/shape.h b/include/freerdp/gdi/shape.h new file mode 100644 index 0000000..d4a183e --- /dev/null +++ b/include/freerdp/gdi/shape.h @@ -0,0 +1,44 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * GDI Shape Functions + * + * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_GDI_SHAPE_H +#define FREERDP_GDI_SHAPE_H + +#include <freerdp/api.h> +#include <freerdp/gdi/gdi.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API BOOL gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, + int nBottomRect); + FREERDP_API BOOL gdi_FillRect(HGDI_DC hdc, const HGDI_RECT rect, HGDI_BRUSH hbr); + FREERDP_API BOOL gdi_Polygon(HGDI_DC hdc, GDI_POINT* lpPoints, int nCount); + FREERDP_API BOOL gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT* lpPoints, int* lpPolyCounts, + int nCount); + FREERDP_API BOOL gdi_Rectangle(HGDI_DC hdc, INT32 nXDst, INT32 nYDst, INT32 nWidth, + INT32 nHeight); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_GDI_SHAPE_H */ diff --git a/include/freerdp/gdi/video.h b/include/freerdp/gdi/video.h new file mode 100644 index 0000000..a9e50f8 --- /dev/null +++ b/include/freerdp/gdi/video.h @@ -0,0 +1,53 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Video Optimized Remoting Virtual Channel Extension for X11 + * + * Copyright 2017 David Fort <contact@hardening-consulting.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_GDI_VIDEO_H_ +#define FREERDP_GDI_VIDEO_H_ + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/gdi/gdi.h> +#include <freerdp/client/geometry.h> +#include <freerdp/client/video.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_gdiVideoContext gdiVideoContext; + + FREERDP_API void gdi_video_geometry_init(rdpGdi* gdi, GeometryClientContext* geom); + FREERDP_API void gdi_video_geometry_uninit(rdpGdi* gdi, GeometryClientContext* geom); + + FREERDP_API void gdi_video_control_init(rdpGdi* gdi, VideoClientContext* video); + FREERDP_API void gdi_video_control_uninit(rdpGdi* gdi, VideoClientContext* video); + + FREERDP_API void gdi_video_data_init(rdpGdi* gdi, VideoClientContext* video); + FREERDP_API void gdi_video_data_uninit(rdpGdi* gdi, VideoClientContext* context); + + FREERDP_API void gdi_video_free(gdiVideoContext* context); + + WINPR_ATTR_MALLOC(gdi_video_free, 1) + FREERDP_API gdiVideoContext* gdi_video_new(rdpGdi* gdi); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_GDI_VIDEO_H_ */ diff --git a/include/freerdp/graphics.h b/include/freerdp/graphics.h new file mode 100644 index 0000000..1b98635 --- /dev/null +++ b/include/freerdp/graphics.h @@ -0,0 +1,175 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Graphical Objects + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@thincast.com> + * Copyright 2016 Thincast Technologies GmbH + * + * 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_GRAPHICS_H +#define FREERDP_GRAPHICS_H + +#include <stdlib.h> +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_bitmap rdpBitmap; + typedef struct rdp_pointer rdpPointer; + typedef struct rdp_glyph rdpGlyph; + + /* Bitmap Class */ + typedef BOOL (*pBitmap_New)(rdpContext* context, rdpBitmap* bitmap); + typedef void (*pBitmap_Free)(rdpContext* context, rdpBitmap* bitmap); + typedef BOOL (*pBitmap_Paint)(rdpContext* context, rdpBitmap* bitmap); + typedef BOOL (*pBitmap_Decompress)(rdpContext* context, rdpBitmap* bitmap, const BYTE* data, + UINT32 width, UINT32 height, UINT32 bpp, UINT32 length, + BOOL compressed, UINT32 codec_id); + typedef BOOL (*pBitmap_SetSurface)(rdpContext* context, rdpBitmap* bitmap, BOOL primary); + + struct rdp_bitmap + { + size_t size; /* 0 */ + pBitmap_New New; /* 1 */ + pBitmap_Free Free; /* 2 */ + pBitmap_Paint Paint; /* 3 */ + pBitmap_Decompress Decompress; /* 4 */ + pBitmap_SetSurface SetSurface; /* 5 */ + UINT32 paddingA[16 - 6]; /* 6 */ + + UINT32 left; /* 16 */ + UINT32 top; /* 17 */ + UINT32 right; /* 18 */ + UINT32 bottom; /* 19 */ + UINT32 width; /* 20 */ + UINT32 height; /* 21 */ + UINT32 format; /* 22 */ + UINT32 flags; /* 23 */ + UINT32 length; /* 24 */ + BYTE* data; /* 25 */ + UINT64 key64; /* 26 */ + UINT32 paddingB[32 - 27]; /* 27 */ + + BOOL compressed; /* 32 */ + BOOL ephemeral; /* 33 */ + UINT32 paddingC[64 - 34]; /* 34 */ + }; + + FREERDP_API rdpBitmap* Bitmap_Alloc(rdpContext* context); + FREERDP_API BOOL Bitmap_SetRectangle(rdpBitmap* bitmap, UINT16 left, UINT16 top, UINT16 right, + UINT16 bottom); + FREERDP_API BOOL Bitmap_SetDimensions(rdpBitmap* bitmap, UINT16 width, UINT16 height); + + /* Pointer Class */ + + typedef BOOL (*pPointer_New)(rdpContext* context, rdpPointer* pointer); + typedef void (*pPointer_Free)(rdpContext* context, rdpPointer* pointer); + typedef BOOL (*pPointer_Set)(rdpContext* context, rdpPointer* pointer); + typedef BOOL (*pPointer_SetNull)(rdpContext* context); + typedef BOOL (*pPointer_SetDefault)(rdpContext* context); + typedef BOOL (*pPointer_SetPosition)(rdpContext* context, UINT32 x, UINT32 y); + + struct rdp_pointer + { + size_t size; /* 0 */ + pPointer_New New; /* 1 */ + pPointer_Free Free; /* 2 */ + pPointer_Set Set; /* 3 */ + pPointer_SetNull SetNull; /* 4*/ + pPointer_SetDefault SetDefault; /* 5 */ + pPointer_SetPosition SetPosition; /* 6 */ + UINT32 paddingA[16 - 7]; /* 7 */ + + UINT32 xPos; /* 16 */ + UINT32 yPos; /* 17 */ + UINT32 width; /* 18 */ + UINT32 height; /* 19 */ + UINT32 xorBpp; /* 20 */ + UINT32 lengthAndMask; /* 21 */ + UINT32 lengthXorMask; /* 22 */ + BYTE* xorMaskData; /* 23 */ + BYTE* andMaskData; /* 24 */ + UINT32 paddingB[32 - 25]; /* 25 */ + }; + + FREERDP_API rdpPointer* Pointer_Alloc(rdpContext* context); + + /* Glyph Class */ + typedef BOOL (*pGlyph_New)(rdpContext* context, rdpGlyph* glyph); + typedef void (*pGlyph_Free)(rdpContext* context, rdpGlyph* glyph); + typedef BOOL (*pGlyph_Draw)(rdpContext* context, const rdpGlyph* glyph, INT32 x, INT32 y, + INT32 w, INT32 h, INT32 sx, INT32 sy, BOOL fOpRedundant); + typedef BOOL (*pGlyph_BeginDraw)(rdpContext* context, INT32 x, INT32 y, INT32 width, + INT32 height, UINT32 bgcolor, UINT32 fgcolor, + BOOL fOpRedundant); + typedef BOOL (*pGlyph_EndDraw)(rdpContext* context, INT32 x, INT32 y, INT32 width, INT32 height, + UINT32 bgcolor, UINT32 fgcolor); + typedef BOOL (*pGlyph_SetBounds)(rdpContext* context, INT32 x, INT32 y, INT32 width, + INT32 height); + + struct rdp_glyph + { + size_t size; /* 0 */ + pGlyph_New New; /* 1 */ + pGlyph_Free Free; /* 2 */ + pGlyph_Draw Draw; /* 3 */ + pGlyph_BeginDraw BeginDraw; /* 4 */ + pGlyph_EndDraw EndDraw; /* 5 */ + pGlyph_SetBounds SetBounds; /* 6 */ + UINT32 paddingA[16 - 7]; /* 7 */ + + INT32 x; /* 16 */ + INT32 y; /* 17 */ + UINT32 cx; /* 18 */ + UINT32 cy; /* 19 */ + UINT32 cb; /* 20 */ + BYTE* aj; /* 21 */ + UINT32 paddingB[32 - 22]; /* 22 */ + }; + + FREERDP_API rdpGlyph* Glyph_Alloc(rdpContext* context, INT32 x, INT32 y, UINT32 cx, UINT32 cy, + UINT32 cb, const BYTE* aj); + + /* Graphics Module */ + + struct rdp_graphics + { + rdpContext* context; /* 0 */ + rdpBitmap* Bitmap_Prototype; /* 1 */ + rdpPointer* Pointer_Prototype; /* 2 */ + rdpGlyph* Glyph_Prototype; /* 3 */ + UINT32 paddingA[16 - 4]; /* 4 */ + }; + typedef struct rdp_graphics rdpGraphics; + + FREERDP_API void graphics_register_bitmap(rdpGraphics* graphics, const rdpBitmap* bitmap); + FREERDP_API void graphics_register_pointer(rdpGraphics* graphics, const rdpPointer* pointer); + FREERDP_API void graphics_register_glyph(rdpGraphics* graphics, const rdpGlyph* glyph); + + FREERDP_API void graphics_free(rdpGraphics* graphics); + + WINPR_ATTR_MALLOC(graphics_free, 1) + FREERDP_API rdpGraphics* graphics_new(rdpContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_GRAPHICS_H */ diff --git a/include/freerdp/heartbeat.h b/include/freerdp/heartbeat.h new file mode 100644 index 0000000..61512e6 --- /dev/null +++ b/include/freerdp/heartbeat.h @@ -0,0 +1,47 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Heartbeat PDUs + * + * Copyright 2014 Dell Software <Mike.McDonald@software.dell.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_HEARTBEAT_H +#define FREERDP_HEARTBEAT_H + +#include <freerdp/types.h> +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_heartbeat rdpHeartbeat; + + typedef BOOL (*pServerHeartbeat)(freerdp* instance, BYTE period, BYTE count1, BYTE count2); + + struct rdp_heartbeat + { + pServerHeartbeat ServerHeartbeat; + }; + + FREERDP_API BOOL freerdp_heartbeat_send_heartbeat_pdu(freerdp_peer* peer, BYTE period, + BYTE count1, BYTE count2); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_HEARTBEAT_H */ diff --git a/include/freerdp/input.h b/include/freerdp/input.h new file mode 100644 index 0000000..512fcee --- /dev/null +++ b/include/freerdp/input.h @@ -0,0 +1,123 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Input Interface API + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_INPUT_H +#define FREERDP_INPUT_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/scancode.h> + +#include <winpr/crt.h> +#include <winpr/collections.h> + +/* keyboard Flags */ +#define KBD_FLAGS_EXTENDED 0x0100 +#define KBD_FLAGS_EXTENDED1 0x0200 +#define KBD_FLAGS_DOWN \ + 0x4000 /**< Presence of this flag indicates the key was already down previously */ +#define KBD_FLAGS_RELEASE \ + 0x8000 /**< Presence of this flag indicates a key was released. Absence a key press */ + +/* Pointer Flags */ +#define PTR_FLAGS_HWHEEL 0x0400 +#define PTR_FLAGS_WHEEL 0x0200 +#define PTR_FLAGS_WHEEL_NEGATIVE 0x0100 +#define PTR_FLAGS_MOVE 0x0800 +#define PTR_FLAGS_DOWN 0x8000 +#define PTR_FLAGS_BUTTON1 0x1000 /* left */ +#define PTR_FLAGS_BUTTON2 0x2000 /* right */ +#define PTR_FLAGS_BUTTON3 0x4000 /* middle */ +#define WheelRotationMask 0x01FF + +/* Extended Pointer Flags */ +#define PTR_XFLAGS_DOWN 0x8000 +#define PTR_XFLAGS_BUTTON1 0x0001 +#define PTR_XFLAGS_BUTTON2 0x0002 + +/* Keyboard Toggle Flags */ +#define KBD_SYNC_SCROLL_LOCK 0x00000001 +#define KBD_SYNC_NUM_LOCK 0x00000002 +#define KBD_SYNC_CAPS_LOCK 0x00000004 +#define KBD_SYNC_KANA_LOCK 0x00000008 + +#define RDP_CLIENT_INPUT_PDU_HEADER_LENGTH 4 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_input rdpInput; + + /* defined inside libfreerdp-core */ + typedef struct rdp_input_proxy rdpInputProxy; + + /* Input Interface */ + + typedef BOOL (*pSynchronizeEvent)(rdpInput* input, UINT32 flags); + typedef BOOL (*pKeyboardEvent)(rdpInput* input, UINT16 flags, UINT8 code); + typedef BOOL (*pUnicodeKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code); + typedef BOOL (*pMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); + typedef BOOL (*pRelMouseEvent)(rdpInput* input, UINT16 flags, INT16 xDelta, INT16 yDelta); + typedef BOOL (*pQoEEvent)(rdpInput* input, UINT32 timestampMS); + typedef BOOL (*pExtendedMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y); + typedef BOOL (*pFocusInEvent)(rdpInput* input, UINT16 toggleStates); + typedef BOOL (*pKeyboardPauseEvent)(rdpInput* input); + + struct rdp_input + { + rdpContext* context; /* 0 */ + void* param1; /* 1 */ + UINT32 paddingA[16 - 2]; /* 2 */ + + pSynchronizeEvent SynchronizeEvent; /* 16 */ + pKeyboardEvent KeyboardEvent; /* 17 */ + pUnicodeKeyboardEvent UnicodeKeyboardEvent; /* 18 */ + pMouseEvent MouseEvent; /* 19 */ + pExtendedMouseEvent ExtendedMouseEvent; /* 20 */ + pFocusInEvent FocusInEvent; /*21 */ + pKeyboardPauseEvent KeyboardPauseEvent; /* 22 */ + pRelMouseEvent RelMouseEvent; /* 23 */ + pQoEEvent QoEEvent; /* 24 */ + + UINT32 paddingB[32 - 25]; /* 25 */ + }; + + FREERDP_API BOOL freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags); + FREERDP_API BOOL freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code); + FREERDP_API BOOL freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down, BOOL repeat, + UINT32 rdp_scancode); + FREERDP_API BOOL freerdp_input_send_keyboard_pause_event(rdpInput* input); + FREERDP_API BOOL freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, + UINT16 code); + FREERDP_API BOOL freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, + UINT16 y); + FREERDP_API BOOL freerdp_input_send_rel_mouse_event(rdpInput* input, UINT16 flags, INT16 xDelta, + INT16 yDelta); + FREERDP_API BOOL freerdp_input_send_qoe_timestamp(rdpInput* input, UINT32 timestampMS); + FREERDP_API BOOL freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, + UINT16 x, UINT16 y); + FREERDP_API BOOL freerdp_input_send_focus_in_event(rdpInput* input, UINT16 toggleStates); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_INPUT_H */ diff --git a/include/freerdp/license.h b/include/freerdp/license.h new file mode 100644 index 0000000..dc195a4 --- /dev/null +++ b/include/freerdp/license.h @@ -0,0 +1,62 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Licensing API + * + * Copyright 2018 David Fort <contact@hardening-consulting.com> + * Copyright 2022 Armin Novak <armin.novak@thincast.com> + * Copyright 2022 Thincast Technologies GmbH + * + * 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_LICENSE_H +#define FREERDP_LICENSE_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + LICENSE_STATE_INITIAL, + LICENSE_STATE_CONFIGURED, + LICENSE_STATE_REQUEST, + LICENSE_STATE_NEW_REQUEST, + LICENSE_STATE_PLATFORM_CHALLENGE, + LICENSE_STATE_PLATFORM_CHALLENGE_RESPONSE, + LICENSE_STATE_COMPLETED, + LICENSE_STATE_ABORTED + } LICENSE_STATE; + + typedef enum + { + LICENSE_TYPE_INVALID = 0, + LICENSE_TYPE_NONE, + LICENSE_TYPE_ISSUED + } LICENSE_TYPE; + + typedef struct rdp_license rdpLicense; + + FREERDP_API rdpLicense* license_get(rdpContext* context); + FREERDP_API LICENSE_STATE license_get_state(const rdpLicense* license); + FREERDP_API LICENSE_TYPE license_get_type(const rdpLicense* license); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_LICENSE_H */ diff --git a/include/freerdp/listener.h b/include/freerdp/listener.h new file mode 100644 index 0000000..56ede56 --- /dev/null +++ b/include/freerdp/listener.h @@ -0,0 +1,86 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP Server Listener + * + * Copyright 2011 Vic Lee + * + * 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_LISTENER_H +#define FREERDP_LISTENER_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/settings.h> +#include <freerdp/peer.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_freerdp_listener freerdp_listener; + + typedef BOOL (*psListenerOpen)(freerdp_listener* instance, const char* bind_address, + UINT16 port); + typedef BOOL (*psListenerOpenLocal)(freerdp_listener* instance, const char* path); + typedef BOOL (*psListenerOpenFromSocket)(freerdp_listener* instance, int fd); +#if defined(WITH_FREERDP_DEPRECATED) + WINPR_DEPRECATED_VAR("Use psListenerGetEventHandles instead", + typedef BOOL (*psListenerGetFileDescriptor)(freerdp_listener* instance, + void** rfds, int* rcount);) +#endif + typedef DWORD (*psListenerGetEventHandles)(freerdp_listener* instance, HANDLE* events, + DWORD nCount); + typedef BOOL (*psListenerCheckFileDescriptor)(freerdp_listener* instance); + typedef void (*psListenerClose)(freerdp_listener* instance); + typedef BOOL (*psPeerAccepted)(freerdp_listener* instance, freerdp_peer* client); + + struct rdp_freerdp_listener + { + void* info; + void* listener; + void* param1; + void* param2; + void* param3; + void* param4; + + psListenerOpen Open; + psListenerOpenLocal OpenLocal; +#if defined(WITH_FREERDP_DEPRECATED) + WINPR_DEPRECATED_VAR("Use rdp_freerdp_listener::GetEventHandles instead", + psListenerGetFileDescriptor GetFileDescriptor;) +#else + void* reserved; +#endif + psListenerGetEventHandles GetEventHandles; + psListenerCheckFileDescriptor CheckFileDescriptor; + psListenerClose Close; + + psPeerAccepted PeerAccepted; + psListenerOpenFromSocket OpenFromSocket; + + psListenerCheckFileDescriptor CheckPeerAcceptRestrictions; + }; + + FREERDP_API void freerdp_listener_free(freerdp_listener* instance); + + WINPR_ATTR_MALLOC(freerdp_listener_free, 1) + FREERDP_API freerdp_listener* freerdp_listener_new(void); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_LISTENER_H */ diff --git a/include/freerdp/locale/keyboard.h b/include/freerdp/locale/keyboard.h new file mode 100644 index 0000000..e35cf69 --- /dev/null +++ b/include/freerdp/locale/keyboard.h @@ -0,0 +1,239 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Keyboard Mapping + * + * Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_LOCALE_KEYBOARD_H +#define FREERDP_LOCALE_KEYBOARD_H + +#include <winpr/input.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/scancode.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define RDP_KEYBOARD_LAYOUT_TYPE_STANDARD 1 +#define RDP_KEYBOARD_LAYOUT_TYPE_VARIANT 2 +#define RDP_KEYBOARD_LAYOUT_TYPE_IME 4 + +typedef struct +{ + UINT16 id; + UINT8 primaryId; + UINT8 subId; + char locale[512]; + char primaryLanguage[512]; + char primaryLanguageSymbol[512]; + char subLanguage[512]; + char subLanguageSymbol[512]; +} RDP_CODEPAGE; + +typedef struct +{ + DWORD code; /* Keyboard layout code */ + char* name; /* Keyboard layout name */ +} RDP_KEYBOARD_LAYOUT; + +/* Keyboard layout IDs */ + +#define KBD_ARABIC_101 0x00000401 +#define KBD_BULGARIAN 0x00000402 +#define KBD_CHINESE_TRADITIONAL_US 0x00000404 +#define KBD_CZECH 0x00000405 +#define KBD_DANISH 0x00000406 +#define KBD_GERMAN 0x00000407 +#define KBD_GREEK 0x00000408 +#define KBD_US 0x00000409 +#define KBD_SPANISH 0x0000040A +#define KBD_FINNISH 0x0000040B +#define KBD_FRENCH 0x0000040C +#define KBD_HEBREW 0x0000040D +#define KBD_HUNGARIAN 0x0000040E +#define KBD_ICELANDIC 0x0000040F +#define KBD_ITALIAN 0x00000410 +#define KBD_JAPANESE 0x00000411 +#define KBD_KOREAN 0x00000412 +#define KBD_DUTCH 0x00000413 +#define KBD_NORWEGIAN 0x00000414 +#define KBD_POLISH_PROGRAMMERS 0x00000415 +#define KBD_PORTUGUESE_BRAZILIAN_ABNT 0x00000416 +#define KBD_ROMANIAN 0x00000418 +#define KBD_RUSSIAN 0x00000419 +#define KBD_CROATIAN 0x0000041A +#define KBD_SLOVAK 0x0000041B +#define KBD_ALBANIAN 0x0000041C +#define KBD_SWEDISH 0x0000041D +#define KBD_THAI_KEDMANEE 0x0000041E +#define KBD_TURKISH_Q 0x0000041F +#define KBD_URDU 0x00000420 +#define KBD_UKRAINIAN 0x00000422 +#define KBD_BELARUSIAN 0x00000423 +#define KBD_SLOVENIAN 0x00000424 +#define KBD_ESTONIAN 0x00000425 +#define KBD_LATVIAN 0x00000426 +#define KBD_LITHUANIAN_IBM 0x00000427 +#define KBD_FARSI 0x00000429 +#define KBD_VIETNAMESE 0x0000042A +#define KBD_ARMENIAN_EASTERN 0x0000042B +#define KBD_AZERI_LATIN 0x0000042C +#define KBD_FYRO_MACEDONIAN 0x0000042F +#define KBD_GEORGIAN 0x00000437 +#define KBD_FAEROESE 0x00000438 +#define KBD_DEVANAGARI_INSCRIPT 0x00000439 +#define KBD_MALTESE_47_KEY 0x0000043A +#define KBD_NORWEGIAN_WITH_SAMI 0x0000043B +#define KBD_KAZAKH 0x0000043F +#define KBD_KYRGYZ_CYRILLIC 0x00000440 +#define KBD_TATAR 0x00000444 +#define KBD_BENGALI 0x00000445 +#define KBD_PUNJABI 0x00000446 +#define KBD_GUJARATI 0x00000447 +#define KBD_TAMIL 0x00000449 +#define KBD_TELUGU 0x0000044A +#define KBD_KANNADA 0x0000044B +#define KBD_MALAYALAM 0x0000044C +#define KBD_MARATHI 0x0000044E +#define KBD_MONGOLIAN_CYRILLIC 0x00000450 +#define KBD_UNITED_KINGDOM_EXTENDED 0x00000452 +#define KBD_SYRIAC 0x0000045A +#define KBD_NEPALI 0x00000461 +#define KBD_PASHTO 0x00000463 +#define KBD_DIVEHI_PHONETIC 0x00000465 +#define KBD_LUXEMBOURGISH 0x0000046E +#define KBD_MAORI 0x00000481 +#define KBD_CHINESE_SIMPLIFIED_US 0x00000804 +#define KBD_SWISS_GERMAN 0x00000807 +#define KBD_UNITED_KINGDOM 0x00000809 +#define KBD_LATIN_AMERICAN 0x0000080A +#define KBD_BELGIAN_FRENCH 0x0000080C +#define KBD_BELGIAN_PERIOD 0x00000813 +#define KBD_PORTUGUESE 0x00000816 +#define KBD_SERBIAN_LATIN 0x0000081A +#define KBD_AZERI_CYRILLIC 0x0000082C +#define KBD_SWEDISH_WITH_SAMI 0x0000083B +#define KBD_UZBEK_CYRILLIC 0x00000843 +#define KBD_INUKTITUT_LATIN 0x0000085D +#define KBD_CANADIAN_FRENCH_LEGACY 0x00000C0C +#define KBD_SERBIAN_CYRILLIC 0x00000C1A +#define KBD_CANADIAN_FRENCH 0x00001009 +#define KBD_SWISS_FRENCH 0x0000100C +#define KBD_BOSNIAN 0x0000141A +#define KBD_IRISH 0x00001809 +#define KBD_BOSNIAN_CYRILLIC 0x0000201A + +/* Keyboard layout variant IDs */ + +#define KBD_ARABIC_102 0x00010401 +#define KBD_BULGARIAN_LATIN 0x00010402 +#define KBD_CZECH_QWERTY 0x00010405 +#define KBD_GERMAN_IBM 0x00010407 +#define KBD_GREEK_220 0x00010408 +#define KBD_UNITED_STATES_DVORAK 0x00010409 +#define KBD_SPANISH_VARIATION 0x0001040A +#define KBD_HUNGARIAN_101_KEY 0x0001040E +#define KBD_ITALIAN_142 0x00010410 +#define KBD_POLISH_214 0x00010415 +#define KBD_PORTUGUESE_BRAZILIAN_ABNT2 0x00010416 +#define KBD_ROMANIAN_STANDARD 0x00010418 +#define KBD_RUSSIAN_TYPEWRITER 0x00010419 +#define KBD_SLOVAK_QWERTY 0x0001041B +#define KBD_THAI_PATTACHOTE 0x0001041E +#define KBD_TURKISH_F 0x0001041F +#define KBD_LATVIAN_QWERTY 0x00010426 +#define KBD_LITHUANIAN 0x00010427 +#define KBD_ARMENIAN_WESTERN 0x0001042B +#define KBD_GEORGIAN_QUERTY 0x00010437 +#define KBD_HINDI_TRADITIONAL 0x00010439 +#define KBD_MALTESE_48_KEY 0x0001043A +#define KBD_SAMI_EXTENDED_NORWAY 0x0001043B +#define KBD_BENGALI_INSCRIPT 0x00010445 +#define KBD_KHMER 0x00010453 +#define KBD_SYRIAC_PHONETIC 0x0001045A +#define KBD_DIVEHI_TYPEWRITER 0x00010465 +#define KBD_BELGIAN_COMMA 0x0001080C +#define KBD_FINNISH_WITH_SAMI 0x0001083B +#define KBD_CANADIAN_MULTILINGUAL_STANDARD 0x00011009 +#define KBD_GAELIC 0x00011809 +#define KBD_ARABIC_102_AZERTY 0x00020401 +#define KBD_CZECH_PROGRAMMERS 0x00020405 +#define KBD_GREEK_319 0x00020408 +#define KBD_UNITED_STATES_INTERNATIONAL 0x00020409 +#define KBD_RUSSIAN_PHONETIC 0x00020419 +#define KBD_THAI_KEDMANEE_NON_SHIFTLOCK 0x0002041E +#define KBD_BANGLA 0x00020445 +#define KBD_SAMI_EXTENDED_FINLAND_SWEDEN 0x0002083B +#define KBD_GREEK_220_LATIN 0x00030408 +#define KBD_UNITED_STATES_DVORAK_FOR_LEFT_HAND 0x00030409 +#define KBD_THAI_PATTACHOTE_NON_SHIFTLOCK 0x0003041E +#define KBD_BULGARIAN_PHONETIC 0x00040402 +#define KBD_GREEK_319_LATIN 0x00040408 +#define KBD_UNITED_STATES_DVORAK_FOR_RIGHT_HAND 0x00040409 +#define KBD_UNITED_STATES_DVORAK_PROGRAMMER 0x19360409 +#define KBD_GREEK_LATIN 0x00050408 +#define KBD_PERSIAN 0x00050429 +#define KBD_US_ENGLISH_TABLE_FOR_IBM_ARABIC_238_L 0x00050409 +#define KBD_GREEK_POLYTONIC 0x00060408 +#define KBD_FRENCH_BEPO 0xa000040c +#define KBD_GERMAN_NEO 0xB0000407 + +/* Global Input Method Editor (IME) IDs */ + +#define KBD_CHINESE_TRADITIONAL_PHONETIC 0xE0010404 +#define KBD_JAPANESE_INPUT_SYSTEM_MS_IME2002 0xE0010411 +#define KBD_KOREAN_INPUT_SYSTEM_IME_2000 0xE0010412 +#define KBD_CHINESE_SIMPLIFIED_QUANPIN 0xE0010804 +#define KBD_CHINESE_TRADITIONAL_CHANGJIE 0xE0020404 +#define KBD_CHINESE_SIMPLIFIED_SHUANGPIN 0xE0020804 +#define KBD_CHINESE_TRADITIONAL_QUICK 0xE0030404 +#define KBD_CHINESE_SIMPLIFIED_ZHENGMA 0xE0030804 +#define KBD_CHINESE_TRADITIONAL_BIG5_CODE 0xE0040404 +#define KBD_CHINESE_TRADITIONAL_ARRAY 0xE0050404 +#define KBD_CHINESE_SIMPLIFIED_NEIMA 0xE0050804 +#define KBD_CHINESE_TRADITIONAL_DAYI 0xE0060404 +#define KBD_CHINESE_TRADITIONAL_UNICODE 0xE0070404 +#define KBD_CHINESE_TRADITIONAL_NEW_PHONETIC 0xE0080404 +#define KBD_CHINESE_TRADITIONAL_NEW_CHANGJIE 0xE0090404 +#define KBD_CHINESE_TRADITIONAL_MICROSOFT_PINYIN_IME_3 0xE00E0804 +#define KBD_CHINESE_TRADITIONAL_ALPHANUMERIC 0xE00F0404 + + FREERDP_API DWORD freerdp_keyboard_init(DWORD keyboardLayoutId); + FREERDP_API DWORD freerdp_keyboard_init_ex(DWORD keyboardLayoutId, + const char* keyboardRemappingList); + FREERDP_API RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(DWORD types, size_t* count); + FREERDP_API void freerdp_keyboard_layouts_free(RDP_KEYBOARD_LAYOUT* layouts, size_t count); + FREERDP_API const char* freerdp_keyboard_get_layout_name_from_id(DWORD keyboardLayoutId); + FREERDP_API DWORD freerdp_keyboard_get_layout_id_from_name(const char* name); + FREERDP_API DWORD freerdp_keyboard_get_rdp_scancode_from_x11_keycode(DWORD keycode); + FREERDP_API DWORD freerdp_keyboard_get_x11_keycode_from_rdp_scancode(DWORD scancode, + BOOL extended); + + FREERDP_API RDP_CODEPAGE* + freerdp_keyboard_get_matching_codepages(DWORD column, const char* filter, size_t* count); + FREERDP_API void freerdp_codepages_free(RDP_CODEPAGE*); + + FREERDP_API const char* freerdp_keyboard_scancode_name(DWORD scancode); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_LOCALE_KEYBOARD_H */ diff --git a/include/freerdp/locale/locale.h b/include/freerdp/locale/locale.h new file mode 100644 index 0000000..6647bb2 --- /dev/null +++ b/include/freerdp/locale/locale.h @@ -0,0 +1,250 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Microsoft Locales + * + * Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.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. + */ + +/* Detection of plausible keyboard layout id based on current locale (LANG) setting. */ + +/* + * Refer to "Windows XP/Server 2003 - List of Locale IDs, Input Locale, and Language Collection": + * http://www.microsoft.com/globaldev/reference/winxp/xp-lcid.mspx + */ + +#ifndef FREERDP_LOCALE_H +#define FREERDP_LOCALE_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#define AFRIKAANS 0x0436 +#define ALBANIAN 0x041C +#define ALSATIAN 0x0484 +#define AMHARIC 0x045E +#define ARABIC_SAUDI_ARABIA 0x0401 +#define ARABIC_IRAQ 0x0801 +#define ARABIC_EGYPT 0x0C01 +#define ARABIC_LIBYA 0x1001 +#define ARABIC_ALGERIA 0x1401 +#define ARABIC_MOROCCO 0x1801 +#define ARABIC_TUNISIA 0x1C01 +#define ARABIC_OMAN 0x2001 +#define ARABIC_YEMEN 0x2401 +#define ARABIC_SYRIA 0x2801 +#define ARABIC_JORDAN 0x2C01 +#define ARABIC_LEBANON 0x3001 +#define ARABIC_KUWAIT 0x3401 +#define ARABIC_UAE 0x3801 +#define ARABIC_BAHRAIN 0x3C01 +#define ARABIC_QATAR 0x4001 +#define ARMENIAN 0x042B +#define ASSAMESE 0x044D +#define AZERI_LATIN 0x042C +#define AZERI_CYRILLIC 0x082C +#define BASHKIR 0x046D +#define BASQUE 0x042D +#define BELARUSIAN 0x0423 +#define BENGALI_INDIA 0x0445 +#define BOSNIAN_LATIN 0x141A +#define BRETON 0x047E +#define BULGARIAN 0x0402 +#define CATALAN 0x0403 +#define CHEROKEE 0x045C +#define CHINESE_TAIWAN 0x0404 +#define CHINESE_PRC 0x0804 +#define CHINESE_HONG_KONG 0x0C04 +#define CHINESE_SINGAPORE 0x1004 +#define CHINESE_MACAU 0x1404 +#define CROATIAN 0x041A +#define CROATIAN_BOSNIA_HERZEGOVINA 0x101A +#define CZECH 0x0405 +#define DANISH 0x0406 +#define DARI 0x048C +#define DIVEHI 0x0465 +#define DUTCH_STANDARD 0x0413 +#define DUTCH_BELGIAN 0x0813 +#define ENGLISH_UNITED_STATES 0x0409 +#define ENGLISH_UNITED_KINGDOM 0x0809 +#define ENGLISH_AUSTRALIAN 0x0C09 +#define ENGLISH_CANADIAN 0x1009 +#define ENGLISH_NEW_ZEALAND 0x1409 +#define ENGLISH_INDIA 0x4009 +#define ENGLISH_IRELAND 0x1809 +#define ENGLISH_MALAYSIA 0x4409 +#define ENGLISH_SOUTH_AFRICA 0x1C09 +#define ENGLISH_JAMAICA 0x2009 +#define ENGLISH_CARIBBEAN 0x2409 +#define ENGLISH_BELIZE 0x2809 +#define ENGLISH_TRINIDAD 0x2C09 +#define ENGLISH_ZIMBABWE 0x3009 +#define ENGLISH_PHILIPPINES 0x3409 +#define ENGLISH_SINGAPORE 0x4809 +#define ESTONIAN 0x0425 +#define FAEROESE 0x0438 +#define FARSI 0x0429 +#define FILIPINO 0x0464 +#define FINNISH 0x040B +#define FRENCH_STANDARD 0x040C +#define FRENCH_BELGIAN 0x080C +#define FRENCH_CANADIAN 0x0C0C +#define FRENCH_SWISS 0x100C +#define FRENCH_LUXEMBOURG 0x140C +#define FRENCH_MONACO 0x180C +#define FRISIAN 0x0462 +#define GEORGIAN 0x0437 +#define GALICIAN 0x0456 +#define GERMAN_STANDARD 0x0407 +#define GERMAN_SWISS 0x0807 +#define GERMAN_AUSTRIAN 0x0C07 +#define GERMAN_LUXEMBOURG 0x1007 +#define GERMAN_LIECHTENSTEIN 0x1407 +#define GREEK 0x0408 +#define GREENLANDIC 0x046F +#define GUJARATI 0x0447 +#define HAWAIIAN 0x0475 +#define HEBREW 0x040D +#define HINDI 0x0439 +#define HUNGARIAN 0x040E +#define ICELANDIC 0x040F +#define IGBO 0x0470 +#define INDONESIAN 0x0421 +#define INUKTITUT 0x045D +#define IRISH 0x083C +#define ITALIAN_STANDARD 0x0410 +#define ITALIAN_SWISS 0x0810 +#define JAPANESE 0x0411 +#define KANNADA 0x044B +#define KAZAKH 0x043F +#define KHMER 0x0453 +#define KICHE 0x0486 +#define KINYARWANDA 0x0487 +#define KONKANI 0x0457 +#define KOREAN 0x0412 +#define KYRGYZ 0x0440 +#define LAO 0x0454 +#define LATVIAN 0x0426 +#define LITHUANIAN 0x0427 +#define LOWER_SORBIAN 0x082E +#define LUXEMBOURGISH 0x046E +#define MACEDONIAN 0x042F +#define MALAY_MALAYSIA 0x043E +#define MALAY_BRUNEI_DARUSSALAM 0x083E +#define MALAYALAM 0x044C +#define MALTESE 0x043A +#define MAPUDUNGUN 0x047A +#define MAORI 0x0481 +#define MARATHI 0x044E +#define MOHAWK 0x047C +#define MONGOLIAN 0x0450 +#define MYANMAR 0x0455 +#define NEPALI 0x0461 +#define NORWEGIAN_BOKMAL 0x0414 +#define NORWEGIAN_NYNORSK 0x0814 +#define OCCITAN 0x0482 +#define ORIYA 0x0448 +#define PASHTO 0x0463 +#define POLISH 0x0415 +#define PORTUGUESE_BRAZILIAN 0x0416 +#define PORTUGUESE_STANDARD 0x0816 +#define PUNJABI 0x0446 +#define QUECHUA_BOLIVIA 0x046B +#define QUECHUA_ECUADOR 0x086B +#define QUECHUA_PERU 0x0C6B +#define ROMANIAN 0x0418 +#define ROMANSH 0x0417 +#define RUSSIAN 0x0419 +#define SAMI_INARI 0x243B +#define SAMI_LULE_NORWAY 0x103B +#define SAMI_LULE_SWEDEN 0x143B +#define SAMI_NORTHERN_FINLAND 0x0C3B +#define SAMI_NORTHERN_NORWAY 0x043B +#define SAMI_NORTHERN_SWEDEN 0x083B +#define SAMI_SKOLT 0x203B +#define SAMI_SOUTHERN_NORWAY 0x183B +#define SAMI_SOUTHERN_SWEDEN 0x1C3B +#define SANSKRIT 0x044F +#define SERBIAN_LATIN 0x081A +#define SERBIAN_LATIN_BOSNIA_HERZEGOVINA 0x181A +#define SERBIAN_CYRILLIC 0x0C1A +#define SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA 0x1C1A +#define SESOTHO_SA_LEBOA 0x046C +#define SINHALA 0x045B +#define SLOVAK 0x041B +#define SLOVENIAN 0x0424 +#define SPANISH_TRADITIONAL_SORT 0x040A +#define SPANISH_MEXICAN 0x080A +#define SPANISH_MODERN_SORT 0x0C0A +#define SPANISH_GUATEMALA 0x100A +#define SPANISH_COSTA_RICA 0x140A +#define SPANISH_PANAMA 0x180A +#define SPANISH_DOMINICAN_REPUBLIC 0x1C0A +#define SPANISH_VENEZUELA 0x200A +#define SPANISH_COLOMBIA 0x240A +#define SPANISH_PERU 0x280A +#define SPANISH_ARGENTINA 0x2C0A +#define SPANISH_ECUADOR 0x300A +#define SPANISH_CHILE 0x340A +#define SPANISH_UNITED_STATES 0x540A +#define SPANISH_URUGUAY 0x380A +#define SPANISH_PARAGUAY 0x3C0A +#define SPANISH_BOLIVIA 0x400A +#define SPANISH_EL_SALVADOR 0x440A +#define SPANISH_HONDURAS 0x480A +#define SPANISH_NICARAGUA 0x4C0A +#define SPANISH_PUERTO_RICO 0x500A +#define SWAHILI 0x0441 +#define SWEDISH 0x041D +#define SWEDISH_FINLAND 0x081D +#define SYRIAC 0x045A +#define TAMIL 0x0449 +#define TATAR 0x0444 +#define TELUGU 0x044A +#define THAI 0x041E +#define TIBETAN_BHUTAN 0x0851 +#define TIBETAN_PRC 0x0451 +#define TSWANA 0x0432 +#define UKRAINIAN 0x0422 +#define TURKISH 0x041F +#define TURKMEN 0x0442 +#define UIGHUR 0x0480 +#define UPPER_SORBIAN 0x042E +#define URDU 0x0420 +#define URDU_INDIA 0x0820 +#define UZBEK_LATIN 0x0443 +#define UZBEK_CYRILLIC 0x0843 +#define VIETNAMESE 0x042A +#define WELSH 0x0452 +#define WOLOF 0x0488 +#define XHOSA 0x0434 +#define YAKUT 0x0485 +#define YI 0x0478 +#define YORUBA 0x046A +#define ZULU 0x0435 + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API DWORD freerdp_get_system_locale_id(void); + FREERDP_API const char* freerdp_get_system_locale_name_from_id(DWORD localeId); + FREERDP_API int freerdp_detect_keyboard_layout_from_system_locale(DWORD* keyboardLayoutId); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_LOCALE_H */ diff --git a/include/freerdp/log.h b/include/freerdp/log.h new file mode 100644 index 0000000..2343889 --- /dev/null +++ b/include/freerdp/log.h @@ -0,0 +1,29 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP log defines + * + * Copyright 2014 Armin Novak <armin.novak@gmail.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_LOG_H +#define FREERDP_LOG_H + +#include <winpr/wlog.h> + +#define FREERDP_TAG(tag) "com.freerdp." tag +#define SERVER_TAG(tag) FREERDP_TAG("server.") tag +#define CLIENT_TAG(tag) FREERDP_TAG("client.") tag + +#endif /* FREERDP_UTILS_DEBUG_H */ diff --git a/include/freerdp/message.h b/include/freerdp/message.h new file mode 100644 index 0000000..1c47b9f --- /dev/null +++ b/include/freerdp/message.h @@ -0,0 +1,376 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Asynchronous Message Interface + * + * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_MESSAGE_H +#define FREERDP_MESSAGE_H + +#define GetMessageType(_id) (_id & 0xFF) +#define GetMessageClass(_id) ((_id >> 16) & 0xFF) + +#define GetMessageId(_class, _type) ((_class << 16) | _type) + +#define MakeMessageId(_class, _type) (((_class##_Class) << 16) | (_class##_##_type)) + +/** + * Update Message Queue + */ + +#define FREERDP_UPDATE_MESSAGE_QUEUE 1 + +#define Update_Base 0 + +/* Update */ + +#define Update_Class (Update_Base + 1) + +#define Update_BeginPaint 1 +#define Update_EndPaint 2 +#define Update_SetBounds 3 +#define Update_Synchronize 4 +#define Update_DesktopResize 5 +#define Update_BitmapUpdate 6 +#define Update_Palette 7 +#define Update_PlaySound 8 +#define Update_RefreshRect 9 +#define Update_SuppressOutput 10 +#define Update_SurfaceCommand 11 +#define Update_SurfaceBits 12 +#define Update_SurfaceFrameMarker 13 +#define Update_SurfaceFrameAcknowledge 14 +#define Update_SetKeyboardIndicators 15 +#define Update_SetKeyboardImeStatus 16 + +#define FREERDP_UPDATE_BEGIN_PAINT MakeMessageId(Update, BeginPaint) +#define FREERDP_UPDATE_ END_PAINT MakeMessageId(Update, EndPaint) +#define FREERDP_UPDATE_SET_BOUNDS MakeMessageId(Update, SetBounds) +#define FREERDP_UPDATE_SYNCHRONIZE MakeMessageId(Update, Synchronize) +#define FREERDP_UPDATE_DESKTOP_RESIZE MakeMessageId(Update, DesktopResize) +#define FREERDP_UPDATE_BITMAP_UPDATE MakeMessageId(Update, BitmapUpdate) +#define FREERDP_UPDATE_PALETTE MakeMessageId(Update, Palette) +#define FREERDP_UPDATE_PLAY_SOUND MakeMessageId(Update, PlaySound) +#define FREERDP_UPDATE_REFRESH_RECT MakeMessageId(Update, RefreshRect) +#define FREERDP_UPDATE_SUPPRESS_OUTPUT MakeMessageId(Update, SuppressOutput) +#define FREERDP_UPDATE_SURFACE_COMMAND MakeMessageId(Update, SurfaceCommand) +#define FREERDP_UPDATE_SURFACE_BITS MakeMessageId(Update, SurfaceBits) +#define FREERDP_UPDATE_SURFACE_FRAME_MARKER MakeMessageId(Update, SurfaceFrameMarker) +#define FREERDP_UPDATE_SURFACE_FRAME_ACKNOWLEDGE MakeMessageId(Update, SurfaceFrameAcknowledge) +#define FREERDP_UPDATE_SET_KEYBOARD_INDICATORS MakeMessageId(Update, SetKeyboardIndicators) + +/* Primary Update */ + +#define PrimaryUpdate_Class (Update_Base + 2) + +#define PrimaryUpdate_DstBlt 1 +#define PrimaryUpdate_PatBlt 2 +#define PrimaryUpdate_ScrBlt 3 +#define PrimaryUpdate_OpaqueRect 4 +#define PrimaryUpdate_DrawNineGrid 5 +#define PrimaryUpdate_MultiDstBlt 6 +#define PrimaryUpdate_MultiPatBlt 7 +#define PrimaryUpdate_MultiScrBlt 8 +#define PrimaryUpdate_MultiOpaqueRect 9 +#define PrimaryUpdate_MultiDrawNineGrid 10 +#define PrimaryUpdate_LineTo 11 +#define PrimaryUpdate_Polyline 12 +#define PrimaryUpdate_MemBlt 13 +#define PrimaryUpdate_Mem3Blt 14 +#define PrimaryUpdate_SaveBitmap 15 +#define PrimaryUpdate_GlyphIndex 16 +#define PrimaryUpdate_FastIndex 17 +#define PrimaryUpdate_FastGlyph 18 +#define PrimaryUpdate_PolygonSC 19 +#define PrimaryUpdate_PolygonCB 20 +#define PrimaryUpdate_EllipseSC 21 +#define PrimaryUpdate_EllipseCB 22 + +#define FREERDP_PRIMARY_UPDATE_DSTBLT MakeMessageId(PrimaryUpdate, DstBlt) +#define FREERDP_PRIMARY_UPDATE_PATBLT MakeMessageId(PrimaryUpdate, PatBlt) +#define FREERDP_PRIMARY_UPDATE_SCRBLT MakeMessageId(PrimaryUpdate, ScrBlt) +#define FREERDP_PRIMARY_UPDATE_OPAQUE_RECT MakeMessageId(PrimaryUpdate, OpaqueRect) +#define FREERDP_PRIMARY_UPDATE_DRAW_NINE_GRID MakeMessageId(PrimaryUpdate, DrawNineGrid) +#define FREERDP_PRIMARY_UPDATE_MULTI_DSTBLT MakeMessageId(PrimaryUpdate, MultiDstBlt) +#define FREERDP_PRIMARY_UPDATE_MULTI_PATBLT MakeMessageId(PrimaryUpdate, MultiPatBlt) +#define FREERDP_PRIMARY_UPDATE_MULTI_SCRBLT MakeMessageId(PrimaryUpdate, MultiScrBlt) +#define FREERDP_PRIMARY_UPDATE_MULTI_OPAQUE_RECT MakeMessageId(PrimaryUpdate, MultiOpaqueRect) +#define FREERDP_PRIMARY_UPDATE_MULTI_DRAW_NINE_GRID MakeMessageId(PrimaryUpdate, MultiDrawNineGrid) +#define FREERDP_PRIMARY_UPDATE_LINE_TO MakeMessageId(PrimaryUpdate, LineTo) +#define FREERDP_PRIMARY_UPDATE_POLYLINE MakeMessageId(PrimaryUpdate, Polyline) +#define FREERDP_PRIMARY_UPDATE_MEMBLT MakeMessageId(PrimaryUpdate, MemBlt) +#define FREERDP_PRIMARY_UPDATE_MEM3BLT MakeMessageId(PrimaryUpdate, Mem3Blt) +#define FREERDP_PRIMARY_UPDATE_SAVE_BITMAP MakeMessageId(PrimaryUpdate, SaveBitmap) +#define FREERDP_PRIMARY_UPDATE_GLYPH_INDEX MakeMessageId(PrimaryUpdate, GlyphIndex) +#define FREERDP_PRIMARY_UPDATE_FAST_INDEX MakeMessageId(PrimaryUpdate, FastIndex) +#define FREERDP_PRIMARY_UPDATE_FAST_GLYPH MakeMessageId(PrimaryUpdate, FastGlyph) +#define FREERDP_PRIMARY_UPDATE_POLYGON_SC MakeMessageId(PrimaryUpdate, PolygonSC) +#define FREERDP_PRIMARY_UPDATE_POLYGON_CB MakeMessageId(PrimaryUpdate, PolygonCB) +#define FREERDP_PRIMARY_UPDATE_ELLIPSE_SC MakeMessageId(PrimaryUpdate, EllipseSC) +#define FREERDP_PRIMARY_UPDATE_ELLIPSE_CB MakeMessageId(PrimaryUpdate, EllipseCB) + +/* Secondary Update */ + +#define SecondaryUpdate_Class (Update_Base + 3) + +#define SecondaryUpdate_CacheBitmap 1 +#define SecondaryUpdate_CacheBitmapV2 2 +#define SecondaryUpdate_CacheBitmapV3 3 +#define SecondaryUpdate_CacheColorTable 4 +#define SecondaryUpdate_CacheGlyph 5 +#define SecondaryUpdate_CacheGlyphV2 6 +#define SecondaryUpdate_CacheBrush 7 + +#define FREERDP_SECONDARY_UPDATE_CACHE_BITMAP MakeMessageId(SecondaryUpdate, CacheBitmap) +#define FREERDP_SECONDARY_UPDATE_CACHE_BITMAP_V2 MakeMessageId(SecondaryUpdate, CacheBitmapV2) +#define FREERDP_SECONDARY_UPDATE_CACHE_BITMAP_V3 MakeMessageId(SecondaryUpdate, CacheBitmapV3) +#define FREERDP_SECONDARY_UPDATE_CACHE_COLOR_TABLE MakeMessageId(SecondaryUpdate, CacheColorTable) +#define FREERDP_SECONDARY_UPDATE_CACHE_GLYPH MakeMessageId(SecondaryUpdate, CacheGlyph) +#define FREERDP_SECONDARY_UPDATE_CACHE_GLYPH_V2 MakeMessageId(SecondaryUpdate, CacheGlyphV2) +#define FREERDP_SECONDARY_UPDATE_CACHE_BRUSH MakeMessageId(SecondaryUpdate, CacheBrush) + +/* Alternate Secondary Update */ + +#define AltSecUpdate_Class (Update_Base + 4) + +#define AltSecUpdate_CreateOffscreenBitmap 1 +#define AltSecUpdate_SwitchSurface 2 +#define AltSecUpdate_CreateNineGridBitmap 3 +#define AltSecUpdate_FrameMarker 4 +#define AltSecUpdate_StreamBitmapFirst 5 +#define AltSecUpdate_StreamBitmapNext 6 +#define AltSecUpdate_DrawGdiPlusFirst 7 +#define AltSecUpdate_DrawGdiPlusNext 8 +#define AltSecUpdate_DrawGdiPlusEnd 9 +#define AltSecUpdate_DrawGdiPlusCacheFirst 10 +#define AltSecUpdate_DrawGdiPlusCacheNext 11 +#define AltSecUpdate_DrawGdiPlusCacheEnd 12 + +#define FREERDP_ALTSEC_UPDATE_CREATE_OFFSCREEN_BITMAP \ + MakeMessageId(AltSecUpdate, CreateOffscreenBitmap) +#define FREERDP_ALTSEC_UPDATE_SWITCH_SURFACE MakeMessageId(AltSecUpdate, SwitchSurface) +#define FREERDP_ALTSEC_UPDATE_CREATE_NINE_GRID_BITMAP \ + MakeMessageId(AltSecUpdate, CreateNineGridBitmap) +#define FREERDP_ALTSEC_UPDATE_FRAME_MARKER MakeMessageId(AltSecUpdate, FrameMarker) +#define FREERDP_ALTSEC_UPDATE_STREAM_BITMAP_FIRST MakeMessageId(AltSecUpdate, StreamBitmapFirst) +#define FREERDP_ALTSEC_UPDATE_STREAM_BITMAP_NEXT MakeMessageId(AltSecUpdate, StreamBitmapNext) +#define FREERDP_ALTSEC_UPDATE_DRAW_GDI_PLUS_FIRST MakeMessageId(AltSecUpdate, DrawGdiPlusFirst) +#define FREERDP_ALTSEC_UPDATE_DRAW_GDI_PLUS_NEXT MakeMessageId(AltSecUpdate, DrawGdiPlusNext) +#define FREERDP_ALTSEC_UPDATE_DRAW_GDI_PLUS_END MakeMessageId(AltSecUpdate, DrawGdiPlusEnd) +#define FREERDP_ALTSEC_UPDATE_DRAW_GDI_PLUS_CACHE_FIRST \ + MakeMessageId(AltSecUpdate, DrawGdiPlusCacheFirst) +#define FREERDP_ALTSEC_UPDATE_DRAW_GDI_PLUS_CACHE_NEXT \ + MakeMessageId(AltSecUpdate, DrawGdiPlusCacheNext) +#define FREERDP_ALTSEC_UPDATE_DRAW_GDI_PLUS_CACHE_END \ + MakeMessageId(AltSecUpdate, DrawGdiPlusCacheEnd) + +/* Window Update */ + +#define WindowUpdate_Class (Update_Base + 5) + +#define WindowUpdate_WindowCreate 1 +#define WindowUpdate_WindowUpdate 2 +#define WindowUpdate_WindowIcon 3 +#define WindowUpdate_WindowCachedIcon 4 +#define WindowUpdate_WindowDelete 5 +#define WindowUpdate_NotifyIconCreate 6 +#define WindowUpdate_NotifyIconUpdate 7 +#define WindowUpdate_NotifyIconDelete 8 +#define WindowUpdate_MonitoredDesktop 9 +#define WindowUpdate_NonMonitoredDesktop 10 + +#define FREERDP_WINDOW_UPDATE_WINDOW_CREATE MakeMessageId(WindowUpdate, WindowCreate) +#define FREERDP_WINDOW_UPDATE_WINDOW_UPDATE MakeMessageId(WindowUpdate, WindowUpdate) +#define FREERDP_WINDOW_UPDATE_WINDOW_ICON MakeMessageId(WindowUpdate, WindowIcon) +#define FREERDP_WINDOW_UPDATE_WINDOW_CACHED_ICON MakeMessageId(WindowUpdate, WindowCachedIcon) +#define FREERDP_WINDOW_UPDATE_WINDOW_DELETE MakeMessageId(WindowUpdate, WindowDelete) +#define FREERDP_WINDOW_UPDATE_NOTIFY_ICON_CREATE MakeMessageId(WindowUpdate, NotifyIconCreate) +#define FREERDP_WINDOW_UPDATE_NOTIFY_ICON_UPDATE MakeMessageId(WindowUpdate, NotifyIconUpdate) +#define FREERDP_WINDOW_UPDATE_NOTIFY_ICON_DELETE MakeMessageId(WindowUpdate, NotifyIconDelete) +#define FREERDP_WINDOW_UPDATE_MONITORED_DESKTOP MakeMessageId(WindowUpdate, MonitoredDesktop) +#define FREERDP_WINDOW_UPDATE_NON_MONITORED_DESKTOP MakeMessageId(WindowUpdate, NonMonitoredDesktop) + +/* Pointer Update */ + +#define PointerUpdate_Class (Update_Base + 6) + +#define PointerUpdate_PointerPosition 1 +#define PointerUpdate_PointerSystem 2 +#define PointerUpdate_PointerColor 3 +#define PointerUpdate_PointerNew 4 +#define PointerUpdate_PointerCached 5 +#define PointerUpdate_PointerLarge 6 + +#define FREERDP_POINTER_UPDATE_ POINTER_POSITION MakeMessageId(PointerUpdate, PointerPosition) +#define FREERDP_POINTER_UPDATE_POINTER_SYSTEM MakeMessageId(PointerUpdate, PointerSystem) +#define FREERDP_POINTER_UPDATE_POINTER_COLOR MakeMessageId(PointerUpdate, PointerColor) +#define FREERDP_POINTER_UPDATE_POINTER_NEW MakeMessageId(PointerUpdate, PointerNew) +#define FREERDP_POINTER_UPDATE_POINTER_CACHED MakeMessageId(PointerUpdate, PointerCached) +#define FREERDP_POINTER_UPDATE_POINTER_LARGE MakeMessageId(PointerUpdate, PointerLarge) + +/** + * Input Message Queue + */ + +#define FREERDP_INPUT_MESSAGE_QUEUE 2 + +#define Input_Base 16 + +/* Input */ + +#define Input_Class (Input_Base + 1) + +#define Input_SynchronizeEvent 1 +#define Input_KeyboardEvent 2 +#define Input_UnicodeKeyboardEvent 3 +#define Input_MouseEvent 4 +#define Input_ExtendedMouseEvent 5 +#define Input_FocusInEvent 6 +#define Input_KeyboardPauseEvent 7 + +#define FREERDP_INPUT_SYNCHRONIZE_EVENT MakeMessageId(Input, SynchronizeEvent) +#define FREERDP_INPUT_KEYBOARD_EVENT MakeMessageId(Input, KeyboardEvent) +#define FREERDP_INPUT_UNICODE_KEYBOARD_EVENT MakeMessageId(Input, UnicodeKeyboardEvent) +#define FREERDP_INPUT_MOUSE_EVENT MakeMessageId(Input, MouseEvent) +#define FREERDP_INPUT_EXTENDED_MOUSE_EVENT MakeMessageId(Input, ExtendedMouseEvent) +#define FREERDP_INPUT_FOCUS_IN_EVENT MakeMessageId(Input, FocusInEvent) +#define FREERDP_INPUT_KEYBOARD_PAUSE_EVENT MakeMessageId(Input, KeyboardPauseEvent) + +/** + * Static Channel Message Queues + */ + +#define FREERDP_CHANNEL_MESSAGE_QUEUE 3 + +#define Channel_Base 20 + +/** + * Debug Channel + */ + +#define DebugChannel_Class (Channel_Base + 1) + +/** + * Clipboard Channel + */ + +#define CliprdrChannel_Class (Channel_Base + 2) + +#define CliprdrChannel_MonitorReady 1 +#define CliprdrChannel_FormatList 2 +#define CliprdrChannel_DataRequest 3 +#define CliprdrChannel_DataResponse 4 +#define CliprdrChannel_ClipCaps 5 +#define CliprdrChannel_FilecontentsRequest 6 +#define CliprdrChannel_FilecontentsResponse 7 +#define CliprdrChannel_LockClipdata 8 +#define CliprdrChannel_UnLockClipdata 9 +#define CliprdrChannel_TemporaryDirectory 10 + +#define FREERDP_CLIPRDR_CHANNEL_MONITOR_READY MakeMessageId(CliprdrChannel, MonitorReady) +#define FREERDP_CLIPRDR_CHANNEL_FORMAT_LIST MakeMessageId(CliprdrChannel, FormatList) +#define FREERDP_CLIPRDR_CHANNEL_DATA_REQUEST MakeMessageId(CliprdrChannel, DataRequest) +#define FREERDP_CLIPRDR_CHANNEL_DATA_RESPONSE MakeMessageId(CliprdrChannel, DataResponse) +#define FREERDP_CLIPRDR_CHANNEL_CLIP_CAPS MakeMessageId(CliprdrChannel, ClipCaps) + +/** + * Multimedia Redirection Channel + */ + +#define TsmfChannel_Class (Channel_Base + 3) + +#define TsmfChannel_VideoFrame 1 +#define TsmfChannel_Redraw 2 + +#define FREERDP_TSMF_CHANNEL_VIDEO_FRAME MakeMessageId(TsmfChannel, VideoFrame) +#define FREERDP_TSMF_CHANNEL_REDRAW MakeMessageId(TsmfChannel, Redraw) + +/** + * RemoteApp Channel + */ + +#define RailChannel_Class (Channel_Base + 4) + +#define RailChannel_ClientExecute 1 +#define RailChannel_ClientActivate 2 +#define RailChannel_GetSystemParam 3 +#define RailChannel_ClientSystemParam 4 +#define RailChannel_ServerSystemParam 5 +#define RailChannel_ClientSystemCommand 6 +#define RailChannel_ClientHandshake 7 +#define RailChannel_ServerHandshake 8 +#define RailChannel_ClientNotifyEvent 9 +#define RailChannel_ClientWindowMove 10 +#define RailChannel_ServerLocalMoveSize 11 +#define RailChannel_ServerMinMaxInfo 12 +#define RailChannel_ClientInformation 13 +#define RailChannel_ClientSystemMenu 14 +#define RailChannel_ClientLanguageBarInfo 15 +#define RailChannel_ServerLanguageBarInfo 16 +#define RailChannel_ServerExecuteResult 17 +#define RailChannel_ClientGetAppIdRequest 18 +#define RailChannel_ServerGetAppIdResponse 19 +#define RailChannel_ClientHandshakeEx 20 +#define RailChannel_ServerHandshakeEx 21 + +#define FREERDP_RAIL_CHANNEL_CLIENT_EXECUTE MakeMessageId(RailChannel, ClientExecute) +#define FREERDP_RAIL_CHANNEL_CLIENT_ACTIVATE MakeMessageId(RailChannel, ClientActivate) +#define FREERDP_RAIL_CHANNEL_GET_SYSTEM_PARAM MakeMessageId(RailChannel, GetSystemParam) +#define FREERDP_RAIL_CHANNEL_CLIENT_SYSTEM_PARAM MakeMessageId(RailChannel, ClientSystemParam) +#define FREERDP_RAIL_CHANNEL_SERVER_SYSTEM_PARAM MakeMessageId(RailChannel, ClientSystemParam) +#define FREERDP_RAIL_CHANNEL_CLIENT_SYSTEM_COMMAND MakeMessageId(RailChannel, ClientSystemCommand) +#define FREERDP_RAIL_CHANNEL_CLIENT_HANDSHAKE MakeMessageId(RailChannel, ClientHandshake) +#define FREERDP_RAIL_CHANNEL_SERVER_HANDSHAKE MakeMessageId(RailChannel, ServerHandshake) +#define FREERDP_RAIL_CHANNEL_CLIENT_NOTIFY_EVENT MakeMessageId(RailChannel, ClientNotifyEvent) +#define FREERDP_RAIL_CHANNEL_CLIENT_WINDOW_MOVE MakeMessageId(RailChannel, ClientWindowMove) +#define FREERDP_RAIL_CHANNEL_SERVER_LOCAL_MOVE_SIZE MakeMessageId(RailChannel, ServerLocalMoveSize) +#define FREERDP_RAIL_CHANNEL_SERVER_MIN_MAX_INFO MakeMessageId(RailChannel, ServerMinMaxInfo) +#define FREERDP_RAIL_CHANNEL_CLIENT_INFORMATION MakeMessageId(RailChannel, ClientInformation) +#define FREERDP_RAIL_CHANNEL_CLIENT_SYSTEM_MENU MakeMessageId(RailChannel, ClientSystemMenu) +#define FREERDP_RAIL_CHANNEL_CLIENT_LANGUAGE_BAR_INFO \ + MakeMessageId(RailChannel, ClientLanguageBarInfo) +#define FREERDP_RAIL_CHANNEL_SERVER_LANGUAGE_BAR_INFO \ + MakeMessageId(RailChannel, ServerLanguageBarInfo) +#define FREERDP_RAIL_CHANNEL_SERVER_EXECUTE_RESULT MakeMessageId(RailChannel, ServerExecuteResult) +#define FREERDP_RAIL_CHANNEL_CLIENT_GET_APP_ID_REQUEST \ + MakeMessageId(RailChannel, ClientGetAppIdRequest) +#define FREERDP_RAIL_CHANNEL_SERVER_GET_APP_ID_RESPONSE \ + MakeMessageId(RailChannel, ServerGetAppIdResponse) +#define FREERDP_RAIL_CHANNEL_CLIENT_HANDSHAKE_EX MakeMessageId(RailChannel, ClientHandshakeEx) +#define FREERDP_RAIL_CHANNEL_SERVER_HANDSHAKE_EX MakeMessageId(RailChannel, ServerHandshakeEx) + +/** + * MultiTouch Input Channel Extension (MS-RDPEDI) + */ + +#define RdpeiChannel_Class (Channel_Base + 5) + +#define RdpeiChannel_ServerReady 1 +#define RdpeiChannel_ClientReady 2 +#define RdpeiChannel_TouchEvent 3 +#define RdpeiChannel_SuspendTouch 4 +#define RdpeiChannel_ResumeTouch 5 +#define RdpeiChannel_DismissHoveringContact 6 + +#define FREERDP_RDPEI_CHANNEL_SERVER_READY MakeMessageId(RdpeiChannel, ServerReady) +#define FREERDP_RDPEI_CHANNEL_CLIENT_READY MakeMessageId(RdpeiChannel, ClientReady) +#define FREERDP_RDPEI_CHANNEL_TOUCH_EVENT MakeMessageId(RdpeiChannel, TouchEvent) +#define FREERDP_RDPEI_CHANNEL_SUSPEND_TOUCH MakeMessageId(RdpeiChannel, SuspendTouch) +#define FREERDP_RDPEI_CHANNEL_RESUME_TOUCH MakeMessageId(RdpeiChannel, ResumeTouch) +#define FREERDP_RDPEI_CHANNEL_DISMISS_HOVERING_CONTACT \ + MakeMessageId(RdpeiChannel, DismissHoveringContact) + +#endif /* FREERDP_MESSAGE_H */ diff --git a/include/freerdp/metrics.h b/include/freerdp/metrics.h new file mode 100644 index 0000000..6d00bfd --- /dev/null +++ b/include/freerdp/metrics.h @@ -0,0 +1,52 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Protocol Metrics + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_METRICS_H +#define FREERDP_METRICS_H + +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + struct rdp_metrics + { + rdpContext* context; + + UINT64 TotalCompressedBytes; + UINT64 TotalUncompressedBytes; + double TotalCompressionRatio; + }; + typedef struct rdp_metrics rdpMetrics; + + FREERDP_API double metrics_write_bytes(rdpMetrics* metrics, UINT32 UncompressedBytes, + UINT32 CompressedBytes); + + FREERDP_API void metrics_free(rdpMetrics* metrics); + + WINPR_ATTR_MALLOC(metrics_free, 1) + FREERDP_API rdpMetrics* metrics_new(rdpContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_METRICS_H */ diff --git a/include/freerdp/peer.h b/include/freerdp/peer.h new file mode 100644 index 0000000..db09228 --- /dev/null +++ b/include/freerdp/peer.h @@ -0,0 +1,218 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP Server Peer + * + * Copyright 2011 Vic Lee + * + * 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_PEER_H +#define FREERDP_PEER_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/settings.h> +#include <freerdp/input.h> +#include <freerdp/update.h> +#include <freerdp/autodetect.h> +#include <freerdp/redirection.h> + +#include <winpr/sspi.h> +#include <winpr/ntlm.h> +#include <winpr/winsock.h> +#include <winpr/secapi.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef BOOL (*psPeerContextNew)(freerdp_peer* peer, rdpContext* context); + typedef void (*psPeerContextFree)(freerdp_peer* peer, rdpContext* context); + + typedef BOOL (*psPeerInitialize)(freerdp_peer* peer); +#if defined(WITH_FREERDP_DEPRECATED) + WINPR_DEPRECATED_VAR("Use psPeerGetEventHandle instead", + typedef BOOL (*psPeerGetFileDescriptor)(freerdp_peer* peer, void** rfds, + int* rcount);) +#endif + typedef HANDLE (*psPeerGetEventHandle)(freerdp_peer* peer); + typedef DWORD (*psPeerGetEventHandles)(freerdp_peer* peer, HANDLE* events, DWORD count); + typedef HANDLE (*psPeerGetReceiveEventHandle)(freerdp_peer* peer); + typedef BOOL (*psPeerCheckFileDescriptor)(freerdp_peer* peer); + typedef BOOL (*psPeerIsWriteBlocked)(freerdp_peer* peer); + typedef int (*psPeerDrainOutputBuffer)(freerdp_peer* peer); + typedef BOOL (*psPeerHasMoreToRead)(freerdp_peer* peer); + typedef BOOL (*psPeerClose)(freerdp_peer* peer); + typedef void (*psPeerDisconnect)(freerdp_peer* peer); + typedef BOOL (*psPeerRemoteCredentials)(freerdp_peer* peer, KERB_TICKET_LOGON* logonCreds, + MSV1_0_SUPPLEMENTAL_CREDENTIAL* suppCreds); + typedef BOOL (*psPeerCapabilities)(freerdp_peer* peer); + typedef BOOL (*psPeerPostConnect)(freerdp_peer* peer); + typedef BOOL (*psPeerActivate)(freerdp_peer* peer); + typedef BOOL (*psPeerLogon)(freerdp_peer* peer, const SEC_WINNT_AUTH_IDENTITY* identity, + BOOL automatic); + typedef BOOL (*psPeerSendServerRedirection)(freerdp_peer* peer, + const rdpRedirection* redirection); + typedef BOOL (*psPeerAdjustMonitorsLayout)(freerdp_peer* peer); + typedef BOOL (*psPeerClientCapabilities)(freerdp_peer* peer); + + typedef BOOL (*psPeerSendChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data, + size_t size); + typedef BOOL (*psPeerSendChannelPacket)(freerdp_peer* client, UINT16 channelId, + size_t totalSize, UINT32 flags, const BYTE* data, + size_t chunkSize); + typedef BOOL (*psPeerReceiveChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data, + size_t size, UINT32 flags, size_t totalSize); + + typedef HANDLE (*psPeerVirtualChannelOpen)(freerdp_peer* peer, const char* name, UINT32 flags); + typedef BOOL (*psPeerVirtualChannelClose)(freerdp_peer* peer, HANDLE hChannel); + typedef int (*psPeerVirtualChannelRead)(freerdp_peer* peer, HANDLE hChannel, BYTE* buffer, + UINT32 length); + typedef int (*psPeerVirtualChannelWrite)(freerdp_peer* peer, HANDLE hChannel, + const BYTE* buffer, UINT32 length); + typedef void* (*psPeerVirtualChannelGetData)(freerdp_peer* peer, HANDLE hChannel); + typedef int (*psPeerVirtualChannelSetData)(freerdp_peer* peer, HANDLE hChannel, void* data); + typedef BOOL (*psPeerSetState)(freerdp_peer* peer, CONNECTION_STATE state); + typedef BOOL (*psPeerReachedState)(freerdp_peer* peer, CONNECTION_STATE state); + + /** @brief the result of the license callback */ + typedef enum + { + LICENSE_CB_INTERNAL_ERROR, /** an internal error happened in the callback */ + LICENSE_CB_ABORT, /** licensing process failed, abort the connection */ + LICENSE_CB_IN_PROGRESS, /** incoming packet has been treated, we're waiting for further + packets to complete the workflow */ + LICENSE_CB_COMPLETED /** the licensing workflow has completed, go to next step */ + } LicenseCallbackResult; + + typedef LicenseCallbackResult (*psPeerLicenseCallback)(freerdp_peer* peer, wStream* s); + + struct rdp_freerdp_peer + { + ALIGN64 rdpContext* context; + + ALIGN64 int sockfd; + ALIGN64 char hostname[50]; + +#if defined(WITH_FREERDP_DEPRECATED) + WINPR_DEPRECATED_VAR("Use rdpContext::update instead", ALIGN64 rdpUpdate* update;) + WINPR_DEPRECATED_VAR("Use rdpContext::settings instead", ALIGN64 rdpSettings* settings;) + WINPR_DEPRECATED_VAR("Use rdpContext::autodetect instead", + ALIGN64 rdpAutoDetect* autodetect;) +#else + UINT64 reservedX[3]; +#endif + + ALIGN64 void* ContextExtra; + ALIGN64 size_t ContextSize; + ALIGN64 psPeerContextNew ContextNew; + ALIGN64 psPeerContextFree ContextFree; + + ALIGN64 psPeerInitialize Initialize; +#if defined(WITH_FREERDP_DEPRECATED) + WINPR_DEPRECATED_VAR("Use freerdp_peer::GetEventHandle instead", + ALIGN64 psPeerGetFileDescriptor GetFileDescriptor;) +#else + UINT64 reserved; +#endif + ALIGN64 psPeerGetEventHandle GetEventHandle; + ALIGN64 psPeerGetReceiveEventHandle GetReceiveEventHandle; + ALIGN64 psPeerCheckFileDescriptor CheckFileDescriptor; + ALIGN64 psPeerClose Close; + ALIGN64 psPeerDisconnect Disconnect; + + ALIGN64 psPeerCapabilities Capabilities; + ALIGN64 psPeerPostConnect PostConnect; + ALIGN64 psPeerActivate Activate; + ALIGN64 psPeerLogon Logon; + + ALIGN64 psPeerSendServerRedirection SendServerRedirection; + + ALIGN64 psPeerSendChannelData SendChannelData; + ALIGN64 psPeerReceiveChannelData ReceiveChannelData; + + ALIGN64 psPeerVirtualChannelOpen VirtualChannelOpen; + ALIGN64 psPeerVirtualChannelClose VirtualChannelClose; + ALIGN64 psPeerVirtualChannelRead VirtualChannelRead; + ALIGN64 psPeerVirtualChannelWrite VirtualChannelWrite; + ALIGN64 psPeerVirtualChannelGetData VirtualChannelGetData; + ALIGN64 psPeerVirtualChannelSetData VirtualChannelSetData; + + ALIGN64 int pId; + ALIGN64 UINT32 ack_frame_id; + ALIGN64 BOOL local; + ALIGN64 BOOL connected; + ALIGN64 BOOL activated; + ALIGN64 BOOL authenticated; + ALIGN64 SEC_WINNT_AUTH_IDENTITY identity; + + ALIGN64 psPeerIsWriteBlocked IsWriteBlocked; + ALIGN64 psPeerDrainOutputBuffer DrainOutputBuffer; + ALIGN64 psPeerHasMoreToRead HasMoreToRead; + ALIGN64 psPeerGetEventHandles GetEventHandles; + ALIGN64 psPeerAdjustMonitorsLayout AdjustMonitorsLayout; + ALIGN64 psPeerClientCapabilities ClientCapabilities; +#if defined(WITH_FREERDP_DEPRECATED) + WINPR_DEPRECATED_VAR("Use freerdp_peer::SspiNtlmHashCallback instead", + ALIGN64 psPeerComputeNtlmHash ComputeNtlmHash;) +#else + UINT64 reserved2; +#endif + ALIGN64 psPeerLicenseCallback LicenseCallback; + + ALIGN64 psPeerSendChannelPacket SendChannelPacket; + + /** + * @brief SetState Function pointer allowing to manually set the state of the + * internal state machine. + * + * This is useful if certain parts of a RDP connection must be skipped (e.g. + * when replaying a RDP connection dump the authentication/negotiate parts + * must be skipped) + * + * \note Must be called after \b Initialize as that also modifies the state. + */ + ALIGN64 psPeerSetState SetState; + ALIGN64 psPeerReachedState ReachedState; + ALIGN64 psSspiNtlmHashCallback SspiNtlmHashCallback; + /** + * @brief RemoteCredentials Function pointer that will be called when remote + * credentials guard are used by the peer and we receive the logonCreds (kerberos) + * and supplementary creds (NTLM). + */ + ALIGN64 psPeerRemoteCredentials RemoteCredentials; + }; + + FREERDP_API void freerdp_peer_context_free(freerdp_peer* client); + + FREERDP_API BOOL freerdp_peer_context_new(freerdp_peer* client); + FREERDP_API BOOL freerdp_peer_context_new_ex(freerdp_peer* client, const rdpSettings* settings); + + FREERDP_API const char* freerdp_peer_os_major_type_string(freerdp_peer* client); + FREERDP_API const char* freerdp_peer_os_minor_type_string(freerdp_peer* client); + + FREERDP_API void freerdp_peer_free(freerdp_peer* client); + + WINPR_ATTR_MALLOC(freerdp_peer_free, 1) + FREERDP_API freerdp_peer* freerdp_peer_new(int sockfd); + + FREERDP_API BOOL freerdp_peer_set_local_and_hostname(freerdp_peer* client, + const struct sockaddr_storage* peer_addr); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_PEER_H */ diff --git a/include/freerdp/pointer.h b/include/freerdp/pointer.h new file mode 100644 index 0000000..351c021 --- /dev/null +++ b/include/freerdp/pointer.h @@ -0,0 +1,118 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Pointer Updates Interface API + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_UPDATE_POINTER_H +#define FREERDP_UPDATE_POINTER_H + +#include <freerdp/types.h> + +#define PTR_MSG_TYPE_SYSTEM 0x0001 +#define PTR_MSG_TYPE_POSITION 0x0003 +#define PTR_MSG_TYPE_COLOR 0x0006 +#define PTR_MSG_TYPE_CACHED 0x0007 +#define PTR_MSG_TYPE_POINTER 0x0008 +#define PTR_MSG_TYPE_POINTER_LARGE 0x0009 + +#define SYSPTR_NULL 0x00000000 +#define SYSPTR_DEFAULT 0x00007F00 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + UINT32 xPos; + UINT32 yPos; + } POINTER_POSITION_UPDATE; + + typedef struct + { + UINT32 type; + } POINTER_SYSTEM_UPDATE; + + typedef struct + { + UINT16 cacheIndex; + UINT16 hotSpotX; + UINT16 hotSpotY; + UINT16 width; + UINT16 height; + UINT16 lengthAndMask; + UINT16 lengthXorMask; + BYTE* xorMaskData; + BYTE* andMaskData; + } POINTER_COLOR_UPDATE; + + typedef struct + { + UINT16 xorBpp; + UINT16 cacheIndex; + UINT16 hotSpotX; + UINT16 hotSpotY; + UINT16 width; + UINT16 height; + UINT32 lengthAndMask; + UINT32 lengthXorMask; + BYTE* xorMaskData; + BYTE* andMaskData; + } POINTER_LARGE_UPDATE; + + typedef struct + { + UINT32 xorBpp; + POINTER_COLOR_UPDATE colorPtrAttr; + } POINTER_NEW_UPDATE; + + typedef struct + { + UINT32 cacheIndex; + } POINTER_CACHED_UPDATE; + + typedef BOOL (*pPointerPosition)(rdpContext* context, + const POINTER_POSITION_UPDATE* pointer_position); + typedef BOOL (*pPointerSystem)(rdpContext* context, + const POINTER_SYSTEM_UPDATE* pointer_system); + typedef BOOL (*pPointerColor)(rdpContext* context, const POINTER_COLOR_UPDATE* pointer_color); + typedef BOOL (*pPointerNew)(rdpContext* context, const POINTER_NEW_UPDATE* pointer_new); + typedef BOOL (*pPointerCached)(rdpContext* context, + const POINTER_CACHED_UPDATE* pointer_cached); + typedef BOOL (*pPointerLarge)(rdpContext* context, const POINTER_LARGE_UPDATE* pointer_large); + + struct rdp_pointer_update + { + rdpContext* context; /* 0 */ + UINT32 paddingA[16 - 1]; /* 1 */ + + pPointerPosition PointerPosition; /* 16 */ + pPointerSystem PointerSystem; /* 17 */ + pPointerColor PointerColor; /* 18 */ + pPointerNew PointerNew; /* 19 */ + pPointerCached PointerCached; /* 20 */ + pPointerLarge PointerLarge; /* 21 */ + UINT32 paddingB[32 - 22]; /* 22 */ + }; + typedef struct rdp_pointer_update rdpPointerUpdate; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UPDATE_POINTER_H */ diff --git a/include/freerdp/primary.h b/include/freerdp/primary.h new file mode 100644 index 0000000..77f3b39 --- /dev/null +++ b/include/freerdp/primary.h @@ -0,0 +1,481 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Primary Drawing Orders Interface API + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_UPDATE_PRIMARY_H +#define FREERDP_UPDATE_PRIMARY_H + +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + UINT32 cacheIndex; + INT16 x; + INT16 y; + UINT32 cx; + UINT32 cy; + UINT32 cb; + BYTE* aj; + } GLYPH_DATA; + + typedef struct + { + UINT32 cacheIndex; + INT32 x; + INT32 y; + UINT32 cx; + UINT32 cy; + UINT32 cb; + BYTE* aj; + } GLYPH_DATA_V2; + +#define BACKMODE_TRANSPARENT 0x0001 +#define BACKMODE_OPAQUE 0x0002 + +struct rdp_bounds +{ + INT32 left; + INT32 top; + INT32 right; + INT32 bottom; +}; +typedef struct rdp_bounds rdpBounds; + +struct rdp_brush +{ + UINT32 x; + UINT32 y; + UINT32 bpp; + UINT32 style; + UINT32 hatch; + UINT32 index; + BYTE* data; + BYTE p8x8[8]; +}; +typedef struct rdp_brush rdpBrush; + +typedef struct +{ + UINT32 controlFlags; + UINT32 orderType; + UINT32 fieldFlags; + UINT32 boundsFlags; + rdpBounds bounds; + BOOL deltaCoordinates; +} ORDER_INFO; + +typedef struct +{ + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; +} DSTBLT_ORDER; + +typedef struct +{ + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + UINT32 backColor; + UINT32 foreColor; + rdpBrush brush; +} PATBLT_ORDER; + +typedef struct +{ + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + INT32 nXSrc; + INT32 nYSrc; +} SCRBLT_ORDER; + +typedef struct +{ + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 color; +} OPAQUE_RECT_ORDER; + +typedef struct +{ + INT32 srcLeft; + INT32 srcTop; + INT32 srcRight; + INT32 srcBottom; + UINT32 bitmapId; +} DRAW_NINE_GRID_ORDER; + +typedef struct +{ + INT32 left; + INT32 top; + INT32 width; + INT32 height; +} DELTA_RECT; + +typedef struct +{ + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + UINT32 numRectangles; + UINT32 cbData; + DELTA_RECT rectangles[45]; +} MULTI_DSTBLT_ORDER; + +typedef struct +{ + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + UINT32 backColor; + UINT32 foreColor; + rdpBrush brush; + UINT32 numRectangles; + UINT32 cbData; + DELTA_RECT rectangles[45]; +} MULTI_PATBLT_ORDER; + +typedef struct +{ + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + INT32 nXSrc; + INT32 nYSrc; + UINT32 numRectangles; + UINT32 cbData; + DELTA_RECT rectangles[45]; +} MULTI_SCRBLT_ORDER; + +typedef struct +{ + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 color; + UINT32 numRectangles; + UINT32 cbData; + DELTA_RECT rectangles[45]; +} MULTI_OPAQUE_RECT_ORDER; + +typedef struct +{ + INT32 srcLeft; + INT32 srcTop; + INT32 srcRight; + INT32 srcBottom; + UINT32 bitmapId; + UINT32 nDeltaEntries; + UINT32 cbData; + DELTA_RECT rectangles[45]; +} MULTI_DRAW_NINE_GRID_ORDER; + +typedef struct +{ + UINT32 backMode; + INT32 nXStart; + INT32 nYStart; + INT32 nXEnd; + INT32 nYEnd; + UINT32 backColor; + UINT32 bRop2; + UINT32 penStyle; + UINT32 penWidth; + UINT32 penColor; +} LINE_TO_ORDER; + +typedef struct +{ + INT32 x; + INT32 y; +} DELTA_POINT; + +typedef struct +{ + INT32 xStart; + INT32 yStart; + UINT32 bRop2; + UINT32 penColor; + UINT32 numDeltaEntries; + UINT32 cbData; + DELTA_POINT* points; +} POLYLINE_ORDER; + +typedef struct +{ + UINT32 cacheId; + UINT32 colorIndex; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + INT32 nXSrc; + INT32 nYSrc; + UINT32 cacheIndex; + rdpBitmap* bitmap; +} MEMBLT_ORDER; + +typedef struct +{ + UINT32 cacheId; + UINT32 colorIndex; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nWidth; + INT32 nHeight; + UINT32 bRop; + INT32 nXSrc; + INT32 nYSrc; + UINT32 backColor; + UINT32 foreColor; + rdpBrush brush; + UINT32 cacheIndex; + rdpBitmap* bitmap; +} MEM3BLT_ORDER; + +typedef struct +{ + UINT32 savedBitmapPosition; + INT32 nLeftRect; + INT32 nTopRect; + INT32 nRightRect; + INT32 nBottomRect; + UINT32 operation; +} SAVE_BITMAP_ORDER; + +typedef struct +{ + UINT32 index; + UINT32 delta; +} GLYPH_FRAGMENT_INDEX; + +typedef struct +{ + UINT32 operation; + UINT32 index; + UINT32 size; + UINT32 nindices; + GLYPH_FRAGMENT_INDEX* indices; +} GLYPH_FRAGMENT; + +typedef struct +{ + UINT32 cacheId; + UINT32 flAccel; + UINT32 ulCharInc; + UINT32 fOpRedundant; + UINT32 backColor; + UINT32 foreColor; + INT32 bkLeft; + INT32 bkTop; + INT32 bkRight; + INT32 bkBottom; + INT32 opLeft; + INT32 opTop; + INT32 opRight; + INT32 opBottom; + rdpBrush brush; + INT32 x; + INT32 y; + UINT32 cbData; + BYTE data[256]; +} GLYPH_INDEX_ORDER; + +typedef struct +{ + UINT32 cacheId; + UINT32 flAccel; + UINT32 ulCharInc; + UINT32 backColor; + UINT32 foreColor; + INT32 bkLeft; + INT32 bkTop; + INT32 bkRight; + INT32 bkBottom; + INT32 opLeft; + INT32 opTop; + INT32 opRight; + INT32 opBottom; + BOOL opaqueRect; + INT32 x; + INT32 y; + UINT32 cbData; + BYTE data[256]; +} FAST_INDEX_ORDER; + +typedef struct +{ + UINT32 cacheId; + UINT32 flAccel; + UINT32 ulCharInc; + UINT32 backColor; + UINT32 foreColor; + INT32 bkLeft; + INT32 bkTop; + INT32 bkRight; + INT32 bkBottom; + INT32 opLeft; + INT32 opTop; + INT32 opRight; + INT32 opBottom; + INT32 x; + INT32 y; + UINT32 cbData; + BYTE data[256]; + GLYPH_DATA_V2 glyphData; +} FAST_GLYPH_ORDER; + +typedef struct +{ + INT32 xStart; + INT32 yStart; + UINT32 bRop2; + UINT32 fillMode; + UINT32 brushColor; + UINT32 numPoints; + UINT32 cbData; + DELTA_POINT* points; +} POLYGON_SC_ORDER; + +typedef struct +{ + INT32 xStart; + INT32 yStart; + UINT32 bRop2; + UINT32 backMode; + UINT32 fillMode; + UINT32 backColor; + UINT32 foreColor; + rdpBrush brush; + UINT32 numPoints; + UINT32 cbData; + DELTA_POINT* points; +} POLYGON_CB_ORDER; + +typedef struct +{ + INT32 leftRect; + INT32 topRect; + INT32 rightRect; + INT32 bottomRect; + UINT32 bRop2; + UINT32 fillMode; + UINT32 color; +} ELLIPSE_SC_ORDER; + +typedef struct +{ + INT32 leftRect; + INT32 topRect; + INT32 rightRect; + INT32 bottomRect; + UINT32 bRop2; + UINT32 fillMode; + UINT32 backColor; + UINT32 foreColor; + rdpBrush brush; +} ELLIPSE_CB_ORDER; + +typedef BOOL (*pDstBlt)(rdpContext* context, const DSTBLT_ORDER* dstblt); +typedef BOOL (*pPatBlt)(rdpContext* context, PATBLT_ORDER* patblt); +typedef BOOL (*pScrBlt)(rdpContext* context, const SCRBLT_ORDER* scrblt); +typedef BOOL (*pOpaqueRect)(rdpContext* context, const OPAQUE_RECT_ORDER* opaque_rect); +typedef BOOL (*pDrawNineGrid)(rdpContext* context, const DRAW_NINE_GRID_ORDER* draw_nine_grid); +typedef BOOL (*pMultiDstBlt)(rdpContext* context, const MULTI_DSTBLT_ORDER* multi_dstblt); +typedef BOOL (*pMultiPatBlt)(rdpContext* context, const MULTI_PATBLT_ORDER* multi_patblt); +typedef BOOL (*pMultiScrBlt)(rdpContext* context, const MULTI_SCRBLT_ORDER* multi_scrblt); +typedef BOOL (*pMultiOpaqueRect)(rdpContext* context, + const MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect); +typedef BOOL (*pMultiDrawNineGrid)(rdpContext* context, + const MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid); +typedef BOOL (*pLineTo)(rdpContext* context, const LINE_TO_ORDER* line_to); +typedef BOOL (*pPolyline)(rdpContext* context, const POLYLINE_ORDER* polyline); +typedef BOOL (*pMemBlt)(rdpContext* context, MEMBLT_ORDER* memblt); +typedef BOOL (*pMem3Blt)(rdpContext* context, MEM3BLT_ORDER* memblt); +typedef BOOL (*pSaveBitmap)(rdpContext* context, const SAVE_BITMAP_ORDER* save_bitmap); +typedef BOOL (*pGlyphIndex)(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index); +typedef BOOL (*pFastIndex)(rdpContext* context, const FAST_INDEX_ORDER* fast_index); +typedef BOOL (*pFastGlyph)(rdpContext* context, const FAST_GLYPH_ORDER* fast_glyph); +typedef BOOL (*pPolygonSC)(rdpContext* context, const POLYGON_SC_ORDER* polygon_sc); +typedef BOOL (*pPolygonCB)(rdpContext* context, POLYGON_CB_ORDER* polygon_cb); +typedef BOOL (*pEllipseSC)(rdpContext* context, const ELLIPSE_SC_ORDER* ellipse_sc); +typedef BOOL (*pEllipseCB)(rdpContext* context, const ELLIPSE_CB_ORDER* ellipse_cb); +typedef BOOL (*pOrderInfo)(rdpContext* context, const ORDER_INFO* order_info, + const char* order_name); + +struct rdp_primary_update +{ + rdpContext* context; /* 0 */ + UINT32 paddingA[16 - 1]; /* 1 */ + + pDstBlt DstBlt; /* 16 */ + pPatBlt PatBlt; /* 17 */ + pScrBlt ScrBlt; /* 18 */ + pOpaqueRect OpaqueRect; /* 19 */ + pDrawNineGrid DrawNineGrid; /* 20 */ + pMultiDstBlt MultiDstBlt; /* 21 */ + pMultiPatBlt MultiPatBlt; /* 22 */ + pMultiScrBlt MultiScrBlt; /* 23 */ + pMultiOpaqueRect MultiOpaqueRect; /* 24 */ + pMultiDrawNineGrid MultiDrawNineGrid; /* 25 */ + pLineTo LineTo; /* 26 */ + pPolyline Polyline; /* 27 */ + pMemBlt MemBlt; /* 28 */ + pMem3Blt Mem3Blt; /* 29 */ + pSaveBitmap SaveBitmap; /* 30 */ + pGlyphIndex GlyphIndex; /* 31 */ + pFastIndex FastIndex; /* 32 */ + pFastGlyph FastGlyph; /* 33 */ + pPolygonSC PolygonSC; /* 34 */ + pPolygonCB PolygonCB; /* 35 */ + pEllipseSC EllipseSC; /* 36 */ + pEllipseCB EllipseCB; /* 37 */ + /* Statistics callback */ + pOrderInfo OrderInfo; /* 38 */ + UINT32 paddingB[48 - 39]; /* 39 */ +}; +typedef struct rdp_primary_update rdpPrimaryUpdate; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UPDATE_PRIMARY_H */ diff --git a/include/freerdp/primitives.h b/include/freerdp/primitives.h new file mode 100644 index 0000000..20b74d6 --- /dev/null +++ b/include/freerdp/primitives.h @@ -0,0 +1,240 @@ +/* primitives.h + * vi:ts=4 sw=4 + * + * (c) Copyright 2012 Hewlett-Packard Development Company, L.P. + * 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. Algorithms used by + * this code may be covered by patents by HP, Microsoft, or other parties. + */ + +#ifdef __GNUC__ +#pragma once +#endif + +#ifndef FREERDP_PRIMITIVES_H +#define FREERDP_PRIMITIVES_H + +#include <winpr/wtypes.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/codec/color.h> + +#include <winpr/platform.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef INT32 pstatus_t; /* match IppStatus. */ +#define PRIMITIVES_SUCCESS (0) /* match ippStsNoErr */ + +/* Simple macro for address of an x,y location in 2d 4-byte memory block */ +#define PIXMAP4_ADDR(_dst_, _x_, _y_, _span_) \ + ((void*)(((BYTE*)(_dst_)) + (((_x_) + (_y_) * (_span_)) << 2))) + +#define PRIM_X86_MMX_AVAILABLE (1U << 0) +#define PRIM_X86_3DNOW_AVAILABLE (1U << 1) +#define PRIM_X86_3DNOW_PREFETCH_AVAILABLE (1U << 2) +#define PRIM_X86_SSE_AVAILABLE (1U << 3) +#define PRIM_X86_SSE2_AVAILABLE (1U << 4) +#define PRIM_X86_SSE3_AVAILABLE (1U << 5) +#define PRIM_X86_SSSE3_AVAILABLE (1U << 6) +#define PRIM_X86_SSE41_AVAILABLE (1U << 7) +#define PRIM_X86_SSE42_AVAILABLE (1U << 8) +#define PRIM_X86_AVX_AVAILABLE (1U << 9) +#define PRIM_X86_FMA_AVAILABLE (1U << 10) +#define PRIM_X86_AVX_AES_AVAILABLE (1U << 11) +#define PRIM_X86_AVX2_AVAILABLE (1U << 12) + +#define PRIM_ARM_VFP1_AVAILABLE (1U << 0) +#define PRIM_ARM_VFP2_AVAILABLE (1U << 1) +#define PRIM_ARM_VFP3_AVAILABLE (1U << 2) +#define PRIM_ARM_VFP4_AVAILABLE (1U << 3) +#define PRIM_ARM_FPA_AVAILABLE (1U << 4) +#define PRIM_ARM_FPE_AVAILABLE (1U << 5) +#define PRIM_ARM_IWMMXT_AVAILABLE (1U << 6) +#define PRIM_ARM_NEON_AVAILABLE (1U << 7) + +/** @brief flags of primitives */ +enum +{ + PRIM_FLAGS_HAVE_EXTCPU = (1U << 0), /* primitives are using CPU extensions */ + PRIM_FLAGS_HAVE_EXTGPU = (1U << 1), /* primitives are using the GPU */ +}; + +/* Structures compatible with IPP */ +typedef struct +{ + UINT32 width; + UINT32 height; +} prim_size_t; /* like IppiSize */ + +typedef enum +{ + AVC444_LUMA, + AVC444_CHROMAv1, + AVC444_CHROMAv2 +} avc444_frame_type; + +/* Function prototypes for all of the supported primitives. */ +typedef pstatus_t (*__copy_t)(const void* WINPR_RESTRICT pSrc, void* WINPR_RESTRICT pDst, + INT32 bytes); +typedef pstatus_t (*__copy_8u_t)(const BYTE* WINPR_RESTRICT pSrc, BYTE* WINPR_RESTRICT pDst, + INT32 len); +typedef pstatus_t (*__copy_8u_AC4r_t)(const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep, /* bytes */ + BYTE* WINPR_RESTRICT pDst, INT32 dstStep, /* bytes */ + INT32 width, INT32 height); /* pixels */ +typedef pstatus_t (*__set_8u_t)(BYTE val, BYTE* WINPR_RESTRICT pDst, UINT32 len); +typedef pstatus_t (*__set_32s_t)(INT32 val, INT32* WINPR_RESTRICT pDst, UINT32 len); +typedef pstatus_t (*__set_32u_t)(UINT32 val, UINT32* WINPR_RESTRICT pDst, UINT32 len); +typedef pstatus_t (*__zero_t)(void* WINPR_RESTRICT pDst, size_t bytes); +typedef pstatus_t (*__alphaComp_argb_t)(const BYTE* WINPR_RESTRICT pSrc1, UINT32 src1Step, + const BYTE* WINPR_RESTRICT pSrc2, UINT32 src2Step, + BYTE* WINPR_RESTRICT pDst, UINT32 dstStep, UINT32 width, + UINT32 height); +typedef pstatus_t (*__add_16s_t)(const INT16* WINPR_RESTRICT pSrc1, + const INT16* WINPR_RESTRICT pSrc2, INT16* WINPR_RESTRICT pDst, + UINT32 len); +typedef pstatus_t (*__lShiftC_16s_t)(const INT16* pSrc, UINT32 val, INT16* pSrcDst, UINT32 len); +typedef pstatus_t (*__lShiftC_16u_t)(const UINT16* pSrc, UINT32 val, UINT16* pSrcDst, UINT32 len); +typedef pstatus_t (*__rShiftC_16s_t)(const INT16* pSrc, UINT32 val, INT16* pSrcDst, UINT32 len); +typedef pstatus_t (*__rShiftC_16u_t)(const UINT16* pSrc, UINT32 val, UINT16* pSrcDst, UINT32 len); +typedef pstatus_t (*__shiftC_16s_t)(const INT16* pSrc, INT32 val, INT16* pSrcDst, UINT32 len); +typedef pstatus_t (*__shiftC_16u_t)(const UINT16* pSrc, INT32 val, UINT16* pSrcDst, UINT32 len); +typedef pstatus_t (*__sign_16s_t)(const INT16* WINPR_RESTRICT pSrc, INT16* WINPR_RESTRICT pDst, + UINT32 len); +typedef pstatus_t (*__yCbCrToRGB_16s8u_P3AC4R_t)(const INT16* const WINPR_RESTRICT pSrc[3], + UINT32 srcStep, BYTE* WINPR_RESTRICT pDst, + UINT32 dstStep, UINT32 DstFormat, + const prim_size_t* WINPR_RESTRICT roi); +typedef pstatus_t (*__yCbCrToRGB_16s16s_P3P3_t)(const INT16* const WINPR_RESTRICT pSrc[3], + INT32 srcStep, INT16* WINPR_RESTRICT pDst[3], + INT32 dstStep, + const prim_size_t* WINPR_RESTRICT roi); +typedef pstatus_t (*__RGBToYCbCr_16s16s_P3P3_t)(const INT16* const WINPR_RESTRICT pSrc[3], + INT32 srcStep, INT16* WINPR_RESTRICT pDst[3], + INT32 dstStep, + const prim_size_t* WINPR_RESTRICT roi); +typedef pstatus_t (*__RGBToRGB_16s8u_P3AC4R_t)(const INT16* const WINPR_RESTRICT pSrc[3], + UINT32 srcStep, BYTE* WINPR_RESTRICT pDst, + UINT32 dstStep, UINT32 DstFormat, + const prim_size_t* WINPR_RESTRICT roi); +typedef pstatus_t (*__YCoCgToRGB_8u_AC4R_t)(const BYTE* WINPR_RESTRICT pSrc, INT32 srcStep, + BYTE* WINPR_RESTRICT pDst, UINT32 DstFormat, + INT32 dstStep, UINT32 width, UINT32 height, UINT8 shift, + BOOL withAlpha); +typedef pstatus_t (*__RGB565ToARGB_16u32u_C3C4_t)(const UINT16* WINPR_RESTRICT pSrc, INT32 srcStep, + UINT32* WINPR_RESTRICT pDst, INT32 dstStep, + UINT32 width, UINT32 height, UINT32 format); +typedef pstatus_t (*__YUV420ToRGB_8u_P3AC4R_t)(const BYTE* const WINPR_RESTRICT pSrc[3], + const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst, + UINT32 dstStep, UINT32 DstFormat, + const prim_size_t* WINPR_RESTRICT roi); +typedef pstatus_t (*__YUV444ToRGB_8u_P3AC4R_t)(const BYTE* const WINPR_RESTRICT pSrc[3], + const UINT32 srcStep[3], BYTE* WINPR_RESTRICT pDst, + UINT32 dstStep, UINT32 DstFormat, + const prim_size_t* WINPR_RESTRICT roi); +typedef pstatus_t (*__RGBToYUV420_8u_P3AC4R_t)(const BYTE* WINPR_RESTRICT pSrc, UINT32 SrcFormat, + UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3], + const UINT32 dstStep[3], + const prim_size_t* WINPR_RESTRICT roi); +typedef pstatus_t (*__RGBToYUV444_8u_P3AC4R_t)(const BYTE* WINPR_RESTRICT pSrc, UINT32 SrcFormat, + UINT32 srcStep, BYTE* WINPR_RESTRICT pDst[3], + UINT32 dstStep[3], + const prim_size_t* WINPR_RESTRICT roi); +typedef pstatus_t (*__YUV420CombineToYUV444_t)(avc444_frame_type type, + const BYTE* const WINPR_RESTRICT pSrc[3], + const UINT32 srcStep[3], UINT32 nWidth, + UINT32 nHeight, BYTE* WINPR_RESTRICT pDst[3], + const UINT32 dstStep[3], + const RECTANGLE_16* WINPR_RESTRICT roi); +typedef pstatus_t (*__YUV444SplitToYUV420_t)( + const BYTE* const WINPR_RESTRICT pSrc[3], const UINT32 srcStep[3], + BYTE* WINPR_RESTRICT pMainDst[3], const UINT32 dstMainStep[3], BYTE* WINPR_RESTRICT pAuxDst[3], + const UINT32 srcAuxStep[3], const prim_size_t* WINPR_RESTRICT roi); +typedef pstatus_t (*__RGBToAVC444YUV_t)(const BYTE* WINPR_RESTRICT pSrc, UINT32 srcFormat, + UINT32 srcStep, BYTE* WINPR_RESTRICT pMainDst[3], + const UINT32 dstMainStep[3], + BYTE* WINPR_RESTRICT pAuxDst[3], const UINT32 dstAuxStep[3], + const prim_size_t* WINPR_RESTRICT roi); +typedef pstatus_t (*__andC_32u_t)(const UINT32* WINPR_RESTRICT pSrc, UINT32 val, + UINT32* WINPR_RESTRICT pDst, INT32 len); +typedef pstatus_t (*__orC_32u_t)(const UINT32* WINPR_RESTRICT pSrc, UINT32 val, + UINT32* WINPR_RESTRICT pDst, INT32 len); +typedef pstatus_t (*primitives_uninit_t)(void); + +typedef struct +{ + /* Memory-to-memory copy routines */ + __copy_t copy; /* memcpy/memmove, basically */ + __copy_8u_t copy_8u; /* more strongly typed */ + __copy_8u_AC4r_t copy_8u_AC4r; /* pixel copy function */ + /* Memory setting routines */ + __set_8u_t set_8u; /* memset, basically */ + __set_32s_t set_32s; + __set_32u_t set_32u; + __zero_t zero; /* bzero or faster */ + /* Arithmetic functions */ + __add_16s_t add_16s; + /* And/or */ + __andC_32u_t andC_32u; + __orC_32u_t orC_32u; + /* Shifts */ + __lShiftC_16s_t lShiftC_16s; + __lShiftC_16u_t lShiftC_16u; + __rShiftC_16s_t rShiftC_16s; + __rShiftC_16u_t rShiftC_16u; + __shiftC_16s_t shiftC_16s; + __shiftC_16u_t shiftC_16u; + /* Alpha Composition */ + __alphaComp_argb_t alphaComp_argb; + /* Sign */ + __sign_16s_t sign_16s; + /* Color conversions */ + __yCbCrToRGB_16s8u_P3AC4R_t yCbCrToRGB_16s8u_P3AC4R; + __yCbCrToRGB_16s16s_P3P3_t yCbCrToRGB_16s16s_P3P3; + __RGBToYCbCr_16s16s_P3P3_t RGBToYCbCr_16s16s_P3P3; + __RGBToRGB_16s8u_P3AC4R_t RGBToRGB_16s8u_P3AC4R; + __YCoCgToRGB_8u_AC4R_t YCoCgToRGB_8u_AC4R; + __YUV420ToRGB_8u_P3AC4R_t YUV420ToRGB_8u_P3AC4R; + __RGBToYUV420_8u_P3AC4R_t RGBToYUV420_8u_P3AC4R; + __RGBToYUV444_8u_P3AC4R_t RGBToYUV444_8u_P3AC4R; + __YUV420CombineToYUV444_t YUV420CombineToYUV444; + __YUV444SplitToYUV420_t YUV444SplitToYUV420; + __YUV444ToRGB_8u_P3AC4R_t YUV444ToRGB_8u_P3AC4R; + __RGBToAVC444YUV_t RGBToAVC444YUV; + __RGBToAVC444YUV_t RGBToAVC444YUVv2; + /* flags */ + DWORD flags; + primitives_uninit_t uninit; +} primitives_t; + +typedef enum +{ + PRIMITIVES_PURE_SOFT, /** use generic software implementation */ + PRIMITIVES_ONLY_CPU, /** use generic software or cpu optimized routines */ + PRIMITIVES_ONLY_GPU, /** use opencl optimized routines */ + PRIMITIVES_AUTODETECT /** detect the best routines */ +} primitive_hints; + + FREERDP_API primitives_t* primitives_get(void); + FREERDP_API void primitives_set_hints(primitive_hints hints); + FREERDP_API primitive_hints primitives_get_hints(void); + FREERDP_API primitives_t* primitives_get_generic(void); + FREERDP_API DWORD primitives_flags(primitives_t* p); + FREERDP_API BOOL primitives_init(primitives_t* p, primitive_hints hints); + FREERDP_API void primitives_uninit(void); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_PRIMITIVES_H */ diff --git a/include/freerdp/rail.h b/include/freerdp/rail.h new file mode 100644 index 0000000..66ad34b --- /dev/null +++ b/include/freerdp/rail.h @@ -0,0 +1,590 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Remote Applications Integrated Locally (RAIL) + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2011 Roman Barabanov <romanbarabanov@gmail.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_RAIL_GLOBAL_H +#define FREERDP_RAIL_GLOBAL_H + +#include <winpr/windows.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define RAIL_SVC_CHANNEL_NAME "rail" + +/* DEPRECATED: RAIL PDU flags use the spec conformant naming with TS_ prefix */ +#if defined(WITH_FREERDP_DEPRECATED) +#define RAIL_EXEC_FLAG_EXPAND_WORKINGDIRECTORY 0x0001 +#define RAIL_EXEC_FLAG_TRANSLATE_FILES 0x0002 +#define RAIL_EXEC_FLAG_FILE 0x0004 +#define RAIL_EXEC_FLAG_EXPAND_ARGUMENTS 0x0008 +#endif + +/* RAIL PDU flags */ +#define TS_RAIL_EXEC_FLAG_EXPAND_WORKINGDIRECTORY 0x0001 +#define TS_RAIL_EXEC_FLAG_TRANSLATE_FILES 0x0002 +#define TS_RAIL_EXEC_FLAG_FILE 0x0004 +#define TS_RAIL_EXEC_FLAG_EXPAND_ARGUMENTS 0x0008 +#define TS_RAIL_EXEC_FLAG_APP_USER_MODEL_ID 0x0010 + +/* Notification Icon Balloon Tooltip */ +#define NIIF_NONE 0x00000000 +#define NIIF_INFO 0x00000001 +#define NIIF_WARNING 0x00000002 +#define NIIF_ERROR 0x00000003 +#define NIIF_NOSOUND 0x00000010 +#define NIIF_LARGE_ICON 0x00000020 + +/* Client Execute PDU Flags */ +#define RAIL_EXEC_FLAG_EXPAND_WORKING_DIRECTORY 0x0001 +#define RAIL_EXEC_FLAG_TRANSLATE_FILES 0x0002 +#define RAIL_EXEC_FLAG_FILE 0x0004 +#define RAIL_EXEC_FLAG_EXPAND_ARGUMENTS 0x0008 +#define RAIL_EXEC_FLAG_APP_USER_MODEL_ID 0x0010 + +/* Server Execute Result PDU */ +#define RAIL_EXEC_S_OK 0x0000 +#define RAIL_EXEC_E_HOOK_NOT_LOADED 0x0001 +#define RAIL_EXEC_E_DECODE_FAILED 0x0002 +#define RAIL_EXEC_E_NOT_IN_ALLOWLIST 0x0003 +#define RAIL_EXEC_E_FILE_NOT_FOUND 0x0005 +#define RAIL_EXEC_E_FAIL 0x0006 +#define RAIL_EXEC_E_SESSION_LOCKED 0x0007 + +/* DEPRECATED: Server System Parameters Update PDU + * use the spec conformant naming scheme from winpr/windows.h + */ +#define SPI_SET_SCREEN_SAVE_ACTIVE 0x00000011 +#define SPI_SET_SCREEN_SAVE_SECURE 0x00000077 + +/*Bit mask values for SPI_ parameters*/ +enum SPI_MASK +{ + SPI_MASK_SET_DRAG_FULL_WINDOWS = 0x00000001, + SPI_MASK_SET_KEYBOARD_CUES = 0x00000002, + SPI_MASK_SET_KEYBOARD_PREF = 0x00000004, + SPI_MASK_SET_MOUSE_BUTTON_SWAP = 0x00000008, + SPI_MASK_SET_WORK_AREA = 0x00000010, + SPI_MASK_DISPLAY_CHANGE = 0x00000020, + SPI_MASK_TASKBAR_POS = 0x00000040, + SPI_MASK_SET_HIGH_CONTRAST = 0x00000080, + SPI_MASK_SET_SCREEN_SAVE_ACTIVE = 0x00000100, + SPI_MASK_SET_SET_SCREEN_SAVE_SECURE = 0x00000200, + SPI_MASK_SET_CARET_WIDTH = 0x00000400, + SPI_MASK_SET_STICKY_KEYS = 0x00000800, + SPI_MASK_SET_TOGGLE_KEYS = 0x00001000, + SPI_MASK_SET_FILTER_KEYS = 0x00002000 +}; + +/* Client System Parameters Update PDU + * some are defined in winuser.h (winpr/windows.h wrapper) + */ +#define SPI_SET_DRAG_FULL_WINDOWS 0x00000025 +#define SPI_SET_KEYBOARD_CUES 0x0000100B +#define SPI_SET_KEYBOARD_PREF 0x00000045 +#define SPI_SET_MOUSE_BUTTON_SWAP 0x00000021 +#define SPI_SET_WORK_AREA 0x0000002F +#define SPI_DISPLAY_CHANGE 0x0000F001 +#define SPI_TASKBAR_POS 0x0000F000 +#define SPI_SET_HIGH_CONTRAST 0x00000043 + +/* Client System Command PDU */ +#define SC_SIZE 0xF000 +#define SC_MOVE 0xF010 +#define SC_MINIMIZE 0xF020 +#define SC_MAXIMIZE 0xF030 +#define SC_CLOSE 0xF060 +#define SC_KEYMENU 0xF100 +#define SC_RESTORE 0xF120 +#define SC_DEFAULT 0xF160 + +/* Client Notify Event PDU */ +#ifndef _WIN32 +#define WM_LBUTTONDOWN 0x00000201 +#define WM_LBUTTONUP 0x00000202 +#define WM_RBUTTONDOWN 0x00000204 +#define WM_RBUTTONUP 0x00000205 +#define WM_CONTEXTMENU 0x0000007b +#define WM_LBUTTONDBLCLK 0x00000203 +#define WM_RBUTTONDBLCLK 0x00000206 + +#define NIN_SELECT 0x00000400 +#define NIN_KEYSELECT 0x00000401 +#define NIN_BALLOONSHOW 0x00000402 +#define NIN_BALLOONHIDE 0x00000403 +#define NIN_BALLOONTIMEOUT 0x00000404 +#define NIN_BALLOONUSERCLICK 0x00000405 +#else +#include <shellapi.h> +#endif + +/* DEPRECATED: Client Information PDU + * use the spec conformant naming scheme TS_ below + */ +#define RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE 0x00000001 +#define RAIL_CLIENTSTATUS_AUTORECONNECT 0x00000002 + +/* Client Information PDU */ +typedef enum +{ + TS_RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE = 0x00000001, + TS_RAIL_CLIENTSTATUS_AUTORECONNECT = 0x00000002, + TS_RAIL_CLIENTSTATUS_ZORDER_SYNC = 0x00000004, + TS_RAIL_CLIENTSTATUS_WINDOW_RESIZE_MARGIN_SUPPORTED = 0x00000010, + TS_RAIL_CLIENTSTATUS_HIGH_DPI_ICONS_SUPPORTED = 0x00000020, + TS_RAIL_CLIENTSTATUS_APPBAR_REMOTING_SUPPORTED = 0x00000040, + TS_RAIL_CLIENTSTATUS_POWER_DISPLAY_REQUEST_SUPPORTED = 0x00000080, + TS_RAIL_CLIENTSTATUS_GET_APPID_RESPONSE_EX_SUPPORTED = 0x00000100, + TS_RAIL_CLIENTSTATUS_BIDIRECTIONAL_CLOAK_SUPPORTED = 0x00000200, + TS_RAIL_CLIENTSTATUS_SUPPRESS_ICON_ORDERS = 0x00000400 +} CLIENT_INFO_PDU; + +/* Server Move/Size Start PDU */ +#define RAIL_WMSZ_LEFT 0x0001 +#define RAIL_WMSZ_RIGHT 0x0002 +#define RAIL_WMSZ_TOP 0x0003 +#define RAIL_WMSZ_TOPLEFT 0x0004 +#define RAIL_WMSZ_TOPRIGHT 0x0005 +#define RAIL_WMSZ_BOTTOM 0x0006 +#define RAIL_WMSZ_BOTTOMLEFT 0x0007 +#define RAIL_WMSZ_BOTTOMRIGHT 0x0008 +#define RAIL_WMSZ_MOVE 0x0009 +#define RAIL_WMSZ_KEYMOVE 0x000A +#define RAIL_WMSZ_KEYSIZE 0x000B + +/* Language Bar Information PDU */ +#define TF_SFT_SHOWNORMAL 0x00000001 +#define TF_SFT_DOCK 0x00000002 +#define TF_SFT_MINIMIZED 0x00000004 +#define TF_SFT_HIDDEN 0x00000008 +#define TF_SFT_NOTRANSPARENCY 0x00000010 +#define TF_SFT_LOWTRANSPARENCY 0x00000020 +#define TF_SFT_HIGHTRANSPARENCY 0x00000040 +#define TF_SFT_LABELS 0x00000080 +#define TF_SFT_NOLABELS 0x00000100 +#define TF_SFT_EXTRAICONSONMINIMIZED 0x00000200 +#define TF_SFT_NOEXTRAICONSONMINIMIZED 0x00000400 +#define TF_SFT_DESKBAND 0x00000800 + +/* DEPRECATED: Extended Handshake Flags + * use the spec conformant naming scheme TS_ below + */ +#define RAIL_ORDER_HANDSHAKEEX_FLAGS_HIDEF 0x00000001 +#define RAIL_ORDER_HANDSHAKE_EX_FLAGS_EXTENDED_SPI_SUPPORTED 0x00000002 +#define RAIL_ORDER_HANDSHAKE_EX_FLAGS_SNAP_ARRANGE_SUPPORTED 0x00000004 + +/* Extended Handshake Flags */ +typedef enum +{ + TS_RAIL_ORDER_HANDSHAKEEX_FLAGS_HIDEF = 0x00000001, + TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_EXTENDED_SPI_SUPPORTED = 0x00000002, + TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_SNAP_ARRANGE_SUPPORTED = 0x00000004, + TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_TEXT_SCALE_SUPPORTED = 0x00000008, + TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_CARET_BLINK_SUPPORTED = 0x00000010, + TS_RAIL_ORDER_HANDSHAKE_EX_FLAGS_EXTENDED_SPI_2_SUPPORTED = 0x00000020 +} EXTENDED_HANDSHAKE_FLAGS; +/* Language Profile Information Flags */ +#define TF_PROFILETYPE_INPUTPROCESSOR 0x00000001 +#define TF_PROFILETYPE_KEYBOARDLAYOUT 0x00000002 + +/* LanguageProfileCLSID and ProfileGUID */ +#ifndef _WIN32 +#define GUID_NULL \ + { \ + 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \ + } +#else +#include <cguid.h> +#endif +#define GUID_MSIME_JPN \ + { \ + 0x03B5835F, 0xF03C, 0x411B, 0x9C, 0xE2, 0xAA, 0x23, 0xE1, 0x17, 0x1E, 0x36 \ + } +#define GUID_MSIME_KOR \ + { \ + 0xA028AE76, 0x01B1, 0x46C2, 0x99, 0xC4, 0xAC, 0xD9, 0x85, 0x8A, 0xE0, 0x02 \ + } +#define GUID_CHSIME \ + { \ + 0x81D4E9C9, 0x1D3B, 0x41BC, 0x9E, 0x6C, 0x4B, 0x40, 0xBF, 0x79, 0xE3, 0x5E \ + } +#define GUID_CHTIME \ + { \ + 0x531FDEBF, 0x9B4C, 0x4A43, 0xA2, 0xAA, 0x96, 0x0E, 0x8F, 0xCD, 0xC7, 0x32 \ + } +#define GUID_PROFILE_NEWPHONETIC \ + { \ + 0xB2F9C502, 0x1742, 0x11D4, 0x97, 0x90, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E \ + } +#define GUID_PROFILE_CHANGJIE \ + { \ + 0x4BDF9F03, 0xC7D3, 0x11D4, 0xB2, 0xAB, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E \ + } +#define GUID_PROFILE_QUICK \ + { \ + 0x6024B45F, 0x5C54, 0x11D4, 0xB9, 0x21, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E \ + } +#define GUID_PROFILE_CANTONESE \ + { \ + 0x0AEC109C, 0x7E96, 0x11D4, 0xB2, 0xEF, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E \ + } +#define GUID_PROFILE_PINYIN \ + { \ + 0xF3BA9077, 0x6C7E, 0x11D4, 0x97, 0xFA, 0x00, 0x80, 0xC8, 0x82, 0x68, 0x7E \ + } +#define GUID_PROFILE_SIMPLEFAST \ + { \ + 0xFA550B04, 0x5AD7, 0x411F, 0xA5, 0xAC, 0xCA, 0x03, 0x8E, 0xC5, 0x15, 0xD7 \ + } +#define GUID_GUID_PROFILE_MSIME_JPN \ + { \ + 0xA76C93D9, 0x5523, 0x4E90, 0xAA, 0xFA, 0x4D, 0xB1, 0x12, 0xF9, 0xAC, 0x76 \ + } +#define GUID_PROFILE_MSIME_KOR \ + { \ + 0xB5FE1F02, 0xD5F2, 0x4445, 0x9C, 0x03, 0xC5, 0x68, 0xF2, 0x3C, 0x99, 0xA1 \ + } + +/* ImeState */ +#define IME_STATE_CLOSED 0x00000000 +#define IME_STATE_OPEN 0x00000001 + +/* ImeConvMode */ +#if !defined(_IME_CMODES_) && !defined(__MINGW32__) +#define IME_CMODE_NATIVE 0x00000001 +#define IME_CMODE_KATAKANA 0x00000002 +#define IME_CMODE_FULLSHAPE 0x00000008 +#define IME_CMODE_ROMAN 0x00000010 +#define IME_CMODE_CHARCODE 0x00000020 +#define IME_CMODE_HANJACONVERT 0x00000040 +#define IME_CMODE_SOFTKBD 0x00000080 +#define IME_CMODE_NOCONVERSION 0x00000100 +#define IME_CMODE_EUDC 0x00000200 +#define IME_CMODE_SYMBOL 0x00000400 +#define IME_CMODE_FIXED 0x00000800 +#endif + +/* ImeSentenceMode */ +#ifndef _IMM_ +#define IME_SMODE_NONE 0x00000000 +#define IME_SMODE_PLURALCASE 0x00000001 +#define IME_SMODE_SINGLECONVERT 0x00000002 +#define IME_SMODE_AUTOMATIC 0x00000004 +#define IME_SMODE_PHRASEPREDICT 0x00000008 +#define IME_SMODE_CONVERSATION 0x00000010 +#endif + +/* KANAMode */ +#define KANA_MODE_OFF 0x00000000 +#define KANA_MODE_ON 0x00000001 + +/* Taskbar */ +#define RAIL_TASKBAR_MSG_TAB_REGISTER 0x00000001 +#define RAIL_TASKBAR_MSG_TAB_UNREGISTER 0x00000002 +#define RAIL_TASKBAR_MSG_TAB_ORDER 0x00000003 +#define RAIL_TASKBAR_MSG_TAB_ACTIVE 0x00000004 +#define RAIL_TASKBAR_MSG_TAB_PROPERTIES 0x00000005 + +/* Taskbar body */ +#define RAIL_TASKBAR_MSG_TAB_REGISTER 0x00000001 +#define RAIL_TASKBAR_MSG_TAB_UNREGISTER 0x00000002 +#define RAIL_TASKBAR_MSG_TAB_ORDER 0x00000003 +#define RAIL_TASKBAR_MSG_TAB_ACTIVE 0x00000004 +#define RAIL_TASKBAR_MSG_TAB_PROPERTIES 0x00000005 + +typedef struct +{ + UINT16 length; + BYTE* string; +} RAIL_UNICODE_STRING; + +typedef struct +{ + UINT32 flags; + UINT32 colorSchemeLength; + RAIL_UNICODE_STRING colorScheme; +} RAIL_HIGH_CONTRAST; + +/* RAIL Orders */ + +typedef struct +{ + UINT32 buildNumber; +} RAIL_HANDSHAKE_ORDER; + +typedef struct +{ + UINT32 buildNumber; + UINT32 railHandshakeFlags; +} RAIL_HANDSHAKE_EX_ORDER; + +typedef struct +{ + UINT32 flags; +} RAIL_CLIENT_STATUS_ORDER; + +typedef struct +{ + UINT16 flags; + char* RemoteApplicationProgram; + char* RemoteApplicationWorkingDir; + char* RemoteApplicationArguments; +} RAIL_EXEC_ORDER; + +typedef struct +{ + UINT16 flags; + UINT16 execResult; + UINT32 rawResult; + RAIL_UNICODE_STRING exeOrFile; +} RAIL_EXEC_RESULT_ORDER; + +typedef struct +{ + UINT32 Flags; + UINT32 WaitTime; + UINT32 DelayTime; + UINT32 RepeatTime; + UINT32 BounceTime; +} TS_FILTERKEYS; + +typedef struct +{ + UINT32 param; + UINT32 params; + BOOL dragFullWindows; + BOOL keyboardCues; + BOOL keyboardPref; + BOOL mouseButtonSwap; + RECTANGLE_16 workArea; + RECTANGLE_16 displayChange; + RECTANGLE_16 taskbarPos; + RAIL_HIGH_CONTRAST highContrast; + UINT32 caretWidth; + UINT32 stickyKeys; + UINT32 toggleKeys; + TS_FILTERKEYS filterKeys; + BOOL setScreenSaveActive; + BOOL setScreenSaveSecure; +} RAIL_SYSPARAM_ORDER; + +typedef struct +{ + UINT32 windowId; + BOOL enabled; +} RAIL_ACTIVATE_ORDER; + +typedef struct +{ + UINT32 windowId; + INT16 left; + INT16 top; +} RAIL_SYSMENU_ORDER; + +typedef struct +{ + UINT32 windowId; + UINT16 command; +} RAIL_SYSCOMMAND_ORDER; + +typedef struct +{ + UINT32 windowId; + UINT32 notifyIconId; + UINT32 message; +} RAIL_NOTIFY_EVENT_ORDER; + +typedef struct +{ + UINT32 windowId; + INT16 maxWidth; + INT16 maxHeight; + INT16 maxPosX; + INT16 maxPosY; + INT16 minTrackWidth; + INT16 minTrackHeight; + INT16 maxTrackWidth; + INT16 maxTrackHeight; +} RAIL_MINMAXINFO_ORDER; + +typedef struct +{ + UINT32 windowId; + BOOL isMoveSizeStart; + UINT16 moveSizeType; + INT16 posX; + INT16 posY; +} RAIL_LOCALMOVESIZE_ORDER; + +typedef struct +{ + UINT32 windowId; + INT16 left; + INT16 top; + INT16 right; + INT16 bottom; +} RAIL_WINDOW_MOVE_ORDER; + +typedef struct +{ + UINT32 windowId; +} RAIL_GET_APPID_REQ_ORDER; + +typedef struct +{ + UINT32 windowId; + WCHAR applicationId[260]; +} RAIL_GET_APPID_RESP_ORDER; + +typedef struct +{ + UINT32 languageBarStatus; +} RAIL_LANGBAR_INFO_ORDER; + +typedef struct +{ + UINT32 ImeState; + UINT32 ImeConvMode; + UINT32 ImeSentenceMode; + UINT32 KanaMode; +} RAIL_COMPARTMENT_INFO_ORDER; + +typedef struct +{ + UINT32 windowIdMarker; +} RAIL_ZORDER_SYNC; + +typedef struct +{ + UINT32 windowId; + BOOL cloak; +} RAIL_CLOAK; + +typedef struct +{ + UINT32 active; +} RAIL_POWER_DISPLAY_REQUEST; + +typedef struct +{ + UINT32 TaskbarMessage; + UINT32 WindowIdTab; + UINT32 Body; +} RAIL_TASKBAR_INFO_ORDER; + +typedef struct +{ + UINT32 ProfileType; + UINT32 LanguageID; + GUID LanguageProfileCLSID; + GUID ProfileGUID; + UINT32 KeyboardLayout; +} RAIL_LANGUAGEIME_INFO_ORDER; + +typedef struct +{ + UINT32 windowId; + INT16 left; + INT16 top; + INT16 right; + INT16 bottom; +} RAIL_SNAP_ARRANGE; + +typedef struct +{ + UINT32 windowID; + WCHAR applicationID[520 / sizeof(WCHAR)]; + UINT32 processId; + WCHAR processImageName[520 / sizeof(WCHAR)]; +} RAIL_GET_APPID_RESP_EX; + +/* DEPRECATED: RAIL Constants + * use the spec conformant naming scheme TS_ below + */ + +#define RDP_RAIL_ORDER_EXEC 0x0001 +#define RDP_RAIL_ORDER_ACTIVATE 0x0002 +#define RDP_RAIL_ORDER_SYSPARAM 0x0003 +#define RDP_RAIL_ORDER_SYSCOMMAND 0x0004 +#define RDP_RAIL_ORDER_HANDSHAKE 0x0005 +#define RDP_RAIL_ORDER_NOTIFY_EVENT 0x0006 +#define RDP_RAIL_ORDER_WINDOWMOVE 0x0008 +#define RDP_RAIL_ORDER_LOCALMOVESIZE 0x0009 +#define RDP_RAIL_ORDER_MINMAXINFO 0x000A +#define RDP_RAIL_ORDER_CLIENTSTATUS 0x000B +#define RDP_RAIL_ORDER_SYSMENU 0x000C +#define RDP_RAIL_ORDER_LANGBARINFO 0x000D +#define RDP_RAIL_ORDER_EXEC_RESULT 0x0080 +#define RDP_RAIL_ORDER_GET_APPID_REQ 0x000E +#define RDP_RAIL_ORDER_GET_APPID_RESP 0x000F +#define RDP_RAIL_ORDER_LANGUAGEIMEINFO 0x0011 +#define RDP_RAIL_ORDER_COMPARTMENTINFO 0x0012 +#define RDP_RAIL_ORDER_HANDSHAKE_EX 0x0013 +#define RDP_RAIL_ORDER_ZORDER_SYNC 0x0014 +#define RDP_RAIL_ORDER_CLOAK 0x0015 +#define RDP_RAIL_ORDER_POWER_DISPLAY_REQUEST 0x0016 +#define RDP_RAIL_ORDER_SNAP_ARRANGE 0x0017 +#define RDP_RAIL_ORDER_GET_APPID_RESP_EX 0x0018 + +/* RAIL Constants */ + +typedef enum +{ + TS_RAIL_ORDER_EXEC = 0x0001, + TS_RAIL_ORDER_ACTIVATE = 0x0002, + TS_RAIL_ORDER_SYSPARAM = 0x0003, + TS_RAIL_ORDER_SYSCOMMAND = 0x0004, + TS_RAIL_ORDER_HANDSHAKE = 0x0005, + TS_RAIL_ORDER_NOTIFY_EVENT = 0x0006, + TS_RAIL_ORDER_WINDOWMOVE = 0x0008, + TS_RAIL_ORDER_LOCALMOVESIZE = 0x0009, + TS_RAIL_ORDER_MINMAXINFO = 0x000A, + TS_RAIL_ORDER_CLIENTSTATUS = 0x000B, + TS_RAIL_ORDER_SYSMENU = 0x000C, + TS_RAIL_ORDER_LANGBARINFO = 0x000D, + TS_RAIL_ORDER_GET_APPID_REQ = 0x000E, + TS_RAIL_ORDER_GET_APPID_RESP = 0x000F, + TS_RAIL_ORDER_TASKBARINFO = 0x0010, + TS_RAIL_ORDER_LANGUAGEIMEINFO = 0x0011, + TS_RAIL_ORDER_COMPARTMENTINFO = 0x0012, + TS_RAIL_ORDER_HANDSHAKE_EX = 0x0013, + TS_RAIL_ORDER_ZORDER_SYNC = 0x0014, + TS_RAIL_ORDER_CLOAK = 0x0015, + TS_RAIL_ORDER_POWER_DISPLAY_REQUEST = 0x0016, + TS_RAIL_ORDER_SNAP_ARRANGE = 0x0017, + TS_RAIL_ORDER_GET_APPID_RESP_EX = 0x0018, + TS_RAIL_ORDER_TEXTSCALEINFO = 0x0019, + TS_RAIL_ORDER_CARETBLINKINFO = 0x001A, + TS_RAIL_ORDER_EXEC_RESULT = 0x0080 +} ORDER_TYPE; + + FREERDP_API BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string); + FREERDP_API BOOL utf8_string_to_rail_string(const char* string, + RAIL_UNICODE_STRING* unicode_string); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_RAIL_GLOBAL_H */ diff --git a/include/freerdp/redirection.h b/include/freerdp/redirection.h new file mode 100644 index 0000000..2f40e10 --- /dev/null +++ b/include/freerdp/redirection.h @@ -0,0 +1,84 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP Server Redirection + * + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_REDIRECTION_H +#define FREERDP_REDIRECTION_H + +#include <freerdp/api.h> + +/* Redirection Flags */ +#define LB_TARGET_NET_ADDRESS 0x00000001 +#define LB_LOAD_BALANCE_INFO 0x00000002 +#define LB_USERNAME 0x00000004 +#define LB_DOMAIN 0x00000008 +#define LB_PASSWORD 0x00000010 +#define LB_DONTSTOREUSERNAME 0x00000020 +#define LB_SMARTCARD_LOGON 0x00000040 +#define LB_NOREDIRECT 0x00000080 +#define LB_TARGET_FQDN 0x00000100 +#define LB_TARGET_NETBIOS_NAME 0x00000200 +#define LB_TARGET_NET_ADDRESSES 0x00000800 +#define LB_CLIENT_TSV_URL 0x00001000 +#define LB_SERVER_TSV_CAPABLE 0x00002000 +#define LB_PASSWORD_IS_PK_ENCRYPTED 0x00004000 +#define LB_REDIRECTION_GUID 0x00008000 +#define LB_TARGET_CERTIFICATE 0x00010000 + +#define LB_PASSWORD_MAX_LENGTH 512 + +#define ENCODING_TYPE_ASN1_DER 1 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_redirection rdpRedirection; + + FREERDP_API void redirection_free(rdpRedirection* redirection); + + WINPR_ATTR_MALLOC(redirection_free, 1) + FREERDP_API rdpRedirection* redirection_new(void); + + /** \brief This function checks if all necessary settings for a given \b rdpRedirection are + * available. + * + * \param redirection The redirection settings to check + * \param pFlags An (optional) pointer to UINT32. Is set to the flags that do not have + * necessary data available. + * + * \return \b TRUE if the redirection settings are ready to use, \b FALSE otherwise. + */ + FREERDP_API BOOL redirection_settings_are_valid(rdpRedirection* redirection, UINT32* pFlags); + + FREERDP_API BOOL redirection_set_flags(rdpRedirection* redirection, UINT32 flags); + FREERDP_API BOOL redirection_set_session_id(rdpRedirection* redirection, UINT32 session_id); + FREERDP_API BOOL redirection_set_byte_option(rdpRedirection* redirection, UINT32 flag, + const BYTE* data, size_t length); + FREERDP_API BOOL redirection_set_string_option(rdpRedirection* redirection, UINT32 flag, + const char* str); + FREERDP_API BOOL redirection_set_array_option(rdpRedirection* redirection, UINT32 flag, + const char** str, size_t count); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_REDIRECTION_H */ diff --git a/include/freerdp/scancode.h b/include/freerdp/scancode.h new file mode 100644 index 0000000..0ee3635 --- /dev/null +++ b/include/freerdp/scancode.h @@ -0,0 +1,237 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP protocol "scancodes" + * + * Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_LOCALE_KEYBOARD_RDP_SCANCODE_H +#define FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H + +#include <winpr/input.h> + +/* msdn{cc240584} says: + * "... (a scancode is an 8-bit value specifying a key location on the keyboard). + * The server accepts a scancode value and translates it into the correct character depending on the + * language locale and keyboard layout used in the session." The 8-bit value is later called + * "keyCode" The extended flag is for all practical an important 9th bit with a strange encoding - + * not just a modifier. + */ + +#define RDP_SCANCODE_CODE(_rdp_scancode) ((BYTE)(_rdp_scancode & 0xFF)) +#define RDP_SCANCODE_EXTENDED(_rdp_scancode) (((_rdp_scancode)&KBDEXT) ? TRUE : FALSE) +#define MAKE_RDP_SCANCODE(_code, _extended) (((_code)&0xFF) | ((_extended) ? KBDEXT : 0)) + +/* Defines for known RDP_SCANCODE protocol values. + * Mostly the same as the PKBDLLHOOKSTRUCT scanCode, "A hardware scan code for the key", + * msdn{ms644967}. Based msdn{ms894073} US, msdn{ms894072} UK, msdn{ms892472} */ + +#define RDP_SCANCODE_UNKNOWN MAKE_RDP_SCANCODE(0x00, FALSE) + +#define RDP_SCANCODE_ESCAPE MAKE_RDP_SCANCODE(0x01, FALSE) /* VK_ESCAPE */ +#define RDP_SCANCODE_KEY_1 MAKE_RDP_SCANCODE(0x02, FALSE) /* VK_KEY_1 */ +#define RDP_SCANCODE_KEY_2 MAKE_RDP_SCANCODE(0x03, FALSE) /* VK_KEY_2 */ +#define RDP_SCANCODE_KEY_3 MAKE_RDP_SCANCODE(0x04, FALSE) /* VK_KEY_3 */ +#define RDP_SCANCODE_KEY_4 MAKE_RDP_SCANCODE(0x05, FALSE) /* VK_KEY_4 */ +#define RDP_SCANCODE_KEY_5 MAKE_RDP_SCANCODE(0x06, FALSE) /* VK_KEY_5 */ +#define RDP_SCANCODE_KEY_6 MAKE_RDP_SCANCODE(0x07, FALSE) /* VK_KEY_6 */ +#define RDP_SCANCODE_KEY_7 MAKE_RDP_SCANCODE(0x08, FALSE) /* VK_KEY_7 */ +#define RDP_SCANCODE_KEY_8 MAKE_RDP_SCANCODE(0x09, FALSE) /* VK_KEY_8 */ +#define RDP_SCANCODE_KEY_9 MAKE_RDP_SCANCODE(0x0A, FALSE) /* VK_KEY_9 */ +#define RDP_SCANCODE_KEY_0 MAKE_RDP_SCANCODE(0x0B, FALSE) /* VK_KEY_0 */ +#define RDP_SCANCODE_OEM_MINUS MAKE_RDP_SCANCODE(0x0C, FALSE) /* VK_OEM_MINUS */ +#define RDP_SCANCODE_OEM_PLUS MAKE_RDP_SCANCODE(0x0D, FALSE) /* VK_OEM_PLUS */ +#define RDP_SCANCODE_BACKSPACE MAKE_RDP_SCANCODE(0x0E, FALSE) /* VK_BACK Backspace */ +#define RDP_SCANCODE_TAB MAKE_RDP_SCANCODE(0x0F, FALSE) /* VK_TAB */ +#define RDP_SCANCODE_KEY_Q MAKE_RDP_SCANCODE(0x10, FALSE) /* VK_KEY_Q */ +#define RDP_SCANCODE_KEY_W MAKE_RDP_SCANCODE(0x11, FALSE) /* VK_KEY_W */ +#define RDP_SCANCODE_KEY_E MAKE_RDP_SCANCODE(0x12, FALSE) /* VK_KEY_E */ +#define RDP_SCANCODE_KEY_R MAKE_RDP_SCANCODE(0x13, FALSE) /* VK_KEY_R */ +#define RDP_SCANCODE_KEY_T MAKE_RDP_SCANCODE(0x14, FALSE) /* VK_KEY_T */ +#define RDP_SCANCODE_KEY_Y MAKE_RDP_SCANCODE(0x15, FALSE) /* VK_KEY_Y */ +#define RDP_SCANCODE_KEY_U MAKE_RDP_SCANCODE(0x16, FALSE) /* VK_KEY_U */ +#define RDP_SCANCODE_KEY_I MAKE_RDP_SCANCODE(0x17, FALSE) /* VK_KEY_I */ +#define RDP_SCANCODE_KEY_O MAKE_RDP_SCANCODE(0x18, FALSE) /* VK_KEY_O */ +#define RDP_SCANCODE_KEY_P MAKE_RDP_SCANCODE(0x19, FALSE) /* VK_KEY_P */ +#define RDP_SCANCODE_OEM_4 MAKE_RDP_SCANCODE(0x1A, FALSE) /* VK_OEM_4 '[' on US */ +#define RDP_SCANCODE_OEM_6 MAKE_RDP_SCANCODE(0x1B, FALSE) /* VK_OEM_6 ']' on US */ +#define RDP_SCANCODE_RETURN MAKE_RDP_SCANCODE(0x1C, FALSE) /* VK_RETURN Normal Enter */ +#define RDP_SCANCODE_LCONTROL MAKE_RDP_SCANCODE(0x1D, FALSE) /* VK_LCONTROL */ +#define RDP_SCANCODE_KEY_A MAKE_RDP_SCANCODE(0x1E, FALSE) /* VK_KEY_A */ +#define RDP_SCANCODE_KEY_S MAKE_RDP_SCANCODE(0x1F, FALSE) /* VK_KEY_S */ +#define RDP_SCANCODE_KEY_D MAKE_RDP_SCANCODE(0x20, FALSE) /* VK_KEY_D */ +#define RDP_SCANCODE_KEY_F MAKE_RDP_SCANCODE(0x21, FALSE) /* VK_KEY_F */ +#define RDP_SCANCODE_KEY_G MAKE_RDP_SCANCODE(0x22, FALSE) /* VK_KEY_G */ +#define RDP_SCANCODE_KEY_H MAKE_RDP_SCANCODE(0x23, FALSE) /* VK_KEY_H */ +#define RDP_SCANCODE_KEY_J MAKE_RDP_SCANCODE(0x24, FALSE) /* VK_KEY_J */ +#define RDP_SCANCODE_KEY_K MAKE_RDP_SCANCODE(0x25, FALSE) /* VK_KEY_K */ +#define RDP_SCANCODE_KEY_L MAKE_RDP_SCANCODE(0x26, FALSE) /* VK_KEY_L */ +#define RDP_SCANCODE_OEM_1 MAKE_RDP_SCANCODE(0x27, FALSE) /* VK_OEM_1 ';' on US */ +#define RDP_SCANCODE_OEM_7 MAKE_RDP_SCANCODE(0x28, FALSE) /* VK_OEM_7 "'" on US */ +#define RDP_SCANCODE_OEM_3 \ + MAKE_RDP_SCANCODE(0x29, FALSE) /* VK_OEM_3 Top left, '`' on US, JP DBE_SBCSCHAR */ +#define RDP_SCANCODE_LSHIFT MAKE_RDP_SCANCODE(0x2A, FALSE) /* VK_LSHIFT */ +#define RDP_SCANCODE_OEM_5 MAKE_RDP_SCANCODE(0x2B, FALSE) /* VK_OEM_5 Next to Enter, '\' on US */ +#define RDP_SCANCODE_KEY_Z MAKE_RDP_SCANCODE(0x2C, FALSE) /* VK_KEY_Z */ +#define RDP_SCANCODE_KEY_X MAKE_RDP_SCANCODE(0x2D, FALSE) /* VK_KEY_X */ +#define RDP_SCANCODE_KEY_C MAKE_RDP_SCANCODE(0x2E, FALSE) /* VK_KEY_C */ +#define RDP_SCANCODE_KEY_V MAKE_RDP_SCANCODE(0x2F, FALSE) /* VK_KEY_V */ +#define RDP_SCANCODE_KEY_B MAKE_RDP_SCANCODE(0x30, FALSE) /* VK_KEY_B */ +#define RDP_SCANCODE_KEY_N MAKE_RDP_SCANCODE(0x31, FALSE) /* VK_KEY_N */ +#define RDP_SCANCODE_KEY_M MAKE_RDP_SCANCODE(0x32, FALSE) /* VK_KEY_M */ +#define RDP_SCANCODE_OEM_COMMA MAKE_RDP_SCANCODE(0x33, FALSE) /* VK_OEM_COMMA */ +#define RDP_SCANCODE_OEM_PERIOD MAKE_RDP_SCANCODE(0x34, FALSE) /* VK_OEM_PERIOD */ +#define RDP_SCANCODE_OEM_2 MAKE_RDP_SCANCODE(0x35, FALSE) /* VK_OEM_2 '/' on US */ +#define RDP_SCANCODE_RSHIFT MAKE_RDP_SCANCODE(0x36, FALSE) /* VK_RSHIFT */ +#define RDP_SCANCODE_MULTIPLY MAKE_RDP_SCANCODE(0x37, FALSE) /* VK_MULTIPLY Numerical */ +#define RDP_SCANCODE_LMENU MAKE_RDP_SCANCODE(0x38, FALSE) /* VK_LMENU Left 'Alt' key */ +#define RDP_SCANCODE_SPACE MAKE_RDP_SCANCODE(0x39, FALSE) /* VK_SPACE */ +#define RDP_SCANCODE_CAPSLOCK \ + MAKE_RDP_SCANCODE(0x3A, FALSE) /* VK_CAPITAL 'Caps Lock', JP DBE_ALPHANUMERIC */ +#define RDP_SCANCODE_F1 MAKE_RDP_SCANCODE(0x3B, FALSE) /* VK_F1 */ +#define RDP_SCANCODE_F2 MAKE_RDP_SCANCODE(0x3C, FALSE) /* VK_F2 */ +#define RDP_SCANCODE_F3 MAKE_RDP_SCANCODE(0x3D, FALSE) /* VK_F3 */ +#define RDP_SCANCODE_F4 MAKE_RDP_SCANCODE(0x3E, FALSE) /* VK_F4 */ +#define RDP_SCANCODE_F5 MAKE_RDP_SCANCODE(0x3F, FALSE) /* VK_F5 */ +#define RDP_SCANCODE_F6 MAKE_RDP_SCANCODE(0x40, FALSE) /* VK_F6 */ +#define RDP_SCANCODE_F7 MAKE_RDP_SCANCODE(0x41, FALSE) /* VK_F7 */ +#define RDP_SCANCODE_F8 MAKE_RDP_SCANCODE(0x42, FALSE) /* VK_F8 */ +#define RDP_SCANCODE_F9 MAKE_RDP_SCANCODE(0x43, FALSE) /* VK_F9 */ +#define RDP_SCANCODE_F10 MAKE_RDP_SCANCODE(0x44, FALSE) /* VK_F10 */ +#define RDP_SCANCODE_NUMLOCK \ + MAKE_RDP_SCANCODE(0x45, FALSE) \ + /* VK_NUMLOCK */ /* Note: when this seems to appear in PKBDLLHOOKSTRUCT it means Pause which \ + must be sent as Ctrl + NumLock */ +#define RDP_SCANCODE_SCROLLLOCK \ + MAKE_RDP_SCANCODE(0x46, FALSE) /* VK_SCROLL 'Scroll Lock', JP OEM_SCROLL */ +#define RDP_SCANCODE_NUMPAD7 MAKE_RDP_SCANCODE(0x47, FALSE) /* VK_NUMPAD7 */ +#define RDP_SCANCODE_NUMPAD8 MAKE_RDP_SCANCODE(0x48, FALSE) /* VK_NUMPAD8 */ +#define RDP_SCANCODE_NUMPAD9 MAKE_RDP_SCANCODE(0x49, FALSE) /* VK_NUMPAD9 */ +#define RDP_SCANCODE_SUBTRACT MAKE_RDP_SCANCODE(0x4A, FALSE) /* VK_SUBTRACT */ +#define RDP_SCANCODE_NUMPAD4 MAKE_RDP_SCANCODE(0x4B, FALSE) /* VK_NUMPAD4 */ +#define RDP_SCANCODE_NUMPAD5 MAKE_RDP_SCANCODE(0x4C, FALSE) /* VK_NUMPAD5 */ +#define RDP_SCANCODE_NUMPAD6 MAKE_RDP_SCANCODE(0x4D, FALSE) /* VK_NUMPAD6 */ +#define RDP_SCANCODE_ADD MAKE_RDP_SCANCODE(0x4E, FALSE) /* VK_ADD */ +#define RDP_SCANCODE_NUMPAD1 MAKE_RDP_SCANCODE(0x4F, FALSE) /* VK_NUMPAD1 */ +#define RDP_SCANCODE_NUMPAD2 MAKE_RDP_SCANCODE(0x50, FALSE) /* VK_NUMPAD2 */ +#define RDP_SCANCODE_NUMPAD3 MAKE_RDP_SCANCODE(0x51, FALSE) /* VK_NUMPAD3 */ +#define RDP_SCANCODE_NUMPAD0 MAKE_RDP_SCANCODE(0x52, FALSE) /* VK_NUMPAD0 */ +#define RDP_SCANCODE_DECIMAL MAKE_RDP_SCANCODE(0x53, FALSE) /* VK_DECIMAL Numerical, '.' on US */ +#define RDP_SCANCODE_SYSREQ MAKE_RDP_SCANCODE(0x54, FALSE) /* Sys Req */ +#define RDP_SCANCODE_OEM_102 MAKE_RDP_SCANCODE(0x56, FALSE) /* VK_OEM_102 Lower left '\' on US */ +#define RDP_SCANCODE_F11 MAKE_RDP_SCANCODE(0x57, FALSE) /* VK_F11 */ +#define RDP_SCANCODE_F12 MAKE_RDP_SCANCODE(0x58, FALSE) /* VK_F12 */ +#define RDP_SCANCODE_SLEEP \ + MAKE_RDP_SCANCODE(0x5F, FALSE) /* VK_SLEEP OEM_8 on FR (undocumented?) \ + */ +#define RDP_SCANCODE_ZOOM MAKE_RDP_SCANCODE(0x62, FALSE) /* VK_ZOOM (undocumented?) */ +#define RDP_SCANCODE_HELP MAKE_RDP_SCANCODE(0x63, FALSE) /* VK_HELP (undocumented?) */ + +#define RDP_SCANCODE_F13 \ + MAKE_RDP_SCANCODE(0x64, FALSE) /* VK_F13 */ /* JP agree, should 0x7d according to ms894073 */ +#define RDP_SCANCODE_F14 MAKE_RDP_SCANCODE(0x65, FALSE) /* VK_F14 */ +#define RDP_SCANCODE_F15 MAKE_RDP_SCANCODE(0x66, FALSE) /* VK_F15 */ +#define RDP_SCANCODE_F16 MAKE_RDP_SCANCODE(0x67, FALSE) /* VK_F16 */ +#define RDP_SCANCODE_F17 MAKE_RDP_SCANCODE(0x68, FALSE) /* VK_F17 */ +#define RDP_SCANCODE_F18 MAKE_RDP_SCANCODE(0x69, FALSE) /* VK_F18 */ +#define RDP_SCANCODE_F19 MAKE_RDP_SCANCODE(0x6A, FALSE) /* VK_F19 */ +#define RDP_SCANCODE_F20 MAKE_RDP_SCANCODE(0x6B, FALSE) /* VK_F20 */ +#define RDP_SCANCODE_F21 MAKE_RDP_SCANCODE(0x6C, FALSE) /* VK_F21 */ +#define RDP_SCANCODE_F22 MAKE_RDP_SCANCODE(0x6D, FALSE) /* VK_F22 */ +#define RDP_SCANCODE_F23 MAKE_RDP_SCANCODE(0x6E, FALSE) /* VK_F23 */ /* JP agree */ +#define RDP_SCANCODE_F24 \ + MAKE_RDP_SCANCODE(0x6F, FALSE) /* VK_F24 */ /* 0x87 according to ms894073 */ + +#define RDP_SCANCODE_HIRAGANA MAKE_RDP_SCANCODE(0x70, FALSE) /* JP DBE_HIRAGANA */ +#define RDP_SCANCODE_HANJA_KANJI \ + MAKE_RDP_SCANCODE(0x71, FALSE) /* VK_HANJA / VK_KANJI (undocumented?) */ +#define RDP_SCANCODE_KANA_HANGUL \ + MAKE_RDP_SCANCODE(0x72, FALSE) /* VK_KANA / VK_HANGUL (undocumented?) */ +#define RDP_SCANCODE_ABNT_C1 MAKE_RDP_SCANCODE(0x73, FALSE) /* VK_ABNT_C1 JP OEM_102 */ +#define RDP_SCANCODE_F24_JP MAKE_RDP_SCANCODE(0x76, FALSE) /* JP F24 */ +#define RDP_SCANCODE_CONVERT_JP MAKE_RDP_SCANCODE(0x79, FALSE) /* JP VK_CONVERT */ +#define RDP_SCANCODE_NONCONVERT_JP MAKE_RDP_SCANCODE(0x7B, FALSE) /* JP VK_NONCONVERT */ +#define RDP_SCANCODE_TAB_JP MAKE_RDP_SCANCODE(0x7C, FALSE) /* JP TAB */ +#define RDP_SCANCODE_BACKSLASH_JP MAKE_RDP_SCANCODE(0x7D, FALSE) /* JP OEM_5 ('\') */ +#define RDP_SCANCODE_ABNT_C2 MAKE_RDP_SCANCODE(0x7E, FALSE) /* VK_ABNT_C2, JP */ +#define RDP_SCANCODE_HANJA MAKE_RDP_SCANCODE(0x71, FALSE) /* KR VK_HANJA */ +#define RDP_SCANCODE_HANGUL MAKE_RDP_SCANCODE(0x72, FALSE) /* KR VK_HANGUL */ + +#define RDP_SCANCODE_RETURN_KP \ + MAKE_RDP_SCANCODE(0x1C, TRUE) /* not RDP_SCANCODE_RETURN Numerical Enter */ +#define RDP_SCANCODE_RCONTROL MAKE_RDP_SCANCODE(0x1D, TRUE) /* VK_RCONTROL */ +#define RDP_SCANCODE_DIVIDE MAKE_RDP_SCANCODE(0x35, TRUE) /* VK_DIVIDE Numerical */ +#define RDP_SCANCODE_PRINTSCREEN \ + MAKE_RDP_SCANCODE(0x37, TRUE) /* VK_EXECUTE/VK_PRINT/VK_SNAPSHOT Print Screen */ +#define RDP_SCANCODE_RMENU MAKE_RDP_SCANCODE(0x38, TRUE) /* VK_RMENU Right 'Alt' / 'Alt Gr' */ +#define RDP_SCANCODE_PAUSE \ + MAKE_RDP_SCANCODE(0x46, TRUE) /* VK_PAUSE Pause / Break (Slightly special handling) */ +#define RDP_SCANCODE_HOME MAKE_RDP_SCANCODE(0x47, TRUE) /* VK_HOME */ +#define RDP_SCANCODE_UP MAKE_RDP_SCANCODE(0x48, TRUE) /* VK_UP */ +#define RDP_SCANCODE_PRIOR MAKE_RDP_SCANCODE(0x49, TRUE) /* VK_PRIOR 'Page Up' */ +#define RDP_SCANCODE_LEFT MAKE_RDP_SCANCODE(0x4B, TRUE) /* VK_LEFT */ +#define RDP_SCANCODE_RIGHT MAKE_RDP_SCANCODE(0x4D, TRUE) /* VK_RIGHT */ +#define RDP_SCANCODE_END MAKE_RDP_SCANCODE(0x4F, TRUE) /* VK_END */ +#define RDP_SCANCODE_DOWN MAKE_RDP_SCANCODE(0x50, TRUE) /* VK_DOWN */ +#define RDP_SCANCODE_NEXT MAKE_RDP_SCANCODE(0x51, TRUE) /* VK_NEXT 'Page Down' */ +#define RDP_SCANCODE_INSERT MAKE_RDP_SCANCODE(0x52, TRUE) /* VK_INSERT */ +#define RDP_SCANCODE_DELETE MAKE_RDP_SCANCODE(0x53, TRUE) /* VK_DELETE */ +#define RDP_SCANCODE_NULL MAKE_RDP_SCANCODE(0x54, TRUE) /* <00> */ +#define RDP_SCANCODE_HELP2 \ + MAKE_RDP_SCANCODE(0x56, TRUE) /* Help - documented, different from VK_HELP */ +#define RDP_SCANCODE_LWIN MAKE_RDP_SCANCODE(0x5B, TRUE) /* VK_LWIN */ +#define RDP_SCANCODE_RWIN MAKE_RDP_SCANCODE(0x5C, TRUE) /* VK_RWIN */ +#define RDP_SCANCODE_APPS MAKE_RDP_SCANCODE(0x5D, TRUE) /* VK_APPS Application */ +#define RDP_SCANCODE_POWER_JP MAKE_RDP_SCANCODE(0x5E, TRUE) /* JP POWER */ +#define RDP_SCANCODE_SLEEP_JP MAKE_RDP_SCANCODE(0x5F, TRUE) /* JP SLEEP */ + +/* _not_ valid scancode, but this is what a windows PKBDLLHOOKSTRUCT for NumLock contains */ +#define RDP_SCANCODE_NUMLOCK_EXTENDED \ + MAKE_RDP_SCANCODE(0x45, TRUE) /* should be RDP_SCANCODE_NUMLOCK */ +#define RDP_SCANCODE_RSHIFT_EXTENDED \ + MAKE_RDP_SCANCODE(0x36, TRUE) /* should be RDP_SCANCODE_RSHIFT */ + +/* Audio */ +#define RDP_SCANCODE_VOLUME_MUTE MAKE_RDP_SCANCODE(0x20, TRUE) /* VK_VOLUME_MUTE */ +#define RDP_SCANCODE_VOLUME_DOWN MAKE_RDP_SCANCODE(0x2E, TRUE) /* VK_VOLUME_DOWN */ +#define RDP_SCANCODE_VOLUME_UP MAKE_RDP_SCANCODE(0x30, TRUE) /* VK_VOLUME_UP */ + +/* Media */ +#define RDP_SCANCODE_MEDIA_NEXT_TRACK MAKE_RDP_SCANCODE(0x19, TRUE) /* VK_MEDIA_NEXT_TRACK */ +#define RDP_SCANCODE_MEDIA_PREV_TRACK MAKE_RDP_SCANCODE(0x10, TRUE) /* VK_MEDIA_PREV_TRACK */ +#define RDP_SCANCODE_MEDIA_STOP MAKE_RDP_SCANCODE(0x24, TRUE) /* VK_MEDIA_MEDIA_STOP */ +#define RDP_SCANCODE_MEDIA_PLAY_PAUSE \ + MAKE_RDP_SCANCODE(0x22, TRUE) /* VK_MEDIA_MEDIA_PLAY_PAUSE \ + */ + +/* Browser functions */ +#define RDP_SCANCODE_BROWSER_BACK MAKE_RDP_SCANCODE(0x6A, TRUE) /* VK_BROWSER_BACK */ +#define RDP_SCANCODE_BROWSER_FORWARD MAKE_RDP_SCANCODE(0x69, TRUE) /* VK_BROWSER_FORWARD */ +#define RDP_SCANCODE_BROWSER_REFRESH MAKE_RDP_SCANCODE(0x67, TRUE) /* VK_BROWSER_REFRESH */ +#define RDP_SCANCODE_BROWSER_STOP MAKE_RDP_SCANCODE(0x68, TRUE) /* VK_BROWSER_STOP */ +#define RDP_SCANCODE_BROWSER_SEARCH MAKE_RDP_SCANCODE(0x65, TRUE) /* VK_BROWSER_SEARCH */ +#define RDP_SCANCODE_BROWSER_FAVORITES MAKE_RDP_SCANCODE(0x66, TRUE) /* VK_BROWSER_FAVORITES */ +#define RDP_SCANCODE_BROWSER_HOME MAKE_RDP_SCANCODE(0x32, TRUE) /* VK_BROWSER_HOME */ + +/* Misc. */ +#define RDP_SCANCODE_LAUNCH_MAIL MAKE_RDP_SCANCODE(0x6C, TRUE) /* VK_LAUNCH_MAIL */ + +#define RDP_SCANCODE_LAUNCH_MEDIA_SELECT \ + MAKE_RDP_SCANCODE(0x6D, TRUE) /* VK_LAUNCH_MEDIA_SELECT \ + */ +#define RDP_SCANCODE_LAUNCH_APP1 MAKE_RDP_SCANCODE(0x6E, TRUE) /* VK_LAUNCH_APP1 */ +#define RDP_SCANCODE_LAUNCH_APP2 MAKE_RDP_SCANCODE(0x6F, TRUE) /* VK_LAUNCH_APP2 */ + +#endif /* FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H */ diff --git a/include/freerdp/secondary.h b/include/freerdp/secondary.h new file mode 100644 index 0000000..76ff13d --- /dev/null +++ b/include/freerdp/secondary.h @@ -0,0 +1,197 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Secondary Drawing Orders Interface API + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_UPDATE_SECONDARY_H +#define FREERDP_UPDATE_SECONDARY_H + +#include <freerdp/types.h> +#include <freerdp/primary.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define GLYPH_FRAGMENT_NOP 0x00 +#define GLYPH_FRAGMENT_USE 0xFE +#define GLYPH_FRAGMENT_ADD 0xFF + +#define CBR2_HEIGHT_SAME_AS_WIDTH 0x01 +#define CBR2_PERSISTENT_KEY_PRESENT 0x02 +#define CBR2_NO_BITMAP_COMPRESSION_HDR 0x08 +#define CBR2_DO_NOT_CACHE 0x10 + +#define SCREEN_BITMAP_SURFACE 0xFFFF +#define BITMAP_CACHE_WAITING_LIST_INDEX 0x7FFF + +#define CACHED_BRUSH 0x80 + +#define BMF_1BPP 0x1 +#define BMF_8BPP 0x3 +#define BMF_16BPP 0x4 +#define BMF_24BPP 0x5 +#define BMF_32BPP 0x6 + +#ifndef _WIN32 +#define BS_SOLID 0x00 +#define BS_NULL 0x01 +#define BS_HATCHED 0x02 +#define BS_PATTERN 0x03 +#endif + +#ifndef _WIN32 +#define HS_HORIZONTAL 0x00 +#define HS_VERTICAL 0x01 +#define HS_FDIAGONAL 0x02 +#define HS_BDIAGONAL 0x03 +#define HS_CROSS 0x04 +#define HS_DIAGCROSS 0x05 +#endif + +#define SO_FLAG_DEFAULT_PLACEMENT 0x01 +#define SO_HORIZONTAL 0x02 +#define SO_VERTICAL 0x04 +#define SO_REVERSED 0x08 +#define SO_ZERO_BEARINGS 0x10 +#define SO_CHAR_INC_EQUAL_BM_BASE 0x20 +#define SO_MAXEXT_EQUAL_BM_SIDE 0x40 + +typedef struct +{ + UINT32 cacheId; + UINT32 bitmapBpp; + UINT32 bitmapWidth; + UINT32 bitmapHeight; + UINT32 bitmapLength; + UINT32 cacheIndex; + BOOL compressed; + BYTE bitmapComprHdr[8]; + BYTE* bitmapDataStream; +} CACHE_BITMAP_ORDER; + +typedef struct +{ + UINT32 cacheId; + UINT32 flags; + UINT32 key1; + UINT32 key2; + UINT32 bitmapBpp; + UINT32 bitmapWidth; + UINT32 bitmapHeight; + UINT32 bitmapLength; + UINT32 cacheIndex; + BOOL compressed; + UINT32 cbCompFirstRowSize; + UINT32 cbCompMainBodySize; + UINT32 cbScanWidth; + UINT32 cbUncompressedSize; + BYTE* bitmapDataStream; +} CACHE_BITMAP_V2_ORDER; + +typedef struct +{ + UINT32 bpp; + UINT32 codecID; + UINT32 width; + UINT32 height; + UINT32 length; + BYTE* data; +} BITMAP_DATA_EX; + +typedef struct +{ + UINT32 cacheId; + UINT32 bpp; + UINT32 flags; + UINT32 cacheIndex; + UINT32 key1; + UINT32 key2; + BITMAP_DATA_EX bitmapData; +} CACHE_BITMAP_V3_ORDER; + +typedef struct +{ + UINT32 cacheIndex; + UINT32 numberColors; + UINT32 colorTable[256]; +} CACHE_COLOR_TABLE_ORDER; + +typedef struct +{ + UINT32 cacheId; + UINT32 cGlyphs; + GLYPH_DATA glyphData[256]; + WCHAR* unicodeCharacters; +} CACHE_GLYPH_ORDER; + +typedef struct +{ + UINT32 cacheId; + UINT32 flags; + UINT32 cGlyphs; + GLYPH_DATA_V2 glyphData[256]; + WCHAR* unicodeCharacters; +} CACHE_GLYPH_V2_ORDER; + +typedef struct +{ + UINT32 index; + UINT32 bpp; + UINT32 cx; + UINT32 cy; + UINT32 style; + UINT32 length; + BYTE data[256]; +} CACHE_BRUSH_ORDER; + +typedef BOOL (*pCacheBitmap)(rdpContext* context, const CACHE_BITMAP_ORDER* cache_bitmap_order); +typedef BOOL (*pCacheBitmapV2)(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order); +typedef BOOL (*pCacheBitmapV3)(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order); +typedef BOOL (*pCacheColorTable)(rdpContext* context, + const CACHE_COLOR_TABLE_ORDER* cache_color_table_order); +typedef BOOL (*pCacheGlyph)(rdpContext* context, const CACHE_GLYPH_ORDER* cache_glyph_order); +typedef BOOL (*pCacheGlyphV2)(rdpContext* context, + const CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order); +typedef BOOL (*pCacheBrush)(rdpContext* context, const CACHE_BRUSH_ORDER* cache_brush_order); +typedef BOOL (*pCacheOrderInfo)(rdpContext* context, INT16 orderLength, UINT16 extraFlags, + UINT8 orderType, const char* orderName); + +struct rdp_secondary_update +{ + rdpContext* context; /* 0 */ + UINT32 paddingA[16 - 1]; /* 1 */ + + pCacheBitmap CacheBitmap; /* 16 */ + pCacheBitmapV2 CacheBitmapV2; /* 17 */ + pCacheBitmapV3 CacheBitmapV3; /* 18 */ + pCacheColorTable CacheColorTable; /* 19 */ + pCacheGlyph CacheGlyph; /* 20 */ + pCacheGlyphV2 CacheGlyphV2; /* 21 */ + pCacheBrush CacheBrush; /* 22 */ + /* Statistics callback */ + pCacheOrderInfo CacheOrderInfo; /* 23 */ + UINT32 paddingE[32 - 24]; /* 24 */ +}; +typedef struct rdp_secondary_update rdpSecondaryUpdate; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UPDATE_SECONDARY_H */ diff --git a/include/freerdp/server/ainput.h b/include/freerdp/server/ainput.h new file mode 100644 index 0000000..21c47d6 --- /dev/null +++ b/include/freerdp/server/ainput.h @@ -0,0 +1,124 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * AInput Virtual Channel Extension + * + * Copyright 2022 Armin Novak <anovak@thincast.com> + * Copyright 2022 Thincast Technologies GmbH + * + * 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_CHANNEL_AINPUT_SERVER_H +#define FREERDP_CHANNEL_AINPUT_SERVER_H + +#include <freerdp/channels/wtsvc.h> +#include <freerdp/channels/ainput.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum AINPUT_SERVER_OPEN_RESULT + { + AINPUT_SERVER_OPEN_RESULT_OK = 0, + AINPUT_SERVER_OPEN_RESULT_CLOSED = 1, + AINPUT_SERVER_OPEN_RESULT_NOTSUPPORTED = 2, + AINPUT_SERVER_OPEN_RESULT_ERROR = 3 + } AINPUT_SERVER_OPEN_RESULT; + + typedef struct s_ainput_server_context ainput_server_context; + + typedef BOOL (*psAInputChannelIdAssigned)(ainput_server_context* context, UINT32 channelId); + + typedef UINT (*psAInputServerInitialize)(ainput_server_context* context, BOOL externalThread); + typedef UINT (*psAInputServerPoll)(ainput_server_context* context); + typedef BOOL (*psAInputServerChannelHandle)(ainput_server_context* context, HANDLE* handle); + + typedef UINT (*psAInputServerOpen)(ainput_server_context* context); + typedef UINT (*psAInputServerClose)(ainput_server_context* context); + typedef BOOL (*psAInputServerIsOpen)(ainput_server_context* context); + + typedef UINT (*psAInputServerOpenResult)(ainput_server_context* context, + AINPUT_SERVER_OPEN_RESULT result); + typedef UINT (*psAInputServerMouseEvent)(ainput_server_context* context, UINT64 timestamp, + UINT64 flags, INT32 x, INT32 y); + + struct s_ainput_server_context + { + HANDLE vcm; + + /* Server self-defined pointer. */ + void* data; + + /*** APIs called by the server. ***/ + /** + * Open the ainput channel. + */ + psAInputServerOpen Open; + + /** + * Optional: Set thread handling. + * When externalThread=TRUE the application is responsible to call + * ainput_server_context_poll periodically to process input events. + * + * Defaults to externalThread=FALSE + */ + psAInputServerInitialize Initialize; + + /** + * @brief Poll When externalThread=TRUE call periodically from your main loop. + * if externalThread=FALSE do not call. + */ + psAInputServerPoll Poll; + + /** + * @brief Poll When externalThread=TRUE call to get a handle to wait for events. + * Will return FALSE until the handle is available. + */ + psAInputServerChannelHandle ChannelHandle; + + /** + * Close the ainput channel. + */ + psAInputServerClose Close; + /** + * Status of the ainput channel. + */ + psAInputServerIsOpen IsOpen; + + /*** Callbacks registered by the server. ***/ + + /** + * Receive ainput mouse event PDU. + */ + psAInputServerMouseEvent MouseEvent; + + rdpContext* rdpcontext; + + /** + * Callback, when the channel got its id assigned. + */ + psAInputChannelIdAssigned ChannelIdAssigned; + }; + + FREERDP_API void ainput_server_context_free(ainput_server_context* context); + + WINPR_ATTR_MALLOC(ainput_server_context_free, 1) + FREERDP_API ainput_server_context* ainput_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_AINPUT_SERVER_H */ diff --git a/include/freerdp/server/audin.h b/include/freerdp/server/audin.h new file mode 100644 index 0000000..51d83fe --- /dev/null +++ b/include/freerdp/server/audin.h @@ -0,0 +1,179 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Server Audio Input Virtual Channel + * + * Copyright 2012 Vic Lee + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com> + * Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_AUDIN_SERVER_H +#define FREERDP_CHANNEL_AUDIN_SERVER_H + +#include <freerdp/config.h> + +#include <freerdp/channels/audin.h> +#include <freerdp/channels/wtsvc.h> + +#if !defined(CHANNEL_AUDIN_SERVER) +#error "This header must not be included if CHANNEL_AUDIN_SERVER is not defined" +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_audin_server_context audin_server_context; + + typedef BOOL (*psAudinServerChannelOpen)(audin_server_context* context); + typedef BOOL (*psAudinServerChannelIsOpen)(audin_server_context* context); + typedef BOOL (*psAudinServerChannelClose)(audin_server_context* context); + + typedef BOOL (*psAudinServerChannelIdAssigned)(audin_server_context* context, UINT32 channelId); + + typedef UINT (*psAudinServerVersion)(audin_server_context* context, + const SNDIN_VERSION* version); + typedef UINT (*psAudinServerFormats)(audin_server_context* context, + const SNDIN_FORMATS* formats); + typedef UINT (*psAudinServerOpen)(audin_server_context* context, const SNDIN_OPEN* open); + typedef UINT (*psAudinServerOpenReply)(audin_server_context* context, + const SNDIN_OPEN_REPLY* open_reply); + typedef UINT (*psAudinServerIncomingData)(audin_server_context* context, + const SNDIN_DATA_INCOMING* data_incoming); + typedef UINT (*psAudinServerData)(audin_server_context* context, const SNDIN_DATA* data); + typedef UINT (*psAudinServerFormatChange)(audin_server_context* context, + const SNDIN_FORMATCHANGE* format_change); + + struct s_audin_server_context + { + HANDLE vcm; + + /* Server self-defined pointer. */ + void* userdata; + + /** + * Server version to send to the client, when the DVC was successfully + * opened. + **/ + SNDIN_VERSION_Version serverVersion; + + /*** APIs called by the server. ***/ + + /** + * Open the audio input channel. + */ + psAudinServerChannelOpen Open; + + /** + * Check, whether the audio input channel thread was created + */ + psAudinServerChannelIsOpen IsOpen; + + /** + * Close the audio input channel. + */ + psAudinServerChannelClose Close; + + /** + * For the following server to client PDUs, + * the message header does not have to be set. + */ + + /** + * Send a Version PDU. + */ + psAudinServerVersion SendVersion; + + /** + * Send a Sound Formats PDU. + */ + psAudinServerFormats SendFormats; + + /** + * Send an Open PDU. + */ + psAudinServerOpen SendOpen; + + /** + * Send a Format Change PDU. + */ + psAudinServerFormatChange SendFormatChange; + + /*** Callbacks registered by the server. ***/ + + /** + * Callback, when the channel got its id assigned. + */ + psAudinServerChannelIdAssigned ChannelIdAssigned; + + /* + * Callback for the Version PDU. + */ + psAudinServerVersion ReceiveVersion; + + /* + * Callback for the Sound Formats PDU. + */ + psAudinServerFormats ReceiveFormats; + + /* + * Callback for the Open Reply PDU. + */ + psAudinServerOpenReply OpenReply; + + /* + * Callback for the Incoming Data PDU. + */ + psAudinServerIncomingData IncomingData; + + /* + * Callback for the Data PDU. + */ + psAudinServerData Data; + + /* + * Callback for the Format Change PDU. + */ + psAudinServerFormatChange ReceiveFormatChange; + + rdpContext* rdpcontext; + }; + + FREERDP_API void audin_server_context_free(audin_server_context* context); + + WINPR_ATTR_MALLOC(audin_server_context_free, 1) + FREERDP_API audin_server_context* audin_server_context_new(HANDLE vcm); + + /** \brief sets the supported audio formats for AUDIN server channel context. + * + * \param context The context to set the formats for + * \param count The number of formats found in \b formats. Use \b -1 to set to default formats + * supported by FreeRDP \param formats An array of \b count elements + * + * \return \b TRUE if successful and at least one format is supported, \b FALSE otherwise. + */ + FREERDP_API BOOL audin_server_set_formats(audin_server_context* context, SSIZE_T count, + const AUDIO_FORMAT* formats); + + FREERDP_API const AUDIO_FORMAT* + audin_server_get_negotiated_format(const audin_server_context* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_AUDIN_SERVER_H */ diff --git a/include/freerdp/server/channels.h b/include/freerdp/server/channels.h new file mode 100644 index 0000000..65b6b7f --- /dev/null +++ b/include/freerdp/server/channels.h @@ -0,0 +1,25 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Server Channels + * + * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.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_CHANNELS_SERVER_H +#define FREERDP_CHANNELS_SERVER_H + +#include <freerdp/api.h> + +#endif /* FREERDP_CHANNELS_SERVER_H */ diff --git a/include/freerdp/server/cliprdr.h b/include/freerdp/server/cliprdr.h new file mode 100644 index 0000000..77ebb00 --- /dev/null +++ b/include/freerdp/server/cliprdr.h @@ -0,0 +1,146 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Clipboard Virtual Channel Server Interface + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_CLIPRDR_SERVER_CLIPRDR_H +#define FREERDP_CHANNEL_CLIPRDR_SERVER_CLIPRDR_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/channels/wtsvc.h> + +#include <freerdp/channels/cliprdr.h> +#include <freerdp/client/cliprdr.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Server Interface + */ + + typedef struct s_cliprdr_server_context CliprdrServerContext; + + typedef UINT (*psCliprdrOpen)(CliprdrServerContext* context); + typedef UINT (*psCliprdrClose)(CliprdrServerContext* context); + typedef UINT (*psCliprdrStart)(CliprdrServerContext* context); + typedef UINT (*psCliprdrStop)(CliprdrServerContext* context); + typedef HANDLE (*psCliprdrGetEventHandle)(CliprdrServerContext* context); + typedef UINT (*psCliprdrCheckEventHandle)(CliprdrServerContext* context); + + typedef UINT (*psCliprdrServerCapabilities)(CliprdrServerContext* context, + const CLIPRDR_CAPABILITIES* capabilities); + typedef UINT (*psCliprdrClientCapabilities)(CliprdrServerContext* context, + const CLIPRDR_CAPABILITIES* capabilities); + typedef UINT (*psCliprdrMonitorReady)(CliprdrServerContext* context, + const CLIPRDR_MONITOR_READY* monitorReady); + typedef UINT (*psCliprdrTempDirectory)(CliprdrServerContext* context, + const CLIPRDR_TEMP_DIRECTORY* tempDirectory); + typedef UINT (*psCliprdrClientFormatList)(CliprdrServerContext* context, + const CLIPRDR_FORMAT_LIST* formatList); + typedef UINT (*psCliprdrServerFormatList)(CliprdrServerContext* context, + const CLIPRDR_FORMAT_LIST* formatList); + typedef UINT (*psCliprdrClientFormatListResponse)( + CliprdrServerContext* context, const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse); + typedef UINT (*psCliprdrServerFormatListResponse)( + CliprdrServerContext* context, const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse); + typedef UINT (*psCliprdrClientLockClipboardData)( + CliprdrServerContext* context, const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData); + typedef UINT (*psCliprdrServerLockClipboardData)( + CliprdrServerContext* context, const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData); + typedef UINT (*psCliprdrClientUnlockClipboardData)( + CliprdrServerContext* context, const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData); + typedef UINT (*psCliprdrServerUnlockClipboardData)( + CliprdrServerContext* context, const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData); + typedef UINT (*psCliprdrClientFormatDataRequest)( + CliprdrServerContext* context, const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest); + typedef UINT (*psCliprdrServerFormatDataRequest)( + CliprdrServerContext* context, const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest); + typedef UINT (*psCliprdrClientFormatDataResponse)( + CliprdrServerContext* context, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse); + typedef UINT (*psCliprdrServerFormatDataResponse)( + CliprdrServerContext* context, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse); + typedef UINT (*psCliprdrClientFileContentsRequest)( + CliprdrServerContext* context, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest); + typedef UINT (*psCliprdrServerFileContentsRequest)( + CliprdrServerContext* context, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest); + typedef UINT (*psCliprdrClientFileContentsResponse)( + CliprdrServerContext* context, const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse); + typedef UINT (*psCliprdrServerFileContentsResponse)( + CliprdrServerContext* context, const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse); + + struct s_cliprdr_server_context + { + void* handle; + void* custom; + + /* server clipboard capabilities - set by server - updated by the channel after client + * capability exchange */ + BOOL useLongFormatNames; + BOOL streamFileClipEnabled; + BOOL fileClipNoFilePaths; + BOOL canLockClipData; + + psCliprdrOpen Open; + psCliprdrClose Close; + psCliprdrStart Start; + psCliprdrStop Stop; + psCliprdrGetEventHandle GetEventHandle; + psCliprdrCheckEventHandle CheckEventHandle; + + psCliprdrServerCapabilities ServerCapabilities; + psCliprdrClientCapabilities ClientCapabilities; + psCliprdrMonitorReady MonitorReady; + psCliprdrTempDirectory TempDirectory; + psCliprdrClientFormatList ClientFormatList; + psCliprdrServerFormatList ServerFormatList; + psCliprdrClientFormatListResponse ClientFormatListResponse; + psCliprdrServerFormatListResponse ServerFormatListResponse; + psCliprdrClientLockClipboardData ClientLockClipboardData; + psCliprdrServerLockClipboardData ServerLockClipboardData; + psCliprdrClientUnlockClipboardData ClientUnlockClipboardData; + psCliprdrServerUnlockClipboardData ServerUnlockClipboardData; + psCliprdrClientFormatDataRequest ClientFormatDataRequest; + psCliprdrServerFormatDataRequest ServerFormatDataRequest; + psCliprdrClientFormatDataResponse ClientFormatDataResponse; + psCliprdrServerFormatDataResponse ServerFormatDataResponse; + psCliprdrClientFileContentsRequest ClientFileContentsRequest; + psCliprdrServerFileContentsRequest ServerFileContentsRequest; + psCliprdrClientFileContentsResponse ClientFileContentsResponse; + psCliprdrServerFileContentsResponse ServerFileContentsResponse; + + rdpContext* rdpcontext; + BOOL autoInitializationSequence; + UINT32 lastRequestedFormatId; + BOOL hasHugeFileSupport; + }; + + FREERDP_API void cliprdr_server_context_free(CliprdrServerContext* context); + + WINPR_ATTR_MALLOC(cliprdr_server_context_free, 1) + FREERDP_API CliprdrServerContext* cliprdr_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_CLIPRDR_SERVER_CLIPRDR_H */ diff --git a/include/freerdp/server/disp.h b/include/freerdp/server/disp.h new file mode 100644 index 0000000..d17c3c2 --- /dev/null +++ b/include/freerdp/server/disp.h @@ -0,0 +1,78 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDPEDISP Virtual Channel Extension + * + * Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.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_CHANNEL_DISP_SERVER_DISP_H +#define FREERDP_CHANNEL_DISP_SERVER_DISP_H + +#include <freerdp/channels/disp.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_disp_server_private DispServerPrivate; + typedef struct s_disp_server_context DispServerContext; + + typedef BOOL (*psDispChannelIdAssigned)(DispServerContext* context, UINT32 channelId); + + typedef UINT (*psDispMonitorLayout)(DispServerContext* context, + const DISPLAY_CONTROL_MONITOR_LAYOUT_PDU* pdu); + typedef UINT (*psDispCaps)(DispServerContext* context); + typedef UINT (*psDispOpen)(DispServerContext* context); + typedef UINT (*psDispClose)(DispServerContext* context); + + struct s_disp_server_context + { + void* custom; + HANDLE vcm; + + /* Server capabilities */ + UINT32 MaxNumMonitors; + UINT32 MaxMonitorAreaFactorA; + UINT32 MaxMonitorAreaFactorB; + + psDispOpen Open; + psDispClose Close; + + psDispMonitorLayout DispMonitorLayout; + psDispCaps DisplayControlCaps; + + DispServerPrivate* priv; + rdpContext* rdpcontext; + + /** + * Callback, when the channel got its id assigned. + */ + psDispChannelIdAssigned ChannelIdAssigned; + }; + + FREERDP_API void disp_server_context_free(DispServerContext* context); + + WINPR_ATTR_MALLOC(disp_server_context_free, 1) + FREERDP_API DispServerContext* disp_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_DISP_SERVER_DISP_H */ diff --git a/include/freerdp/server/drdynvc.h b/include/freerdp/server/drdynvc.h new file mode 100644 index 0000000..09453f4 --- /dev/null +++ b/include/freerdp/server/drdynvc.h @@ -0,0 +1,63 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Dynamic Virtual Channel Extension + * + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_DRDYNVC_SERVER_DRDYNVC_H +#define FREERDP_CHANNEL_DRDYNVC_SERVER_DRDYNVC_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/channels/wtsvc.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Server Interface + */ + + typedef struct s_drdynvc_server_context DrdynvcServerContext; + typedef struct s_drdynvc_server_private DrdynvcServerPrivate; + + typedef UINT (*psDrdynvcStart)(DrdynvcServerContext* context); + typedef UINT (*psDrdynvcStop)(DrdynvcServerContext* context); + + struct s_drdynvc_server_context + { + HANDLE vcm; + + psDrdynvcStart Start; + psDrdynvcStop Stop; + + DrdynvcServerPrivate* priv; + }; + + FREERDP_API void drdynvc_server_context_free(DrdynvcServerContext* context); + + WINPR_ATTR_MALLOC(drdynvc_server_context_free, 1) + FREERDP_API DrdynvcServerContext* drdynvc_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_DRDYNVC_SERVER_DRDYNVC_H */ diff --git a/include/freerdp/server/echo.h b/include/freerdp/server/echo.h new file mode 100644 index 0000000..609d8c3 --- /dev/null +++ b/include/freerdp/server/echo.h @@ -0,0 +1,102 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Echo Virtual Channel Extension + * + * Copyright 2014 Vic Lee + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_ECHO_SERVER_H +#define FREERDP_CHANNEL_ECHO_SERVER_H + +#include <freerdp/channels/wtsvc.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum ECHO_SERVER_OPEN_RESULT + { + ECHO_SERVER_OPEN_RESULT_OK = 0, + ECHO_SERVER_OPEN_RESULT_CLOSED = 1, + ECHO_SERVER_OPEN_RESULT_NOTSUPPORTED = 2, + ECHO_SERVER_OPEN_RESULT_ERROR = 3 + } ECHO_SERVER_OPEN_RESULT; + + typedef struct s_echo_server_context echo_server_context; + + typedef BOOL (*psEchoServerChannelIdAssigned)(echo_server_context* context, UINT32 channelId); + + typedef UINT (*psEchoServerOpen)(echo_server_context* context); + typedef UINT (*psEchoServerClose)(echo_server_context* context); + typedef BOOL (*psEchoServerRequest)(echo_server_context* context, const BYTE* buffer, + UINT32 length); + + typedef UINT (*psEchoServerOpenResult)(echo_server_context* context, + ECHO_SERVER_OPEN_RESULT result); + typedef UINT (*psEchoServerResponse)(echo_server_context* context, const BYTE* buffer, + UINT32 length); + + struct s_echo_server_context + { + HANDLE vcm; + + /* Server self-defined pointer. */ + void* data; + + /*** APIs called by the server. ***/ + /** + * Open the echo channel. + */ + psEchoServerOpen Open; + /** + * Close the echo channel. + */ + psEchoServerClose Close; + /** + * Send echo request PDU. + */ + psEchoServerRequest Request; + + /*** Callbacks registered by the server. ***/ + /** + * Indicate whether the channel is opened successfully. + */ + psEchoServerOpenResult OpenResult; + /** + * Receive echo response PDU. + */ + psEchoServerResponse Response; + + rdpContext* rdpcontext; + + /** + * Callback, when the channel got its id assigned. + */ + psEchoServerChannelIdAssigned ChannelIdAssigned; + }; + + FREERDP_API void echo_server_context_free(echo_server_context* context); + + WINPR_ATTR_MALLOC(echo_server_context_free, 1) + FREERDP_API echo_server_context* echo_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_ECHO_SERVER_H */ diff --git a/include/freerdp/server/encomsp.h b/include/freerdp/server/encomsp.h new file mode 100644 index 0000000..534fd3e --- /dev/null +++ b/include/freerdp/server/encomsp.h @@ -0,0 +1,104 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Multiparty Virtual Channel + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_ENCOMSP_SERVER_ENCOMSP_H +#define FREERDP_CHANNEL_ENCOMSP_SERVER_ENCOMSP_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/channels/wtsvc.h> + +#include <freerdp/channels/encomsp.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Server Interface + */ + + typedef struct s_encomsp_server_context EncomspServerContext; + typedef struct s_encomsp_server_private EncomspServerPrivate; + + typedef UINT (*psEncomspStart)(EncomspServerContext* context); + typedef UINT (*psEncomspStop)(EncomspServerContext* context); + + typedef UINT (*psEncomspFilterUpdated)(EncomspServerContext* context, + ENCOMSP_FILTER_UPDATED_PDU* filterUpdated); + typedef UINT (*psEncomspApplicationCreated)( + EncomspServerContext* context, ENCOMSP_APPLICATION_CREATED_PDU* applicationCreated); + typedef UINT (*psEncomspApplicationRemoved)( + EncomspServerContext* context, ENCOMSP_APPLICATION_REMOVED_PDU* applicationRemoved); + typedef UINT (*psEncomspWindowCreated)(EncomspServerContext* context, + ENCOMSP_WINDOW_CREATED_PDU* windowCreated); + typedef UINT (*psEncomspWindowRemoved)(EncomspServerContext* context, + ENCOMSP_WINDOW_REMOVED_PDU* windowRemoved); + typedef UINT (*psEncomspShowWindow)(EncomspServerContext* context, + ENCOMSP_SHOW_WINDOW_PDU* showWindow); + typedef UINT (*psEncomspParticipantCreated)( + EncomspServerContext* context, ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated); + typedef UINT (*psEncomspParticipantRemoved)( + EncomspServerContext* context, ENCOMSP_PARTICIPANT_REMOVED_PDU* participantRemoved); + typedef UINT (*psEncomspChangeParticipantControlLevel)( + EncomspServerContext* context, + ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* changeParticipantControlLevel); + typedef UINT (*psEncomspGraphicsStreamPaused)( + EncomspServerContext* context, ENCOMSP_GRAPHICS_STREAM_PAUSED_PDU* graphicsStreamPaused); + typedef UINT (*psEncomspGraphicsStreamResumed)( + EncomspServerContext* context, ENCOMSP_GRAPHICS_STREAM_RESUMED_PDU* graphicsStreamResumed); + + struct s_encomsp_server_context + { + HANDLE vcm; + void* custom; + + psEncomspStart Start; + psEncomspStop Stop; + + psEncomspFilterUpdated FilterUpdated; + psEncomspApplicationCreated ApplicationCreated; + psEncomspApplicationRemoved ApplicationRemoved; + psEncomspWindowCreated WindowCreated; + psEncomspWindowRemoved WindowRemoved; + psEncomspShowWindow ShowWindow; + psEncomspParticipantCreated ParticipantCreated; + psEncomspParticipantRemoved ParticipantRemoved; + psEncomspChangeParticipantControlLevel ChangeParticipantControlLevel; + psEncomspGraphicsStreamPaused GraphicsStreamPaused; + psEncomspGraphicsStreamResumed GraphicsStreamResumed; + + EncomspServerPrivate* priv; + + rdpContext* rdpcontext; + }; + + FREERDP_API void encomsp_server_context_free(EncomspServerContext* context); + + WINPR_ATTR_MALLOC(encomsp_server_context_free, 1) + FREERDP_API EncomspServerContext* encomsp_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_ENCOMSP_SERVER_ENCOMSP_H */ diff --git a/include/freerdp/server/gfxredir.h b/include/freerdp/server/gfxredir.h new file mode 100644 index 0000000..9e10cdf --- /dev/null +++ b/include/freerdp/server/gfxredir.h @@ -0,0 +1,103 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDPXXXX Remote App Graphics Redirection Virtual Channel Extension + * + * Copyright 2020 Microsoft + * + * 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_CHANNEL_GFXREDIR_SERVER_GFXREDIR_H +#define FREERDP_CHANNEL_GFXREDIR_SERVER_GFXREDIR_H + +#include <freerdp/channels/gfxredir.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_gfxredir_server_private GfxRedirServerPrivate; + typedef struct s_gfxredir_server_context GfxRedirServerContext; + + typedef UINT (*psGfxRedirOpen)(GfxRedirServerContext* context); + typedef UINT (*psGfxRedirClose)(GfxRedirServerContext* context); + + typedef UINT (*psGfxRedirError)(GfxRedirServerContext* context, + const GFXREDIR_ERROR_PDU* error); + + typedef UINT (*psGfxRedirGraphicsRedirectionLegacyCaps)( + GfxRedirServerContext* context, const GFXREDIR_LEGACY_CAPS_PDU* graphicsCaps); + + typedef UINT (*psGfxRedirGraphicsRedirectionCapsAdvertise)( + GfxRedirServerContext* context, const GFXREDIR_CAPS_ADVERTISE_PDU* graphicsCapsAdvertise); + typedef UINT (*psGfxRedirGraphicsRedirectionCapsConfirm)( + GfxRedirServerContext* context, const GFXREDIR_CAPS_CONFIRM_PDU* graphicsCapsConfirm); + + typedef UINT (*psGfxRedirOpenPool)(GfxRedirServerContext* context, + const GFXREDIR_OPEN_POOL_PDU* openPool); + typedef UINT (*psGfxRedirClosePool)(GfxRedirServerContext* context, + const GFXREDIR_CLOSE_POOL_PDU* closePool); + + typedef UINT (*psGfxRedirCreateBuffer)(GfxRedirServerContext* context, + const GFXREDIR_CREATE_BUFFER_PDU* createBuffer); + typedef UINT (*psGfxRedirDestroyBuffer)(GfxRedirServerContext* context, + const GFXREDIR_DESTROY_BUFFER_PDU* destroyBuffer); + + typedef UINT (*psGfxRedirPresentBuffer)(GfxRedirServerContext* context, + const GFXREDIR_PRESENT_BUFFER_PDU* presentBuffer); + typedef UINT (*psGfxRedirPresentBufferAck)( + GfxRedirServerContext* context, const GFXREDIR_PRESENT_BUFFER_ACK_PDU* presentBufferAck); + + struct s_gfxredir_server_context + { + void* custom; + HANDLE vcm; + + psGfxRedirOpen Open; + psGfxRedirClose Close; + + psGfxRedirError Error; + + psGfxRedirGraphicsRedirectionLegacyCaps GraphicsRedirectionLegacyCaps; + + psGfxRedirGraphicsRedirectionCapsAdvertise GraphicsRedirectionCapsAdvertise; + psGfxRedirGraphicsRedirectionCapsConfirm GraphicsRedirectionCapsConfirm; + + psGfxRedirOpenPool OpenPool; + psGfxRedirClosePool ClosePool; + + psGfxRedirCreateBuffer CreateBuffer; + psGfxRedirDestroyBuffer DestroyBuffer; + + psGfxRedirPresentBuffer PresentBuffer; + psGfxRedirPresentBufferAck PresentBufferAck; + + GfxRedirServerPrivate* priv; + rdpContext* rdpcontext; + + UINT32 confirmedCapsVersion; + }; + + WINPR_ATTR_MALLOC(gfxredir_server_context_free, 1) + FREERDP_API GfxRedirServerContext* gfxredir_server_context_new(HANDLE vcm); + FREERDP_API void gfxredir_server_context_free(GfxRedirServerContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_GFXREDIR_SERVER_GFXREDIR_H */ diff --git a/include/freerdp/server/location.h b/include/freerdp/server/location.h new file mode 100644 index 0000000..8078878 --- /dev/null +++ b/include/freerdp/server/location.h @@ -0,0 +1,142 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Location Virtual Channel Extension + * + * Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_LOCATION_SERVER_LOCATION_H +#define FREERDP_CHANNEL_LOCATION_SERVER_LOCATION_H + +#include <freerdp/channels/location.h> +#include <freerdp/channels/wtsvc.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_location_server_context LocationServerContext; + + typedef UINT (*psLocationServerOpen)(LocationServerContext* context); + typedef UINT (*psLocationServerClose)(LocationServerContext* context); + + typedef BOOL (*psLocationServerChannelIdAssigned)(LocationServerContext* context, + UINT32 channelId); + + typedef UINT (*psLocationServerInitialize)(LocationServerContext* context, BOOL externalThread); + typedef UINT (*psLocationServerPoll)(LocationServerContext* context); + typedef BOOL (*psLocationServerChannelHandle)(LocationServerContext* context, HANDLE* handle); + + typedef UINT (*psLocationServerServerReady)(LocationServerContext* context, + const RDPLOCATION_SERVER_READY_PDU* serverReady); + typedef UINT (*psLocationServerClientReady)(LocationServerContext* context, + const RDPLOCATION_CLIENT_READY_PDU* clientReady); + + typedef UINT (*psLocationServerBaseLocation3D)( + LocationServerContext* context, const RDPLOCATION_BASE_LOCATION3D_PDU* baseLocation3D); + typedef UINT (*psLocationServerLocation2DDelta)( + LocationServerContext* context, const RDPLOCATION_LOCATION2D_DELTA_PDU* location2DDelta); + typedef UINT (*psLocationServerLocation3DDelta)( + LocationServerContext* context, const RDPLOCATION_LOCATION3D_DELTA_PDU* location3DDelta); + + struct s_location_server_context + { + HANDLE vcm; + + /* Server self-defined pointer. */ + void* userdata; + + /*** APIs called by the server. ***/ + + /** + * Optional: Set thread handling. + * When externalThread=TRUE, the application is responsible to call + * Poll() periodically to process channel events. + * + * Defaults to externalThread=FALSE + */ + psLocationServerInitialize Initialize; + + /** + * Open the location channel. + */ + psLocationServerOpen Open; + + /** + * Close the location channel. + */ + psLocationServerClose Close; + + /** + * Poll + * When externalThread=TRUE, call Poll() periodically from your main loop. + * If externalThread=FALSE do not call. + */ + psLocationServerPoll Poll; + + /** + * Retrieve the channel handle for use in conjunction with Poll(). + * If externalThread=FALSE do not call. + */ + psLocationServerChannelHandle ChannelHandle; + + /* All PDUs sent by the server don't require the header to be set */ + + /* + * Send a ServerReady PDU. + */ + psLocationServerServerReady ServerReady; + + /*** Callbacks registered by the server. ***/ + + /** + * Callback, when the channel got its id assigned. + */ + psLocationServerChannelIdAssigned ChannelIdAssigned; + + /** + * Callback for the ClientReady PDU. + */ + psLocationServerClientReady ClientReady; + + /** + * Callback for the BaseLocation3D PDU. + */ + psLocationServerBaseLocation3D BaseLocation3D; + + /** + * Callback for the Location2DDelta PDU. + */ + psLocationServerLocation2DDelta Location2DDelta; + + /** + * Callback for the Location3DDelta PDU. + */ + psLocationServerLocation3DDelta Location3DDelta; + + rdpContext* rdpcontext; + }; + + FREERDP_API void location_server_context_free(LocationServerContext* context); + + WINPR_ATTR_MALLOC(location_server_context_free, 1) + FREERDP_API LocationServerContext* location_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_LOCATION_SERVER_LOCATION_H */ diff --git a/include/freerdp/server/proxy/proxy_config.h b/include/freerdp/server/proxy/proxy_config.h new file mode 100644 index 0000000..237fdf3 --- /dev/null +++ b/include/freerdp/server/proxy/proxy_config.h @@ -0,0 +1,235 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Proxy Server + * + * Copyright 2021-2023 Armin Novak <armin.novak@thincast.com> + * Copyright 2021-2023 Thincast Technologies GmbH + * + * 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_SERVER_PROXY_CONFIG_H +#define FREERDP_SERVER_PROXY_CONFIG_H + +#include <winpr/wtypes.h> +#include <winpr/ini.h> + +#include <freerdp/api.h> +#include <freerdp/server/proxy/proxy_modules_api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct proxy_config proxyConfig; + + struct proxy_config + { + /* server */ + char* Host; + UINT16 Port; + + /* target */ + BOOL FixedTarget; + char* TargetHost; + UINT16 TargetPort; + char* TargetUser; + char* TargetDomain; + char* TargetPassword; + + /* input */ + BOOL Keyboard; + BOOL Mouse; + BOOL Multitouch; + + /* server security */ + BOOL ServerTlsSecurity; + BOOL ServerRdpSecurity; + BOOL ServerNlaSecurity; + + /* client security */ + BOOL ClientNlaSecurity; + BOOL ClientTlsSecurity; + BOOL ClientRdpSecurity; + BOOL ClientAllowFallbackToTls; + + /* channels */ + BOOL GFX; + BOOL DisplayControl; + BOOL Clipboard; + BOOL AudioOutput; + BOOL AudioInput; + BOOL RemoteApp; + BOOL DeviceRedirection; + BOOL VideoRedirection; + BOOL CameraRedirection; + + BOOL PassthroughIsBlacklist; + char** Passthrough; + size_t PassthroughCount; + char** Intercept; + size_t InterceptCount; + + /* clipboard specific settings */ + BOOL TextOnly; + UINT32 MaxTextLength; + + /* gfx settings */ + BOOL DecodeGFX; + + /* modules */ + char** Modules; /* module file names to load */ + size_t ModulesCount; + + char** RequiredPlugins; /* required plugin names */ + size_t RequiredPluginsCount; + + char* CertificateFile; + char* CertificateContent; + + char* PrivateKeyFile; + char* PrivateKeyContent; + + /* Data extracted from CertificateContent or CertificateFile (evaluation in this order) */ + char* CertificatePEM; + size_t CertificatePEMLength; + + /* Data extracted from PrivateKeyContent or PrivateKeyFile (evaluation in this order) */ + char* PrivateKeyPEM; + size_t PrivateKeyPEMLength; + + wIniFile* ini; + + /* target continued */ + UINT32 TargetTlsSecLevel; + }; + + /** + * @brief pf_server_config_dump Dumps a default INI configuration file + * @param file The file to write to. Existing files are truncated. + * @return TRUE for success, FALSE if the file could not be written. + */ + FREERDP_API BOOL pf_server_config_dump(const char* file); + + /** + * @brief server_config_load_ini Create a proxyConfig from a already loaded + * INI file. + * + * @param ini A pointer to the parsed INI file. Must NOT be NULL. + * + * @return A proxyConfig or NULL in case of failure. + */ + FREERDP_API proxyConfig* server_config_load_ini(wIniFile* ini); + /** + * @brief pf_server_config_load_file Create a proxyConfig from a INI file found at path. + * + * @param path The path of the INI file + * + * @return A proxyConfig or NULL in case of failure. + */ + FREERDP_API proxyConfig* pf_server_config_load_file(const char* path); + + /** + * @brief pf_server_config_load_buffer Create a proxyConfig from a memory string buffer in INI + * file format + * + * @param buffer A pointer to the '\0' terminated INI string. + * + * @return A proxyConfig or NULL in case of failure. + */ + FREERDP_API proxyConfig* pf_server_config_load_buffer(const char* buffer); + + /** + * @brief pf_server_config_print Print the configuration to stdout + * + * @param config A pointer to the configuration to print. Must NOT be NULL. + */ + FREERDP_API void pf_server_config_print(const proxyConfig* config); + + /** + * @brief pf_server_config_free Releases all resources associated with proxyConfig + * + * @param config A pointer to the proxyConfig to clean up. Might be NULL. + */ + FREERDP_API void pf_server_config_free(proxyConfig* config); + + /** + * @brief pf_config_required_plugins_count + * + * @param config A pointer to the proxyConfig. Must NOT be NULL. + * + * @return The number of required plugins configured. + */ + FREERDP_API size_t pf_config_required_plugins_count(const proxyConfig* config); + + /** + * @brief pf_config_required_plugin + * @param config A pointer to the proxyConfig. Must NOT be NULL. + * @param index The index of the plugin to return + * + * @return The name of the plugin or NULL. + */ + FREERDP_API const char* pf_config_required_plugin(const proxyConfig* config, size_t index); + + /** + * @brief pf_config_modules_count + * + * @param config A pointer to the proxyConfig. Must NOT be NULL. + * + * @return The number of proxy modules configured. + */ + FREERDP_API size_t pf_config_modules_count(const proxyConfig* config); + + /** + * @brief pf_config_modules + * @param config A pointer to the proxyConfig. Must NOT be NULL. + * + * @return An array of strings of size pf_config_modules_count with the module names. + */ + FREERDP_API const char** pf_config_modules(const proxyConfig* config); + + /** + * @brief pf_config_clone Create a copy of the configuration + * @param dst A pointer that receives the newly allocated copy + * @param config The source configuration to copy + * + * @return TRUE for success, FALSE otherwise + */ + FREERDP_API BOOL pf_config_clone(proxyConfig** dst, const proxyConfig* config); + + /** + * @brief pf_config_plugin Register a proxy plugin handling event filtering + * defined in the configuration. + * + * @param plugins_manager The plugin manager + * @param userdata A proxyConfig* to use as reference + * + * @return TRUE for success, FALSE for failure + */ + FREERDP_API BOOL pf_config_plugin(proxyPluginsManager* plugins_manager, void* userdata); + + /** + * @brief pf_config_get get a value for a section/key + * @param config A pointer to the proxyConfig. Must NOT be NULL. + * @param section The name of the section the key is in, must not be \b NULL + * @param key The name of the key to look for. Must not be \b NULL + * + * @return A pointer to the value for \b section/key or \b NULL if not found + */ + FREERDP_API const char* pf_config_get(const proxyConfig* config, const char* section, + const char* key); + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_SERVER_PROXY_CONFIG_H */ diff --git a/include/freerdp/server/proxy/proxy_context.h b/include/freerdp/server/proxy/proxy_context.h new file mode 100644 index 0000000..0132c66 --- /dev/null +++ b/include/freerdp/server/proxy/proxy_context.h @@ -0,0 +1,186 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Proxy Server + * + * Copyright 2019 Mati Shabtay <matishabtay@gmail.com> + * Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com> + * Copyright 2019 Idan Freiberg <speidy@gmail.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_SERVER_PROXY_PFCONTEXT_H +#define FREERDP_SERVER_PROXY_PFCONTEXT_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/freerdp.h> +#include <freerdp/channels/wtsvc.h> + +#include <freerdp/server/proxy/proxy_config.h> +#include <freerdp/server/proxy/proxy_types.h> + +#define PROXY_SESSION_ID_LENGTH 32 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct proxy_data proxyData; + typedef struct proxy_module proxyModule; + typedef struct p_server_static_channel_context pServerStaticChannelContext; + + typedef struct s_InterceptContextMapEntry + { + void (*free)(struct s_InterceptContextMapEntry*); + } InterceptContextMapEntry; + + /* All proxy interception channels derive from this base struct + * and set their cleanup function accordingly. */ + FREERDP_API void intercept_context_entry_free(void* obj); + typedef PfChannelResult (*proxyChannelDataFn)(proxyData* pdata, + const pServerStaticChannelContext* channel, + const BYTE* xdata, size_t xsize, UINT32 flags, + size_t totalSizepServer); + typedef void (*proxyChannelContextDtor)(void* context); + + /** @brief per channel configuration */ + struct p_server_static_channel_context + { + char* channel_name; + UINT32 front_channel_id; + UINT32 back_channel_id; + pf_utils_channel_mode channelMode; + proxyChannelDataFn onFrontData; + proxyChannelDataFn onBackData; + proxyChannelContextDtor contextDtor; + void* context; + }; + + void StaticChannelContext_free(pServerStaticChannelContext* ctx); + + /** + * Wraps rdpContext and holds the state for the proxy's server. + */ + struct p_server_context + { + rdpContext context; + + proxyData* pdata; + + HANDLE vcm; + HANDLE dynvcReady; + + wHashTable* interceptContextMap; + wHashTable* channelsByFrontId; + wHashTable* channelsByBackId; + }; + typedef struct p_server_context pServerContext; + + WINPR_ATTR_MALLOC(StaticChannelContext_free, 1) + pServerStaticChannelContext* StaticChannelContext_new(pServerContext* ps, const char* name, + UINT32 id); + + /** + * Wraps rdpContext and holds the state for the proxy's client. + */ + typedef struct p_client_context pClientContext; + + struct p_client_context + { + rdpContext context; + + proxyData* pdata; + + /* + * In a case when freerdp_connect fails, + * Used for NLA fallback feature, to check if the server should close the connection. + * When it is set to TRUE, proxy's client knows it shouldn't signal the server thread to + * closed the connection when pf_client_post_disconnect is called, because it is trying to + * connect reconnect without NLA. It must be set to TRUE before the first try, and to FALSE + * after the connection fully established, to ensure graceful shutdown of the connection + * when it will be closed. + */ + BOOL allow_next_conn_failure; + + BOOL connected; /* Set after client post_connect. */ + + pReceiveChannelData client_receive_channel_data_original; + wQueue* cached_server_channel_data; + BOOL (*sendChannelData)(pClientContext* pc, const proxyChannelDataEventInfo* ev); + + /* X509 specific */ + char* remote_hostname; + wStream* remote_pem; + UINT16 remote_port; + UINT32 remote_flags; + + BOOL input_state_sync_pending; + UINT32 input_state; + + wHashTable* interceptContextMap; + UINT32 computerNameLen; + BOOL computerNameUnicode; + union + { + WCHAR* wc; + char* c; + void* v; + } computerName; + }; + + /** + * Holds data common to both sides of a proxy's session. + */ + struct proxy_data + { + proxyModule* module; + const proxyConfig* config; + + pServerContext* ps; + pClientContext* pc; + + HANDLE abort_event; + HANDLE client_thread; + HANDLE gfx_server_ready; + + char session_id[PROXY_SESSION_ID_LENGTH + 1]; + + /* used to external modules to store per-session info */ + wHashTable* modules_info; + psPeerReceiveChannelData server_receive_channel_data_original; + }; + + FREERDP_API BOOL pf_context_copy_settings(rdpSettings* dst, const rdpSettings* src); + FREERDP_API BOOL pf_context_init_server_context(freerdp_peer* client); + + WINPR_ATTR_MALLOC(freerdp_client_context_free, 1) + FREERDP_API pClientContext* pf_context_create_client_context(const rdpSettings* clientSettings); + + FREERDP_API void proxy_data_free(proxyData* pdata); + + WINPR_ATTR_MALLOC(proxy_data_free, 1) + FREERDP_API proxyData* proxy_data_new(void); + FREERDP_API void proxy_data_set_client_context(proxyData* pdata, pClientContext* context); + FREERDP_API void proxy_data_set_server_context(proxyData* pdata, pServerContext* context); + + FREERDP_API BOOL proxy_data_shall_disconnect(proxyData* pdata); + FREERDP_API void proxy_data_abort_connect(proxyData* pdata); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SERVER_PROXY_PFCONTEXT_H */ diff --git a/include/freerdp/server/proxy/proxy_log.h b/include/freerdp/server/proxy/proxy_log.h new file mode 100644 index 0000000..3f3be2c --- /dev/null +++ b/include/freerdp/server/proxy/proxy_log.h @@ -0,0 +1,53 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Proxy Server + * + * Copyright 2019 Mati Shabtay <matishabtay@gmail.com> + * Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com> + * Copyright 2019 Idan Freiberg <speidy@gmail.com> + * Copyright 2021 Armin Novak <anovak@thincast.com> + * Copyright 2021 Thincast Technologies GmbH + * + * 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_SERVER_PROXY_LOG_H +#define FREERDP_SERVER_PROXY_LOG_H + +#include <winpr/wlog.h> +#include <freerdp/log.h> + +#define PROXY_TAG(tag) FREERDP_TAG("proxy." tag) + +/* + * log format in proxy is: + * "[SessionID=%s]: Log message" + * SessionID is optional, but if they should be written to the log, + * that's the format. + */ + +/* log macros that prepends session id and function name tp the log message */ +#define PROXY_LOG_INFO(_tag, _context, _format, ...) \ + WLog_INFO(TAG, "[SessionID=%s]: " _format, \ + (_context && _context->pdata) ? _context->pdata->session_id : "null", ##__VA_ARGS__) +#define PROXY_LOG_ERR(_tag, _context, _format, ...) \ + WLog_ERR(TAG, "[SessionID=%s]: " _format, \ + (_context && _context->pdata) ? _context->pdata->session_id : "null", ##__VA_ARGS__) +#define PROXY_LOG_DBG(_tag, _context, _format, ...) \ + WLog_DBG(TAG, "[SessionID=%s]: " _format, \ + (_context && _context->pdata) ? _context->pdata->session_id : "null", ##__VA_ARGS__) +#define PROXY_LOG_WARN(_tag, _context, _format, ...) \ + WLog_WARN(TAG, "[SessionID=%s]: " _format, \ + (_context && _context->pdata) ? _context->pdata->session_id : "null", ##__VA_ARGS__) + +#endif /* FREERDP_SERVER_PROXY_LOG_H */ diff --git a/include/freerdp/server/proxy/proxy_modules_api.h b/include/freerdp/server/proxy/proxy_modules_api.h new file mode 100644 index 0000000..1887f90 --- /dev/null +++ b/include/freerdp/server/proxy/proxy_modules_api.h @@ -0,0 +1,241 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Proxy Server + * + * Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com> + * Copyright 2019 Idan Freiberg <speidy@gmail.com> + * Copyright 2021 Armin Novak <anovak@thincast.com> + * Copyright 2021 Thincast Technologies GmbH + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_SERVER_PROXY_MODULES_API_H +#define FREERDP_SERVER_PROXY_MODULES_API_H + +#include <winpr/winpr.h> +#include <winpr/stream.h> +#include <winpr/sspi.h> + +#include <freerdp/server/proxy/proxy_types.h> + +#define MODULE_TAG(module) "proxy.modules." module + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct proxy_data proxyData; + typedef struct proxy_module proxyModule; + typedef struct proxy_plugin proxyPlugin; + typedef struct proxy_plugins_manager proxyPluginsManager; + + /* hook callback. should return TRUE on success or FALSE on error. */ + typedef BOOL (*proxyHookFn)(proxyPlugin*, proxyData*, void*); + + /* + * Filter callback: + * It MUST return TRUE if the related event should be proxied, + * or FALSE if it should be ignored. + */ + typedef BOOL (*proxyFilterFn)(proxyPlugin*, proxyData*, void*); + + /* describes a plugin: name, description and callbacks to execute. + * + * This is public API, so always add new fields at the end of the struct to keep + * some backward compatibility. + */ + struct proxy_plugin + { + const char* name; /* 0: unique module name */ + const char* description; /* 1: module description */ + + UINT64 reserved1[32 - 2]; /* 2-32 */ + + BOOL (*PluginUnload)(proxyPlugin* plugin); /* 33 */ + UINT64 reserved2[66 - 34]; /* 34 - 65 */ + + /* proxy hooks. a module can set these function pointers to register hooks */ + proxyHookFn ClientInitConnect; /* 66 custom=rdpContext* */ + proxyHookFn ClientUninitConnect; /* 67 custom=rdpContext* */ + proxyHookFn ClientPreConnect; /* 68 custom=rdpContext* */ + proxyHookFn ClientPostConnect; /* 69 custom=rdpContext* */ + proxyHookFn ClientPostDisconnect; /* 70 custom=rdpContext* */ + proxyHookFn ClientX509Certificate; /* 71 custom=rdpContext* */ + proxyHookFn ClientLoginFailure; /* 72 custom=rdpContext* */ + proxyHookFn ClientEndPaint; /* 73 custom=rdpContext* */ + proxyHookFn ClientRedirect; /* 74 custom=rdpContext* */ + proxyHookFn ClientLoadChannels; /* 75 custom=rdpContext* */ + UINT64 reserved3[96 - 76]; /* 76-95 */ + + proxyHookFn ServerPostConnect; /* 96 custom=freerdp_peer* */ + proxyHookFn ServerPeerActivate; /* 97 custom=freerdp_peer* */ + proxyHookFn ServerChannelsInit; /* 98 custom=freerdp_peer* */ + proxyHookFn ServerChannelsFree; /* 99 custom=freerdp_peer* */ + proxyHookFn ServerSessionEnd; /* 100 custom=freerdp_peer* */ + proxyHookFn ServerSessionInitialize; /* 101 custom=freerdp_peer* */ + proxyHookFn ServerSessionStarted; /* 102 custom=freerdp_peer* */ + + UINT64 reserved4[128 - 103]; /* 103 - 127 */ + + /* proxy filters. a module can set these function pointers to register filters */ + proxyFilterFn KeyboardEvent; /* 128 */ + proxyFilterFn MouseEvent; /* 129 */ + proxyFilterFn ClientChannelData; /* 130 passthrough channels data */ + proxyFilterFn ServerChannelData; /* 131 passthrough channels data */ + proxyFilterFn DynamicChannelCreate; /* 132 passthrough drdynvc channel create data */ + proxyFilterFn ServerFetchTargetAddr; /* 133 */ + proxyFilterFn ServerPeerLogon; /* 134 */ + proxyFilterFn ChannelCreate; /* 135 passthrough drdynvc channel create data */ + proxyFilterFn UnicodeEvent; /* 136 */ + proxyFilterFn MouseExEvent; /* 137 */ + + /* proxy dynamic channel filters: + * + * - a function that returns the list of channels to intercept + * - a function to call with the data received + */ + proxyFilterFn DynChannelToIntercept; /* 138 */ + proxyFilterFn DynChannelIntercept; /* 139 */ + proxyFilterFn StaticChannelToIntercept; /* 140 */ + UINT64 reserved5[160 - 141]; /* 141-159 */ + + /* Runtime data fields */ + proxyPluginsManager* mgr; /* 160 */ /** Set during plugin registration */ + void* userdata; /* 161 */ /** Custom data provided with RegisterPlugin, memory managed + outside of plugin. */ + void* custom; /* 162 */ /** Custom configuration data, must be allocated in RegisterPlugin + and freed in PluginUnload */ + + UINT64 reserved6[192 - 163]; /* 163-191 Add some filler data to allow for new callbacks or + * fields without breaking API */ + }; + + /* + * Main API for use by external modules. + * Supports: + * - Registering a plugin. + * - Setting/getting plugin's per-session specific data. + * - Aborting a session. + */ + struct proxy_plugins_manager + { + /* 0 used for registering a fresh new proxy plugin. */ + BOOL (*RegisterPlugin)(struct proxy_plugins_manager* mgr, const proxyPlugin* plugin); + + /* 1 used for setting plugin's per-session info. */ + BOOL (*SetPluginData)(struct proxy_plugins_manager* mgr, const char*, proxyData*, void*); + + /* 2 used for getting plugin's per-session info. */ + void* (*GetPluginData)(struct proxy_plugins_manager* mgr, const char*, proxyData*); + + /* 3 used for aborting a session. */ + void (*AbortConnect)(struct proxy_plugins_manager* mgr, proxyData*); + + UINT64 reserved[128 - 4]; /* 4-127 reserved fields */ + }; + + typedef BOOL (*proxyModuleEntryPoint)(proxyPluginsManager* plugins_manager, void* userdata); + +/* filter events parameters */ +#define WINPR_PACK_PUSH +#include <winpr/pack.h> +typedef struct proxy_keyboard_event_info +{ + UINT16 flags; + UINT16 rdp_scan_code; +} proxyKeyboardEventInfo; + +typedef struct proxy_unicode_event_info +{ + UINT16 flags; + UINT16 code; +} proxyUnicodeEventInfo; + +typedef struct proxy_mouse_event_info +{ + UINT16 flags; + UINT16 x; + UINT16 y; +} proxyMouseEventInfo; + +typedef struct proxy_mouse_ex_event_info +{ + UINT16 flags; + UINT16 x; + UINT16 y; +} proxyMouseExEventInfo; + +typedef struct +{ + /* channel metadata */ + const char* channel_name; + UINT16 channel_id; + + /* actual data */ + const BYTE* data; + size_t data_len; + size_t total_size; + UINT32 flags; +} proxyChannelDataEventInfo; + +typedef struct +{ + /* out values */ + char* target_address; + UINT16 target_port; + + /* + * If this value is set to true by a plugin, target info will be fetched from config and proxy + * will connect any client to the same remote server. + */ + ProxyFetchTargetMethod fetch_method; +} proxyFetchTargetEventInfo; + +typedef struct server_peer_logon +{ + const SEC_WINNT_AUTH_IDENTITY* identity; + BOOL automatic; +} proxyServerPeerLogon; + +typedef struct dyn_channel_intercept_data +{ + const char* name; + UINT32 channelId; + wStream* data; + BOOL isBackData; + BOOL first; + BOOL last; + BOOL rewritten; + size_t packetSize; + PfChannelResult result; +} proxyDynChannelInterceptData; + +typedef struct dyn_channel_to_intercept_data +{ + const char* name; + UINT32 channelId; + BOOL intercept; +} proxyChannelToInterceptData; + +#define WINPR_PACK_POP +#include <winpr/pack.h> + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SERVER_PROXY_MODULES_API_H */ diff --git a/include/freerdp/server/proxy/proxy_server.h b/include/freerdp/server/proxy/proxy_server.h new file mode 100644 index 0000000..39e738f --- /dev/null +++ b/include/freerdp/server/proxy/proxy_server.h @@ -0,0 +1,115 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Proxy Server + * + * Copyright 2021 Armin Novak <armin.novak@thincast.com> + * Copyright 2021 Thincast Technologies GmbH + * + * 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_SERVER_PROXY_SERVER_H +#define FREERDP_SERVER_PROXY_SERVER_H + +#include <freerdp/api.h> +#include <freerdp/server/proxy/proxy_config.h> +#include <freerdp/server/proxy/proxy_modules_api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct proxy_server proxyServer; + + /** + * @brief pf_server_free Cleans up a (stopped) proxy server instance. + * + * @param server The proxy server to clean up. Might be NULL. + */ + FREERDP_API void pf_server_free(proxyServer* server); + + /** + * @brief pf_server_new Creates a new proxy server instance + * + * @param config The proxy server configuration to use. Must NOT be NULL. + * + * @return A new proxy server instance or NULL on failure. + */ + WINPR_ATTR_MALLOC(pf_server_free, 1) + FREERDP_API proxyServer* pf_server_new(const proxyConfig* config); + + /** + * @brief pf_server_add_module Allows registering proxy modules that are + * build-in instead of shipped as separate + * module loaded at runtime. + * + * @param server A proxy instance to add the module to. Must NOT be NULL + * @param ep The proxy entry function to add. Must NOT be NULL + * @param userdata Custom data for the module. May be NULL + * + * @return TRUE for success, FALSE otherwise. + */ + FREERDP_API BOOL pf_server_add_module(proxyServer* server, proxyModuleEntryPoint ep, + void* userdata); + + /** + * @brief pf_server_start Starts the proxy, binding the configured port. + * + * @param server The server instance. Must NOT be NULL. + * + * @return TRUE for success, FALSE on error + */ + FREERDP_API BOOL pf_server_start(proxyServer* server); + + /** + * @brief pf_server_start_from_socket Starts the proxy using an existing bound socket + * + * @param server The server instance. Must NOT be NULL. + * @param socket The bound socket to wait for events on. + * + * @return TRUE for success, FALSE on error + */ + FREERDP_API BOOL pf_server_start_from_socket(proxyServer* server, int socket); + + /** + * @brief pf_server_start_with_peer_socket Use existing peer socket + * + * @param server The server instance. Must NOT be NULL. + * @param socket Ready to use peer socket + * + * @return TRUE for success, FALSE on error + */ + FREERDP_API BOOL pf_server_start_with_peer_socket(proxyServer* server, int socket); + + /** + * @brief pf_server_stop Stops a server instance asynchronously. + * Can be called from any thread to stop a running server instance. + * @param server A pointer to the server instance to stop. May be NULL. + */ + FREERDP_API void pf_server_stop(proxyServer* server); + + /** + * @brief pf_server_run This (blocking) function runs the main loop of the + * proxy. + * + * @param server The server instance. Must NOT be NULL. + * + * @return TRUE for successful termination, FALSE otherwise. + */ + FREERDP_API BOOL pf_server_run(proxyServer* server); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SERVER_PROXY_SERVER_H */ diff --git a/include/freerdp/server/proxy/proxy_types.h b/include/freerdp/server/proxy/proxy_types.h new file mode 100644 index 0000000..98ee4b1 --- /dev/null +++ b/include/freerdp/server/proxy/proxy_types.h @@ -0,0 +1,57 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Proxy enum types + * + * Copyright 2023 Armin Novak <armin.novak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_SERVER_PROXY_TYPES_H +#define FREERDP_SERVER_PROXY_TYPES_H + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** @brief how is handled a channel */ + typedef enum + { + PF_UTILS_CHANNEL_NOT_HANDLED, /*!< channel not handled */ + PF_UTILS_CHANNEL_BLOCK, /*!< block and drop traffic on this channel */ + PF_UTILS_CHANNEL_PASSTHROUGH, /*!< pass traffic from this channel */ + PF_UTILS_CHANNEL_INTERCEPT /*!< inspect traffic from this channel */ + } pf_utils_channel_mode; + + /** @brief result of a channel treatment */ + typedef enum + { + PF_CHANNEL_RESULT_PASS, /*!< pass the packet as is */ + PF_CHANNEL_RESULT_DROP, /*!< drop the packet */ + PF_CHANNEL_RESULT_ERROR /*!< error during packet treatment */ + } PfChannelResult; + typedef enum + { + PROXY_FETCH_TARGET_METHOD_DEFAULT, + PROXY_FETCH_TARGET_METHOD_CONFIG, + PROXY_FETCH_TARGET_METHOD_LOAD_BALANCE_INFO, + PROXY_FETCH_TARGET_USE_CUSTOM_ADDR + } ProxyFetchTargetMethod; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SERVER_PROXY_TYPES_H */ diff --git a/include/freerdp/server/rail.h b/include/freerdp/server/rail.h new file mode 100644 index 0000000..0fdd1a3 --- /dev/null +++ b/include/freerdp/server/rail.h @@ -0,0 +1,157 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RAIL Virtual Channel Plugin + * + * Copyright 2019 Mati Shabtay <matishabtay@gmail.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_CHANNEL_RAIL_SERVER_RAIL_H +#define FREERDP_CHANNEL_RAIL_SERVER_RAIL_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/rail.h> +#include <freerdp/channels/rail.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_rail_server_context RailServerContext; + typedef struct s_rail_server_private RailServerPrivate; + + typedef UINT (*psRailStart)(RailServerContext* context); + typedef BOOL (*psRailStop)(RailServerContext* context); + + /* Client side callback types */ + typedef UINT (*psRailClientHandshake)(RailServerContext* context, + const RAIL_HANDSHAKE_ORDER* handshake); + typedef UINT (*psRailClientClientStatus)(RailServerContext* context, + const RAIL_CLIENT_STATUS_ORDER* clientStatus); + typedef UINT (*psRailClientExec)(RailServerContext* context, const RAIL_EXEC_ORDER* exec); + typedef UINT (*psRailClientSysparam)(RailServerContext* context, + const RAIL_SYSPARAM_ORDER* sysparam); + typedef UINT (*psRailClientActivate)(RailServerContext* context, + const RAIL_ACTIVATE_ORDER* activate); + typedef UINT (*psRailClientSysmenu)(RailServerContext* context, + const RAIL_SYSMENU_ORDER* sysmenu); + typedef UINT (*psRailClientSyscommand)(RailServerContext* context, + const RAIL_SYSCOMMAND_ORDER* syscommand); + typedef UINT (*psRailClientNotifyEvent)(RailServerContext* context, + const RAIL_NOTIFY_EVENT_ORDER* notifyEvent); + typedef UINT (*psRailClientGetAppidReq)(RailServerContext* context, + const RAIL_GET_APPID_REQ_ORDER* getAppidReq); + typedef UINT (*psRailClientWindowMove)(RailServerContext* context, + const RAIL_WINDOW_MOVE_ORDER* windowMove); + typedef UINT (*psRailClientSnapArrange)(RailServerContext* context, + const RAIL_SNAP_ARRANGE* snapArrange); + typedef UINT (*psRailClientLangbarInfo)(RailServerContext* context, + const RAIL_LANGBAR_INFO_ORDER* langbarInfo); + typedef UINT (*psRailClientLanguageImeInfo)(RailServerContext* context, + const RAIL_LANGUAGEIME_INFO_ORDER* languageImeInfo); + typedef UINT (*psRailClientCompartmentInfo)(RailServerContext* context, + const RAIL_COMPARTMENT_INFO_ORDER* compartmentInfo); + typedef UINT (*psRailClientCloak)(RailServerContext* context, const RAIL_CLOAK* cloak); + typedef UINT (*psRailClientTextScale)(RailServerContext* context, UINT32 TextScale); + typedef UINT (*psRailClientCaretBlinkRate)(RailServerContext* context, UINT32 CaretBlinkRate); + + /* Server side messages sending methods */ + typedef UINT (*psRailServerHandshake)(RailServerContext* context, + const RAIL_HANDSHAKE_ORDER* handshake); + typedef UINT (*psRailServerHandshakeEx)(RailServerContext* context, + const RAIL_HANDSHAKE_EX_ORDER* handshakeEx); + typedef UINT (*psRailServerSysparam)(RailServerContext* context, + const RAIL_SYSPARAM_ORDER* sysparam); + typedef UINT (*psRailServerLocalMoveSize)(RailServerContext* context, + const RAIL_LOCALMOVESIZE_ORDER* localMoveSize); + typedef UINT (*psRailServerMinMaxInfo)(RailServerContext* context, + const RAIL_MINMAXINFO_ORDER* minMaxInfo); + typedef UINT (*psRailServerTaskbarInfo)(RailServerContext* context, + const RAIL_TASKBAR_INFO_ORDER* taskbarInfo); + typedef UINT (*psRailServerLangbarInfo)(RailServerContext* context, + const RAIL_LANGBAR_INFO_ORDER* langbarInfo); + typedef UINT (*psRailServerExecResult)(RailServerContext* context, + const RAIL_EXEC_RESULT_ORDER* execResult); + typedef UINT (*psRailServerGetAppidResp)(RailServerContext* context, + const RAIL_GET_APPID_RESP_ORDER* getAppIdResp); + typedef UINT (*psRailServerZOrderSync)(RailServerContext* context, + const RAIL_ZORDER_SYNC* zOrderSync); + typedef UINT (*psRailServerCloak)(RailServerContext* context, const RAIL_CLOAK* cloak); + typedef UINT (*psRailServerPowerDisplayRequest)( + RailServerContext* context, const RAIL_POWER_DISPLAY_REQUEST* PowerDisplayRequest); + typedef UINT (*psRailServerGetAppidRespEx)(RailServerContext* context, + const RAIL_GET_APPID_RESP_EX* GetAppidRespEx); + + struct s_rail_server_context + { + HANDLE vcm; + void* custom; + + psRailStart Start; + psRailStop Stop; + + /* Callbacks from client */ + psRailClientHandshake ClientHandshake; + psRailClientClientStatus ClientClientStatus; + psRailClientExec ClientExec; + psRailClientSysparam ClientSysparam; + psRailClientActivate ClientActivate; + psRailClientSysmenu ClientSysmenu; + psRailClientSyscommand ClientSyscommand; + psRailClientNotifyEvent ClientNotifyEvent; + psRailClientGetAppidReq ClientGetAppidReq; + psRailClientWindowMove ClientWindowMove; + psRailClientSnapArrange ClientSnapArrange; + psRailClientLangbarInfo ClientLangbarInfo; + psRailClientLanguageImeInfo ClientLanguageImeInfo; + psRailClientCompartmentInfo ClientCompartmentInfo; + psRailClientCloak ClientCloak; + psRailClientTextScale ClientTextScale; + psRailClientCaretBlinkRate ClientCaretBlinkRate; + + /* Methods for sending server side messages */ + psRailServerHandshake ServerHandshake; + psRailServerHandshakeEx ServerHandshakeEx; + psRailServerSysparam ServerSysparam; + psRailServerLocalMoveSize ServerLocalMoveSize; + psRailServerMinMaxInfo ServerMinMaxInfo; + psRailServerTaskbarInfo ServerTaskbarInfo; + psRailServerLangbarInfo ServerLangbarInfo; + psRailServerExecResult ServerExecResult; + psRailServerZOrderSync ServerZOrderSync; + psRailServerCloak ServerCloak; + psRailServerPowerDisplayRequest ServerPowerDisplayRequest; + psRailServerGetAppidResp ServerGetAppidResp; + psRailServerGetAppidRespEx ServerGetAppidRespEx; + + RailServerPrivate* priv; + rdpContext* rdpcontext; + }; + + FREERDP_API void rail_server_context_free(RailServerContext* context); + + WINPR_ATTR_MALLOC(rail_server_context_free, 1) + FREERDP_API RailServerContext* rail_server_context_new(HANDLE vcm); + + FREERDP_API UINT rail_server_handle_messages(RailServerContext* context); + FREERDP_API void rail_server_set_handshake_ex_flags(RailServerContext* context, DWORD flags); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RAIL_SERVER_RAIL_H */ diff --git a/include/freerdp/server/rdpdr.h b/include/freerdp/server/rdpdr.h new file mode 100644 index 0000000..8f01f1f --- /dev/null +++ b/include/freerdp/server/rdpdr.h @@ -0,0 +1,227 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Device Redirection Virtual Channel Server Interface + * + * Copyright 2014 Dell Software <Mike.McDonald@software.dell.com> + * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_RDPDR_SERVER_RDPDR_H +#define FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/channels/wtsvc.h> +#include <freerdp/channels/rdpdr.h> +#include <freerdp/utils/rdpdr_utils.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Server Interface + */ + + typedef struct s_rdpdr_server_context RdpdrServerContext; + typedef struct s_rdpdr_server_private RdpdrServerPrivate; + + typedef struct + { + UINT16 Component; + UINT16 PacketId; + } RDPDR_HEADER; + +#ifndef __MINGW32__ +typedef struct +{ + UINT32 NextEntryOffset; + UINT32 FileIndex; + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + LARGE_INTEGER EndOfFile; + LARGE_INTEGER AllocationSize; + UINT32 FileAttributes; + char FileName[512]; +} FILE_DIRECTORY_INFORMATION; +#endif + +typedef UINT (*psRdpdrStart)(RdpdrServerContext* context); +typedef UINT (*psRdpdrStop)(RdpdrServerContext* context); + +typedef UINT (*psRdpdrCapablityPDU)(RdpdrServerContext* context, + const RDPDR_CAPABILITY_HEADER* header, size_t size, + const BYTE* data); +typedef UINT (*psRdpdrReceivePDU)(RdpdrServerContext* context, const RDPDR_HEADER* header, + UINT error); +typedef UINT (*psRdpdrReceiveAnnounceResponse)(RdpdrServerContext* context, UINT16 VersionMajor, + UINT16 VersionMinor, UINT32 ClientId); +typedef UINT (*psRdpdrSendServerAnnounce)(RdpdrServerContext* context); +typedef UINT (*psRdpdrReceiveDeviceAnnounce)(RdpdrServerContext* context, + const RdpdrDevice* device); +typedef UINT (*psRdpdrReceiveDeviceRemove)(RdpdrServerContext* context, UINT32 deviceId, + const RdpdrDevice* device); +typedef UINT (*psRdpdrReceiveClientNameRequest)(RdpdrServerContext* context, size_t ComputerNameLen, + const char* name); + +typedef UINT (*psRdpdrDriveCreateDirectory)(RdpdrServerContext* context, void* callbackData, + UINT32 deviceId, const char* path); +typedef UINT (*psRdpdrDriveDeleteDirectory)(RdpdrServerContext* context, void* callbackData, + UINT32 deviceId, const char* path); +typedef UINT (*psRdpdrDriveQueryDirectory)(RdpdrServerContext* context, void* callbackData, + UINT32 deviceId, const char* path); +typedef UINT (*psRdpdrDriveOpenFile)(RdpdrServerContext* context, void* callbackData, + UINT32 deviceId, const char* path, UINT32 desiredAccess, + UINT32 createDisposition); +typedef UINT (*psRdpdrDriveReadFile)(RdpdrServerContext* context, void* callbackData, + UINT32 deviceId, UINT32 fileId, UINT32 length, UINT32 offset); +typedef UINT (*psRdpdrDriveWriteFile)(RdpdrServerContext* context, void* callbackData, + UINT32 deviceId, UINT32 fileId, const char* buffer, + UINT32 length, UINT32 offset); +typedef UINT (*psRdpdrDriveCloseFile)(RdpdrServerContext* context, void* callbackData, + UINT32 deviceId, UINT32 fileId); +typedef UINT (*psRdpdrDriveDeleteFile)(RdpdrServerContext* context, void* callbackData, + UINT32 deviceId, const char* path); +typedef UINT (*psRdpdrDriveRenameFile)(RdpdrServerContext* context, void* callbackData, + UINT32 deviceId, const char* oldPath, const char* newPath); + +typedef void (*psRdpdrOnDriveCreateDirectoryComplete)(RdpdrServerContext* context, + void* callbackData, UINT32 ioStatus); +typedef void (*psRdpdrOnDriveDeleteDirectoryComplete)(RdpdrServerContext* context, + void* callbackData, UINT32 ioStatus); +typedef void (*psRdpdrOnDriveQueryDirectoryComplete)(RdpdrServerContext* context, + void* callbackData, UINT32 ioStatus, + FILE_DIRECTORY_INFORMATION* fdi); +typedef void (*psRdpdrOnDriveOpenFileComplete)(RdpdrServerContext* context, void* callbackData, + UINT32 ioStatus, UINT32 deviceId, UINT32 fileId); +typedef void (*psRdpdrOnDriveReadFileComplete)(RdpdrServerContext* context, void* callbackData, + UINT32 ioStatus, const char* buffer, UINT32 length); +typedef void (*psRdpdrOnDriveWriteFileComplete)(RdpdrServerContext* context, void* callbackData, + UINT32 ioStatus, UINT32 bytesWritten); +typedef void (*psRdpdrOnDriveCloseFileComplete)(RdpdrServerContext* context, void* callbackData, + UINT32 ioStatus); +typedef void (*psRdpdrOnDriveDeleteFileComplete)(RdpdrServerContext* context, void* callbackData, + UINT32 ioStatus); +typedef void (*psRdpdrOnDriveRenameFileComplete)(RdpdrServerContext* context, void* callbackData, + UINT32 ioStatus); + +typedef UINT (*psRdpdrOnDeviceCreate)(RdpdrServerContext* context, const RdpdrDevice* device); +typedef UINT (*psRdpdrOnDeviceDelete)(RdpdrServerContext* context, UINT32 deviceId); + +struct s_rdpdr_server_context +{ + HANDLE vcm; + + psRdpdrStart Start; + psRdpdrStop Stop; + + RdpdrServerPrivate* priv; + + /* Server self-defined pointer. */ + void* data; + + /**< Server supported redirections. + * initially used to determine which redirections are supported by the + * server in the server capability, later on updated with what the client + * actually wants to have supported. + * + * Use the \b RDPDR_DTYP_* defines as a mask to check. + */ + UINT16 supported; + + /*** RDPDR message intercept callbacks */ + psRdpdrCapablityPDU ReceiveCaps; /**< Called for each received capability */ + psRdpdrCapablityPDU SendCaps; /**< Called for each capability to be sent */ + psRdpdrReceivePDU ReceivePDU; /**< Called after a RDPDR pdu was received and parsed */ + psRdpdrSendServerAnnounce + SendServerAnnounce; /**< Called before the server sends the announce message */ + psRdpdrReceiveAnnounceResponse + ReceiveAnnounceResponse; /**< Called after the client announce response is received */ + psRdpdrReceiveClientNameRequest + ReceiveClientNameRequest; /**< Called after a client name request is received */ + psRdpdrReceiveDeviceAnnounce + ReceiveDeviceAnnounce; /** < Called after a new device request was received but before the + device is added */ + psRdpdrReceiveDeviceRemove ReceiveDeviceRemove; /**< Called after a new device request was + received, but before it is removed */ + + /*** Drive APIs called by the server. ***/ + psRdpdrDriveCreateDirectory DriveCreateDirectory; + psRdpdrDriveDeleteDirectory DriveDeleteDirectory; + psRdpdrDriveQueryDirectory DriveQueryDirectory; + psRdpdrDriveOpenFile DriveOpenFile; + psRdpdrDriveReadFile DriveReadFile; + psRdpdrDriveWriteFile DriveWriteFile; + psRdpdrDriveCloseFile DriveCloseFile; + psRdpdrDriveDeleteFile DriveDeleteFile; + psRdpdrDriveRenameFile DriveRenameFile; + + /*** Drive callbacks registered by the server. ***/ + psRdpdrOnDeviceCreate OnDriveCreate; /**< Called for devices of type \b RDPDR_DTYP_FILESYSTEM + after \b ReceiveDeviceAnnounce */ + psRdpdrOnDeviceDelete OnDriveDelete; /**< Called for devices of type \b RDPDR_DTYP_FILESYSTEM + after \b ReceiveDeviceRemove */ + psRdpdrOnDriveCreateDirectoryComplete OnDriveCreateDirectoryComplete; + psRdpdrOnDriveDeleteDirectoryComplete OnDriveDeleteDirectoryComplete; + psRdpdrOnDriveQueryDirectoryComplete OnDriveQueryDirectoryComplete; + psRdpdrOnDriveOpenFileComplete OnDriveOpenFileComplete; + psRdpdrOnDriveReadFileComplete OnDriveReadFileComplete; + psRdpdrOnDriveWriteFileComplete OnDriveWriteFileComplete; + psRdpdrOnDriveCloseFileComplete OnDriveCloseFileComplete; + psRdpdrOnDriveDeleteFileComplete OnDriveDeleteFileComplete; + psRdpdrOnDriveRenameFileComplete OnDriveRenameFileComplete; + + /*** Serial Port callbacks registered by the server. ***/ + psRdpdrOnDeviceCreate OnSerialPortCreate; /**< Called for devices of type \b RDPDR_DTYP_SERIAL + after \b ReceiveDeviceAnnounce */ + psRdpdrOnDeviceDelete OnSerialPortDelete; /**< Called for devices of type \b RDPDR_DTYP_SERIAL + after \b ReceiveDeviceRemove */ + + /*** Parallel Port callbacks registered by the server. ***/ + psRdpdrOnDeviceCreate OnParallelPortCreate; /**< Called for devices of type \b + RDPDR_DTYP_PARALLEL after \b ReceiveDeviceAnnounce */ + psRdpdrOnDeviceDelete OnParallelPortDelete; /**< Called for devices of type \b + RDPDR_DTYP_PARALLEL after \b ReceiveDeviceRemove */ + + /*** Printer callbacks registered by the server. ***/ + psRdpdrOnDeviceCreate OnPrinterCreate; /**< Called for devices of type RDPDR_DTYP_PRINT after \b + ReceiveDeviceAnnounce */ + psRdpdrOnDeviceDelete OnPrinterDelete; /**< Called for devices of type RDPDR_DTYP_PRINT after \b + ReceiveDeviceRemove */ + + /*** Smartcard callbacks registered by the server. ***/ + psRdpdrOnDeviceCreate OnSmartcardCreate; /**< Called for devices of type RDPDR_DTYP_SMARTCARD + after \b ReceiveDeviceAnnounce */ + psRdpdrOnDeviceDelete OnSmartcardDelete; /**< Called for devices of type RDPDR_DTYP_SMARTCARD + after \b ReceiveDeviceRemove */ + + rdpContext* rdpcontext; +}; + +FREERDP_API void rdpdr_server_context_free(RdpdrServerContext* context); + +WINPR_ATTR_MALLOC(rdpdr_server_context_free, 1) +FREERDP_API RdpdrServerContext* rdpdr_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RDPDR_SERVER_RDPDR_H */ diff --git a/include/freerdp/server/rdpecam-enumerator.h b/include/freerdp/server/rdpecam-enumerator.h new file mode 100644 index 0000000..800caf8 --- /dev/null +++ b/include/freerdp/server/rdpecam-enumerator.h @@ -0,0 +1,137 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Video Capture Virtual Channel Extension + * + * Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_CAM_DEV_ENUM_SERVER_CAM_DEV_ENUM_H +#define FREERDP_CHANNEL_CAM_DEV_ENUM_SERVER_CAM_DEV_ENUM_H + +#include <freerdp/channels/rdpecam.h> +#include <freerdp/channels/wtsvc.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_cam_dev_enum_server_context CamDevEnumServerContext; + + typedef UINT (*psCamDevEnumServerServerOpen)(CamDevEnumServerContext* context); + typedef UINT (*psCamDevEnumServerServerClose)(CamDevEnumServerContext* context); + + typedef BOOL (*psCamDevEnumServerServerChannelIdAssigned)(CamDevEnumServerContext* context, + UINT32 channelId); + + typedef UINT (*psCamDevEnumServerServerInitialize)(CamDevEnumServerContext* context, + BOOL externalThread); + typedef UINT (*psCamDevEnumServerServerPoll)(CamDevEnumServerContext* context); + typedef BOOL (*psCamDevEnumServerServerChannelHandle)(CamDevEnumServerContext* context, + HANDLE* handle); + + typedef UINT (*psCamDevEnumServerServerSelectVersionRequest)( + CamDevEnumServerContext* context, const CAM_SELECT_VERSION_REQUEST* selectVersionRequest); + typedef UINT (*psCamDevEnumServerServerSelectVersionResponse)( + CamDevEnumServerContext* context, const CAM_SELECT_VERSION_RESPONSE* selectVersionResponse); + + typedef UINT (*psCamDevEnumServerServerDeviceAddedNotification)( + CamDevEnumServerContext* context, + const CAM_DEVICE_ADDED_NOTIFICATION* deviceAddedNotification); + typedef UINT (*psCamDevEnumServerServerDeviceRemovedNotification)( + CamDevEnumServerContext* context, + const CAM_DEVICE_REMOVED_NOTIFICATION* deviceRemovedNotification); + + struct s_cam_dev_enum_server_context + { + HANDLE vcm; + + /* Server self-defined pointer. */ + void* userdata; + + /*** APIs called by the server. ***/ + + /** + * Optional: Set thread handling. + * When externalThread=TRUE, the application is responsible to call + * Poll() periodically to process channel events. + * + * Defaults to externalThread=FALSE + */ + psCamDevEnumServerServerInitialize Initialize; + + /** + * Open the camera device enumerator channel. + */ + psCamDevEnumServerServerOpen Open; + + /** + * Close the camera device enumerator channel. + */ + psCamDevEnumServerServerClose Close; + + /** + * Poll + * When externalThread=TRUE, call Poll() periodically from your main loop. + * If externalThread=FALSE do not call. + */ + psCamDevEnumServerServerPoll Poll; + + /** + * Retrieve the channel handle for use in conjunction with Poll(). + * If externalThread=FALSE do not call. + */ + psCamDevEnumServerServerChannelHandle ChannelHandle; + + /* + * Send a Select Version Response PDU. + */ + psCamDevEnumServerServerSelectVersionResponse SelectVersionResponse; + + /*** Callbacks registered by the server. ***/ + + /** + * Callback, when the channel got its id assigned. + */ + psCamDevEnumServerServerChannelIdAssigned ChannelIdAssigned; + + /** + * Callback for the Select Version Request PDU. + */ + psCamDevEnumServerServerSelectVersionRequest SelectVersionRequest; + + /** + * Callback for the Device Added Notification PDU. + */ + psCamDevEnumServerServerDeviceAddedNotification DeviceAddedNotification; + + /** + * Callback for the Device Removed Notification PDU. + */ + psCamDevEnumServerServerDeviceRemovedNotification DeviceRemovedNotification; + + rdpContext* rdpcontext; + }; + + FREERDP_API void cam_dev_enum_server_context_free(CamDevEnumServerContext* context); + + WINPR_ATTR_MALLOC(cam_dev_enum_server_context_free, 1) + FREERDP_API CamDevEnumServerContext* cam_dev_enum_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_CAM_DEV_ENUM_SERVER_CAM_DEV_ENUM_H */ diff --git a/include/freerdp/server/rdpecam.h b/include/freerdp/server/rdpecam.h new file mode 100644 index 0000000..dd18494 --- /dev/null +++ b/include/freerdp/server/rdpecam.h @@ -0,0 +1,284 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Video Capture Virtual Channel Extension + * + * Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_CAMERA_DEVICE_SERVER_CAMERA_DEVICE_H +#define FREERDP_CHANNEL_CAMERA_DEVICE_SERVER_CAMERA_DEVICE_H + +#include <freerdp/channels/rdpecam.h> +#include <freerdp/channels/wtsvc.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct camera_device_server_context CameraDeviceServerContext; + + typedef UINT (*psCameraDeviceServerOpen)(CameraDeviceServerContext* context); + typedef UINT (*psCameraDeviceServerClose)(CameraDeviceServerContext* context); + + typedef BOOL (*psCameraDeviceServerChannelIdAssigned)(CameraDeviceServerContext* context, + UINT32 channelId); + + typedef UINT (*psCameraDeviceServerInitialize)(CameraDeviceServerContext* context, + BOOL externalThread); + typedef UINT (*psCameraDeviceServerPoll)(CameraDeviceServerContext* context); + typedef BOOL (*psCameraDeviceServerChannelHandle)(CameraDeviceServerContext* context, + HANDLE* handle); + + typedef UINT (*psCameraDeviceServerSuccessResponse)( + CameraDeviceServerContext* context, const CAM_SUCCESS_RESPONSE* successResponse); + typedef UINT (*psCameraDeviceServerErrorResponse)(CameraDeviceServerContext* context, + const CAM_ERROR_RESPONSE* errorResponse); + + typedef UINT (*psCameraDeviceServerActivateDeviceRequest)( + CameraDeviceServerContext* context, + const CAM_ACTIVATE_DEVICE_REQUEST* activateDeviceRequest); + typedef UINT (*psCameraDeviceServerDeactivateDeviceRequest)( + CameraDeviceServerContext* context, + const CAM_DEACTIVATE_DEVICE_REQUEST* deactivateDeviceRequest); + + typedef UINT (*psCameraDeviceServerStreamListRequest)( + CameraDeviceServerContext* context, const CAM_STREAM_LIST_REQUEST* streamListRequest); + typedef UINT (*psCameraDeviceServerStreamListResponse)( + CameraDeviceServerContext* context, const CAM_STREAM_LIST_RESPONSE* streamListResponse); + + typedef UINT (*psCameraDeviceServerMediaTypeListRequest)( + CameraDeviceServerContext* context, + const CAM_MEDIA_TYPE_LIST_REQUEST* mediaTypeListRequest); + typedef UINT (*psCameraDeviceServerMediaTypeListResponse)( + CameraDeviceServerContext* context, + const CAM_MEDIA_TYPE_LIST_RESPONSE* mediaTypeListResponse); + + typedef UINT (*psCameraDeviceServerCurrentMediaTypeRequest)( + CameraDeviceServerContext* context, + const CAM_CURRENT_MEDIA_TYPE_REQUEST* currentMediaTypeRequest); + typedef UINT (*psCameraDeviceServerCurrentMediaTypeResponse)( + CameraDeviceServerContext* context, + const CAM_CURRENT_MEDIA_TYPE_RESPONSE* currentMediaTypeResponse); + + typedef UINT (*psCameraDeviceServerStartStreamsRequest)( + CameraDeviceServerContext* context, const CAM_START_STREAMS_REQUEST* startStreamsRequest); + typedef UINT (*psCameraDeviceServerStopStreamsRequest)( + CameraDeviceServerContext* context, const CAM_STOP_STREAMS_REQUEST* stopStreamsRequest); + + typedef UINT (*psCameraDeviceServerSampleRequest)(CameraDeviceServerContext* context, + const CAM_SAMPLE_REQUEST* sampleRequest); + typedef UINT (*psCameraDeviceServerSampleResponse)(CameraDeviceServerContext* context, + const CAM_SAMPLE_RESPONSE* sampleResponse); + typedef UINT (*psCameraDeviceServerSampleErrorResponse)( + CameraDeviceServerContext* context, const CAM_SAMPLE_ERROR_RESPONSE* sampleErrorResponse); + + typedef UINT (*psCameraDeviceServerPropertyListRequest)( + CameraDeviceServerContext* context, const CAM_PROPERTY_LIST_REQUEST* propertyListRequest); + typedef UINT (*psCameraDeviceServerPropertyListResponse)( + CameraDeviceServerContext* context, const CAM_PROPERTY_LIST_RESPONSE* propertyListResponse); + + typedef UINT (*psCameraDeviceServerPropertyValueRequest)( + CameraDeviceServerContext* context, const CAM_PROPERTY_VALUE_REQUEST* propertyValueRequest); + typedef UINT (*psCameraDeviceServerPropertyValueResponse)( + CameraDeviceServerContext* context, + const CAM_PROPERTY_VALUE_RESPONSE* propertyValueResponse); + + typedef UINT (*psCameraDeviceServerSetPropertyValueRequest)( + CameraDeviceServerContext* context, + const CAM_SET_PROPERTY_VALUE_REQUEST* setPropertyValueRequest); + + struct camera_device_server_context + { + HANDLE vcm; + + /* Server self-defined pointer. */ + void* userdata; + + /** + * Name of the virtual channel. Pointer owned by the CameraDeviceServerContext, + * meaning camera_device_server_context_free() takes care of freeing the pointer. + * + * Server implementations should sanitize the virtual channel name for invalid + * names, like names for other known channels + * ("ECHO", "AUDIO_PLAYBACK_DVC", etc.) + */ + char* virtualChannelName; + + /** + * Protocol version to be used. Every sent server to client PDU has the + * version value in the Header set to the following value. + */ + BYTE protocolVersion; + + /*** APIs called by the server. ***/ + + /** + * Optional: Set thread handling. + * When externalThread=TRUE, the application is responsible to call + * Poll() periodically to process channel events. + * + * Defaults to externalThread=FALSE + */ + psCameraDeviceServerInitialize Initialize; + + /** + * Open the camera device channel. + */ + psCameraDeviceServerOpen Open; + + /** + * Close the camera device channel. + */ + psCameraDeviceServerClose Close; + + /** + * Poll + * When externalThread=TRUE, call Poll() periodically from your main loop. + * If externalThread=FALSE do not call. + */ + psCameraDeviceServerPoll Poll; + + /** + * Retrieve the channel handle for use in conjunction with Poll(). + * If externalThread=FALSE do not call. + */ + psCameraDeviceServerChannelHandle ChannelHandle; + + /** + * For the following server to client PDUs, + * the message header does not have to be set. + */ + + /** + * Send a Activate Device Request PDU. + */ + psCameraDeviceServerActivateDeviceRequest ActivateDeviceRequest; + + /** + * Send a Deactivate Device Request PDU. + */ + psCameraDeviceServerDeactivateDeviceRequest DeactivateDeviceRequest; + + /** + * Send a Stream List Request PDU. + */ + psCameraDeviceServerStreamListRequest StreamListRequest; + + /** + * Send a Media Type List Request PDU. + */ + psCameraDeviceServerMediaTypeListRequest MediaTypeListRequest; + + /** + * Send a Current Media Type Request PDU. + */ + psCameraDeviceServerCurrentMediaTypeRequest CurrentMediaTypeRequest; + + /** + * Send a Start Streams Request PDU. + */ + psCameraDeviceServerStartStreamsRequest StartStreamsRequest; + + /** + * Send a Stop Streams Request PDU. + */ + psCameraDeviceServerStopStreamsRequest StopStreamsRequest; + + /** + * Send a Sample Request PDU. + */ + psCameraDeviceServerSampleRequest SampleRequest; + + /** + * Send a Property List Request PDU. + */ + psCameraDeviceServerPropertyListRequest PropertyListRequest; + + /** + * Send a Property Value Request PDU. + */ + psCameraDeviceServerPropertyValueRequest PropertyValueRequest; + + /** + * Send a Set Property Value Request PDU. + */ + psCameraDeviceServerSetPropertyValueRequest SetPropertyValueRequest; + + /*** Callbacks registered by the server. ***/ + + /** + * Callback, when the channel got its id assigned. + */ + psCameraDeviceServerChannelIdAssigned ChannelIdAssigned; + + /** + * Callback for the Success Response PDU. + */ + psCameraDeviceServerSuccessResponse SuccessResponse; + + /** + * Callback for the Error Response PDU. + */ + psCameraDeviceServerErrorResponse ErrorResponse; + + /** + * Callback for the Stream List Response PDU. + */ + psCameraDeviceServerStreamListResponse StreamListResponse; + + /** + * Callback for the Media Type List Response PDU. + */ + psCameraDeviceServerMediaTypeListResponse MediaTypeListResponse; + + /** + * Callback for the Current Media Type Response PDU. + */ + psCameraDeviceServerCurrentMediaTypeResponse CurrentMediaTypeResponse; + + /** + * Callback for the Sample Response PDU. + */ + psCameraDeviceServerSampleResponse SampleResponse; + + /** + * Callback for the Sample Error Response PDU. + */ + psCameraDeviceServerSampleErrorResponse SampleErrorResponse; + + /** + * Callback for the Property List Response PDU. + */ + psCameraDeviceServerPropertyListResponse PropertyListResponse; + + /** + * Callback for the Property Value Response PDU. + */ + psCameraDeviceServerPropertyValueResponse PropertyValueResponse; + + rdpContext* rdpcontext; + }; + + FREERDP_API void camera_device_server_context_free(CameraDeviceServerContext* context); + + WINPR_ATTR_MALLOC(camera_device_server_context_free, 1) + FREERDP_API CameraDeviceServerContext* camera_device_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_CAMERA_DEVICE_SERVER_CAMERA_DEVICE_H */ diff --git a/include/freerdp/server/rdpei.h b/include/freerdp/server/rdpei.h new file mode 100644 index 0000000..215f7f1 --- /dev/null +++ b/include/freerdp/server/rdpei.h @@ -0,0 +1,81 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Extended Input channel server-side definitions + * + * Copyright 2014 Thincast Technologies Gmbh. + * Copyright 2014 David FORT <contact@hardening-consulting.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_RDPEI_SERVER_H +#define FREERDP_CHANNEL_RDPEI_SERVER_H + +#include <freerdp/channels/wtsvc.h> +#include <freerdp/channels/rdpei.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_rdpei_server_context RdpeiServerContext; + typedef struct s_rdpei_server_private RdpeiServerPrivate; + + struct s_rdpei_server_context + { + HANDLE vcm; + + RdpeiServerPrivate* priv; + + UINT32 clientVersion; + UINT16 maxTouchPoints; + UINT32 protocolFlags; + + /** callbacks that can be set by the user */ + UINT (*onClientReady)(RdpeiServerContext* context); + UINT (*onTouchEvent)(RdpeiServerContext* context, const RDPINPUT_TOUCH_EVENT* touchEvent); + UINT (*onPenEvent)(RdpeiServerContext* context, const RDPINPUT_PEN_EVENT* penEvent); + UINT (*onTouchReleased)(RdpeiServerContext* context, BYTE contactId); + + void* user_data; /* user data, useful for callbacks */ + + /** + * Callback, when the channel got its id assigned. + */ + BOOL (*onChannelIdAssigned)(RdpeiServerContext* context, UINT32 channelId); + }; + + FREERDP_API void rdpei_server_context_free(RdpeiServerContext* context); + + WINPR_ATTR_MALLOC(rdpei_server_context_free, 1) + FREERDP_API RdpeiServerContext* rdpei_server_context_new(HANDLE vcm); + + FREERDP_API void rdpei_server_context_reset(RdpeiServerContext* context); + + FREERDP_API HANDLE rdpei_server_get_event_handle(RdpeiServerContext* context); + FREERDP_API UINT rdpei_server_init(RdpeiServerContext* context); + FREERDP_API UINT rdpei_server_handle_messages(RdpeiServerContext* context); + + FREERDP_API UINT rdpei_server_send_sc_ready(RdpeiServerContext* context, UINT32 version, + UINT32 features); + FREERDP_API UINT rdpei_server_suspend(RdpeiServerContext* context); + FREERDP_API UINT rdpei_server_resume(RdpeiServerContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RDPEI_SERVER_H */ diff --git a/include/freerdp/server/rdpemsc.h b/include/freerdp/server/rdpemsc.h new file mode 100644 index 0000000..f1ce98a --- /dev/null +++ b/include/freerdp/server/rdpemsc.h @@ -0,0 +1,132 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Mouse Cursor Virtual Channel Extension + * + * Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_RDPEMSC_SERVER_RDPEMSC_H +#define FREERDP_CHANNEL_RDPEMSC_SERVER_RDPEMSC_H + +#include <freerdp/channels/rdpemsc.h> +#include <freerdp/channels/wtsvc.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_mouse_cursor_server_context MouseCursorServerContext; + + typedef UINT (*psMouseCursorServerOpen)(MouseCursorServerContext* context); + typedef UINT (*psMouseCursorServerClose)(MouseCursorServerContext* context); + + typedef BOOL (*psMouseCursorServerChannelIdAssigned)(MouseCursorServerContext* context, + UINT32 channelId); + + typedef UINT (*psMouseCursorServerInitialize)(MouseCursorServerContext* context, + BOOL externalThread); + typedef UINT (*psMouseCursorServerPoll)(MouseCursorServerContext* context); + typedef BOOL (*psMouseCursorServerChannelHandle)(MouseCursorServerContext* context, + HANDLE* handle); + + typedef UINT (*psMouseCursorServerCapsAdvertise)( + MouseCursorServerContext* context, + const RDP_MOUSE_CURSOR_CAPS_ADVERTISE_PDU* capsAdvertise); + typedef UINT (*psMouseCursorServerCapsConfirm)( + MouseCursorServerContext* context, const RDP_MOUSE_CURSOR_CAPS_CONFIRM_PDU* capsConfirm); + + typedef UINT (*psMouseCursorServerMouseptrUpdate)( + MouseCursorServerContext* context, + const RDP_MOUSE_CURSOR_MOUSEPTR_UPDATE_PDU* mouseptrUpdate); + + struct s_mouse_cursor_server_context + { + HANDLE vcm; + + /* Server self-defined pointer. */ + void* userdata; + + /*** APIs called by the server. ***/ + + /** + * Optional: Set thread handling. + * When externalThread=TRUE, the application is responsible to call + * Poll() periodically to process channel events. + * + * Defaults to externalThread=FALSE + */ + psMouseCursorServerInitialize Initialize; + + /** + * Open the mouse cursor channel. + */ + psMouseCursorServerOpen Open; + + /** + * Close the mouse cursor channel. + */ + psMouseCursorServerClose Close; + + /** + * Poll + * When externalThread=TRUE, call Poll() periodically from your main loop. + * If externalThread=FALSE do not call. + */ + psMouseCursorServerPoll Poll; + + /** + * Retrieve the channel handle for use in conjunction with Poll(). + * If externalThread=FALSE do not call. + */ + psMouseCursorServerChannelHandle ChannelHandle; + + /* All PDUs sent by the server don't require the pduType to be set */ + + /* + * Send a CapsConfirm PDU. + */ + psMouseCursorServerCapsConfirm CapsConfirm; + + /* + * Send a MouseptrUpdate PDU. + */ + psMouseCursorServerMouseptrUpdate MouseptrUpdate; + + /*** Callbacks registered by the server. ***/ + + /** + * Callback, when the channel got its id assigned. + */ + psMouseCursorServerChannelIdAssigned ChannelIdAssigned; + + /** + * Callback for the CapsAdvertise PDU. + */ + psMouseCursorServerCapsAdvertise CapsAdvertise; + + rdpContext* rdpcontext; + }; + + FREERDP_API void mouse_cursor_server_context_free(MouseCursorServerContext* context); + + WINPR_ATTR_MALLOC(mouse_cursor_server_context_free, 1) + FREERDP_API MouseCursorServerContext* mouse_cursor_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RDPEMSC_SERVER_RDPEMSC_H */ diff --git a/include/freerdp/server/rdpgfx.h b/include/freerdp/server/rdpgfx.h new file mode 100644 index 0000000..262bb38 --- /dev/null +++ b/include/freerdp/server/rdpgfx.h @@ -0,0 +1,156 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Graphics Pipeline Extension + * + * Copyright 2016 Jiang Zihao <zihao.jiang@yahoo.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_CHANNEL_RDPGFX_SERVER_RDPGFX_H +#define FREERDP_CHANNEL_RDPGFX_SERVER_RDPGFX_H + +#include <freerdp/channels/rdpgfx.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_rdpgfx_server_context RdpgfxServerContext; + typedef struct s_rdpgfx_server_private RdpgfxServerPrivate; + + typedef BOOL (*psRdpgfxServerOpen)(RdpgfxServerContext* context); + typedef BOOL (*psRdpgfxServerClose)(RdpgfxServerContext* context); + + typedef BOOL (*psRdpgfxServerChannelIdAssigned)(RdpgfxServerContext* context, UINT32 channelId); + + typedef BOOL (*psRdpgfxServerInitialize)(RdpgfxServerContext* context, BOOL externalThread); + + typedef UINT (*psRdpgfxResetGraphics)(RdpgfxServerContext* context, + const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics); + typedef UINT (*psRdpgfxStartFrame)(RdpgfxServerContext* context, + const RDPGFX_START_FRAME_PDU* startFrame); + typedef UINT (*psRdpgfxEndFrame)(RdpgfxServerContext* context, + const RDPGFX_END_FRAME_PDU* endFrame); + typedef UINT (*psRdpgfxSurfaceCommand)(RdpgfxServerContext* context, + const RDPGFX_SURFACE_COMMAND* cmd); + typedef UINT (*psRdpgfxSurfaceFrameCommand)(RdpgfxServerContext* context, + const RDPGFX_SURFACE_COMMAND* cmd, + const RDPGFX_START_FRAME_PDU* startFrame, + const RDPGFX_END_FRAME_PDU* endFrame); + typedef UINT (*psRdpgfxDeleteEncodingContext)( + RdpgfxServerContext* context, + const RDPGFX_DELETE_ENCODING_CONTEXT_PDU* deleteEncodingContext); + typedef UINT (*psRdpgfxCreateSurface)(RdpgfxServerContext* context, + const RDPGFX_CREATE_SURFACE_PDU* createSurface); + typedef UINT (*psRdpgfxDeleteSurface)(RdpgfxServerContext* context, + const RDPGFX_DELETE_SURFACE_PDU* deleteSurface); + typedef UINT (*psRdpgfxSolidFill)(RdpgfxServerContext* context, + const RDPGFX_SOLID_FILL_PDU* solidFill); + typedef UINT (*psRdpgfxSurfaceToSurface)(RdpgfxServerContext* context, + const RDPGFX_SURFACE_TO_SURFACE_PDU* surfaceToSurface); + typedef UINT (*psRdpgfxSurfaceToCache)(RdpgfxServerContext* context, + const RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache); + typedef UINT (*psRdpgfxCacheToSurface)(RdpgfxServerContext* context, + const RDPGFX_CACHE_TO_SURFACE_PDU* cacheToSurface); + typedef UINT (*psRdpgfxCacheImportOffer)(RdpgfxServerContext* context, + const RDPGFX_CACHE_IMPORT_OFFER_PDU* cacheImportOffer); + typedef UINT (*psRdpgfxCacheImportReply)(RdpgfxServerContext* context, + const RDPGFX_CACHE_IMPORT_REPLY_PDU* cacheImportReply); + typedef UINT (*psRdpgfxEvictCacheEntry)(RdpgfxServerContext* context, + const RDPGFX_EVICT_CACHE_ENTRY_PDU* evictCacheEntry); + typedef UINT (*psRdpgfxMapSurfaceToOutput)( + RdpgfxServerContext* context, const RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU* surfaceToOutput); + typedef UINT (*psRdpgfxMapSurfaceToWindow)( + RdpgfxServerContext* context, const RDPGFX_MAP_SURFACE_TO_WINDOW_PDU* surfaceToWindow); + typedef UINT (*psRdpgfxMapSurfaceToScaledOutput)( + RdpgfxServerContext* context, + const RDPGFX_MAP_SURFACE_TO_SCALED_OUTPUT_PDU* surfaceToOutput); + typedef UINT (*psRdpgfxMapSurfaceToScaledWindow)( + RdpgfxServerContext* context, + const RDPGFX_MAP_SURFACE_TO_SCALED_WINDOW_PDU* surfaceToWindow); + typedef UINT (*psRdpgfxCapsAdvertise)(RdpgfxServerContext* context, + const RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise); + typedef UINT (*psRdpgfxCapsConfirm)(RdpgfxServerContext* context, + const RDPGFX_CAPS_CONFIRM_PDU* capsConfirm); + typedef UINT (*psRdpgfxFrameAcknowledge)(RdpgfxServerContext* context, + const RDPGFX_FRAME_ACKNOWLEDGE_PDU* frameAcknowledge); + typedef UINT (*psRdpgfxQoeFrameAcknowledge)( + RdpgfxServerContext* context, const RDPGFX_QOE_FRAME_ACKNOWLEDGE_PDU* qoeFrameAcknowledge); + + struct s_rdpgfx_server_context + { + HANDLE vcm; + void* custom; + + psRdpgfxServerOpen Open; + psRdpgfxServerClose Close; + + psRdpgfxResetGraphics ResetGraphics; + psRdpgfxStartFrame StartFrame; + psRdpgfxEndFrame EndFrame; + psRdpgfxSurfaceCommand SurfaceCommand; + psRdpgfxSurfaceFrameCommand SurfaceFrameCommand; + psRdpgfxDeleteEncodingContext DeleteEncodingContext; + psRdpgfxCreateSurface CreateSurface; + psRdpgfxDeleteSurface DeleteSurface; + psRdpgfxSolidFill SolidFill; + psRdpgfxSurfaceToSurface SurfaceToSurface; + psRdpgfxSurfaceToCache SurfaceToCache; + psRdpgfxCacheToSurface CacheToSurface; + psRdpgfxCacheImportOffer CacheImportOffer; + psRdpgfxCacheImportReply CacheImportReply; + psRdpgfxEvictCacheEntry EvictCacheEntry; + psRdpgfxMapSurfaceToOutput MapSurfaceToOutput; + psRdpgfxMapSurfaceToWindow MapSurfaceToWindow; + psRdpgfxMapSurfaceToScaledOutput MapSurfaceToScaledOutput; + psRdpgfxMapSurfaceToScaledWindow MapSurfaceToScaledWindow; + psRdpgfxCapsAdvertise CapsAdvertise; + psRdpgfxCapsConfirm CapsConfirm; + psRdpgfxFrameAcknowledge FrameAcknowledge; + psRdpgfxQoeFrameAcknowledge QoeFrameAcknowledge; + + RdpgfxServerPrivate* priv; + rdpContext* rdpcontext; + + /** + * Callback, when the channel got its id assigned. + */ + psRdpgfxServerChannelIdAssigned ChannelIdAssigned; + /** + * Optional: Set thread handling. + * When externalThread=TRUE, the application is responsible to call + * Poll() periodically to process channel events. + * + * Defaults to externalThread=FALSE + */ + psRdpgfxServerInitialize Initialize; + }; + + FREERDP_API void rdpgfx_server_context_free(RdpgfxServerContext* context); + + WINPR_ATTR_MALLOC(rdpgfx_server_context_free, 1) + FREERDP_API RdpgfxServerContext* rdpgfx_server_context_new(HANDLE vcm); + + FREERDP_API BOOL rdpgfx_server_set_own_thread(RdpgfxServerContext* context, + BOOL internalThread); + FREERDP_API HANDLE rdpgfx_server_get_event_handle(RdpgfxServerContext* context); + FREERDP_API UINT rdpgfx_server_handle_messages(RdpgfxServerContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RDPGFX_SERVER_RDPGFX_H */ diff --git a/include/freerdp/server/rdpsnd.h b/include/freerdp/server/rdpsnd.h new file mode 100644 index 0000000..cbd5eab --- /dev/null +++ b/include/freerdp/server/rdpsnd.h @@ -0,0 +1,196 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Server Audio Virtual Channel + * + * Copyright 2012 Vic Lee + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_RDPSND_SERVER_H +#define FREERDP_CHANNEL_RDPSND_SERVER_H + +#include <freerdp/channels/wtsvc.h> +#include <freerdp/channels/rdpsnd.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_rdpsnd_server_context RdpsndServerContext; + typedef struct s_rdpsnd_server_context rdpsnd_server_context; + typedef struct s_rdpsnd_server_private RdpsndServerPrivate; + + typedef UINT (*psRdpsndStart)(RdpsndServerContext* context); + typedef UINT (*psRdpsndStop)(RdpsndServerContext* context); + + typedef BOOL (*psRdpsndChannelIdAssigned)(RdpsndServerContext* context, UINT32 channelId); + + typedef UINT (*psRdpsndServerInitialize)(RdpsndServerContext* context, BOOL ownThread); + typedef UINT (*psRdpsndServerSendFormats)(RdpsndServerContext* context); + typedef UINT (*psRdpsndServerSelectFormat)(RdpsndServerContext* context, + UINT16 client_format_index); + typedef UINT (*psRdpsndServerTraining)(RdpsndServerContext* context, UINT16 timestamp, + UINT16 packsize, BYTE* data); + typedef UINT (*psRdpsndServerTrainingConfirm)(RdpsndServerContext* context, UINT16 timestamp, + UINT16 packsize); + typedef UINT (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const void* buf, + size_t nframes, UINT16 wTimestamp); + typedef UINT (*psRdpsndServerSendSamples2)(RdpsndServerContext* context, UINT16 formatNo, + const void* buf, size_t size, UINT16 timestamp, + UINT32 audioTimeStamp); + typedef UINT (*psRdpsndServerConfirmBlock)(RdpsndServerContext* context, BYTE confirmBlockNum, + UINT16 wtimestamp); + typedef UINT (*psRdpsndServerSetVolume)(RdpsndServerContext* context, UINT16 left, + UINT16 right); + typedef UINT (*psRdpsndServerClose)(RdpsndServerContext* context); + + typedef void (*psRdpsndServerActivated)(RdpsndServerContext* context); + + struct s_rdpsnd_server_context + { + HANDLE vcm; + + psRdpsndStart Start; + psRdpsndStop Stop; + + RdpsndServerPrivate* priv; + + /* Server self-defined pointer. */ + void* data; + + /* Server to request to use dynamic virtual channel. */ + BOOL use_dynamic_virtual_channel; + + /* Server supported formats. Set by server. */ + AUDIO_FORMAT* server_formats; + size_t num_server_formats; + + /* Server source PCM audio format. Set by server. */ + AUDIO_FORMAT* src_format; + + /* Server audio latency, or buffer size, in milli-seconds. Set by server. */ + UINT32 latency; + + /* Client supported formats. */ + AUDIO_FORMAT* client_formats; + UINT16 num_client_formats; + UINT16 selected_client_format; + + /* Last sent audio block number. */ + UINT8 block_no; + + /*** APIs called by the server. ***/ + /** + * Initialize the channel. The caller should check the return value to see + * whether the initialization succeed. If not, the "Activated" callback + * will not be called and the server must not call any API on this context. + */ + psRdpsndServerInitialize Initialize; + + /** + * Choose the audio format to be sent. The index argument is an index into + * the client_formats array and must be smaller than num_client_formats. + */ + psRdpsndServerSelectFormat SelectFormat; + /** + * Send audio samples. Actually bytes in the buffer must be: + * nframes * src_format.nBitsPerSample * src_format.nChannels / 8 + */ + psRdpsndServerSendSamples SendSamples; + + /** + * Called when block confirm is received from the client + */ + psRdpsndServerConfirmBlock ConfirmBlock; + /** + * Set the volume level of the client. Valid range is between 0 and 0xFFFF. + */ + psRdpsndServerSetVolume SetVolume; + /** + * Close the audio stream. + */ + psRdpsndServerClose Close; + + /*** Callbacks registered by the server. ***/ + /** + * The channel has been activated. The server maybe choose audio format and + * start audio stream from this point. Note that this callback is called + * from a different thread context so the server must be careful of thread + * synchronization. + */ + psRdpsndServerActivated Activated; + + /** + * MS-RDPEA channel version the client announces + */ + UINT16 clientVersion; + + rdpContext* rdpcontext; + + /* dwFlags in CLIENT_AUDIO_VERSION_AND_FORMATS */ + UINT32 capsFlags; + /* dwVolume in CLIENT_AUDIO_VERSION_AND_FORMATS */ + UINT32 initialVolume; + /* dwPitch in CLIENT_AUDIO_VERSION_AND_FORMATS */ + UINT32 initialPitch; + + UINT16 qualityMode; + + /** + * Send server formats and version to the client. Automatically sent, when + * opening the channel. + * Also used to restart the protocol after sending the Close PDU. + */ + psRdpsndServerSendFormats SendFormats; + /** + * Send Training PDU. + */ + psRdpsndServerTraining Training; + + /** + * Send encoded audio samples using a Wave2 PDU. + * When successful, the block_no member is incremented. + */ + psRdpsndServerSendSamples2 SendSamples2; + + /** + * Called when a TrainingConfirm PDU is received from the client. + */ + psRdpsndServerTrainingConfirm TrainingConfirm; + + /** + * Callback, when the channel got its id assigned. + * Only called, when use_dynamic_virtual_channel=TRUE. + */ + psRdpsndChannelIdAssigned ChannelIdAssigned; + }; + + FREERDP_API void rdpsnd_server_context_free(RdpsndServerContext* context); + + WINPR_ATTR_MALLOC(rdpsnd_server_context_free, 1) + FREERDP_API RdpsndServerContext* rdpsnd_server_context_new(HANDLE vcm); + + FREERDP_API void rdpsnd_server_context_reset(RdpsndServerContext*); + + FREERDP_API HANDLE rdpsnd_server_get_event_handle(RdpsndServerContext* context); + FREERDP_API UINT rdpsnd_server_handle_messages(RdpsndServerContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_RDPSND_SERVER_H */ diff --git a/include/freerdp/server/remdesk.h b/include/freerdp/server/remdesk.h new file mode 100644 index 0000000..ef45032 --- /dev/null +++ b/include/freerdp/server/remdesk.h @@ -0,0 +1,67 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Remote Assistance Virtual Channel + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_REMDESK_SERVER_REMDESK_H +#define FREERDP_CHANNEL_REMDESK_SERVER_REMDESK_H + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/channels/wtsvc.h> + +#include <freerdp/client/remdesk.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * Server Interface + */ + + typedef struct s_remdesk_server_context RemdeskServerContext; + typedef struct s_remdesk_server_private RemdeskServerPrivate; + + typedef UINT (*psRemdeskStart)(RemdeskServerContext* context); + typedef UINT (*psRemdeskStop)(RemdeskServerContext* context); + + struct s_remdesk_server_context + { + HANDLE vcm; + void* custom; + + psRemdeskStart Start; + psRemdeskStop Stop; + + RemdeskServerPrivate* priv; + rdpContext* rdpcontext; + }; + + FREERDP_API void remdesk_server_context_free(RemdeskServerContext* context); + + WINPR_ATTR_MALLOC(remdesk_server_context_free, 1) + FREERDP_API RemdeskServerContext* remdesk_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_REMDESK_SERVER_REMDESK_H */ diff --git a/include/freerdp/server/server-common.h b/include/freerdp/server/server-common.h new file mode 100644 index 0000000..eba831b --- /dev/null +++ b/include/freerdp/server/server-common.h @@ -0,0 +1,44 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Server Common + * + * Copyright 2018 Armin Novak <armin.novak@thincast.com> + * Copyright 2018 Thincast Technologies GmbH + * + * 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_SERVER_COMMON_SERVER_H +#define FREERDP_SERVER_COMMON_SERVER_H + +#include <winpr/wtypes.h> +#include <freerdp/api.h> +#include <freerdp/codec/audio.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API size_t server_audin_get_formats(AUDIO_FORMAT** dst_formats); + FREERDP_API size_t server_rdpsnd_get_formats(AUDIO_FORMAT** dst_formats); + + FREERDP_API void freerdp_server_warn_unmaintained(int argc, char* argv[]); + FREERDP_API void freerdp_server_warn_experimental(int argc, char* argv[]); + FREERDP_API void freerdp_server_warn_deprecated(int argc, char* argv[]); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SERVER_COMMON_SERVER_H */ diff --git a/include/freerdp/server/shadow.h b/include/freerdp/server/shadow.h new file mode 100644 index 0000000..9ddb8ae --- /dev/null +++ b/include/freerdp/server/shadow.h @@ -0,0 +1,350 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Session Shadowing + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.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_SERVER_SHADOW_H +#define FREERDP_SERVER_SHADOW_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <freerdp/freerdp.h> +#include <freerdp/settings.h> +#include <freerdp/listener.h> + +#include <freerdp/channels/wtsvc.h> +#include <freerdp/channels/channels.h> + +#include <freerdp/server/encomsp.h> +#include <freerdp/server/remdesk.h> +#include <freerdp/server/rdpsnd.h> +#if defined(CHANNEL_AUDIN_SERVER) +#include <freerdp/server/audin.h> +#endif +#include <freerdp/server/rdpgfx.h> + +#include <freerdp/codec/color.h> +#include <freerdp/codec/region.h> + +#include <winpr/crt.h> +#include <winpr/synch.h> +#include <winpr/collections.h> +#include <winpr/cmdline.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_shadow_client rdpShadowClient; + typedef struct rdp_shadow_server rdpShadowServer; + typedef struct rdp_shadow_screen rdpShadowScreen; + typedef struct rdp_shadow_surface rdpShadowSurface; + typedef struct rdp_shadow_encoder rdpShadowEncoder; + typedef struct rdp_shadow_capture rdpShadowCapture; + typedef struct rdp_shadow_subsystem rdpShadowSubsystem; + typedef struct rdp_shadow_multiclient_event rdpShadowMultiClientEvent; + + typedef struct S_RDP_SHADOW_ENTRY_POINTS RDP_SHADOW_ENTRY_POINTS; + typedef int (*pfnShadowSubsystemEntry)(RDP_SHADOW_ENTRY_POINTS* pEntryPoints); + + typedef rdpShadowSubsystem* (*pfnShadowSubsystemNew)(void); + typedef void (*pfnShadowSubsystemFree)(rdpShadowSubsystem* subsystem); + + typedef int (*pfnShadowSubsystemInit)(rdpShadowSubsystem* subsystem); + typedef int (*pfnShadowSubsystemUninit)(rdpShadowSubsystem* subsystem); + + typedef int (*pfnShadowSubsystemStart)(rdpShadowSubsystem* subsystem); + typedef int (*pfnShadowSubsystemStop)(rdpShadowSubsystem* subsystem); + + typedef UINT32 (*pfnShadowEnumMonitors)(MONITOR_DEF* monitors, UINT32 maxMonitors); + + typedef int (*pfnShadowAuthenticate)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, + const char* user, const char* domain, + const char* password); + typedef BOOL (*pfnShadowClientConnect)(rdpShadowSubsystem* subsystem, rdpShadowClient* client); + typedef void (*pfnShadowClientDisconnect)(rdpShadowSubsystem* subsystem, + rdpShadowClient* client); + typedef BOOL (*pfnShadowClientCapabilities)(rdpShadowSubsystem* subsystem, + rdpShadowClient* client); + + typedef BOOL (*pfnShadowSynchronizeEvent)(rdpShadowSubsystem* subsystem, + rdpShadowClient* client, UINT32 flags); + typedef BOOL (*pfnShadowKeyboardEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, + UINT16 flags, UINT8 code); + typedef BOOL (*pfnShadowUnicodeKeyboardEvent)(rdpShadowSubsystem* subsystem, + rdpShadowClient* client, UINT16 flags, + UINT16 code); + typedef BOOL (*pfnShadowMouseEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client, + UINT16 flags, UINT16 x, UINT16 y); + typedef BOOL (*pfnShadowExtendedMouseEvent)(rdpShadowSubsystem* subsystem, + rdpShadowClient* client, UINT16 flags, UINT16 x, + UINT16 y); + + typedef BOOL (*pfnShadowChannelAudinServerReceiveSamples)(rdpShadowSubsystem* subsystem, + rdpShadowClient* client, + const AUDIO_FORMAT* format, + wStream* data); + + struct rdp_shadow_client + { + rdpContext context; + + HANDLE thread; + BOOL activated; + BOOL first_frame; + BOOL inLobby; + BOOL mayView; + BOOL mayInteract; + BOOL suppressOutput; + UINT16 surfaceId; + wMessageQueue* MsgQueue; + CRITICAL_SECTION lock; + REGION16 invalidRegion; + rdpShadowServer* server; + rdpShadowEncoder* encoder; + rdpShadowSubsystem* subsystem; + + UINT32 pointerX; + UINT32 pointerY; + + HANDLE vcm; + EncomspServerContext* encomsp; + RemdeskServerContext* remdesk; + RdpsndServerContext* rdpsnd; +#if defined(CHANNEL_AUDIN_SERVER) + audin_server_context* audin; +#endif + RdpgfxServerContext* rdpgfx; + + BOOL resizeRequested; + UINT32 resizeWidth; + UINT32 resizeHeight; + BOOL areGfxCapsReady; + }; + + struct rdp_shadow_server + { + void* ext; + HANDLE thread; + HANDLE StopEvent; + wArrayList* clients; + rdpSettings* settings; + rdpShadowScreen* screen; + rdpShadowSurface* surface; + rdpShadowSurface* lobby; + rdpShadowCapture* capture; + rdpShadowSubsystem* subsystem; + + DWORD port; + BOOL mayView; + BOOL mayInteract; + BOOL shareSubRect; + BOOL authentication; + UINT32 selectedMonitor; + RECTANGLE_16 subRect; + + /* Codec settings */ + RLGR_MODE rfxMode; + H264_RATECONTROL_MODE h264RateControlMode; + UINT32 h264BitRate; + UINT32 h264FrameRate; + UINT32 h264QP; + + char* ipcSocket; + char* ConfigPath; + char* CertificateFile; + char* PrivateKeyFile; + CRITICAL_SECTION lock; + freerdp_listener* listener; + + size_t maxClientsConnected; + }; + + struct rdp_shadow_surface + { + rdpShadowServer* server; + + UINT16 x; + UINT16 y; + UINT32 width; + UINT32 height; + UINT32 scanline; + DWORD format; + BYTE* data; + + CRITICAL_SECTION lock; + REGION16 invalidRegion; + }; + + struct S_RDP_SHADOW_ENTRY_POINTS + { + pfnShadowSubsystemNew New; + pfnShadowSubsystemFree Free; + + pfnShadowSubsystemInit Init; + pfnShadowSubsystemUninit Uninit; + + pfnShadowSubsystemStart Start; + pfnShadowSubsystemStop Stop; + + pfnShadowEnumMonitors EnumMonitors; + }; + + struct rdp_shadow_subsystem + { + RDP_SHADOW_ENTRY_POINTS ep; + HANDLE event; + UINT32 numMonitors; + UINT32 captureFrameRate; + UINT32 selectedMonitor; + MONITOR_DEF monitors[16]; + MONITOR_DEF virtualScreen; + + /* This event indicates that we have graphic change */ + /* such as screen update and resize. It should not be */ + /* used by subsystem implementation directly */ + rdpShadowMultiClientEvent* updateEvent; + + wMessagePipe* MsgPipe; + UINT32 pointerX; + UINT32 pointerY; + + AUDIO_FORMAT* rdpsndFormats; + size_t nRdpsndFormats; + AUDIO_FORMAT* audinFormats; + size_t nAudinFormats; + + pfnShadowSynchronizeEvent SynchronizeEvent; + pfnShadowKeyboardEvent KeyboardEvent; + pfnShadowUnicodeKeyboardEvent UnicodeKeyboardEvent; + pfnShadowMouseEvent MouseEvent; + pfnShadowExtendedMouseEvent ExtendedMouseEvent; + pfnShadowChannelAudinServerReceiveSamples AudinServerReceiveSamples; + + pfnShadowAuthenticate Authenticate; + pfnShadowClientConnect ClientConnect; + pfnShadowClientDisconnect ClientDisconnect; + pfnShadowClientCapabilities ClientCapabilities; + + rdpShadowServer* server; + }; + +/* Definition of message between subsystem and clients */ +#define SHADOW_MSG_IN_REFRESH_REQUEST_ID 1001 + + typedef struct S_SHADOW_MSG_OUT SHADOW_MSG_OUT; + typedef void (*MSG_OUT_FREE_FN)(UINT32 id, + SHADOW_MSG_OUT* msg); /* function to free SHADOW_MSG_OUT */ + + struct S_SHADOW_MSG_OUT + { + int refCount; + MSG_OUT_FREE_FN Free; + }; + +#define SHADOW_MSG_OUT_POINTER_POSITION_UPDATE_ID 2001 +#define SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE_ID 2002 +#define SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES_ID 2003 +#define SHADOW_MSG_OUT_AUDIO_OUT_VOLUME_ID 2004 + + typedef struct + { + SHADOW_MSG_OUT common; + UINT32 xPos; + UINT32 yPos; + } SHADOW_MSG_OUT_POINTER_POSITION_UPDATE; + + typedef struct + { + SHADOW_MSG_OUT common; + UINT32 xHot; + UINT32 yHot; + UINT32 width; + UINT32 height; + UINT32 lengthAndMask; + UINT32 lengthXorMask; + BYTE* xorMaskData; + BYTE* andMaskData; + } SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE; + + typedef struct + { + SHADOW_MSG_OUT common; + AUDIO_FORMAT* audio_format; + void* buf; + size_t nFrames; + UINT16 wTimestamp; + } SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES; + + typedef struct + { + SHADOW_MSG_OUT common; + UINT16 left; + UINT16 right; + } SHADOW_MSG_OUT_AUDIO_OUT_VOLUME; + + FREERDP_API void shadow_subsystem_set_entry_builtin(const char* name); + FREERDP_API void shadow_subsystem_set_entry(pfnShadowSubsystemEntry pEntry); + + FREERDP_API int shadow_subsystem_pointer_convert_alpha_pointer_data( + BYTE* pixels, BOOL premultiplied, UINT32 width, UINT32 height, + SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* pointerColor); + + FREERDP_API int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** argv, + COMMAND_LINE_ARGUMENT_A* cargs); + FREERDP_API int shadow_server_command_line_status_print(rdpShadowServer* server, int argc, + char** argv, int status, + COMMAND_LINE_ARGUMENT_A* cargs); + + FREERDP_API int shadow_server_start(rdpShadowServer* server); + FREERDP_API int shadow_server_stop(rdpShadowServer* server); + + FREERDP_API int shadow_server_init(rdpShadowServer* server); + FREERDP_API int shadow_server_uninit(rdpShadowServer* server); + + FREERDP_API UINT32 shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors); + + FREERDP_API void shadow_server_free(rdpShadowServer* server); + + WINPR_ATTR_MALLOC(shadow_server_free, 1) + FREERDP_API rdpShadowServer* shadow_server_new(void); + + FREERDP_API int shadow_capture_align_clip_rect(RECTANGLE_16* rect, RECTANGLE_16* clip); + FREERDP_API int shadow_capture_compare(BYTE* pData1, UINT32 nStep1, UINT32 nWidth, + UINT32 nHeight, BYTE* pData2, UINT32 nStep2, + RECTANGLE_16* rect); + + FREERDP_API void shadow_subsystem_frame_update(rdpShadowSubsystem* subsystem); + + FREERDP_API BOOL shadow_client_post_msg(rdpShadowClient* client, void* context, UINT32 type, + SHADOW_MSG_OUT* msg, void* lParam); + FREERDP_API int shadow_client_boardcast_msg(rdpShadowServer* server, void* context, UINT32 type, + SHADOW_MSG_OUT* msg, void* lParam); + FREERDP_API int shadow_client_boardcast_quit(rdpShadowServer* server, int nExitCode); + + FREERDP_API UINT32 shadow_encoder_preferred_fps(rdpShadowEncoder* encoder); + FREERDP_API UINT32 shadow_encoder_inflight_frames(rdpShadowEncoder* encoder); + + FREERDP_API BOOL shadow_screen_resize(rdpShadowScreen* screen); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SERVER_SHADOW_H */ diff --git a/include/freerdp/server/telemetry.h b/include/freerdp/server/telemetry.h new file mode 100644 index 0000000..0697e70 --- /dev/null +++ b/include/freerdp/server/telemetry.h @@ -0,0 +1,111 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Telemetry Virtual Channel Extension + * + * Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_CHANNEL_TELEMETRY_SERVER_TELEMETRY_H +#define FREERDP_CHANNEL_TELEMETRY_SERVER_TELEMETRY_H + +#include <freerdp/channels/telemetry.h> +#include <freerdp/channels/wtsvc.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_telemetry_server_context TelemetryServerContext; + + typedef UINT (*psTelemetryServerOpen)(TelemetryServerContext* context); + typedef UINT (*psTelemetryServerClose)(TelemetryServerContext* context); + + typedef BOOL (*psTelemetryServerChannelIdAssigned)(TelemetryServerContext* context, + UINT32 channelId); + + typedef UINT (*psTelemetryServerInitialize)(TelemetryServerContext* context, + BOOL externalThread); + typedef UINT (*psTelemetryServerPoll)(TelemetryServerContext* context); + typedef BOOL (*psTelemetryServerChannelHandle)(TelemetryServerContext* context, HANDLE* handle); + + typedef UINT (*psTelemetryServerRdpTelemetry)(TelemetryServerContext* context, + const TELEMETRY_RDP_TELEMETRY_PDU* rdpTelemetry); + + struct s_telemetry_server_context + { + HANDLE vcm; + + /* Server self-defined pointer. */ + void* userdata; + + /*** APIs called by the server. ***/ + + /** + * Optional: Set thread handling. + * When externalThread=TRUE, the application is responsible to call + * Poll() periodically to process channel events. + * + * Defaults to externalThread=FALSE + */ + psTelemetryServerInitialize Initialize; + + /** + * Open the telemetry channel. + */ + psTelemetryServerOpen Open; + + /** + * Close the telemetry channel. + */ + psTelemetryServerClose Close; + + /** + * Poll + * When externalThread=TRUE, call Poll() periodically from your main loop. + * If externalThread=FALSE do not call. + */ + psTelemetryServerPoll Poll; + + /** + * Retrieve the channel handle for use in conjunction with Poll(). + * If externalThread=FALSE do not call. + */ + psTelemetryServerChannelHandle ChannelHandle; + + /*** Callbacks registered by the server. ***/ + + /** + * Callback, when the channel got its id assigned + */ + psTelemetryServerChannelIdAssigned ChannelIdAssigned; + /** + * Callback for the RDP Telemetry PDU. + */ + psTelemetryServerRdpTelemetry RdpTelemetry; + + rdpContext* rdpcontext; + }; + + FREERDP_API void telemetry_server_context_free(TelemetryServerContext* context); + + WINPR_ATTR_MALLOC(telemetry_server_context_free, 1) + FREERDP_API TelemetryServerContext* telemetry_server_context_new(HANDLE vcm); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_TELEMETRY_SERVER_TELEMETRY_H */ diff --git a/include/freerdp/session.h b/include/freerdp/session.h new file mode 100644 index 0000000..12b8032 --- /dev/null +++ b/include/freerdp/session.h @@ -0,0 +1,59 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Client Session Info + * + * Copyright 2016 David FORT <contact@hardening-consulting.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_SESSION_H +#define FREERDP_SESSION_H + +#include <winpr/wtypes.h> + +/* Logon Information Types */ +#define INFO_TYPE_LOGON 0x00000000 +#define INFO_TYPE_LOGON_LONG 0x00000001 +#define INFO_TYPE_LOGON_PLAIN_NOTIFY 0x00000002 +#define INFO_TYPE_LOGON_EXTENDED_INF 0x00000003 + +#ifdef __cplusplus +extern "C" +{ +#endif + + struct rdp_logon_info + { + UINT32 sessionId; + char* username; + char* domain; + }; + typedef struct rdp_logon_info logon_info; + + struct rdp_logon_info_ex + { + BOOL haveCookie; + UINT32 LogonId; + BYTE ArcRandomBits[16]; + + BOOL haveErrorInfo; + UINT32 ErrorNotificationType; + UINT32 ErrorNotificationData; + }; + typedef struct rdp_logon_info_ex logon_info_ex; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SESSION_H */ diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h new file mode 100644 index 0000000..cd89b32 --- /dev/null +++ b/include/freerdp/settings.h @@ -0,0 +1,709 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP Settings + * + * Copyright 2009-2011 Jay Sorg + * Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@gmail.com> + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_SETTINGS_H +#define FREERDP_SETTINGS_H + +#include <winpr/timezone.h> +#include <winpr/wlog.h> + +#include <freerdp/api.h> +#include <freerdp/config.h> +#include <freerdp/types.h> +#include <freerdp/redirection.h> + +#if !defined(WITH_OPAQUE_SETTINGS) +#include <freerdp/settings_types_private.h> +#endif + +#include <freerdp/settings_keys.h> +#include <freerdp/settings_types.h> + +#include <freerdp/crypto/certificate.h> +#include <freerdp/crypto/privatekey.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** \file + * \brief This is the FreeRDP settings module. + * + * Settings are used to store configuration data for an RDP connection. + * There are 3 different settings for each client and server: + * + * 1. The initial connection supplied by the user + * 2. The settings sent from client or server during capability exchange + * 3. The settings merged from the capability exchange and the initial configuration. + * + * The lifetime of the settings is as follows: + * 1. Initial configuration is saved and will be valid for the whole application lifecycle + * 2. The client or server settings from the other end are valid from capability exchange until the + * connection is ended (disconnect/redirect/...) + * 3. The merged settings are created from the initial configuration and server settings and have + * the same lifetime, until the connection ends + * + * + * So, when accessing the settings always ensure to know which one you are operating on! (this is + * especially important for the proxy where you have a RDP client and RDP server in the same + * application context) + */ + +typedef struct rdp_settings rdpSettings; + +/** + * rdpSettings creation flags + */ +#define FREERDP_SETTINGS_SERVER_MODE 0x00000001 +#define FREERDP_SETTINGS_REMOTE_MODE 0x00000002 + + /** \brief creates a new setting struct + * + * \param flags Flags for creation, use \b FREERDP_SETTINGS_SERVER_MODE for server settings, 0 + * for client. + * + * \return A newly allocated settings struct or NULL + */ + FREERDP_API rdpSettings* freerdp_settings_new(DWORD flags); + + /** \brief Creates a deep copy of settings + * + * \param settings A pointer to a settings struct to copy. May be NULL (returns NULL) + * + * \return A newly allocated copy of \b settings or NULL + */ + FREERDP_API rdpSettings* freerdp_settings_clone(const rdpSettings* settings); + + /** \brief Deep copies settings from \b src to \b dst + * + * The function frees up all allocated data in \b dst before copying the data from \b src + * + * \param dst A pointer for the settings to copy data to. May be NULL (fails copy) + * \param src A pointer to the settings to copy. May be NULL (fails copy) + * + * \return \b TRUE for success, \b FALSE for failure. + */ + FREERDP_API BOOL freerdp_settings_copy(rdpSettings* dst, const rdpSettings* src); + + /** \brief copies one setting identified by \b id from \b src to \b dst + * + * The function frees up all allocated data in \b dst before copying the data from \b src + * + * \param dst A pointer for the settings to copy data to. May be NULL (fails copy) + * \param src A pointer to the settings to copy. May be NULL (fails copy) + * \param id The settings identifier to copy + * + * \return \b TRUE for success, \b FALSE for failure. + */ + + FREERDP_API BOOL freerdp_settings_copy_item(rdpSettings* dst, const rdpSettings* src, + SSIZE_T id); + + /** \brief Free a settings struct with all data in it + * + * \param settings A pointer to the settings to free, May be NULL + */ + FREERDP_API void freerdp_settings_free(rdpSettings* settings); + + /** \brief Dumps the contents of a settings struct to a WLog logger + * + * \param log The logger to write to, must not be NULL + * \param level The WLog level to use for the log entries + * \param settings A pointer to the settings to dump. May be NULL. + */ + FREERDP_API void freerdp_settings_dump(wLog* log, DWORD level, const rdpSettings* settings); + + /** \brief Dumps the difference between two settings structs to a WLog + * + * \param log The logger to write to, must not be NULL. + * \param level The WLog level to use for the log entries. + * \param src A pointer to the settings to dump. May be NULL. + * \param other A pointer to the settings to dump. May be NULL. + * + * \return \b TRUE if not equal, \b FALSE otherwise + */ + FREERDP_API BOOL freerdp_settings_print_diff(wLog* log, DWORD level, const rdpSettings* src, + const rdpSettings* other); + + FREERDP_API ADDIN_ARGV* freerdp_addin_argv_new(size_t argc, const char* argv[]); + FREERDP_API ADDIN_ARGV* freerdp_addin_argv_clone(const ADDIN_ARGV* args); + FREERDP_API void freerdp_addin_argv_free(ADDIN_ARGV* args); + + FREERDP_API BOOL freerdp_addin_argv_add_argument(ADDIN_ARGV* args, const char* argument); + FREERDP_API BOOL freerdp_addin_argv_add_argument_ex(ADDIN_ARGV* args, const char* argument, + size_t len); + FREERDP_API BOOL freerdp_addin_argv_del_argument(ADDIN_ARGV* args, const char* argument); + + FREERDP_API int freerdp_addin_set_argument(ADDIN_ARGV* args, const char* argument); + FREERDP_API int freerdp_addin_replace_argument(ADDIN_ARGV* args, const char* previous, + const char* argument); + FREERDP_API int freerdp_addin_set_argument_value(ADDIN_ARGV* args, const char* option, + const char* value); + FREERDP_API int freerdp_addin_replace_argument_value(ADDIN_ARGV* args, const char* previous, + const char* option, const char* value); + + FREERDP_API BOOL freerdp_device_collection_add(rdpSettings* settings, RDPDR_DEVICE* device); + FREERDP_API RDPDR_DEVICE* freerdp_device_collection_find(rdpSettings* settings, + const char* name); + FREERDP_API RDPDR_DEVICE* freerdp_device_collection_find_type(rdpSettings* settings, + UINT32 type); + + FREERDP_API void freerdp_device_free(RDPDR_DEVICE* device); + + WINPR_ATTR_MALLOC(freerdp_device_free, 1) + FREERDP_API RDPDR_DEVICE* freerdp_device_new(UINT32 Type, size_t count, const char* args[]); + + WINPR_ATTR_MALLOC(freerdp_device_free, 1) + FREERDP_API RDPDR_DEVICE* freerdp_device_clone(const RDPDR_DEVICE* device); + + FREERDP_API BOOL freerdp_device_equal(const RDPDR_DEVICE* one, const RDPDR_DEVICE* other); + + FREERDP_API void freerdp_device_collection_free(rdpSettings* settings); + + FREERDP_API BOOL freerdp_static_channel_collection_add(rdpSettings* settings, + ADDIN_ARGV* channel); + FREERDP_API BOOL freerdp_static_channel_collection_del(rdpSettings* settings, const char* name); + FREERDP_API ADDIN_ARGV* freerdp_static_channel_collection_find(rdpSettings* settings, + const char* name); +#if defined(WITH_FREERDP_DEPRECATED) + FREERDP_API WINPR_DEPRECATED(ADDIN_ARGV* freerdp_static_channel_clone(ADDIN_ARGV* channel)); +#endif + + FREERDP_API void freerdp_static_channel_collection_free(rdpSettings* settings); + + FREERDP_API BOOL freerdp_dynamic_channel_collection_add(rdpSettings* settings, + ADDIN_ARGV* channel); + FREERDP_API BOOL freerdp_dynamic_channel_collection_del(rdpSettings* settings, + const char* name); + FREERDP_API ADDIN_ARGV* freerdp_dynamic_channel_collection_find(const rdpSettings* settings, + const char* name); + +#if defined(WITH_FREERDP_DEPRECATED) + FREERDP_API WINPR_DEPRECATED(ADDIN_ARGV* freerdp_dynamic_channel_clone(ADDIN_ARGV* channel)); +#endif + + FREERDP_API void freerdp_dynamic_channel_collection_free(rdpSettings* settings); + FREERDP_API void freerdp_capability_buffer_free(rdpSettings* settings); + FREERDP_API BOOL freerdp_capability_buffer_copy(rdpSettings* settings, const rdpSettings* src); + + FREERDP_API void freerdp_server_license_issuers_free(rdpSettings* settings); + FREERDP_API BOOL freerdp_server_license_issuers_copy(rdpSettings* settings, char** addresses, + UINT32 count); + + FREERDP_API void freerdp_target_net_addresses_free(rdpSettings* settings); + FREERDP_API BOOL freerdp_target_net_addresses_copy(rdpSettings* settings, char** addresses, + UINT32 count); + + FREERDP_API void freerdp_performance_flags_make(rdpSettings* settings); + FREERDP_API void freerdp_performance_flags_split(rdpSettings* settings); + + FREERDP_API BOOL freerdp_set_gateway_usage_method(rdpSettings* settings, + UINT32 GatewayUsageMethod); + FREERDP_API void freerdp_update_gateway_usage_method(rdpSettings* settings, + UINT32 GatewayEnabled, + UINT32 GatewayBypassLocal); + + /* DEPRECATED: + * the functions freerdp_get_param_* and freerdp_set_param_* are deprecated. + * use freerdp_settings_get_* and freerdp_settings_set_* as a replacement! + */ +#if defined(WITH_FREERDP_DEPRECATED) + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_settings_get_bool instead", + BOOL freerdp_get_param_bool(const rdpSettings* settings, + int id)); + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_settings_set_bool instead", + int freerdp_set_param_bool(rdpSettings* settings, int id, + BOOL param)); + + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_settings_get_int[16|32] instead", + int freerdp_get_param_int(const rdpSettings* settings, + int id)); + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_settings_set_int[16|32] instead", + int freerdp_set_param_int(rdpSettings* settings, int id, + int param)); + + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_settings_set_uint32 instead", + UINT32 freerdp_get_param_uint32(const rdpSettings* settings, + int id)); + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_settings_set_uint32 instead", + int freerdp_set_param_uint32(rdpSettings* settings, int id, + UINT32 param)); + + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_settings_get_uint64 instead", + UINT64 freerdp_get_param_uint64(const rdpSettings* settings, + int id)); + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_settings_set_uint64 instead", + int freerdp_set_param_uint64(rdpSettings* settings, int id, + UINT64 param)); + + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_settings_get_string instead", + char* freerdp_get_param_string(const rdpSettings* settings, + int id)); + FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_settings_set_string instead", + int freerdp_set_param_string(rdpSettings* settings, int id, + const char* param)); +#endif + + /** \brief Returns \b TRUE if settings are in a valid state, \b FALSE otherwise + * + * This function is meant to replace tideous return checks for \b freerdp_settings_set_* with a + * single check after these calls. + * + * \param settings the settings instance to check + * + * \return \b TRUE if valid, \b FALSE otherwise + */ + FREERDP_API BOOL freerdp_settings_are_valid(const rdpSettings* settings); + + /** \brief Returns a boolean settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the value of the boolean key + */ + FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings* settings, + FreeRDP_Settings_Keys_Bool id); + + /** \brief Sets a BOOL settings value. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_bool(rdpSettings* settings, FreeRDP_Settings_Keys_Bool id, + BOOL param); + + /** \brief Returns a INT16 settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the value of the INT16 key + */ + FREERDP_API INT16 freerdp_settings_get_int16(const rdpSettings* settings, + FreeRDP_Settings_Keys_Int16 id); + + /** \brief Sets a INT16 settings value. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_int16(rdpSettings* settings, + FreeRDP_Settings_Keys_Int16 id, INT16 param); + + /** \brief Returns a UINT16 settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the value of the UINT16 key + */ + FREERDP_API UINT16 freerdp_settings_get_uint16(const rdpSettings* settings, + FreeRDP_Settings_Keys_UInt16 id); + + /** \brief Sets a UINT16 settings value. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_uint16(rdpSettings* settings, + FreeRDP_Settings_Keys_UInt16 id, UINT16 param); + + /** \brief Returns a INT32 settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the value of the INT32 key + */ + FREERDP_API INT32 freerdp_settings_get_int32(const rdpSettings* settings, + FreeRDP_Settings_Keys_Int32 id); + + /** \brief Sets a INT32 settings value. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_int32(rdpSettings* settings, + FreeRDP_Settings_Keys_Int32 id, INT32 param); + + /** \brief Returns a UINT32 settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the value of the UINT32 key + */ + FREERDP_API UINT32 freerdp_settings_get_uint32(const rdpSettings* settings, + FreeRDP_Settings_Keys_UInt32 id); + + /** \brief Sets a UINT32 settings value. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_uint32(rdpSettings* settings, + FreeRDP_Settings_Keys_UInt32 id, UINT32 param); + + /** \brief Returns a INT64 settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the value of the INT64 key + */ + FREERDP_API INT64 freerdp_settings_get_int64(const rdpSettings* settings, + FreeRDP_Settings_Keys_Int64 id); + + /** \brief Sets a INT64 settings value. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_int64(rdpSettings* settings, + FreeRDP_Settings_Keys_Int64 id, INT64 param); + + /** \brief Returns a UINT64 settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the value of the UINT64 key + */ + FREERDP_API UINT64 freerdp_settings_get_uint64(const rdpSettings* settings, + FreeRDP_Settings_Keys_UInt64 id); + + /** \brief Sets a UINT64 settings value. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_uint64(rdpSettings* settings, + FreeRDP_Settings_Keys_UInt64 id, UINT64 param); + + /** \brief Returns a immutable string settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the immutable string pointer + */ + FREERDP_API const char* freerdp_settings_get_string(const rdpSettings* settings, + FreeRDP_Settings_Keys_String id); + + /** \brief Returns a string settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the string pointer + */ + FREERDP_API char* freerdp_settings_get_string_writable(rdpSettings* settings, + FreeRDP_Settings_Keys_String id); + + /** \brief Sets a string settings value. The \b param is copied. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. If NULL allocates an empty string buffer of \b len size, + * otherwise a copy is created. \param len The length of \b param, 0 to remove the old entry. + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_string_len(rdpSettings* settings, + FreeRDP_Settings_Keys_String id, + const char* param, size_t len); + + /** \brief Sets a string settings value. The \b param is copied. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. If NULL removes the old entry, otherwise a copy is created. + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_string(rdpSettings* settings, + FreeRDP_Settings_Keys_String id, + const char* param); + + /** \brief appends a string to a settings value. The \b param is copied. + * If the initial value of the setting was not empty, <old value><separator><param> is created + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param separator The separator string to use. May be NULL (no separator) + * \param param The value to append + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_append_string(rdpSettings* settings, + FreeRDP_Settings_Keys_String id, + const char* separator, const char* param); + + /** \brief Sets a string settings value. The \b param is converted to UTF-8 and the copy stored. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. If NULL removes the old entry, otherwise a copy is created. + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_string_from_utf16(rdpSettings* settings, + FreeRDP_Settings_Keys_String id, + const WCHAR* param); + + /** \brief Sets a string settings value. The \b param is converted to UTF-8 and the copy stored. + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * \param param The value to set. If NULL removes the old entry, otherwise a copy is created. + * \param length The length of the WCHAR string in number of WCHAR characters + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_string_from_utf16N(rdpSettings* settings, + FreeRDP_Settings_Keys_String id, + const WCHAR* param, size_t length); + /** \brief Return an allocated UTF16 string + * + * \param settings A pointer to the settings struct to use + * \param id The settings identifier + * + * \return An allocated, '\0' terminated WCHAR string or NULL + */ + FREERDP_API WCHAR* freerdp_settings_get_string_as_utf16(const rdpSettings* settings, + FreeRDP_Settings_Keys_String id, + size_t* pCharLen); + + /** \brief Returns a immutable pointer settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the immutable pointer value + */ + FREERDP_API const void* freerdp_settings_get_pointer(const rdpSettings* settings, + FreeRDP_Settings_Keys_Pointer id); + + /** \brief Returns a mutable pointer settings value + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to query + * + * \return the mutable pointer value + */ + FREERDP_API void* freerdp_settings_get_pointer_writable(rdpSettings* settings, + FreeRDP_Settings_Keys_Pointer id); + + /** \brief Set a pointer to value \b data + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to update + * \param data The data to set (direct update, no copy created, previous value overwritten) + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_pointer(rdpSettings* settings, + FreeRDP_Settings_Keys_Pointer id, + const void* data); + + /** \brief Set a pointer to value \b data + * + * \param settings A pointer to the settings to query, must not be NULL. + * \param id The key to update + * \param data The data to set (copy created, previous value freed) + * + * \return \b TRUE for success, \b FALSE for failure + */ + FREERDP_API BOOL freerdp_settings_set_pointer_len(rdpSettings* settings, + FreeRDP_Settings_Keys_Pointer id, + const void* data, size_t len); + + FREERDP_API const void* freerdp_settings_get_pointer_array(const rdpSettings* settings, + FreeRDP_Settings_Keys_Pointer id, + size_t offset); + FREERDP_API void* freerdp_settings_get_pointer_array_writable(const rdpSettings* settings, + FreeRDP_Settings_Keys_Pointer id, + size_t offset); + FREERDP_API BOOL freerdp_settings_set_pointer_array(rdpSettings* settings, + FreeRDP_Settings_Keys_Pointer id, + size_t offset, const void* data); + + FREERDP_API BOOL freerdp_settings_set_value_for_name(rdpSettings* settings, const char* name, + const char* value); + + /** \brief Get a key index for the name string of that key + * + * \param value A key name string like FreeRDP_ServerMode + * + * \return The key index or -1 in case of an error (e.g. name does not exist) + */ + FREERDP_API SSIZE_T freerdp_settings_get_key_for_name(const char* value); + + /** \brief Get a key type for the name string of that key + * + * \param value A key name string like FreeRDP_ServerMode + * + * \return The key type (e.g. FREERDP_SETTINGS_TYPE_BOOL) or -1 in case of an error (e.g. name + * does not exist) + */ + FREERDP_API SSIZE_T freerdp_settings_get_type_for_name(const char* value); + + /** \brief Get a key type for the key index + * + * \param key The key index like FreeRDP_ServerMode + * + * \return The key type (e.g. FREERDP_SETTINGS_TYPE_BOOL) or -1 in case of an error (e.g. name + * does not exist) + */ + FREERDP_API SSIZE_T freerdp_settings_get_type_for_key(SSIZE_T key); + + /** \brief Returns the type name for a \b key + * + * \param key the key number to stringify + * \return the type name of the key or \b FREERDP_SETTINGS_TYPE_UNKNOWN + */ + FREERDP_API const char* freerdp_settings_get_type_name_for_key(SSIZE_T key); + + /** \brief Returns the type name for a \b type + * + * \param type the type to stringify + * \return the name of the key or \b FREERDP_SETTINGS_TYPE_UNKNOWN + */ + FREERDP_API const char* freerdp_settings_get_type_name_for_type(SSIZE_T type); + + /** \brief Returns the type name for a \b key + * + * \param key the key number to stringify + * \return the name of the key or \b NULL + */ + FREERDP_API const char* freerdp_settings_get_name_for_key(SSIZE_T key); + + /** \brief helper function to get a mask of supported codec flags. + * + * This function checks various settings to create a mask of supported codecs + * \b FreeRDP_CodecFlags defines the codecs + * + * \param settings the settings to check + * + * \return a mask of supported codecs + */ + FREERDP_API UINT32 freerdp_settings_get_codecs_flags(const rdpSettings* settings); + + /** \brief Parse capability data and apply to settings + * + * The capability message is stored in raw form in the settings, the data parsed and applied to + * the settings. + * + * \param settings A pointer to the settings to use + * \param capsFlags A pointer to the capablity flags, must have capsCount fields + * \param capsData A pointer array to the RAW capability data, must have capsCount fields + * \param capsSizes A pointer to an array of RAW capability sizes, must have capsCount fields + * \param capsCount The number of capabilities contained in the RAW data + * \param serverReceivedCaps Indicates if the parser should assume to be a server or client + * instance + * + * \return \b TRUE for success, \b FALSE in case of an error + */ + FREERDP_API BOOL freerdp_settings_update_from_caps(rdpSettings* settings, const BYTE* capsFlags, + const BYTE** capsData, + const UINT32* capsSizes, UINT32 capsCount, + BOOL serverReceivedCaps); + + /** \brief A helper function to return the correct server name. + * + * The server name might be in key FreeRDP_ServerHostname or if used in + * FreeRDP_UserSpecifiedServerName. This function returns the correct name to use. + * + * \param settings The settings to query, must not be NULL. + * + * \return A string pointer or NULL in case of failure. + */ + FREERDP_API const char* freerdp_settings_get_server_name(const rdpSettings* settings); + + /** \brief Returns a stringified representation of RAIL support flags + * + * \param flags The flags to stringify + * \param buffer A pointer to the string buffer to write to + * \param length The size of the string buffer + * + * \return A pointer to \b buffer for success, NULL otherwise + */ + FREERDP_API char* freerdp_rail_support_flags_to_string(UINT32 flags, char* buffer, + size_t length); + + /** \brief Returns a stringified representation of the RDP protocol version. + * + * \param version The RDP protocol version number. + * + * \return A string representation of the protocol version as "RDP_VERSION_10_11" or + * "RDP_VERSION_UNKNOWN" for invalid/unknown versions + */ + FREERDP_API const char* freerdp_rdp_version_string(UINT32 version); + + /** \brief Returns a string representation of \b RDPDR_DTYP_* + * + * \param type The integer of the \b RDPDR_DTYP_* to stringify + * + * \return A string representation of the \b RDPDR_DTYP_* or "RDPDR_DTYP_UNKNOWN" + */ + FREERDP_API const char* freerdp_rdpdr_dtyp_string(UINT32 type); + + FREERDP_API const char* freerdp_encryption_level_string(UINT32 EncryptionLevel); + FREERDP_API const char* freerdp_encryption_methods_string(UINT32 EncryptionLevel, char* buffer, + size_t size); + + /** \brief returns a string representation of \b RNS_UD_XXBPP_SUPPORT values + * + * return A string reprenentation of the bitmask. + */ + FREERDP_API const char* freerdp_supported_color_depths_string(UINT16 mask, char* buffer, + size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SETTINGS_H */ diff --git a/include/freerdp/settings_types.h b/include/freerdp/settings_types.h new file mode 100644 index 0000000..ef489e3 --- /dev/null +++ b/include/freerdp/settings_types.h @@ -0,0 +1,514 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP Settings + * + * Copyright 2009-2011 Jay Sorg + * Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2016 Armin Novak <armin.novak@gmail.com> + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_SETTINGS_TYPES_H +#define FREERDP_SETTINGS_TYPES_H + +#include <winpr/timezone.h> +#include <winpr/wlog.h> + +#include <freerdp/api.h> +#include <freerdp/config.h> +#include <freerdp/types.h> +#include <freerdp/redirection.h> + +#include <freerdp/crypto/certificate.h> +#include <freerdp/crypto/privatekey.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** \file + * \brief This is the FreeRDP settings module. + * + * Settings are used to store configuration data for an RDP connection. + * There are 3 different settings for each client and server: + * + * 1. The initial connection supplied by the user + * 2. The settings sent from client or server during capability exchange + * 3. The settings merged from the capability exchange and the initial configuration. + * + * The lifetime of the settings is as follows: + * 1. Initial configuration is saved and will be valid for the whole application lifecycle + * 2. The client or server settings from the other end are valid from capability exchange until the + * connection is ended (disconnect/redirect/...) + * 3. The merged settings are created from the initial configuration and server settings and have + * the same lifetime, until the connection ends + * + * + * So, when accessing the settings always ensure to know which one you are operating on! (this is + * especially important for the proxy where you have a RDP client and RDP server in the same + * application context) + */ + +/* RAIL Support Level */ +#define RAIL_LEVEL_SUPPORTED 0x00000001 +#define RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED 0x00000002 +#define RAIL_LEVEL_SHELL_INTEGRATION_SUPPORTED 0x00000004 +#define RAIL_LEVEL_LANGUAGE_IME_SYNC_SUPPORTED 0x00000008 +#define RAIL_LEVEL_SERVER_TO_CLIENT_IME_SYNC_SUPPORTED 0x00000010 +#define RAIL_LEVEL_HIDE_MINIMIZED_APPS_SUPPORTED 0x00000020 +#define RAIL_LEVEL_WINDOW_CLOAKING_SUPPORTED 0x00000040 +#define RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED 0x00000080 + +/* Performance Flags */ +#define PERF_FLAG_NONE 0x00000000 +#define PERF_DISABLE_WALLPAPER 0x00000001 +#define PERF_DISABLE_FULLWINDOWDRAG 0x00000002 +#define PERF_DISABLE_MENUANIMATIONS 0x00000004 +#define PERF_DISABLE_THEMING 0x00000008 +#define PERF_DISABLE_CURSOR_SHADOW 0x00000020 +#define PERF_DISABLE_CURSORSETTINGS 0x00000040 +#define PERF_ENABLE_FONT_SMOOTHING 0x00000080 +#define PERF_ENABLE_DESKTOP_COMPOSITION 0x00000100 + +/* Connection Types */ +#define CONNECTION_TYPE_MODEM 0x01 +#define CONNECTION_TYPE_BROADBAND_LOW 0x02 +#define CONNECTION_TYPE_SATELLITE 0x03 +#define CONNECTION_TYPE_BROADBAND_HIGH 0x04 +#define CONNECTION_TYPE_WAN 0x05 +#define CONNECTION_TYPE_LAN 0x06 +#define CONNECTION_TYPE_AUTODETECT 0x07 + +/* Client to Server (CS) data blocks */ +#define CS_CORE 0xC001 +#define CS_SECURITY 0xC002 +#define CS_NET 0xC003 +#define CS_CLUSTER 0xC004 +#define CS_MONITOR 0xC005 +#define CS_MCS_MSGCHANNEL 0xC006 +#define CS_MONITOR_EX 0xC008 +#define CS_UNUSED1 0xC00C +#define CS_MULTITRANSPORT 0xC00A + +/* Server to Client (SC) data blocks */ +#define SC_CORE 0x0C01 +#define SC_SECURITY 0x0C02 +#define SC_NET 0x0C03 +#define SC_MCS_MSGCHANNEL 0x0C04 +#define SC_MULTITRANSPORT 0x0C08 + + /* RDP versions, see + * [MS-RDPBCGR] 2.2.1.3.2 Client Core Data (TS_UD_CS_CORE) + * [MS-RDPBCGR] 2.2.1.4.2 Server Core Data (TS_UD_SC_CORE) + */ + typedef enum + { + RDP_VERSION_4 = 0x00080001, + RDP_VERSION_5_PLUS = 0x00080004, + RDP_VERSION_10_0 = 0x00080005, + RDP_VERSION_10_1 = 0x00080006, + RDP_VERSION_10_2 = 0x00080007, + RDP_VERSION_10_3 = 0x00080008, + RDP_VERSION_10_4 = 0x00080009, + RDP_VERSION_10_5 = 0x0008000a, + RDP_VERSION_10_6 = 0x0008000b, + RDP_VERSION_10_7 = 0x0008000C, + RDP_VERSION_10_8 = 0x0008000D, + RDP_VERSION_10_9 = 0x0008000E, + RDP_VERSION_10_10 = 0x0008000F, + RDP_VERSION_10_11 = 0x00080010, + RDP_VERSION_10_12 = 0x00080011 + } RDP_VERSION; + +/* Color depth */ +#define RNS_UD_COLOR_4BPP 0xCA00 +#define RNS_UD_COLOR_8BPP 0xCA01 +#define RNS_UD_COLOR_16BPP_555 0xCA02 +#define RNS_UD_COLOR_16BPP_565 0xCA03 +#define RNS_UD_COLOR_24BPP 0xCA04 + +/* Secure Access Sequence */ +#define RNS_UD_SAS_DEL 0xAA03 + +/* Supported Color Depths */ +#define RNS_UD_24BPP_SUPPORT 0x0001 +#define RNS_UD_16BPP_SUPPORT 0x0002 +#define RNS_UD_15BPP_SUPPORT 0x0004 +#define RNS_UD_32BPP_SUPPORT 0x0008 + +/* Audio Mode */ +#define AUDIO_MODE_REDIRECT 0 /* Bring to this computer */ +#define AUDIO_MODE_PLAY_ON_SERVER 1 /* Leave at remote computer */ +#define AUDIO_MODE_NONE 2 /* Do not play */ + +/* Early Capability Flags (Client to Server) */ +#define RNS_UD_CS_SUPPORT_ERRINFO_PDU 0x0001 +#define RNS_UD_CS_WANT_32BPP_SESSION 0x0002 +#define RNS_UD_CS_SUPPORT_STATUSINFO_PDU 0x0004 +#define RNS_UD_CS_STRONG_ASYMMETRIC_KEYS 0x0008 +#define RNS_UD_CS_RELATIVE_MOUSE_INPUT 0x0010 +#define RNS_UD_CS_VALID_CONNECTION_TYPE 0x0020 +#define RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU 0x0040 +#define RNS_UD_CS_SUPPORT_NETCHAR_AUTODETECT 0x0080 +#define RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL 0x0100 +#define RNS_UD_CS_SUPPORT_DYNAMIC_TIME_ZONE 0x0200 +#define RNS_UD_CS_SUPPORT_HEARTBEAT_PDU 0x0400 +#define RNS_UD_CS_SUPPORT_SKIP_CHANNELJOIN 0x0800 + +/* Early Capability Flags (Server to Client) */ +#define RNS_UD_SC_EDGE_ACTIONS_SUPPORTED_V1 0x00000001 +#define RNS_UD_SC_DYNAMIC_DST_SUPPORTED 0x00000002 +#define RNS_UD_SC_EDGE_ACTIONS_SUPPORTED_V2 0x00000004 +#define RNS_UD_SC_SKIP_CHANNELJOIN_SUPPORTED 0x00000008 + +/* Cluster Information Flags */ +#define REDIRECTION_SUPPORTED 0x00000001 +#define REDIRECTED_SESSIONID_FIELD_VALID 0x00000002 +#define REDIRECTED_SMARTCARD 0x00000040 + +#define ServerSessionRedirectionVersionMask 0x0000003c +#define REDIRECTION_VERSION1 0x00 +#define REDIRECTION_VERSION2 0x01 +#define REDIRECTION_VERSION3 0x02 +#define REDIRECTION_VERSION4 0x03 +#define REDIRECTION_VERSION5 0x04 +#define REDIRECTION_VERSION6 0x05 + +#define MONITOR_PRIMARY 0x00000001 + +/* Encryption Methods */ +#define ENCRYPTION_METHOD_NONE 0x00000000 +#define ENCRYPTION_METHOD_40BIT 0x00000001 +#define ENCRYPTION_METHOD_128BIT 0x00000002 +#define ENCRYPTION_METHOD_56BIT 0x00000008 +#define ENCRYPTION_METHOD_FIPS 0x00000010 + +/* Encryption Levels */ +#define ENCRYPTION_LEVEL_NONE 0x00000000 +#define ENCRYPTION_LEVEL_LOW 0x00000001 +#define ENCRYPTION_LEVEL_CLIENT_COMPATIBLE 0x00000002 +#define ENCRYPTION_LEVEL_HIGH 0x00000003 +#define ENCRYPTION_LEVEL_FIPS 0x00000004 + +/* Multitransport Types */ +#define TRANSPORT_TYPE_UDP_FECR 0x00000001 +#define TRANSPORT_TYPE_UDP_FECL 0x00000004 +#define TRANSPORT_TYPE_UDP_PREFERRED 0x00000100 +#define SOFTSYNC_TCP_TO_UDP 0x00000200 + +/* Static Virtual Channel Options */ +#define CHANNEL_OPTION_INITIALIZED 0x80000000 +#define CHANNEL_OPTION_ENCRYPT_RDP 0x40000000 +#define CHANNEL_OPTION_ENCRYPT_SC 0x20000000 +#define CHANNEL_OPTION_ENCRYPT_CS 0x10000000 +#define CHANNEL_OPTION_PRI_HIGH 0x08000000 +#define CHANNEL_OPTION_PRI_MED 0x04000000 +#define CHANNEL_OPTION_PRI_LOW 0x02000000 +#define CHANNEL_OPTION_COMPRESS_RDP 0x00800000 +#define CHANNEL_OPTION_COMPRESS 0x00400000 +#define CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000 +#define CHANNEL_REMOTE_CONTROL_PERSISTENT 0x00100000 + +/* Virtual Channel Capability Flags */ +#define VCCAPS_NO_COMPR 0x00000000 +#define VCCAPS_COMPR_SC 0x00000001 +#define VCCAPS_COMPR_CS_8K 0x00000002 + +/* Large Pointer Support Flags */ +#define LARGE_POINTER_FLAG_96x96 0x00000001 +#define LARGE_POINTER_FLAG_384x384 0x00000002 + +/* Auto Reconnect Version */ +#define AUTO_RECONNECT_VERSION_1 0x00000001 + +/* Cookie Lengths */ +#define MSTSC_COOKIE_MAX_LENGTH 9 +#define DEFAULT_COOKIE_MAX_LENGTH 0xFF + +/* Order Support */ +#define NEG_DSTBLT_INDEX 0x00 +#define NEG_PATBLT_INDEX 0x01 +#define NEG_SCRBLT_INDEX 0x02 +#define NEG_MEMBLT_INDEX 0x03 +#define NEG_MEM3BLT_INDEX 0x04 +#define NEG_ATEXTOUT_INDEX 0x05 +#define NEG_AEXTTEXTOUT_INDEX 0x06 /* Must be ignored */ +#define NEG_DRAWNINEGRID_INDEX 0x07 /* Must be ignored */ +#define NEG_LINETO_INDEX 0x08 +#define NEG_MULTI_DRAWNINEGRID_INDEX 0x09 +#define NEG_OPAQUE_RECT_INDEX 0x0A /* Must be ignored */ +#define NEG_SAVEBITMAP_INDEX 0x0B +#define NEG_WTEXTOUT_INDEX 0x0C /* Must be ignored */ +#define NEG_MEMBLT_V2_INDEX 0x0D /* Must be ignored */ +#define NEG_MEM3BLT_V2_INDEX 0x0E /* Must be ignored */ +#define NEG_MULTIDSTBLT_INDEX 0x0F +#define NEG_MULTIPATBLT_INDEX 0x10 +#define NEG_MULTISCRBLT_INDEX 0x11 +#define NEG_MULTIOPAQUERECT_INDEX 0x12 +#define NEG_FAST_INDEX_INDEX 0x13 +#define NEG_POLYGON_SC_INDEX 0x14 +#define NEG_POLYGON_CB_INDEX 0x15 +#define NEG_POLYLINE_INDEX 0x16 +#define NEG_UNUSED23_INDEX 0x17 /* Must be ignored */ +#define NEG_FAST_GLYPH_INDEX 0x18 +#define NEG_ELLIPSE_SC_INDEX 0x19 +#define NEG_ELLIPSE_CB_INDEX 0x1A +#define NEG_GLYPH_INDEX_INDEX 0x1B +#define NEG_GLYPH_WEXTTEXTOUT_INDEX 0x1C /* Must be ignored */ +#define NEG_GLYPH_WLONGTEXTOUT_INDEX 0x1D /* Must be ignored */ +#define NEG_GLYPH_WLONGEXTTEXTOUT_INDEX 0x1E /* Must be ignored */ +#define NEG_UNUSED31_INDEX 0x1F /* Must be ignored */ + +/* Glyph Support Level */ +#define GLYPH_SUPPORT_NONE 0x0000 +#define GLYPH_SUPPORT_PARTIAL 0x0001 +#define GLYPH_SUPPORT_FULL 0x0002 +#define GLYPH_SUPPORT_ENCODE 0x0003 + +/* Gateway Usage Method */ +#define TSC_PROXY_MODE_NONE_DIRECT 0x0 +#define TSC_PROXY_MODE_DIRECT 0x1 +#define TSC_PROXY_MODE_DETECT 0x2 +#define TSC_PROXY_MODE_DEFAULT 0x3 +#define TSC_PROXY_MODE_NONE_DETECT 0x4 + +/* Gateway Credentials Source */ +#define TSC_PROXY_CREDS_MODE_USERPASS 0x0 +#define TSC_PROXY_CREDS_MODE_SMARTCARD 0x1 +#define TSC_PROXY_CREDS_MODE_ANY 0x2 + +/* Keyboard Hook */ +#define KEYBOARD_HOOK_LOCAL 0 +#define KEYBOARD_HOOK_REMOTE 1 +#define KEYBOARD_HOOK_FULLSCREEN_ONLY 2 + + typedef struct + { + UINT32 Length; + LPWSTR Address; + } TARGET_NET_ADDRESS; + +/* Logon Error Info */ +#define LOGON_MSG_DISCONNECT_REFUSED 0xFFFFFFF9 +#define LOGON_MSG_NO_PERMISSION 0xFFFFFFFA +#define LOGON_MSG_BUMP_OPTIONS 0xFFFFFFFB +#define LOGON_MSG_RECONNECT_OPTIONS 0xFFFFFFFC +#define LOGON_MSG_SESSION_TERMINATE 0xFFFFFFFD +#define LOGON_MSG_SESSION_CONTINUE 0xFFFFFFFE + +#define LOGON_FAILED_BAD_PASSWORD 0x00000000 +#define LOGON_FAILED_UPDATE_PASSWORD 0x00000001 +#define LOGON_FAILED_OTHER 0x00000002 +#define LOGON_WARNING 0x00000003 + +/* Server Status Info */ +#define STATUS_FINDING_DESTINATION 0x00000401 +#define STATUS_LOADING_DESTINATION 0x00000402 +#define STATUS_BRINGING_SESSION_ONLINE 0x00000403 +#define STATUS_REDIRECTING_TO_DESTINATION 0x00000404 +#define STATUS_VM_LOADING 0x00000501 +#define STATUS_VM_WAKING 0x00000502 +#define STATUS_VM_BOOTING 0x00000503 + +/* Compression Flags */ +#define PACKET_COMPR_TYPE_8K 0x00 +#define PACKET_COMPR_TYPE_64K 0x01 +#define PACKET_COMPR_TYPE_RDP6 0x02 +#define PACKET_COMPR_TYPE_RDP61 0x03 +#define PACKET_COMPR_TYPE_RDP8 0x04 + +/* Desktop Rotation Flags */ +#define ORIENTATION_LANDSCAPE 0 +#define ORIENTATION_PORTRAIT 90 +#define ORIENTATION_LANDSCAPE_FLIPPED 180 +#define ORIENTATION_PORTRAIT_FLIPPED 270 + +/* Clipboard feature mask */ +#define CLIPRDR_FLAG_LOCAL_TO_REMOTE 0x01 +#define CLIPRDR_FLAG_LOCAL_TO_REMOTE_FILES 0x02 +#define CLIPRDR_FLAG_REMOTE_TO_LOCAL 0x10 +#define CLIPRDR_FLAG_REMOTE_TO_LOCAL_FILES 0x20 + +#define CLIPRDR_FLAG_DEFAULT_MASK \ + (CLIPRDR_FLAG_LOCAL_TO_REMOTE | CLIPRDR_FLAG_LOCAL_TO_REMOTE_FILES | \ + CLIPRDR_FLAG_REMOTE_TO_LOCAL | CLIPRDR_FLAG_REMOTE_TO_LOCAL_FILES) + + /* ARC_CS_PRIVATE_PACKET */ + typedef struct + { + UINT32 cbLen; + UINT32 version; + UINT32 logonId; + BYTE securityVerifier[16]; + } ARC_CS_PRIVATE_PACKET; + + /* ARC_SC_PRIVATE_PACKET */ + typedef struct + { + UINT32 cbLen; + UINT32 version; + UINT32 logonId; + BYTE arcRandomBits[16]; + } ARC_SC_PRIVATE_PACKET; + + /* Channels */ + + typedef struct + { + int argc; + char** argv; + } ADDIN_ARGV; + + /* Extensions */ + + struct rdp_ext_set + { + char name[256]; /* plugin name or path */ + void* data; /* plugin data */ + }; + + /* Bitmap Cache */ + + typedef struct + { + UINT16 numEntries; + UINT16 maxSize; + } BITMAP_CACHE_CELL_INFO; + + typedef struct + { + UINT32 numEntries; + BOOL persistent; + } BITMAP_CACHE_V2_CELL_INFO; + + /* Glyph Cache */ + + typedef struct + { + UINT16 cacheEntries; + UINT16 cacheMaximumCellSize; + } GLYPH_CACHE_DEFINITION; + + /* Monitors */ + + typedef struct + { + INT32 left; + INT32 top; + INT32 right; + INT32 bottom; + UINT32 flags; + } MONITOR_DEF; + + typedef struct + { + UINT32 physicalWidth; + UINT32 physicalHeight; + UINT32 orientation; + UINT32 desktopScaleFactor; + UINT32 deviceScaleFactor; + } MONITOR_ATTRIBUTES; + + typedef struct + { + INT32 x; + INT32 y; + INT32 width; + INT32 height; + UINT32 is_primary; + UINT32 orig_screen; + MONITOR_ATTRIBUTES attributes; + } rdpMonitor; + +/* Device Redirection */ +#define RDPDR_DTYP_SERIAL 0x00000001 +#define RDPDR_DTYP_PARALLEL 0x00000002 +#define RDPDR_DTYP_PRINT 0x00000004 +#define RDPDR_DTYP_FILESYSTEM 0x00000008 +#define RDPDR_DTYP_SMARTCARD 0x00000020 + + typedef struct + { + UINT32 Id; + UINT32 Type; + char* Name; + } RDPDR_DEVICE; + + typedef struct + { + RDPDR_DEVICE device; + char* Path; + BOOL automount; + } RDPDR_DRIVE; + + typedef struct + { + RDPDR_DEVICE device; + char* DriverName; + BOOL IsDefault; + } RDPDR_PRINTER; + + typedef struct + { + RDPDR_DEVICE device; + } RDPDR_SMARTCARD; + + typedef struct + { + RDPDR_DEVICE device; + char* Path; + char* Driver; + char* Permissive; + } RDPDR_SERIAL; + + typedef struct + { + RDPDR_DEVICE device; + char* Path; + } RDPDR_PARALLEL; + +#define PROXY_TYPE_NONE 0 +#define PROXY_TYPE_HTTP 1 +#define PROXY_TYPE_SOCKS 2 +#define PROXY_TYPE_IGNORE 0xFFFF + +/* ThreadingFlags */ +#define THREADING_FLAGS_DISABLE_THREADS 0x00000001 + + enum rdp_settings_type + { + RDP_SETTINGS_TYPE_BOOL, + RDP_SETTINGS_TYPE_UINT16, + RDP_SETTINGS_TYPE_INT16, + RDP_SETTINGS_TYPE_UINT32, + RDP_SETTINGS_TYPE_INT32, + RDP_SETTINGS_TYPE_UINT64, + RDP_SETTINGS_TYPE_INT64, + RDP_SETTINGS_TYPE_STRING, + RDP_SETTINGS_TYPE_POINTER + }; + +/** + * rdpSettings creation flags + */ +#define FREERDP_SETTINGS_SERVER_MODE 0x00000001 + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SETTINGS_TYPES_H */ diff --git a/include/freerdp/settings_types_private.h b/include/freerdp/settings_types_private.h new file mode 100644 index 0000000..6d23110 --- /dev/null +++ b/include/freerdp/settings_types_private.h @@ -0,0 +1,806 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Internal settings header for functions not exported + * + * Copyright 2018 Armin Novak <armin.novak@thincast.com> + * Copyright 2018 Thincast Technologies GmbH + * + * 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_SETTINGS_TYPES_PRIVATE_H +#define FREERDP_SETTINGS_TYPES_PRIVATE_H + +#include <winpr/string.h> +#include <winpr/sspi.h> + +#include <freerdp/config.h> + +#include <freerdp/types.h> +#include <freerdp/api.h> +#include <freerdp/settings_types.h> + +#include <string.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef FREERDP_SETTINGS_INTERNAL_USE +#define SETTINGS_DEPRECATED(x) WINPR_DEPRECATED(x) +#else +#define SETTINGS_DEPRECATED(x) x +#endif + +struct rdp_settings +{ + /** + * WARNING: this data structure is carefully padded for ABI stability! + * Keeping this area clean is particularly challenging, so unless you are + * a trusted developer you should NOT take the liberty of adding your own + * options straight into the ABI stable zone. Instead, append them to the + * very end of this data structure, in the zone marked as ABI unstable. + */ + + SETTINGS_DEPRECATED(ALIGN64 void* instance); /* 0 */ + UINT64 padding001[16 - 1]; /* 1 */ + + /* Core Parameters */ + SETTINGS_DEPRECATED(ALIGN64 BOOL ServerMode); /* 16 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ShareId); /* 17 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 PduSource); /* 18 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ServerPort); /* 19 */ + SETTINGS_DEPRECATED(ALIGN64 char* ServerHostname); /* 20 */ + SETTINGS_DEPRECATED(ALIGN64 char* Username); /* 21 */ + SETTINGS_DEPRECATED(ALIGN64 char* Password); /* 22 */ + SETTINGS_DEPRECATED(ALIGN64 char* Domain); /* 23 */ + SETTINGS_DEPRECATED(ALIGN64 char* PasswordHash); /* 24 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL WaitForOutputBufferFlush); /* 25 */ + UINT64 padding26[27 - 26]; /* 26 */ + SETTINGS_DEPRECATED(ALIGN64 char* AcceptedCert); /* 27 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 AcceptedCertLength); /* 28 */ + SETTINGS_DEPRECATED(ALIGN64 char* UserSpecifiedServerName); /* 29 */ + SETTINGS_DEPRECATED(ALIGN64 char* AadServerHostname); /* 30 */ + UINT64 padding0064[64 - 31]; /* 31 */ + /* resource management related options */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ThreadingFlags); /* 64 */ + + UINT64 padding0128[128 - 65]; /* 65 */ + + /** + * GCC User Data Blocks + */ + + /* Client/Server Core Data */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RdpVersion); /* 128 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DesktopWidth); /* 129 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DesktopHeight); /* 130 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ColorDepth); /* 131 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ConnectionType); /* 132 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ClientBuild); /* 133 */ + SETTINGS_DEPRECATED(ALIGN64 char* ClientHostname); /* 134 */ + SETTINGS_DEPRECATED(ALIGN64 char* ClientProductId); /* 135 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 EarlyCapabilityFlags); /* 136 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL NetworkAutoDetect); /* 137 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportAsymetricKeys); /* 138 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportErrorInfoPdu); /* 139 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportStatusInfoPdu); /* 140 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportMonitorLayoutPdu); /* 141 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportGraphicsPipeline); /* 142 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportDynamicTimeZone); /* 143 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportHeartbeatPdu); /* 144 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DesktopPhysicalWidth); /* 145 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DesktopPhysicalHeight); /* 146 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 DesktopOrientation); /* 147 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DesktopScaleFactor); /* 148 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DeviceScaleFactor); /* 149 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportEdgeActionV1); /* 150 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportEdgeActionV2); /* 151 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportSkipChannelJoin); /* 152 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 SupportedColorDepths); /* 153 */ + UINT64 padding0192[192 - 154]; /* 154 */ + + /* Client/Server Security Data */ + SETTINGS_DEPRECATED(ALIGN64 BOOL UseRdpSecurityLayer); /* 192 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 EncryptionMethods); /* 193 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ExtEncryptionMethods); /* 194 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 EncryptionLevel); /* 195 */ + SETTINGS_DEPRECATED(ALIGN64 BYTE* ServerRandom); /* 196 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ServerRandomLength); /* 197 */ + SETTINGS_DEPRECATED(ALIGN64 BYTE* ServerCertificate); /* 198 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ServerCertificateLength); /* 199 */ + SETTINGS_DEPRECATED(ALIGN64 BYTE* ClientRandom); /* 200 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ClientRandomLength); /* 201 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL ServerLicenseRequired); /* 202 */ + SETTINGS_DEPRECATED(ALIGN64 char* ServerLicenseCompanyName); /* 203 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ServerLicenseProductVersion); /* 204 */ + SETTINGS_DEPRECATED(ALIGN64 char* ServerLicenseProductName); /* 205 */ + SETTINGS_DEPRECATED(ALIGN64 char** ServerLicenseProductIssuers); /* 206 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ServerLicenseProductIssuersCount); /* 207 */ + UINT64 padding0256[256 - 208]; /* 208 */ + + /* Client Network Data */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ChannelCount); /* 256 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ChannelDefArraySize); /* 257 */ + SETTINGS_DEPRECATED(ALIGN64 CHANNEL_DEF* ChannelDefArray); /* 258 */ + UINT64 padding0320[320 - 259]; /* 259 */ + + /* Client Cluster Data */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ClusterInfoFlags); /* 320 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RedirectedSessionId); /* 321 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL ConsoleSession); /* 322 */ + UINT64 padding0384[384 - 323]; /* 323 */ + + /* Client Monitor Data */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 MonitorCount); /* 384 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 MonitorDefArraySize); /* 385 */ + SETTINGS_DEPRECATED(ALIGN64 rdpMonitor* MonitorDefArray); /* 386 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SpanMonitors); /* 387 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL UseMultimon); /* 388 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL ForceMultimon); /* 389 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DesktopPosX); /* 390 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DesktopPosY); /* 391 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL ListMonitors); /* 392 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32* MonitorIds); /* 393 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 NumMonitorIds); /* 394 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 MonitorLocalShiftX); /*395 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 MonitorLocalShiftY); /* 396 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL HasMonitorAttributes); /* 397 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 MonitorFlags); /* 398 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 MonitorAttributeFlags); /* 399 */ + UINT64 padding0448[448 - 400]; /* 400 */ + + /* Client Message Channel Data */ + UINT64 padding0512[512 - 448]; /* 448 */ + + /* Client Multitransport Channel Data */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 MultitransportFlags); /* 512 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportMultitransport); /* 513 */ + UINT64 padding0576[576 - 514]; /* 514 */ + UINT64 padding0640[640 - 576]; /* 576 */ + + /* + * Client Info + */ + + /* Client Info (Shell) */ + SETTINGS_DEPRECATED(ALIGN64 char* AlternateShell); /* 640 */ + SETTINGS_DEPRECATED(ALIGN64 char* ShellWorkingDirectory); /* 641 */ + UINT64 padding0704[704 - 642]; /* 642 */ + + /* Client Info Flags */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AutoLogonEnabled); /* 704 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL CompressionEnabled); /* 705 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DisableCtrlAltDel); /* 706 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL EnableWindowsKey); /* 707 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL MaximizeShell); /* 708 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL LogonNotify); /* 709 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL LogonErrors); /* 710 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL MouseAttached); /* 711 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL MouseHasWheel); /* 712 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RemoteConsoleAudio); /* 713 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AudioPlayback); /* 714 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AudioCapture); /* 715 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL VideoDisable); /* 716 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL PasswordIsSmartcardPin); /* 717 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL UsingSavedCredentials); /* 718 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL ForceEncryptedCsPdu); /* 719 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL HiDefRemoteApp); /* 720 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 CompressionLevel); /* 721 */ + UINT64 padding0768[768 - 722]; /* 722 */ + + /* Client Info (Extra) */ + SETTINGS_DEPRECATED(ALIGN64 BOOL IPv6Enabled); /* 768 */ + SETTINGS_DEPRECATED(ALIGN64 char* ClientAddress); /* 769 */ + SETTINGS_DEPRECATED(ALIGN64 char* ClientDir); /* 770 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ClientSessionId); /* 771 */ + UINT64 padding0832[832 - 772]; /* 772 */ + + /* Client Info (Auto Reconnection) */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AutoReconnectionEnabled); /* 832 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 AutoReconnectMaxRetries); /* 833 */ + SETTINGS_DEPRECATED(ALIGN64 ARC_CS_PRIVATE_PACKET* ClientAutoReconnectCookie); /* 834 */ + SETTINGS_DEPRECATED(ALIGN64 ARC_SC_PRIVATE_PACKET* ServerAutoReconnectCookie); /* 835 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL PrintReconnectCookie); /* 836 */ + UINT64 padding0896[896 - 837]; /* 837 */ + + /* Client Info (Time Zone) */ + SETTINGS_DEPRECATED(ALIGN64 TIME_ZONE_INFORMATION* ClientTimeZone); /* 896 */ + SETTINGS_DEPRECATED(ALIGN64 char* DynamicDSTTimeZoneKeyName); /* 897 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DynamicDaylightTimeDisabled); /* 898 */ + UINT64 padding0960[960 - 899]; /* 899 */ + + /* Client Info (Performance Flags) */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 PerformanceFlags); /* 960 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AllowFontSmoothing); /* 961 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DisableWallpaper); /* 962 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DisableFullWindowDrag); /* 963 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DisableMenuAnims); /* 964 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DisableThemes); /* 965 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DisableCursorShadow); /* 966 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DisableCursorBlinking); /* 967 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AllowDesktopComposition); /* 968 */ + UINT64 padding1024[1024 - 969]; /* 969 */ + + /* Remote Assistance */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RemoteAssistanceMode); /* 1024 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteAssistanceSessionId); /* 1025 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteAssistancePassStub); /* 1026 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteAssistancePassword); /* 1027 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteAssistanceRCTicket); /* 1028 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL EncomspVirtualChannel); /* 1029 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RemdeskVirtualChannel); /* 1030 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL LyncRdpMode); /* 1031 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RemoteAssistanceRequestControl); /* 1032 */ + UINT64 padding1088[1088 - 1033]; /* 1033 */ + + /** + * X.224 Connection Request/Confirm + */ + + /* Protocol Security */ + SETTINGS_DEPRECATED(ALIGN64 BOOL TlsSecurity); /* 1088 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL NlaSecurity); /* 1089 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RdpSecurity); /* 1090 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL ExtSecurity); /* 1091 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL Authentication); /* 1092 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RequestedProtocols); /* 1093 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 SelectedProtocol); /* 1094 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 NegotiationFlags); /* 1095 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL NegotiateSecurityLayer); /* 1096 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RestrictedAdminModeRequired); /* 1097 */ + SETTINGS_DEPRECATED(ALIGN64 char* AuthenticationServiceClass); /* 1098 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DisableCredentialsDelegation); /* 1099 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 AuthenticationLevel); /* 1100 */ + SETTINGS_DEPRECATED(ALIGN64 char* AllowedTlsCiphers); /* 1101 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL VmConnectMode); /* 1102 */ + SETTINGS_DEPRECATED(ALIGN64 char* NtlmSamFile); /* 1103 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL FIPSMode); /* 1104 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 TlsSecLevel); /* 1105 */ + SETTINGS_DEPRECATED(ALIGN64 char* SspiModule); /* 1106 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 TLSMinVersion); /* 1107 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 TLSMaxVersion); /* 1108 */ + SETTINGS_DEPRECATED(ALIGN64 char* TlsSecretsFile); /* 1109 */ + SETTINGS_DEPRECATED(ALIGN64 char* AuthenticationPackageList); /* 1110 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RdstlsSecurity); /* 1111 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AadSecurity); /* 1112 */ + SETTINGS_DEPRECATED(ALIGN64 char* WinSCardModule); /* 1113 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RemoteCredentialGuard); /* 1114 */ + UINT64 padding1152[1152 - 1115]; /* 1115 */ + + /* Connection Cookie */ + SETTINGS_DEPRECATED(ALIGN64 BOOL MstscCookieMode); /* 1152 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 CookieMaxLength); /* 1153 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 PreconnectionId); /* 1154 */ + SETTINGS_DEPRECATED(ALIGN64 char* PreconnectionBlob); /* 1155 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SendPreconnectionPdu); /* 1156 */ + UINT64 padding1216[1216 - 1157]; /* 1157 */ + + /* Server Redirection */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RedirectionFlags); /* 1216 */ + SETTINGS_DEPRECATED(ALIGN64 char* TargetNetAddress); /* 1217 */ + SETTINGS_DEPRECATED(ALIGN64 BYTE* LoadBalanceInfo); /* 1218 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 LoadBalanceInfoLength); /* 1219 */ + SETTINGS_DEPRECATED(ALIGN64 char* RedirectionUsername); /* 1220 */ + SETTINGS_DEPRECATED(ALIGN64 char* RedirectionDomain); /* 1221 */ + SETTINGS_DEPRECATED(ALIGN64 BYTE* RedirectionPassword); /* 1222 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RedirectionPasswordLength); /* 1223 */ + SETTINGS_DEPRECATED(ALIGN64 char* RedirectionTargetFQDN); /* 1224 */ + SETTINGS_DEPRECATED(ALIGN64 char* RedirectionTargetNetBiosName); /* 1225 */ + SETTINGS_DEPRECATED(ALIGN64 BYTE* RedirectionTsvUrl); /* 1226 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RedirectionTsvUrlLength); /* 1227 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 TargetNetAddressCount); /* 1228 */ + SETTINGS_DEPRECATED(ALIGN64 char** TargetNetAddresses); /* 1229 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32* TargetNetPorts); /* 1230 */ + SETTINGS_DEPRECATED(ALIGN64 char* RedirectionAcceptedCert); /* 1231 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RedirectionAcceptedCertLength); /* 1232 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RedirectionPreferType); /* 1233 */ + SETTINGS_DEPRECATED(ALIGN64 BYTE* RedirectionGuid); /* 1234 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RedirectionGuidLength); /* 1235 */ + SETTINGS_DEPRECATED(ALIGN64 rdpCertificate* RedirectionTargetCertificate); /* 1236 */ + UINT64 padding1280[1280 - 1237]; /* 1237 */ + + /** + * Security + */ + + /* Credentials Cache */ + SETTINGS_DEPRECATED(ALIGN64 BYTE* Password51); /* 1280 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 Password51Length); /* 1281 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SmartcardLogon); /* 1282 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL PromptForCredentials); /* 1283 */ + UINT64 padding1284[1285 - 1284]; /* 1284 */ + + /* Settings used for smartcard emulation */ + SETTINGS_DEPRECATED(ALIGN64 char* SmartcardCertificate); /* 1285 */ + SETTINGS_DEPRECATED(ALIGN64 char* SmartcardPrivateKey); /* 1286 */ + UINT64 padding1287[1288 - 1287]; /* 1287 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SmartcardEmulation); /* 1288 */ + SETTINGS_DEPRECATED(ALIGN64 char* Pkcs11Module); /* 1289 */ + SETTINGS_DEPRECATED(ALIGN64 char* PkinitAnchors); /* 1290 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 KeySpec); /* 1291 */ + SETTINGS_DEPRECATED(ALIGN64 char* CardName); /* 1292 */ + SETTINGS_DEPRECATED(ALIGN64 char* ReaderName); /* 1293 */ + SETTINGS_DEPRECATED(ALIGN64 char* ContainerName); /* 1294 */ + SETTINGS_DEPRECATED(ALIGN64 char* CspName); /* 1295 */ + UINT64 padding1344[1344 - 1296]; /* 1296 */ + + /* Kerberos Authentication */ + SETTINGS_DEPRECATED(ALIGN64 char* KerberosKdcUrl); /* 1344 */ + SETTINGS_DEPRECATED(ALIGN64 char* KerberosRealm); /* 1345 */ + SETTINGS_DEPRECATED(ALIGN64 char* KerberosStartTime); /* 1346 */ + SETTINGS_DEPRECATED(ALIGN64 char* KerberosLifeTime); /* 1347 */ + SETTINGS_DEPRECATED(ALIGN64 char* KerberosRenewableLifeTime); /* 1348 */ + SETTINGS_DEPRECATED(ALIGN64 char* KerberosCache); /* 1349 */ + SETTINGS_DEPRECATED(ALIGN64 char* KerberosArmor); /* 1350 */ + SETTINGS_DEPRECATED(ALIGN64 char* KerberosKeytab); /* 1351 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL KerberosRdgIsProxy); /* 1352 */ + UINT64 padding1408[1408 - 1353]; /* 1353 */ + + /* Server Certificate */ + SETTINGS_DEPRECATED(ALIGN64 BOOL IgnoreCertificate); /* 1408 */ + SETTINGS_DEPRECATED(ALIGN64 char* CertificateName); /* 1409 */ + UINT64 padding1410[1413 - 1410]; /* 1410 */ + SETTINGS_DEPRECATED(ALIGN64 rdpPrivateKey* RdpServerRsaKey); /* 1413 */ + SETTINGS_DEPRECATED(ALIGN64 rdpCertificate* RdpServerCertificate); /* 1414 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL ExternalCertificateManagement); /* 1415 */ + UINT64 padding1416[1419 - 1416]; /* 1416 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AutoAcceptCertificate); /* 1419 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AutoDenyCertificate); /* 1420 */ + SETTINGS_DEPRECATED(ALIGN64 char* CertificateAcceptedFingerprints); /* 1421 */ + UINT64 padding1422[1423 - 1422]; /* 1422 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL CertificateCallbackPreferPEM); /* 1423 */ + UINT64 padding1472[1472 - 1424]; /* 1424 */ + UINT64 padding1536[1536 - 1472]; /* 1472 */ + + /** + * User Interface + */ + + /* Window Settings */ + SETTINGS_DEPRECATED(ALIGN64 BOOL Workarea); /* 1536 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL Fullscreen); /* 1537 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 PercentScreen); /* 1538 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GrabKeyboard); /* 1539 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL Decorations); /* 1540 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL MouseMotion); /* 1541 */ + SETTINGS_DEPRECATED(ALIGN64 char* WindowTitle); /* 1542 */ + SETTINGS_DEPRECATED(ALIGN64 UINT64 ParentWindowId); /* 1543 */ + UINT64 padding1544[1545 - 1544]; /* 1544 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AsyncUpdate); /* 1545 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AsyncChannels); /* 1546 */ + UINT64 padding1548[1548 - 1547]; /* 1547 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL ToggleFullscreen); /* 1548 */ + SETTINGS_DEPRECATED(ALIGN64 char* WmClass); /* 1549 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL EmbeddedWindow); /* 1550 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SmartSizing); /* 1551 */ + SETTINGS_DEPRECATED(ALIGN64 INT32 XPan); /* 1552 */ + SETTINGS_DEPRECATED(ALIGN64 INT32 YPan); /* 1553 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 SmartSizingWidth); /* 1554 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 SmartSizingHeight); /* 1555 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL PercentScreenUseWidth); /* 1556 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL PercentScreenUseHeight); /* 1557 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DynamicResolutionUpdate); /* 1558 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GrabMouse); /* 1559 */ + UINT64 padding1601[1601 - 1560]; /* 1560 */ + + /* Miscellaneous */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SoftwareGdi); /* 1601 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL LocalConnection); /* 1602 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AuthenticationOnly); /* 1603 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL CredentialsFromStdin); /* 1604 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL UnmapButtons); /* 1605 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL OldLicenseBehaviour); /* 1606 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL MouseUseRelativeMove); /* 1607 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL UseCommonStdioCallbacks); /* 1608 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL ConnectChildSession); /* 1609 */ + UINT64 padding1664[1664 - 1610]; /* 1610 */ + + /* Names */ + SETTINGS_DEPRECATED(ALIGN64 char* ComputerName); /* 1664 */ + UINT64 padding1728[1728 - 1665]; /* 1665 */ + + /* Files */ + SETTINGS_DEPRECATED(ALIGN64 char* ConnectionFile); /* 1728 */ + SETTINGS_DEPRECATED(ALIGN64 char* AssistanceFile); /* 1729 */ + UINT64 padding1792[1792 - 1730]; /* 1730 */ + + /* Paths */ + SETTINGS_DEPRECATED(ALIGN64 char* HomePath); /* 1792 */ + SETTINGS_DEPRECATED(ALIGN64 char* ConfigPath); /* 1793 */ + SETTINGS_DEPRECATED(ALIGN64 char* CurrentPath); /* 1794 */ + UINT64 padding1856[1856 - 1795]; /* 1795 */ + + /* Recording */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DumpRemoteFx); /* 1856 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL PlayRemoteFx); /* 1857 */ + SETTINGS_DEPRECATED(ALIGN64 char* DumpRemoteFxFile); /* 1858 */ + SETTINGS_DEPRECATED(ALIGN64 char* PlayRemoteFxFile); /* 1859 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL TransportDump); /* 1860 */ + SETTINGS_DEPRECATED(ALIGN64 char* TransportDumpFile); /* 1861 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL TransportDumpReplay); /* 1862 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DeactivateClientDecoding); /* 1863 */ + UINT64 padding1920[1920 - 1864]; /* 1864 */ + UINT64 padding1984[1984 - 1920]; /* 1920 */ + + /** + * Gateway + */ + + /* Gateway */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 GatewayUsageMethod); /* 1984 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 GatewayPort); /* 1985 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayHostname); /* 1986 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayUsername); /* 1987 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayPassword); /* 1988 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayDomain); /* 1989 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 GatewayCredentialsSource); /* 1990 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GatewayUseSameCredentials); /* 1991 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GatewayEnabled); /* 1992 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GatewayBypassLocal); /* 1993 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GatewayRpcTransport); /* 1994 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GatewayHttpTransport); /* 1995 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GatewayUdpTransport); /* 1996 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayAccessToken); /* 1997 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayAcceptedCert); /* 1998 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 GatewayAcceptedCertLength); /* 1999 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GatewayHttpUseWebsockets); /* 2000 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GatewayHttpExtAuthSspiNtlm); /* 2001 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayHttpExtAuthBearer); /* 2002 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayUrl); /* 2003 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GatewayArmTransport); /* 2004 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayAvdWvdEndpointPool); /* 2005 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayAvdGeo); /* 2006 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayAvdArmpath); /* 2007 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayAvdAadtenantid); /* 2008 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayAvdDiagnosticserviceurl); /* 2009 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayAvdHubdiscoverygeourl); /* 2010 */ + SETTINGS_DEPRECATED(ALIGN64 char* GatewayAvdActivityhint); /* 2011 */ + UINT64 padding2015[2015 - 2012]; /* 2012 */ + + /* Proxy */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ProxyType); /* 2015 */ + SETTINGS_DEPRECATED(ALIGN64 char* ProxyHostname); /* 2016 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 ProxyPort); /* 2017 */ + SETTINGS_DEPRECATED(ALIGN64 char* ProxyUsername); /* 2018 */ + SETTINGS_DEPRECATED(ALIGN64 char* ProxyPassword); /* 2019 */ + UINT64 padding2112[2112 - 2020]; /* 2020 */ + + /** + * RemoteApp + */ + + /* RemoteApp */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RemoteApplicationMode); /* 2112 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteApplicationName); /* 2113 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteApplicationIcon); /* 2114 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteApplicationProgram); /* 2115 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteApplicationFile); /* 2116 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteApplicationGuid); /* 2117 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteApplicationCmdLine); /* 2118 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RemoteApplicationExpandCmdLine); /* 2119 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RemoteApplicationExpandWorkingDir); /* 2120 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DisableRemoteAppCapsCheck); /* 2121 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RemoteAppNumIconCaches); /* 2122 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RemoteAppNumIconCacheEntries); /* 2123 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RemoteAppLanguageBarSupported); /* 2124 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RemoteWndSupportLevel); /* 2125 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RemoteApplicationSupportLevel); /* 2126 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RemoteApplicationSupportMask); /* 2127 */ + SETTINGS_DEPRECATED(ALIGN64 char* RemoteApplicationWorkingDir); /* 2128 */ + UINT64 padding2176[2176 - 2129]; /* 2129 */ + UINT64 padding2240[2240 - 2176]; /* 2176 */ + + /** + * Mandatory Capabilities + */ + + /* Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 BYTE* ReceivedCapabilities); /* 2240 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ReceivedCapabilitiesSize); /* 2241 */ + SETTINGS_DEPRECATED(ALIGN64 BYTE** ReceivedCapabilityData); /* 2242 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32* ReceivedCapabilityDataSizes); /* 2243 */ + UINT64 padding2304[2304 - 2244]; /* 2244 */ + + /* General Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 OsMajorType); /* 2304 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 OsMinorType); /* 2305 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RefreshRect); /* 2306 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SuppressOutput); /* 2307 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL FastPathOutput); /* 2308 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SaltedChecksum); /* 2309 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL LongCredentialsSupported); /* 2310 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL NoBitmapCompressionHeader); /* 2311 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL BitmapCompressionDisabled); /* 2312 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 CapsProtocolVersion); /* 2313 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 CapsGeneralCompressionTypes); /* 2314 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 CapsUpdateCapabilityFlag); /* 2315 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 CapsRemoteUnshareFlag); /* 2316 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 CapsGeneralCompressionLevel); /* 2317 */ + UINT64 padding2368[2368 - 2318]; /* 2318 */ + + /* Bitmap Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DesktopResize); /* 2368 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DrawAllowDynamicColorFidelity); /* 2369 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DrawAllowColorSubsampling); /* 2370 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DrawAllowSkipAlpha); /* 2371 */ + UINT64 padding2432[2432 - 2372]; /* 2372 */ + + /* Order Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 BYTE* OrderSupport); /* 2432 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL BitmapCacheV3Enabled); /* 2433 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AltSecFrameMarkerSupport); /* 2434 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AllowUnanouncedOrdersFromServer); /* 2435 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 OrderSupportFlags); /* 2436 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 OrderSupportFlagsEx); /* 2437 */ + SETTINGS_DEPRECATED(ALIGN64 char* TerminalDescriptor); /* 2438 */ + SETTINGS_DEPRECATED(ALIGN64 UINT16 TextANSICodePage); /* 2439 */ + UINT64 padding2497[2497 - 2440]; /* 2440 */ + + /* Bitmap Cache Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 BOOL BitmapCacheEnabled); /* 2497 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 BitmapCacheVersion); /* 2498 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL AllowCacheWaitingList); /* 2499 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL BitmapCachePersistEnabled); /* 2500 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 BitmapCacheV2NumCells); /* 2501 */ + SETTINGS_DEPRECATED(ALIGN64 BITMAP_CACHE_V2_CELL_INFO* BitmapCacheV2CellInfo); /* 2502 */ + SETTINGS_DEPRECATED(ALIGN64 char* BitmapCachePersistFile); /* 2503 */ + UINT64 padding2560[2560 - 2504]; /* 2504 */ + + /* Pointer Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ColorPointerCacheSize); /* 2560 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 PointerCacheSize); /* 2561 */ + UINT64 padding2624[2622 - 2562]; /* 2562 */ + + /* Input Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 char* KeyboardRemappingList); /* 2622 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 KeyboardCodePage); /* 2623 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 KeyboardLayout); /* 2624 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 KeyboardType); /* 2625 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 KeyboardSubType); /* 2626 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 KeyboardFunctionKey); /* 2627 */ + SETTINGS_DEPRECATED(ALIGN64 char* ImeFileName); /* 2628 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL UnicodeInput); /* 2629 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL FastPathInput); /* 2630 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL MultiTouchInput); /* 2631 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL MultiTouchGestures); /* 2632 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 KeyboardHook); /* 2633 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL HasHorizontalWheel); /* 2634 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL HasExtendedMouseEvent); /* 2635 */ + + /** SuspendInput disables processing of keyboard/mouse/multitouch input. + * If used by an implementation ensure proper state resync after reenabling + * input + */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SuspendInput); /* 2636 */ + SETTINGS_DEPRECATED(ALIGN64 char* KeyboardPipeName); /* 2637 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL HasRelativeMouseEvent); /* 2638 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL HasQoeEvent); /* 2639 */ + UINT64 padding2688[2688 - 2640]; /* 2640 */ + + /* Brush Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 BrushSupportLevel); /* 2688 */ + UINT64 padding2752[2752 - 2689]; /* 2689 */ + + /* Glyph Cache Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 GlyphSupportLevel); /* 2752 */ + SETTINGS_DEPRECATED(ALIGN64 GLYPH_CACHE_DEFINITION* GlyphCache); /* 2753 */ + SETTINGS_DEPRECATED(ALIGN64 GLYPH_CACHE_DEFINITION* FragCache); /* 2754 */ + UINT64 padding2816[2816 - 2755]; /* 2755 */ + + /* Offscreen Bitmap Cache */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 OffscreenSupportLevel); /* 2816 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 OffscreenCacheSize); /* 2817 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 OffscreenCacheEntries); /* 2818 */ + UINT64 padding2880[2880 - 2819]; /* 2819 */ + + /* Virtual Channel Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 VCFlags); /* 2880 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 VCChunkSize); /* 2881 */ + UINT64 padding2944[2944 - 2882]; /* 2882 */ + + /* Sound Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SoundBeepsEnabled); /* 2944 */ + UINT64 padding3008[3008 - 2945]; /* 2945 */ + UINT64 padding3072[3072 - 3008]; /* 3008 */ + + /** + * Optional Capabilities + */ + + /* Bitmap Cache Host Capabilities */ + UINT64 padding3136[3136 - 3072]; /* 3072 */ + + /* Control Capabilities */ + UINT64 padding3200[3200 - 3136]; /* 3136 */ + + /* Window Activation Capabilities */ + UINT64 padding3264[3264 - 3200]; /* 3200 */ + + /* Font Capabilities */ + UINT64 padding3328[3328 - 3264]; /* 3264 */ + + /* Multifragment Update Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 MultifragMaxRequestSize); /* 3328 */ + UINT64 padding3392[3392 - 3329]; /* 3329 */ + + /* Large Pointer Update Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 LargePointerFlag); /* 3392 */ + UINT64 padding3456[3456 - 3393]; /* 3393 */ + + /* Desktop Composition Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 CompDeskSupportLevel); /* 3456 */ + UINT64 padding3520[3520 - 3457]; /* 3457 */ + + /* Surface Commands Capabilities */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SurfaceCommandsEnabled); /* 3520 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL FrameMarkerCommandEnabled); /* 3521 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SurfaceFrameMarkerEnabled); /* 3522 */ + UINT64 padding3584[3584 - 3523]; /* 3523 */ + UINT64 padding3648[3648 - 3584]; /* 3584 */ + + /* + * Bitmap Codecs Capabilities + */ + + /* RemoteFX */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RemoteFxOnly); /* 3648 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RemoteFxCodec); /* 3649 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RemoteFxCodecId); /* 3650 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RemoteFxCodecMode); /* 3651 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RemoteFxImageCodec); /* 3652 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 RemoteFxCaptureFlags); /* 3653 */ + UINT64 padding3712[3712 - 3654]; /* 3654 */ + + /* NSCodec */ + SETTINGS_DEPRECATED(ALIGN64 BOOL NSCodec); /* 3712 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 NSCodecId); /* 3713 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 FrameAcknowledge); /* 3714 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 NSCodecColorLossLevel); /* 3715 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL NSCodecAllowSubsampling); /* 3716 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL NSCodecAllowDynamicColorFidelity); /* 3717 */ + UINT64 padding3776[3776 - 3718]; /* 3718 */ + + /* JPEG */ + SETTINGS_DEPRECATED(ALIGN64 BOOL JpegCodec); /* 3776 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 JpegCodecId); /* 3777 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 JpegQuality); /* 3778 */ + UINT64 padding3840[3840 - 3779]; /* 3779 */ + + SETTINGS_DEPRECATED(ALIGN64 BOOL GfxThinClient); /* 3840 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GfxSmallCache); /* 3841 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GfxProgressive); /* 3842 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GfxProgressiveV2); /* 3843 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GfxH264); /* 3844 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GfxAVC444); /* 3845 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GfxSendQoeAck); /* 3846 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GfxAVC444v2); /* 3847 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 GfxCapsFilter); /* 3848 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL GfxPlanar); /* 3849 */ + UINT64 padding3904[3904 - 3850]; /* 3850 */ + + /** + * Caches + */ + + /* Bitmap Cache V3 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 BitmapCacheV3CodecId); /* 3904 */ + UINT64 padding3968[3968 - 3905]; /* 3905 */ + + /* Draw Nine Grid */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DrawNineGridEnabled); /* 3968 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DrawNineGridCacheSize); /* 3969 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DrawNineGridCacheEntries); /* 3970 */ + UINT64 padding4032[4032 - 3971]; /* 3971 */ + + /* Draw GDI+ */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DrawGdiPlusEnabled); /* 4032 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DrawGdiPlusCacheEnabled); /* 4033 */ + UINT64 padding4096[4096 - 4034]; /* 4034 */ + UINT64 padding4160[4160 - 4096]; /* 4096 */ + + /** + * Device Redirection + */ + + /* Device Redirection */ + SETTINGS_DEPRECATED(ALIGN64 BOOL DeviceRedirection); /* 4160 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DeviceCount); /* 4161 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DeviceArraySize); /* 4162 */ + SETTINGS_DEPRECATED(ALIGN64 RDPDR_DEVICE** DeviceArray); /* 4163 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL IgnoreInvalidDevices); /* 4164 */ + UINT64 padding4288[4288 - 4165]; /* 4165 */ + + /* Drive Redirection */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RedirectDrives); /* 4288 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RedirectHomeDrive); /* 4289 */ + SETTINGS_DEPRECATED(ALIGN64 char* DrivesToRedirect); /* 4290 */ + UINT64 padding4416[4416 - 4291]; /* 4291 */ + + /* Smartcard Redirection */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RedirectSmartCards); /* 4416 */ + /* WebAuthN Redirection */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RedirectWebAuthN); /* 4417 */ + UINT64 padding4544[4544 - 4418]; /* 4418 */ + + /* Printer Redirection */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RedirectPrinters); /* 4544 */ + UINT64 padding4672[4672 - 4545]; /* 4545 */ + + /* Serial and Parallel Port Redirection */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RedirectSerialPorts); /* 4672 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL RedirectParallelPorts); /* 4673 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL PreferIPv6OverIPv4); /* 4674 */ + UINT64 padding4800[4800 - 4675]; /* 4675 */ + + /** + * Other Redirection + */ + + SETTINGS_DEPRECATED(ALIGN64 BOOL RedirectClipboard); /* 4800 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 ClipboardFeatureMask); /* 4801 */ + SETTINGS_DEPRECATED(ALIGN64 char* ClipboardUseSelection); /* 4802 */ + SETTINGS_DEPRECATED(UINT64 padding4928[4928 - 4803]); /* 4803 */ + + /** + * Static Virtual Channels + */ + + SETTINGS_DEPRECATED(ALIGN64 UINT32 StaticChannelCount); /* 4928 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 StaticChannelArraySize); /* 4929 */ + SETTINGS_DEPRECATED(ALIGN64 ADDIN_ARGV** StaticChannelArray); /* 4930 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SynchronousStaticChannels); /* 4931 */ + UINT64 padding5056[5056 - 4932]; /* 4932 */ + + /** + * Dynamic Virtual Channels + */ + + SETTINGS_DEPRECATED(ALIGN64 UINT32 DynamicChannelCount); /* 5056 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 DynamicChannelArraySize); /* 5057 */ + SETTINGS_DEPRECATED(ALIGN64 ADDIN_ARGV** DynamicChannelArray); /* 5058 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportDynamicChannels); /* 5059 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SynchronousDynamicChannels); /* 5060 */ + UINT64 padding5184[5184 - 5061]; /* 5061 */ + + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportEchoChannel); /* 5184 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportDisplayControl); /* 5185 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportGeometryTracking); /* 5186 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportSSHAgentChannel); /* 5187 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL SupportVideoOptimized); /* 5188 */ + SETTINGS_DEPRECATED(ALIGN64 char* RDP2TCPArgs); /* 5189 */ + SETTINGS_DEPRECATED(ALIGN64 BOOL TcpKeepAlive); /* 5190 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 TcpKeepAliveRetries); /* 5191 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 TcpKeepAliveDelay); /* 5192 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 TcpKeepAliveInterval); /* 5193 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 TcpAckTimeout); /* 5194 */ + SETTINGS_DEPRECATED(ALIGN64 char* ActionScript); /* 5195 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 Floatbar); /* 5196 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 TcpConnectTimeout); /* 5197 */ + SETTINGS_DEPRECATED(ALIGN64 UINT32 FakeMouseMotionInterval); /* 5198 */ + UINT64 padding5312[5312 - 5199]; /* 5199 */ + + /** + * WARNING: End of ABI stable zone! + * + * The zone below this point is ABI unstable, and + * is therefore potentially subject to ABI breakage. + */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SETTINGS_TYPES_PRIVATE_H */ diff --git a/include/freerdp/streamdump.h b/include/freerdp/streamdump.h new file mode 100644 index 0000000..14bd5fd --- /dev/null +++ b/include/freerdp/streamdump.h @@ -0,0 +1,60 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Interface to dump RDP session data to files + * + * Copyright 2021 Armin Novak + * Copyright 2021 Thincast Technologies GmbH + * + * 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_STREAM_DUMP_H +#define FREERDP_STREAM_DUMP_H + +#include <winpr/stream.h> +#include <winpr/wtypes.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct stream_dump_context rdpStreamDumpContext; + + typedef enum + { + STREAM_MSG_SRV_RX = 1, + STREAM_MSG_SRV_TX = 2 + } StreamDumpDirection; + + FREERDP_API SSIZE_T stream_dump_append(const rdpContext* context, UINT32 flags, wStream* s, + size_t* offset); + FREERDP_API SSIZE_T stream_dump_get(const rdpContext* context, UINT32* flags, wStream* s, + size_t* offset, UINT64* pts); + + FREERDP_API BOOL stream_dump_register_handlers(rdpContext* context, CONNECTION_STATE state, + BOOL isServer); + + FREERDP_API void stream_dump_free(rdpStreamDumpContext* dump); + + WINPR_ATTR_MALLOC(stream_dump_free, 1) + FREERDP_API rdpStreamDumpContext* stream_dump_new(void); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_STREAM_DUMP_H */ diff --git a/include/freerdp/svc.h b/include/freerdp/svc.h new file mode 100644 index 0000000..e7154a2 --- /dev/null +++ b/include/freerdp/svc.h @@ -0,0 +1,81 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Static Virtual Channel Interface + * + * Copyright 2009-2011 Jay Sorg + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_SVC_H +#define FREERDP_SVC_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#include <winpr/wtsapi.h> +#include <freerdp/types.h> + +#define CHANNEL_EVENT_USER 1000 + +#define CHANNEL_EXPORT_FUNC_NAME "VirtualChannelEntry" +#define CHANNEL_EXPORT_FUNC_NAME_EX "VirtualChannelEntryEx" + +#define FREERDP_CHANNEL_MAGIC_NUMBER 0x46524450 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + UINT32 cbSize; + UINT32 protocolVersion; + PVIRTUALCHANNELINIT pVirtualChannelInit; + PVIRTUALCHANNELOPEN pVirtualChannelOpen; + PVIRTUALCHANNELCLOSE pVirtualChannelClose; + PVIRTUALCHANNELWRITE pVirtualChannelWrite; + + /* Extended Fields */ + UINT32 MagicNumber; /* identifies FreeRDP */ + void* pExtendedData; /* extended initial data */ + void* pInterface; /* channel callback interface, use after initialization */ + rdpContext* context; + } CHANNEL_ENTRY_POINTS_FREERDP; + typedef CHANNEL_ENTRY_POINTS_FREERDP* PCHANNEL_ENTRY_POINTS_FREERDP; + + typedef struct + { + UINT32 cbSize; + UINT32 protocolVersion; + PVIRTUALCHANNELINITEX pVirtualChannelInitEx; + PVIRTUALCHANNELOPENEX pVirtualChannelOpenEx; + PVIRTUALCHANNELCLOSEEX pVirtualChannelCloseEx; + PVIRTUALCHANNELWRITEEX pVirtualChannelWriteEx; + + /* Extended Fields */ + UINT32 MagicNumber; /* identifies FreeRDP */ + void* pExtendedData; /* extended initial data */ + void* pInterface; /* channel callback interface, use after initialization */ + rdpContext* context; + } CHANNEL_ENTRY_POINTS_FREERDP_EX; + typedef CHANNEL_ENTRY_POINTS_FREERDP_EX* PCHANNEL_ENTRY_POINTS_FREERDP_EX; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_SVC_H */ diff --git a/include/freerdp/transport_io.h b/include/freerdp/transport_io.h new file mode 100644 index 0000000..ca1ad2c --- /dev/null +++ b/include/freerdp/transport_io.h @@ -0,0 +1,85 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * FreeRDP Interface + * + * Copyright 2009-2011 Jay Sorg + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_TRANSPORT_IO_H +#define FREERDP_TRANSPORT_IO_H + +#include <winpr/stream.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> +#include <freerdp/settings.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef int (*pTCPConnect)(rdpContext* context, rdpSettings* settings, const char* hostname, + int port, DWORD timeout); + typedef BOOL (*pTransportFkt)(rdpTransport* transport); + typedef BOOL (*pTransportAttach)(rdpTransport* transport, int sockfd); + typedef int (*pTransportRWFkt)(rdpTransport* transport, wStream* s); + typedef SSIZE_T (*pTransportRead)(rdpTransport* transport, BYTE* data, size_t bytes); + typedef BOOL (*pTransportGetPublicKey)(rdpTransport* transport, const BYTE** data, + DWORD* length); + typedef BOOL (*pTransportSetBlockingMode)(rdpTransport* transport, BOOL blocking); + + struct rdp_transport_io + { + pTCPConnect TCPConnect; + pTransportFkt TLSConnect; + pTransportFkt TLSAccept; + pTransportAttach TransportAttach; + pTransportFkt TransportDisconnect; + pTransportRWFkt ReadPdu; /* Reads a whole PDU from the transport */ + pTransportRWFkt WritePdu; /* Writes a whole PDU to the transport */ + pTransportRead ReadBytes; /* Reads up to a requested amount of bytes from the transport */ + pTransportGetPublicKey GetPublicKey; + pTransportSetBlockingMode SetBlockingMode; + UINT64 reserved[54]; /* Reserve some space for ABI compatibility */ + }; + typedef struct rdp_transport_io rdpTransportIo; + + FREERDP_API BOOL freerdp_io_callback_set_event(rdpContext* context, BOOL reset); + + FREERDP_API const rdpTransportIo* freerdp_get_io_callbacks(rdpContext* context); + FREERDP_API BOOL freerdp_set_io_callbacks(rdpContext* context, + const rdpTransportIo* io_callbacks); + + FREERDP_API BOOL freerdp_set_io_callback_context(rdpContext* context, void* usercontext); + FREERDP_API void* freerdp_get_io_callback_context(rdpContext* context); + + /* PDU parser. + * incomplete: FALSE if the whole PDU is available, TRUE otherwise + * Return: 0 -> PDU header incomplete + * >0 -> PDU header complete, length of PDU. + * <0 -> Abort, an error occured + */ + FREERDP_API SSIZE_T transport_parse_pdu(rdpTransport* transport, wStream* s, BOOL* incomplete); + FREERDP_API rdpContext* transport_get_context(rdpTransport* transport); + FREERDP_API rdpTransport* freerdp_get_transport(rdpContext* context); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_TRANSPORT_IO_H */ diff --git a/include/freerdp/types.h b/include/freerdp/types.h new file mode 100644 index 0000000..044ee5f --- /dev/null +++ b/include/freerdp/types.h @@ -0,0 +1,141 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Type Definitions + * + * Copyright 2009-2011 Jay Sorg + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_TYPES_H +#define FREERDP_TYPES_H + +#include <winpr/wtypes.h> +#include <winpr/wtsapi.h> + +#ifndef MIN +#define MIN(x, y) (((x) < (y)) ? (x) : (y)) +#endif + +#ifndef MAX +#define MAX(x, y) (((x) > (y)) ? (x) : (y)) +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + CONNECTION_STATE_INITIAL, + CONNECTION_STATE_NEGO, + CONNECTION_STATE_NLA, + CONNECTION_STATE_AAD, + CONNECTION_STATE_MCS_CREATE_REQUEST, + CONNECTION_STATE_MCS_CREATE_RESPONSE, + CONNECTION_STATE_MCS_ERECT_DOMAIN, + CONNECTION_STATE_MCS_ATTACH_USER, + CONNECTION_STATE_MCS_ATTACH_USER_CONFIRM, + CONNECTION_STATE_MCS_CHANNEL_JOIN_REQUEST, + CONNECTION_STATE_MCS_CHANNEL_JOIN_RESPONSE, + CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT, + CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE, + CONNECTION_STATE_CONNECT_TIME_AUTO_DETECT_REQUEST, + CONNECTION_STATE_CONNECT_TIME_AUTO_DETECT_RESPONSE, + CONNECTION_STATE_LICENSING, + CONNECTION_STATE_MULTITRANSPORT_BOOTSTRAPPING_REQUEST, + CONNECTION_STATE_MULTITRANSPORT_BOOTSTRAPPING_RESPONSE, + CONNECTION_STATE_CAPABILITIES_EXCHANGE_DEMAND_ACTIVE, + CONNECTION_STATE_CAPABILITIES_EXCHANGE_MONITOR_LAYOUT, + CONNECTION_STATE_CAPABILITIES_EXCHANGE_CONFIRM_ACTIVE, + CONNECTION_STATE_FINALIZATION_SYNC, + CONNECTION_STATE_FINALIZATION_COOPERATE, + CONNECTION_STATE_FINALIZATION_REQUEST_CONTROL, + CONNECTION_STATE_FINALIZATION_PERSISTENT_KEY_LIST, + CONNECTION_STATE_FINALIZATION_FONT_LIST, + CONNECTION_STATE_FINALIZATION_CLIENT_SYNC, + CONNECTION_STATE_FINALIZATION_CLIENT_COOPERATE, + CONNECTION_STATE_FINALIZATION_CLIENT_GRANTED_CONTROL, + CONNECTION_STATE_FINALIZATION_CLIENT_FONT_MAP, + CONNECTION_STATE_ACTIVE + } CONNECTION_STATE; + + typedef struct rdp_channels rdpChannels; + typedef struct rdp_freerdp freerdp; + typedef struct rdp_context rdpContext; + typedef struct rdp_freerdp_peer freerdp_peer; + typedef struct rdp_transport rdpTransport; /* Opaque */ + + typedef struct + { + BYTE red; + BYTE green; + BYTE blue; + } PALETTE_ENTRY; + + typedef struct + { + UINT32 count; + PALETTE_ENTRY entries[256]; + } rdpPalette; + + typedef struct + { + DWORD size; + void* data[4]; + } RDP_PLUGIN_DATA; + + typedef struct + { + INT16 x; + INT16 y; + INT16 width; + INT16 height; + } RDP_RECT; + + typedef struct + { + UINT16 left; + UINT16 top; + UINT16 right; + UINT16 bottom; + } RECTANGLE_16; + + typedef struct + { + UINT32 left; + UINT32 top; + UINT32 width; + UINT32 height; + } RECTANGLE_32; + + /** @brief type of RDP transport */ + typedef enum + { + RDP_TRANSPORT_TCP = 0, + RDP_TRANSPORT_UDP_R, + RDP_TRANSPORT_UDP_L + } RDP_TRANSPORT_TYPE; + +#ifdef __cplusplus +} +#endif + +/* Plugin events */ + +#include <freerdp/message.h> +#include <winpr/collections.h> + +#endif /* __RDP_TYPES_H */ diff --git a/include/freerdp/update.h b/include/freerdp/update.h new file mode 100644 index 0000000..abfe640 --- /dev/null +++ b/include/freerdp/update.h @@ -0,0 +1,250 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Update Interface API + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_UPDATE_H +#define FREERDP_UPDATE_H + +#include <winpr/crt.h> +#include <winpr/wlog.h> +#include <winpr/synch.h> +#include <winpr/thread.h> +#include <winpr/stream.h> +#include <winpr/collections.h> + +#include <freerdp/rail.h> +#include <freerdp/types.h> +#include <freerdp/settings.h> +#include <freerdp/graphics.h> +#include <freerdp/utils/pcap.h> + +#include <freerdp/primary.h> +#include <freerdp/secondary.h> +#include <freerdp/altsec.h> +#include <freerdp/window.h> +#include <freerdp/pointer.h> + +/* Bitmap Updates */ +#define EX_COMPRESSED_BITMAP_HEADER_PRESENT 0x01 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct rdp_update rdpUpdate; + + typedef struct + { + UINT32 destLeft; + UINT32 destTop; + UINT32 destRight; + UINT32 destBottom; + UINT32 width; + UINT32 height; + UINT32 bitsPerPixel; + UINT32 flags; + UINT32 bitmapLength; + UINT32 cbCompFirstRowSize; + UINT32 cbCompMainBodySize; + UINT32 cbScanWidth; + UINT32 cbUncompressedSize; + BYTE* bitmapDataStream; + BOOL compressed; + } BITMAP_DATA; + + typedef struct + { + UINT32 number; + BITMAP_DATA* rectangles; + BOOL skipCompression; + } BITMAP_UPDATE; + + /* Palette Updates */ + + typedef struct + { + UINT32 number; + PALETTE_ENTRY entries[256]; + } PALETTE_UPDATE; + + /* Play Sound (System Beep) Updates */ + + typedef struct + { + UINT32 duration; + UINT32 frequency; + } PLAY_SOUND_UPDATE; + + /* Surface Command Updates */ + typedef struct + { + UINT32 highUniqueId; + UINT32 lowUniqueId; + UINT64 tmMilliseconds; + UINT64 tmSeconds; + } TS_COMPRESSED_BITMAP_HEADER_EX; + + typedef struct + { + BYTE bpp; + BYTE flags; + UINT16 codecID; + UINT16 width; + UINT16 height; + UINT32 bitmapDataLength; + TS_COMPRESSED_BITMAP_HEADER_EX exBitmapDataHeader; + BYTE* bitmapData; + } TS_BITMAP_DATA_EX; + + enum SURFCMD_CMDTYPE + { + CMDTYPE_SET_SURFACE_BITS = 0x0001, + CMDTYPE_FRAME_MARKER = 0x0004, + CMDTYPE_STREAM_SURFACE_BITS = 0x0006 + }; + + typedef struct + { + UINT32 cmdType; + UINT32 destLeft; + UINT32 destTop; + UINT32 destRight; + UINT32 destBottom; + TS_BITMAP_DATA_EX bmp; + BOOL skipCompression; + } SURFACE_BITS_COMMAND; + + typedef struct + { + UINT32 frameAction; + UINT32 frameId; + } SURFACE_FRAME_MARKER; + + enum SURFCMD_FRAMEACTION + { + SURFACECMD_FRAMEACTION_BEGIN = 0x0000, + SURFACECMD_FRAMEACTION_END = 0x0001 + }; + + /** @brief status code as in 2.2.5.2 Server Status Info PDU */ + enum + { + TS_STATUS_FINDING_DESTINATION = 0x00000401, + TS_STATUS_LOADING_DESTINATION = 0x00000402, + TS_STATUS_BRINGING_SESSION_ONLINE = 0x00000403, + TS_STATUS_REDIRECTING_TO_DESTINATION = 0x00000404, + TS_STATUS_VM_LOADING = 0x00000501, + TS_STATUS_VM_WAKING = 0x00000502, + TS_STATUS_VM_STARTING = 0x00000503, + TS_STATUS_VM_STARTING_MONITORING = 0x00000504, + TS_STATUS_VM_RETRYING_MONITORING = 0x00000505 + }; + + typedef struct + { + UINT32 frameId; + UINT32 commandCount; + SURFACE_BITS_COMMAND* commands; + } SURFACE_FRAME; + + /* defined inside libfreerdp-core */ + typedef struct rdp_update_proxy rdpUpdateProxy; + + /* Update Interface */ + + typedef BOOL (*pBeginPaint)(rdpContext* context); + typedef BOOL (*pEndPaint)(rdpContext* context); + typedef BOOL (*pSetBounds)(rdpContext* context, const rdpBounds* bounds); + + typedef BOOL (*pSynchronize)(rdpContext* context); + typedef BOOL (*pDesktopResize)(rdpContext* context); + typedef BOOL (*pBitmapUpdate)(rdpContext* context, const BITMAP_UPDATE* bitmap); + typedef BOOL (*pPalette)(rdpContext* context, const PALETTE_UPDATE* palette); + typedef BOOL (*pPlaySound)(rdpContext* context, const PLAY_SOUND_UPDATE* play_sound); + typedef BOOL (*pSetKeyboardIndicators)(rdpContext* context, UINT16 led_flags); + + typedef BOOL (*pRefreshRect)(rdpContext* context, BYTE count, const RECTANGLE_16* areas); + typedef BOOL (*pSuppressOutput)(rdpContext* context, BYTE allow, const RECTANGLE_16* area); + typedef BOOL (*pRemoteMonitors)(rdpContext* context, UINT32 count, const MONITOR_DEF* monitors); + + typedef BOOL (*pSurfaceCommand)(rdpContext* context, wStream* s); + typedef BOOL (*pSurfaceBits)(rdpContext* context, + const SURFACE_BITS_COMMAND* surfaceBitsCommand); + typedef BOOL (*pSurfaceFrameMarker)(rdpContext* context, + const SURFACE_FRAME_MARKER* surfaceFrameMarker); + typedef BOOL (*pSurfaceFrameBits)(rdpContext* context, const SURFACE_BITS_COMMAND* cmd, + BOOL first, BOOL last, UINT32 frameId); + typedef BOOL (*pSurfaceFrameAcknowledge)(rdpContext* context, UINT32 frameId); + + typedef BOOL (*pSaveSessionInfo)(rdpContext* context, UINT32 type, void* data); + typedef BOOL (*pSetKeyboardImeStatus)(rdpContext* context, UINT16 imeId, UINT32 imeState, + UINT32 imeConvMode); + typedef BOOL (*pServerStatusInfo)(rdpContext* context, UINT32 status); + + struct rdp_update + { + rdpContext* context; /* 0 */ + UINT32 paddingA[16 - 1]; /* 1 */ + + pBeginPaint BeginPaint; /* 16 */ + pEndPaint EndPaint; /* 17 */ + pSetBounds SetBounds; /* 18 */ + pSynchronize Synchronize; /* 19 */ + pDesktopResize DesktopResize; /* 20 */ + pBitmapUpdate BitmapUpdate; /* 21 */ + pPalette Palette; /* 22 */ + pPlaySound PlaySound; /* 23 */ + pSetKeyboardIndicators SetKeyboardIndicators; /* 24 */ + pSetKeyboardImeStatus SetKeyboardImeStatus; /* 25 */ + UINT32 paddingB[32 - 26]; /* 26 */ + + rdpPointerUpdate* pointer; /* 32 */ + rdpPrimaryUpdate* primary; /* 33 */ + rdpSecondaryUpdate* secondary; /* 34 */ + rdpAltSecUpdate* altsec; /* 35 */ + rdpWindowUpdate* window; /* 36 */ + UINT32 paddingC[48 - 37]; /* 37 */ + + pRefreshRect RefreshRect; /* 48 */ + pSuppressOutput SuppressOutput; /* 49 */ + pRemoteMonitors RemoteMonitors; /* 50 */ + UINT32 paddingD[64 - 51]; /* 51 */ + + pSurfaceCommand SurfaceCommand; /* 64 */ + pSurfaceBits SurfaceBits; /* 65 */ + pSurfaceFrameMarker SurfaceFrameMarker; /* 66 */ + pSurfaceFrameBits SurfaceFrameBits; /* 67 */ + pSurfaceFrameAcknowledge SurfaceFrameAcknowledge; /* 68 */ + pSaveSessionInfo SaveSessionInfo; /* 69 */ + pServerStatusInfo ServerStatusInfo; /* 70 */ + /* if autoCalculateBitmapData is set to TRUE, the server automatically + * fills BITMAP_DATA struct members: flags, cbCompMainBodySize and cbCompFirstRowSize. + */ + BOOL autoCalculateBitmapData; /* 71 */ + UINT32 paddingE[80 - 72]; /* 72 */ + }; + + FREERDP_API void rdp_update_lock(rdpUpdate* update); + FREERDP_API void rdp_update_unlock(rdpUpdate* update); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UPDATE_H */ diff --git a/include/freerdp/utils/aad.h b/include/freerdp/utils/aad.h new file mode 100644 index 0000000..c59e83c --- /dev/null +++ b/include/freerdp/utils/aad.h @@ -0,0 +1,35 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Network Level Authentication (NLA) + * + * Copyright 2023 Armin Novak <anovak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_UTILS_AAD_H +#define FREERDP_UTILS_AAD_H + +#include <winpr/wlog.h> + +#include <freerdp/api.h> +#include <freerdp/config.h> + +#ifdef WITH_AAD + +FREERDP_API char* freerdp_utils_aad_get_access_token(wLog* log, const char* data, size_t length); + +#endif + +#endif /* FREERDP_UTILS_AAD_H */ diff --git a/include/freerdp/utils/cliprdr_utils.h b/include/freerdp/utils/cliprdr_utils.h new file mode 100644 index 0000000..0b3295b --- /dev/null +++ b/include/freerdp/utils/cliprdr_utils.h @@ -0,0 +1,51 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDPDR utility functions + * + * Copyright 2022 Armin Novak <armin.novak@thincast.com> + * Copyright 2022 Thincast Technologies GmbH + * + * 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_UTILS_CLIPRDR_H +#define FREERDP_UTILS_CLIPRDR_H + +#include <winpr/wtypes.h> +#include <winpr/shell.h> +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API BOOL cliprdr_read_filedescriptor(wStream* s, FILEDESCRIPTORW* descriptor); + FREERDP_API BOOL cliprdr_write_filedescriptor(wStream* s, const FILEDESCRIPTORW* descriptor); + + FREERDP_API UINT cliprdr_parse_file_list(const BYTE* format_data, UINT32 format_data_length, + FILEDESCRIPTORW** file_descriptor_array, + UINT32* file_descriptor_count); + FREERDP_API UINT cliprdr_serialize_file_list(const FILEDESCRIPTORW* file_descriptor_array, + UINT32 file_descriptor_count, BYTE** format_data, + UINT32* format_data_length); + FREERDP_API UINT cliprdr_serialize_file_list_ex(UINT32 flags, + const FILEDESCRIPTORW* file_descriptor_array, + UINT32 file_descriptor_count, + BYTE** format_data, UINT32* format_data_length); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/freerdp/utils/drdynvc.h b/include/freerdp/utils/drdynvc.h new file mode 100644 index 0000000..cc96d95 --- /dev/null +++ b/include/freerdp/utils/drdynvc.h @@ -0,0 +1,39 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * + * GFX Utils - Helper functions converting something to string + * + * Copyright 2023 Armin Novak <armin.novak@thincast.com> + * Copyright 2023 Thincast Technologies GmbH + * + * 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_UTILS_DRDYNVC_H +#define FREERDP_UTILS_DRDYNVC_H + +#include <winpr/wtypes.h> +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API const char* drdynvc_get_packet_type(BYTE cmd); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/freerdp/utils/encoded_types.h b/include/freerdp/utils/encoded_types.h new file mode 100644 index 0000000..b3852fe --- /dev/null +++ b/include/freerdp/utils/encoded_types.h @@ -0,0 +1,40 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * + * Helper functions to parse encoded types into regular ones + * + * Copyright 2023 Pascal Nowack <Pascal.Nowack@gmx.de> + * + * 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_UTILS_ENCODED_TYPES_H +#define FREERDP_UTILS_ENCODED_TYPES_H + +#include <freerdp/api.h> +#include <winpr/stream.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API BOOL freerdp_read_four_byte_signed_integer(wStream* s, INT32* value); + + FREERDP_API BOOL freerdp_read_four_byte_float(wStream* s, double* value); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UTILS_ENCODED_TYPES_H */ diff --git a/include/freerdp/utils/gfx.h b/include/freerdp/utils/gfx.h new file mode 100644 index 0000000..0f5c189 --- /dev/null +++ b/include/freerdp/utils/gfx.h @@ -0,0 +1,41 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * + * GFX Utils - Helper functions converting something to string + * + * Copyright 2022 Armin Novak <armin.novak@thincast.com> + * Copyright 2022 Thincast Technologies GmbH + * + * 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_UTILS_GFX_H +#define FREERDP_UTILS_GFX_H + +#include <winpr/wtypes.h> +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API const char* rdpgfx_get_cmd_id_string(UINT16 cmdId); + + FREERDP_API const char* rdpgfx_get_codec_id_string(UINT16 codecId); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/freerdp/utils/http.h b/include/freerdp/utils/http.h new file mode 100644 index 0000000..9719402 --- /dev/null +++ b/include/freerdp/utils/http.h @@ -0,0 +1,75 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Smartcard Device Service Virtual Channel + * + * Copyright 2023 Isaac Klein <fifthdegree@protonmail.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_UTILS_HTTP_H +#define FREERDP_UTILS_HTTP_H + +#include <freerdp/api.h> + +typedef enum +{ + HTTP_STATUS_CONTINUE = 100, + HTTP_STATUS_SWITCH_PROTOCOLS = 101, + HTTP_STATUS_OK = 200, + HTTP_STATUS_CREATED = 201, + HTTP_STATUS_ACCEPTED = 202, + HTTP_STATUS_PARTIAL = 203, + HTTP_STATUS_NO_CONTENT = 204, + HTTP_STATUS_RESET_CONTENT = 205, + HTTP_STATUS_PARTIAL_CONTENT = 206, + HTTP_STATUS_WEBDAV_MULTI_STATUS = 207, + HTTP_STATUS_AMBIGUOUS = 300, + HTTP_STATUS_MOVED = 301, + HTTP_STATUS_REDIRECT = 302, + HTTP_STATUS_REDIRECT_METHOD = 303, + HTTP_STATUS_NOT_MODIFIED = 304, + HTTP_STATUS_USE_PROXY = 305, + HTTP_STATUS_REDIRECT_KEEP_VERB = 307, + HTTP_STATUS_BAD_REQUEST = 400, + HTTP_STATUS_DENIED = 401, + HTTP_STATUS_PAYMENT_REQ = 402, + HTTP_STATUS_FORBIDDEN = 403, + HTTP_STATUS_NOT_FOUND = 404, + HTTP_STATUS_BAD_METHOD = 405, + HTTP_STATUS_NONE_ACCEPTABLE = 406, + HTTP_STATUS_PROXY_AUTH_REQ = 407, + HTTP_STATUS_REQUEST_TIMEOUT = 408, + HTTP_STATUS_CONFLICT = 409, + HTTP_STATUS_GONE = 410, + HTTP_STATUS_LENGTH_REQUIRED = 411, + HTTP_STATUS_PRECOND_FAILED = 412, + HTTP_STATUS_REQUEST_TOO_LARGE = 413, + HTTP_STATUS_URI_TOO_LONG = 414, + HTTP_STATUS_UNSUPPORTED_MEDIA = 415, + HTTP_STATUS_RETRY_WITH = 449, + HTTP_STATUS_SERVER_ERROR = 500, + HTTP_STATUS_NOT_SUPPORTED = 501, + HTTP_STATUS_BAD_GATEWAY = 502, + HTTP_STATUS_SERVICE_UNAVAIL = 503, + HTTP_STATUS_GATEWAY_TIMEOUT = 504, + HTTP_STATUS_VERSION_NOT_SUP = 505 +} FREERDP_HTTP_STATUS; + +FREERDP_API BOOL freerdp_http_request(const char* url, const char* body, long* status_code, + BYTE** response, size_t* response_length); + +FREERDP_API const char* freerdp_http_status_string(long status); +FREERDP_API char* freerdp_http_status_string_format(long status, char* buffer, size_t size); + +#endif /* FREERDP_UTILS_HTTP_H */ diff --git a/include/freerdp/utils/passphrase.h b/include/freerdp/utils/passphrase.h new file mode 100644 index 0000000..f6a0f96 --- /dev/null +++ b/include/freerdp/utils/passphrase.h @@ -0,0 +1,44 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Passphrase Handling Utils + * + * Copyright 2011 Shea Levy <shea@shealevy.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_UTILS_PASSPHRASE_H +#define FREERDP_UTILS_PASSPHRASE_H + +#include <stdlib.h> +#include <stdio.h> + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API int freerdp_interruptible_getc(rdpContext* context, FILE* file); + FREERDP_API SSIZE_T freerdp_interruptible_get_line(rdpContext* context, char** lineptr, + size_t* size, FILE* stream); + FREERDP_API char* freerdp_passphrase_read(rdpContext* context, const char* prompt, char* buf, + size_t bufsiz, int from_stdin); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UTILS_PASSPHRASE_H */ diff --git a/include/freerdp/utils/pcap.h b/include/freerdp/utils/pcap.h new file mode 100644 index 0000000..5178f38 --- /dev/null +++ b/include/freerdp/utils/pcap.h @@ -0,0 +1,80 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * pcap File Format Utils + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_UTILS_PCAP_H +#define FREERDP_UTILS_PCAP_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + UINT32 magic_number; /* magic number */ + UINT16 version_major; /* major version number */ + UINT16 version_minor; /* minor version number */ + INT32 thiszone; /* GMT to local correction */ + UINT32 sigfigs; /* accuracy of timestamps */ + UINT32 snaplen; /* max length of captured packets, in octets */ + UINT32 network; /* data link type */ + } pcap_header; + + typedef struct + { + UINT32 ts_sec; /* timestamp seconds */ + UINT32 ts_usec; /* timestamp microseconds */ + UINT32 incl_len; /* number of octets of packet saved in file */ + UINT32 orig_len; /* actual length of packet */ + } pcap_record_header; + + typedef struct s_pcap_record pcap_record; + + struct s_pcap_record + { + pcap_record_header header; + union + { + void* data; + const void* cdata; + }; + UINT32 length; + pcap_record* next; + }; + + typedef struct rdp_pcap rdpPcap; + + FREERDP_API rdpPcap* pcap_open(const char* name, BOOL write); + FREERDP_API void pcap_close(rdpPcap* pcap); + + FREERDP_API BOOL pcap_add_record(rdpPcap* pcap, const void* data, size_t length); + FREERDP_API BOOL pcap_has_next_record(const rdpPcap* pcap); + FREERDP_API BOOL pcap_get_next_record(rdpPcap* pcap, pcap_record* record); + FREERDP_API BOOL pcap_get_next_record_header(rdpPcap* pcap, pcap_record* record); + FREERDP_API BOOL pcap_get_next_record_content(rdpPcap* pcap, pcap_record* record); + FREERDP_API void pcap_flush(rdpPcap* pcap); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UTILS_PCAP_H */ diff --git a/include/freerdp/utils/pod_arrays.h b/include/freerdp/utils/pod_arrays.h new file mode 100644 index 0000000..ef8667d --- /dev/null +++ b/include/freerdp/utils/pod_arrays.h @@ -0,0 +1,138 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * POD arrays + * + * Copyright 2022 David Fort <contact@hardening-consulting.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_UTILS_POD_ARRAYS_H_ +#define FREERDP_UTILS_POD_ARRAYS_H_ + +#include <winpr/wtypes.h> +#include <winpr/assert.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define POD_ARRAYS_IMPL(T, TLOWER) \ + typedef struct \ + { \ + T* values; \ + size_t nvalues; \ + } Array##T; \ + typedef BOOL Array##T##Cb(T* v, void* data); \ + \ + static INLINE void array_##TLOWER##_init(Array##T* a) \ + { \ + WINPR_ASSERT(a); \ + a->values = NULL; \ + a->nvalues = 0; \ + } \ + \ + static INLINE size_t array_##TLOWER##_size(const Array##T* a) \ + { \ + WINPR_ASSERT(a); \ + return a->nvalues; \ + } \ + \ + static INLINE T* array_##TLOWER##_data(const Array##T* a) \ + { \ + WINPR_ASSERT(a); \ + return a->values; \ + } \ + \ + static INLINE const T* array_##TLOWER##_cdata(const Array##T* a) \ + { \ + WINPR_ASSERT(a); \ + return (const T*)a->values; \ + } \ + \ + static INLINE T array_##TLOWER##_get(const Array##T* a, size_t idx) \ + { \ + WINPR_ASSERT(a); \ + WINPR_ASSERT(a->nvalues > idx); \ + return a->values[idx]; \ + } \ + \ + static INLINE void array_##TLOWER##_set(Array##T* a, size_t idx, T v) \ + { \ + WINPR_ASSERT(a); \ + WINPR_ASSERT(a->nvalues > idx); \ + a->values[idx] = v; \ + } \ + \ + static INLINE BOOL array_##TLOWER##_append(Array##T* a, T v) \ + { \ + WINPR_ASSERT(a); \ + T* tmp = realloc(a->values, sizeof(T) * (a->nvalues + 1)); \ + if (!tmp) \ + return FALSE; \ + \ + tmp[a->nvalues] = v; \ + a->values = tmp; \ + a->nvalues++; \ + return TRUE; \ + } \ + \ + static INLINE BOOL array_##TLOWER##_contains(const Array##T* a, T v) \ + { \ + WINPR_ASSERT(a); \ + \ + for (UINT32 i = 0; i < a->nvalues; i++) \ + { \ + if (memcmp(&a->values[i], &v, sizeof(T)) == 0) \ + return TRUE; \ + } \ + \ + return FALSE; \ + } \ + \ + static INLINE BOOL array_##TLOWER##_foreach(Array##T* a, Array##T##Cb cb, void* data) \ + { \ + WINPR_ASSERT(a); \ + for (size_t i = 0; i < a->nvalues; i++) \ + { \ + if (!cb(&a->values[i], data)) \ + return FALSE; \ + } \ + \ + return TRUE; \ + } \ + \ + static INLINE void array_##TLOWER##_reset(Array##T* a) \ + { \ + WINPR_ASSERT(a); \ + a->nvalues = 0; \ + } \ + \ + static INLINE void array_##TLOWER##_uninit(Array##T* a) \ + { \ + WINPR_ASSERT(a); \ + free(a->values); \ + \ + a->values = NULL; \ + a->nvalues = 0; \ + } + + POD_ARRAYS_IMPL(UINT16, uint16) + POD_ARRAYS_IMPL(UINT32, uint32) + POD_ARRAYS_IMPL(UINT64, uint64) + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UTILS_POD_ARRAYS_H_ */ diff --git a/include/freerdp/utils/profiler.h b/include/freerdp/utils/profiler.h new file mode 100644 index 0000000..29b9e32 --- /dev/null +++ b/include/freerdp/utils/profiler.h @@ -0,0 +1,99 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Profiler Utils + * + * Copyright 2011 Stephen Erisman + * + * 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_UTILS_PROFILER_H +#define FREERDP_UTILS_PROFILER_H + +#include <freerdp/api.h> +#include <freerdp/utils/stopwatch.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct S_PROFILER PROFILER; + + FREERDP_API PROFILER* profiler_create(const char* name); + FREERDP_API void profiler_free(PROFILER* profiler); + + FREERDP_API void profiler_enter(PROFILER* profiler); + FREERDP_API void profiler_exit(PROFILER* profiler); + + FREERDP_API void profiler_print_header(void); + FREERDP_API void profiler_print(PROFILER* profiler); + FREERDP_API void profiler_print_footer(void); + +#ifdef WITH_PROFILER +#define PROFILER_RENAME(prof, name) \ + do \ + { \ + profiler_free(prof); \ + prof = profiler_create(name); \ + } while (0); +#define PROFILER_DEFINE(prof) PROFILER* prof; +#define PROFILER_CREATE(prof, name) prof = profiler_create(name); +#define PROFILER_FREE(prof) profiler_free(prof); +#define PROFILER_ENTER(prof) profiler_enter(prof); +#define PROFILER_EXIT(prof) profiler_exit(prof); +#define PROFILER_PRINT_HEADER profiler_print_header(); +#define PROFILER_PRINT(prof) profiler_print(prof); +#define PROFILER_PRINT_FOOTER profiler_print_footer(); +#else +#define PROFILER_RENAME(prof, name) \ + do \ + { \ + } while (0); + +#define PROFILER_DEFINE(prof) +#define PROFILER_CREATE(prof, name) \ + do \ + { \ + } while (0); +#define PROFILER_FREE(prof) \ + do \ + { \ + } while (0); +#define PROFILER_ENTER(prof) \ + do \ + { \ + } while (0); +#define PROFILER_EXIT(prof) \ + do \ + { \ + } while (0); +#define PROFILER_PRINT_HEADER \ + do \ + { \ + } while (0); +#define PROFILER_PRINT(prof) \ + do \ + { \ + } while (0); +#define PROFILER_PRINT_FOOTER \ + do \ + { \ + } while (0); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UTILS_PROFILER_H */ diff --git a/include/freerdp/utils/proxy_utils.h b/include/freerdp/utils/proxy_utils.h new file mode 100644 index 0000000..0bd510e --- /dev/null +++ b/include/freerdp/utils/proxy_utils.h @@ -0,0 +1,37 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDP Proxy Utils + * + * Copyright 2016 Armin Novak <armin.novak@gmail.com> + * Copyright 2022 Adrian Vollmer <adrian.vollmer@syss.de> + * + * 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_PROXY_UTILS_H +#define FREERDP_PROXY_UTILS_H + +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API BOOL proxy_parse_uri(rdpSettings* settings, const char* uri_in); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_PROXY_UTILS_H */ diff --git a/include/freerdp/utils/rdpdr_utils.h b/include/freerdp/utils/rdpdr_utils.h new file mode 100644 index 0000000..6e205d5 --- /dev/null +++ b/include/freerdp/utils/rdpdr_utils.h @@ -0,0 +1,72 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * RDPDR utility functions + * + * Copyright 2021 Armin Novak <armin.novak@thincast.com> + * Copyright 2021 Thincast Technologies GmbH + * + * 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_UTILS_RDPDR_H +#define FREERDP_UTILS_RDPDR_H + +#include <winpr/stream.h> +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + UINT32 DeviceType; + UINT32 DeviceId; + char PreferredDosName[8]; + UINT32 DeviceDataLength; + BYTE* DeviceData; + } RdpdrDevice; + + typedef struct + { + UINT16 CapabilityType; + UINT16 CapabilityLength; + UINT32 Version; + } RDPDR_CAPABILITY_HEADER; + + FREERDP_API const char* rdpdr_component_string(UINT16 component); + FREERDP_API const char* rdpdr_packetid_string(UINT16 packetid); + FREERDP_API const char* rdpdr_irp_string(UINT32 major); + FREERDP_API const char* rdpdr_cap_type_string(UINT16 capability); + + FREERDP_API LONG scard_log_status_error(const char* tag, const char* what, LONG status); + FREERDP_API const char* scard_get_ioctl_string(UINT32 ioControlCode, BOOL funcName); + + FREERDP_API BOOL rdpdr_write_iocompletion_header(wStream* out, UINT32 DeviceId, + UINT32 CompletionId, UINT32 ioStatus); + + FREERDP_API void rdpdr_dump_received_packet(wLog* log, DWORD lvl, wStream* out, + const char* custom); + FREERDP_API void rdpdr_dump_send_packet(wLog* log, DWORD lvl, wStream* out, const char* custom); + + FREERDP_API UINT rdpdr_read_capset_header(wLog* log, wStream* s, + RDPDR_CAPABILITY_HEADER* header); + FREERDP_API UINT rdpdr_write_capset_header(wLog* log, wStream* s, + const RDPDR_CAPABILITY_HEADER* header); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/freerdp/utils/ringbuffer.h b/include/freerdp/utils/ringbuffer.h new file mode 100644 index 0000000..3de191c --- /dev/null +++ b/include/freerdp/utils/ringbuffer.h @@ -0,0 +1,131 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * + * Copyright 2014 Thincast Technologies GmbH + * Copyright 2014 Hardening <contact@hardening-consulting.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_UTILS_RINGBUFFER_H +#define FREERDP_UTILS_RINGBUFFER_H + +#include <winpr/wtypes.h> +#include <freerdp/api.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** @brief ring buffer meta data */ + typedef struct + { + size_t initialSize; + size_t freeSize; + size_t size; + size_t readPtr; + size_t writePtr; + BYTE* buffer; + } RingBuffer; + + /** @brief a piece of data in the ring buffer, exactly like a glibc iovec */ + typedef struct + { + size_t size; + const BYTE* data; + } DataChunk; + + /** + * initialise a ringbuffer + * + * @param initialSize the initial capacity of the ringBuffer + * @return if the initialisation was successful + */ + FREERDP_API BOOL ringbuffer_init(RingBuffer* rb, size_t initialSize); + + /** + * destroys internal data used by this ringbuffer + * + * @param ringbuffer A pointer to the ringbuffer + */ + FREERDP_API void ringbuffer_destroy(RingBuffer* ringbuffer); + + /** + * computes the space used in this ringbuffer + * + * @param ringbuffer A pointer to the ringbuffer + * @return the number of bytes stored in that ringbuffer + */ + FREERDP_API size_t ringbuffer_used(const RingBuffer* ringbuffer); + + /** returns the capacity of the ring buffer + * + * @param ringbuffer A pointer to the ringbuffer + * @return the capacity of this ring buffer + */ + FREERDP_API size_t ringbuffer_capacity(const RingBuffer* ringbuffer); + + /** writes some bytes in the ringbuffer, if the data doesn't fit, the ringbuffer + * is resized automatically + * + * @param rb the ringbuffer + * @param ptr a pointer on the data to add + * @param sz the size of the data to add + * @return if the operation was successful, it could fail in case of OOM during realloc() + */ + FREERDP_API BOOL ringbuffer_write(RingBuffer* rb, const BYTE* ptr, size_t sz); + + /** ensures that we have sz bytes available at the write head, and return a pointer + * on the write head + * + * @param rb the ring buffer + * @param sz the size to ensure + * @return a pointer on the write head, or NULL in case of OOM + */ + FREERDP_API BYTE* ringbuffer_ensure_linear_write(RingBuffer* rb, size_t sz); + + /** move ahead the write head in case some byte were written directly by using + * a pointer retrieved via ringbuffer_ensure_linear_write(). This function is + * used to commit the written bytes. The provided size should not exceed the + * size ensured by ringbuffer_ensure_linear_write() + * + * @param rb the ring buffer + * @param sz the number of bytes that have been written + * @return if the operation was successful, FALSE is sz is too big + */ + FREERDP_API BOOL ringbuffer_commit_written_bytes(RingBuffer* rb, size_t sz); + + /** peeks the buffer chunks for sz bytes and returns how many chunks are filled. + * Note that the sum of the resulting chunks may be smaller than sz. + * + * @param rb the ringbuffer + * @param chunks an array of data chunks that will contain data / size of chunks + * @param sz the requested size + * @return the number of chunks used for reading sz bytes + */ + FREERDP_API int ringbuffer_peek(const RingBuffer* rb, DataChunk chunks[2], size_t sz); + + /** move ahead the read head in case some byte were read using ringbuffer_peek() + * This function is used to commit the bytes that were effectively consumed. + * + * @param rb the ring buffer + * @param sz the number of bytes to read + */ + FREERDP_API void ringbuffer_commit_read_bytes(RingBuffer* rb, size_t sz); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UTILS_RINGBUFFER_H */ diff --git a/include/freerdp/utils/signal.h b/include/freerdp/utils/signal.h new file mode 100644 index 0000000..8a74b81 --- /dev/null +++ b/include/freerdp/utils/signal.h @@ -0,0 +1,63 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Signal handling + * + * Copyright 2011 Shea Levy <shea@shealevy.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_UTILS_SIGNAL_H +#define FREERDP_UTILS_SIGNAL_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef void (*freerdp_signal_handler_t)(int signum, const char* signame, void* context); + + FREERDP_API int freerdp_handle_signals(void); + + /** \brief registers a cleanup handler for non fatal signals. + * + * This allows cleaning up resources like with \b atexit but for signals. + * + * \param context a context for the clenaup handler. + * \param handler the function to call on cleanup. Must not be \b NULL + * + * \return \b TRUE if registered successfully, \b FALSE otherwise. + */ + FREERDP_API BOOL freerdp_add_signal_cleanup_handler(void* context, + freerdp_signal_handler_t handler); + + /** \brief unregisters a cleanup handler for non fatal signals. + * + * This allows removal of a cleanup handler for signals. + * + * \param context a context for the clenaup handler. + * \param handler the function to call on cleanup. Must not be \b NULL + * + * \return \b TRUE if unregistered successfully, \b FALSE otherwise. + */ + FREERDP_API BOOL freerdp_del_signal_cleanup_handler(void* context, + freerdp_signal_handler_t handler); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UTILS_SIGNAL_H */ diff --git a/include/freerdp/utils/smartcard_call.h b/include/freerdp/utils/smartcard_call.h new file mode 100644 index 0000000..5f6e026 --- /dev/null +++ b/include/freerdp/utils/smartcard_call.h @@ -0,0 +1,65 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Smartcard Device Service Virtual Channel + * + * Copyright 2011 O.S. Systems Software Ltda. + * Copyright 2011 Eduardo Fiss Beloni <beloni@ossystems.com.br> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_SMARTCARD_CALL_H +#define FREERDP_CHANNEL_SMARTCARD_CALL_H + +#include <winpr/crt.h> +#include <winpr/stream.h> + +#include <freerdp/api.h> +#include <freerdp/settings.h> +#include <freerdp/channels/scard.h> +#include <freerdp/utils/smartcard_operations.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct s_scard_call_context scard_call_context; + + FREERDP_API void smartcard_call_context_free(scard_call_context* ctx); + + WINPR_ATTR_MALLOC(smartcard_call_context_free, 1) + FREERDP_API scard_call_context* smartcard_call_context_new(const rdpSettings* settings); + + FREERDP_API BOOL smartcard_call_context_signal_stop(scard_call_context* ctx, BOOL reset); + FREERDP_API BOOL smartcard_call_context_add(scard_call_context* ctx, const char* name); + FREERDP_API BOOL smartcard_call_cancel_context(scard_call_context* ctx, SCARDCONTEXT context); + FREERDP_API BOOL smartcard_call_cancel_all_context(scard_call_context* ctx); + FREERDP_API BOOL smartcard_call_release_context(scard_call_context* ctx, SCARDCONTEXT context); + FREERDP_API BOOL smartcard_call_is_configured(scard_call_context* ctx); + + FREERDP_API BOOL smarcard_call_set_callbacks(scard_call_context* ctx, void* userdata, + void* (*fn_new)(void*, SCARDCONTEXT), + void (*fn_free)(void*)); + FREERDP_API void* smartcard_call_get_context(scard_call_context* ctx, SCARDCONTEXT hContext); + + FREERDP_API LONG smartcard_irp_device_control_call(scard_call_context* context, wStream* out, + UINT32* pIoStatus, + SMARTCARD_OPERATION* operation); + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_CHANNEL_SMARTCARD_CALL_H */ diff --git a/include/freerdp/utils/smartcard_operations.h b/include/freerdp/utils/smartcard_operations.h new file mode 100644 index 0000000..cab7fac --- /dev/null +++ b/include/freerdp/utils/smartcard_operations.h @@ -0,0 +1,96 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Smartcard Device Service Virtual Channel + * + * Copyright 2011 O.S. Systems Software Ltda. + * Copyright 2011 Eduardo Fiss Beloni <beloni@ossystems.com.br> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.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_CHANNEL_SMARTCARD_OPERATIONS_MAIN_H +#define FREERDP_CHANNEL_SMARTCARD_OPERATIONS_MAIN_H + +#include <winpr/crt.h> +#include <winpr/stream.h> +#include <winpr/smartcard.h> + +#include <freerdp/api.h> +#include <freerdp/channels/scard.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + typedef struct + { + union + { + Handles_Call handles; + Long_Call lng; + Context_Call context; + ContextAndStringA_Call contextAndStringA; + ContextAndStringW_Call contextAndStringW; + ContextAndTwoStringA_Call contextAndTwoStringA; + ContextAndTwoStringW_Call contextAndTwoStringW; + EstablishContext_Call establishContext; + ListReaderGroups_Call listReaderGroups; + ListReaders_Call listReaders; + GetStatusChangeA_Call getStatusChangeA; + LocateCardsA_Call locateCardsA; + LocateCardsW_Call locateCardsW; + LocateCards_ATRMask locateCardsATRMask; + LocateCardsByATRA_Call locateCardsByATRA; + LocateCardsByATRW_Call locateCardsByATRW; + GetStatusChangeW_Call getStatusChangeW; + GetReaderIcon_Call getReaderIcon; + GetDeviceTypeId_Call getDeviceTypeId; + Connect_Common_Call connect; + ConnectA_Call connectA; + ConnectW_Call connectW; + Reconnect_Call reconnect; + HCardAndDisposition_Call hCardAndDisposition; + State_Call state; + Status_Call status; + SCardIO_Request scardIO; + Transmit_Call transmit; + GetTransmitCount_Call getTransmitCount; + Control_Call control; + GetAttrib_Call getAttrib; + SetAttrib_Call setAttrib; + ReadCache_Common readCache; + ReadCacheA_Call readCacheA; + ReadCacheW_Call readCacheW; + WriteCache_Common writeCache; + WriteCacheA_Call writeCacheA; + WriteCacheW_Call writeCacheW; + } call; + UINT32 ioControlCode; + UINT32 completionID; + UINT32 deviceID; + SCARDCONTEXT hContext; + SCARDHANDLE hCard; + const char* ioControlCodeName; + } SMARTCARD_OPERATION; + + FREERDP_API LONG smartcard_irp_device_control_decode(wStream* s, UINT32 CompletionId, + UINT32 FileId, + SMARTCARD_OPERATION* operation); + FREERDP_API void smartcard_operation_free(SMARTCARD_OPERATION* op, BOOL allocated); + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_CHANNEL_SMARTCARD_CLIENT_OPERATIONS_H */ diff --git a/include/freerdp/utils/smartcard_pack.h b/include/freerdp/utils/smartcard_pack.h new file mode 100644 index 0000000..42a4f02 --- /dev/null +++ b/include/freerdp/utils/smartcard_pack.h @@ -0,0 +1,186 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Smart Card Structure Packing + * + * Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com> + * Copyright 2015 Thincast Technologies GmbH + * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com> + * Copyright 2020 Armin Novak <armin.novak@thincast.com> + * Copyright 2020 Thincast Technologies GmbH + * + * 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_CHANNEL_SMARTCARD_CLIENT_PACK_H +#define FREERDP_CHANNEL_SMARTCARD_CLIENT_PACK_H + +#include <winpr/crt.h> +#include <winpr/stream.h> +#include <winpr/smartcard.h> + +#include <freerdp/api.h> +#include <freerdp/channels/scard.h> + +#define SMARTCARD_COMMON_TYPE_HEADER_LENGTH 8 +#define SMARTCARD_PRIVATE_TYPE_HEADER_LENGTH 8 + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API LONG smartcard_pack_write_size_align(wStream* s, size_t size, UINT32 alignment); + FREERDP_API LONG smartcard_unpack_read_size_align(wStream* s, size_t size, UINT32 alignment); + + FREERDP_API SCARDCONTEXT smartcard_scard_context_native_from_redir(REDIR_SCARDCONTEXT* context); + FREERDP_API void smartcard_scard_context_native_to_redir(REDIR_SCARDCONTEXT* context, + SCARDCONTEXT hContext); + + FREERDP_API SCARDHANDLE smartcard_scard_handle_native_from_redir(REDIR_SCARDHANDLE* handle); + FREERDP_API void smartcard_scard_handle_native_to_redir(REDIR_SCARDHANDLE* handle, + SCARDHANDLE hCard); + + FREERDP_API LONG smartcard_unpack_common_type_header(wStream* s); + FREERDP_API void smartcard_pack_common_type_header(wStream* s); + + FREERDP_API LONG smartcard_unpack_private_type_header(wStream* s); + FREERDP_API void smartcard_pack_private_type_header(wStream* s, UINT32 objectBufferLength); + + FREERDP_API LONG smartcard_unpack_establish_context_call(wStream* s, + EstablishContext_Call* call); + + FREERDP_API LONG smartcard_pack_establish_context_return(wStream* s, + const EstablishContext_Return* ret); + + FREERDP_API LONG smartcard_unpack_context_call(wStream* s, Context_Call* call, + const char* name); + + FREERDP_API void smartcard_trace_long_return(const Long_Return* ret, const char* name); + + FREERDP_API LONG smartcard_unpack_list_reader_groups_call(wStream* s, + ListReaderGroups_Call* call, + BOOL unicode); + + FREERDP_API LONG smartcard_pack_list_reader_groups_return(wStream* s, + const ListReaderGroups_Return* ret, + BOOL unicode); + + FREERDP_API LONG smartcard_unpack_list_readers_call(wStream* s, ListReaders_Call* call, + BOOL unicode); + + FREERDP_API LONG smartcard_pack_list_readers_return(wStream* s, const ListReaders_Return* ret, + BOOL unicode); + + FREERDP_API LONG + smartcard_unpack_context_and_two_strings_a_call(wStream* s, ContextAndTwoStringA_Call* call); + + FREERDP_API LONG + smartcard_unpack_context_and_two_strings_w_call(wStream* s, ContextAndTwoStringW_Call* call); + + FREERDP_API LONG smartcard_unpack_context_and_string_a_call(wStream* s, + ContextAndStringA_Call* call); + + FREERDP_API LONG smartcard_unpack_context_and_string_w_call(wStream* s, + ContextAndStringW_Call* call); + + FREERDP_API LONG smartcard_unpack_locate_cards_a_call(wStream* s, LocateCardsA_Call* call); + + FREERDP_API LONG smartcard_pack_locate_cards_return(wStream* s, const LocateCards_Return* ret); + + FREERDP_API LONG smartcard_unpack_locate_cards_w_call(wStream* s, LocateCardsW_Call* call); + + FREERDP_API LONG smartcard_pack_locate_cards_w_return(wStream* s, const LocateCardsW_Call* ret); + + FREERDP_API LONG smartcard_unpack_connect_a_call(wStream* s, ConnectA_Call* call); + + FREERDP_API LONG smartcard_unpack_connect_w_call(wStream* s, ConnectW_Call* call); + + FREERDP_API LONG smartcard_pack_connect_return(wStream* s, const Connect_Return* ret); + + FREERDP_API LONG smartcard_unpack_reconnect_call(wStream* s, Reconnect_Call* call); + + FREERDP_API LONG smartcard_pack_reconnect_return(wStream* s, const Reconnect_Return* ret); + + FREERDP_API LONG smartcard_unpack_hcard_and_disposition_call(wStream* s, + HCardAndDisposition_Call* call, + const char* name); + + FREERDP_API LONG smartcard_unpack_get_status_change_a_call(wStream* s, + GetStatusChangeA_Call* call); + + FREERDP_API LONG smartcard_unpack_get_status_change_w_call(wStream* s, + GetStatusChangeW_Call* call); + + FREERDP_API LONG smartcard_pack_get_status_change_return(wStream* s, + const GetStatusChange_Return* ret, + BOOL unicode); + + FREERDP_API LONG smartcard_unpack_state_call(wStream* s, State_Call* call); + FREERDP_API LONG smartcard_pack_state_return(wStream* s, const State_Return* ret); + + FREERDP_API LONG smartcard_unpack_status_call(wStream* s, Status_Call* call, BOOL unicode); + + FREERDP_API LONG smartcard_pack_status_return(wStream* s, const Status_Return* ret, + BOOL unicode); + + FREERDP_API LONG smartcard_unpack_get_attrib_call(wStream* s, GetAttrib_Call* call); + + FREERDP_API LONG smartcard_pack_get_attrib_return(wStream* s, const GetAttrib_Return* ret, + DWORD dwAttrId, DWORD cbAttrCallLen); + + FREERDP_API LONG smartcard_unpack_set_attrib_call(wStream* s, SetAttrib_Call* call); + + FREERDP_API LONG smartcard_unpack_control_call(wStream* s, Control_Call* call); + + FREERDP_API LONG smartcard_pack_control_return(wStream* s, const Control_Return* ret); + + FREERDP_API LONG smartcard_unpack_transmit_call(wStream* s, Transmit_Call* call); + + FREERDP_API LONG smartcard_pack_transmit_return(wStream* s, const Transmit_Return* ret); + + FREERDP_API LONG smartcard_unpack_locate_cards_by_atr_a_call(wStream* s, + LocateCardsByATRA_Call* call); + + FREERDP_API LONG smartcard_unpack_locate_cards_by_atr_w_call(wStream* s, + LocateCardsByATRW_Call* call); + + FREERDP_API LONG smartcard_unpack_read_cache_a_call(wStream* s, ReadCacheA_Call* call); + + FREERDP_API LONG smartcard_unpack_read_cache_w_call(wStream* s, ReadCacheW_Call* call); + + FREERDP_API LONG smartcard_pack_read_cache_return(wStream* s, const ReadCache_Return* ret); + + FREERDP_API LONG smartcard_unpack_write_cache_a_call(wStream* s, WriteCacheA_Call* call); + + FREERDP_API LONG smartcard_unpack_write_cache_w_call(wStream* s, WriteCacheW_Call* call); + + FREERDP_API LONG smartcard_unpack_get_transmit_count_call(wStream* s, + GetTransmitCount_Call* call); + FREERDP_API LONG smartcard_pack_get_transmit_count_return(wStream* s, + const GetTransmitCount_Return* call); + + FREERDP_API LONG smartcard_unpack_get_reader_icon_call(wStream* s, GetReaderIcon_Call* call); + FREERDP_API LONG smartcard_pack_get_reader_icon_return(wStream* s, + const GetReaderIcon_Return* ret); + + FREERDP_API LONG smartcard_unpack_get_device_type_id_call(wStream* s, + GetDeviceTypeId_Call* call); + + FREERDP_API LONG smartcard_pack_device_type_id_return(wStream* s, + const GetDeviceTypeId_Return* ret); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CHANNEL_SMARTCARD_CLIENT_PACK_H */ diff --git a/include/freerdp/utils/smartcardlogon.h b/include/freerdp/utils/smartcardlogon.h new file mode 100644 index 0000000..66e1097 --- /dev/null +++ b/include/freerdp/utils/smartcardlogon.h @@ -0,0 +1,62 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Logging in with smartcards + * + * Copyright 2022 David Fort <contact@hardening-consulting.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_UTILS_SMARTCARDLOGON_H +#define FREERDP_UTILS_SMARTCARDLOGON_H + +#include <freerdp/types.h> +#include <freerdp/settings.h> +#include <freerdp/crypto/certificate.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct SmartcardKeyInfo_st SmartcardKeyInfo; + + typedef struct SmartcardCertInfo_st + { + LPWSTR csp; + LPWSTR reader; + rdpCertificate* certificate; + char* pkinitArgs; + UINT32 slotId; + char* keyName; + WCHAR* containerName; + char* upn; + char* userHint; + char* domainHint; + char* subject; + char* issuer; + BYTE sha1Hash[20]; + SmartcardKeyInfo* key_info; + } SmartcardCertInfo; + + FREERDP_API BOOL smartcard_enumerateCerts(const rdpSettings* settings, + SmartcardCertInfo*** scCerts, size_t* retCount, + BOOL gateway); + FREERDP_API BOOL smartcard_getCert(const rdpContext* context, SmartcardCertInfo** cert, + BOOL gateway); + FREERDP_API void smartcardCertInfo_Free(SmartcardCertInfo* pscCert); + FREERDP_API void smartcardCertList_Free(SmartcardCertInfo** pscCert, size_t count); + +#ifdef __cplusplus +} +#endif +#endif /* FREERDP_UTILS_SMARTCARDLOGON_H */ diff --git a/include/freerdp/utils/stopwatch.h b/include/freerdp/utils/stopwatch.h new file mode 100644 index 0000000..c267250 --- /dev/null +++ b/include/freerdp/utils/stopwatch.h @@ -0,0 +1,54 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Stopwatch Utils + * + * Copyright 2011 Stephen Erisman + * + * 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_UTILS_STOPWATCH_H +#define FREERDP_UTILS_STOPWATCH_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + UINT64 start; + UINT64 end; + UINT64 elapsed; + UINT32 count; + } STOPWATCH; + + FREERDP_API STOPWATCH* stopwatch_create(void); + FREERDP_API void stopwatch_free(STOPWATCH* stopwatch); + + FREERDP_API void stopwatch_start(STOPWATCH* stopwatch); + FREERDP_API void stopwatch_stop(STOPWATCH* stopwatch); + FREERDP_API void stopwatch_reset(STOPWATCH* stopwatch); + + FREERDP_API double stopwatch_get_elapsed_time_in_seconds(STOPWATCH* stopwatch); + FREERDP_API void stopwatch_get_elapsed_time_in_useconds(STOPWATCH* stopwatch, UINT32* sec, + UINT32* usec); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UTILS_STOPWATCH_H */ diff --git a/include/freerdp/utils/string.h b/include/freerdp/utils/string.h new file mode 100644 index 0000000..c008368 --- /dev/null +++ b/include/freerdp/utils/string.h @@ -0,0 +1,40 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * + * String Utils - Helper functions converting something to string + * + * Copyright 2022 Armin Novak <armin.novak@thincast.com> + * Copyright 2022 Thincast Technologies GmbH + * + * 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_UTILS_STRING_H +#define FREERDP_UTILS_STRING_H + +#include <freerdp/api.h> +#include <freerdp/types.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + + FREERDP_API char* rdp_redirection_flags_to_string(UINT32 flags, char* buffer, size_t size); + FREERDP_API char* rdp_cluster_info_flags_to_string(UINT32 flags, char* buffer, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UTILS_STRING_H */ diff --git a/include/freerdp/window.h b/include/freerdp/window.h new file mode 100644 index 0000000..4f62dfd --- /dev/null +++ b/include/freerdp/window.h @@ -0,0 +1,292 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Window Alternate Secondary Drawing Orders Interface API + * + * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.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_UPDATE_WINDOW_H +#define FREERDP_UPDATE_WINDOW_H + +#include <freerdp/types.h> +#include <freerdp/rail.h> + +/* Window Order Header Flags */ +#define WINDOW_ORDER_TYPE_WINDOW 0x01000000 +#define WINDOW_ORDER_TYPE_NOTIFY 0x02000000 +#define WINDOW_ORDER_TYPE_DESKTOP 0x04000000 + +#define WINDOW_ORDER_STATE_NEW 0x10000000 +#define WINDOW_ORDER_STATE_DELETED 0x20000000 + +/* Window Order Update */ +#define WINDOW_ORDER_FIELD_OWNER 0x00000002 +#define WINDOW_ORDER_FIELD_STYLE 0x00000008 +#define WINDOW_ORDER_FIELD_SHOW 0x00000010 +#define WINDOW_ORDER_FIELD_TITLE 0x00000004 +#define WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET 0x00004000 +#define WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE 0x00010000 +#define WINDOW_ORDER_FIELD_RESIZE_MARGIN_X 0x00000080 +#define WINDOW_ORDER_FIELD_RESIZE_MARGIN_Y 0x08000000 +#define WINDOW_ORDER_FIELD_RP_CONTENT 0x00020000 +#define WINDOW_ORDER_FIELD_ROOT_PARENT 0x00040000 +#define WINDOW_ORDER_FIELD_WND_OFFSET 0x00000800 +#define WINDOW_ORDER_FIELD_WND_CLIENT_DELTA 0x00008000 +#define WINDOW_ORDER_FIELD_WND_SIZE 0x00000400 +#define WINDOW_ORDER_FIELD_WND_RECTS 0x00000100 +#define WINDOW_ORDER_FIELD_VIS_OFFSET 0x00001000 +#define WINDOW_ORDER_FIELD_VISIBILITY 0x00000200 +#define WINDOW_ORDER_FIELD_OVERLAY_DESCRIPTION 0x00400000 +#define WINDOW_ORDER_FIELD_ICON_OVERLAY_NULL 0x00200000 +#define WINDOW_ORDER_FIELD_TASKBAR_BUTTON 0x00800000 +#define WINDOW_ORDER_FIELD_ENFORCE_SERVER_ZORDER 0x00080000 +#define WINDOW_ORDER_FIELD_APPBAR_STATE 0x00000040 +#define WINDOW_ORDER_FIELD_APPBAR_EDGE 0x00000001 + +/* Window (chached) Icon */ +#define WINDOW_ORDER_ICON 0x40000000 +#define WINDOW_ORDER_CACHED_ICON 0x80000000 +#define WINDOW_ORDER_FIELD_ICON_BIG 0x00002000 +#define WINDOW_ORDER_FIELD_ICON_OVERLAY 0x00100000 + +#define WINDOW_ORDER_FIELD_NOTIFY_VERSION 0x00000008 +#define WINDOW_ORDER_FIELD_NOTIFY_TIP 0x00000001 +#define WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP 0x00000002 +#define WINDOW_ORDER_FIELD_NOTIFY_STATE 0x00000004 +#define WINDOW_ORDER_FIELD_DESKTOP_NONE 0x00000001 +#define WINDOW_ORDER_FIELD_DESKTOP_HOOKED 0x00000002 +#define WINDOW_ORDER_FIELD_DESKTOP_ARC_COMPLETED 0x00000004 +#define WINDOW_ORDER_FIELD_DESKTOP_ARC_BEGAN 0x00000008 +#define WINDOW_ORDER_FIELD_DESKTOP_ZORDER 0x00000010 +#define WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND 0x00000020 + +/* Window Show States */ +#define WINDOW_HIDE 0x00 +#define WINDOW_SHOW_MINIMIZED 0x02 +#define WINDOW_SHOW_MAXIMIZED 0x03 +#define WINDOW_SHOW 0x05 + +/* Window Styles */ +#ifndef _WIN32 +#define WS_BORDER 0x00800000 +#define WS_CAPTION 0x00C00000 +#define WS_CHILD 0x40000000 +#define WS_CLIPCHILDREN 0x02000000 +#define WS_CLIPSIBLINGS 0x04000000 +#define WS_DISABLED 0x08000000 +#define WS_DLGFRAME 0x00400000 +#define WS_GROUP 0x00020000 +#define WS_HSCROLL 0x00100000 +#define WS_ICONIC 0x20000000 +#define WS_MAXIMIZE 0x01000000 +#define WS_MAXIMIZEBOX 0x00010000 +#define WS_MINIMIZE 0x20000000 +#define WS_MINIMIZEBOX 0x00020000 +#define WS_OVERLAPPED 0x00000000 +#define WS_OVERLAPPEDWINDOW \ + (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX) +#define WS_POPUP 0x80000000 +#define WS_POPUPWINDOW (WS_POPUP | WS_BORDER | WS_SYSMENU) +#define WS_SIZEBOX 0x00040000 +#define WS_SYSMENU 0x00080000 +#define WS_TABSTOP 0x00010000 +#define WS_THICKFRAME 0x00040000 +#define WS_VISIBLE 0x10000000 +#define WS_VSCROLL 0x00200000 +#endif + +/* Extended Window Styles */ +#ifndef _WIN32 +#define WS_EX_ACCEPTFILES 0x00000010 +#define WS_EX_APPWINDOW 0x00040000 +#define WS_EX_CLIENTEDGE 0x00000200 +#define WS_EX_COMPOSITED 0x02000000 +#define WS_EX_CONTEXTHELP 0x00000400 +#define WS_EX_CONTROLPARENT 0x00010000 +#define WS_EX_DLGMODALFRAME 0x00000001 +#define WS_EX_LAYERED 0x00080000 +#define WS_EX_LAYOUTRTL 0x00400000 +#define WS_EX_LEFT 0x00000000 +#define WS_EX_LEFTSCROLLBAR 0x00004000 +#define WS_EX_LTRREADING 0x00000000 +#define WS_EX_MDICHILD 0x00000040 +#define WS_EX_NOACTIVATE 0x08000000 +#define WS_EX_NOINHERITLAYOUT 0x00100000 +#define WS_EX_NOPARENTNOTIFY 0x00000004 +#define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE) +#define WS_EX_PALETTEWINDOW (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST) +#define WS_EX_RIGHT 0x00001000 +#define WS_EX_RIGHTSCROLLBAR 0x00000000 +#define WS_EX_RTLREADING 0x00002000 +#define WS_EX_STATICEDGE 0x00020000 +#define WS_EX_TOOLWINDOW 0x00000080 +#define WS_EX_TOPMOST 0x00000008 +#define WS_EX_TRANSPARENT 0x00000020 +#define WS_EX_WINDOWEDGE 0x00000100 +#endif + +/** + * This is a custom extended window style used by XRDP + * instructing the client to use local window decorations + */ + +#define WS_EX_DECORATIONS 0x40000000 + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef struct + { + UINT32 windowId; + UINT32 fieldFlags; + UINT32 notifyIconId; + } WINDOW_ORDER_INFO; + + typedef struct + { + UINT32 cacheEntry; + UINT32 cacheId; + UINT32 bpp; + UINT32 width; + UINT32 height; + UINT32 cbColorTable; + UINT32 cbBitsMask; + UINT32 cbBitsColor; + BYTE* bitsMask; + BYTE* colorTable; + BYTE* bitsColor; + } ICON_INFO; + + typedef struct + { + UINT32 cacheEntry; + UINT32 cacheId; + } CACHED_ICON_INFO; + + typedef struct + { + UINT32 timeout; + UINT32 flags; + RAIL_UNICODE_STRING text; + RAIL_UNICODE_STRING title; + } NOTIFY_ICON_INFOTIP; + + typedef struct + { + UINT32 ownerWindowId; + UINT32 style; + UINT32 extendedStyle; + UINT32 showState; + RAIL_UNICODE_STRING titleInfo; + INT32 clientOffsetX; + INT32 clientOffsetY; + UINT32 clientAreaWidth; + UINT32 clientAreaHeight; + UINT32 RPContent; + UINT32 rootParentHandle; + INT32 windowOffsetX; + INT32 windowOffsetY; + INT32 windowClientDeltaX; + INT32 windowClientDeltaY; + UINT32 windowWidth; + UINT32 windowHeight; + UINT32 numWindowRects; + RECTANGLE_16* windowRects; + INT32 visibleOffsetX; + INT32 visibleOffsetY; + UINT32 resizeMarginLeft; + UINT32 resizeMarginTop; + UINT32 resizeMarginRight; + UINT32 resizeMarginBottom; + UINT32 numVisibilityRects; + RECTANGLE_16* visibilityRects; + RAIL_UNICODE_STRING OverlayDescription; + BYTE TaskbarButton; + UINT8 EnforceServerZOrder; + UINT8 AppBarState; + UINT8 AppBarEdge; + } WINDOW_STATE_ORDER; + + typedef struct + { + ICON_INFO* iconInfo; + } WINDOW_ICON_ORDER; + + typedef struct + { + CACHED_ICON_INFO cachedIcon; + } WINDOW_CACHED_ICON_ORDER; + + typedef struct + { + UINT32 version; + RAIL_UNICODE_STRING toolTip; + NOTIFY_ICON_INFOTIP infoTip; + UINT32 state; + ICON_INFO icon; + CACHED_ICON_INFO cachedIcon; + } NOTIFY_ICON_STATE_ORDER; + + typedef struct + { + UINT32 activeWindowId; + UINT32 numWindowIds; + UINT32* windowIds; + } MONITORED_DESKTOP_ORDER; + + typedef BOOL (*pWindowCreate)(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo, + const WINDOW_STATE_ORDER* window_state); + typedef BOOL (*pWindowUpdate)(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo, + const WINDOW_STATE_ORDER* window_state); + typedef BOOL (*pWindowIcon)(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo, + const WINDOW_ICON_ORDER* window_icon); + typedef BOOL (*pWindowCachedIcon)(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo, + const WINDOW_CACHED_ICON_ORDER* window_cached_icon); + typedef BOOL (*pWindowDelete)(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo); + typedef BOOL (*pNotifyIconCreate)(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo, + const NOTIFY_ICON_STATE_ORDER* notify_icon_state); + typedef BOOL (*pNotifyIconUpdate)(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo, + const NOTIFY_ICON_STATE_ORDER* notify_icon_state); + typedef BOOL (*pNotifyIconDelete)(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo); + typedef BOOL (*pMonitoredDesktop)(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo, + const MONITORED_DESKTOP_ORDER* monitored_desktop); + typedef BOOL (*pNonMonitoredDesktop)(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo); + + struct rdp_window_update + { + rdpContext* context; /* 0 */ + UINT32 paddingA[16 - 1]; /* 1 */ + + pWindowCreate WindowCreate; /* 16 */ + pWindowUpdate WindowUpdate; /* 17 */ + pWindowIcon WindowIcon; /* 18 */ + pWindowCachedIcon WindowCachedIcon; /* 19 */ + pWindowDelete WindowDelete; /* 20 */ + pNotifyIconCreate NotifyIconCreate; /* 21 */ + pNotifyIconUpdate NotifyIconUpdate; /* 22 */ + pNotifyIconDelete NotifyIconDelete; /* 23 */ + pMonitoredDesktop MonitoredDesktop; /* 24 */ + pNonMonitoredDesktop NonMonitoredDesktop; /* 25 */ + UINT32 paddingB[32 - 26]; /* 26 */ + }; + typedef struct rdp_window_update rdpWindowUpdate; + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_UPDATE_WINDOW_H */ |