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_URI_LIST
|
---|
60 | #include <VBox/GuestHost/SharedClipboard-uri.h>
|
---|
61 | #endif
|
---|
62 |
|
---|
63 | /*
|
---|
64 | * The mode of operations.
|
---|
65 | */
|
---|
66 | #define VBOX_SHARED_CLIPBOARD_MODE_OFF 0
|
---|
67 | #define VBOX_SHARED_CLIPBOARD_MODE_HOST_TO_GUEST 1
|
---|
68 | #define VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST 2
|
---|
69 | #define VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL 3
|
---|
70 |
|
---|
71 | /*
|
---|
72 | * The service functions which are callable by host.
|
---|
73 | */
|
---|
74 | /** Sets the current Shared Clipboard operation mode. */
|
---|
75 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE 1
|
---|
76 | /** Run headless on the host, i.e. do not touch the host clipboard. */
|
---|
77 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS 2
|
---|
78 | /** Reports cancellation of the current operation to the guest. */
|
---|
79 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_CANCEL 3
|
---|
80 | /** Reports an error to the guest. */
|
---|
81 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_ERROR 4
|
---|
82 | /** Reports that a new clipboard area has been registered. */
|
---|
83 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_AREA_REGISTER 5
|
---|
84 | /** Reports that a clipboard area has been unregistered. */
|
---|
85 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_AREA_UNREGISTER 6
|
---|
86 | /** Reports that a client (host / guest) has attached to a clipboard area. */
|
---|
87 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_AREA_ATTACH 7
|
---|
88 | /** Reports that a client (host / guest) has detached from a clipboard area. */
|
---|
89 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_AREA_DETACH 8
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * The host messages for the guest.
|
---|
93 | */
|
---|
94 | /** Asks the client to quit / terminate. */
|
---|
95 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT 1
|
---|
96 | /** Reads (simple) data from the guest. */
|
---|
97 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA 2
|
---|
98 | /** Reports available clipboard format from host to the guest.
|
---|
99 | * Formerly known as VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS. */
|
---|
100 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS_REPORT 3
|
---|
101 |
|
---|
102 | /** Initiates a new transfer (read / write) on the guest side. */
|
---|
103 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_TRANSFER_START 50
|
---|
104 | /** Reads the root list header from the guest. */
|
---|
105 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_HDR_READ 51
|
---|
106 | /** Writes the root list header to the guest. */
|
---|
107 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_HDR_WRITE 52
|
---|
108 | /** Reads a root list entry from the guest. */
|
---|
109 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_ENTRY_READ 53
|
---|
110 | /** Writes a root list entry to the guest. */
|
---|
111 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_ENTRY_WRITE 54
|
---|
112 | /** Open an URI list on the guest side. */
|
---|
113 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_OPEN 55
|
---|
114 | /** Closes a formerly opened URI list on the guest side. */
|
---|
115 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE 56
|
---|
116 | /** Reads a list header from the guest. */
|
---|
117 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_READ 57
|
---|
118 | /** Writes a list header to the guest. */
|
---|
119 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_WRITE 58
|
---|
120 | /** Reads a list entry from the guest. */
|
---|
121 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_READ 59
|
---|
122 | /** Writes a list entry to the guest. */
|
---|
123 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_WRITE 60
|
---|
124 | /** Open an URI object on the guest side. */
|
---|
125 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN 61
|
---|
126 | /** Closes a formerly opened URI object on the guest side. */
|
---|
127 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_CLOSE 62
|
---|
128 | /** Reads from an object on the guest side. */
|
---|
129 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_READ 63
|
---|
130 | /** Writes to an object on the guest side. */
|
---|
131 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_WRITE 64
|
---|
132 | /** Indicates that the host has canceled a transfer. */
|
---|
133 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_CANCEL 65
|
---|
134 | /** Indicates that the an unrecoverable error on the host occurred . */
|
---|
135 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ERROR 66
|
---|
136 |
|
---|
137 | /*
|
---|
138 | * The service functions which are called by guest.
|
---|
139 | */
|
---|
140 | /** Calls the host and waits (blocking) for an host event VBOX_SHARED_CLIPBOARD_HOST_MSG_*.
|
---|
141 | * Note: This is the old message which still is being used for the non-URI Shared Clipboard transfers,
|
---|
142 | * to not break compatibility with older Guest Additions / VBox versions. */
|
---|
143 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_GET_HOST_MSG_OLD 1
|
---|
144 | /** Sends a list of available formats to the host.
|
---|
145 | * Formely known as VBOX_SHARED_CLIPBOARD_GUEST_FN_REPORT_FORMATS. */
|
---|
146 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_FORMATS_REPORT 2
|
---|
147 | /** Reads data in specified format from the host. */
|
---|
148 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_DATA_READ 3
|
---|
149 | /** Writes data in requested format to the host. */
|
---|
150 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_DATA_WRITE 4
|
---|
151 |
|
---|
152 | /** Does the actual protocol handshake. If this message is not
|
---|
153 | * being sent by the guest, the host handles that particular client
|
---|
154 | * with the legacy protocol (v0).
|
---|
155 | *
|
---|
156 | * New since protocol v1. */
|
---|
157 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_CONNECT 5
|
---|
158 | /** Peeks at the next message, returning immediately.
|
---|
159 | * New since protocol v1. */
|
---|
160 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_NOWAIT 6
|
---|
161 | /** Peeks at the next message, waiting for one to arrive.
|
---|
162 | * New since protocol v1. */
|
---|
163 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_WAIT 7
|
---|
164 | /** Gets the next message, returning immediately.
|
---|
165 | * New since protocol v1. */
|
---|
166 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET 8
|
---|
167 | /** Sends a transfer status to the host.
|
---|
168 | * New since protocol v1. */
|
---|
169 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_STATUS 9
|
---|
170 | /** Replies to a function from the host.
|
---|
171 | * New since protocol v1. */
|
---|
172 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY 10
|
---|
173 | /** Reports the available root entries of a transfer.
|
---|
174 | * New since protocol v1. */
|
---|
175 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOT_LIST_HDR_READ 11
|
---|
176 | /** Reports the available root entries of a transfer.
|
---|
177 | * New since protocol v1. */
|
---|
178 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOT_LIST_HDR_WRITE 12
|
---|
179 | /** Reports the available root entries of a transfer.
|
---|
180 | * New since protocol v1. */
|
---|
181 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOT_LIST_ENTRY_READ 13
|
---|
182 | /** Reports the available root entries of a transfer.
|
---|
183 | * New since protocol v1. */
|
---|
184 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOT_LIST_ENTRY_WRITE 14
|
---|
185 | /** Opens / gets a list handle from the host.
|
---|
186 | * New since protocol v1. */
|
---|
187 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_OPEN 15
|
---|
188 | /** Closes a list handle from the host.
|
---|
189 | * New since protocol v1. */
|
---|
190 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_CLOSE 16
|
---|
191 | /** Reads a list header from the host.
|
---|
192 | * New since protocol v1. */
|
---|
193 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_READ 17
|
---|
194 | /** Writes a list header to the host.
|
---|
195 | * New since protocol v1. */
|
---|
196 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_WRITE 18
|
---|
197 | /** New since protocol v1. */
|
---|
198 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_READ 19
|
---|
199 | /** New since protocol v1. */
|
---|
200 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_WRITE 20
|
---|
201 | /** New since protocol v1. */
|
---|
202 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_OPEN 21
|
---|
203 | /** New since protocol v1. */
|
---|
204 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_CLOSE 22
|
---|
205 | /** New since protocol v1. */
|
---|
206 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_READ 23
|
---|
207 | /** New since protocol v1. */
|
---|
208 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_WRITE 24
|
---|
209 | /** Reports cancellation of the current operation to the host.
|
---|
210 | * New since protocol v1. */
|
---|
211 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_CANCEL 25
|
---|
212 | /** Reports an error to the host.
|
---|
213 | * New since protocol v1. */
|
---|
214 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_ERROR 26
|
---|
215 |
|
---|
216 | /** The maximum default chunk size for a single data transfer. */
|
---|
217 | #define VBOX_SHARED_CLIPBOARD_MAX_CHUNK_SIZE _64K
|
---|
218 |
|
---|
219 | /**
|
---|
220 | * Creates a context ID out of a source ID and and event ID.
|
---|
221 | */
|
---|
222 | #define VBOX_SHARED_CLIPBOARD_CONTEXTID_MAKE(uSourceID, uEventID) \
|
---|
223 | RT_MAKE_U32(uEventID, uSourceID)
|
---|
224 | /** Gets the source ID out of a context ID. */
|
---|
225 | #define VBOX_SHARED_CLIPBOARD_CONTEXTID_GET_SOURCE(uContextID) \
|
---|
226 | RT_HI_U16(uContextID)
|
---|
227 | /** Gets the event ID out of a context ID. */
|
---|
228 | #define VBOX_SHARED_CLIPBOARD_CONTEXTID_GET_EVENT(uContextID) \
|
---|
229 | RT_LO_U16(uContextID)
|
---|
230 |
|
---|
231 | /*
|
---|
232 | * HGCM parameter structures.
|
---|
233 | */
|
---|
234 | #pragma pack(1)
|
---|
235 | /**
|
---|
236 | * Waits (blocking) for a new host message to arrive.
|
---|
237 | * Deprecated; do not use anymore.
|
---|
238 | * Kept for maintaining compatibility with older Guest Additions.
|
---|
239 | */
|
---|
240 | typedef struct _VBoxClipboardGetHostMsgOld
|
---|
241 | {
|
---|
242 | VBGLIOCHGCMCALL hdr;
|
---|
243 |
|
---|
244 | /** uint32_t, out: Host message type. */
|
---|
245 | HGCMFunctionParameter msg;
|
---|
246 | /** uint32_t, out: VBOX_SHARED_CLIPBOARD_FMT_*, depends on the 'msg'.
|
---|
247 | * r=andy This actual can have *different* meanings, depending on the host message type. */
|
---|
248 | HGCMFunctionParameter formats; /* OUT uint32_t */
|
---|
249 | } VBoxClipboardGetHostMsgOld;
|
---|
250 |
|
---|
251 | #define VBOX_SHARED_CLIPBOARD_CPARMS_GET_HOST_MSG_OLD 2
|
---|
252 |
|
---|
253 | /**
|
---|
254 | * Message for doing the protocol negotiation between the host
|
---|
255 | * and the guest. Not available on older (VBox <= 6.0) hosts.
|
---|
256 | */
|
---|
257 | typedef struct _VBoxClipboardConnect
|
---|
258 | {
|
---|
259 | VBGLIOCHGCMCALL hdr;
|
---|
260 |
|
---|
261 | /** uint32_t, out: Protocol version. */
|
---|
262 | HGCMFunctionParameter uProtocolVer;
|
---|
263 | /** uint32_t, out: Protocol flags, unused at the moment. */
|
---|
264 | HGCMFunctionParameter uProtocolFlags;
|
---|
265 | /** uint32_t, out: Maximum chunk size for data transfers. */
|
---|
266 | HGCMFunctionParameter cbChunkSize;
|
---|
267 | /** uint32_t, in/out: Compression type. Currently unused. */
|
---|
268 | HGCMFunctionParameter enmCompression;
|
---|
269 | /** uint32_t, in/out: Checksum type used for data transfer. Currently unused. */
|
---|
270 | HGCMFunctionParameter enmChecksumType;
|
---|
271 | } VBoxClipboardConnect;
|
---|
272 |
|
---|
273 | #define VBOX_SHARED_CLIPBOARD_CPARMS_CONNECT 5
|
---|
274 |
|
---|
275 | typedef struct _VBoxClipboardFormatsMsg
|
---|
276 | {
|
---|
277 | VBGLIOCHGCMCALL hdr;
|
---|
278 |
|
---|
279 | /** uint32_t, in: Context ID. */
|
---|
280 | HGCMFunctionParameter uContext;
|
---|
281 | /** uint32_t, out: VBOX_SHARED_CLIPBOARD_FMT_*. */
|
---|
282 | HGCMFunctionParameter uFormats;
|
---|
283 | /** uint32_t, in: Format flags. */
|
---|
284 | HGCMFunctionParameter fFlags;
|
---|
285 | } VBoxClipboardFormatsMsg;
|
---|
286 |
|
---|
287 | typedef struct _VBoxClipboardReadDataReqMsg
|
---|
288 | {
|
---|
289 | VBGLIOCHGCMCALL hdr;
|
---|
290 |
|
---|
291 | /** uint32_t, out: Context ID. */
|
---|
292 | HGCMFunctionParameter uContext;
|
---|
293 | /** uint32_t, out: Requested format to read data in. */
|
---|
294 | HGCMFunctionParameter uFormat;
|
---|
295 | /** uint32_t, out: Maximum size (in bytes) to read. */
|
---|
296 | HGCMFunctionParameter cbSize;
|
---|
297 | } VBoxClipboardReadDataReqMsg;
|
---|
298 |
|
---|
299 | #define VBOX_SHARED_CLIPBOARD_CPARMS_READ_DATA_REQ 2
|
---|
300 |
|
---|
301 | typedef struct _VBoxClipboardReadDataMsg
|
---|
302 | {
|
---|
303 | VBGLIOCHGCMCALL hdr;
|
---|
304 |
|
---|
305 | /** uint32_t, out: Requested format. */
|
---|
306 | HGCMFunctionParameter format; /* IN uint32_t */
|
---|
307 | /** ptr, out: The data buffer. */
|
---|
308 | HGCMFunctionParameter ptr; /* IN linear pointer. */
|
---|
309 | /** uint32_t, out: Size of returned data, if > ptr->cb, then no data was
|
---|
310 | * actually transferred and the guest must repeat the call.
|
---|
311 | */
|
---|
312 | HGCMFunctionParameter size; /* OUT uint32_t */
|
---|
313 |
|
---|
314 | } VBoxClipboardReadDataMsg;
|
---|
315 |
|
---|
316 | #define VBOX_SHARED_CLIPBOARD_CPARMS_READ_DATA 3
|
---|
317 |
|
---|
318 | typedef struct _VBoxClipboardWriteDataMsg
|
---|
319 | {
|
---|
320 | VBGLIOCHGCMCALL hdr;
|
---|
321 |
|
---|
322 | union
|
---|
323 | {
|
---|
324 | struct
|
---|
325 | {
|
---|
326 | /** Returned format as requested in the VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA message. */
|
---|
327 | HGCMFunctionParameter format; /* IN uint32_t */
|
---|
328 | /** Data. */
|
---|
329 | HGCMFunctionParameter ptr; /* IN linear pointer. */
|
---|
330 | } v0;
|
---|
331 | struct
|
---|
332 | {
|
---|
333 | /** uint32_t, out: Context ID. */
|
---|
334 | HGCMFunctionParameter uContext;
|
---|
335 | /** uint32_t, out: Requested format to read data in. */
|
---|
336 | HGCMFunctionParameter uFormat;
|
---|
337 | /** uint32_t, out: Size of data (in bytes). */
|
---|
338 | HGCMFunctionParameter cbData;
|
---|
339 | /** ptr, out: Actual data. */
|
---|
340 | HGCMFunctionParameter pvData;
|
---|
341 | } v1;
|
---|
342 | } u;
|
---|
343 | } VBoxClipboardWriteDataMsg;
|
---|
344 |
|
---|
345 | #define VBOX_SHARED_CLIPBOARD_CPARMS_WRITE_DATA 4
|
---|
346 |
|
---|
347 | typedef struct _VBoxClipboardTransferReport
|
---|
348 | {
|
---|
349 | VBGLIOCHGCMCALL hdr;
|
---|
350 |
|
---|
351 | /** uint32_t, out: Context ID. */
|
---|
352 | HGCMFunctionParameter uContext;
|
---|
353 | /** uint32_t, out: Status to report. */
|
---|
354 | HGCMFunctionParameter uStatus;
|
---|
355 | } VBoxClipboardTransferReport;
|
---|
356 |
|
---|
357 | #define VBOX_SHARED_CLIPBOARD_CPARMS_TRANSFER_REPORT 2
|
---|
358 |
|
---|
359 | /**
|
---|
360 | * Asks the host for the next command to process, along
|
---|
361 | * with the needed amount of parameters and an optional blocking
|
---|
362 | * flag.
|
---|
363 | *
|
---|
364 | * Used by: VBOX_SHARED_CLIPBOARD_GUEST_FN_GET_HOST_MSG
|
---|
365 | *
|
---|
366 | */
|
---|
367 | typedef struct _VBoxClipboardGetHostMsg
|
---|
368 | {
|
---|
369 | VBGLIOCHGCMCALL hdr;
|
---|
370 |
|
---|
371 | /** uint32_t, out: Message ID. */
|
---|
372 | HGCMFunctionParameter uMsg;
|
---|
373 | /** uint32_t, out: Number of parameters the message needs. */
|
---|
374 | HGCMFunctionParameter cParms;
|
---|
375 | /** uint32_t, in: Whether or not to block (wait) for a new message to arrive. */
|
---|
376 | HGCMFunctionParameter fBlock;
|
---|
377 | } VBoxClipboardPeekMsg;
|
---|
378 |
|
---|
379 | #define VBOX_SHARED_CLIPBOARD_CPARMS_GET_HOST_MSG 3
|
---|
380 |
|
---|
381 | /** @todo might be necessary for future. */
|
---|
382 | #define VBOX_SHAREDCLIPBOARD_LIST_FLAG_NONE 0
|
---|
383 | #define VBOX_SHAREDCLIPBOARD_LIST_FLAG_RETURN_ONE RT_BIT(0)
|
---|
384 | #define VBOX_SHAREDCLIPBOARD_LIST_FLAG_RESTART RT_BIT(1)
|
---|
385 |
|
---|
386 | #define VBOX_SHAREDCLIPBOARD_LISTHDR_FLAG_NONE 0
|
---|
387 |
|
---|
388 | /** No additional information provided. */
|
---|
389 | #define VBOX_SHAREDCLIPBOARD_INFO_FLAG_NONE 0
|
---|
390 | /** Get object information of type SHAREDCLIPBOARDFSOBJINFO. */
|
---|
391 | #define VBOX_SHAREDCLIPBOARD_INFO_FLAG_FSOBJINFO RT_BIT(0)
|
---|
392 |
|
---|
393 | /**
|
---|
394 | * Transfert status message.
|
---|
395 | */
|
---|
396 | typedef struct _VBoxClipboardStatusMsg
|
---|
397 | {
|
---|
398 | VBGLIOCHGCMCALL hdr;
|
---|
399 |
|
---|
400 | /** uint32_t, in: Context ID. */
|
---|
401 | HGCMFunctionParameter uContext;
|
---|
402 | /** uint32_t, in: Transfer status of type SHAREDCLIPBOARDURITRANSFERSTATUS. */
|
---|
403 | HGCMFunctionParameter uStatus;
|
---|
404 | /** uint32_t, in: Size of payload of this status, based on the status type. */
|
---|
405 | HGCMFunctionParameter cbPayload;
|
---|
406 | /** pointer, in: Optional payload of this status, based on the status type. */
|
---|
407 | HGCMFunctionParameter pvPayload;
|
---|
408 | } VBoxClipboardStatusMsg;
|
---|
409 |
|
---|
410 | #define VBOX_SHARED_CLIPBOARD_CPARMS_STATUS 4
|
---|
411 |
|
---|
412 | #define VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_INVALID 0
|
---|
413 | #define VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_LIST_OPEN 1
|
---|
414 | #define VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_LIST_CLOSE 2
|
---|
415 | #define VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_OBJ_OPEN 3
|
---|
416 | #define VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_OBJ_CLOSE 4
|
---|
417 |
|
---|
418 | /**
|
---|
419 | * Generic reply message.
|
---|
420 | */
|
---|
421 | typedef struct _VBoxClipboardReplyMsg
|
---|
422 | {
|
---|
423 | VBGLIOCHGCMCALL hdr;
|
---|
424 |
|
---|
425 | /** uint32_t, out: Context ID. */
|
---|
426 | HGCMFunctionParameter uContext;
|
---|
427 | /** uint32_t, out: Message type of type VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_XXX. */
|
---|
428 | HGCMFunctionParameter enmType;
|
---|
429 | /** uint32_t, out: IPRT result of overall operation. */
|
---|
430 | HGCMFunctionParameter rc;
|
---|
431 | /** uint32_t, out: Size of optional payload of this reply, based on the message type. */
|
---|
432 | HGCMFunctionParameter cbPayload;
|
---|
433 | /** pointer, out: Optional payload of this reply, based on the message type. */
|
---|
434 | HGCMFunctionParameter pvPayload;
|
---|
435 | union
|
---|
436 | {
|
---|
437 | struct
|
---|
438 | {
|
---|
439 | HGCMFunctionParameter uHandle;
|
---|
440 | } ListOpen;
|
---|
441 | struct
|
---|
442 | {
|
---|
443 | HGCMFunctionParameter uHandle;
|
---|
444 | } ObjOpen;
|
---|
445 | struct
|
---|
446 | {
|
---|
447 | HGCMFunctionParameter uHandle;
|
---|
448 | } ObjClose;
|
---|
449 | } u;
|
---|
450 | } VBoxClipboardReplyMsg;
|
---|
451 |
|
---|
452 | #define VBOX_SHARED_CLIPBOARD_CPARMS_REPLY_MIN 5
|
---|
453 |
|
---|
454 | typedef struct _VBoxClipboardRootListParms
|
---|
455 | {
|
---|
456 | /** uint32_t, in: Context ID. s*/
|
---|
457 | HGCMFunctionParameter uContext;
|
---|
458 | /** uint32_t, in: Roots listing flags; unused at the moment. */
|
---|
459 | HGCMFunctionParameter fRoots;
|
---|
460 | } VBoxClipboardRootListParms;
|
---|
461 |
|
---|
462 | /**
|
---|
463 | * Requests to read the root list.
|
---|
464 | */
|
---|
465 | typedef struct _VBoxClipboardRootListReadReqMsg
|
---|
466 | {
|
---|
467 | VBGLIOCHGCMCALL hdr;
|
---|
468 |
|
---|
469 | VBoxClipboardRootListParms ReqParms;
|
---|
470 | } VBoxClipboardRootListReadReqMsg;
|
---|
471 |
|
---|
472 | #define VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_HDR_READ 2
|
---|
473 |
|
---|
474 | /**
|
---|
475 | * Reads / Writes a root list header.
|
---|
476 | */
|
---|
477 | typedef struct _VBoxClipboardRootListHdrMsg
|
---|
478 | {
|
---|
479 | VBGLIOCHGCMCALL hdr;
|
---|
480 |
|
---|
481 | VBoxClipboardRootListParms ReqParms;
|
---|
482 | /** uint64_t, in/out: Number of total root list entries. */
|
---|
483 | HGCMFunctionParameter cRoots;
|
---|
484 | } VBoxClipboardRootListHdrMsg;
|
---|
485 |
|
---|
486 | #define VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_HDR 2
|
---|
487 |
|
---|
488 | typedef struct _VBoxClipboardRootListEntryParms
|
---|
489 | {
|
---|
490 | /** uint32_t, in: Context ID. */
|
---|
491 | HGCMFunctionParameter uContext;
|
---|
492 | /** uint32_t, in: VBOX_SHAREDCLIPBOARD_INFO_FLAG_XXX. */
|
---|
493 | HGCMFunctionParameter fInfo;
|
---|
494 | /** uint32_t, in: Index of root list entry to get (zero-based). */
|
---|
495 | HGCMFunctionParameter uIndex;
|
---|
496 | } VBoxClipboardRootListEntryParms;
|
---|
497 |
|
---|
498 | /**
|
---|
499 | * Request to read a list root entry.
|
---|
500 | */
|
---|
501 | typedef struct _VBoxClipboardRootListEntryReadReqMsg
|
---|
502 | {
|
---|
503 | VBGLIOCHGCMCALL hdr;
|
---|
504 |
|
---|
505 | /** in: Request parameters. */
|
---|
506 | VBoxClipboardRootListEntryParms Parms;
|
---|
507 | } VBoxClipboardRootListEntryReadReqMsg;
|
---|
508 |
|
---|
509 | #define VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_ENTRY_READ_REQ 3
|
---|
510 |
|
---|
511 | /**
|
---|
512 | * Reads / Writes a root list entry.
|
---|
513 | */
|
---|
514 | typedef struct _VBoxClipboardRootListEntryMsg
|
---|
515 | {
|
---|
516 | VBGLIOCHGCMCALL hdr;
|
---|
517 |
|
---|
518 | /** in/out: Request parameters. */
|
---|
519 | VBoxClipboardRootListEntryParms Parms;
|
---|
520 | /** pointer, in/out: Entry name. */
|
---|
521 | HGCMFunctionParameter szName;
|
---|
522 | /** uint32_t, out: Bytes to be used for information/How many bytes were used. */
|
---|
523 | HGCMFunctionParameter cbInfo;
|
---|
524 | /** pointer, in/out: Information to be set/get (SHAREDCLIPBOARDFSOBJINFO only currently).
|
---|
525 | * Do not forget to set the SHAREDCLIPBOARDFSOBJINFO::Attr::enmAdditional for Get operation as well. */
|
---|
526 | HGCMFunctionParameter pvInfo;
|
---|
527 | } VBoxClipboardRootListEntryMsg;
|
---|
528 |
|
---|
529 | #define VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_ENTRY 6
|
---|
530 |
|
---|
531 | /**
|
---|
532 | * Opens a list.
|
---|
533 | */
|
---|
534 | typedef struct _VBoxClipboardListOpenMsg
|
---|
535 | {
|
---|
536 | VBGLIOCHGCMCALL hdr;
|
---|
537 |
|
---|
538 | /** uint32_t, in: Context ID. */
|
---|
539 | HGCMFunctionParameter uContext;
|
---|
540 | /** uint32_t, in: Listing flags (see VBOX_SHAREDCLIPBOARD_LIST_FLAG_XXX). */
|
---|
541 | HGCMFunctionParameter fList;
|
---|
542 | /** uint32_t, in: Size (in bytes) of the filter string. */
|
---|
543 | HGCMFunctionParameter cbFilter;
|
---|
544 | /** pointer, in: Filter string. */
|
---|
545 | HGCMFunctionParameter pvFilter;
|
---|
546 | /** uint32_t, in: Size (in bytes) of the listing path. */
|
---|
547 | HGCMFunctionParameter cbPath;
|
---|
548 | /** pointer, in: Listing poth. If empty or NULL the listing's root path will be opened. */
|
---|
549 | HGCMFunctionParameter pvPath;
|
---|
550 | /** uint64_t, out: List handle. */
|
---|
551 | HGCMFunctionParameter uHandle;
|
---|
552 | } VBoxClipboardListOpenMsg;
|
---|
553 |
|
---|
554 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_OPEN 7
|
---|
555 |
|
---|
556 | /**
|
---|
557 | * Closes a list.
|
---|
558 | */
|
---|
559 | typedef struct _VBoxClipboardListCloseMsg
|
---|
560 | {
|
---|
561 | VBGLIOCHGCMCALL hdr;
|
---|
562 |
|
---|
563 | /** uint32_t, in/out: Context ID. */
|
---|
564 | HGCMFunctionParameter uContext;
|
---|
565 | /** uint64_t, in: List handle. */
|
---|
566 | HGCMFunctionParameter uHandle;
|
---|
567 | } VBoxClipboardListCloseMsg;
|
---|
568 |
|
---|
569 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_CLOSE 2
|
---|
570 |
|
---|
571 | typedef struct _VBoxClipboardListHdrReqParms
|
---|
572 | {
|
---|
573 | /** uint32_t, in: Context ID. */
|
---|
574 | HGCMFunctionParameter uContext;
|
---|
575 | /** uint64_t, in: List handle. */
|
---|
576 | HGCMFunctionParameter uHandle;
|
---|
577 | /** uint32_t, in: Flags of type VBOX_SHAREDCLIPBOARD_LISTHDR_FLAG_XXX. */
|
---|
578 | HGCMFunctionParameter fFlags;
|
---|
579 | } VBoxClipboardListHdrReqParms;
|
---|
580 |
|
---|
581 | /**
|
---|
582 | * Request to read a list header.
|
---|
583 | */
|
---|
584 | typedef struct _VBoxClipboardListHdrReadReqMsg
|
---|
585 | {
|
---|
586 | VBGLIOCHGCMCALL hdr;
|
---|
587 |
|
---|
588 | VBoxClipboardListHdrReqParms ReqParms;
|
---|
589 | } VBoxClipboardListHdrReadReqMsg;
|
---|
590 |
|
---|
591 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR_READ_REQ 3
|
---|
592 |
|
---|
593 | /**
|
---|
594 | * Reads / Writes a list header.
|
---|
595 | */
|
---|
596 | typedef struct _VBoxClipboardListHdrMsg
|
---|
597 | {
|
---|
598 | VBGLIOCHGCMCALL hdr;
|
---|
599 |
|
---|
600 | VBoxClipboardListHdrReqParms ReqParms;
|
---|
601 | /** uint32_t, in/out: Feature flags (see VBOX_SHAREDCLIPBOARD_FEATURE_FLAG_XXX). */
|
---|
602 | HGCMFunctionParameter fFeatures;
|
---|
603 | /** uint64_t, in/out: Number of total objects to transfer. */
|
---|
604 | HGCMFunctionParameter cTotalObjects;
|
---|
605 | /** uint64_t, in/out: Number of total bytes to transfer. */
|
---|
606 | HGCMFunctionParameter cbTotalSize;
|
---|
607 | } VBoxClipboardListHdrMsg;
|
---|
608 |
|
---|
609 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR 6
|
---|
610 |
|
---|
611 | typedef struct _VBoxClipboardListEntryReqParms
|
---|
612 | {
|
---|
613 | /** uint32_t, in: Context ID. */
|
---|
614 | HGCMFunctionParameter uContext;
|
---|
615 | /** uint64_t, in: List handle. */
|
---|
616 | HGCMFunctionParameter uHandle;
|
---|
617 | /** uint32_t, in: VBOX_SHAREDCLIPBOARD_INFO_FLAG_XXX. */
|
---|
618 | HGCMFunctionParameter fInfo;
|
---|
619 | } VBoxClipboardListEntryReqParms;
|
---|
620 |
|
---|
621 | /**
|
---|
622 | * Request to read a list entry.
|
---|
623 | */
|
---|
624 | typedef struct _VBoxClipboardListEntryReadReqMsg
|
---|
625 | {
|
---|
626 | VBGLIOCHGCMCALL hdr;
|
---|
627 |
|
---|
628 | VBoxClipboardListEntryReqParms ReqParms;
|
---|
629 | } VBoxClipboardListEntryReadReqMsg;
|
---|
630 |
|
---|
631 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY_READ 3
|
---|
632 |
|
---|
633 | /**
|
---|
634 | * Reads / Writes a list entry.
|
---|
635 | */
|
---|
636 | typedef struct _VBoxClipboardListEntryMsg
|
---|
637 | {
|
---|
638 | VBGLIOCHGCMCALL hdr;
|
---|
639 |
|
---|
640 | /** in/out: Request parameters. */
|
---|
641 | VBoxClipboardListEntryReqParms ReqParms;
|
---|
642 | /** pointer, in/out: Entry name. */
|
---|
643 | HGCMFunctionParameter szName;
|
---|
644 | /** uint32_t, out: Bytes to be used for information/How many bytes were used. */
|
---|
645 | HGCMFunctionParameter cbInfo;
|
---|
646 | /** pointer, in/out: Information to be set/get (SHAREDCLIPBOARDFSOBJINFO only currently).
|
---|
647 | * Do not forget to set the SHAREDCLIPBOARDFSOBJINFO::Attr::enmAdditional for Get operation as well. */
|
---|
648 | HGCMFunctionParameter pvInfo;
|
---|
649 | } VBoxClipboardListEntryMsg;
|
---|
650 |
|
---|
651 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY 6
|
---|
652 |
|
---|
653 | typedef struct _VBoxClipboardObjOpenMsg
|
---|
654 | {
|
---|
655 | VBGLIOCHGCMCALL hdr;
|
---|
656 |
|
---|
657 | /** uint32_t, in/out: Context ID. */
|
---|
658 | HGCMFunctionParameter uContext;
|
---|
659 | /** uint64_t, in/out: Object handle. */
|
---|
660 | HGCMFunctionParameter uHandle;
|
---|
661 | /** uint32_t, in/out: Size (in bytes) of absoulte path of object to open/create. */
|
---|
662 | HGCMFunctionParameter cbPath;
|
---|
663 | /** pointer, in/out: Absoulte path of object to open/create. */
|
---|
664 | HGCMFunctionParameter szPath;
|
---|
665 | /** uint32_t in/out: Open / Create flags of type SHAREDCLIPBOARD_OBJ_CF_. */
|
---|
666 | HGCMFunctionParameter fCreate;
|
---|
667 | } VBoxClipboardObjOpenMsg;
|
---|
668 |
|
---|
669 | #define VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_OPEN 5
|
---|
670 |
|
---|
671 | typedef struct _VBoxClipboardObjCloseMsg
|
---|
672 | {
|
---|
673 | VBGLIOCHGCMCALL hdr;
|
---|
674 |
|
---|
675 | /** uint32_t, in/out: Context ID. */
|
---|
676 | HGCMFunctionParameter uContext;
|
---|
677 | /** uint64_t, in: SHAREDCLIPBOARDOBJHANDLE of object to close. */
|
---|
678 | HGCMFunctionParameter uHandle;
|
---|
679 | } VBoxClipboardObjCloseMsg;
|
---|
680 |
|
---|
681 | #define VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_CLOSE 2
|
---|
682 |
|
---|
683 | typedef struct _VBoxClipboardObjReadReqParms
|
---|
684 | {
|
---|
685 | /** uint32_t, in: Context ID. */
|
---|
686 | HGCMFunctionParameter uContext;
|
---|
687 | /** uint64_t, in: SHAREDCLIPBOARDOBJHANDLE of object to write to. */
|
---|
688 | HGCMFunctionParameter uHandle;
|
---|
689 | /** uint32_t, in: How many bytes to read. */
|
---|
690 | HGCMFunctionParameter cbToRead;
|
---|
691 | /** uint32_t, in: Read flags. Currently unused and must be 0. */
|
---|
692 | HGCMFunctionParameter fRead;
|
---|
693 | } VBoxClipboardObjReadReqParms;
|
---|
694 |
|
---|
695 | typedef struct _VBoxClipboardObjReadReqMsg
|
---|
696 | {
|
---|
697 | VBGLIOCHGCMCALL hdr;
|
---|
698 |
|
---|
699 | VBoxClipboardObjReadReqParms ReqParms;
|
---|
700 | } VBoxClipboardObjReadReqMsg;
|
---|
701 |
|
---|
702 | #define VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_READ_REQ 4
|
---|
703 |
|
---|
704 | /**
|
---|
705 | * Reads / writes data of / to an object.
|
---|
706 | *
|
---|
707 | * Used by:
|
---|
708 | * VBOX_SHARED_CLIPBOARD_FN_OBJ_READ
|
---|
709 | * VBOX_SHARED_CLIPBOARD_FN_OBJ_WRITE
|
---|
710 | */
|
---|
711 | typedef struct _VBoxClipboardObjReadWriteMsg
|
---|
712 | {
|
---|
713 | VBGLIOCHGCMCALL hdr;
|
---|
714 |
|
---|
715 | /** uint32_t, in/out: Context ID. */
|
---|
716 | HGCMFunctionParameter uContext;
|
---|
717 | /** uint64_t, in/out: SHAREDCLIPBOARDOBJHANDLE of object to write to. */
|
---|
718 | HGCMFunctionParameter uHandle;
|
---|
719 | /** uint32_t, in/out: Size (in bytes) of current data chunk. */
|
---|
720 | HGCMFunctionParameter cbData;
|
---|
721 | /** pointer, in/out: Current data chunk. */
|
---|
722 | HGCMFunctionParameter pvData;
|
---|
723 | /** uint32_t, in/out: Size (in bytes) of current data chunk checksum. */
|
---|
724 | HGCMFunctionParameter cbChecksum;
|
---|
725 | /** pointer, in/out: Checksum of data block, based on the checksum
|
---|
726 | * type in the data header. Optional. */
|
---|
727 | HGCMFunctionParameter pvChecksum;
|
---|
728 | } VBoxClipboardObjReadWriteMsg;
|
---|
729 |
|
---|
730 | #define VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_READ 6
|
---|
731 | #define VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_WRITE 6
|
---|
732 |
|
---|
733 | /**
|
---|
734 | * Sends an error event.
|
---|
735 | *
|
---|
736 | * Used by:
|
---|
737 | * VBOX_SHARED_CLIPBOARD_FN_WRITE_ERROR
|
---|
738 | */
|
---|
739 | typedef struct _VBoxClipboardErrorMsg
|
---|
740 | {
|
---|
741 | VBGLIOCHGCMCALL hdr;
|
---|
742 |
|
---|
743 | /** uint32_t, in: Context ID. */
|
---|
744 | HGCMFunctionParameter uContext;
|
---|
745 | /** uint32_t, in: The error code (IPRT-style). */
|
---|
746 | HGCMFunctionParameter rc;
|
---|
747 | } VBoxClipboardWriteErrorMsg;
|
---|
748 |
|
---|
749 | #define VBOX_SHARED_CLIPBOARD_CPARMS_ERROR 2
|
---|
750 |
|
---|
751 | #pragma pack()
|
---|
752 |
|
---|
753 | typedef struct _VBOXCLIPBOARDFILEDATA
|
---|
754 | {
|
---|
755 | /** Current file data chunk. */
|
---|
756 | void *pvData;
|
---|
757 | /** Size (in bytes) of current data chunk. */
|
---|
758 | uint32_t cbData;
|
---|
759 | /** Checksum for current file data chunk. */
|
---|
760 | void *pvChecksum;
|
---|
761 | /** Size (in bytes) of current data chunk. */
|
---|
762 | uint32_t cbChecksum;
|
---|
763 | } VBOXCLIPBOARDFILEDATA, *PVBOXCLIPBOARDFILEDATA;
|
---|
764 |
|
---|
765 | typedef struct _VBOXCLIPBOARDERRORDATA
|
---|
766 | {
|
---|
767 | int32_t rc;
|
---|
768 | } VBOXCLIPBOARDERRORDATA, *PVBOXCLIPBOARDERRORDATA;
|
---|
769 |
|
---|
770 | bool VBoxSvcClipboardGetHeadless(void);
|
---|
771 | bool VBoxSvcClipboardLock(void);
|
---|
772 | void VBoxSvcClipboardUnlock(void);
|
---|
773 |
|
---|
774 | #endif /* !VBOX_INCLUDED_HostServices_VBoxClipboardSvc_h */
|
---|
775 |
|
---|