open-vm-tools 9.10.2

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

guestrpc.h
Go to the documentation of this file.
1 /*********************************************************
2 * Copyright (C) 2008,2014-2015 VMware, Inc. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published
6 * by the Free Software Foundation version 2.1 and no later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
11 * License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 *********************************************************/
18
19 #ifndef _VMWARE_TOOLS_GUESTRPC_H_
20 #define _VMWARE_TOOLS_GUESTRPC_H_
21
39 #include <glib.h>
40 #include "vmware/tools/utils.h"
41
42 G_BEGIN_DECLS
43
45 #define RPCIN_SETRETVALS RpcChannel_SetRetVals
46 #define RPCIN_SETRETVALSF RpcChannel_SetRetValsF
47
48 typedef struct _RpcChannel RpcChannel;
49
51 typedef struct RpcInData {
53 const char *name;
58 const char *args;
60 size_t argsSize;
65 char *result;
67 size_t resultLen;
72 gboolean freeResult;
74 void *appCtx;
76 void *clientData;
77 } RpcInData;
78
79 typedef enum RpcChannelType {
80 RPCCHANNEL_TYPE_INACTIVE,
81 RPCCHANNEL_TYPE_BKDOOR,
82 RPCCHANNEL_TYPE_PRIV_VSOCK,
83 RPCCHANNEL_TYPE_UNPRIV_VSOCK
84 } RpcChannelType;
85
90 typedef gboolean (*RpcIn_Callback)(RpcInData *data);
91
92
94 typedef struct RpcChannelCallback {
96 const char *name;
98 RpcIn_Callback callback;
100 gpointer clientData;
102 gpointer xdrIn;
109 gpointer xdrOut;
114 size_t xdrInSize;
115 } RpcChannelCallback;
116
124 typedef void (*RpcChannelResetCb)(RpcChannel *chan,
125 gboolean success,
126 gpointer data);
127
128 gboolean
129 RpcChannel_Start(RpcChannel *chan);
130
131 void
132 RpcChannel_Stop(RpcChannel *chan);
133
134 RpcChannelType
135 RpcChannel_GetType(RpcChannel *chan);
136
137 gboolean
138 RpcChannel_Send(RpcChannel *chan,
139 char const *data,
140 size_t dataLen,
141 char **result,
142 size_t *resultLen);
143
144 void
145 RpcChannel_Free(void *ptr);
146
147 gboolean
148 RpcChannel_BuildXdrCommand(const char *cmd,
149 void *xdrProc,
150 void *xdrData,
151 char **result,
152 size_t *resultLen);
153
154 RpcChannel *
155 RpcChannel_Create(void);
156
157 void
158 RpcChannel_Shutdown(RpcChannel *chan);
159
160 gboolean
161 RpcChannel_Destroy(RpcChannel *chan);
162
163 gboolean
164 RpcChannel_Dispatch(RpcInData *data);
165
166 void
167 RpcChannel_Setup(RpcChannel *chan,
168 const gchar *appName,
169 GMainContext *mainCtx,
170 gpointer appCtx,
171 RpcChannelResetCb resetCb,
172 gpointer resetData);
173
174 void
175 RpcChannel_RegisterCallback(RpcChannel *chan,
176 RpcChannelCallback *rpc);
177
178 gboolean
179 RpcChannel_SetRetVals(RpcInData *data,
180 char const *result,
181 gboolean retVal);
182
183 gboolean
184 RpcChannel_SetRetValsF(RpcInData *data,
185 char *result,
186 gboolean retVal);
187
188 void
189 RpcChannel_UnregisterCallback(RpcChannel *chan,
190 RpcChannelCallback *rpc);
191
192 gboolean
193 RpcChannel_SendOneRaw(const char *data,
194 size_t dataLen,
195 char **result,
196 size_t *resultLen);
197
198 gboolean
199 RpcChannel_SendOne(char **reply,
200 size_t *repLen,
201 const char *reqFmt,
202 ...);
203
204 RpcChannel *
205 RpcChannel_New(void);
206
207 void
208 RpcChannel_SetBackdoorOnly(void);
209
210 G_END_DECLS
211
214 #endif
215
RpcInData::args
const char * args
Definition: guestrpc.h:58
RpcInData::name
const char * name
Definition: guestrpc.h:53
RpcInData
Definition: guestrpc.h:51
RpcChannelCallback::clientData
gpointer clientData
Definition: guestrpc.h:100
RpcChannelCallback::xdrIn
gpointer xdrIn
Definition: guestrpc.h:102
RpcInData::argsSize
size_t argsSize
Definition: guestrpc.h:60
RpcChannelResetCb
void(* RpcChannelResetCb)(RpcChannel *chan, gboolean success, gpointer data)
Definition: guestrpc.h:124
utils.h
RpcInData::appCtx
void * appCtx
Definition: guestrpc.h:74
RpcChannelCallback
struct RpcChannelCallback RpcChannelCallback
RpcChannelCallback::xdrOut
gpointer xdrOut
Definition: guestrpc.h:109
RpcInData::result
char * result
Definition: guestrpc.h:65
RpcChannelCallback::xdrInSize
size_t xdrInSize
Definition: guestrpc.h:114
RpcInData::resultLen
size_t resultLen
Definition: guestrpc.h:67
RpcInData::clientData
void * clientData
Definition: guestrpc.h:76
RpcChannelCallback::callback
RpcIn_Callback callback
Definition: guestrpc.h:98
RpcChannelCallback::name
const char * name
Definition: guestrpc.h:96
RpcIn_Callback
gboolean(* RpcIn_Callback)(RpcInData *data)
Definition: guestrpc.h:90
RpcInData
struct RpcInData RpcInData
RpcInData::freeResult
gboolean freeResult
Definition: guestrpc.h:72
RpcChannelCallback
Definition: guestrpc.h:94