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
00026
00027
00028
00029 #ifndef CTSERVER_H
00030 #define CTSERVER_H "$Id: ctserver.h,v 1.6 2003/05/08 12:26:39 aquamaniac Exp $"
00031
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035
00036
00037 #include <chameleon/error.h>
00038 #include <chameleon/ipcservicelayer.h>
00039 #include <chameleon/cryp.h>
00040 #include <chameleon/conf.h>
00041 #include <ctservice.h>
00042
00043 typedef struct CTSERVERDATASTRUCT CTSERVERDATA;
00044
00050 typedef ERRORCODE (*CTSERVER_HANDLEREQUESTPTR)(CTSERVERDATA *sd,
00051 IPCMESSAGELAYER *ml,
00052 IPCMESSAGE *msg);
00053
00054 typedef ERRORCODE (*CTSERVER_CLIENTUPPTR)(CTSERVERDATA *sd,
00055 IPCMESSAGELAYER *ml);
00056 typedef ERRORCODE (*CTSERVER_CLIENTDOWNPTR)(CTSERVERDATA *sd,
00057 IPCMESSAGELAYER *ml);
00058
00059
00060
00061 struct CTSERVERDATASTRUCT {
00062 IPCSERVICELAYER *service;
00063 CTSERVER_CLIENTUPPTR clientUp;
00064 CTSERVER_CLIENTDOWNPTR clientDown;
00065 CTSERVER_HANDLEREQUESTPTR handleRequest;
00066 const char *serverPipe;
00067 int nextMessageId;
00068 void *privateData;
00069 int mark;
00070 char *address;
00071 int port;
00072 };
00073
00074
00075
00076 CTSERVERDATA* CTServer_new();
00077 void CTServer_free(CTSERVERDATA *sd);
00078
00079
00080 ERRORCODE CTServer_Init(CTSERVERDATA *sd,
00081 CONFIGGROUP *root);
00082 ERRORCODE CTServer_Fini(CTSERVERDATA *sd);
00083
00084 ERRORCODE CTServer_Work(CTSERVERDATA *sd,
00085 int timeout,
00086 int maxmsg);
00087
00088 ERRORCODE CTServer_SendResponse(CTSERVERDATA *sd,
00089 IPCMESSAGELAYER *ml,
00090 IPCMESSAGE *msg);
00091
00092 ERRORCODE CTServer_SendErrorMessage(CTSERVERDATA *sd,
00093 IPCMESSAGELAYER *ml,
00094 IPCMESSAGE *req,
00095 ERRORCODE errcode);
00096
00097
00098 void CTServer_RemoveDisconnected(CTSERVERDATA *sd);
00099
00100 void CTServer_SetRequestHandler(CTSERVERDATA *sd,
00101 CTSERVER_HANDLEREQUESTPTR p);
00102
00103 void CTServer_SetClientUpHandler(CTSERVERDATA *sd,
00104 CTSERVER_CLIENTUPPTR p);
00105 void CTServer_SetClientDownHandler(CTSERVERDATA *sd,
00106 CTSERVER_CLIENTDOWNPTR p);
00107
00108 void CTServer_SetPrivateData(CTSERVERDATA *sd,
00109 void *p);
00110 void *CTServer_GetPrivateData(CTSERVERDATA *sd);
00111
00112
00113 #ifdef __cplusplus
00114 }
00115 #endif
00116
00117
00118 #endif
00119
00120