installationservices/swcomponentregistry/inc_private/scrserver.h
branchRCL_3
changeset 25 7333d7932ef7
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
       
     1 /*
       
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * Defines server-side classes which are used to implement the SCR server.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalComponent
       
    23  @released
       
    24 */
       
    25  
       
    26 
       
    27 #ifndef SCRSERVER_H
       
    28 #define SCRSERVER_H
       
    29 
       
    30 #include <scs/scsserver.h>
       
    31 #include "scrcommon.h"
       
    32 #include "usifcommon.h"
       
    33 
       
    34 _LIT_SECURE_ID(KSisRegistryServerSid, 0x10202DCA); 
       
    35 _LIT_SECURE_ID(KApparcServerSid, 0x10003A3F);
       
    36 
       
    37 namespace Usif
       
    38 	{
       
    39 	// forward declarations
       
    40 	class CScrServer;
       
    41 	class CScrRequestImpl;
       
    42 												
       
    43 	class CScrSession : public CScsSession
       
    44 	/**
       
    45 		The instance of this class is used to perform SCR client requests and 
       
    46 		is created for each client. 
       
    47 	 */
       
    48 		{
       
    49 	public:
       
    50 		static CScrSession* NewL(CScrServer &aServer, const RMessage2& aMessage);
       
    51 		~CScrSession();
       
    52 				
       
    53 		// implement CScsSession
       
    54 		TBool DoServiceL(TInt aFunction, const RMessage2& aMessage);
       
    55 		// override CScsSession
       
    56 		CScsSubsession* DoCreateSubsessionL(TInt aFunction, const RMessage2& aMessage);
       
    57 		
       
    58 	private:
       
    59 		CScrSession(CScrServer& aServer);
       
    60 		
       
    61 		void ApplySubsessionConstraintL(CScrServer& aServer);
       
    62 		void ApplyTransactionConstraintL(CScrServer& aServer, TBool& aCreateImplicitTransaction);
       
    63 		void MutatingOperationsPreambleL(CScrServer& aServer, TScrSessionFunction aFunction, TBool& aIsTransactionImplicit);
       
    64 		void MutatingOperationsPostambleL(CScrServer& aServer);
       
    65 		
       
    66 	private:
       
    67 		TBool iTransactionOwner; 
       
    68 		};
       
    69 	
       
    70 	class CScrServer : public CScsServer
       
    71 	/**
       
    72 		The CScsServer-derived object which is used to generate SCR sessions for the SCR clients.
       
    73 	 */
       
    74 		{
       
    75 	public:
       
    76 		static CScrServer* NewLC();
       
    77 				
       
    78 		~CScrServer();
       
    79 		
       
    80 		//Implement from CScsServer
       
    81 		CScsSession* DoNewSessionL(const RMessage2& aMessage);
       
    82 	
       
    83 		inline CScrRequestImpl* RequestImpL();
       
    84 		void ReconnectL();
       
    85 		
       
    86 		void AddSubsessionOwnerL(CScrSession* aSession);
       
    87 		void RemoveSubsessionOwner(CScrSession* aSession);
       
    88 		TBool IsTheOnlySubsessionOwner(CScrSession* aSession);
       
    89 		TInt SubsessionCount();
       
    90 		
       
    91 		void SetTransactionOwner(CScrSession* aSession);
       
    92 		TBool IsTransactionInProgress();
       
    93 		TBool IsTransactionOwner(CScrSession* aSession);
       
    94 		virtual void DoPreHeapMarkOrCheckL();
       
    95 		virtual void DoPostHeapMarkOrCheckL();
       
    96 	protected:
       
    97 		CPolicyServer::TCustomResult CustomSecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing);		
       
    98 		
       
    99 	private:
       
   100 		CScrServer();
       
   101 		void ConstructL();
       
   102 		void SetupL();
       
   103 		CPolicyServer::TCustomResult CheckDeleteComponentAllowedL(const RMessage2& aMsg);
       
   104 		CPolicyServer::TCustomResult CheckComponentIdMatchingEnvironmentL(const RMessage2& aMsg, TBool aCheckForSingleApp=EFalse);				
       
   105 		CPolicyServer::TCustomResult CheckSoftwareNameMatchingEnvironmentL(const RMessage2& aMsg);
       
   106 		CPolicyServer::TCustomResult CheckAllowedFilePathL(const RMessage2& aMsg);
       
   107 		CPolicyServer::TCustomResult CheckClientIsInstallerL(const RMessage2& aMsg);
       
   108 		CPolicyServer::TCustomResult CheckCommonComponentPropertySettableL(const RMessage2& aMsg, TCapability aRequiredCapability);
       
   109 		
       
   110 	private:
       
   111 		RFs iFs;										///< File server session handle.
       
   112 		CScrRequestImpl* iRequestImpl;					///< Pointer to the request implementation object.
       
   113 		CScrSession* iTransactionOwningSession; 		///< Pointer to the session which is owner of the current transaction. Owned by another object. NULL means there is no transaction in progress.
       
   114 		RPointerArray<CScrSession> iSubsessionOwners;   ///< The list of sessions which own active subsessions
       
   115 		RFile iDatabaseFile;							///< The database file handle
       
   116 		RFile iJournalFile;								///< The journal file handle
       
   117 		};
       
   118 	
       
   119 	inline CScrRequestImpl* CScrServer::RequestImpL()
       
   120 		{
       
   121 		if(!iRequestImpl)
       
   122 			{
       
   123 			User::Leave(KErrArgument);
       
   124 			}
       
   125 		return iRequestImpl;
       
   126 		}
       
   127 	
       
   128 	} // End of namespace SCRSERVER_H	
       
   129 #endif