00001 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 00002 // All rights reserved. 00003 // This component and the accompanying materials are made available 00004 // under the terms of "Eclipse Public License v1.0" 00005 // which accompanies this distribution, and is available 00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". 00007 // 00008 // Initial Contributors: 00009 // Nokia Corporation - initial contribution. 00010 // 00011 // Contributors: 00012 // 00013 // Description: 00014 // Contains the implementation of functions described in the CSecureServer class. 00015 // 00016 00017 00018 00022 #include "secureclientandserver.h" 00023 #include "secureserver.h" 00024 00029 void CSecureServer::PanicServer(TSecureServerPanic aPanic) 00030 { 00031 _LIT(KTxTSecureServer,"SecureServer"); 00032 User::Panic(KTxTSecureServer,aPanic); 00033 } 00034 00040 CSecureServer* CSecureServer::NewL(CActive::TPriority aActiveObjectPriority) 00041 { 00042 CSecureServer* self = new (ELeave) CSecureServer(aActiveObjectPriority); 00043 CleanupStack::PushL(self); 00044 self->ConstructL(); 00045 CleanupStack::Pop(); 00046 return self; 00047 } 00048 00053 CObjectCon* CSecureServer::NewContainerL() 00054 { 00055 return iContainerIndex->CreateL(); 00056 } 00057 00062 void CSecureServer::RemoveContainer(CObjectCon *aCon) 00063 { 00064 iContainerIndex->Remove(aCon); 00065 } 00066 00075 CSecureServer::CSecureServer(CActive::TPriority aActiveObjectPriority) 00076 : CPolicyServer(aActiveObjectPriority, KSecureServerPolicy, ESharableSessions) 00077 { 00078 // KSecurityPolicy is the TPolicy object that defines the security policy of the server. 00079 } 00080 00090 void CSecureServer::ConstructL() 00091 { 00092 iContainerIndex = CObjectConIx::NewL(); 00093 } 00094 00098 CSecureServer::~CSecureServer() 00099 { 00100 delete iContainerIndex; 00101 } 00102 00108 CSession2* CSecureServer::NewSessionL(const TVersion &aVersion,const RMessage2& /*aMessage*/) const 00109 { 00110 TVersion v(KSecureServMajorVersionNumber,KSecureServMinorVersionNumber,KSecureServBuildVersionNumber); 00111 if (!User::QueryVersionSupported(v,aVersion)) 00112 { 00113 User::Leave(KErrNotSupported); 00114 } 00115 return new (ELeave) CSecureServerSession; 00116 } 00117 00136 CPolicyServer::TCustomResult CSecureServer:: CustomSecurityCheckL(const RMessage2 &aMsg, TInt &aAction, TSecurityInfo &aMissing) 00137 { 00138 TInt sid; 00139 RMessagePtr2 msg = aMsg; 00140 sid = msg.SecureId(); 00141 switch(aMsg.Function()) 00142 { 00143 case ESecureServerIncreaseBy: 00144 case ESecureServerDecreaseBy: 00145 { 00146 TInt val = aMsg.Int0(); 00147 if(val > 10) 00148 { 00149 if(sid > 0x70fffff5) 00150 { 00151 return EFail; 00152 } 00153 } 00154 } 00155 break; 00156 case ESecureServerReset: 00157 case ESecureServerDecrease: 00158 case ESecureServerIncrease: 00159 { 00160 } 00161 break; 00162 default: 00163 { 00164 aAction = EPanicClient; 00165 CheckFailedL(aMsg,aAction,aMissing); 00166 return EFail; 00167 } 00168 } 00169 return EPass; 00170 }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.