279
|
1 |
// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
|
0
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
279
|
14 |
// Contains the Domain Manager interface for clients providing policy
|
|
15 |
// information. Typically this is the same client that acts in the
|
|
16 |
// "Domain Controller" role.
|
|
17 |
//
|
|
18 |
// There are two versions of the policy API - the original V1 and the new V2.
|
|
19 |
// V2 builds upon V1 and specifies the states which clients are allowed to defer
|
|
20 |
// their transition timeout if they have not finished, up to a max number of
|
|
21 |
// times. This is part of the Domain Manager Transition Monitoring feature.
|
|
22 |
//
|
0
|
23 |
//
|
|
24 |
// WARNING: This file contains some APIs which are internal and are subject
|
|
25 |
// to change without notice. Such APIs should therefore not be used
|
|
26 |
// outside the Kernel and Hardware Services package.
|
|
27 |
//
|
|
28 |
|
|
29 |
#ifndef __DOMAIN_POLICY_H__
|
|
30 |
#define __DOMAIN_POLICY_H__
|
|
31 |
|
|
32 |
#include <e32std.h>
|
|
33 |
|
|
34 |
#include <domaindefs.h>
|
|
35 |
|
|
36 |
|
|
37 |
/**
|
|
38 |
Defines the characteristics of a domain.
|
|
39 |
*/
|
|
40 |
struct TDmDomainSpec
|
|
41 |
{
|
279
|
42 |
/** The 16-bit domain identifier */
|
0
|
43 |
TDmDomainId iId;
|
|
44 |
|
279
|
45 |
/** The domain identifier of the domain's parent */
|
0
|
46 |
TDmDomainId iParentId;
|
|
47 |
|
279
|
48 |
/** The security capability required to join this domain */
|
0
|
49 |
TStaticSecurityPolicy iJoinPolicy;
|
|
50 |
|
279
|
51 |
/** The initial state of the domain after construction */
|
0
|
52 |
TDmDomainState iInitState;
|
|
53 |
|
279
|
54 |
/** The total time allowed for the domain to complete a state transition.
|
|
55 |
Members of the domain must acknowledge a transition within this time.
|
|
56 |
Measured in microseconds. */
|
0
|
57 |
TUint32 iTimeBudgetUs;
|
|
58 |
};
|
|
59 |
|
279
|
60 |
#define TDM_DOMAIN_SPEC_END {KDmIdNone, KDmIdNone, _INIT_SECURITY_POLICY_PASS, 0, 0}
|
0
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
/**
|
279
|
65 |
Defines the overall traversal and failure policy for a particular
|
|
66 |
domain hierarchy and is returned by DmPolicy::GetPolicy().
|
|
67 |
Note the failure policy can be overridden for individual
|
|
68 |
states in V2 policies.
|
0
|
69 |
|
279
|
70 |
@see TDmTransitionFailurePolicy
|
0
|
71 |
*/
|
279
|
72 |
class TDmHierarchyPolicy
|
0
|
73 |
{
|
279
|
74 |
public:
|
|
75 |
/** Direction of traversal if target state is after current state */
|
|
76 |
TDmTraverseDirection iPositiveTransitions;
|
|
77 |
|
|
78 |
/** Direction of traversal if target state is before current state */
|
|
79 |
TDmTraverseDirection iNegativeTransitions;
|
|
80 |
|
|
81 |
/** Policy which outlines the action upon transition failure */
|
|
82 |
TDmTransitionFailurePolicy iFailurePolicy;
|
0
|
83 |
};
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
/**
|
279
|
88 |
Defines the characteristics of a state and is used by entry points introduced
|
|
89 |
in version 2 of the policy API. The structure itself is also versioned with V1
|
|
90 |
in use with version 2 policy libraries.
|
|
91 |
|
|
92 |
Policy providers provide an object of this type for each state they want to:
|
|
93 |
- enable the Transition Monitoring feature or/and
|
|
94 |
- override the default failure policy
|
0
|
95 |
|
279
|
96 |
Enabling transition monitoring will allow trusted clients to receive more time
|
|
97 |
to complete their work before final acknowledgment. Enable transition
|
|
98 |
monitoring to ensure a fair completion of the transition e.g. shutdown system.
|
|
99 |
Where transition monitoring is enabled the Domain level timer is not used
|
|
100 |
and iTimeBudgetUs provided in TDmDomainSpec is ignored.
|
|
101 |
|
|
102 |
The global failure policy is returned by DmPolicy::GetPolicy() and in V1
|
|
103 |
policies this applies to all state transitions. iFailurePolicy in this
|
|
104 |
structure allows different failure policies for different state transitions.
|
|
105 |
|
|
106 |
@see DmPolicy::GetStateSpec()
|
0
|
107 |
*/
|
279
|
108 |
struct SDmStateSpecV1
|
0
|
109 |
{
|
279
|
110 |
/** The destination state of the transition */
|
|
111 |
TDmDomainState iState;
|
|
112 |
|
|
113 |
/** Transition Monitoring: member transition timeout granularity, in
|
|
114 |
milliseconds, e.g. 200ms. Set to 0 to not use transition monitoring for
|
|
115 |
this state. */
|
|
116 |
TInt16 iTimeoutMs;
|
|
117 |
|
|
118 |
/** Transition Monitoring: maximum number of times a domain member may be
|
|
119 |
granted an additional timeout period. Set to 0 when transition
|
|
120 |
monitoring not used for this state. */
|
|
121 |
TInt16 iDeferralLimit;
|
|
122 |
|
|
123 |
/** Specifies the failure policy for transitions to the target state, see
|
|
124 |
TDmTransitionFailurePolicy. Overrides the global value returned by
|
|
125 |
the policy function DmPolicyGetPolicy().
|
|
126 |
Set to ETransitionFailureUsePolicyFromOrdinal3 if override not required. */
|
|
127 |
TInt16 iFailurePolicy;
|
0
|
128 |
};
|
279
|
129 |
|
|
130 |
const TInt KSDmStateSpecV1 = 1;
|
|
131 |
|
0
|
132 |
|
|
133 |
|
|
134 |
/**
|
279
|
135 |
Defines the function type for a static function that is implemented by
|
|
136 |
a device's domain policy DLL at ordinal 1.
|
|
137 |
The domain manager uses this function to access the domain
|
|
138 |
hierarchy specification. The pointer returned must point to an array of
|
|
139 |
TDmDomainSpec objects where the last object in the array is defined
|
|
140 |
using the END macro, as shown below.
|
|
141 |
@code
|
|
142 |
. . .
|
|
143 |
TDM_DOMAIN_SPEC_END
|
|
144 |
};
|
|
145 |
@endcode
|
0
|
146 |
|
279
|
147 |
The implementation should return NULL if it is unable to supply the requested
|
|
148 |
information due to an error. This will abort policy loading and hierarchy
|
|
149 |
creation.
|
|
150 |
The implementation must never panic or leave in any way.
|
0
|
151 |
|
279
|
152 |
@see DmPolicy
|
0
|
153 |
*/
|
|
154 |
typedef const TDmDomainSpec* (*DmPolicyGetDomainSpecs)();
|
|
155 |
|
|
156 |
|
|
157 |
/**
|
279
|
158 |
Defines the function type for a static function that is implemented by
|
|
159 |
a device's domain policy DLL at ordinal 2. The domain manager uses this
|
|
160 |
function to release the domain hierarchy specification returned by ordinal 1.
|
|
161 |
The implementation must never panic or leave in any way.
|
0
|
162 |
|
279
|
163 |
@see DmPolicy
|
0
|
164 |
*/
|
|
165 |
typedef void (*DmPolicyRelease) (const TDmDomainSpec* aDomainSpec);
|
|
166 |
|
|
167 |
|
|
168 |
/**
|
279
|
169 |
Defines the function type for a static function that is implemented by
|
|
170 |
a device's domain policy DLL at ordinal 3. The domain manager uses this
|
|
171 |
function to access the hierarchy's policy.
|
|
172 |
The implementation may return a system-wide error code if it encounters an
|
|
173 |
error. This will abort policy loading and hierarchy creation.
|
|
174 |
The implementation must never panic or leave in any way.
|
0
|
175 |
|
279
|
176 |
@see DmPolicy
|
0
|
177 |
*/
|
|
178 |
typedef TInt (*DmPolicyGetPolicy) (TDmHierarchyPolicy& aPolicy);
|
|
179 |
|
279
|
180 |
|
0
|
181 |
/**
|
279
|
182 |
Defines the function type for a static function that is implemented by
|
|
183 |
a device's domain policy DLL at ordinal 4. The domain manager uses this
|
|
184 |
function to obtain the state specification to configure the client transition
|
|
185 |
monitoring feature.
|
|
186 |
This method is new in V2 of the domain policy and should not be present in
|
|
187 |
V1 policy library.
|
|
188 |
The implementation must never panic or leave in any way.
|
|
189 |
|
|
190 |
The implementation returns either an error or the version of the state
|
|
191 |
specification structure used in the array pointed to by aPtr on exit.
|
|
192 |
When the return value is >=1, aNumElements must be >0.
|
|
193 |
Where a state specification is not required (i.e. client transition monitoring
|
|
194 |
is not required) the implementation returns 0. When an error occurs a negative
|
|
195 |
system-wide error code is returned. In both these cases the output parameters are
|
|
196 |
ignored.
|
|
197 |
|
|
198 |
@see SDmStateSpecV1
|
|
199 |
@see DmPolicy
|
|
200 |
*/
|
|
201 |
typedef TInt (*DmPolicyGetStateSpec) (TAny*& aPtr, TUint& aNumElements);
|
0
|
202 |
|
279
|
203 |
/**
|
|
204 |
Defines the function type for a static function that is implemented by
|
|
205 |
a device's domain policy DLL at ordinal 5. The domain manager uses this
|
|
206 |
function to release the state specification returned by ordinal 4. The
|
|
207 |
implementation may be empty and simply return if no release action needs
|
|
208 |
to be taken.
|
|
209 |
|
|
210 |
This method is new in V2 of the domain policy and should not be present in
|
|
211 |
V1 policy library.
|
|
212 |
The implementation must never panic or leave in any way.
|
|
213 |
|
|
214 |
@see DmPolicy
|
|
215 |
*/
|
|
216 |
typedef void (*DmPolicyReleaseStateSpec) (TAny* aStateSpec);
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
/**
|
|
221 |
A set of static functions implemented in a domain hierarchy policy DLL that
|
|
222 |
the domain manager uses to access and release the domain hierarchy and
|
|
223 |
domain state specifications.
|
|
224 |
|
|
225 |
@see DmPolicyOrdinals
|
0
|
226 |
*/
|
|
227 |
class DmPolicy
|
|
228 |
{
|
|
229 |
public:
|
279
|
230 |
// Original policy version methods
|
0
|
231 |
IMPORT_C static const TDmDomainSpec* GetDomainSpecs();
|
|
232 |
IMPORT_C static void Release(const TDmDomainSpec* aDomainSpec);
|
|
233 |
IMPORT_C static TInt GetPolicy(TDmHierarchyPolicy& aPolicy);
|
279
|
234 |
|
|
235 |
// Version 2 methods
|
|
236 |
IMPORT_C static TInt GetStateSpec(TAny*& aPtr, TUint& aNumElements);
|
|
237 |
IMPORT_C static void ReleaseStateSpec(TAny* aStateSpec);
|
0
|
238 |
};
|
|
239 |
|
|
240 |
|
279
|
241 |
|
0
|
242 |
/**
|
279
|
243 |
Describes the purpose (and thus each function prototype) of each ordinal in the
|
|
244 |
policy DLL. There are two versions of this DLL in use:
|
|
245 |
- V1 DLLs implement ordinals 1..3
|
|
246 |
- V2 DLLs implement ordinals 1..5
|
|
247 |
|
|
248 |
@see DmPolicy
|
0
|
249 |
*/
|
|
250 |
enum DmPolicyOrdinals
|
|
251 |
{
|
279
|
252 |
// Policy DLL version 1 ordinals
|
0
|
253 |
EDmPolicyGetDomainSpecs = 1,
|
|
254 |
EDmPolicyRelease,
|
279
|
255 |
EDmPolicyGetPolicy,
|
|
256 |
|
|
257 |
// Policy DLL version 2 ordinals for the "Transition Monitoring" feature.
|
|
258 |
// These entry points are not needed in V1 policy libraries.
|
|
259 |
EDmPolicyGetStateSpec,
|
|
260 |
EDmPolicyReleaseStateSpec
|
0
|
261 |
};
|
|
262 |
|
279
|
263 |
|
|
264 |
|
0
|
265 |
#endif
|