summaryrefslogtreecommitdiff
path: root/open-vm-tools/services/plugins/dndcp/dnd/dndCPTransport.h
blob: 8facfd34db655219fb3695ca73fe7b7826e46e02 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*********************************************************
 * Copyright (C) 2010 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.
 *
 *********************************************************/

/*
 * dndCPTransport.h --
 *
 *      DnDCPTransport provides a data transportation interface for both dnd and copyPaste.
 */

#ifndef DND_CP_TRANSPORT_H
#define DND_CP_TRANSPORT_H

#ifndef LIB_EXPORT
#define LIB_EXPORT
#endif

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

/* Some definitions for addressId. */
#define MAX_NUM_OF_CONNECTIONS  50
#define BROADCAST_CONNECTION_ID 10000
#define DEFAULT_CONNECTION_ID   10001
#define INVALID_CONNECTION_ID   99999

typedef enum TransportInterfaceType {
   TRANSPORT_HOST_CONTROLLER_DND = 0,
   TRANSPORT_HOST_CONTROLLER_CP,
   TRANSPORT_HOST_CONTROLLER_FT,
   TRANSPORT_GUEST_CONTROLLER_DND,
   TRANSPORT_GUEST_CONTROLLER_CP,
   TRANSPORT_GUEST_CONTROLLER_FT,
   TRANSPORT_INTERFACE_MAX,
} TransportInterfaceType;

class RpcBase;
#if defined(SWIG)
class DnDCPTransport
#else
class LIB_EXPORT DnDCPTransport
#endif
{
public:
   virtual ~DnDCPTransport() {};

   virtual void StartLoop() {};
   virtual void EndLoop() {};
   virtual void IterateLoop() {};
   virtual bool RegisterRpc(RpcBase *rpc,
                            TransportInterfaceType type) = 0;
   virtual bool UnregisterRpc(TransportInterfaceType type) = 0;

   virtual bool SendPacket(uint32 destId,
                           TransportInterfaceType type,
                           const uint8 *msg,
                           size_t length) = 0;
};

#endif // DND_CP_TRANSPORT_H