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 | /**
|
---|
27 | * Protocol handling and notes:
|
---|
28 | * All client/server components should be backwards compatible.
|
---|
29 | *
|
---|
30 | ******************************************************************************
|
---|
31 | *
|
---|
32 | * Protocol changelog:
|
---|
33 | *
|
---|
34 | * Protocol v0 (VBox < 6.1, deprecated):
|
---|
35 | * | First, initial implementation since feature was developed.
|
---|
36 | * Has no protocol handshake / versioning support, the client's
|
---|
37 | * waiting message also acted as retrieving the parameters from
|
---|
38 | * the host (always and only *exactly* two parameters). Does
|
---|
39 | * not have the ability to control / handle parallel transfers.
|
---|
40 | *
|
---|
41 | * Protocol v1 (VBox >= 6.1):
|
---|
42 | * + Adds protocol versioning and context IDs for parallel,
|
---|
43 | * asynchronous transfers.
|
---|
44 | * | Keeps backwards-compatbility with protocol v0 clients by translating
|
---|
45 | * messages to protocol v0, to not break compatibility with older
|
---|
46 | * Guest Additions (VBox < 6.1).
|
---|
47 | */
|
---|
48 |
|
---|
49 | #ifndef VBOX_INCLUDED_HostServices_VBoxClipboardSvc_h
|
---|
50 | #define VBOX_INCLUDED_HostServices_VBoxClipboardSvc_h
|
---|
51 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
52 | # pragma once
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | #include <VBox/VMMDevCoreTypes.h>
|
---|
56 | #include <VBox/VBoxGuestCoreTypes.h>
|
---|
57 | #include <VBox/hgcmsvc.h>
|
---|
58 |
|
---|
59 | #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
|
---|
60 | #include <VBox/GuestHost/SharedClipboard-transfers.h>
|
---|
61 | #endif
|
---|
62 |
|
---|
63 | /*
|
---|
64 | * The saved state versions.
|
---|
65 | * We're using it as a version field with the high bit set.
|
---|
66 | */
|
---|
67 | /** Older saved states (VBox < 6.1). Includes protocol v0 state. */
|
---|
68 | #define VBOX_SHCL_SSM_VER_0 UINT32_C(0x80000002)
|
---|
69 | /** Protocol v1 is being used. */
|
---|
70 | #define VBOX_SHCL_SSM_VER_1 UINT32_C(0x80000003)
|
---|
71 |
|
---|
72 | /*
|
---|
73 | * The Shared Clipboard modes of operation.
|
---|
74 | */
|
---|
75 | /** Shared Clipboard is disabled completely. */
|
---|
76 | #define VBOX_SHCL_MODE_OFF 0
|
---|
77 | /** Only transfers from host to the guest are possible. */
|
---|
78 | #define VBOX_SHCL_MODE_HOST_TO_GUEST 1
|
---|
79 | /** Only transfers from guest to the host are possible. */
|
---|
80 | #define VBOX_SHCL_MODE_GUEST_TO_HOST 2
|
---|
81 | /** Bidirectional transfers between guest and host are possible. */
|
---|
82 | #define VBOX_SHCL_MODE_BIDIRECTIONAL 3
|
---|
83 |
|
---|
84 | /*
|
---|
85 | * The service functions which are callable by host.
|
---|
86 | */
|
---|
87 | /** Sets the current Shared Clipboard operation mode. */
|
---|
88 | #define VBOX_SHCL_HOST_FN_SET_MODE 1
|
---|
89 | /** Run headless on the host, i.e. do not touch the host clipboard. */
|
---|
90 | #define VBOX_SHCL_HOST_FN_SET_HEADLESS 2
|
---|
91 | /** Reports cancellation of the current operation to the guest. */
|
---|
92 | #define VBOX_SHCL_HOST_FN_CANCEL 3
|
---|
93 | /** Reports an error to the guest. */
|
---|
94 | #define VBOX_SHCL_HOST_FN_ERROR 4
|
---|
95 | /** Reports that a new clipboard area has been registered. */
|
---|
96 | #define VBOX_SHCL_HOST_FN_AREA_REGISTER 5
|
---|
97 | /** Reports that a clipboard area has been unregistered. */
|
---|
98 | #define VBOX_SHCL_HOST_FN_AREA_UNREGISTER 6
|
---|
99 | /** Reports that a client (host / guest) has attached to a clipboard area. */
|
---|
100 | #define VBOX_SHCL_HOST_FN_AREA_ATTACH 7
|
---|
101 | /** Reports that a client (host / guest) has detached from a clipboard area. */
|
---|
102 | #define VBOX_SHCL_HOST_FN_AREA_DETACH 8
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * The host messages for the guest.
|
---|
106 | */
|
---|
107 | /** Asks the client to quit / terminate. */
|
---|
108 | #define VBOX_SHCL_HOST_MSG_QUIT 1
|
---|
109 | /** Reads (simple) data from the guest. */
|
---|
110 | #define VBOX_SHCL_HOST_MSG_READ_DATA 2
|
---|
111 | /** Reports available clipboard format from host to the guest.
|
---|
112 | * Formerly known as VBOX_SHCL_HOST_MSG_REPORT_FORMATS. */
|
---|
113 | #define VBOX_SHCL_HOST_MSG_FORMATS_REPORT 3
|
---|
114 |
|
---|
115 | /** Sends a transfer status to the guest side. */
|
---|
116 | #define VBOX_SHCL_HOST_MSG_TRANSFER_STATUS 50
|
---|
117 | /** Reads the root list header from the guest. */
|
---|
118 | #define VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_HDR_READ 51
|
---|
119 | /** Writes the root list header to the guest. */
|
---|
120 | #define VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_HDR_WRITE 52
|
---|
121 | /** Reads a root list entry from the guest. */
|
---|
122 | #define VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_ENTRY_READ 53
|
---|
123 | /** Writes a root list entry to the guest. */
|
---|
124 | #define VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_ENTRY_WRITE 54
|
---|
125 | /** Open a transfer list on the guest side. */
|
---|
126 | #define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_OPEN 55
|
---|
127 | /** Closes a formerly opened transfer list on the guest side. */
|
---|
128 | #define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_CLOSE 56
|
---|
129 | /** Reads a list header from the guest. */
|
---|
130 | #define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_HDR_READ 57
|
---|
131 | /** Writes a list header to the guest. */
|
---|
132 | #define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_HDR_WRITE 58
|
---|
133 | /** Reads a list entry from the guest. */
|
---|
134 | #define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_ENTRY_READ 59
|
---|
135 | /** Writes a list entry to the guest. */
|
---|
136 | #define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_ENTRY_WRITE 60
|
---|
137 | /** Open a transfer object on the guest side. */
|
---|
138 | #define VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_OPEN 61
|
---|
139 | /** Closes a formerly opened transfer object on the guest side. */
|
---|
140 | #define VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_CLOSE 62
|
---|
141 | /** Reads from an object on the guest side. */
|
---|
142 | #define VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_READ 63
|
---|
143 | /** Writes to an object on the guest side. */
|
---|
144 | #define VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_WRITE 64
|
---|
145 | /** Indicates that the host has canceled a transfer. */
|
---|
146 | #define VBOX_SHCL_HOST_MSG_TRANSFER_CANCEL 65
|
---|
147 | /** Indicates that the an unrecoverable error on the host occurred . */
|
---|
148 | #define VBOX_SHCL_HOST_MSG_TRANSFER_ERROR 66
|
---|
149 |
|
---|
150 | /*
|
---|
151 | * The service functions which are called by guest.
|
---|
152 | */
|
---|
153 | /** Calls the host and waits (blocking) for an host event VBOX_SHCL_HOST_MSG_*.
|
---|
154 | * Note: This is the old message which still is being used for the non-URI Shared Clipboard transfers,
|
---|
155 | * to not break compatibility with older Guest Additions / VBox versions. */
|
---|
156 | #define VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD 1
|
---|
157 | /** Sends a list of available formats to the host.
|
---|
158 | * Formely known as VBOX_SHCL_GUEST_FN_REPORT_FORMATS. */
|
---|
159 | #define VBOX_SHCL_GUEST_FN_FORMATS_REPORT 2
|
---|
160 | /** Reads data in specified format from the host. */
|
---|
161 | #define VBOX_SHCL_GUEST_FN_DATA_READ 3
|
---|
162 | /** Writes data in requested format to the host. */
|
---|
163 | #define VBOX_SHCL_GUEST_FN_DATA_WRITE 4
|
---|
164 |
|
---|
165 | /** Does the actual protocol handshake. If this message is not
|
---|
166 | * being sent by the guest, the host handles that particular client
|
---|
167 | * with the legacy protocol (v0).
|
---|
168 | *
|
---|
169 | * New since protocol v1. */
|
---|
170 | #define VBOX_SHCL_GUEST_FN_CONNECT 5
|
---|
171 | /** Peeks at the next message, returning immediately.
|
---|
172 | * New since protocol v1. */
|
---|
173 | #define VBOX_SHCL_GUEST_FN_MSG_PEEK_NOWAIT 6
|
---|
174 | /** Peeks at the next message, waiting for one to arrive.
|
---|
175 | * New since protocol v1. */
|
---|
176 | #define VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT 7
|
---|
177 | /** Gets the next message, returning immediately.
|
---|
178 | * New since protocol v1. */
|
---|
179 | #define VBOX_SHCL_GUEST_FN_MSG_GET 8
|
---|
180 | /** Sends a transfer status to the host.
|
---|
181 | * New since protocol v1. */
|
---|
182 | #define VBOX_SHCL_GUEST_FN_STATUS 9
|
---|
183 | /** Replies to a function from the host.
|
---|
184 | * New since protocol v1. */
|
---|
185 | #define VBOX_SHCL_GUEST_FN_REPLY 10
|
---|
186 | /** Reports the available root entries of a transfer.
|
---|
187 | * New since protocol v1. */
|
---|
188 | #define VBOX_SHCL_GUEST_FN_ROOT_LIST_HDR_READ 11
|
---|
189 | /** Reports the available root entries of a transfer.
|
---|
190 | * New since protocol v1. */
|
---|
191 | #define VBOX_SHCL_GUEST_FN_ROOT_LIST_HDR_WRITE 12
|
---|
192 | /** Reports the available root entries of a transfer.
|
---|
193 | * New since protocol v1. */
|
---|
194 | #define VBOX_SHCL_GUEST_FN_ROOT_LIST_ENTRY_READ 13
|
---|
195 | /** Reports the available root entries of a transfer.
|
---|
196 | * New since protocol v1. */
|
---|
197 | #define VBOX_SHCL_GUEST_FN_ROOT_LIST_ENTRY_WRITE 14
|
---|
198 | /** Opens / gets a list handle from the host.
|
---|
199 | * New since protocol v1. */
|
---|
200 | #define VBOX_SHCL_GUEST_FN_LIST_OPEN 15
|
---|
201 | /** Closes a list handle from the host.
|
---|
202 | * New since protocol v1. */
|
---|
203 | #define VBOX_SHCL_GUEST_FN_LIST_CLOSE 16
|
---|
204 | /** Reads a list header from the host.
|
---|
205 | * New since protocol v1. */
|
---|
206 | #define VBOX_SHCL_GUEST_FN_LIST_HDR_READ 17
|
---|
207 | /** Writes a list header to the host.
|
---|
208 | * New since protocol v1. */
|
---|
209 | #define VBOX_SHCL_GUEST_FN_LIST_HDR_WRITE 18
|
---|
210 | /** New since protocol v1. */
|
---|
211 | #define VBOX_SHCL_GUEST_FN_LIST_ENTRY_READ 19
|
---|
212 | /** New since protocol v1. */
|
---|
213 | #define VBOX_SHCL_GUEST_FN_LIST_ENTRY_WRITE 20
|
---|
214 | /** New since protocol v1. */
|
---|
215 | #define VBOX_SHCL_GUEST_FN_OBJ_OPEN 21
|
---|
216 | /** New since protocol v1. */
|
---|
217 | #define VBOX_SHCL_GUEST_FN_OBJ_CLOSE 22
|
---|
218 | /** New since protocol v1. */
|
---|
219 | #define VBOX_SHCL_GUEST_FN_OBJ_READ 23
|
---|
220 | /** New since protocol v1. */
|
---|
221 | #define VBOX_SHCL_GUEST_FN_OBJ_WRITE 24
|
---|
222 | /** Reports cancellation of the current operation to the host.
|
---|
223 | * New since protocol v1. */
|
---|
224 | #define VBOX_SHCL_GUEST_FN_CANCEL 25
|
---|
225 | /** Reports an error to the host.
|
---|
226 | * New since protocol v1. */
|
---|
227 | #define VBOX_SHCL_GUEST_FN_ERROR 26
|
---|
228 |
|
---|
229 | /** The maximum default chunk size for a single data transfer. */
|
---|
230 | #define VBOX_SHCL_MAX_CHUNK_SIZE _64K
|
---|
231 |
|
---|
232 | /*
|
---|
233 | * HGCM parameter structures.
|
---|
234 | */
|
---|
235 | #pragma pack(1)
|
---|
236 | /**
|
---|
237 | * Waits (blocking) for a new host message to arrive.
|
---|
238 | * Deprecated; do not use anymore.
|
---|
239 | * Kept for maintaining compatibility with older Guest Additions.
|
---|
240 | */
|
---|
241 | typedef struct _VBoxShClGetHostMsgOld
|
---|
242 | {
|
---|
243 | VBGLIOCHGCMCALL hdr;
|
---|
244 |
|
---|
245 | /** uint32_t, out: Host message type. */
|
---|
246 | HGCMFunctionParameter msg;
|
---|
247 | /** uint32_t, out: VBOX_SHCL_FMT_*, depends on the 'msg'.
|
---|
248 | * r=andy This actual can have *different* meanings, depending on the host message type. */
|
---|
249 | HGCMFunctionParameter formats; /* OUT uint32_t */
|
---|
250 | } VBoxShClGetHostMsgOld;
|
---|
251 |
|
---|
252 | #define VBOX_SHCL_CPARMS_GET_HOST_MSG_OLD 2
|
---|
253 |
|
---|
254 | /**
|
---|
255 | * Message for doing the protocol negotiation between the host
|
---|
256 | * and the guest. Not available on older (VBox <= 6.0) hosts.
|
---|
257 | */
|
---|
258 | typedef struct _VBoxShClConnect
|
---|
259 | {
|
---|
260 | VBGLIOCHGCMCALL hdr;
|
---|
261 |
|
---|
262 | /** uint32_t, out: Protocol version. */
|
---|
263 | HGCMFunctionParameter uProtocolVer;
|
---|
264 | /** uint32_t, out: Protocol flags, unused at the moment. */
|
---|
265 | HGCMFunctionParameter uProtocolFlags;
|
---|
266 | /** uint32_t, out: Maximum chunk size for data transfers. */
|
---|
267 | HGCMFunctionParameter cbChunkSize;
|
---|
268 | /** uint32_t, in/out: Compression type. Currently unused. */
|
---|
269 | HGCMFunctionParameter enmCompression;
|
---|
270 | /** uint32_t, in/out: Checksum type used for data transfer. Currently unused. */
|
---|
271 | HGCMFunctionParameter enmChecksumType;
|
---|
272 | } VBoxShClConnect;
|
---|
273 |
|
---|
274 | #define VBOX_SHCL_CPARMS_CONNECT 5
|
---|
275 |
|
---|
276 | /**
|
---|
277 | * Reports available formats.
|
---|
278 | */
|
---|
279 | typedef struct _VBoxShClFormatsMsg
|
---|
280 | {
|
---|
281 | VBGLIOCHGCMCALL hdr;
|
---|
282 |
|
---|
283 | union
|
---|
284 | {
|
---|
285 | struct
|
---|
286 | {
|
---|
287 | /** uint32_t, out: VBOX_SHCL_FMT_*. */
|
---|
288 | HGCMFunctionParameter uFormats;
|
---|
289 | } v0;
|
---|
290 |
|
---|
291 | struct
|
---|
292 | {
|
---|
293 | /** uint32_t, in: Context ID. */
|
---|
294 | HGCMFunctionParameter uContext;
|
---|
295 | /** uint32_t, out: VBOX_SHCL_FMT_*. */
|
---|
296 | HGCMFunctionParameter uFormats;
|
---|
297 | /** uint32_t, in: Format flags. */
|
---|
298 | HGCMFunctionParameter fFlags;
|
---|
299 | } v1;
|
---|
300 | } u;
|
---|
301 | } VBoxShClFormatsMsg;
|
---|
302 |
|
---|
303 | /**
|
---|
304 | * Requests to read clipboard data.
|
---|
305 | */
|
---|
306 | typedef struct _VBoxShClReadDataReqMsg
|
---|
307 | {
|
---|
308 | VBGLIOCHGCMCALL hdr;
|
---|
309 |
|
---|
310 | /** uint32_t, out: Context ID. */
|
---|
311 | HGCMFunctionParameter uContext;
|
---|
312 | /** uint32_t, out: Requested format to read data in. */
|
---|
313 | HGCMFunctionParameter uFormat;
|
---|
314 | /** uint32_t, out: Maximum size (in bytes) to read. */
|
---|
315 | HGCMFunctionParameter cbSize;
|
---|
316 | } VBoxShClReadDataReqMsg;
|
---|
317 |
|
---|
318 | #define VBOX_SHCL_CPARMS_READ_DATA_REQ 2
|
---|
319 |
|
---|
320 | /**
|
---|
321 | * Reads clipboard data.
|
---|
322 | */
|
---|
323 | typedef struct _VBoxShClReadDataMsg
|
---|
324 | {
|
---|
325 | VBGLIOCHGCMCALL hdr;
|
---|
326 |
|
---|
327 | /** uint32_t, out: Requested format. */
|
---|
328 | HGCMFunctionParameter format; /* IN uint32_t */
|
---|
329 | /** ptr, out: The data buffer. */
|
---|
330 | HGCMFunctionParameter ptr; /* IN linear pointer. */
|
---|
331 | /** uint32_t, out: Size of returned data, if > ptr->cb, then no data was
|
---|
332 | * actually transferred and the guest must repeat the call.
|
---|
333 | */
|
---|
334 | HGCMFunctionParameter size; /* OUT uint32_t */
|
---|
335 |
|
---|
336 | } VBoxShClReadDataMsg;
|
---|
337 |
|
---|
338 | #define VBOX_SHCL_CPARMS_READ_DATA 3
|
---|
339 |
|
---|
340 | /**
|
---|
341 | * Writes clipboard data.
|
---|
342 | */
|
---|
343 | typedef struct _VBoxShClWriteDataMsg
|
---|
344 | {
|
---|
345 | VBGLIOCHGCMCALL hdr;
|
---|
346 |
|
---|
347 | union
|
---|
348 | {
|
---|
349 | struct
|
---|
350 | {
|
---|
351 | /** Returned format as requested in the VBOX_SHCL_HOST_MSG_READ_DATA message. */
|
---|
352 | HGCMFunctionParameter format; /* IN uint32_t */
|
---|
353 | /** Data. */
|
---|
354 | HGCMFunctionParameter ptr; /* IN linear pointer. */
|
---|
355 | } v0;
|
---|
356 | struct
|
---|
357 | {
|
---|
358 | /** uint32_t, out: Context ID. */
|
---|
359 | HGCMFunctionParameter uContext;
|
---|
360 | /** uint32_t, out: Requested format to read data in. */
|
---|
361 | HGCMFunctionParameter uFormat;
|
---|
362 | /** uint32_t, out: Size of data (in bytes). */
|
---|
363 | HGCMFunctionParameter cbData;
|
---|
364 | /** ptr, out: Actual data. */
|
---|
365 | HGCMFunctionParameter pvData;
|
---|
366 | } v1;
|
---|
367 | } u;
|
---|
368 | } VBoxShClWriteDataMsg;
|
---|
369 |
|
---|
370 | #define VBOX_SHCL_CPARMS_WRITE_DATA 4
|
---|
371 |
|
---|
372 | /**
|
---|
373 | * Reports a transfer status.
|
---|
374 | */
|
---|
375 | typedef struct _VBoxShClTransferStatusMsg
|
---|
376 | {
|
---|
377 | VBGLIOCHGCMCALL hdr;
|
---|
378 |
|
---|
379 | /** uint32_t, out: Context ID. */
|
---|
380 | HGCMFunctionParameter uContext;
|
---|
381 | /** uint32_t, out: Direction of transfer; of type SHCLTRANSFERDIR_. */
|
---|
382 | HGCMFunctionParameter enmDir;
|
---|
383 | /** uint32_t, out: Status to report; of type SHCLTRANSFERSTATUS_. */
|
---|
384 | HGCMFunctionParameter enmStatus;
|
---|
385 | /** uint32_t, out: Result code to report. Optional. */
|
---|
386 | HGCMFunctionParameter rc;
|
---|
387 | /** uint32_t, out: Reporting flags. Currently unused and must be 0. */
|
---|
388 | HGCMFunctionParameter fFlags;
|
---|
389 | } VBoxShClTransferStatusMsg;
|
---|
390 |
|
---|
391 | #define VBOX_SHCL_CPARMS_TRANSFER_STATUS 5
|
---|
392 |
|
---|
393 | /**
|
---|
394 | * Asks the host for the next command to process, along
|
---|
395 | * with the needed amount of parameters and an optional blocking
|
---|
396 | * flag.
|
---|
397 | *
|
---|
398 | * Used by: VBOX_SHCL_GUEST_FN_GET_HOST_MSG
|
---|
399 | *
|
---|
400 | */
|
---|
401 | typedef struct _VBoxShClGetHostMsg
|
---|
402 | {
|
---|
403 | VBGLIOCHGCMCALL hdr;
|
---|
404 |
|
---|
405 | /** uint32_t, out: Message ID. */
|
---|
406 | HGCMFunctionParameter uMsg;
|
---|
407 | /** uint32_t, out: Number of parameters the message needs. */
|
---|
408 | HGCMFunctionParameter cParms;
|
---|
409 | /** uint32_t, in: Whether or not to block (wait) for a new message to arrive. */
|
---|
410 | HGCMFunctionParameter fBlock;
|
---|
411 | } VBoxShClPeekMsg;
|
---|
412 |
|
---|
413 | #define VBOX_SHCL_CPARMS_GET_HOST_MSG 3
|
---|
414 |
|
---|
415 | /** No listing flags specified. */
|
---|
416 | #define VBOX_SHCL_LIST_FLAG_NONE 0
|
---|
417 | /** Only returns one entry per read. */
|
---|
418 | #define VBOX_SHCL_LIST_FLAG_RETURN_ONE RT_BIT(0)
|
---|
419 | /** Restarts reading a list from the beginning. */
|
---|
420 | #define VBOX_SHCL_LIST_FLAG_RESTART RT_BIT(1)
|
---|
421 |
|
---|
422 | #define VBOX_SHCL_LISTHDR_FLAG_NONE 0
|
---|
423 |
|
---|
424 | /** No additional information provided. */
|
---|
425 | #define VBOX_SHCL_INFO_FLAG_NONE 0
|
---|
426 | /** Get object information of type SHCLFSOBJINFO. */
|
---|
427 | #define VBOX_SHCL_INFO_FLAG_FSOBJINFO RT_BIT(0)
|
---|
428 |
|
---|
429 | /**
|
---|
430 | * Status messag for lists and objects.
|
---|
431 | */
|
---|
432 | typedef struct _VBoxShClStatusMsg
|
---|
433 | {
|
---|
434 | VBGLIOCHGCMCALL hdr;
|
---|
435 |
|
---|
436 | /** uint32_t, in: Context ID. */
|
---|
437 | HGCMFunctionParameter uContext;
|
---|
438 | /** uint32_t, in: Transfer status of type SHCLTRANSFERSTATUS. */
|
---|
439 | HGCMFunctionParameter uStatus;
|
---|
440 | /** uint32_t, in: Size of payload of this status, based on the status type. */
|
---|
441 | HGCMFunctionParameter cbPayload;
|
---|
442 | /** pointer, in: Optional payload of this status, based on the status type. */
|
---|
443 | HGCMFunctionParameter pvPayload;
|
---|
444 | } VBoxShClStatusMsg;
|
---|
445 |
|
---|
446 | #define VBOX_SHCL_CPARMS_STATUS 4
|
---|
447 |
|
---|
448 | /** Invalid message type, do not use. */
|
---|
449 | #define VBOX_SHCL_REPLYMSGTYPE_INVALID 0
|
---|
450 | /** Replies a transfer status. */
|
---|
451 | #define VBOX_SHCL_REPLYMSGTYPE_TRANSFER_STATUS 1
|
---|
452 | /** Replies a list open status. */
|
---|
453 | #define VBOX_SHCL_REPLYMSGTYPE_LIST_OPEN 2
|
---|
454 | /** Replies a list close status. */
|
---|
455 | #define VBOX_SHCL_REPLYMSGTYPE_LIST_CLOSE 3
|
---|
456 | /** Replies an object open status. */
|
---|
457 | #define VBOX_SHCL_REPLYMSGTYPE_OBJ_OPEN 4
|
---|
458 | /** Replies an object close status. */
|
---|
459 | #define VBOX_SHCL_REPLYMSGTYPE_OBJ_CLOSE 5
|
---|
460 |
|
---|
461 | /**
|
---|
462 | * Generic reply message.
|
---|
463 | */
|
---|
464 | typedef struct _VBoxShClReplyMsg
|
---|
465 | {
|
---|
466 | VBGLIOCHGCMCALL hdr;
|
---|
467 |
|
---|
468 | /** uint32_t, out: Context ID. */
|
---|
469 | HGCMFunctionParameter uContext;
|
---|
470 | /** uint32_t, out: Message type of type VBOX_SHCL_REPLYMSGTYPE_XXX. */
|
---|
471 | HGCMFunctionParameter enmType;
|
---|
472 | /** uint32_t, out: IPRT result of overall operation. */
|
---|
473 | HGCMFunctionParameter rc;
|
---|
474 | /** uint32_t, out: Size of optional payload of this reply, based on the message type. */
|
---|
475 | HGCMFunctionParameter cbPayload;
|
---|
476 | /** pointer, out: Optional payload of this reply, based on the message type. */
|
---|
477 | HGCMFunctionParameter pvPayload;
|
---|
478 | union
|
---|
479 | {
|
---|
480 | struct
|
---|
481 | {
|
---|
482 | HGCMFunctionParameter enmStatus;
|
---|
483 | } TransferStatus;
|
---|
484 | struct
|
---|
485 | {
|
---|
486 | HGCMFunctionParameter uHandle;
|
---|
487 | } ListOpen;
|
---|
488 | struct
|
---|
489 | {
|
---|
490 | HGCMFunctionParameter uHandle;
|
---|
491 | } ObjOpen;
|
---|
492 | struct
|
---|
493 | {
|
---|
494 | HGCMFunctionParameter uHandle;
|
---|
495 | } ObjClose;
|
---|
496 | } u;
|
---|
497 | } VBoxShClReplyMsg;
|
---|
498 |
|
---|
499 | /** Minimum parameters (HGCM function parameters minus the union) a reply message must have. */
|
---|
500 | #define VBOX_SHCL_CPARMS_REPLY_MIN 5
|
---|
501 |
|
---|
502 | /**
|
---|
503 | * Structure for keeping root list message parameters.
|
---|
504 | */
|
---|
505 | typedef struct _VBoxShClRootListParms
|
---|
506 | {
|
---|
507 | /** uint32_t, in: Context ID. s*/
|
---|
508 | HGCMFunctionParameter uContext;
|
---|
509 | /** uint32_t, in: Roots listing flags; unused at the moment. */
|
---|
510 | HGCMFunctionParameter fRoots;
|
---|
511 | } VBoxShClRootListParms;
|
---|
512 |
|
---|
513 | /**
|
---|
514 | * Requests to read the root list.
|
---|
515 | */
|
---|
516 | typedef struct _VBoxShClRootListReadReqMsg
|
---|
517 | {
|
---|
518 | VBGLIOCHGCMCALL hdr;
|
---|
519 |
|
---|
520 | VBoxShClRootListParms ReqParms;
|
---|
521 | } VBoxShClRootListReadReqMsg;
|
---|
522 |
|
---|
523 | #define VBOX_SHCL_CPARMS_ROOT_LIST_HDR_READ 2
|
---|
524 |
|
---|
525 | /**
|
---|
526 | * Reads / Writes a root list header.
|
---|
527 | */
|
---|
528 | typedef struct _VBoxShClRootListHdrMsg
|
---|
529 | {
|
---|
530 | VBGLIOCHGCMCALL hdr;
|
---|
531 |
|
---|
532 | VBoxShClRootListParms ReqParms;
|
---|
533 | /** uint64_t, in/out: Number of total root list entries. */
|
---|
534 | HGCMFunctionParameter cRoots;
|
---|
535 | } VBoxShClRootListHdrMsg;
|
---|
536 |
|
---|
537 | #define VBOX_SHCL_CPARMS_ROOT_LIST_HDR 3
|
---|
538 |
|
---|
539 | /**
|
---|
540 | * Structure for keeping list entry message parameters.
|
---|
541 | */
|
---|
542 | typedef struct _VBoxShClRootListEntryParms
|
---|
543 | {
|
---|
544 | /** uint32_t, in: Context ID. */
|
---|
545 | HGCMFunctionParameter uContext;
|
---|
546 | /** uint32_t, in: VBOX_SHCL_INFO_FLAG_XXX. */
|
---|
547 | HGCMFunctionParameter fInfo;
|
---|
548 | /** uint32_t, in: Index of root list entry to get (zero-based). */
|
---|
549 | HGCMFunctionParameter uIndex;
|
---|
550 | } VBoxShClRootListEntryParms;
|
---|
551 |
|
---|
552 | /**
|
---|
553 | * Request to read a list root entry.
|
---|
554 | */
|
---|
555 | typedef struct _VBoxShClRootListEntryReadReqMsg
|
---|
556 | {
|
---|
557 | VBGLIOCHGCMCALL hdr;
|
---|
558 |
|
---|
559 | /** in: Request parameters. */
|
---|
560 | VBoxShClRootListEntryParms Parms;
|
---|
561 | } VBoxShClRootListEntryReadReqMsg;
|
---|
562 |
|
---|
563 | #define VBOX_SHCL_CPARMS_ROOT_LIST_ENTRY_READ_REQ 3
|
---|
564 |
|
---|
565 | /**
|
---|
566 | * Reads / Writes a root list entry.
|
---|
567 | */
|
---|
568 | typedef struct _VBoxShClRootListEntryMsg
|
---|
569 | {
|
---|
570 | VBGLIOCHGCMCALL hdr;
|
---|
571 |
|
---|
572 | /** in/out: Request parameters. */
|
---|
573 | VBoxShClRootListEntryParms Parms;
|
---|
574 | /** pointer, in/out: Entry name. */
|
---|
575 | HGCMFunctionParameter szName;
|
---|
576 | /** uint32_t, out: Bytes to be used for information/How many bytes were used. */
|
---|
577 | HGCMFunctionParameter cbInfo;
|
---|
578 | /** pointer, in/out: Information to be set/get (SHCLFSOBJINFO only currently).
|
---|
579 | * Do not forget to set the SHCLFSOBJINFO::Attr::enmAdditional for Get operation as well. */
|
---|
580 | HGCMFunctionParameter pvInfo;
|
---|
581 | } VBoxShClRootListEntryMsg;
|
---|
582 |
|
---|
583 | #define VBOX_SHCL_CPARMS_ROOT_LIST_ENTRY 6
|
---|
584 |
|
---|
585 | /**
|
---|
586 | * Opens a list.
|
---|
587 | */
|
---|
588 | typedef struct _VBoxShClListOpenMsg
|
---|
589 | {
|
---|
590 | VBGLIOCHGCMCALL hdr;
|
---|
591 |
|
---|
592 | /** uint32_t, in: Context ID. */
|
---|
593 | HGCMFunctionParameter uContext;
|
---|
594 | /** uint32_t, in: Listing flags (see VBOX_SHCL_LIST_FLAG_XXX). */
|
---|
595 | HGCMFunctionParameter fList;
|
---|
596 | /** uint32_t, in: Size (in bytes) of the filter string. */
|
---|
597 | HGCMFunctionParameter cbFilter;
|
---|
598 | /** pointer, in: Filter string. */
|
---|
599 | HGCMFunctionParameter pvFilter;
|
---|
600 | /** uint32_t, in: Size (in bytes) of the listing path. */
|
---|
601 | HGCMFunctionParameter cbPath;
|
---|
602 | /** pointer, in: Listing poth. If empty or NULL the listing's root path will be opened. */
|
---|
603 | HGCMFunctionParameter pvPath;
|
---|
604 | /** uint64_t, out: List handle. */
|
---|
605 | HGCMFunctionParameter uHandle;
|
---|
606 | } VBoxShClListOpenMsg;
|
---|
607 |
|
---|
608 | #define VBOX_SHCL_CPARMS_LIST_OPEN 7
|
---|
609 |
|
---|
610 | /**
|
---|
611 | * Closes a list.
|
---|
612 | */
|
---|
613 | typedef struct _VBoxShClListCloseMsg
|
---|
614 | {
|
---|
615 | VBGLIOCHGCMCALL hdr;
|
---|
616 |
|
---|
617 | /** uint32_t, in/out: Context ID. */
|
---|
618 | HGCMFunctionParameter uContext;
|
---|
619 | /** uint64_t, in: List handle. */
|
---|
620 | HGCMFunctionParameter uHandle;
|
---|
621 | } VBoxShClListCloseMsg;
|
---|
622 |
|
---|
623 | #define VBOX_SHCL_CPARMS_LIST_CLOSE 2
|
---|
624 |
|
---|
625 | typedef struct _VBoxShClListHdrReqParms
|
---|
626 | {
|
---|
627 | /** uint32_t, in: Context ID. */
|
---|
628 | HGCMFunctionParameter uContext;
|
---|
629 | /** uint64_t, in: List handle. */
|
---|
630 | HGCMFunctionParameter uHandle;
|
---|
631 | /** uint32_t, in: Flags of type VBOX_SHCL_LISTHDR_FLAG_XXX. */
|
---|
632 | HGCMFunctionParameter fFlags;
|
---|
633 | } VBoxShClListHdrReqParms;
|
---|
634 |
|
---|
635 | /**
|
---|
636 | * Request to read a list header.
|
---|
637 | */
|
---|
638 | typedef struct _VBoxShClListHdrReadReqMsg
|
---|
639 | {
|
---|
640 | VBGLIOCHGCMCALL hdr;
|
---|
641 |
|
---|
642 | VBoxShClListHdrReqParms ReqParms;
|
---|
643 | } VBoxShClListHdrReadReqMsg;
|
---|
644 |
|
---|
645 | #define VBOX_SHCL_CPARMS_LIST_HDR_READ_REQ 3
|
---|
646 |
|
---|
647 | /**
|
---|
648 | * Reads / Writes a list header.
|
---|
649 | */
|
---|
650 | typedef struct _VBoxShClListHdrMsg
|
---|
651 | {
|
---|
652 | VBGLIOCHGCMCALL hdr;
|
---|
653 |
|
---|
654 | VBoxShClListHdrReqParms ReqParms;
|
---|
655 | /** uint32_t, in/out: Feature flags (see VBOX_SHCL_FEATURE_FLAG_XXX). */
|
---|
656 | HGCMFunctionParameter fFeatures;
|
---|
657 | /** uint64_t, in/out: Number of total objects to transfer. */
|
---|
658 | HGCMFunctionParameter cTotalObjects;
|
---|
659 | /** uint64_t, in/out: Number of total bytes to transfer. */
|
---|
660 | HGCMFunctionParameter cbTotalSize;
|
---|
661 | } VBoxShClListHdrMsg;
|
---|
662 |
|
---|
663 | #define VBOX_SHCL_CPARMS_LIST_HDR 6
|
---|
664 |
|
---|
665 | typedef struct _VBoxShClListEntryReqParms
|
---|
666 | {
|
---|
667 | /** uint32_t, in: Context ID. */
|
---|
668 | HGCMFunctionParameter uContext;
|
---|
669 | /** uint64_t, in: List handle. */
|
---|
670 | HGCMFunctionParameter uHandle;
|
---|
671 | /** uint32_t, in: VBOX_SHCL_INFO_FLAG_XXX. */
|
---|
672 | HGCMFunctionParameter fInfo;
|
---|
673 | } VBoxShClListEntryReqParms;
|
---|
674 |
|
---|
675 | /**
|
---|
676 | * Request to read a list entry.
|
---|
677 | */
|
---|
678 | typedef struct _VBoxShClListEntryReadReqMsg
|
---|
679 | {
|
---|
680 | VBGLIOCHGCMCALL hdr;
|
---|
681 |
|
---|
682 | VBoxShClListEntryReqParms ReqParms;
|
---|
683 | } VBoxShClListEntryReadReqMsg;
|
---|
684 |
|
---|
685 | #define VBOX_SHCL_CPARMS_LIST_ENTRY_READ 3
|
---|
686 |
|
---|
687 | /**
|
---|
688 | * Reads / Writes a list entry.
|
---|
689 | */
|
---|
690 | typedef struct _VBoxShClListEntryMsg
|
---|
691 | {
|
---|
692 | VBGLIOCHGCMCALL hdr;
|
---|
693 |
|
---|
694 | /** in/out: Request parameters. */
|
---|
695 | VBoxShClListEntryReqParms ReqParms;
|
---|
696 | /** pointer, in/out: Entry name. */
|
---|
697 | HGCMFunctionParameter szName;
|
---|
698 | /** uint32_t, out: Bytes to be used for information/How many bytes were used. */
|
---|
699 | HGCMFunctionParameter cbInfo;
|
---|
700 | /** pointer, in/out: Information to be set/get (SHCLFSOBJINFO only currently).
|
---|
701 | * Do not forget to set the SHCLFSOBJINFO::Attr::enmAdditional for Get operation as well. */
|
---|
702 | HGCMFunctionParameter pvInfo;
|
---|
703 | } VBoxShClListEntryMsg;
|
---|
704 |
|
---|
705 | #define VBOX_SHCL_CPARMS_LIST_ENTRY 6
|
---|
706 |
|
---|
707 | /**
|
---|
708 | * Opens a Shared Clipboard object.
|
---|
709 | */
|
---|
710 | typedef struct _VBoxShClObjOpenMsg
|
---|
711 | {
|
---|
712 | VBGLIOCHGCMCALL hdr;
|
---|
713 |
|
---|
714 | /** uint32_t, in/out: Context ID. */
|
---|
715 | HGCMFunctionParameter uContext;
|
---|
716 | /** uint64_t, in/out: Object handle. */
|
---|
717 | HGCMFunctionParameter uHandle;
|
---|
718 | /** uint32_t, in/out: Size (in bytes) of absoulte path of object to open/create. */
|
---|
719 | HGCMFunctionParameter cbPath;
|
---|
720 | /** pointer, in/out: Absoulte path of object to open/create. */
|
---|
721 | HGCMFunctionParameter szPath;
|
---|
722 | /** uint32_t in/out: Open / Create flags of type SHCL_OBJ_CF_. */
|
---|
723 | HGCMFunctionParameter fCreate;
|
---|
724 | } VBoxShClObjOpenMsg;
|
---|
725 |
|
---|
726 | #define VBOX_SHCL_CPARMS_OBJ_OPEN 5
|
---|
727 |
|
---|
728 | /**
|
---|
729 | * Closes a Shared Clipboard object.
|
---|
730 | */
|
---|
731 | typedef struct _VBoxShClObjCloseMsg
|
---|
732 | {
|
---|
733 | VBGLIOCHGCMCALL hdr;
|
---|
734 |
|
---|
735 | /** uint32_t, in/out: Context ID. */
|
---|
736 | HGCMFunctionParameter uContext;
|
---|
737 | /** uint64_t, in: SHCLOBJHANDLE of object to close. */
|
---|
738 | HGCMFunctionParameter uHandle;
|
---|
739 | } VBoxShClObjCloseMsg;
|
---|
740 |
|
---|
741 | #define VBOX_SHCL_CPARMS_OBJ_CLOSE 2
|
---|
742 |
|
---|
743 | /**
|
---|
744 | * Structure for keeping read parameters of a Shared Clipboard object.
|
---|
745 | */
|
---|
746 | typedef struct _VBoxShClObjReadReqParms
|
---|
747 | {
|
---|
748 | /** uint32_t, in: Context ID. */
|
---|
749 | HGCMFunctionParameter uContext;
|
---|
750 | /** uint64_t, in: SHCLOBJHANDLE of object to write to. */
|
---|
751 | HGCMFunctionParameter uHandle;
|
---|
752 | /** uint32_t, in: How many bytes to read. */
|
---|
753 | HGCMFunctionParameter cbToRead;
|
---|
754 | /** uint32_t, in: Read flags. Currently unused and must be 0. */
|
---|
755 | HGCMFunctionParameter fRead;
|
---|
756 | } VBoxShClObjReadReqParms;
|
---|
757 |
|
---|
758 | /**
|
---|
759 | * Reads from a Shared Clipboard object.
|
---|
760 | */
|
---|
761 | typedef struct _VBoxShClObjReadReqMsg
|
---|
762 | {
|
---|
763 | VBGLIOCHGCMCALL hdr;
|
---|
764 |
|
---|
765 | VBoxShClObjReadReqParms ReqParms;
|
---|
766 | } VBoxShClObjReadReqMsg;
|
---|
767 |
|
---|
768 | #define VBOX_SHCL_CPARMS_OBJ_READ_REQ 4
|
---|
769 |
|
---|
770 | /**
|
---|
771 | * Reads / writes data of / to an object.
|
---|
772 | *
|
---|
773 | * Used by:
|
---|
774 | * VBOX_SHCL_FN_OBJ_READ
|
---|
775 | * VBOX_SHCL_FN_OBJ_WRITE
|
---|
776 | */
|
---|
777 | typedef struct _VBoxShClObjReadWriteMsg
|
---|
778 | {
|
---|
779 | VBGLIOCHGCMCALL hdr;
|
---|
780 |
|
---|
781 | /** uint32_t, in/out: Context ID. */
|
---|
782 | HGCMFunctionParameter uContext;
|
---|
783 | /** uint64_t, in/out: SHCLOBJHANDLE of object to write to. */
|
---|
784 | HGCMFunctionParameter uHandle;
|
---|
785 | /** uint32_t, in/out: Size (in bytes) of current data chunk. */
|
---|
786 | HGCMFunctionParameter cbData;
|
---|
787 | /** pointer, in/out: Current data chunk. */
|
---|
788 | HGCMFunctionParameter pvData;
|
---|
789 | /** uint32_t, in/out: Size (in bytes) of current data chunk checksum. */
|
---|
790 | HGCMFunctionParameter cbChecksum;
|
---|
791 | /** pointer, in/out: Checksum of data block, based on the checksum
|
---|
792 | * type in the data header. Optional. */
|
---|
793 | HGCMFunctionParameter pvChecksum;
|
---|
794 | } VBoxShClObjReadWriteMsg;
|
---|
795 |
|
---|
796 | #define VBOX_SHCL_CPARMS_OBJ_READ 6
|
---|
797 | #define VBOX_SHCL_CPARMS_OBJ_WRITE 6
|
---|
798 |
|
---|
799 | /**
|
---|
800 | * Sends an error event.
|
---|
801 | *
|
---|
802 | * Used by:
|
---|
803 | * VBOX_SHCL_FN_WRITE_ERROR
|
---|
804 | */
|
---|
805 | typedef struct _VBoxShClErrorMsg
|
---|
806 | {
|
---|
807 | VBGLIOCHGCMCALL hdr;
|
---|
808 |
|
---|
809 | /** uint32_t, in: Context ID. */
|
---|
810 | HGCMFunctionParameter uContext;
|
---|
811 | /** uint32_t, in: The error code (IPRT-style). */
|
---|
812 | HGCMFunctionParameter rc;
|
---|
813 | } VBoxShClWriteErrorMsg;
|
---|
814 |
|
---|
815 | #define VBOX_SHCL_CPARMS_ERROR 2
|
---|
816 |
|
---|
817 | #pragma pack()
|
---|
818 |
|
---|
819 | /**
|
---|
820 | * Structure for keeping a Shared Clipboard file data chunk.
|
---|
821 | *
|
---|
822 | * @returns VBox status code.
|
---|
823 | */
|
---|
824 | typedef struct _SHCLFILEDATA
|
---|
825 | {
|
---|
826 | /** Current file data chunk. */
|
---|
827 | void *pvData;
|
---|
828 | /** Size (in bytes) of current data chunk. */
|
---|
829 | uint32_t cbData;
|
---|
830 | /** Checksum for current file data chunk. */
|
---|
831 | void *pvChecksum;
|
---|
832 | /** Size (in bytes) of current data chunk. */
|
---|
833 | uint32_t cbChecksum;
|
---|
834 | } SHCLFILEDATA, *PSHCLFILEDATA;
|
---|
835 |
|
---|
836 | /**
|
---|
837 | * Structure for keeping Shared Clipboard error data.
|
---|
838 | */
|
---|
839 | typedef struct _SHCLERRORDATA
|
---|
840 | {
|
---|
841 | int32_t rc;
|
---|
842 | } SHCLERRORDATA, *PSHCLERRORDATA;
|
---|
843 |
|
---|
844 | bool VBoxSvcClipboardGetHeadless(void);
|
---|
845 | bool VBoxSvcClipboardLock(void);
|
---|
846 | void VBoxSvcClipboardUnlock(void);
|
---|
847 |
|
---|
848 | #endif /* !VBOX_INCLUDED_HostServices_VBoxClipboardSvc_h */
|
---|
849 |
|
---|