VirtualBox

source: vbox/trunk/include/VBox/HostServices/VBoxClipboardSvc.h@ 78425

Last change on this file since 78425 was 78316, checked in by vboxsync, 6 years ago

Shared Clipboard/URI: Build fix.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 11.2 KB
Line 
1/** @file
2 * Shared Clipboard - Common header for host service and guest clients.
3 */
4
5/*
6 * Copyright (C) 2006-2019 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef VBOX_INCLUDED_HostServices_VBoxClipboardSvc_h
27#define VBOX_INCLUDED_HostServices_VBoxClipboardSvc_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <VBox/VMMDevCoreTypes.h>
33#include <VBox/VBoxGuestCoreTypes.h>
34#include <VBox/hgcmsvc.h>
35
36/*
37 * The mode of operations.
38 */
39#define VBOX_SHARED_CLIPBOARD_MODE_OFF 0
40#define VBOX_SHARED_CLIPBOARD_MODE_HOST_TO_GUEST 1
41#define VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST 2
42#define VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL 3
43
44/*
45 * The service functions which are callable by host.
46 */
47#define VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE 1
48/** Run headless on the host, i.e. do not touch the host clipboard. */
49#define VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS 2
50
51/*
52 * The service functions which are called by guest.
53 */
54/** Calls the host and waits (blocking) for an host event VBOX_SHARED_CLIPBOARD_HOST_MSG_*. */
55#define VBOX_SHARED_CLIPBOARD_FN_GET_HOST_MSG 1
56/** Sends a list of available formats to host. */
57#define VBOX_SHARED_CLIPBOARD_FN_REPORT_FORMATS 2
58/** Reads data in specified format from host. */
59#define VBOX_SHARED_CLIPBOARD_FN_READ_DATA 3
60/** Writes data in requested format to host. */
61#define VBOX_SHARED_CLIPBOARD_FN_WRITE_DATA 4
62#define VBOX_SHARED_CLIPBOARD_FN_READ_DATA_CHUNK 5
63#define VBOX_SHARED_CLIPBOARD_FN_WRITE_DATA_CHUNK 6
64#define VBOX_SHARED_CLIPBOARD_FN_READ_DATA_HDR 7
65#define VBOX_SHARED_CLIPBOARD_FN_WRITE_DATA_HDR 8
66#define VBOX_SHARED_CLIPBOARD_FN_READ_DIR 9
67#define VBOX_SHARED_CLIPBOARD_FN_WRITE_DIR 10
68#define VBOX_SHARED_CLIPBOARD_FN_READ_FILE_HDR 11
69#define VBOX_SHARED_CLIPBOARD_FN_WRITE_FILE_HDR 12
70#define VBOX_SHARED_CLIPBOARD_FN_READ_FILE_DATA 13
71#define VBOX_SHARED_CLIPBOARD_FN_WRITE_FILE_DATA 14
72#define VBOX_SHARED_CLIPBOARD_FN_WRITE_CANCEL 15
73#define VBOX_SHARED_CLIPBOARD_FN_WRITE_ERROR 16
74
75#define VBOX_SHARED_CLIPBOARD_MAX_CHUNK_SIZE _64K
76
77/*
78 * HGCM parameter structures.
79 */
80#pragma pack(1)
81typedef struct _VBoxClipboardGetHostMsg
82{
83 VBGLIOCHGCMCALL hdr;
84
85 /* VBOX_SHARED_CLIPBOARD_HOST_MSG_* */
86 HGCMFunctionParameter msg; /* OUT uint32_t */
87
88 /* VBOX_SHARED_CLIPBOARD_FMT_*, depends on the 'msg'. */
89 HGCMFunctionParameter formats; /* OUT uint32_t */
90} VBoxClipboardGetHostMsg;
91
92#define VBOX_SHARED_CLIPBOARD_CPARMS_GET_HOST_MSG 2
93
94typedef struct _VBoxClipboardWriteFormats
95{
96 VBGLIOCHGCMCALL hdr;
97
98 /* VBOX_SHARED_CLIPBOARD_FMT_* */
99 HGCMFunctionParameter formats; /* OUT uint32_t */
100} VBoxClipboardWriteFormats;
101
102#define VBOX_SHARED_CLIPBOARD_CPARMS_FORMATS 1
103
104typedef struct _VBoxClipboardReadData
105{
106 VBGLIOCHGCMCALL hdr;
107
108 /* Requested format. */
109 HGCMFunctionParameter format; /* IN uint32_t */
110
111 /* The data buffer. */
112 HGCMFunctionParameter ptr; /* IN linear pointer. */
113
114 /* Size of returned data, if > ptr->cb, then no data was
115 * actually transferred and the guest must repeat the call.
116 */
117 HGCMFunctionParameter size; /* OUT uint32_t */
118
119} VBoxClipboardReadData;
120
121#define VBOX_SHARED_CLIPBOARD_CPARMS_READ_DATA 3
122
123typedef struct _VBoxClipboardWriteData
124{
125 VBGLIOCHGCMCALL hdr;
126
127 /* Returned format as requested in the VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA message. */
128 HGCMFunctionParameter format; /* IN uint32_t */
129
130 /* Data. */
131 HGCMFunctionParameter ptr; /* IN linear pointer. */
132} VBoxClipboardWriteData;
133
134#define VBOX_SHARED_CLIPBOARD_CPARMS_WRITE_DATA 2
135
136#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
137/**
138 * Data header.
139 */
140typedef struct _VBOXCLIPBOARDDATAHDR
141{
142 /** Data transfer flags. Not yet used and must be 0. */
143 uint32_t uFlags;
144 /** Screen ID where the data originates from. */
145 uint32_t uScreenId;
146 /** Total size (in bytes) to transfer. */
147 uint64_t cbTotal;
148 /** Meta data size (in bytes) to transfer.
149 * This size also is part of cbTotal already. */
150 uint32_t cbMeta;
151 /** Meta format buffer. */
152 void *pvMetaFmt;
153 /** Size (in bytes) of meta format buffer. */
154 uint32_t cbMetaFmt;
155 /** Number of objects (files/directories) to transfer. */
156 uint64_t cObjects;
157 /** Compression type. Currently unused, so specify 0.
158 **@todo Add IPRT compression type enumeration as soon as it's available. */
159 uint32_t enmCompression;
160 /** Checksum type. Currently unused, so specify RTDIGESTTYPE_INVALID. */
161 RTDIGESTTYPE enmChecksumType;
162 /** The actual checksum buffer for the entire data to be transferred,
163 * based on enmChksumType. If RTDIGESTTYPE_INVALID is specified,
164 * no checksum is being used and pvChecksum will be NULL. */
165 void *pvChecksum;
166 /** Size (in bytes) of checksum. */
167 uint32_t cbChecksum;
168} VBOXCLIPBOARDDATAHDR, *PVBOXCLIPBOARDDATAHDR;
169
170/**
171 * Sends the header of an incoming (meta) data block.
172 *
173 * Used by:
174 * XXX
175 */
176typedef struct _VBoxClipboardWriteDataHdrMsg
177{
178 VBGLIOCHGCMCALL hdr;
179
180 /** Context ID. Unused at the moment. */
181 HGCMFunctionParameter uContext; /* OUT uint32_t */
182 /** Data transfer flags. Not yet used and must be 0. */
183 HGCMFunctionParameter uFlags; /* OUT uint32_t */
184 /** Screen ID where the data originates from. */
185 HGCMFunctionParameter uScreenId; /* OUT uint32_t */
186 /** Total size (in bytes) to transfer. */
187 HGCMFunctionParameter cbTotal; /* OUT uint64_t */
188 /**
189 * Total meta data size (in bytes) to transfer.
190 * This size also is part of cbTotal already, so:
191 *
192 * cbTotal = cbMeta + additional size for files etc.
193 */
194 HGCMFunctionParameter cbMeta; /* OUT uint64_t */
195 /** Meta data format. */
196 HGCMFunctionParameter pvMetaFmt; /* OUT ptr */
197 /** Size (in bytes) of meta data format. */
198 HGCMFunctionParameter cbMetaFmt; /* OUT uint32_t */
199 /* Number of objects (files/directories) to transfer. */
200 HGCMFunctionParameter cObjects; /* OUT uint64_t */
201 /** Compression type. */
202 HGCMFunctionParameter enmCompression; /* OUT uint32_t */
203 /** Checksum type. */
204 HGCMFunctionParameter enmChecksumType; /* OUT uint32_t */
205 /** Checksum buffer for the entire data to be transferred. */
206 HGCMFunctionParameter pvChecksum; /* OUT ptr */
207 /** Size (in bytes) of checksum. */
208 HGCMFunctionParameter cbChecksum; /* OUT uint32_t */
209} VBoxClipboardWriteDataHdrMsg;
210
211typedef struct _VBOXCLIPBOARDWRITEDATACHUNK
212{
213 /** Data block buffer. */
214 void *pvData;
215 /** Size (in bytes) of data block. */
216 uint32_t cbData;
217 /** (Rolling) Checksum. Not yet implemented. */
218 void *pvChecksum;
219 /** Size (in bytes) of checksum. Not yet implemented. */
220 uint32_t cbChecksum;
221} VBOXCLIPBOARDWRITEDATACHUNK, *PVBOXCLIPBOARDWRITEDATACHUNK;
222
223/**
224 * Sends a (meta) data block to the host.
225 *
226 * Used by:
227 * GUEST_DND_GH_SND_DATA
228 */
229typedef struct _VBoxClipboardWriteDataChunkMsg
230{
231 VBGLIOCHGCMCALL hdr;
232
233 /** Context ID. Unused at the moment. */
234 HGCMFunctionParameter uContext; /* OUT uint32_t */
235 /** Data block to send. */
236 HGCMFunctionParameter pvData; /* OUT ptr */
237 /** Size (in bytes) of data block to send. */
238 HGCMFunctionParameter cbData; /* OUT uint32_t */
239 /** (Rolling) Checksum, based on checksum type in data header. */
240 HGCMFunctionParameter pvChecksum; /* OUT ptr */
241 /** Size (in bytes) of checksum. */
242 HGCMFunctionParameter cbChecksum; /* OUT uint32_t */
243} VBoxClipboardWriteDataChunkMsg;
244
245/**
246 * Sends a directory entry.
247 *
248 * Used by:
249 * XXX
250 */
251typedef struct _VBoxClipboardWriteDirMsg
252{
253 VBGLIOCHGCMCALL hdr;
254
255 /** Context ID. Unused at the moment. */
256 HGCMFunctionParameter uContext; /* OUT uint32_t */
257 /** Directory name. */
258 HGCMFunctionParameter pvName; /* OUT ptr */
259 /** Size (in bytes) of directory name. */
260 HGCMFunctionParameter cbName; /* OUT uint32_t */
261 /** Directory mode. */
262 HGCMFunctionParameter fMode; /* OUT uint32_t */
263} VBoxClipboardWriteDirMsg;
264
265/**
266 * File header message, marking the start of transferring a new file.
267 *
268 * Used by:
269 * XXX
270 */
271typedef struct _VBoxClipboardWriteFileHdrMsg
272{
273 VBGLIOCHGCMCALL hdr;
274
275 /** Context ID. Unused at the moment. */
276 HGCMFunctionParameter uContext; /* OUT uint32_t */
277 /** File path. */
278 HGCMFunctionParameter pvName; /* OUT ptr */
279 /** Size (in bytes) of file path. */
280 HGCMFunctionParameter cbName; /* OUT uint32_t */
281 /** Optional flags; unused at the moment. */
282 HGCMFunctionParameter uFlags; /* OUT uint32_t */
283 /** File creation mode. */
284 HGCMFunctionParameter fMode; /* OUT uint32_t */
285 /** Total size (in bytes). */
286 HGCMFunctionParameter cbTotal; /* OUT uint64_t */
287} VBoxClipboardWriteFileHdrMsg;
288
289/**
290 * Sends data of a file entry.
291 *
292 * Used by:
293 * XXX
294 */
295typedef struct _VBoxClipboardWriteFileDataMsg
296{
297 VBGLIOCHGCMCALL hdr;
298
299 /** Context ID. Unused at the moment. */
300 HGCMFunctionParameter uContext; /* OUT uint32_t */
301 /** Current data chunk. */
302 HGCMFunctionParameter pvData; /* OUT ptr */
303 /** Size (in bytes) of current data chunk. */
304 HGCMFunctionParameter cbData; /* OUT uint32_t */
305 /** Checksum of data block, based on the checksum
306 * type in the data header. Optional. */
307 HGCMFunctionParameter pvChecksum; /* OUT ptr */
308 /** Size (in bytes) of curren data chunk checksum. */
309 HGCMFunctionParameter cbChecksum; /* OUT uint32_t */
310} VBoxClipboardWriteFileDataMsg;
311
312/**
313 * Sends an error event.
314 *
315 * Used by:
316 * XXX
317 */
318typedef struct _VBoxClipboardWriteErrorMsg
319{
320 VBGLIOCHGCMCALL hdr;
321
322 /** Context ID. Unused at the moment. */
323 HGCMFunctionParameter uContext; /* OUT uint32_t */
324 /** The error code (IPRT-style). */
325 HGCMFunctionParameter rc; /* OUT uint32_t */
326} VBoxClipboardWriteErrorMsg;
327#endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
328
329#pragma pack()
330
331bool VBoxSvcClipboardGetHeadless(void);
332bool VBoxSvcClipboardLock(void);
333void VBoxSvcClipboardUnlock(void);
334
335#endif /* !VBOX_INCLUDED_HostServices_VBoxClipboardSvc_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette