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