VirtualBox

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

Last change on this file since 81451 was 81451, checked in by vboxsync, 5 years ago

Shared Clipboard/Svc: Some renaming.

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

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