guestrpc.h
Go to the documentation of this file.
/*********************************************************
* Copyright (C) 2008,2014-2016 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 _VMWARE_TOOLS_GUESTRPC_H_
#define _VMWARE_TOOLS_GUESTRPC_H_
#include <glib.h>
#include "vmware/tools/utils.h"
G_BEGIN_DECLS
#define RPCIN_SETRETVALS RpcChannel_SetRetVals
#define RPCIN_SETRETVALSF RpcChannel_SetRetValsF
typedef struct _RpcChannel RpcChannel;
typedef struct RpcInData {
const char *name;
const char *args;
size_t argsSize;
char *result;
size_t resultLen;
gboolean freeResult;
void *appCtx;
void *clientData;
} RpcInData;
typedef enum RpcChannelType {
RPCCHANNEL_TYPE_INACTIVE,
RPCCHANNEL_TYPE_BKDOOR,
RPCCHANNEL_TYPE_PRIV_VSOCK,
RPCCHANNEL_TYPE_UNPRIV_VSOCK
} RpcChannelType;
typedef gboolean (*RpcIn_Callback)(RpcInData *data);
typedef struct RpcChannelCallback {
const char *name;
RpcIn_Callback callback;
gpointer clientData;
gpointer xdrIn;
gpointer xdrOut;
size_t xdrInSize;
} RpcChannelCallback;
typedef void (*RpcChannelResetCb)(RpcChannel *chan,
gboolean success,
gpointer data);
gboolean
RpcChannel_Start(RpcChannel *chan);
void
RpcChannel_Stop(RpcChannel *chan);
RpcChannelType
RpcChannel_GetType(RpcChannel *chan);
gboolean
RpcChannel_Send(RpcChannel *chan,
char const *data,
size_t dataLen,
char **result,
size_t *resultLen);
void
RpcChannel_Free(void *ptr);
gboolean
RpcChannel_BuildXdrCommand(const char *cmd,
void *xdrProc,
void *xdrData,
char **result,
size_t *resultLen);
RpcChannel *
RpcChannel_Create(void);
void
RpcChannel_Shutdown(RpcChannel *chan);
gboolean
RpcChannel_Destroy(RpcChannel *chan);
gboolean
RpcChannel_Dispatch(RpcInData *data);
void
RpcChannel_Setup(RpcChannel *chan,
const gchar *appName,
GMainContext *mainCtx,
gpointer appCtx,
RpcChannelResetCb resetCb,
gpointer resetData);
void
RpcChannel_RegisterCallback(RpcChannel *chan,
RpcChannelCallback *rpc);
gboolean
RpcChannel_SetRetVals(RpcInData *data,
char const *result,
gboolean retVal);
gboolean
RpcChannel_SetRetValsF(RpcInData *data,
char *result,
gboolean retVal);
void
RpcChannel_UnregisterCallback(RpcChannel *chan,
RpcChannelCallback *rpc);
gboolean
RpcChannel_SendOneRaw(const char *data,
size_t dataLen,
char **result,
size_t *resultLen);
gboolean
RpcChannel_SendOne(char **reply,
size_t *repLen,
const char *reqFmt,
...);
RpcChannel *
RpcChannel_New(void);
void
RpcChannel_SetBackdoorOnly(void);
G_END_DECLS
#endif
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