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 // Defines CSecureServer, CSecureServerSession and CSecureServerSubSession classes. 00015 // It also defines the constants that form the security policy for the server. 00016 // 00017 00018 00019 00024 #ifndef __SECURESERVER_H__ 00025 #define __SECURESERVER_H__ 00026 00027 #include <e32svr.h> 00028 #include <e32uid.h> 00029 #include <e32math.h> 00030 #include <f32file.h> 00031 00036 const TUint KDefaultHeapSize=0x10000; 00037 00043 enum TSecureServerPanic 00044 { 00048 EBadRequest = 1, 00052 EDescriptorNonNumeric, 00056 EMainSchedulerError, 00060 EServerCreateServer, 00064 EServerStartServer, 00068 ECreateTrapCleanup, 00072 EBadSubsessionHandle, 00076 ESecureServerSecurityPolicy 00077 }; 00078 00083 const TInt KSecureServerRangeCount = 5; 00084 00089 const TInt KSecureServerRanges[KSecureServerRangeCount] = 00090 { 00094 0, 00098 5, 00102 6, 00106 11, 00110 13 00111 }; 00112 00117 const CPolicyServer::TPolicyElement KSecureServerElements[] = 00118 { 00122 _INIT_SECURITY_POLICY_S0(0x70fffff0), 00126 {_INIT_SECURITY_POLICY_C1(ECapabilityReadDeviceData | ECapabilityWriteDeviceData), CPolicyServer::EFailClient} 00127 }; 00128 00133 const TUint8 KSecureServerElementsIndex[KSecureServerRangeCount] = 00134 { 00139 CPolicyServer::EAlwaysPass, 00144 0, 00149 CPolicyServer::ECustomCheck, 00154 1, 00159 CPolicyServer::ENotSupported 00160 }; 00161 00167 const CPolicyServer::TPolicy KSecureServerPolicy = 00168 { 00172 CPolicyServer::EAlwaysPass, 00173 KSecureServerRangeCount, 00174 KSecureServerRanges, 00175 KSecureServerElementsIndex, 00176 KSecureServerElements 00177 }; 00178 00190 class CSecureServer : public CPolicyServer 00191 { 00192 public: 00193 CSession2* NewSessionL(const TVersion &aVersion,const RMessage2& aMessage) const; 00194 static CSecureServer* NewL(CActive::TPriority aActiveObjectPriority); 00195 static TInt ThreadFunction(TAny* aStarted); 00196 static void PanicServer(TSecureServerPanic aPanic); 00197 CPolicyServer::TCustomResult CustomSecurityCheckL(const RMessage2 &aMsg, TInt &aAction, TSecurityInfo &aMissing); 00198 CObjectCon* NewContainerL(); 00199 void RemoveContainer(CObjectCon *aCon); 00200 ~CSecureServer(); 00201 private : 00202 CSecureServer(CActive::TPriority aActiveObjectPriority); 00203 void ConstructL(); 00204 00205 private: 00209 CObjectConIx* iContainerIndex; 00210 }; 00211 00212 class CSecureServerSubSession; 00213 00220 class CSecureServerSession : public CSession2 00221 { 00222 public: 00223 static CSecureServerSession* NewL(); 00224 void CreateL(); 00225 void ServiceL(const RMessage2& aMessage); 00226 void NewCounterL(const RMessage2& aMessage); 00227 void CloseSession(); 00228 void NumResourcesL(const RMessage2& aMessage); 00229 CSecureServerSubSession* CounterFromHandle(const RMessage2& aMessage,TInt aHandle); 00230 void DeleteCounter(TInt aHandle); 00231 TInt CountResources(); 00232 void PanicClient(const RMessage2& aMessage,TInt aPanic) const; 00233 CSecureServerSession(); 00234 private: 00238 CObjectCon* iContainer; 00242 CObjectIx* iCountersObjectIndex; 00247 TInt iResourceCount; 00248 }; 00249 00256 class CSecureServerSubSession : public CObject 00257 { 00258 public: 00259 static CSecureServerSubSession* NewL(CSecureServerSession* aSession); 00260 CSecureServerSubSession(CSecureServerSession* aSession); 00261 void ConstructL(CSecureServerSession* aSession); 00262 void SetFromStringL(const RMessage2& aMessage); 00263 void Increase(); 00264 void IncreaseBy(const RMessage2& aMessage); 00265 void Decrease(); 00266 void DecreaseBy(const RMessage2& aMessage); 00267 void Reset(); 00268 void CounterValueL(const RMessage2& aMessage); 00269 void SaveCounterValueL(); 00270 void SetCounterValueFromFileL(); 00271 00272 protected: 00276 CSecureServerSession* iSession; 00277 00278 private: 00282 TInt iCount; 00283 }; 00284 00285 #endif
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.