DragAndDropSvc.h revision 99f33ab590a3a65e0cd082dd8d67779efb9cc6c9
/** @file
* Drag and Drop service - Common header for host service and guest clients.
*/
/*
* Copyright (C) 2011-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#include <VBox/VBoxGuest2.h>
/*
* The mode of operations.
*/
#define VBOX_DRAG_AND_DROP_MODE_OFF 0
#define VBOX_DRAG_AND_DROP_MODE_HOST_TO_GUEST 1
#define VBOX_DRAG_AND_DROP_MODE_GUEST_TO_HOST 2
#define VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL 3
#define DND_IGNORE_ACTION UINT32_C(0)
#define DND_COPY_ACTION RT_BIT_32(0)
#define hasDnDCopyAction(a) ((a) && DND_COPY_ACTION)
#define hasDnDMoveAction(a) ((a) && DND_MOVE_ACTION)
#define hasDnDLinkAction(a) ((a) && DND_LINK_ACTION)
#define isDnDIgnoreAction(a) ((a) == DND_IGNORE_ACTION)
#define isDnDCopyAction(a) ((a) == DND_COPY_ACTION)
#define isDnDMoveAction(a) ((a) == DND_MOVE_ACTION)
#define isDnDLinkAction(a) ((a) == DND_LINK_ACTION)
/* Everything defined in this file lives in this namespace. */
/******************************************************************************
* Typedefs, constants and inlines *
******************************************************************************/
/**
* The service functions which are callable by host.
*/
enum eHostFn
{
HOST_DND_SET_MODE = 100,
/* H->G */
HOST_DND_HG_EVT_ENTER = 200,
/** Gets the actual MIME data, based on
* the format(s) specified by HOST_DND_HG_EVT_ENTER. */
/** Sent when the actual buffer for HOST_DND_HG_SND_DATA
* was too small. */
/* G->H */
HOST_DND_GH_REQ_PENDING = 300,
};
/**
* The service functions which are called by guest.
*/
enum eGuestFn
{
/**
* Guest waits for a new message the host wants to process on the guest side.
* This is a blocking call and can be deferred.
*/
GUEST_DND_GET_NEXT_HOST_MSG = 300,
/* H->G */
GUEST_DND_HG_ACK_OP = 400,
/* G->H */
GUEST_DND_GH_ACK_PENDING = 500,
};
/**
* The possible states for the progress operations.
*/
enum
{
DND_PROGRESS_RUNNING = 1,
};
#pragma pack (1)
/*
* Host events
*/
typedef struct VBOXDNDHGACTIONMSG
{
/**
* HG Action event.
*
* Used by:
* HOST_DND_HG_EVT_ENTER
* HOST_DND_HG_EVT_MOVE
* HOST_DND_HG_EVT_DROPPED
*/
typedef struct VBOXDNDHGLEAVEMSG
{
/**
* HG Leave event.
*
* Used by:
* HOST_DND_HG_EVT_LEAVE
*/
typedef struct VBOXDNDHGCANCELMSG
{
/**
* HG Cancel return event.
*
* Used by:
* HOST_DND_HG_EVT_CANCEL
*/
typedef struct VBOXDNDHGSENDDATAMSG
{
/**
* HG Send Data event.
*
* Used by:
* HOST_DND_HG_SND_DATA
*/
typedef struct VBOXDNDHGSENDMOREDATAMSG
{
/**
* HG Send More Data event.
*
* Used by:
* HOST_DND_HG_SND_MORE_DATA
*/
typedef struct VBOXDNDHGSENDDIRMSG
{
/**
* HG Directory event.
*
* Used by:
* HOST_DND_HG_SND_DIR
*/
typedef struct VBOXDNDHGSENDFILEMSG
{
/**
* HG File event.
*
* Used by:
* HOST_DND_HG_SND_FILE
*/
typedef struct VBOXDNDGHREQPENDINGMSG
{
/**
* GH Request Pending event.
*
* Used by:
* HOST_DND_GH_REQ_PENDING
*/
typedef struct VBOXDNDGHDROPPEDMSG
{
/**
* GH Dropped event.
*
* Used by:
* HOST_DND_GH_EVT_DROPPED
*/
/*
* Guest events
*/
typedef struct VBOXDNDNEXTMSGMSG
{
/**
* The returned command the host wants to
* run on the guest.
*
* Used by:
* GUEST_DND_GET_NEXT_HOST_MSG
*/
/** Number of parameters the message needs. */
typedef struct VBOXDNDHGACKOPMSG
{
/**
* HG Acknowledge Operation event.
*
* Used by:
* GUEST_DND_HG_ACK_OP
*/
typedef struct VBOXDNDHGREQDATAMSG
{
/**
* HG request for data event.
*
* Used by:
* GUEST_DND_HG_REQ_DATA
*/
typedef struct VBOXDNDGHACKPENDINGMSG
{
/**
* GH Acknowledge Pending event.
*
* Used by:
* GUEST_DND_GH_ACK_PENDING
*/
typedef struct VBOXDNDGHSENDDATAMSG
{
/**
* GH Send Data event.
*
* Used by:
* GUEST_DND_GH_SND_DATA
*/
typedef struct VBOXDNDGHEVTERRORMSG
{
/**
* GH Cancel Data event.
*
* Used by:
* GUEST_DND_GH_EVT_CANCEL
*/
#pragma pack()
/*
* Callback handler
*/
enum
{
CB_MAGIC_DND_HG_ACK_OP = 0xe2100b93,
CB_MAGIC_DND_HG_REQ_DATA = 0x5cb3faf9,
CB_MAGIC_DND_HG_EVT_PROGRESS = 0x8c8a6956,
CB_MAGIC_DND_GH_ACK_PENDING = 0xbe975a14,
CB_MAGIC_DND_GH_SND_DATA = 0x4eb61bff,
CB_MAGIC_DND_GH_EVT_ERROR = 0x117a87c4
};
typedef struct VBOXDNDCBHEADERDATA
{
/** Magic number to identify the structure. */
/** Context ID to identify callback data. */
typedef VBOXDNDCBHEADERDATA *PVBOXDNDCBHEADERDATA;
typedef struct VBOXDNDCBHGACKOPDATA
{
/** Callback data header. */
typedef VBOXDNDCBHGACKOPDATA *PVBOXDNDCBHGACKOPDATA;
typedef struct VBOXDNDCBHGREQDATADATA
{
/** Callback data header. */
char *pszFormat;
typedef struct VBOXDNDCBHGEVTPROGRESSDATA
{
/** Callback data header. */
int rc;
typedef struct VBOXDNDCBGHACKPENDINGDATA
{
/** Callback data header. */
char *pszFormat;
typedef struct VBOXDNDCBSNDDATADATA
{
/** Callback data header. */
void *pvData;
typedef VBOXDNDCBSNDDATADATA *PVBOXDNDCBSNDDATADATA;
typedef struct VBOXDNDCBEVTERRORDATA
{
/** Callback data header. */
typedef VBOXDNDCBEVTERRORDATA *PVBOXDNDCBEVTERRORDATA;
} /* namespace DragAndDropSvc */
#endif /* !___VBox_HostService_DragAndDropSvc_h */