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 __COBAINSERVER_H
00026 #define __COBAINSERVER_H
00027
00028 #include <e32base.h>
00029 #include <flogger.h>
00030
00031
00032 _LIT(KCobainServerFilename, "CobainServer");
00033 _LIT(KCobainServerName,"CobainServer");
00034 _LIT(KCobainServerSemaphoreName, "CobainServerSemaphore");
00035
00036
00037 static const TUid KCobainServerUid3 = { 0x03F5C4A9 };
00038
00039
00040 const TUint KCobainServerMajorVersion = 0;
00041 const TUint KCobainServerMinorVersion = 1;
00042 const TUint KCobainServerBuildVersion = 0;
00043
00044
00045 _LIT(KServerPanic, "Cobain server");
00046 _LIT(KClientPanic, "Cobain client");
00047
00048
00049 class CDelayedShutdown;
00050
00058 class CCobainServer : public CServer
00059 {
00060 public:
00061 enum TRequest {
00062 EGetNumPeers = 1,
00063 EGetPeer,
00064 EStartListen,
00065 EAbortListen,
00066 EGetIncomingConnection,
00067 EConnect,
00068 ESend,
00069 ECloseSocket,
00070 ECreate,
00071 ECancelReceive,
00072 EReceive
00073 };
00074
00075 enum TServerPanic {
00076 EBadRequest = 8800,
00077 EServerStartFailed,
00078 EUnsupportedProtocol,
00079 ESocketTableFull,
00080 EBadSocketTableIndex,
00081 ENoSuchConnection,
00082 EAlreadyListening,
00083 ENotListening,
00084 EBadMessage,
00085 EReceiveAlreadyPending,
00086 EBadSubsessionHandle
00087 };
00088
00089 static CCobainServer * NewL();
00090 static TInt ThreadFunction(TAny* aStarted);
00091 static void ThreadFunctionL();
00092 static void PanicServer(CCobainServer::TServerPanic aPanic);
00093
00094 private:
00095 CCobainServer(TInt aPriority);
00096 ~CCobainServer();
00097 void ConstructL();
00098 CSharableSession* NewSessionL(const TVersion& aVersion) const;
00099 void IncrementSession();
00100 void DecrementSession();
00101
00102
00103 TInt iSessionCount;
00104
00105 friend class CServerSession;
00106 };
00107
00108 #endif