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_BE_H
00026 #define _EYEDBLIB_RPC_BE_H
00027
00028 #include <eyedblib/rpc.h>
00029 #include <eyedblib/connman.h>
00030
00031
00032 typedef struct rpc_Server rpc_Server;
00033
00034 typedef struct rpc_PortHandle rpc_PortHandle;
00035
00036 typedef struct {
00037 RPC_DATA;
00038 int fd;
00039 int buff_size;
00040 void (*garbage_fun)(void *, void *);
00041 void *garbage_data;
00042 } rpc_ServerData;
00043
00044 enum {
00045 rpc_BuffUsed = 10,
00046 rpc_TempDataUsed,
00047 rpc_PermDataUsed
00048 };
00049
00050 typedef enum {
00051 rpc_MonoProc = 1,
00052 rpc_MultiThreaded,
00053 rpc_MultiProcs,
00054 rpc_FrontThreaded
00055 } rpc_ServerMode;
00056
00057 typedef unsigned int rpc_ClientId;
00058
00059 typedef struct rpc_ServerFunction rpc_ServerFunction;
00060
00061 typedef void (*rpc_UserServerFunction)(rpc_ClientId, void *);
00062 typedef void (*rpc_ConnectionHandlerFunction)(rpc_Server *, rpc_ClientId, rpc_Boolean);
00063
00064 extern rpc_Server *rpc_serverCreate(rpc_ServerMode, unsigned long,
00065 int, int,
00066 void (*init)(int *, int, rpc_ConnInfo *),
00067 void (*release)(rpc_ConnInfo *),
00068 void (*begin)(int, void *),
00069 void (*end)(int, void *), void *);
00070
00071 extern rpc_ServerFunction *
00072 rpc_makeUserServerFunction(rpc_Server *, rpc_RpcDescription *, rpc_UserServerFunction);
00073
00074 extern rpc_Status
00075 rpc_setServerArgSize(rpc_Server *, int);
00076
00077 extern rpc_Status
00078 rpc_portOpen(rpc_Server *, const char *, const char *, rpc_PortHandle **);
00079
00080 extern rpc_Status
00081 rpc_serverMainLoop(rpc_Server *, rpc_PortHandle **, int);
00082
00083 extern rpc_ArgType rpc_makeServerUserType(rpc_Server *, int,
00084 rpc_UserArgFunction);
00085
00086 extern void
00087 rpc_serverOptionsGet(int, char *[], char **, char **);
00088
00089 extern rpc_ConnectionHandlerFunction
00090 rpc_setConnectionHandler(rpc_Server *, rpc_ConnectionHandlerFunction);
00091
00092 extern rpc_Server *rpc_getMainServer(void);
00093
00094 extern void rpc_setProgName(const char *);
00095
00096 extern int rpc_checkConn();
00097
00098 extern void rpc_setTimeOut(int timeout);
00099
00100 extern rpc_ClientId rpc_client_id;
00101
00102 #endif