00001 /* 00002 Copyright (c) 2000-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without 00005 modification, are permitted provided that the following conditions are met: 00006 00007 * Redistributions of source code must retain the above copyright notice, this 00008 list of conditions and the following disclaimer. 00009 * Redistributions in binary form must reproduce the above copyright notice, 00010 this list of conditions and the following disclaimer in the documentation 00011 and/or other materials provided with the distribution. 00012 * Neither the name of Nokia Corporation nor the names of its contributors 00013 may be used to endorse or promote products derived from this software 00014 without specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 00027 Description: ComplexServer.cpp 00028 */ 00029 00030 #include "ComplexClientAndServer.h" 00031 #include "ComplexServer.h" 00032 #include <e32svr.h> 00033 #include <e32uid.h> 00034 00035 00036 00037 //********************************** 00038 //CCountServer - implementations 00039 //********************************** 00040 00044 void CCountServer::PanicServer(TCountServPanic aPanic) 00045 { 00046 _LIT(KTxtCountServer,"CountServer"); 00047 User::Panic(KTxtCountServer,aPanic); 00048 } 00049 00050 00054 CCountServer* CCountServer::NewL(CActive::TPriority aActiveObjectPriority) 00055 { 00056 CCountServer* self=new (ELeave) CCountServer(aActiveObjectPriority); 00057 CleanupStack::PushL(self); 00058 self->ConstructL(); 00059 CleanupStack::Pop(); 00060 return self; 00061 } 00062 00063 00070 CObjectCon* CCountServer::NewContainerL() 00071 { 00072 return iContainerIndex->CreateL(); 00073 } 00074 00075 00080 void CCountServer::RemoveContainer(CObjectCon *aCon) 00081 { 00082 iContainerIndex->Remove(aCon); 00083 } 00084 00085 00096 CCountServer::CCountServer(CActive::TPriority aActiveObjectPriority) 00097 : CServer2(aActiveObjectPriority) 00098 { 00099 } 00100 00101 00105 void CCountServer::ConstructL() 00106 { 00107 iContainerIndex=CObjectConIx::NewL(); 00108 } 00109 00110 00114 CCountServer::~CCountServer() 00115 { 00116 delete iContainerIndex; 00117 } 00118 00119 00123 CSession2* CCountServer::NewSessionL(const TVersion &aVersion,const RMessage2& /*aMessage*/) const 00124 { 00125 // Check that the version is OK 00126 TVersion v(KCountServMajorVersionNumber,KCountServMinorVersionNumber,KCountServBuildVersionNumber); 00127 if (!User::QueryVersionSupported(v,aVersion)) 00128 User::Leave(KErrNotSupported); 00129 00130 // CAN USE THE aMessage argument to check client's security and identity 00131 // can make use of this later but for now ignore. AH 4/5/05 00132 // the connect message is delivered via the RMessage2 object passed. 00133 00134 // Create the session. 00135 return new (ELeave) CCountSession; 00136 } 00137 00138