|
1 /* |
|
2 * Copyright (c) 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 /* |
|
23 * Constructor |
|
24 */ |
|
25 inline CRTSecMgrServer::CRTSecMgrServer(CActive::TPriority aActiveObjectPriority) : |
|
26 //CServer2(aActiveObjectPriority) |
|
27 CPolicyServer( aActiveObjectPriority, KSecMgrSrvPolicy) |
|
28 { |
|
29 iSessionCount = 0; |
|
30 } |
|
31 |
|
32 /** |
|
33 A utility function to panic the server. |
|
34 */ |
|
35 inline void CRTSecMgrServer::PanicServer(TSecMgrServPanic aPanic) |
|
36 { |
|
37 _LIT (KTxtSecMgrServer, "SecurityMgrServer"); |
|
38 User::Panic (KTxtSecMgrServer, aPanic); |
|
39 } |
|
40 |
|
41 inline CObjectCon* CRTSecMgrServer::NewContainerL() |
|
42 { |
|
43 return iContainerIndex->CreateL (); |
|
44 } |
|
45 |
|
46 inline void CRTSecMgrServer::AddSession() |
|
47 { |
|
48 iShutDown.Cancel(); |
|
49 ++iSessionCount; |
|
50 } |
|
51 |
|
52 inline void CRTSecMgrServer::RemoveSession() |
|
53 { |
|
54 if (--iSessionCount == 0) |
|
55 if(!iShutDown.IsActive()) |
|
56 iShutDown.Start(); |
|
57 } |
|
58 |
|
59 inline void CRTSecMgrServer::RemoveFromContainerIx(CObjectCon *aContainer) |
|
60 { |
|
61 iContainerIndex->Remove(aContainer); |
|
62 } |
|
63 |
|
64 inline TInt CRTSecMgrServer::GetScriptFile(TExecutableID aExecID, |
|
65 TDes& aScriptFile) |
|
66 { |
|
67 return iScriptMgr->GetScriptFile (aExecID, aScriptFile); |
|
68 } |
|
69 |
|
70 inline TInt CRTSecMgrServer::GetCapabilityInfo(CScript& aScriptInfo) |
|
71 { |
|
72 return iScriptMgr->ScriptInfo (aScriptInfo); |
|
73 } |
|
74 |
|
75 inline void CRTSecMgrServer::UpdatePermGrantL(TExecutableID aExecID, |
|
76 TPermGrant aPermGrant, TPermGrant aPermDenied) |
|
77 { |
|
78 iScriptMgr->UpdatePermGrantL (aExecID, aPermGrant, aPermDenied); |
|
79 } |
|
80 |
|
81 inline TInt CRTSecMgrServer::ReadCounter(TExecutableID& aExecID) |
|
82 { |
|
83 return iSecMgrDb->ReadCounter (aExecID); |
|
84 } |
|
85 |
|
86 inline void CRTSecMgrServer::AddPolicyL(TPolicyID aPolicyID, |
|
87 const RProtectionDomains& aPolicyInfo, RAliasGroup& aAliasInfo) |
|
88 { |
|
89 CPolicy* policy = CPolicy::NewLC (aPolicyID, aPolicyInfo, aAliasInfo/*,RTrustArray()*/); |
|
90 iPolicyMgr->RegisterPolicyL (*policy); |
|
91 CleanupStack::Pop (policy); |
|
92 } |
|
93 |
|
94 inline TInt CRTSecMgrServer::RemovePolicy(TPolicyID aPolicyID) |
|
95 { |
|
96 return iPolicyMgr->UnRegisterPolicy (aPolicyID); |
|
97 } |
|
98 |
|
99 inline TExecutableID CRTSecMgrServer::RegisterScript(TPolicyID aPolicyID/*,const CTrustInfo& aTrustInfo*/) |
|
100 { |
|
101 return iScriptMgr->RegisterScript (aPolicyID); |
|
102 } |
|
103 |
|
104 inline TExecutableID CRTSecMgrServer::RegisterScript(TPolicyID aPolicyID, const TDesC& aHashValue) |
|
105 { |
|
106 return iScriptMgr->RegisterScript (aPolicyID, aHashValue); |
|
107 } |
|
108 |
|
109 inline void CRTSecMgrServer::UnRegisterScriptL(TExecutableID aExecID, |
|
110 TPolicyID aPolicyID) |
|
111 { |
|
112 iScriptMgr->UnRegisterScriptL (aExecID, aPolicyID); |
|
113 } |
|
114 |
|
115 inline TBool CRTSecMgrServer::IsValidPolicy(TPolicyID aPolicyID) const |
|
116 { |
|
117 return iPolicyMgr->HasPolicy (aPolicyID); |
|
118 } |
|
119 |
|
120 inline TInt CRTSecMgrServer::BackupFile(TPolicyID aPolicyID) |
|
121 { |
|
122 return iSecMgrDb->BackupFile(aPolicyID); |
|
123 } |
|
124 |
|
125 inline TInt CRTSecMgrServer::RemoveTempPolicy(TPolicyID aPolicyID) |
|
126 { |
|
127 return iSecMgrDb->RemoveTempPolicy(aPolicyID); |
|
128 } |
|
129 |
|
130 inline TInt CRTSecMgrServer::RestoreTempPolicy(TPolicyID aPolicyID) |
|
131 { |
|
132 return iSecMgrDb->RestoreTempPolicy(aPolicyID); |
|
133 } |
|
134 |
|
135 inline CPolicy* CRTSecMgrServer::ReturnPolicyInfo(TPolicyID aPolicyID) |
|
136 { |
|
137 return iPolicyMgr->Policy(aPolicyID); |
|
138 } |
|
139 |
|
140 inline void CRTSecMgrServer::StorePolicyL(const CPolicy& aPolicy) |
|
141 { |
|
142 return iSecMgrDb->StorePolicyL(aPolicy); |
|
143 } |