00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _EYEDBLIB_RPC_H
00026 #define _EYEDBLIB_RPC_H
00027
00028 #include <stdio.h>
00029 #include <eyedblib/machtypes.h>
00030
00031 enum {
00032 rpc_VoidType = 1,
00033 rpc_ByteType,
00034 rpc_Int16Type,
00035 rpc_Int32Type,
00036 rpc_Int64Type,
00037 rpc_StringType,
00038 rpc_DataType,
00039 rpc_StatusType,
00040 rpc_NBaseType
00041 };
00042
00043 typedef unsigned int rpc_ArgType;
00044
00045 typedef enum {
00046 rpc_Send = 0x1,
00047 rpc_Rcv = 0x2
00048 } rpc_SendRcv;
00049
00050 typedef struct {
00051 rpc_ArgType type;
00052 rpc_SendRcv send_rcv;
00053 } rpc_Arg;
00054
00055 enum {
00056 rpc_Success = 0,
00057 rpc_ConnectionFailure,
00058 rpc_ServerFailure,
00059 rpc_Error
00060 };
00061
00062 typedef unsigned int rpc_Status;
00063 typedef unsigned int rpc_RpcCode;
00064
00065 typedef enum {
00066 rpc_False = 0,
00067 rpc_True = 1
00068 } rpc_Boolean;
00069
00070 typedef struct {
00071 rpc_RpcCode code;
00072 int nargs;
00073 rpc_Arg *args;
00074 rpc_ArgType arg_ret;
00075 } rpc_RpcDescription;
00076
00077 typedef enum {
00078 rpc_To = 0x10,
00079 rpc_From = 0x11
00080 } rpc_FromTo;
00081
00082 #define RPC_DATA \
00083 int size; \
00084 void *data; \
00085 int status
00086
00087 typedef struct {
00088 RPC_DATA;
00089 } rpc_Data;
00090
00091 typedef void (*rpc_UserArgFunction)(rpc_Arg *, char **, void *, rpc_SendRcv,
00092 rpc_FromTo);
00093
00094
00095 extern rpc_RpcDescription *rpc_newRpcDescription(rpc_RpcCode, int);
00096 extern void rpc_deleteRpcDescription(rpc_RpcDescription *);
00097 extern rpc_Boolean rpc_portIsAddress(const char *);
00098
00099 extern const char *rpc_getPortAttr(const char *, int *domain, int *type);
00100
00101 #define rpc_ObjectNone (void *)-1
00102 #define rpc_SizeVariable -1
00103
00104 #define rpc_assert(X) \
00105 if (!(X)) \
00106 { \
00107 fprintf(stderr, "assertion failed `%s' in file `%s', line %d\n", #X, \
00108 __FILE__, __LINE__); \
00109 return 0; \
00110 }
00111
00112 #endif