diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:24:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:24:41 +0000 |
commit | a9bcc81f821d7c66f623779fa5147e728eb3c388 (patch) | |
tree | 98676963bcdd537ae5908a067a8eb110b93486a6 /include/freerdp/channels | |
parent | Initial commit. (diff) | |
download | freerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.tar.xz freerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.zip |
Adding upstream version 3.3.0+dfsg1.upstream/3.3.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/freerdp/channels')
28 files changed, 3810 insertions, 0 deletions
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 */ |