VirtualBox

source: vbox/trunk/include/VBox/HostServices/DragAndDropSvc.h@ 85123

Last change on this file since 85123 was 84984, checked in by vboxsync, 4 years ago

DnD/DragAndDropSvc: Renaming to emphasize that these structs actually are classes and not POD types.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 36.4 KB
Line 
1/* $Id: DragAndDropSvc.h 84984 2020-06-29 09:47:21Z vboxsync $ */
2/** @file
3 * Drag and Drop service - Common header for host service and guest clients.
4 */
5
6/*
7 * Copyright (C) 2011-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27/**
28 * Protocol handling and notes:
29 * All client/server components should be backwards compatible.
30 *
31 ******************************************************************************
32 *
33 * Protocol changelog:
34 *
35 * Protocol v1 (VBox < 5.0, deprecated):
36 * | Initial implementation which only implemented host to guest transfers.
37 * | For file transfers all file information such as the file name and file size were
38 * transferred with every file data chunk being sent.
39 *
40 * Protocol v2 (VBox 5.0 - VBox 5.0.8, deprecated):
41 * + Added support for guest to host transfers.
42 * + Added protocol version support through VBOXDNDCONNECTMSG. The host takes the installed
43 * Guest Additions version as indicator which protocol to use for communicating with the guest.
44 * The guest itself uses VBOXDNDCONNECTMSG to report its supported protocol version to the DnD service.
45 *
46 * Protocol v3 (VBox 5.0.10 and up, current):
47 * + Added VBOXDNDDISCONNECTMSG for being able to track client disconnects on host side (Main).
48 * + Added context IDs for every HGCM message. Not used yet and must be 0.
49 * + Added VBOXDNDSNDDATAHDR and VBOXDNDCBSNDDATAHDRDATA to support (simple) accounting of objects
50 * being transferred, along with supplying separate meta data size (which is part of the total size being sent).
51 * + Added new HOST_DND_HG_SND_DATA_HDR + GUEST_DND_GH_SND_DATA_HDR commands which now allow specifying an optional
52 * compression type and defining a checksum for the overall data transfer.
53 * + Enhannced VBOXDNDGHSENDDATAMSG to support (rolling) checksums for the supplied data block.
54 * + VBOXDNDHGSENDDATAMSG and VBOXDNDGHSENDDATAMSG can now contain an optional checksum for the current data block.
55 * | VBOXDNDHGSENDFILEDATAMSG and VBOXDNDGHSENDFILEDATAMSG are now sharing the same HGCM mesasge.
56 * - Removed unused HOST_DND_GH_RECV_DIR, HOST_DND_GH_RECV_FILE_DATA and HOST_DND_GH_RECV_FILE_HDR commands.
57 *
58 * Protocol TODO:
59 *
60 * - Split up messages which use VBOXDNDHGACTIONMSG into own functions and remove parameters which
61 * are not actually needed / used by a function. Why does HOST_DND_HG_EVT_MOVE need all the format stuff, for example?
62 */
63
64#ifndef VBOX_INCLUDED_HostServices_DragAndDropSvc_h
65#define VBOX_INCLUDED_HostServices_DragAndDropSvc_h
66#ifndef RT_WITHOUT_PRAGMA_ONCE
67# pragma once
68#endif
69
70#include <VBox/hgcmsvc.h>
71#include <VBox/VMMDevCoreTypes.h>
72#include <VBox/VBoxGuestCoreTypes.h>
73
74#include <VBox/GuestHost/DragAndDropDefs.h>
75
76namespace DragAndDropSvc {
77
78/******************************************************************************
79* Typedefs, constants and inlines *
80******************************************************************************/
81
82/**
83 * The service functions which are callable by host.
84 * Note: When adding new functions to this table, make sure that the actual ID
85 * does *not* overlap with the eGuestFn enumeration below!
86 */
87enum eHostFn
88{
89 /** The host sets a new DnD mode. */
90 HOST_DND_SET_MODE = 100,
91 /** The host requests to cancel the current DnD operation on
92 * the guest side. This can happen on user request on the host's
93 * UI side or due to some host error which has happened.
94 *
95 * Note: This is a fire-and-forget message, as the host should
96 * not rely on an answer from the guest side in order to
97 * properly cancel the operation. */
98 HOST_DND_CANCEL = 204,
99
100 /*
101 * Host -> Guest messages
102 */
103
104 /** The host enters the VM window for starting an actual
105 * DnD operation. */
106 HOST_DND_HG_EVT_ENTER = 200,
107 /** The host's DnD cursor moves within the VM window. */
108 HOST_DND_HG_EVT_MOVE = 201,
109 /** The host leaves the guest VM window. */
110 HOST_DND_HG_EVT_LEAVE = 202,
111 /** The host issues a "drop" event, meaning that the host is
112 * ready to transfer data over to the guest. */
113 HOST_DND_HG_EVT_DROPPED = 203,
114 /** The host sends the data header at the beginning of a (new)
115 * data transfer. */
116 HOST_DND_HG_SND_DATA_HDR = 210,
117 /**
118 * The host sends the actual meta data, based on
119 * the format(s) specified by HOST_DND_HG_EVT_ENTER.
120 *
121 * Protocol v1/v2: If the guest supplied buffer too small to send
122 * the actual data, the host will send a HOST_DND_HG_SND_MORE_DATA
123 * message as follow-up.
124 * Protocol v3+: The incoming meta data size is specified upfront in the
125 * HOST_DND_HG_SND_DATA_HDR message and must be handled accordingly.
126 */
127 HOST_DND_HG_SND_DATA = 205,
128 /** The host sends more data in case the data did not entirely fit in
129 * the HOST_DND_HG_SND_DATA message. */
130 /** @todo Deprecated function; do not use anymore. */
131 HOST_DND_HG_SND_MORE_DATA = 206,
132 /** The host sends a directory entry to the guest. */
133 HOST_DND_HG_SND_DIR = 207,
134 /** The host sends a file data chunk to the guest. */
135 HOST_DND_HG_SND_FILE_DATA = 208,
136 /** The host sends a file header to the guest.
137 * Note: Only for protocol version 2 and up (>= VBox 5.0). */
138 HOST_DND_HG_SND_FILE_HDR = 209,
139
140 /*
141 * Guest -> Host messages
142 */
143
144 /** The host asks the guest whether a DnD operation
145 * is in progress when the mouse leaves the guest window. */
146 HOST_DND_GH_REQ_PENDING = 600,
147 /** The host informs the guest that a DnD drop operation
148 * has been started and that the host wants the data in
149 * a specific MIME type. */
150 HOST_DND_GH_EVT_DROPPED = 601,
151 /** Blow the type up to 32-bit. */
152 HOST_DND_32BIT_HACK = 0x7fffffff
153};
154
155/**
156 * The service functions which are called by guest.
157 * Note: When adding new functions to this table, make sure that the actual ID
158 * does *not* overlap with the eHostFn enumeration above!
159 */
160enum eGuestFn
161{
162 /**
163 * The guest sends a connection request to the HGCM service,
164 * along with some additional information like supported
165 * protocol version and flags.
166 * Note: New since protocol version 2. */
167 GUEST_DND_CONNECT = 10,
168
169 /** The guest client disconnects from the HGCM service. */
170 GUEST_DND_DISCONNECT = 11,
171
172 /**
173 * The guest waits for a new message the host wants to process
174 * on the guest side. This can be a blocking call.
175 */
176 GUEST_DND_GET_NEXT_HOST_MSG = 300,
177
178 /*
179 * Host -> Guest operation messages.
180 */
181
182 /** The guest acknowledges that a pending DnD operation from the host
183 * can be dropped on the currently selected area on the guest. */
184 GUEST_DND_HG_ACK_OP = 400,
185 /** The guest requests the actual DnD data to be sent from the host. */
186 GUEST_DND_HG_REQ_DATA = 401,
187 /** The guest reports back its progress back to the host. */
188 GUEST_DND_HG_EVT_PROGRESS = 402,
189
190 /*
191 * Guest -> Host operation messages.
192 */
193
194 /**
195 * The guests acknowledges that it currently has a drag'n drop
196 * operation in progress on the guest, which eventually could be
197 * dragged over to the host.
198 */
199 GUEST_DND_GH_ACK_PENDING = 500,
200 /** The guest sends the data header at the beginning of a (new)
201 * data transfer. */
202 GUEST_DND_GH_SND_DATA_HDR = 503,
203 /**
204 * The guest sends data of the requested format to the host. There can
205 * be more than one message if the actual data does not fit
206 * into one.
207 */
208 GUEST_DND_GH_SND_DATA = 501,
209 /** The guest reports an error back to the host. */
210 GUEST_DND_GH_EVT_ERROR = 502,
211 /** The guest sends a directory entry to the host. */
212 GUEST_DND_GH_SND_DIR = 700,
213 /** The guest sends file data to the host.
214 * Note: On protocol version 1 this also contains the file name
215 * and other attributes. */
216 GUEST_DND_GH_SND_FILE_DATA = 701,
217 /** The guest sends a file header to the host, marking the
218 * beginning of a (new) file transfer.
219 * Note: Available since protocol version 2 (VBox 5.0). */
220 GUEST_DND_GH_SND_FILE_HDR = 702,
221 /** Blow the type up to 32-bit. */
222 GUEST_DND_32BIT_HACK = 0x7fffffff
223};
224
225/**
226 * DnD operation progress states.
227 */
228typedef enum DNDPROGRESS
229{
230 DND_PROGRESS_UNKNOWN = 0,
231 DND_PROGRESS_RUNNING = 1,
232 DND_PROGRESS_COMPLETE,
233 DND_PROGRESS_CANCELLED,
234 DND_PROGRESS_ERROR,
235 /** Blow the type up to 32-bit. */
236 DND_PROGRESS_32BIT_HACK = 0x7fffffff
237} DNDPROGRESS, *PDNDPROGRESS;
238
239#pragma pack (1)
240
241/*
242 * Host events
243 */
244
245/**
246 * Action message for telling the guest about the currently ongoing
247 * drag and drop action when entering the guest's area, moving around in it
248 * and dropping content into it from the host.
249 *
250 * Used by:
251 * HOST_DND_HG_EVT_ENTER
252 * HOST_DND_HG_EVT_MOVE
253 * HOST_DND_HG_EVT_DROPPED
254 */
255typedef struct HGCMMsgHGAction
256{
257 VBGLIOCHGCMCALL hdr;
258
259 union
260 {
261 struct
262 {
263 HGCMFunctionParameter uScreenId; /* OUT uint32_t */
264 HGCMFunctionParameter uX; /* OUT uint32_t */
265 HGCMFunctionParameter uY; /* OUT uint32_t */
266 HGCMFunctionParameter uDefAction; /* OUT uint32_t */
267 HGCMFunctionParameter uAllActions; /* OUT uint32_t */
268 HGCMFunctionParameter pvFormats; /* OUT ptr */
269 HGCMFunctionParameter cbFormats; /* OUT uint32_t */
270 } v1;
271 struct
272 {
273 /** Context ID. */
274 HGCMFunctionParameter uContext;
275 HGCMFunctionParameter uScreenId; /* OUT uint32_t */
276 HGCMFunctionParameter uX; /* OUT uint32_t */
277 HGCMFunctionParameter uY; /* OUT uint32_t */
278 HGCMFunctionParameter uDefAction; /* OUT uint32_t */
279 HGCMFunctionParameter uAllActions; /* OUT uint32_t */
280 HGCMFunctionParameter pvFormats; /* OUT ptr */
281 HGCMFunctionParameter cbFormats; /* OUT uint32_t */
282 } v3;
283 } u;
284} HGCMMsgHGAction;
285
286/**
287 * Tells the guest that the host has left its drag and drop area on the guest.
288 *
289 * Used by:
290 * HOST_DND_HG_EVT_LEAVE
291 */
292typedef struct HGCMMsgHGLeave
293{
294 VBGLIOCHGCMCALL hdr;
295 union
296 {
297 struct
298 {
299 /** Context ID. */
300 HGCMFunctionParameter uContext;
301 } v3;
302 } u;
303} HGCMMsgHGLeave;
304
305/**
306 * Tells the guest that the host wants to cancel the current drag and drop operation.
307 *
308 * Used by:
309 * HOST_DND_HG_EVT_CANCEL
310 */
311typedef struct HGCMMsgHGCancel
312{
313 VBGLIOCHGCMCALL hdr;
314 union
315 {
316 struct
317 {
318 /** Context ID. */
319 HGCMFunctionParameter uContext;
320 } v3;
321 } u;
322} HGCMMsgHGCancel;
323
324/**
325 * Sends the header of an incoming (meta) data block.
326 *
327 * Used by:
328 * HOST_DND_HG_SND_DATA_HDR
329 * GUEST_DND_GH_SND_DATA_HDR
330 *
331 * New since protocol v3.
332 */
333typedef struct HGCMMsgHGSendDataHdr
334{
335 VBGLIOCHGCMCALL hdr;
336
337 /** Context ID. Unused at the moment. */
338 HGCMFunctionParameter uContext; /* OUT uint32_t */
339 /** Data transfer flags. Not yet used and must be 0. */
340 HGCMFunctionParameter uFlags; /* OUT uint32_t */
341 /** Screen ID where the data originates from. */
342 HGCMFunctionParameter uScreenId; /* OUT uint32_t */
343 /** Total size (in bytes) to transfer. */
344 HGCMFunctionParameter cbTotal; /* OUT uint64_t */
345 /**
346 * Total meta data size (in bytes) to transfer.
347 * This size also is part of cbTotal already, so:
348 *
349 * cbTotal = cbMeta + additional size for files etc.
350 */
351 HGCMFunctionParameter cbMeta; /* OUT uint64_t */
352 /** Meta data format. */
353 HGCMFunctionParameter pvMetaFmt; /* OUT ptr */
354 /** Size (in bytes) of meta data format. */
355 HGCMFunctionParameter cbMetaFmt; /* OUT uint32_t */
356 /* Number of objects (files/directories) to transfer. */
357 HGCMFunctionParameter cObjects; /* OUT uint64_t */
358 /** Compression type. */
359 HGCMFunctionParameter enmCompression; /* OUT uint32_t */
360 /** Checksum type. */
361 HGCMFunctionParameter enmChecksumType; /* OUT uint32_t */
362 /** Checksum buffer for the entire data to be transferred. */
363 HGCMFunctionParameter pvChecksum; /* OUT ptr */
364 /** Size (in bytes) of checksum. */
365 HGCMFunctionParameter cbChecksum; /* OUT uint32_t */
366} HGCMMsgHGSendDataHdr;
367
368/**
369 * Sends a (meta) data block to the guest.
370 *
371 * Used by:
372 * HOST_DND_HG_SND_DATA
373 */
374typedef struct HGCMMsgHGSendData
375{
376 VBGLIOCHGCMCALL hdr;
377
378 union
379 {
380 struct
381 {
382 HGCMFunctionParameter uScreenId; /* OUT uint32_t */
383 HGCMFunctionParameter pvFormat; /* OUT ptr */
384 HGCMFunctionParameter cbFormat; /* OUT uint32_t */
385 HGCMFunctionParameter pvData; /* OUT ptr */
386 HGCMFunctionParameter cbData; /* OUT uint32_t */
387 } v1;
388 /* No changes in v2. */
389 struct
390 {
391 /** Context ID. Unused at the moment. */
392 HGCMFunctionParameter uContext; /* OUT uint32_t */
393 /** Data block to send. */
394 HGCMFunctionParameter pvData; /* OUT ptr */
395 /** Size (in bytes) of data block to send. */
396 HGCMFunctionParameter cbData; /* OUT uint32_t */
397 /** Checksum of data block, based on the checksum
398 * type in the data header. Optional. */
399 HGCMFunctionParameter pvChecksum; /* OUT ptr */
400 /** Size (in bytes) of checksum to send. */
401 HGCMFunctionParameter cbChecksum; /* OUT uint32_t */
402 } v3;
403 } u;
404} HGCMMsgHGSendData;
405
406/**
407 * Sends more (meta) data in case the data didn't fit
408 * into the current XXX_DND_HG_SND_DATA message.
409 *
410 ** @todo Deprecated since protocol v3. Don't use! Will be removed.
411 *
412 * Used by:
413 * HOST_DND_HG_SND_MORE_DATA
414 */
415typedef struct HGCMMsgHGSendMoreData
416{
417 VBGLIOCHGCMCALL hdr;
418
419 HGCMFunctionParameter pvData; /* OUT ptr */
420 HGCMFunctionParameter cbData; /* OUT uint32_t */
421} HGCMMsgHGSendMoreData;
422
423/**
424 * Directory entry event.
425 *
426 * Used by:
427 * HOST_DND_HG_SND_DIR
428 * GUEST_DND_GH_SND_DIR
429 */
430typedef struct HGCMMsgHGSendDir
431{
432 VBGLIOCHGCMCALL hdr;
433
434 union
435 {
436 struct
437 {
438 /** Directory name. */
439 HGCMFunctionParameter pvName; /* OUT ptr */
440 /** Size (in bytes) of directory name. */
441 HGCMFunctionParameter cbName; /* OUT uint32_t */
442 /** Directory mode. */
443 HGCMFunctionParameter fMode; /* OUT uint32_t */
444 } v1;
445 struct
446 {
447 /** Context ID. Unused at the moment. */
448 HGCMFunctionParameter uContext; /* OUT uint32_t */
449 /** Directory name. */
450 HGCMFunctionParameter pvName; /* OUT ptr */
451 /** Size (in bytes) of directory name. */
452 HGCMFunctionParameter cbName; /* OUT uint32_t */
453 /** Directory mode. */
454 HGCMFunctionParameter fMode; /* OUT uint32_t */
455 } v3;
456 } u;
457} HGCMMsgHGSendDir;
458
459/**
460 * File header message, marking the start of transferring a new file.
461 * Note: Only for protocol version 2 and up.
462 *
463 * Used by:
464 * HOST_DND_HG_SND_FILE_HDR
465 * GUEST_DND_GH_SND_FILE_HDR
466 */
467typedef struct HGCMMsgHGSendFileHdr
468{
469 VBGLIOCHGCMCALL hdr;
470
471 /** Context ID. Unused at the moment. */
472 HGCMFunctionParameter uContext; /* OUT uint32_t */
473 /** File path. */
474 HGCMFunctionParameter pvName; /* OUT ptr */
475 /** Size (in bytes) of file path. */
476 HGCMFunctionParameter cbName; /* OUT uint32_t */
477 /** Optional flags; unused at the moment. */
478 HGCMFunctionParameter uFlags; /* OUT uint32_t */
479 /** File creation mode. */
480 HGCMFunctionParameter fMode; /* OUT uint32_t */
481 /** Total size (in bytes). */
482 HGCMFunctionParameter cbTotal; /* OUT uint64_t */
483} HGCMMsgHGSendFileHdr;
484
485/**
486 * HG: File data (chunk) event.
487 *
488 * Used by:
489 * HOST_DND_HG_SND_FILE
490 */
491typedef struct HGCMMsgHGSendFileData
492{
493 VBGLIOCHGCMCALL hdr;
494
495 union
496 {
497 /* Note: Protocol v1 sends the file name + file mode
498 * every time a file data chunk is being sent. */
499 struct
500 {
501 /** File name. */
502 HGCMFunctionParameter pvName; /* OUT ptr */
503 /** Size (in bytes) of file name. */
504 HGCMFunctionParameter cbName; /* OUT uint32_t */
505 /** Current data chunk. */
506 HGCMFunctionParameter pvData; /* OUT ptr */
507 /** Size (in bytes) of current data chunk. */
508 HGCMFunctionParameter cbData; /* OUT uint32_t */
509 /** File mode. */
510 HGCMFunctionParameter fMode; /* OUT uint32_t */
511 } v1;
512 struct
513 {
514 /** Note: pvName is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
515 /** Note: cbName is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
516 /** Context ID. Unused at the moment. */
517 HGCMFunctionParameter uContext; /* OUT uint32_t */
518 /** Current data chunk. */
519 HGCMFunctionParameter pvData; /* OUT ptr */
520 /** Size (in bytes) of current data chunk. */
521 HGCMFunctionParameter cbData; /* OUT uint32_t */
522 /** Note: fMode is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
523 } v2;
524 struct
525 {
526 /** Context ID. Unused at the moment. */
527 HGCMFunctionParameter uContext; /* OUT uint32_t */
528 /** Current data chunk. */
529 HGCMFunctionParameter pvData; /* OUT ptr */
530 /** Size (in bytes) of current data chunk. */
531 HGCMFunctionParameter cbData; /* OUT uint32_t */
532 /** Checksum of data block, based on the checksum
533 * type in the data header. Optional. */
534 HGCMFunctionParameter pvChecksum; /* OUT ptr */
535 /** Size (in bytes) of curren data chunk checksum. */
536 HGCMFunctionParameter cbChecksum; /* OUT uint32_t */
537 } v3;
538 } u;
539} HGCMMsgHGSendFileData;
540
541/**
542 * Asks the guest if a guest->host DnD operation is in progress.
543 *
544 * Used by:
545 * HOST_DND_GH_REQ_PENDING
546 */
547typedef struct HGCMMsgGHReqPending
548{
549 VBGLIOCHGCMCALL hdr;
550
551 union
552 {
553 struct
554 {
555 /** Screen ID. */
556 HGCMFunctionParameter uScreenId; /* OUT uint32_t */
557 } v1;
558 struct
559 {
560 /** Context ID. Unused at the moment. */
561 HGCMFunctionParameter uContext; /* OUT uint32_t */
562 /** Screen ID. */
563 HGCMFunctionParameter uScreenId; /* OUT uint32_t */
564 } v3;
565 } u;
566} HGCMMsgGHReqPending;
567
568/**
569 * Tells the guest that the host has dropped the ongoing guest->host
570 * DnD operation on a valid target on the host.
571 *
572 * Used by:
573 * HOST_DND_GH_EVT_DROPPED
574 */
575typedef struct HGCMMsgGHDropped
576{
577 VBGLIOCHGCMCALL hdr;
578
579 union
580 {
581 struct
582 {
583 /** Requested format for sending the data. */
584 HGCMFunctionParameter pvFormat; /* OUT ptr */
585 /** Size (in bytes) of requested format. */
586 HGCMFunctionParameter cbFormat; /* OUT uint32_t */
587 /** Drop action peformed on the host. */
588 HGCMFunctionParameter uAction; /* OUT uint32_t */
589 } v1;
590 struct
591 {
592 /** Context ID. Unused at the moment. */
593 HGCMFunctionParameter uContext; /* OUT uint32_t */
594 /** Requested format for sending the data. */
595 HGCMFunctionParameter pvFormat; /* OUT ptr */
596 /** Size (in bytes) of requested format. */
597 HGCMFunctionParameter cbFormat; /* OUT uint32_t */
598 /** Drop action peformed on the host. */
599 HGCMFunctionParameter uAction; /* OUT uint32_t */
600 } v3;
601 } u;
602} HGCMMsgGHDropped;
603
604/*
605 * Guest events
606 */
607
608/**
609 * Asks the host for the next command to process, along
610 * with the needed amount of parameters and an optional blocking
611 * flag.
612 *
613 * Used by:
614 * GUEST_DND_GET_NEXT_HOST_MSG
615 */
616typedef struct HGCMMsgGetNext
617{
618 VBGLIOCHGCMCALL hdr;
619
620 /** Message ID. */
621 HGCMFunctionParameter uMsg; /* OUT uint32_t */
622 /** Number of parameters the message needs. */
623 HGCMFunctionParameter cParms; /* OUT uint32_t */
624 /** Whether or not to block (wait) for a
625 * new message to arrive. */
626 HGCMFunctionParameter fBlock; /* OUT uint32_t */
627} HGCMMsgGetNext;
628
629/**
630 * Guest connection request. Used to tell the DnD protocol
631 * version to the (host) service.
632 *
633 * Used by:
634 * GUEST_DND_CONNECT
635 */
636typedef struct HGCMMsgConnect
637{
638 VBGLIOCHGCMCALL hdr;
639
640 union
641 {
642 struct
643 {
644 /** Protocol version to use. */
645 HGCMFunctionParameter uProtocol; /* OUT uint32_t */
646 /** Connection flags. Optional. */
647 HGCMFunctionParameter uFlags; /* OUT uint32_t */
648 } v2;
649 struct
650 {
651 /** Context ID. Unused at the moment. */
652 HGCMFunctionParameter uContext; /* OUT uint32_t */
653 /** Protocol version to use. */
654 HGCMFunctionParameter uProtocol; /* OUT uint32_t */
655 /** Connection flags. Optional. */
656 HGCMFunctionParameter uFlags; /* OUT uint32_t */
657 } v3;
658 } u;
659} HGCMMsgConnect;
660
661/**
662 * Acknowledges a host operation along with the allowed
663 * action(s) on the guest.
664 *
665 * Used by:
666 * GUEST_DND_HG_ACK_OP
667 */
668typedef struct HGCMMsgHGAck
669{
670 VBGLIOCHGCMCALL hdr;
671
672 union
673 {
674 struct
675 {
676 HGCMFunctionParameter uAction; /* OUT uint32_t */
677 } v1;
678 struct
679 {
680 /** Context ID. Unused at the moment. */
681 HGCMFunctionParameter uContext; /* OUT uint32_t */
682 HGCMFunctionParameter uAction; /* OUT uint32_t */
683 } v3;
684 } u;
685} HGCMMsgHGAck;
686
687/**
688 * Requests data to be sent to the guest.
689 *
690 * Used by:
691 * GUEST_DND_HG_REQ_DATA
692 */
693typedef struct HGCMMsgHGReqData
694{
695 VBGLIOCHGCMCALL hdr;
696
697 union
698 {
699 struct
700 {
701 HGCMFunctionParameter pvFormat; /* OUT ptr */
702 } v1;
703 struct
704 {
705 /** Context ID. Unused at the moment. */
706 HGCMFunctionParameter uContext; /* OUT uint32_t */
707 HGCMFunctionParameter pvFormat; /* OUT ptr */
708 HGCMFunctionParameter cbFormat; /* OUT uint32_t */
709 } v3;
710 } u;
711} HGCMMsgHGReqData;
712
713typedef struct HGCMMsgHGProgress
714{
715 VBGLIOCHGCMCALL hdr;
716
717 union
718 {
719 struct
720 {
721 HGCMFunctionParameter uStatus; /* OUT uint32_t */
722 HGCMFunctionParameter uPercent; /* OUT uint32_t */
723 HGCMFunctionParameter rc; /* OUT uint32_t */
724 } v1;
725 struct
726 {
727 /** Context ID. Unused at the moment. */
728 HGCMFunctionParameter uContext; /* OUT uint32_t */
729 HGCMFunctionParameter uStatus; /* OUT uint32_t */
730 HGCMFunctionParameter uPercent; /* OUT uint32_t */
731 HGCMFunctionParameter rc; /* OUT uint32_t */
732 } v3;
733 } u;
734} HGCMMsgHGProgress;
735
736/**
737 * Acknowledges a pending guest drag and drop event to the host.
738 *
739 * Used by:
740 * GUEST_DND_GH_ACK_PENDING
741 */
742typedef struct HGCMMsgGHAckPending
743{
744 VBGLIOCHGCMCALL hdr;
745
746 union
747 {
748 struct
749 {
750 HGCMFunctionParameter uDefAction; /* OUT uint32_t */
751 HGCMFunctionParameter uAllActions; /* OUT uint32_t */
752 HGCMFunctionParameter pvFormats; /* OUT ptr */
753 } v1;
754 struct
755 {
756 /** Context ID. Unused at the moment. */
757 HGCMFunctionParameter uContext; /* OUT uint32_t */
758 HGCMFunctionParameter uDefAction; /* OUT uint32_t */
759 HGCMFunctionParameter uAllActions; /* OUT uint32_t */
760 HGCMFunctionParameter pvFormats; /* OUT ptr */
761 HGCMFunctionParameter cbFormats; /* OUT uint32_t */
762 } v3;
763 } u;
764} HGCMMsgGHAckPending;
765
766/**
767 * Sends the header of an incoming data block
768 * to the host.
769 *
770 * Used by:
771 * GUEST_DND_GH_SND_DATA_HDR
772 *
773 * New since protocol v3.
774 */
775typedef struct HGCMMsgHGSendDataHdr HGCMMsgGHSendDataHdr;
776
777/**
778 * Sends a (meta) data block to the host.
779 *
780 * Used by:
781 * GUEST_DND_GH_SND_DATA
782 */
783typedef struct HGCMMsgGHSendData
784{
785 VBGLIOCHGCMCALL hdr;
786
787 union
788 {
789 struct
790 {
791 HGCMFunctionParameter pvData; /* OUT ptr */
792 /** Total bytes to send. This can be more than
793 * the data block specified in pvData above, e.g.
794 * when sending over file objects afterwards. */
795 HGCMFunctionParameter cbTotalBytes; /* OUT uint32_t */
796 } v1;
797 struct
798 {
799 /** Context ID. Unused at the moment. */
800 HGCMFunctionParameter uContext; /* OUT uint32_t */
801 /** Data block to send. */
802 HGCMFunctionParameter pvData; /* OUT ptr */
803 /** Size (in bytes) of data block to send. */
804 HGCMFunctionParameter cbData; /* OUT uint32_t */
805 /** (Rolling) Checksum, based on checksum type in data header. */
806 HGCMFunctionParameter pvChecksum; /* OUT ptr */
807 /** Size (in bytes) of checksum. */
808 HGCMFunctionParameter cbChecksum; /* OUT uint32_t */
809 } v3;
810 } u;
811} HGCMMsgGHSendData;
812
813/**
814 * Sends a directory entry to the host.
815 *
816 * Used by:
817 * GUEST_DND_GH_SND_DIR
818 */
819typedef struct HGCMMsgHGSendDir HGCMMsgGHSendDir;
820
821/**
822 * Sends a file header to the host.
823 *
824 * Used by:
825 * GUEST_DND_GH_SND_FILE_HDR
826 *
827 * New since protocol v2.
828 */
829typedef struct HGCMMsgHGSendFileHdr HGCMMsgGHSendFileHdr;
830
831/**
832 * Sends file data to the host.
833 *
834 * Used by:
835 * GUEST_DND_GH_SND_FILE_DATA
836 */
837typedef struct HGCMMsgHGSendFileData HGCMMsgGHSendFileData;
838
839/**
840 * Sends a guest error event to the host.
841 *
842 * Used by:
843 * GUEST_DND_GH_EVT_ERROR
844 */
845typedef struct HGCMMsgGHError
846{
847 VBGLIOCHGCMCALL hdr;
848
849 union
850 {
851 struct
852 {
853 HGCMFunctionParameter rc; /* OUT uint32_t */
854 } v1;
855 struct
856 {
857 /** Context ID. Unused at the moment. */
858 HGCMFunctionParameter uContext; /* OUT uint32_t */
859 HGCMFunctionParameter rc; /* OUT uint32_t */
860 } v3;
861 } u;
862} HGCMMsgGHError;
863
864#pragma pack()
865
866/** Builds a callback magic out of the function ID and the version
867 * of the callback data. */
868#define VBOX_DND_CB_MAGIC_MAKE(uFn, uVer) \
869 RT_MAKE_U32(uVer, uFn)
870
871/*
872 * Callback magics.
873 */
874enum eDnDCallbackMagics
875{
876 CB_MAGIC_DND_CONNECT = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_CONNECT, 0),
877 CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_GET_NEXT_HOST_MSG, 0),
878 CB_MAGIC_DND_HG_ACK_OP = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_HG_ACK_OP, 0),
879 CB_MAGIC_DND_HG_REQ_DATA = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_HG_REQ_DATA, 0),
880 CB_MAGIC_DND_HG_EVT_PROGRESS = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_HG_EVT_PROGRESS, 0),
881 CB_MAGIC_DND_GH_ACK_PENDING = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_GH_ACK_PENDING, 0),
882 CB_MAGIC_DND_GH_SND_DATA = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_GH_SND_DATA, 0),
883 CB_MAGIC_DND_GH_SND_DATA_HDR = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_GH_SND_DATA_HDR, 0),
884 CB_MAGIC_DND_GH_SND_DIR = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_GH_SND_DIR, 0),
885 CB_MAGIC_DND_GH_SND_FILE_HDR = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_GH_SND_FILE_HDR, 0),
886 CB_MAGIC_DND_GH_SND_FILE_DATA = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_GH_SND_FILE_DATA, 0),
887 CB_MAGIC_DND_GH_EVT_ERROR = VBOX_DND_CB_MAGIC_MAKE(GUEST_DND_GH_EVT_ERROR, 0)
888};
889
890typedef struct VBOXDNDCBHEADERDATA
891{
892 /** Magic number to identify the structure. */
893 uint32_t uMagic;
894 /** Context ID to identify callback data. */
895 uint32_t uContextID;
896} VBOXDNDCBHEADERDATA, *PVBOXDNDCBHEADERDATA;
897
898typedef struct VBOXDNDCBCONNECTMSGDATA
899{
900 /** Callback data header. */
901 VBOXDNDCBHEADERDATA hdr;
902 uint32_t uProtocol;
903 uint32_t uFlags;
904} VBOXDNDCBCONNECTMSGDATA, *PVBOXDNDCBCONNECTMSGDATA;
905
906typedef struct VBOXDNDCBDISCONNECTMSGDATA
907{
908 /** Callback data header. */
909 VBOXDNDCBHEADERDATA hdr;
910} VBOXDNDCBDISCONNECTMSGDATA, *PVBOXDNDCBDISCONNECTMSGDATA;
911
912typedef struct VBOXDNDCBHGGETNEXTHOSTMSG
913{
914 /** Callback data header. */
915 VBOXDNDCBHEADERDATA hdr;
916 uint32_t uMsg;
917 uint32_t cParms;
918} VBOXDNDCBHGGETNEXTHOSTMSG, *PVBOXDNDCBHGGETNEXTHOSTMSG;
919
920typedef struct VBOXDNDCBHGGETNEXTHOSTMSGDATA
921{
922 /** Callback data header. */
923 VBOXDNDCBHEADERDATA hdr;
924 uint32_t uMsg;
925 uint32_t cParms;
926 PVBOXHGCMSVCPARM paParms;
927} VBOXDNDCBHGGETNEXTHOSTMSGDATA, *PVBOXDNDCBHGGETNEXTHOSTMSGDATA;
928
929typedef struct VBOXDNDCBHGACKOPDATA
930{
931 /** Callback data header. */
932 VBOXDNDCBHEADERDATA hdr;
933 uint32_t uAction;
934} VBOXDNDCBHGACKOPDATA, *PVBOXDNDCBHGACKOPDATA;
935
936typedef struct VBOXDNDCBHGREQDATADATA
937{
938 /** Callback data header. */
939 VBOXDNDCBHEADERDATA hdr;
940 char *pszFormat;
941 uint32_t cbFormat;
942} VBOXDNDCBHGREQDATADATA, *PVBOXDNDCBHGREQDATADATA;
943
944typedef struct VBOXDNDCBHGEVTPROGRESSDATA
945{
946 /** Callback data header. */
947 VBOXDNDCBHEADERDATA hdr;
948 uint32_t uPercentage;
949 uint32_t uStatus;
950 uint32_t rc;
951} VBOXDNDCBHGEVTPROGRESSDATA, *PVBOXDNDCBHGEVTPROGRESSDATA;
952
953typedef struct VBOXDNDCBGHACKPENDINGDATA
954{
955 /** Callback data header. */
956 VBOXDNDCBHEADERDATA hdr;
957 uint32_t uDefAction;
958 uint32_t uAllActions;
959 char *pszFormat;
960 uint32_t cbFormat;
961} VBOXDNDCBGHACKPENDINGDATA, *PVBOXDNDCBGHACKPENDINGDATA;
962
963/**
964 * Data header.
965 * New since protocol v3.
966 */
967typedef struct VBOXDNDDATAHDR
968{
969 /** Data transfer flags. Not yet used and must be 0. */
970 uint32_t uFlags;
971 /** Screen ID where the data originates from. */
972 uint32_t uScreenId;
973 /** Total size (in bytes) to transfer. */
974 uint64_t cbTotal;
975 /** Meta data size (in bytes) to transfer.
976 * This size also is part of cbTotal already. */
977 uint32_t cbMeta;
978 /** Meta format buffer. */
979 void *pvMetaFmt;
980 /** Size (in bytes) of meta format buffer. */
981 uint32_t cbMetaFmt;
982 /** Number of objects (files/directories) to transfer. */
983 uint64_t cObjects;
984 /** Compression type. Currently unused, so specify 0.
985 **@todo Add IPRT compression type enumeration as soon as it's available. */
986 uint32_t enmCompression;
987 /** Checksum type. Currently unused, so specify RTDIGESTTYPE_INVALID. */
988 RTDIGESTTYPE enmChecksumType;
989 /** The actual checksum buffer for the entire data to be transferred,
990 * based on enmChksumType. If RTDIGESTTYPE_INVALID is specified,
991 * no checksum is being used and pvChecksum will be NULL. */
992 void *pvChecksum;
993 /** Size (in bytes) of checksum. */
994 uint32_t cbChecksum;
995} VBOXDNDDATAHDR, *PVBOXDNDSNDDATAHDR;
996
997/* New since protocol v3. */
998typedef struct VBOXDNDCBSNDDATAHDRDATA
999{
1000 /** Callback data header. */
1001 VBOXDNDCBHEADERDATA hdr;
1002 /** Actual header data. */
1003 VBOXDNDDATAHDR data;
1004} VBOXDNDCBSNDDATAHDRDATA, *PVBOXDNDCBSNDDATAHDRDATA;
1005
1006typedef struct VBOXDNDSNDDATA
1007{
1008 union
1009 {
1010 struct
1011 {
1012 /** Data block buffer. */
1013 void *pvData;
1014 /** Size (in bytes) of data block. */
1015 uint32_t cbData;
1016 /** Total metadata size (in bytes). This is transmitted
1017 * with every message because the size can change. */
1018 uint32_t cbTotalSize;
1019 } v1;
1020 /* Protocol v2: No changes. */
1021 struct
1022 {
1023 /** Data block buffer. */
1024 void *pvData;
1025 /** Size (in bytes) of data block. */
1026 uint32_t cbData;
1027 /** (Rolling) Checksum. Not yet implemented. */
1028 void *pvChecksum;
1029 /** Size (in bytes) of checksum. Not yet implemented. */
1030 uint32_t cbChecksum;
1031 } v3;
1032 } u;
1033} VBOXDNDSNDDATA, *PVBOXDNDSNDDATA;
1034
1035typedef struct VBOXDNDCBSNDDATADATA
1036{
1037 /** Callback data header. */
1038 VBOXDNDCBHEADERDATA hdr;
1039 /** Actual data. */
1040 VBOXDNDSNDDATA data;
1041} VBOXDNDCBSNDDATADATA, *PVBOXDNDCBSNDDATADATA;
1042
1043typedef struct VBOXDNDCBSNDDIRDATA
1044{
1045 /** Callback data header. */
1046 VBOXDNDCBHEADERDATA hdr;
1047 /** Directory path. */
1048 char *pszPath;
1049 /** Size (in bytes) of path. */
1050 uint32_t cbPath;
1051 /** Directory creation mode. */
1052 uint32_t fMode;
1053} VBOXDNDCBSNDDIRDATA, *PVBOXDNDCBSNDDIRDATA;
1054
1055/* Note: Only for protocol version 2 and up (>= VBox 5.0). */
1056typedef struct VBOXDNDCBSNDFILEHDRDATA
1057{
1058 /** Callback data header. */
1059 VBOXDNDCBHEADERDATA hdr;
1060 /** File path (name). */
1061 char *pszFilePath;
1062 /** Size (in bytes) of file path. */
1063 uint32_t cbFilePath;
1064 /** Total size (in bytes) of this file. */
1065 uint64_t cbSize;
1066 /** File (creation) mode. */
1067 uint32_t fMode;
1068 /** Additional flags. Not used at the moment. */
1069 uint32_t fFlags;
1070} VBOXDNDCBSNDFILEHDRDATA, *PVBOXDNDCBSNDFILEHDRDATA;
1071
1072typedef struct VBOXDNDCBSNDFILEDATADATA
1073{
1074 /** Callback data header. */
1075 VBOXDNDCBHEADERDATA hdr;
1076 /** Current file data chunk. */
1077 void *pvData;
1078 /** Size (in bytes) of current data chunk. */
1079 uint32_t cbData;
1080 union
1081 {
1082 struct
1083 {
1084 /** File path (name). */
1085 char *pszFilePath;
1086 /** Size (in bytes) of file path. */
1087 uint32_t cbFilePath;
1088 /** File (creation) mode. */
1089 uint32_t fMode;
1090 } v1;
1091 /* Protocol v2 + v3: Have the file attributes (name, size, mode, ...)
1092 in the VBOXDNDCBSNDFILEHDRDATA structure. */
1093 struct
1094 {
1095 /** Checksum for current file data chunk. */
1096 void *pvChecksum;
1097 /** Size (in bytes) of current data chunk. */
1098 uint32_t cbChecksum;
1099 } v3;
1100 } u;
1101} VBOXDNDCBSNDFILEDATADATA, *PVBOXDNDCBSNDFILEDATADATA;
1102
1103typedef struct VBOXDNDCBEVTERRORDATA
1104{
1105 /** Callback data header. */
1106 VBOXDNDCBHEADERDATA hdr;
1107 int32_t rc;
1108} VBOXDNDCBEVTERRORDATA, *PVBOXDNDCBEVTERRORDATA;
1109
1110} /* namespace DragAndDropSvc */
1111
1112#endif /* !VBOX_INCLUDED_HostServices_DragAndDropSvc_h */
1113
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