00001 /* 00002 EyeDB Object Database Management System 00003 Copyright (C) 1994-2008 SYSRA 00004 00005 EyeDB is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 EyeDB is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00018 */ 00019 00020 /* 00021 Author: Eric Viara <viara@sysra.com> 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);