Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals

cobainserver.h

Go to the documentation of this file.
00001 /*
00002  * cobainserver.h,v 1.29 2004/01/06 19:43:01 mattid Exp
00003  *
00004  * COBAIN - Communications API for EPOC Environments
00005  * Copyright (C) 2002-2004 Matti Dahlbom, Matti Kokkola
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * Contact: Matti Dahlbom <matti@777-team.org>
00022  *          Matti Kokkola <matti.kokkola@iki.fi>
00023  */
00024 
00025 #ifndef __COBAINSERVER_H
00026 #define __COBAINSERVER_H
00027 
00028 #include <e32base.h>
00029 #include <flogger.h>
00030 
00031 // Server name stuff
00032 _LIT(KCobainServerFilename, "CobainServer");
00033 _LIT(KCobainServerName,"CobainServer");
00034 _LIT(KCobainServerSemaphoreName, "CobainServerSemaphore");
00035 
00036 // Cobain API UID
00037 static const TUid KCobainServerUid3 = { 0x03F5C4A9 };
00038 
00039 // Server version numbers
00040 const TUint KCobainServerMajorVersion = 0;
00041 const TUint KCobainServerMinorVersion = 1;
00042 const TUint KCobainServerBuildVersion = 0;
00043 
00044 // Panic category for panics issued by the sensor session
00045 _LIT(KServerPanic, "Cobain server");
00046 _LIT(KClientPanic, "Cobain client");
00047 
00048 // forward declarations
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         // number of alive sessions
00103         TInt iSessionCount;
00104 
00105         friend class CServerSession;
00106 };
00107 
00108 #endif

Generated on Tue Jan 13 15:47:07 2004 for CobainAPIImplementation by doxygen 1.3.5