~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201210021442

« back to all changes in this revision

Viewing changes to services/plugins/dndcp/dndGuest/dndCPTransportGuestRpc.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2011-03-31 14:20:05 UTC
  • mfrom: (1.4.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110331142005-3n9red91p7ogkweo
Tags: 2011.03.28-387002-0ubuntu1
* Merge latest upstream git tag.  This has the unlocked_ioctl change
  needed to fix dkms build failures (LP: #727342)
* Changes in debian/rules:
  - work around a bug in toolbox/Makefile, where install-exec-hook is
    not happening.  This needs to get fixed the right way.
  - don't install 'vmware-user' which seems to no longer exist
  - move /etc/xdg into open-vm-toolbox (which should be done using .install)
* debian/open-vm-tools.init: add 'modprobe [-r] vmblock'. (LP: #332323)
* debian/rules and debian/open-vm-toolbox.lintian-overrides:
  - Make vmware-user-suid-wrapper suid-root (LP: #332323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* **************************************************************************
 
2
 * Copyright (C) 2010 VMware, Inc. All Rights Reserved -- VMware Confidential
 
3
 * **************************************************************************/
 
4
 
 
5
/**
 
6
 * @dndCPTransportGuestRpc.hpp --
 
7
 *
 
8
 * GuestRpc implementation of the dndCPTransport interface. Both vmx and guest
 
9
 * tools use this class for DnD version 4.
 
10
 */
 
11
 
 
12
 
 
13
#ifndef DND_CP_TRANSPORT_GUEST_RPC_HPP
 
14
#define DND_CP_TRANSPORT_GUEST_RPC_HPP
 
15
 
 
16
#include "dndCPTransport.h"
 
17
 
 
18
extern "C" {
 
19
   #include "dnd.h"
 
20
#ifdef VMX86_TOOLS
 
21
   #include "vmware/tools/guestrpc.h"
 
22
#else
 
23
   #include "guest_rpc.h"
 
24
#endif
 
25
}
 
26
 
 
27
#define GUEST_RPC_CMD_STR_DND "dnd.transport"
 
28
#define GUEST_RPC_CMD_STR_CP  "copypaste.transport"
 
29
#define GUEST_RPC_DND_DISABLE "dndDisable"
 
30
#define GUEST_RPC_CP_DISABLE  "copyDisable"
 
31
 
 
32
class DnDCPTransportGuestRpc;
 
33
typedef struct GuestRpcCBCtx {
 
34
   DnDCPTransportGuestRpc *transport;
 
35
   TransportInterfaceType type;
 
36
} GuestRpcCBCtx;
 
37
 
 
38
class TransportGuestRpcTables
 
39
{
 
40
public:
 
41
   TransportGuestRpcTables(void);
 
42
   ~TransportGuestRpcTables(void);
 
43
 
 
44
   RpcBase *GetRpc(TransportInterfaceType type);
 
45
   void SetRpc(TransportInterfaceType type, RpcBase *rpc);
 
46
#ifndef VMX86_TOOLS
 
47
   GuestRpcCmd GetCmd(TransportInterfaceType type);
 
48
#endif
 
49
   const char *GetCmdStr(TransportInterfaceType type);
 
50
   const char *GetDisableStr(TransportInterfaceType type);
 
51
 
 
52
private:
 
53
   RpcBase *mRpcList[TRANSPORT_INTERFACE_MAX];
 
54
#ifndef VMX86_TOOLS
 
55
   GuestRpcCmd mCmdTable[TRANSPORT_INTERFACE_MAX];
 
56
#endif
 
57
   const char *mCmdStrTable[TRANSPORT_INTERFACE_MAX];
 
58
   const char *mDisableStrTable[TRANSPORT_INTERFACE_MAX];
 
59
};
 
60
 
 
61
 
 
62
class DnDCPTransportGuestRpc
 
63
   : public DnDCPTransport
 
64
{
 
65
public:
 
66
#ifdef VMX86_TOOLS
 
67
   DnDCPTransportGuestRpc(RpcChannel *chan);
 
68
#else
 
69
   DnDCPTransportGuestRpc(void);
 
70
#endif
 
71
 
 
72
   bool Init(void);
 
73
   virtual bool RegisterRpc(RpcBase *rpc,
 
74
                            TransportInterfaceType type);
 
75
   virtual bool UnregisterRpc(TransportInterfaceType type);
 
76
 
 
77
   virtual bool SendPacket(uint32 destId,
 
78
                           TransportInterfaceType type,
 
79
                           const uint8 *msg,
 
80
                           size_t length);
 
81
   void OnRecvPacket(TransportInterfaceType type,
 
82
                     const uint8 *packet,
 
83
                     size_t packetSize);
 
84
private:
 
85
   TransportGuestRpcTables mTables;
 
86
   GuestRpcCBCtx mCBCtx[TRANSPORT_INTERFACE_MAX];
 
87
#ifdef VMX86_TOOLS
 
88
   RpcChannel *mRpcChannel;
 
89
   RpcChannelCallback mRpcChanCBList[TRANSPORT_INTERFACE_MAX];
 
90
#endif
 
91
};
 
92
 
 
93
#endif // DND_CP_TRANSPORT_GUEST_RPC_HPP