VirtualBox

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

Last change on this file since 52664 was 51557, checked in by vboxsync, 10 years ago

Build fix; forgotten to commit those files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.8 KB
Line 
1/** @file
2 * Drag and Drop service - Common header for host service and guest clients.
3 */
4
5/*
6 * Copyright (C) 2011-2014 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_HostService_DragAndDropSvc_h
27#define ___VBox_HostService_DragAndDropSvc_h
28
29#include <VBox/VMMDev.h>
30#include <VBox/VBoxGuest2.h>
31
32/*
33 * The mode of operations.
34 */
35#define VBOX_DRAG_AND_DROP_MODE_OFF 0
36#define VBOX_DRAG_AND_DROP_MODE_HOST_TO_GUEST 1
37#define VBOX_DRAG_AND_DROP_MODE_GUEST_TO_HOST 2
38#define VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL 3
39
40#define DND_IGNORE_ACTION UINT32_C(0)
41#define DND_COPY_ACTION RT_BIT_32(0)
42#define DND_MOVE_ACTION RT_BIT_32(1)
43#define DND_LINK_ACTION RT_BIT_32(2)
44
45#define hasDnDCopyAction(a) ((a) && DND_COPY_ACTION)
46#define hasDnDMoveAction(a) ((a) && DND_MOVE_ACTION)
47#define hasDnDLinkAction(a) ((a) && DND_LINK_ACTION)
48
49#define isDnDIgnoreAction(a) ((a) == DND_IGNORE_ACTION)
50#define isDnDCopyAction(a) ((a) == DND_COPY_ACTION)
51#define isDnDMoveAction(a) ((a) == DND_MOVE_ACTION)
52#define isDnDLinkAction(a) ((a) == DND_LINK_ACTION)
53
54/** @def VBOX_DND_FORMATS_DEFAULT
55 * Default drag'n drop formats.
56 * Note: If you add new entries here, make sure you test those
57 * with all supported guest OSes!
58 */
59#define VBOX_DND_FORMATS_DEFAULT \
60 "text/uri-list", \
61 /* Text. */ \
62 "text/html", \
63 "text/plain;charset=utf-8", \
64 "text/plain;charset=utf-16", \
65 "text/plain", \
66 "text/richtext", \
67 "UTF8_STRING", \
68 "TEXT", \
69 "STRING", \
70 /* OpenOffice formats. */ \
71 /* See: https://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Common_Application_Features#OpenOffice.org_Clipboard_Data_Formats */ \
72 "application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"" \
73 "application/x-openoffice;windows_formatname=\"Bitmap\""
74
75namespace DragAndDropSvc {
76
77/******************************************************************************
78* Typedefs, constants and inlines *
79******************************************************************************/
80
81/**
82 * The service functions which are callable by host.
83 * Note: When adding new functions to this table, make sure that the actual ID
84 * does *not* overlap with the eGuestFn enumeration below!
85 */
86enum eHostFn
87{
88 HOST_DND_SET_MODE = 100,
89
90 /*
91 * Host -> Guest messages
92 */
93
94 HOST_DND_HG_EVT_ENTER = 200,
95 HOST_DND_HG_EVT_MOVE = 201,
96 HOST_DND_HG_EVT_LEAVE = 202,
97 HOST_DND_HG_EVT_DROPPED = 203,
98 HOST_DND_HG_EVT_CANCEL = 204,
99 /** Gets the actual MIME data, based on
100 * the format(s) specified by HOST_DND_HG_EVT_ENTER. */
101 HOST_DND_HG_SND_DATA = 205,
102 /** Sent when the actual buffer for HOST_DND_HG_SND_DATA
103 * was too small, issued by the DnD host service. */
104 HOST_DND_HG_SND_MORE_DATA = 206,
105 /** Directory entry to be handled on the guest. */
106 HOST_DND_HG_SND_DIR = 207,
107 /** File entry to be handled on the guest. */
108 HOST_DND_HG_SND_FILE = 208,
109
110 /*
111 * Guest -> Host messages
112 */
113
114 /** The host asks the guest whether a DnD operation
115 * is in progress when the mouse leaves the guest window. */
116 HOST_DND_GH_REQ_PENDING = 600,
117 /** The host informs the guest that a DnD drop operation
118 * has been started and that the host wants the data in
119 * a specific MIME type. */
120 HOST_DND_GH_EVT_DROPPED,
121
122 HOST_DND_GH_RECV_DIR = 650,
123 HOST_DND_GH_RECV_FILE = 670
124};
125
126/**
127 * The service functions which are called by guest.
128 * Note: When adding new functions to this table, make sure that the actual ID
129 * does *not* overlap with the eGuestFn enumeration above!
130 */
131enum eGuestFn
132{
133 /**
134 * Guest waits for a new message the host wants to process
135 * on the guest side. This can be a blocking call.
136 */
137 GUEST_DND_GET_NEXT_HOST_MSG = 300,
138
139 /* H->G */
140 /** The guest acknowledges that the pending DnD data from
141 * the host can be dropped on the currently selected source
142 * on the guest. */
143 GUEST_DND_HG_ACK_OP = 400,
144 /** The guest requests the actual DnD data to be sent
145 * from the host. */
146 GUEST_DND_HG_REQ_DATA = 401,
147 GUEST_DND_HG_EVT_PROGRESS = 402,
148
149 /* G->H */
150 /**
151 * The guests acknowledges that it currently has a drag'n drop
152 * operation in progress on the guest, which eventually could be
153 * dragged over to the host.
154 */
155 GUEST_DND_GH_ACK_PENDING = 500,
156 /**
157 * Sends data of the requested format to the host. There can
158 * be more than one message if the actual data does not fit
159 * into one.
160 */
161 GUEST_DND_GH_SND_DATA = 501,
162 GUEST_DND_GH_EVT_ERROR = 502,
163
164 GUEST_DND_GH_SND_DIR = 700,
165 GUEST_DND_GH_SND_FILE = 701
166};
167
168/**
169 * The possible states for the progress operations.
170 */
171enum
172{
173 DND_PROGRESS_RUNNING = 1,
174 DND_PROGRESS_COMPLETE,
175 DND_PROGRESS_CANCELLED,
176 DND_PROGRESS_ERROR
177};
178
179#pragma pack (1)
180
181/*
182 * Host events
183 */
184
185typedef struct VBOXDNDHGACTIONMSG
186{
187 VBoxGuestHGCMCallInfo hdr;
188
189 /**
190 * HG Action event.
191 *
192 * Used by:
193 * HOST_DND_HG_EVT_ENTER
194 * HOST_DND_HG_EVT_MOVE
195 * HOST_DND_HG_EVT_DROPPED
196 */
197 HGCMFunctionParameter uScreenId; /* OUT uint32_t */
198 HGCMFunctionParameter uX; /* OUT uint32_t */
199 HGCMFunctionParameter uY; /* OUT uint32_t */
200 HGCMFunctionParameter uDefAction; /* OUT uint32_t */
201 HGCMFunctionParameter uAllActions; /* OUT uint32_t */
202 HGCMFunctionParameter pvFormats; /* OUT ptr */
203 HGCMFunctionParameter cFormats; /* OUT uint32_t */
204} VBOXDNDHGACTIONMSG;
205
206typedef struct VBOXDNDHGLEAVEMSG
207{
208 VBoxGuestHGCMCallInfo hdr;
209 /**
210 * HG Leave event.
211 *
212 * Used by:
213 * HOST_DND_HG_EVT_LEAVE
214 */
215} VBOXDNDHGLEAVEMSG;
216
217typedef struct VBOXDNDHGCANCELMSG
218{
219 VBoxGuestHGCMCallInfo hdr;
220
221 /**
222 * HG Cancel return event.
223 *
224 * Used by:
225 * HOST_DND_HG_EVT_CANCEL
226 */
227} VBOXDNDHGCANCELMSG;
228
229typedef struct VBOXDNDHGSENDDATAMSG
230{
231 VBoxGuestHGCMCallInfo hdr;
232
233 /**
234 * HG Send Data event.
235 *
236 * Used by:
237 * HOST_DND_HG_SND_DATA
238 */
239 HGCMFunctionParameter uScreenId; /* OUT uint32_t */
240 HGCMFunctionParameter pvFormat; /* OUT ptr */
241 HGCMFunctionParameter cFormat; /* OUT uint32_t */
242 HGCMFunctionParameter pvData; /* OUT ptr */
243 HGCMFunctionParameter cbData; /* OUT uint32_t */
244} VBOXDNDHGSENDDATAMSG;
245
246typedef struct VBOXDNDHGSENDMOREDATAMSG
247{
248 VBoxGuestHGCMCallInfo hdr;
249
250 /**
251 * HG Send More Data event.
252 *
253 * Used by:
254 * HOST_DND_HG_SND_MORE_DATA
255 */
256 HGCMFunctionParameter pvData; /* OUT ptr */
257 HGCMFunctionParameter cbData; /* OUT uint32_t */
258} VBOXDNDHGSENDMOREDATAMSG;
259
260typedef struct VBOXDNDHGSENDDIRMSG
261{
262 VBoxGuestHGCMCallInfo hdr;
263
264 /**
265 * HG Directory event.
266 *
267 * Used by:
268 * HOST_DND_HG_SND_DIR
269 */
270 HGCMFunctionParameter pvName; /* OUT ptr */
271 HGCMFunctionParameter cbName; /* OUT uint32_t */
272 HGCMFunctionParameter fMode; /* OUT uint32_t */
273} VBOXDNDHGSENDDIRMSG;
274
275typedef struct VBOXDNDHGSENDFILEMSG
276{
277 VBoxGuestHGCMCallInfo hdr;
278
279 /**
280 * HG File event.
281 *
282 * Used by:
283 * HOST_DND_HG_SND_FILE
284 */
285 HGCMFunctionParameter pvName; /* OUT ptr */
286 HGCMFunctionParameter cbName; /* OUT uint32_t */
287 HGCMFunctionParameter pvData; /* OUT ptr */
288 HGCMFunctionParameter cbData; /* OUT uint32_t */
289 HGCMFunctionParameter fMode; /* OUT uint32_t */
290} VBOXDNDHGSENDFILEMSG;
291
292typedef struct VBOXDNDGHREQPENDINGMSG
293{
294 VBoxGuestHGCMCallInfo hdr;
295
296 /**
297 * GH Request Pending event.
298 *
299 * Used by:
300 * HOST_DND_GH_REQ_PENDING
301 */
302 HGCMFunctionParameter uScreenId; /* OUT uint32_t */
303} VBOXDNDGHREQPENDINGMSG;
304
305typedef struct VBOXDNDGHDROPPEDMSG
306{
307 VBoxGuestHGCMCallInfo hdr;
308
309 /**
310 * GH Dropped event.
311 *
312 * Used by:
313 * HOST_DND_GH_EVT_DROPPED
314 */
315 HGCMFunctionParameter pvFormat; /* OUT ptr */
316 HGCMFunctionParameter cFormat; /* OUT uint32_t */
317 HGCMFunctionParameter uAction; /* OUT uint32_t */
318} VBOXDNDGHDROPPEDMSG;
319
320/*
321 * Guest events
322 */
323
324typedef struct VBOXDNDNEXTMSGMSG
325{
326 VBoxGuestHGCMCallInfo hdr;
327
328 /**
329 * The returned command the host wants to
330 * run on the guest.
331 *
332 * Used by:
333 * GUEST_DND_GET_NEXT_HOST_MSG
334 */
335 HGCMFunctionParameter msg; /* OUT uint32_t */
336 /** Number of parameters the message needs. */
337 HGCMFunctionParameter num_parms; /* OUT uint32_t */
338 /** Whether or not to block (wait) for a
339 * new message to arrive. */
340 HGCMFunctionParameter block; /* OUT uint32_t */
341
342} VBOXDNDNEXTMSGMSG;
343
344typedef struct VBOXDNDHGACKOPMSG
345{
346 VBoxGuestHGCMCallInfo hdr;
347
348 /**
349 * HG Acknowledge Operation event.
350 *
351 * Used by:
352 * GUEST_DND_HG_ACK_OP
353 */
354 HGCMFunctionParameter uAction; /* OUT uint32_t */
355} VBOXDNDHGACKOPMSG;
356
357typedef struct VBOXDNDHGREQDATAMSG
358{
359 VBoxGuestHGCMCallInfo hdr;
360
361 /**
362 * HG request for data event.
363 *
364 * Used by:
365 * GUEST_DND_HG_REQ_DATA
366 */
367 HGCMFunctionParameter pFormat; /* OUT ptr */
368} VBOXDNDHGREQDATAMSG;
369
370typedef struct VBOXDNDGHACKPENDINGMSG
371{
372 VBoxGuestHGCMCallInfo hdr;
373
374 /**
375 * GH Acknowledge Pending event.
376 *
377 * Used by:
378 * GUEST_DND_GH_ACK_PENDING
379 */
380 HGCMFunctionParameter uDefAction; /* OUT uint32_t */
381 HGCMFunctionParameter uAllActions; /* OUT uint32_t */
382 HGCMFunctionParameter pFormat; /* OUT ptr */
383} VBOXDNDGHACKPENDINGMSG;
384
385typedef struct VBOXDNDGHSENDDATAMSG
386{
387 VBoxGuestHGCMCallInfo hdr;
388
389 /**
390 * GH Send Data event.
391 *
392 * Used by:
393 * GUEST_DND_GH_SND_DATA
394 */
395 HGCMFunctionParameter pvData; /* OUT ptr */
396 /** Total bytes to send. This can be more than
397 * the data block specified in pvData above, e.g.
398 * when sending over file objects afterwards. */
399 HGCMFunctionParameter cbTotalBytes; /* OUT uint32_t */
400} VBOXDNDGHSENDDATAMSG;
401
402typedef struct VBOXDNDGHSENDDIRMSG
403{
404 VBoxGuestHGCMCallInfo hdr;
405
406 /**
407 * GH Directory event.
408 *
409 * Used by:
410 * GUEST_DND_HG_SND_DIR
411 */
412 HGCMFunctionParameter pvName; /* OUT ptr */
413 HGCMFunctionParameter cbName; /* OUT uint32_t */
414 HGCMFunctionParameter fMode; /* OUT uint32_t */
415} VBOXDNDGHSENDDIRMSG;
416
417typedef struct VBOXDNDGHSENDFILEMSG
418{
419 VBoxGuestHGCMCallInfo hdr;
420
421 /**
422 * GH File event.
423 *
424 * Used by:
425 * GUEST_DND_HG_SND_FILE
426 */
427 HGCMFunctionParameter pvName; /* OUT ptr */
428 HGCMFunctionParameter cbName; /* OUT uint32_t */
429 HGCMFunctionParameter pvData; /* OUT ptr */
430 HGCMFunctionParameter cbData; /* OUT uint32_t */
431 HGCMFunctionParameter fMode; /* OUT uint32_t */
432} VBOXDNDGHSENDFILEMSG;
433
434typedef struct VBOXDNDGHEVTERRORMSG
435{
436 VBoxGuestHGCMCallInfo hdr;
437
438 /**
439 * GH Error event.
440 *
441 * Used by:
442 * GUEST_DND_GH_EVT_ERROR
443 */
444 HGCMFunctionParameter uRC; /* OUT uint32_t */
445} VBOXDNDGHEVTERRORMSG;
446
447#pragma pack()
448
449/*
450 * Callback data magics.
451 */
452enum
453{
454 CB_MAGIC_DND_HG_ACK_OP = 0xe2100b93,
455 CB_MAGIC_DND_HG_REQ_DATA = 0x5cb3faf9,
456 CB_MAGIC_DND_HG_EVT_PROGRESS = 0x8c8a6956,
457 CB_MAGIC_DND_GH_ACK_PENDING = 0xbe975a14,
458 CB_MAGIC_DND_GH_SND_DATA = 0x4eb61bff,
459 CB_MAGIC_DND_GH_SND_DIR = 0x411ca754,
460 CB_MAGIC_DND_GH_SND_FILE = 0x65e35eaf,
461 CB_MAGIC_DND_GH_EVT_ERROR = 0x117a87c4
462};
463
464typedef struct VBOXDNDCBHEADERDATA
465{
466 /** Magic number to identify the structure. */
467 uint32_t u32Magic;
468 /** Context ID to identify callback data. */
469 uint32_t u32ContextID;
470} VBOXDNDCBHEADERDATA;
471typedef VBOXDNDCBHEADERDATA *PVBOXDNDCBHEADERDATA;
472
473typedef struct VBOXDNDCBHGACKOPDATA
474{
475 /** Callback data header. */
476 VBOXDNDCBHEADERDATA hdr;
477 uint32_t uAction;
478} VBOXDNDCBHGACKOPDATA;
479typedef VBOXDNDCBHGACKOPDATA *PVBOXDNDCBHGACKOPDATA;
480
481typedef struct VBOXDNDCBHGREQDATADATA
482{
483 /** Callback data header. */
484 VBOXDNDCBHEADERDATA hdr;
485 char *pszFormat;
486} VBOXDNDCBHGREQDATADATA;
487typedef VBOXDNDCBHGREQDATADATA *PVBOXDNDCBHGREQDATADATA;
488
489typedef struct VBOXDNDCBHGEVTPROGRESSDATA
490{
491 /** Callback data header. */
492 VBOXDNDCBHEADERDATA hdr;
493 uint32_t uPercentage;
494 uint32_t uState;
495 int rc;
496} VBOXDNDCBHGEVTPROGRESSDATA;
497typedef VBOXDNDCBHGEVTPROGRESSDATA *PVBOXDNDCBHGEVTPROGRESSDATA;
498
499typedef struct VBOXDNDCBGHACKPENDINGDATA
500{
501 /** Callback data header. */
502 VBOXDNDCBHEADERDATA hdr;
503 uint32_t uDefAction;
504 uint32_t uAllActions;
505 char *pszFormat;
506} VBOXDNDCBGHACKPENDINGDATA;
507typedef VBOXDNDCBGHACKPENDINGDATA *PVBOXDNDCBGHACKPENDINGDATA;
508
509typedef struct VBOXDNDCBSNDDATADATA
510{
511 /** Callback data header. */
512 VBOXDNDCBHEADERDATA hdr;
513 void *pvData;
514 uint32_t cbData;
515 /** Total metadata size (in bytes). This is transmitted
516 * with every message because the size can change. */
517 uint32_t cbTotalSize;
518} VBOXDNDCBSNDDATADATA;
519typedef VBOXDNDCBSNDDATADATA *PVBOXDNDCBSNDDATADATA;
520
521typedef struct VBOXDNDCBSNDDIRDATA
522{
523 /** Callback data header. */
524 VBOXDNDCBHEADERDATA hdr;
525 char *pszPath;
526 uint32_t cbPath;
527 uint32_t fMode;
528} VBOXDNDCBSNDDIRDATA;
529typedef VBOXDNDCBSNDDIRDATA *PVBOXDNDCBSNDDIRDATA;
530
531typedef struct VBOXDNDCBSNDFILEDATA
532{
533 /** Callback data header. */
534 VBOXDNDCBHEADERDATA hdr;
535 char *pszFilePath;
536 uint32_t cbFilePath;
537 uint32_t fMode;
538 void *pvData;
539 uint32_t cbData;
540} VBOXDNDCBSNDFILEDATA;
541typedef VBOXDNDCBSNDFILEDATA *PVBOXDNDCBSNDFILEDATA;
542
543typedef struct VBOXDNDCBEVTERRORDATA
544{
545 /** Callback data header. */
546 VBOXDNDCBHEADERDATA hdr;
547 int32_t rc;
548} VBOXDNDCBEVTERRORDATA;
549typedef VBOXDNDCBEVTERRORDATA *PVBOXDNDCBEVTERRORDATA;
550
551} /* namespace DragAndDropSvc */
552
553#endif /* !___VBox_HostService_DragAndDropSvc_h */
554
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