00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _VMRPCDBG_H_
00020 #define _VMRPCDBG_H_
00021
00032 #include "vmtoolsApp.h"
00033 #include "util.h"
00034
00035 struct RpcDebugPlugin;
00036
00041 typedef gboolean (*RpcDebugRecvFn)(char *data,
00042 size_t dataLen,
00043 char **result,
00044 size_t *resultLen);
00045
00047 typedef struct RpcDebugRecvMapping {
00048 gchar *name;
00049 RpcDebugRecvFn recvFn;
00054 gpointer xdrProc;
00056 size_t xdrSize;
00057 } RpcDebugRecvMapping;
00058
00059
00065 typedef gboolean (*RpcDebugValidateFn)(RpcInData *data,
00066 Bool ret);
00067
00069 typedef struct RpcDebugMsgMapping {
00070 gchar *message;
00071 size_t messageLen;
00072 RpcDebugValidateFn validateFn;
00073 gboolean freeMsg;
00074 } RpcDebugMsgMapping;
00075
00077 typedef struct RpcDebugMsgList {
00078 RpcDebugMsgMapping *mappings;
00079 size_t index;
00080 } RpcDebugMsgList;
00081
00082
00090 typedef gboolean (*RpcDebugSendFn)(RpcDebugMsgMapping *rpcdata);
00091
00093 typedef void (*RpcDebugShutdownFn)(ToolsAppCtx *ctx,
00094 struct RpcDebugPlugin *plugin);
00095
00100 typedef struct RpcDebugPlugin {
00102 RpcDebugRecvMapping *recvFns;
00107 RpcDebugRecvFn dfltRecvFn;
00109 RpcDebugSendFn sendFn;
00111 RpcDebugShutdownFn shutdownFn;
00112 } RpcDebugPlugin;
00113
00114
00119 typedef RpcDebugPlugin *(*RpcDebugOnLoadFn)(ToolsAppCtx *ctx);
00120
00121 struct RpcDebugLibData;
00122
00128 typedef struct RpcDebugLibData {
00129 RpcChannel * (*newDebugChannel) (ToolsAppCtx *, struct RpcDebugLibData *);
00130 void (*shutdown) (ToolsAppCtx *, struct RpcDebugLibData *);
00131 RpcDebugPlugin *debugPlugin;
00132 } RpcDebugLibData;
00133
00135 typedef RpcDebugLibData *(* RpcDebugInitializeFn)(ToolsAppCtx *, gchar *);
00136
00137
00146 #define RPCDEBUG_SET_RESULT(resultStr, result, resultLen) do { \
00147 char *__resultStr = (resultStr); \
00148 char **__result = (result); \
00149 size_t *__resultLen = (resultLen); \
00150 if (__result != NULL) { \
00151 *__result = Util_SafeStrdup(__resultStr); \
00152 } \
00153 if (__resultLen != NULL) { \
00154 *__resultLen = strlen(__resultStr); \
00155 } \
00156 } while (0)
00157
00158 void
00159 RpcDebug_DecRef(ToolsAppCtx *ctx);
00160
00161 void
00162 RpcDebug_IncRef(void);
00163
00164 RpcDebugLibData *
00165 RpcDebug_Initialize(ToolsAppCtx *ctx,
00166 gchar *dbgPlugin);
00167
00168 RpcChannel *
00169 RpcDebug_NewDebugChannel(ToolsAppCtx *ctx,
00170 RpcDebugLibData *data);
00171
00172 gboolean
00173 RpcDebug_SendNext(RpcDebugMsgMapping *rpcdata,
00174 RpcDebugMsgList *list);
00175
00176 void
00177 RpcDebug_Shutdown(ToolsAppCtx *ctx,
00178 RpcDebugLibData *data);
00179
00182 #endif
00183