|
1 /* |
|
2 * Copyright (c) 2008-2009 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 namespace Usif |
|
35 { |
|
36 // forward declarations |
|
37 class CScrServer; |
|
38 class CScrRequestImpl; |
|
39 |
|
40 class CScrSession : public CScsSession |
|
41 /** |
|
42 The instance of this class is used to perform SCR client requests and |
|
43 is created for each client. |
|
44 */ |
|
45 { |
|
46 public: |
|
47 static CScrSession* NewL(CScrServer &aServer, const RMessage2& aMessage); |
|
48 ~CScrSession(); |
|
49 |
|
50 // implement CScsSession |
|
51 TBool DoServiceL(TInt aFunction, const RMessage2& aMessage); |
|
52 // override CScsSession |
|
53 CScsSubsession* DoCreateSubsessionL(TInt aFunction, const RMessage2& aMessage); |
|
54 |
|
55 private: |
|
56 CScrSession(CScrServer& aServer); |
|
57 |
|
58 void ApplySubsessionConstraintL(CScrServer& aServer); |
|
59 void ApplyTransactionConstraintL(CScrServer& aServer, TBool& aCreateImplicitTransaction); |
|
60 void MutatingOperationsPreambleL(CScrServer& aServer, TScrSessionFunction aFunction, TBool& aIsTransactionImplicit); |
|
61 void MutatingOperationsPostambleL(CScrServer& aServer); |
|
62 |
|
63 private: |
|
64 TBool iTransactionOwner; |
|
65 }; |
|
66 |
|
67 class CScrServer : public CScsServer |
|
68 /** |
|
69 The CScsServer-derived object which is used to generate SCR sessions for the SCR clients. |
|
70 */ |
|
71 { |
|
72 public: |
|
73 static CScrServer* NewLC(); |
|
74 |
|
75 ~CScrServer(); |
|
76 |
|
77 //Implement from CScsServer |
|
78 CScsSession* DoNewSessionL(const RMessage2& aMessage); |
|
79 |
|
80 inline CScrRequestImpl* RequestImpL(); |
|
81 void ReconnectL(); |
|
82 |
|
83 void AddSubsessionOwnerL(CScrSession* aSession); |
|
84 void RemoveSubsessionOwner(CScrSession* aSession); |
|
85 TBool IsTheOnlySubsessionOwner(CScrSession* aSession); |
|
86 TInt SubsessionCount(); |
|
87 |
|
88 void SetTransactionOwner(CScrSession* aSession); |
|
89 TBool IsTransactionInProgress(); |
|
90 TBool IsTransactionOwner(CScrSession* aSession); |
|
91 virtual void DoPreHeapMarkOrCheckL(); |
|
92 virtual void DoPostHeapMarkOrCheckL(); |
|
93 protected: |
|
94 CPolicyServer::TCustomResult CustomSecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing); |
|
95 |
|
96 private: |
|
97 CScrServer(); |
|
98 void ConstructL(); |
|
99 void SetupL(); |
|
100 CPolicyServer::TCustomResult CheckDeleteComponentAllowedL(const RMessage2& aMsg); |
|
101 CPolicyServer::TCustomResult CheckComponentIdMatchingEnvironmentL(const RMessage2& aMsg); |
|
102 CPolicyServer::TCustomResult CheckSoftwareNameMatchingEnvironmentL(const RMessage2& aMsg); |
|
103 CPolicyServer::TCustomResult CheckAllowedFilePathL(const RMessage2& aMsg); |
|
104 CPolicyServer::TCustomResult CheckClientIsInstallerL(const RMessage2& aMsg); |
|
105 CPolicyServer::TCustomResult CheckCommonComponentPropertySettableL(const RMessage2& aMsg, TCapability aRequiredCapability); |
|
106 |
|
107 private: |
|
108 RFs iFs; ///< File server session handle. |
|
109 CScrRequestImpl* iRequestImpl; ///< Pointer to the request implementation object. |
|
110 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. |
|
111 RPointerArray<CScrSession> iSubsessionOwners; ///< The list of sessions which own active subsessions |
|
112 RFile iDatabaseFile; ///< The database file handle |
|
113 RFile iJournalFile; ///< The journal file handle |
|
114 }; |
|
115 |
|
116 inline CScrRequestImpl* CScrServer::RequestImpL() |
|
117 { |
|
118 if(!iRequestImpl) |
|
119 { |
|
120 User::Leave(KErrArgument); |
|
121 } |
|
122 return iRequestImpl; |
|
123 } |
|
124 |
|
125 } // End of namespace SCRSERVER_H |
|
126 #endif |