rpc_be.h

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 #ifndef _EYEDBLIB_RPC_BE_H
00026 #define _EYEDBLIB_RPC_BE_H
00027 
00028 #include <eyedblib/rpc.h>
00029 #include <eyedblib/connman.h>
00030 
00031 /* back end: server */
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

Generated on Mon Dec 22 18:16:07 2008 for eyedb by  doxygen 1.5.3