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 #include <sys/types.h>
00026 #include <eyedblib/rpc_be.h>
00027 #include <eyedblib/rpc_lib.h>
00028 #include <sys/select.h>
00029
00030 typedef char *rpc_ServerArg;
00031
00032 typedef struct {
00033 rpc_ServerArg *ua;
00034 pthread_t *tid;
00035 char **comm_buff;
00036 rpc_Boolean dead;
00037 int refcnt;
00038 int fd_cnt;
00039 } rpc_ClientInfo;
00040
00041 struct rpc_Server {
00042 rpc_ServerMode mode;
00043 int conn_cnt;
00044 int comm_size;
00045 int nclients;
00046 void (*init)(int *, int, rpc_ConnInfo *);
00047 void (*release)(rpc_ConnInfo *);
00048 void (*begin)(int, void *);
00049 void (*end)(int, void *);
00050 void *user_data;
00051 rpc_ClientInfo *cinfos;
00052 #ifdef RPC_FUN_CHAIN
00053 rpc_ServerFunction *first;
00054 #else
00055 rpc_ServerFunction *funcs[256];
00056 #endif
00057 rpc_ConnectionHandlerFunction connh;
00058 int last_type;
00059 int args_size;
00060 rpc_UserType utyp[RPC_UTYPS];
00061 fd_set fds_used;
00062 eyedblib::uint32 magic;
00063 };
00064
00065 enum {
00066 rpc_OutOfBandSTART = 0x100,
00067 rpc_OutOfBandSTOP = 0x200,
00068 rpc_OutOfBandOK = 0x300
00069 };
00070
00071 struct rpc_PortHandle {
00072 rpc_Server *server;
00073 int domain, type;
00074 char *portname;
00075 union {
00076 struct {
00077 int sockin_fd;
00078 struct sockaddr_in sock_in_name;
00079 } in;
00080 struct {
00081 int sockun_fd;
00082 struct sockaddr_un sock_un_name;
00083 } un;
00084 } u;
00085 };
00086
00087 struct rpc_ServerFunction {
00088 rpc_RpcDescription *rd;
00089 rpc_UserServerFunction uf;
00090 rpc_ServerFunction *next;
00091 };
00092
00093 extern rpc_ServerFunction *rpc_rpcGet(rpc_Server *, rpc_RpcCode);