1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
/*********************************************************
* Copyright (C) 2007 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 2.1 and no later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
*********************************************************/
/*
* dndMsg.h --
*
* DnDMsg represents an rpc message which is sent across the
* wire. Any args that it holds will be written out exactly as stored.
*/
#ifndef _DNDMSG_H_
#define _DNDMSG_H_
#define INCLUDE_ALLOW_USERLEVEL
#include "includeCheck.h"
#include "vm_basic_types.h"
#include "dynbuf.h"
#include "dynarray.h"
#include "dnd.h"
/* Various return types serialization/unserialization functions can return. */
typedef enum {
DNDMSG_SUCCESS = 0,
DNDMSG_ERR,
DNDMSG_NOMEM,
DNDMSG_INPUT_TOO_SMALL, /* Input buffer needs to be bigger. */
DNDMSG_INPUT_ERR, /* Serialize/unserialized failed sanity checks. */
} DnDMsgErr;
/*
* DnD Commands.
*/
typedef enum {
DND_INVALID = 0,
/*
* We need to send mouse packets for old protocols because old guest tools
* manipulate the mouse directly, but in DnD Version 3+, the host controls the
* mouse pointer via foundry.
*/
/* DnD Ver 1/2 Commands */
DND_HG_SEND_MOUSE_PACKET,
/* DnD version 3 commands */
// GHDnD (h->g)
DND_GH_QUERY_PENDING_DRAG,
DND_GH_CANCEL,
DND_GH_COPY_DONE,
// GHDnD (g->h)
DND_GH_DRAG_ENTER,
DND_GH_NOT_PENDING,
// HGDnD (h->g)
DND_HG_DRAG_ENTER,
DND_HG_DRAG_START,
DND_HG_CANCEL,
DND_HG_DROP,
DND_HG_FILE_COPY_DONE,
// HGDnD (g->h)
DND_HG_DRAG_ENTER_DONE,
DND_HG_DRAG_READY,
DND_HG_UPDATE_FEEDBACK,
DND_HG_DROP_DONE,
DND_HG_START_FILE_COPY,
// Add future commands here.
DND_GH_UPDATE_UNITY_DET_WND,
// New command after DnD version 3.1
DND_UPDATE_HOST_VERSION,
DND_UPDATE_GUEST_VERSION,
DND_UPDATE_MOUSE,
DND_GH_PRIVATE_DROP,
DND_GH_TRANSPORT_TEST,
DND_MOVE_DET_WND_TO_MOUSE_POS,
DND_MAX,
} DnDCommand;
/*
* Copy/Paste commands.
*/
typedef enum {
CP_INVALID = 0,
/* DnD version 3 commands. */
// GHCopyPaste (h->g)
CP_GH_GET_CLIPBOARD,
// GHCopyPaste (g->h)
CP_GH_GET_CLIPBOARD_DONE, // FORMAT DATA(property list?)
// HGCopyPaste (h->g)
CP_HG_SET_CLIPBOARD,
CP_HG_FILE_COPY_DONE,
// HGCopyPaste(g->h)
CP_HG_START_FILE_COPY,
// Add future commands here.
CP_GH_TRANSPORT_TEST,
CP_MAX,
} CopyPasteCommand;
/*
* Opaque data structure.
* Members are listed in order of unserialization.
*/
typedef struct DnDMsg {
/* Header */
uint8 ver; // Must be first across all versions.
uint32 cmd;
uint32 nargs;
/* The expected size of the buffer needed to unserialize the arguments. */
uint32 expectedArgsSz;
/* Body */
DynBufArray args;
} DnDMsg;
#define DnDMsg_Success(x) ((x) == DNDMSG_SUCCESS)
void DnDMsg_Init(DnDMsg *msg);
void DnDMsg_Destroy(DnDMsg *msg);
/* Header information. */
uint32 DnDMsg_GetCmd(DnDMsg *msg);
void DnDMsg_SetCmd(DnDMsg *msg, uint32 cmd);
uint32 DnDMsg_NumArgs(DnDMsg *msg);
DynBuf *DnDMsg_GetArg(DnDMsg *msg, uint32 arg);
Bool DnDMsg_AppendArg(DnDMsg *msg, void *buf, size_t len);
Bool DnDMsg_Serialize(DnDMsg *msg, DynBuf *buf);
DnDMsgErr DnDMsg_UnserializeHeader(DnDMsg *msg, void *buf, size_t len);
DnDMsgErr DnDMsg_UnserializeArgs(DnDMsg *msg, void *buf, size_t len);
#endif /* _DNDMSG_H_ */
|