1 | /** @file
|
---|
2 | * Shared Clipboard - Common header for host service and guest clients.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef VBOX_INCLUDED_HostServices_VBoxClipboardSvc_h
|
---|
27 | #define VBOX_INCLUDED_HostServices_VBoxClipboardSvc_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/VMMDevCoreTypes.h>
|
---|
33 | #include <VBox/VBoxGuestCoreTypes.h>
|
---|
34 | #include <VBox/hgcmsvc.h>
|
---|
35 |
|
---|
36 | #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
|
---|
37 | #include <VBox/GuestHost/SharedClipboard-uri.h>
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | /*
|
---|
41 | * The mode of operations.
|
---|
42 | */
|
---|
43 | #define VBOX_SHARED_CLIPBOARD_MODE_OFF 0
|
---|
44 | #define VBOX_SHARED_CLIPBOARD_MODE_HOST_TO_GUEST 1
|
---|
45 | #define VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST 2
|
---|
46 | #define VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL 3
|
---|
47 |
|
---|
48 | /*
|
---|
49 | * The service functions which are callable by host.
|
---|
50 | */
|
---|
51 | /** Sets the current Shared Clipboard operation mode. */
|
---|
52 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE 1
|
---|
53 | /** Run headless on the host, i.e. do not touch the host clipboard. */
|
---|
54 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS 2
|
---|
55 | /** Reports cancellation of the current operation to the guest. */
|
---|
56 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_CANCEL 3
|
---|
57 | /** Reports an error to the guest. */
|
---|
58 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_ERROR 4
|
---|
59 | /** Reports that a new clipboard area has been registered. */
|
---|
60 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_AREA_REGISTER 5
|
---|
61 | /** Reports that a clipboard area has been unregistered. */
|
---|
62 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_AREA_UNREGISTER 6
|
---|
63 | /** Reports that a client (host / guest) has attached to a clipboard area. */
|
---|
64 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_AREA_ATTACH 7
|
---|
65 | /** Reports that a client (host / guest) has detached from a clipboard area. */
|
---|
66 | #define VBOX_SHARED_CLIPBOARD_HOST_FN_AREA_DETACH 8
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * The host messages for the guest.
|
---|
70 | */
|
---|
71 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT 1
|
---|
72 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA 2
|
---|
73 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS 3
|
---|
74 |
|
---|
75 | /** Initiates a new transfer (read / write) on the guest side. */
|
---|
76 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_TRANSFER_START 50
|
---|
77 | /** Requests reading the root entries from the guest. */
|
---|
78 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOTS 51
|
---|
79 | /** Open an URI list on the guest side. */
|
---|
80 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_OPEN 52
|
---|
81 | /** Closes a formerly opened URI list on the guest side. */
|
---|
82 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE 53
|
---|
83 | /** Reads a list header from the guest. */
|
---|
84 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_READ 54
|
---|
85 | /** Writes a list header to the guest. */
|
---|
86 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_WRITE 55
|
---|
87 | /** Reads a list entry from the guest. */
|
---|
88 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_READ 56
|
---|
89 | /** Writes a list entry to the guest. */
|
---|
90 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_WRITE 57
|
---|
91 | /** Open an URI object on the guest side. */
|
---|
92 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN 58
|
---|
93 | /** Closes a formerly opened URI object on the guest side. */
|
---|
94 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_CLOSE 59
|
---|
95 | /** Reads from an object on the guest side. */
|
---|
96 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_READ 60
|
---|
97 | /** Writes to an object on the guest side. */
|
---|
98 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_WRITE 61
|
---|
99 | /** Indicates that the host has canceled a transfer. */
|
---|
100 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_CANCEL 62
|
---|
101 | /** Indicates that the an unrecoverable error on the host occurred . */
|
---|
102 | #define VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ERROR 63
|
---|
103 |
|
---|
104 | /*
|
---|
105 | * The service functions which are called by guest.
|
---|
106 | */
|
---|
107 | /** Calls the host and waits (blocking) for an host event VBOX_SHARED_CLIPBOARD_HOST_MSG_*.
|
---|
108 | * Note: This is the old message which still is being used for the non-URI Shared Clipboard transfers,
|
---|
109 | * to not break compatibility with older Guest Additions / VBox versions. */
|
---|
110 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_GET_HOST_MSG_OLD 1
|
---|
111 | /** Sends a list of available formats to the host. */
|
---|
112 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_REPORT_FORMATS 2
|
---|
113 | /** Reads data in specified format from the host. */
|
---|
114 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_READ_DATA 3
|
---|
115 | /** Writes data in requested format to the host. */
|
---|
116 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_WRITE_DATA 4
|
---|
117 |
|
---|
118 | /** Peeks at the next message, returning immediately.
|
---|
119 | * New since URI handling was implemented. */
|
---|
120 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_NOWAIT 5
|
---|
121 | /** Peeks at the next message, waiting for one to arrive.
|
---|
122 | * New since URI handling was implemented. */
|
---|
123 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_WAIT 6
|
---|
124 | /** Gets the next message, returning immediately.
|
---|
125 | * New since URI handling was implemented. */
|
---|
126 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET 7
|
---|
127 | /** Sends a transfer status to the host.
|
---|
128 | * New since URI handling was implemented. */
|
---|
129 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_STATUS 8
|
---|
130 | /** Replies to a function from the host.
|
---|
131 | * New since URI handling was implemented. */
|
---|
132 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY 9
|
---|
133 | /** Reports the available root entries of a transfer.
|
---|
134 | * New since URI handling was implemented. */
|
---|
135 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOTS 10
|
---|
136 | /** Opens / gets a list handle from the host.
|
---|
137 | * New since URI handling was implemented. */
|
---|
138 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_OPEN 11
|
---|
139 | /** Closes a list handle from the host.
|
---|
140 | * New since URI handling was implemented. */
|
---|
141 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_CLOSE 12
|
---|
142 | /** Reads a list header from the host.
|
---|
143 | * New since URI handling was implemented. */
|
---|
144 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_READ 13
|
---|
145 | /** Writes a list header to the host.
|
---|
146 | * New since URI handling was implemented. */
|
---|
147 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_WRITE 14
|
---|
148 | /** New since URI handling was implemented. */
|
---|
149 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_READ 15
|
---|
150 | /** New since URI handling was implemented. */
|
---|
151 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_WRITE 16
|
---|
152 | /** New since URI handling was implemented. */
|
---|
153 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_OPEN 17
|
---|
154 | /** New since URI handling was implemented. */
|
---|
155 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_CLOSE 18
|
---|
156 | /** New since URI handling was implemented. */
|
---|
157 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_READ 19
|
---|
158 | /** New since URI handling was implemented. */
|
---|
159 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_WRITE 20
|
---|
160 | /** Reports cancellation of the current operation to the host.
|
---|
161 | * New since URI handling was implemented. */
|
---|
162 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_CANCEL 21
|
---|
163 | /** Reports an error to the host.
|
---|
164 | * New since URI handling was implemented. */
|
---|
165 | #define VBOX_SHARED_CLIPBOARD_GUEST_FN_ERROR 22
|
---|
166 |
|
---|
167 | /**
|
---|
168 | * Translates a Shared Clipboard host message enum to a string.
|
---|
169 | *
|
---|
170 | * @returns Message ID string name.
|
---|
171 | * @param uMsg The message to translate.
|
---|
172 | */
|
---|
173 | DECLINLINE(const char *) VBoxSvcClipboardHostMsgToStr(uint32_t uMsg)
|
---|
174 | {
|
---|
175 | switch (uMsg)
|
---|
176 | {
|
---|
177 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT);
|
---|
178 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA);
|
---|
179 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS);
|
---|
180 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_TRANSFER_START);
|
---|
181 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOTS);
|
---|
182 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_OPEN);
|
---|
183 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE);
|
---|
184 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_READ);
|
---|
185 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_WRITE);
|
---|
186 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_READ);
|
---|
187 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_WRITE);
|
---|
188 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN);
|
---|
189 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_CLOSE);
|
---|
190 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_READ);
|
---|
191 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_WRITE);
|
---|
192 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_CANCEL);
|
---|
193 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ERROR);
|
---|
194 | }
|
---|
195 | return "Unknown";
|
---|
196 | }
|
---|
197 |
|
---|
198 | /**
|
---|
199 | * Translates a Shared Clipboard guest message enum to a string.
|
---|
200 | *
|
---|
201 | * @returns Message ID string name.
|
---|
202 | * @param uMsg The message to translate.
|
---|
203 | */
|
---|
204 | DECLINLINE(const char *) VBoxSvcClipboardGuestMsgToStr(uint32_t uMsg)
|
---|
205 | {
|
---|
206 | switch (uMsg)
|
---|
207 | {
|
---|
208 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_REPORT_FORMATS);
|
---|
209 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_READ_DATA);
|
---|
210 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_WRITE_DATA);
|
---|
211 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_NOWAIT);
|
---|
212 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_WAIT);
|
---|
213 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET);
|
---|
214 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_STATUS);
|
---|
215 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY);
|
---|
216 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOTS);
|
---|
217 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_OPEN);
|
---|
218 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_CLOSE);
|
---|
219 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_READ);
|
---|
220 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_WRITE);
|
---|
221 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_READ);
|
---|
222 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_WRITE);
|
---|
223 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_OPEN);
|
---|
224 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_CLOSE);
|
---|
225 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_READ);
|
---|
226 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_WRITE);
|
---|
227 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_CANCEL);
|
---|
228 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_ERROR);
|
---|
229 | RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT);
|
---|
230 | }
|
---|
231 | return "Unknown";
|
---|
232 | }
|
---|
233 |
|
---|
234 | /** The maximum default chunk size for a single data transfer. */
|
---|
235 | #define VBOX_SHARED_CLIPBOARD_MAX_CHUNK_SIZE _64K
|
---|
236 |
|
---|
237 | /*
|
---|
238 | * HGCM parameter structures.
|
---|
239 | */
|
---|
240 | #pragma pack(1)
|
---|
241 | typedef struct _VBoxClipboardGetHostMsgOld
|
---|
242 | {
|
---|
243 | VBGLIOCHGCMCALL hdr;
|
---|
244 |
|
---|
245 | /* VBOX_SHARED_CLIPBOARD_HOST_MSG_* */
|
---|
246 | HGCMFunctionParameter msg; /* OUT uint32_t */
|
---|
247 |
|
---|
248 | /* VBOX_SHARED_CLIPBOARD_FMT_*, depends on the 'msg'. */
|
---|
249 | HGCMFunctionParameter formats; /* OUT uint32_t */
|
---|
250 | } VBoxClipboardGetHostMsgOld;
|
---|
251 |
|
---|
252 | #define VBOX_SHARED_CLIPBOARD_CPARMS_GET_HOST_MSG_OLD 2
|
---|
253 |
|
---|
254 | typedef struct _VBoxClipboardReportFormatsMsg
|
---|
255 | {
|
---|
256 | VBGLIOCHGCMCALL hdr;
|
---|
257 |
|
---|
258 | /* VBOX_SHARED_CLIPBOARD_FMT_* */
|
---|
259 | HGCMFunctionParameter formats; /* OUT uint32_t */
|
---|
260 | } VBoxClipboardReportFormatsMsg;
|
---|
261 |
|
---|
262 | #define VBOX_SHARED_CLIPBOARD_CPARMS_REPORT_FORMATS 1
|
---|
263 |
|
---|
264 | typedef struct _VBoxClipboardReadDataMsg
|
---|
265 | {
|
---|
266 | VBGLIOCHGCMCALL hdr;
|
---|
267 |
|
---|
268 | /* Requested format. */
|
---|
269 | HGCMFunctionParameter format; /* IN uint32_t */
|
---|
270 |
|
---|
271 | /* The data buffer. */
|
---|
272 | HGCMFunctionParameter ptr; /* IN linear pointer. */
|
---|
273 |
|
---|
274 | /* Size of returned data, if > ptr->cb, then no data was
|
---|
275 | * actually transferred and the guest must repeat the call.
|
---|
276 | */
|
---|
277 | HGCMFunctionParameter size; /* OUT uint32_t */
|
---|
278 |
|
---|
279 | } VBoxClipboardReadDataMsg;
|
---|
280 |
|
---|
281 | #define VBOX_SHARED_CLIPBOARD_CPARMS_READ_DATA 3
|
---|
282 |
|
---|
283 | typedef struct _VBoxClipboardWriteDataMsg
|
---|
284 | {
|
---|
285 | VBGLIOCHGCMCALL hdr;
|
---|
286 |
|
---|
287 | /* Returned format as requested in the VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA message. */
|
---|
288 | HGCMFunctionParameter format; /* IN uint32_t */
|
---|
289 |
|
---|
290 | /* Data. */
|
---|
291 | HGCMFunctionParameter ptr; /* IN linear pointer. */
|
---|
292 | } VBoxClipboardWriteDataMsg;
|
---|
293 |
|
---|
294 | #define VBOX_SHARED_CLIPBOARD_CPARMS_WRITE_DATA 2
|
---|
295 |
|
---|
296 | typedef struct _VBoxClipboardTransferReport
|
---|
297 | {
|
---|
298 | VBGLIOCHGCMCALL hdr;
|
---|
299 |
|
---|
300 | /** uint32_t, out: Context ID. Unused at the moment. */
|
---|
301 | HGCMFunctionParameter uContext;
|
---|
302 | /** uint32_t, out: Status to report. */
|
---|
303 | HGCMFunctionParameter uStatus;
|
---|
304 | } VBoxClipboardTransferReport;
|
---|
305 |
|
---|
306 | #define VBOX_SHARED_CLIPBOARD_CPARMS_TRANSFER_REPORT 2
|
---|
307 |
|
---|
308 | /**
|
---|
309 | * Asks the host for the next command to process, along
|
---|
310 | * with the needed amount of parameters and an optional blocking
|
---|
311 | * flag.
|
---|
312 | *
|
---|
313 | * Used by: VBOX_SHARED_CLIPBOARD_GUEST_FN_GET_HOST_MSG
|
---|
314 | *
|
---|
315 | */
|
---|
316 | typedef struct _VBoxClipboardGetHostMsg
|
---|
317 | {
|
---|
318 | VBGLIOCHGCMCALL hdr;
|
---|
319 |
|
---|
320 | /** uint32_t, out: Message ID. */
|
---|
321 | HGCMFunctionParameter uMsg;
|
---|
322 | /** uint32_t, out: Number of parameters the message needs. */
|
---|
323 | HGCMFunctionParameter cParms;
|
---|
324 | /** uint32_t, in: Whether or not to block (wait) for a new message to arrive. */
|
---|
325 | HGCMFunctionParameter fBlock;
|
---|
326 | } VBoxClipboardPeekMsg;
|
---|
327 |
|
---|
328 | #define VBOX_SHARED_CLIPBOARD_CPARMS_GET_HOST_MSG 3
|
---|
329 |
|
---|
330 | /** @todo might be necessary for future. */
|
---|
331 | #define VBOX_SHAREDCLIPBOARD_LIST_FLAG_NONE 0
|
---|
332 | #define VBOX_SHAREDCLIPBOARD_LIST_FLAG_RETURN_ONE RT_BIT(0)
|
---|
333 | #define VBOX_SHAREDCLIPBOARD_LIST_FLAG_RESTART RT_BIT(1)
|
---|
334 |
|
---|
335 | #define VBOX_SHAREDCLIPBOARD_LISTHDR_FLAG_NONE 0
|
---|
336 |
|
---|
337 | /** No additional information provided. */
|
---|
338 | #define VBOX_SHAREDCLIPBOARD_INFO_FLAG_NONE 0
|
---|
339 | /** Get object information of type SHAREDCLIPBOARDFSOBJINFO. */
|
---|
340 | #define VBOX_SHAREDCLIPBOARD_INFO_FLAG_FSOBJINFO RT_BIT(0)
|
---|
341 |
|
---|
342 | /**
|
---|
343 | * Transfert status message.
|
---|
344 | */
|
---|
345 | typedef struct _VBoxClipboardStatusMsg
|
---|
346 | {
|
---|
347 | VBGLIOCHGCMCALL hdr;
|
---|
348 |
|
---|
349 | /** uint32_t, in: Context ID. Unused at the moment. */
|
---|
350 | HGCMFunctionParameter uContext;
|
---|
351 | /** uint32_t, in: Transfer status of type SHAREDCLIPBOARDURITRANSFERSTATUS. */
|
---|
352 | HGCMFunctionParameter uStatus;
|
---|
353 | /** uint32_t, in: Size of payload of this status, based on the status type. */
|
---|
354 | HGCMFunctionParameter cbPayload;
|
---|
355 | /** pointer, in: Optional payload of this status, based on the status type. */
|
---|
356 | HGCMFunctionParameter pvPayload;
|
---|
357 | } VBoxClipboardStatusMsg;
|
---|
358 |
|
---|
359 | #define VBOX_SHARED_CLIPBOARD_CPARMS_STATUS 4
|
---|
360 |
|
---|
361 | #define VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_INVALID 0
|
---|
362 | #define VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_LIST_OPEN 1
|
---|
363 | #define VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_LIST_CLOSE 2
|
---|
364 | #define VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_OBJ_OPEN 3
|
---|
365 | #define VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_OBJ_CLOSE 4
|
---|
366 |
|
---|
367 | /**
|
---|
368 | * Generic reply message.
|
---|
369 | */
|
---|
370 | typedef struct _VBoxClipboardReplyMsg
|
---|
371 | {
|
---|
372 | VBGLIOCHGCMCALL hdr;
|
---|
373 |
|
---|
374 | /** uint32_t, out: Context ID. Unused at the moment. */
|
---|
375 | HGCMFunctionParameter uContext;
|
---|
376 | /** uint32_t, out: Message type of type VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_XXX. */
|
---|
377 | HGCMFunctionParameter enmType;
|
---|
378 | /** uint32_t, out: IPRT result of overall operation. */
|
---|
379 | HGCMFunctionParameter rc;
|
---|
380 | /** uint32_t, out: Size of optional payload of this reply, based on the message type. */
|
---|
381 | HGCMFunctionParameter cbPayload;
|
---|
382 | /** pointer, out: Optional payload of this reply, based on the message type. */
|
---|
383 | HGCMFunctionParameter pvPayload;
|
---|
384 | union
|
---|
385 | {
|
---|
386 | struct
|
---|
387 | {
|
---|
388 | HGCMFunctionParameter uHandle;
|
---|
389 | } ListOpen;
|
---|
390 | struct
|
---|
391 | {
|
---|
392 | HGCMFunctionParameter uHandle;
|
---|
393 | } ObjOpen;
|
---|
394 | } u;
|
---|
395 | } VBoxClipboardReplyMsg;
|
---|
396 |
|
---|
397 | #define VBOX_SHARED_CLIPBOARD_CPARMS_REPLY_MIN 5
|
---|
398 |
|
---|
399 | /**
|
---|
400 | * Reads / Writes the roots list.
|
---|
401 | */
|
---|
402 | typedef struct _VBoxClipboardRootsMsg
|
---|
403 | {
|
---|
404 | VBGLIOCHGCMCALL hdr;
|
---|
405 |
|
---|
406 | /** uint32_t, in: Context ID. Unused at the moment. */
|
---|
407 | HGCMFunctionParameter uContext;
|
---|
408 | /** uint32_t, in: Roots listing flags; unused at the moment. */
|
---|
409 | HGCMFunctionParameter fRoots;
|
---|
410 | /** uint32_t, out: Boolean indicating that more root items are following
|
---|
411 | * (via another message). */
|
---|
412 | HGCMFunctionParameter fMore;
|
---|
413 | /** uint32_t, out: Number of root items in this message. */
|
---|
414 | HGCMFunctionParameter cRoots;
|
---|
415 | /** uin32_t, out: Size (in bytes) of string list. */
|
---|
416 | HGCMFunctionParameter cbRoots;
|
---|
417 | /** pointer, out: string list (separated with CRLF) containing the root items. */
|
---|
418 | HGCMFunctionParameter pvRoots;
|
---|
419 | } VBoxClipboardRootsMsg;
|
---|
420 |
|
---|
421 | #define VBOX_SHARED_CLIPBOARD_CPARMS_ROOTS 6
|
---|
422 |
|
---|
423 | /**
|
---|
424 | * Opens a list.
|
---|
425 | */
|
---|
426 | typedef struct _VBoxClipboardListOpenMsg
|
---|
427 | {
|
---|
428 | VBGLIOCHGCMCALL hdr;
|
---|
429 |
|
---|
430 | /** uint32_t, in: Context ID. Unused at the moment. */
|
---|
431 | HGCMFunctionParameter uContext;
|
---|
432 | /** uint32_t, in: Listing flags (see VBOX_SHAREDCLIPBOARD_LIST_FLAG_XXX). */
|
---|
433 | HGCMFunctionParameter fList;
|
---|
434 | /** uint32_t, in: Size (in bytes) of the filter string. */
|
---|
435 | HGCMFunctionParameter cbFilter;
|
---|
436 | /** pointer, in: Filter string. */
|
---|
437 | HGCMFunctionParameter pvFilter;
|
---|
438 | /** uint32_t, in: Size (in bytes) of the listing path. */
|
---|
439 | HGCMFunctionParameter cbPath;
|
---|
440 | /** pointer, in: Listing poth. If empty or NULL the listing's root path will be opened. */
|
---|
441 | HGCMFunctionParameter pvPath;
|
---|
442 | /** uint64_t, out: List handle. */
|
---|
443 | HGCMFunctionParameter uHandle;
|
---|
444 | } VBoxClipboardListOpenMsg;
|
---|
445 |
|
---|
446 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_OPEN 7
|
---|
447 |
|
---|
448 | /**
|
---|
449 | * Closes a list.
|
---|
450 | */
|
---|
451 | typedef struct _VBoxClipboardListCloseMsg
|
---|
452 | {
|
---|
453 | VBGLIOCHGCMCALL hdr;
|
---|
454 |
|
---|
455 | /** uint32_t, in/out: Context ID. Unused at the moment. */
|
---|
456 | HGCMFunctionParameter uContext;
|
---|
457 | /** uint64_t, in: List handle. */
|
---|
458 | HGCMFunctionParameter uHandle;
|
---|
459 | } VBoxClipboardListCloseMsg;
|
---|
460 |
|
---|
461 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_CLOSE 2
|
---|
462 |
|
---|
463 | typedef struct _VBoxClipboardListHdrReqParms
|
---|
464 | {
|
---|
465 | /** uint32_t, in: Context ID. Unused at the moment. */
|
---|
466 | HGCMFunctionParameter uContext;
|
---|
467 | /** uint64_t, in: List handle. */
|
---|
468 | HGCMFunctionParameter uHandle;
|
---|
469 | /** uint32_t, in: Flags of type VBOX_SHAREDCLIPBOARD_LISTHDR_FLAG_XXX. */
|
---|
470 | HGCMFunctionParameter fFlags;
|
---|
471 | } VBoxClipboardListHdrReqParms;
|
---|
472 |
|
---|
473 | /**
|
---|
474 | * Request to read a list header.
|
---|
475 | */
|
---|
476 | typedef struct _VBoxClipboardListHdrReadReqMsg
|
---|
477 | {
|
---|
478 | VBGLIOCHGCMCALL hdr;
|
---|
479 |
|
---|
480 | VBoxClipboardListHdrReqParms ReqParms;
|
---|
481 | } VBoxClipboardListHdrReadReqMsg;
|
---|
482 |
|
---|
483 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR_READ_REQ 3
|
---|
484 |
|
---|
485 | /**
|
---|
486 | * Reads / Writes a list header.
|
---|
487 | */
|
---|
488 | typedef struct _VBoxClipboardListHdrMsg
|
---|
489 | {
|
---|
490 | VBGLIOCHGCMCALL hdr;
|
---|
491 |
|
---|
492 | VBoxClipboardListHdrReqParms ReqParms;
|
---|
493 | /** uint32_t, in/out: Feature flags (see VBOX_SHAREDCLIPBOARD_FEATURE_FLAG_XXX). */
|
---|
494 | HGCMFunctionParameter fFeatures;
|
---|
495 | /** uint64_t, in/out: Number of total objects to transfer. */
|
---|
496 | HGCMFunctionParameter cTotalObjects;
|
---|
497 | /** uint64_t, in/out: Number of total bytes to transfer. */
|
---|
498 | HGCMFunctionParameter cbTotalSize;
|
---|
499 | /** uint32_t, in/out: Compression type. */
|
---|
500 | HGCMFunctionParameter enmCompression;
|
---|
501 | /** uint32_t, in/out: Checksum type used for data transfer. */
|
---|
502 | HGCMFunctionParameter enmChecksumType;
|
---|
503 | } VBoxClipboardListHdrMsg;
|
---|
504 |
|
---|
505 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR 8
|
---|
506 |
|
---|
507 | typedef struct _VBoxClipboardListEntryReqParms
|
---|
508 | {
|
---|
509 | /** uint32_t, Context ID. Unused at the moment. */
|
---|
510 | HGCMFunctionParameter uContext;
|
---|
511 | /** uint64_t, in: List handle. */
|
---|
512 | HGCMFunctionParameter uHandle;
|
---|
513 | /** uint32_t, in: VBOX_SHAREDCLIPBOARD_INFO_FLAG_XXX. */
|
---|
514 | HGCMFunctionParameter fInfo;
|
---|
515 | } VBoxClipboardListEntryReqParms;
|
---|
516 |
|
---|
517 | /**
|
---|
518 | * Request to read a list entry.
|
---|
519 | */
|
---|
520 | typedef struct _VBoxClipboardListEntryReadReqMsg
|
---|
521 | {
|
---|
522 | VBGLIOCHGCMCALL hdr;
|
---|
523 |
|
---|
524 | VBoxClipboardListEntryReqParms ReqParms;
|
---|
525 | } VBoxClipboardListEntryReadReqMsg;
|
---|
526 |
|
---|
527 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY_READ_REQ 3
|
---|
528 |
|
---|
529 | /**
|
---|
530 | * Reads / Writes a list entry.
|
---|
531 | */
|
---|
532 | typedef struct _VBoxClipboardListEntryMsg
|
---|
533 | {
|
---|
534 | VBGLIOCHGCMCALL hdr;
|
---|
535 |
|
---|
536 | /** in/out: Request parameters. */
|
---|
537 | VBoxClipboardListEntryReqParms ReqParms;
|
---|
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 (SHAREDCLIPBOARDFSOBJINFO only currently).
|
---|
543 | * Do not forget to set the SHAREDCLIPBOARDFSOBJINFO::Attr::enmAdditional for Get operation as well. */
|
---|
544 | HGCMFunctionParameter pvInfo;
|
---|
545 | } VBoxClipboardListEntryMsg;
|
---|
546 |
|
---|
547 | #define VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY 6
|
---|
548 |
|
---|
549 | typedef struct _VBoxClipboardObjOpenMsg
|
---|
550 | {
|
---|
551 | VBGLIOCHGCMCALL hdr;
|
---|
552 |
|
---|
553 | /** Absoulte path of object to open/create. */
|
---|
554 | HGCMFunctionParameter cbPath;
|
---|
555 | /** Absoulte path of object to open/create. */
|
---|
556 | HGCMFunctionParameter szPath;
|
---|
557 | /** Points to SHAREDCLIPBOARDCREATEPARMS buffer. */
|
---|
558 | HGCMFunctionParameter parms;
|
---|
559 |
|
---|
560 | } VBoxClipboardObjOpenMsg;
|
---|
561 |
|
---|
562 | #define VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_OPEN 2
|
---|
563 |
|
---|
564 | typedef struct _VBoxClipboardObjCloseMsg
|
---|
565 | {
|
---|
566 | VBGLIOCHGCMCALL hdr;
|
---|
567 |
|
---|
568 | /** uint64_t, in: SHAREDCLIPBOARDOBJHANDLE of object to close. */
|
---|
569 | HGCMFunctionParameter uHandle;
|
---|
570 | } VBoxClipboardObjCloseMsg;
|
---|
571 |
|
---|
572 | #define VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_CLOSE 1
|
---|
573 |
|
---|
574 | /**
|
---|
575 | * Reads / writes data of / to an object.
|
---|
576 | *
|
---|
577 | * Used by:
|
---|
578 | * VBOX_SHARED_CLIPBOARD_FN_OBJ_READ
|
---|
579 | * VBOX_SHARED_CLIPBOARD_FN_OBJ_WRITE
|
---|
580 | */
|
---|
581 | typedef struct _VBoxClipboardObjReadWriteMsg
|
---|
582 | {
|
---|
583 | VBGLIOCHGCMCALL hdr;
|
---|
584 |
|
---|
585 | /** Context ID. Unused at the moment. */
|
---|
586 | HGCMFunctionParameter uContext; /* OUT uint32_t */
|
---|
587 | /** uint64_t, in: SHAREDCLIPBOARDOBJHANDLE of object to write to. */
|
---|
588 | HGCMFunctionParameter uHandle;
|
---|
589 | /** Size (in bytes) of current data chunk. */
|
---|
590 | HGCMFunctionParameter cbData; /* OUT uint32_t */
|
---|
591 | /** Current data chunk. */
|
---|
592 | HGCMFunctionParameter pvData; /* OUT ptr */
|
---|
593 | /** Size (in bytes) of current data chunk checksum. */
|
---|
594 | HGCMFunctionParameter cbChecksum; /* OUT uint32_t */
|
---|
595 | /** Checksum of data block, based on the checksum
|
---|
596 | * type in the data header. Optional. */
|
---|
597 | HGCMFunctionParameter pvChecksum; /* OUT ptr */
|
---|
598 | } VBoxClipboardObjReadWriteMsg;
|
---|
599 |
|
---|
600 | #define VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_READ 6
|
---|
601 | #define VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_WRITE 6
|
---|
602 |
|
---|
603 | /**
|
---|
604 | * Sends an error event.
|
---|
605 | *
|
---|
606 | * Used by:
|
---|
607 | * VBOX_SHARED_CLIPBOARD_FN_WRITE_ERROR
|
---|
608 | */
|
---|
609 | typedef struct _VBoxClipboardErrorMsg
|
---|
610 | {
|
---|
611 | VBGLIOCHGCMCALL hdr;
|
---|
612 |
|
---|
613 | /** uint32_t, in: Context ID. Unused at the moment. */
|
---|
614 | HGCMFunctionParameter uContext;
|
---|
615 | /** uint32_t, in: The error code (IPRT-style). */
|
---|
616 | HGCMFunctionParameter rc;
|
---|
617 | } VBoxClipboardWriteErrorMsg;
|
---|
618 |
|
---|
619 | #define VBOX_SHARED_CLIPBOARD_CPARMS_ERROR 2
|
---|
620 |
|
---|
621 | #pragma pack()
|
---|
622 |
|
---|
623 | typedef struct _VBOXCLIPBOARDFILEDATA
|
---|
624 | {
|
---|
625 | /** Current file data chunk. */
|
---|
626 | void *pvData;
|
---|
627 | /** Size (in bytes) of current data chunk. */
|
---|
628 | uint32_t cbData;
|
---|
629 | /** Checksum for current file data chunk. */
|
---|
630 | void *pvChecksum;
|
---|
631 | /** Size (in bytes) of current data chunk. */
|
---|
632 | uint32_t cbChecksum;
|
---|
633 | } VBOXCLIPBOARDFILEDATA, *PVBOXCLIPBOARDFILEDATA;
|
---|
634 |
|
---|
635 | typedef struct _VBOXCLIPBOARDERRORDATA
|
---|
636 | {
|
---|
637 | int32_t rc;
|
---|
638 | } VBOXCLIPBOARDERRORDATA, *PVBOXCLIPBOARDERRORDATA;
|
---|
639 |
|
---|
640 | bool VBoxSvcClipboardGetHeadless(void);
|
---|
641 | bool VBoxSvcClipboardLock(void);
|
---|
642 | void VBoxSvcClipboardUnlock(void);
|
---|
643 |
|
---|
644 | #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
|
---|
645 | int VBoxSvcClipboardURIGetListHdr(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PSHAREDCLIPBOARDLISTHANDLE phList, PVBOXCLIPBOARDLISTHDR pListHdr);
|
---|
646 | int VBoxSvcClipboardURISetListHdr(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDLISTHDR pListHdr);
|
---|
647 | int VBoxSvcClipboardURIGetListEntry(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PSHAREDCLIPBOARDLISTHANDLE phList, PVBOXCLIPBOARDLISTENTRY pListEntry);
|
---|
648 | int VBoxSvcClipboardURISetListEntry(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDLISTENTRY pListEntry);
|
---|
649 | int VBoxSvcClipboardURIGetFileData(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDFILEDATA pFileData);
|
---|
650 | int VBoxSvcClipboardURISetFileData(uint32_t cParms, VBOXHGCMSVCPARM paParms[], PVBOXCLIPBOARDFILEDATA pFileData);
|
---|
651 | #endif
|
---|
652 |
|
---|
653 | #endif /* !VBOX_INCLUDED_HostServices_VBoxClipboardSvc_h */
|
---|
654 |
|
---|