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
|
/*********************************************************
* Copyright (C) 2008 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.
*
*********************************************************/
#ifndef _RPCCHANNELINT_H_
#define _RPCCHANNELINT_H_
/**
* @file rpcChannelInt.h
*
* Internal definitions for the RPC channel library.
*/
#include "vmware/tools/guestrpc.h"
/** Max amount of time (in .01s) that the RpcIn loop will sleep for. */
#define RPCIN_MAX_DELAY 10
struct RpcIn;
/** a list of interface functions for a channel implementation */
typedef struct _RpcChannelFuncs{
gboolean (*start)(RpcChannel *);
void (*stop)(RpcChannel *);
gboolean (*send)(RpcChannel *, char const *data, size_t dataLen,
char **result, size_t *resultLen);
void (*setup)(RpcChannel *chan, GMainContext *mainCtx,
const char *appName, gpointer appCtx);
void (*shutdown)(RpcChannel *);
RpcChannelType (*getType)(RpcChannel *chan);
void (*onStartErr)(RpcChannel *);
gboolean (*stopRpcOut)(RpcChannel *);
} RpcChannelFuncs;
/** Defines the interface between the application and the RPC channel. */
struct _RpcChannel {
const RpcChannelFuncs *funcs;
gpointer _private;
GMainContext *mainCtx;
const char *appName;
gpointer appCtx;
GStaticMutex outLock;
struct RpcIn *in;
gboolean inStarted;
gboolean outStarted;
};
void
RpcChannel_Error(void *_state,
char const *status);
RpcChannel *VSockChannel_New(void);
RpcChannel *BackdoorChannel_New(void);
gboolean
BackdoorChannel_Fallback(RpcChannel *chan);
#endif /* _RPCCHANNELINT_H_ */
|