summaryrefslogtreecommitdiff
path: root/open-vm-tools/services/plugins/dndcp/dnd/rpcV3Util.hpp
blob: 68a368a0c4c483a957f4a03a0b7b872a982d6200 (plain)
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
/* **************************************************************************
 * Copyright (C) 2010 VMware, Inc. All Rights Reserved -- VMware Confidential
 * **************************************************************************/

/**
 * @rpcV3Util.hpp --
 *
 * Rpc layer object for DnD version 4.
 */

#ifndef RPC_V3_UTIL_HPP
#define RPC_V3_UTIL_HPP

#ifndef LIB_EXPORT
#define LIB_EXPORT
#endif

#include "rpcBase.h"

extern "C" {
   #include "dnd.h"
}

struct DnDMsg;

class LIB_EXPORT RpcV3Util
{
public:
   RpcV3Util(void);
   virtual ~RpcV3Util(void);

   void Init(RpcBase *rpc);

   void OnRecvPacket(uint32 srcId,
                     const uint8 *packet,
                     size_t packetSize);
   bool SendMsg(uint32 cmd);
   bool SendMsg(uint32 cmd,
                const CPClipboard *clip);
   bool SendMsg(uint32 cmd, int32 x, int32 y); // For cmd with mouse info.
   bool SendMsg(const DnDMsg *msg);
   uint32 GetVersionMajor(void) { return mVersionMajor; }
   uint32 GetVersionMinor(void) { return mVersionMinor; }

private:
   bool SendMsg(const uint8 *binary,
                uint32 binarySize);
   RpcBase *mRpc;
   uint32 mVersionMajor;
   uint32 mVersionMinor;
   DnDTransportBuffer mSendBuf;
   DnDTransportBuffer mRecvBuf;
   uint32 mSeqNum;
};

#endif // RPC_V3_UTIL_HPP