cliprdr.h (5467B)
1/** 2 * FreeRDP: A Remote Desktop Protocol Implementation 3 * Clipboard Virtual Channel Extension 4 * 5 * Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com> 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20#ifndef FREERDP_CHANNEL_CLIPRDR_H 21#define FREERDP_CHANNEL_CLIPRDR_H 22 23#include <freerdp/api.h> 24#include <freerdp/types.h> 25#include <freerdp/utils/cliprdr_utils.h> 26 27#include <winpr/shell.h> 28 29#define CLIPRDR_SVC_CHANNEL_NAME "cliprdr" 30 31/** 32 * Clipboard Formats 33 */ 34 35#define CB_FORMAT_HTML 0xD010 36#define CB_FORMAT_PNG 0xD011 37#define CB_FORMAT_JPEG 0xD012 38#define CB_FORMAT_GIF 0xD013 39#define CB_FORMAT_TEXTURILIST 0xD014 40 41/* CLIPRDR_HEADER.msgType */ 42#define CB_MONITOR_READY 0x0001 43#define CB_FORMAT_LIST 0x0002 44#define CB_FORMAT_LIST_RESPONSE 0x0003 45#define CB_FORMAT_DATA_REQUEST 0x0004 46#define CB_FORMAT_DATA_RESPONSE 0x0005 47#define CB_TEMP_DIRECTORY 0x0006 48#define CB_CLIP_CAPS 0x0007 49#define CB_FILECONTENTS_REQUEST 0x0008 50#define CB_FILECONTENTS_RESPONSE 0x0009 51#define CB_LOCK_CLIPDATA 0x000A 52#define CB_UNLOCK_CLIPDATA 0x000B 53 54/* CLIPRDR_HEADER.msgFlags */ 55#define CB_RESPONSE_OK 0x0001 56#define CB_RESPONSE_FAIL 0x0002 57#define CB_ASCII_NAMES 0x0004 58 59/* CLIPRDR_CAPS_SET.capabilitySetType */ 60#define CB_CAPSTYPE_GENERAL 0x0001 61 62/* CLIPRDR_GENERAL_CAPABILITY.lengthCapability */ 63#define CB_CAPSTYPE_GENERAL_LEN 12 64 65/* CLIPRDR_GENERAL_CAPABILITY.version */ 66#define CB_CAPS_VERSION_1 0x00000001 67#define CB_CAPS_VERSION_2 0x00000002 68 69/* CLIPRDR_GENERAL_CAPABILITY.generalFlags */ 70#define CB_USE_LONG_FORMAT_NAMES 0x00000002 71#define CB_STREAM_FILECLIP_ENABLED 0x00000004 72#define CB_FILECLIP_NO_FILE_PATHS 0x00000008 73#define CB_CAN_LOCK_CLIPDATA 0x00000010 74#define CB_HUGE_FILE_SUPPORT_ENABLED 0x00000020 75 76/* File Contents Request Flags */ 77#define FILECONTENTS_SIZE 0x00000001 78#define FILECONTENTS_RANGE 0x00000002 79 80/* Special Clipboard Response Formats */ 81 82struct _CLIPRDR_MFPICT 83{ 84 UINT32 mappingMode; 85 UINT32 xExt; 86 UINT32 yExt; 87 UINT32 metaFileSize; 88 BYTE* metaFileData; 89}; 90typedef struct _CLIPRDR_MFPICT CLIPRDR_MFPICT; 91 92#ifdef __cplusplus 93extern "C" 94{ 95#endif 96 97#ifdef __cplusplus 98} 99#endif 100 101/* Clipboard Messages */ 102 103#define DEFINE_CLIPRDR_HEADER_COMMON() \ 104 UINT16 msgType; \ 105 UINT16 msgFlags; \ 106 UINT32 dataLen 107 108struct _CLIPRDR_HEADER 109{ 110 DEFINE_CLIPRDR_HEADER_COMMON(); 111}; 112typedef struct _CLIPRDR_HEADER CLIPRDR_HEADER; 113 114struct _CLIPRDR_CAPABILITY_SET 115{ 116 UINT16 capabilitySetType; 117 UINT16 capabilitySetLength; 118}; 119typedef struct _CLIPRDR_CAPABILITY_SET CLIPRDR_CAPABILITY_SET; 120 121struct _CLIPRDR_GENERAL_CAPABILITY_SET 122{ 123 UINT16 capabilitySetType; 124 UINT16 capabilitySetLength; 125 126 UINT32 version; 127 UINT32 generalFlags; 128}; 129typedef struct _CLIPRDR_GENERAL_CAPABILITY_SET CLIPRDR_GENERAL_CAPABILITY_SET; 130 131struct _CLIPRDR_CAPABILITIES 132{ 133 DEFINE_CLIPRDR_HEADER_COMMON(); 134 135 UINT32 cCapabilitiesSets; 136 CLIPRDR_CAPABILITY_SET* capabilitySets; 137}; 138typedef struct _CLIPRDR_CAPABILITIES CLIPRDR_CAPABILITIES; 139 140struct _CLIPRDR_MONITOR_READY 141{ 142 DEFINE_CLIPRDR_HEADER_COMMON(); 143}; 144typedef struct _CLIPRDR_MONITOR_READY CLIPRDR_MONITOR_READY; 145 146struct _CLIPRDR_TEMP_DIRECTORY 147{ 148 DEFINE_CLIPRDR_HEADER_COMMON(); 149 150 char szTempDir[520]; 151}; 152typedef struct _CLIPRDR_TEMP_DIRECTORY CLIPRDR_TEMP_DIRECTORY; 153 154struct _CLIPRDR_FORMAT 155{ 156 UINT32 formatId; 157 char* formatName; 158}; 159typedef struct _CLIPRDR_FORMAT CLIPRDR_FORMAT; 160 161struct _CLIPRDR_FORMAT_LIST 162{ 163 DEFINE_CLIPRDR_HEADER_COMMON(); 164 165 UINT32 numFormats; 166 CLIPRDR_FORMAT* formats; 167}; 168typedef struct _CLIPRDR_FORMAT_LIST CLIPRDR_FORMAT_LIST; 169 170struct _CLIPRDR_FORMAT_LIST_RESPONSE 171{ 172 DEFINE_CLIPRDR_HEADER_COMMON(); 173}; 174typedef struct _CLIPRDR_FORMAT_LIST_RESPONSE CLIPRDR_FORMAT_LIST_RESPONSE; 175 176struct _CLIPRDR_LOCK_CLIPBOARD_DATA 177{ 178 DEFINE_CLIPRDR_HEADER_COMMON(); 179 180 UINT32 clipDataId; 181}; 182typedef struct _CLIPRDR_LOCK_CLIPBOARD_DATA CLIPRDR_LOCK_CLIPBOARD_DATA; 183 184struct _CLIPRDR_UNLOCK_CLIPBOARD_DATA 185{ 186 DEFINE_CLIPRDR_HEADER_COMMON(); 187 188 UINT32 clipDataId; 189}; 190typedef struct _CLIPRDR_UNLOCK_CLIPBOARD_DATA CLIPRDR_UNLOCK_CLIPBOARD_DATA; 191 192struct _CLIPRDR_FORMAT_DATA_REQUEST 193{ 194 DEFINE_CLIPRDR_HEADER_COMMON(); 195 196 UINT32 requestedFormatId; 197}; 198typedef struct _CLIPRDR_FORMAT_DATA_REQUEST CLIPRDR_FORMAT_DATA_REQUEST; 199 200struct _CLIPRDR_FORMAT_DATA_RESPONSE 201{ 202 DEFINE_CLIPRDR_HEADER_COMMON(); 203 204 const BYTE* requestedFormatData; 205}; 206typedef struct _CLIPRDR_FORMAT_DATA_RESPONSE CLIPRDR_FORMAT_DATA_RESPONSE; 207 208struct _CLIPRDR_FILE_CONTENTS_REQUEST 209{ 210 DEFINE_CLIPRDR_HEADER_COMMON(); 211 212 UINT32 streamId; 213 UINT32 listIndex; 214 UINT32 dwFlags; 215 UINT32 nPositionLow; 216 UINT32 nPositionHigh; 217 UINT32 cbRequested; 218 BOOL haveClipDataId; 219 UINT32 clipDataId; 220}; 221typedef struct _CLIPRDR_FILE_CONTENTS_REQUEST CLIPRDR_FILE_CONTENTS_REQUEST; 222 223struct _CLIPRDR_FILE_CONTENTS_RESPONSE 224{ 225 DEFINE_CLIPRDR_HEADER_COMMON(); 226 227 UINT32 streamId; 228 UINT32 cbRequested; 229 const BYTE* requestedData; 230}; 231typedef struct _CLIPRDR_FILE_CONTENTS_RESPONSE CLIPRDR_FILE_CONTENTS_RESPONSE; 232 233#endif /* FREERDP_CHANNEL_CLIPRDR_H */