|
1 /* |
|
2 * Copyright (c) 2007-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 * Implements an interface to keep and access decision record fields. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalTechnology |
|
23 @prototype |
|
24 */ |
|
25 #include <s32strm.h> |
|
26 #include <ups/upstypes.h> |
|
27 #include <ups/upsconst.h> |
|
28 #include "upslog.h" |
|
29 #include <ups/upserr.h> |
|
30 #include "upscommon.h" |
|
31 |
|
32 namespace UserPromptService { |
|
33 |
|
34 CDecisionRecord::CDecisionRecord() |
|
35 /** |
|
36 Constructor for the decision record. |
|
37 */ |
|
38 { |
|
39 |
|
40 } |
|
41 |
|
42 CDecisionRecord::CDecisionRecord(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid, |
|
43 const TUint8 aResult, const TUint16& aMajorPolicyVersion, const TUint32 aEvaluatorInfo, const TUint32& aRecordId) |
|
44 /** |
|
45 Constructor for the decision record. Assigns the ID values. |
|
46 */ |
|
47 :iClientSid(aClientSid),iEvaluatorId(aEvaluatorId), |
|
48 iServiceId(aServiceId),iServerSid(aServerSid), |
|
49 iResult(aResult),iMajorPolicyVersion(aMajorPolicyVersion), |
|
50 iRecordId(aRecordId),iEvaluatorInfo(aEvaluatorInfo) |
|
51 { |
|
52 |
|
53 } |
|
54 |
|
55 |
|
56 CDecisionRecord::~CDecisionRecord() |
|
57 /** |
|
58 Destructor for the decision record object |
|
59 */ |
|
60 { |
|
61 iFingerprint.Close(); |
|
62 iClientEntity.Close(); |
|
63 iDescription.Close(); |
|
64 } |
|
65 |
|
66 EXPORT_C CDecisionRecord* CDecisionRecord::NewL(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid, |
|
67 const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TDesC& aDescription, const TUint8 aResult, |
|
68 const TUint16& aMajorPolicyVersion, const TUint32 aEvaluatorInfo, const TUint32& aRecordId) |
|
69 /** |
|
70 Creates a decision record object. The function leaves, if creation of the record object fails. |
|
71 |
|
72 @param aClientSid Secure Id of client application |
|
73 @param aEvaluatorId UID for the policy evaluator DLL |
|
74 @param aServiceId UID for service e.g. sms, mms, telephony, gprs |
|
75 @param aServerSid Secure Id for the system server that the decision applies to |
|
76 @param aFingerprint Hash of the destination and/or opaque data. Maximum length is 32 bytes. |
|
77 @param aClientEntity The name of the entity within the client that requested the service. Maximum length is 32 bytes. |
|
78 @param aDescription A copy of description and/or opaque. |
|
79 @param aResult Whether the request should be approved (=1) or denied (=0) |
|
80 @param aMajorPolicyVersion The major version of the policy file. |
|
81 @param aEvaluatorInfo Policy evaluator specific data |
|
82 @param aRecordId An auto-incrementing record number. |
|
83 |
|
84 @return A pointer to the newly allocated decision record object, if creation is successful. |
|
85 */ |
|
86 { |
|
87 CDecisionRecord* self = CDecisionRecord::NewLC(aClientSid,aEvaluatorId,aServiceId,aServerSid,aFingerprint,aClientEntity, |
|
88 aDescription,aResult,aMajorPolicyVersion,aEvaluatorInfo,aRecordId); |
|
89 CleanupStack::Pop(self); |
|
90 return self; |
|
91 } |
|
92 |
|
93 |
|
94 EXPORT_C CDecisionRecord* CDecisionRecord::NewLC(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid, |
|
95 const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TDesC& aDescription, const TUint8 aResult, |
|
96 const TUint16& aMajorPolicyVersion, const TUint32 aEvaluatorInfo, const TUint32& aRecordId) |
|
97 /** |
|
98 Creates a decision record object. The function leaves, if creation of the record object fails. |
|
99 |
|
100 @return A pointer to the newly allocated decision record object, if creation is successful. |
|
101 The pointer is also put onto the cleanup stack. |
|
102 @see CDecisionRecord::NewL() |
|
103 */ |
|
104 { |
|
105 CDecisionRecord* self = new (ELeave) CDecisionRecord(aClientSid,aEvaluatorId,aServiceId,aServerSid,aResult, |
|
106 aMajorPolicyVersion,aEvaluatorInfo,aRecordId); |
|
107 CleanupStack::PushL(self); |
|
108 self->ConstructL(aFingerprint,aClientEntity,aDescription); |
|
109 return self; |
|
110 } |
|
111 |
|
112 EXPORT_C CDecisionRecord* CDecisionRecord::NewLC() |
|
113 /** |
|
114 Creates a decision record object. The function leaves, if creation of the record object fails. |
|
115 |
|
116 @return A pointer to the newly allocated decision record object, if creation is successful. |
|
117 The pointer is also put onto the cleanup stack. |
|
118 */ |
|
119 { |
|
120 CDecisionRecord* self = new (ELeave) CDecisionRecord(); |
|
121 CleanupStack::PushL(self); |
|
122 return self; |
|
123 } |
|
124 |
|
125 void CDecisionRecord::ConstructL(const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TDesC& aDescription) |
|
126 /** |
|
127 Second phase constructor for the decision record. Sets members allocated on the heap. |
|
128 The function leaves, if any buffer allocation fails. |
|
129 @see CDecisionRecord::NewL() |
|
130 */ |
|
131 { |
|
132 |
|
133 iFingerprint.CreateL(aFingerprint); |
|
134 |
|
135 iClientEntity.CreateL(aClientEntity); |
|
136 |
|
137 iDescription.CreateL(aDescription); |
|
138 |
|
139 ValidateL(); |
|
140 } |
|
141 |
|
142 void CDecisionRecord::ValidateL() |
|
143 /** |
|
144 Check both the fingerprint and client entity are not too long. |
|
145 An absent fingerprint or client entity is represent by an empty string. |
|
146 */ |
|
147 { |
|
148 if(iFingerprint.Length() > (TInt)KUpsMaxFingerprintLength) |
|
149 { |
|
150 DEBUG_PRINTF2(_L8("The fingerprint length (%d) has not been satisfied during decision construction!"),iFingerprint.Length()); |
|
151 User::Leave(KErrUpsBadFingerprintLength); |
|
152 } |
|
153 |
|
154 if(iClientEntity.Length() > (TInt)KUpsMaxClientEntityLength) |
|
155 { |
|
156 DEBUG_PRINTF2(_L8("The client entity length (%d) has not been satisfied during decision construction!"),iClientEntity.Length()); |
|
157 User::Leave(KErrUpsBadClientEntityLength); |
|
158 } |
|
159 } |
|
160 |
|
161 EXPORT_C void CDecisionRecord::ExternalizeL(RWriteStream& aStream) const |
|
162 /** |
|
163 Externalise this CDecisionRecord object to the specified stream. |
|
164 */ |
|
165 { |
|
166 aStream.WriteUint32L(iClientSid.iId); |
|
167 aStream.WriteInt32L(iEvaluatorId.iUid); |
|
168 aStream.WriteInt32L(iServiceId.iUid); |
|
169 aStream.WriteUint32L(iServerSid.iId); |
|
170 aStream << iFingerprint; |
|
171 aStream << iClientEntity; |
|
172 aStream << iDescription; |
|
173 aStream << iResult; |
|
174 aStream << iMajorPolicyVersion; |
|
175 aStream << iRecordId; |
|
176 aStream << iEvaluatorInfo; |
|
177 } |
|
178 |
|
179 EXPORT_C void CDecisionRecord::InternalizeL(RReadStream& aStream) |
|
180 /** |
|
181 Internalise this CDecisionRecord object from the specified stream. |
|
182 */ |
|
183 { |
|
184 iClientSid.iId= aStream.ReadUint32L(); |
|
185 iEvaluatorId.iUid = aStream.ReadInt32L(); |
|
186 iServiceId.iUid = aStream.ReadInt32L(); |
|
187 iServerSid.iId = aStream.ReadUint32L(); |
|
188 |
|
189 iFingerprint.Close(); |
|
190 iFingerprint.CreateL(aStream, KMaskDesLength8); |
|
191 |
|
192 iClientEntity.Close(); |
|
193 iClientEntity.CreateL(aStream, KMaskDesLength8); |
|
194 |
|
195 iDescription.Close(); |
|
196 iDescription.CreateL(aStream, KMaskDesLength16); |
|
197 |
|
198 aStream >> iResult; |
|
199 aStream >> iMajorPolicyVersion; |
|
200 aStream >> iRecordId; |
|
201 aStream >> iEvaluatorInfo; |
|
202 |
|
203 ValidateL(); |
|
204 } |
|
205 |
|
206 CDecisionFilter::CDecisionFilter() |
|
207 /** |
|
208 Constructor for an empty decision filter. |
|
209 */ |
|
210 { |
|
211 |
|
212 } |
|
213 |
|
214 |
|
215 CDecisionFilter::CDecisionFilter(const TSecureId& aClientSid, const TUid& aEvaluatorId, |
|
216 const TUid& aServiceId, const TSecureId& aServerSid, const TUint16& aVersion) |
|
217 :iClientSid(aClientSid),iEvaluatorId(aEvaluatorId),iServiceId(aServiceId), |
|
218 iServerSid(aServerSid),iMajorPolicyVersion(aVersion) |
|
219 /** |
|
220 Constructor for the decision filter. Assigns the ID values. |
|
221 */ |
|
222 { |
|
223 iSetFlag[KPosClientSid] = KSetClientSid | UserPromptService::EEqual; |
|
224 iSetFlag[KPosEvaluatorId] = KSetEvaluatorId | UserPromptService::EEqual; |
|
225 iSetFlag[KPosServiceId] = KSetServiceId | UserPromptService::EEqual; |
|
226 iSetFlag[KPosServerSid] = KSetServerSid | UserPromptService::EEqual; |
|
227 iSetFlag[KPosMajorPolicyVersion] = KSetMajorPolicyVersion | UserPromptService::EEqual; |
|
228 } |
|
229 |
|
230 |
|
231 CDecisionFilter::~CDecisionFilter() |
|
232 /** |
|
233 Destructor for the decision filter |
|
234 */ |
|
235 { |
|
236 delete iFingerprint; |
|
237 delete iClientEntity; |
|
238 } |
|
239 |
|
240 |
|
241 EXPORT_C CDecisionFilter* CDecisionFilter::NewL() |
|
242 /** |
|
243 Creates an empty filter object. The function is used to define any number of filter keys. |
|
244 It leaves, if the creation of the filter object fails. |
|
245 |
|
246 @return A pointer to the newly allocated filter object, if creation is successful. |
|
247 */ |
|
248 { |
|
249 CDecisionFilter* self = CDecisionFilter::NewLC(); |
|
250 CleanupStack::Pop(self); |
|
251 return self; |
|
252 } |
|
253 |
|
254 |
|
255 EXPORT_C CDecisionFilter* CDecisionFilter::NewLC() |
|
256 /** |
|
257 Creates an empty filter object. The function is used to define any number of filter keys. |
|
258 It leaves, if the creation of the filter object fails. |
|
259 |
|
260 @return A pointer to the newly allocated filter object, if creation is successful. |
|
261 The pointer is also put onto the cleanup stack. |
|
262 */ |
|
263 { |
|
264 CDecisionFilter* self = new (ELeave) CDecisionFilter(); |
|
265 CleanupStack::PushL(self); |
|
266 return self; |
|
267 } |
|
268 |
|
269 |
|
270 EXPORT_C CDecisionFilter* CDecisionFilter::NewL(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid, |
|
271 const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TUint16& aVersion) |
|
272 /** |
|
273 Creates a filter object and assigns all filter keys. The function leaves, if creation of the filter object fails. |
|
274 |
|
275 @param aClientSid Secure Id of client application |
|
276 @param aEvaluatorId UID for the policy evaluator DLL |
|
277 @param aServiceId UID for service e.g. sms, mms, telephony, gprs |
|
278 @param aServerSid Secure Id for the system server that the decision applies to |
|
279 @param aFingerprint Hash of the destination and/or opaque data. |
|
280 @param aClientEntity The name of the entity within the client that requested the service. |
|
281 @param aVersion Major version of policy file. |
|
282 @return A pointer to the newly allocated filter object, if creation is successful. |
|
283 */ |
|
284 { |
|
285 CDecisionFilter* self = CDecisionFilter::NewLC(aClientSid,aEvaluatorId,aServiceId,aServerSid,aFingerprint,aClientEntity,aVersion); |
|
286 CleanupStack::Pop(self); |
|
287 return self; |
|
288 } |
|
289 |
|
290 |
|
291 EXPORT_C CDecisionFilter* CDecisionFilter::NewLC(const TSecureId& aClientSid,const TUid& aEvaluatorId,const TUid& aServiceId,const TSecureId& aServerSid, |
|
292 const TDesC8& aFingerprint,const TDesC8& aClientEntity,const TUint16& aVersion) |
|
293 /** |
|
294 Creates a filter object and assigns all filter keys. The function leaves, if creation of the filter object fails. |
|
295 |
|
296 @param aClientSid Secure Id of client application |
|
297 @param aEvaluatorId UID for the policy evaluator DLL |
|
298 @param aServiceId UID for service e.g. sms, mms, telephony, gprs |
|
299 @param aServerSid Secure Id for the system server that the decision applies to |
|
300 @param aFingerprint Hash of the destination and/or opaque data. |
|
301 @param aClientEntity The name of the entity within the client that requested the service. |
|
302 @param aVersion Major version of policy file. |
|
303 @return A pointer to the newly allocated filter object, if creation is successful. |
|
304 The pointer is also put onto the cleanup stack. |
|
305 */ |
|
306 { |
|
307 CDecisionFilter* self = new (ELeave) CDecisionFilter(aClientSid,aEvaluatorId,aServiceId,aServerSid,aVersion); |
|
308 CleanupStack::PushL(self); |
|
309 self->ConstructL(aFingerprint,aClientEntity); |
|
310 return self; |
|
311 } |
|
312 |
|
313 |
|
314 void CDecisionFilter::ConstructL(const TDesC8& aFingerprint, const TDesC8& aClientEntity) |
|
315 /** |
|
316 Second phase constructor for the decision filter. Sets members allocated on the heap. |
|
317 The function leaves, if any buffer allocation fails. |
|
318 */ |
|
319 { |
|
320 |
|
321 iFingerprint = aFingerprint.AllocL(); |
|
322 iSetFlag[KPosFingerprint] |= KSetFingerprint; |
|
323 |
|
324 iClientEntity = aClientEntity.AllocL(); |
|
325 iSetFlag[KPosClientEntity] |= KSetClientEntity; |
|
326 |
|
327 ValidateL(); |
|
328 } |
|
329 |
|
330 void CDecisionFilter::ValidateL() |
|
331 /** |
|
332 Check fingerprint and client entity lengths are valid. |
|
333 */ |
|
334 { |
|
335 if((iSetFlag[KPosFingerprint] & KSetFingerprint) && |
|
336 ((iFingerprint == 0) || (iFingerprint->Length() > KUpsMaxFingerprintLength))) |
|
337 { |
|
338 DEBUG_PRINTF2(_L8("The fingerprint length (%d) has not been satisfied during filter construction!"),(iFingerprint) ? (iFingerprint->Length()) : (0)); |
|
339 User::Leave(KErrUpsBadFingerprintLength); |
|
340 } |
|
341 |
|
342 if((iSetFlag[KPosClientEntity] & KSetClientEntity) && |
|
343 ((iClientEntity == 0) || (iClientEntity->Length() > KUpsMaxClientEntityLength))) |
|
344 { |
|
345 DEBUG_PRINTF2(_L8("The client entity length (%d) has not been satisfied during filter construction!"),(iClientEntity) ? (iClientEntity->Length()) : (0)); |
|
346 User::Leave(KErrUpsBadClientEntityLength); |
|
347 } |
|
348 } |
|
349 |
|
350 EXPORT_C void CDecisionFilter::SetClientSid(const TSecureId& aSid, TComparisonOp aOp) |
|
351 /** |
|
352 Sets the Secure ID of the client application. |
|
353 |
|
354 @param aUid SID for the client application |
|
355 @param aOp Comparision operator which is used to create SQL statement. |
|
356 */ |
|
357 { |
|
358 iClientSid = aSid; |
|
359 iSetFlag[KPosClientSid] |= KSetClientSid; |
|
360 iSetFlag[KPosClientSid] |= aOp; |
|
361 } |
|
362 |
|
363 |
|
364 EXPORT_C void CDecisionFilter::SetEvaluatorId(const TUid& aUid, TComparisonOp aOp) |
|
365 /** |
|
366 Sets the UID of the policy evaluator DLL. |
|
367 |
|
368 @param aUid UID for the policy evaluator DLL |
|
369 @param aOp Comparision operator which is used to create SQL statement. |
|
370 */ |
|
371 { |
|
372 iEvaluatorId = aUid; |
|
373 iSetFlag[KPosEvaluatorId] |= KSetEvaluatorId; |
|
374 iSetFlag[KPosEvaluatorId] |= aOp; |
|
375 } |
|
376 |
|
377 |
|
378 EXPORT_C void CDecisionFilter::SetServiceId(const TUid& aUid, TComparisonOp aOp) |
|
379 /** |
|
380 Sets the Secure ID of the service. |
|
381 |
|
382 @param aUid UID for the service |
|
383 @param aOp Comparision operator which is used to create SQL statement. |
|
384 */ |
|
385 { |
|
386 iServiceId = aUid; |
|
387 iSetFlag[KPosServiceId] |= KSetServiceId; |
|
388 iSetFlag[KPosServiceId] |= aOp; |
|
389 } |
|
390 |
|
391 |
|
392 EXPORT_C void CDecisionFilter::SetServerSid(const TSecureId& aSid, TComparisonOp aOp) |
|
393 /** |
|
394 Sets the Secure ID of the system server. |
|
395 |
|
396 @param aUid UID for the system server |
|
397 @param aOp Comparision operator which is used to create SQL statement. |
|
398 */ |
|
399 { |
|
400 iServerSid = aSid; |
|
401 iSetFlag[KPosServerSid] |= KSetServerSid; |
|
402 iSetFlag[KPosServerSid] |= aOp; |
|
403 } |
|
404 |
|
405 |
|
406 EXPORT_C void CDecisionFilter::SetFingerprintL(const TDesC8& aFingerprint, TComparisonOp aOp) |
|
407 /** |
|
408 Sets the fingerprint. A buffer is allocated on the heap and aFingerprint copied into it. |
|
409 The function leaves, if the buffer allocation fails. |
|
410 |
|
411 @param aFingerprint Hash of the destination and/or opaque data. (Maximum length is 32 bytes) |
|
412 @param aOp Comparision operator which is used to create SQL statement. |
|
413 */ |
|
414 { |
|
415 //Fingerprint's length can not be longer than KUpsMaxFingerprintLength |
|
416 if(aFingerprint.Length() > KUpsMaxFingerprintLength) |
|
417 { |
|
418 User::Leave(KErrUpsBadFingerprintLength); |
|
419 } |
|
420 |
|
421 delete iFingerprint; |
|
422 iFingerprint = 0; |
|
423 |
|
424 iFingerprint = aFingerprint.AllocL(); |
|
425 iSetFlag[KPosFingerprint] |= KSetFingerprint; |
|
426 iSetFlag[KPosFingerprint] |= aOp; |
|
427 } |
|
428 |
|
429 |
|
430 EXPORT_C void CDecisionFilter::SetClientEntityL(const TDesC8& aClientEntity, TComparisonOp aOp) |
|
431 /** |
|
432 Sets the client entity. A buffer is allocated on the heap and aClientEntity copied into it. |
|
433 The function leaves, if the buffer allocation fails. |
|
434 |
|
435 @param aClientEntity The name of the entity within the client. (Maximum length is 32 bytes) |
|
436 @param aOp Comparision operator which is used to create SQL statement. |
|
437 */ |
|
438 { |
|
439 //ClientEntity's length can not be longer than KUpsMaxClientEntityLength |
|
440 if(aClientEntity.Length() > KUpsMaxClientEntityLength) |
|
441 { |
|
442 User::Leave(KErrUpsBadClientEntityLength); |
|
443 } |
|
444 |
|
445 delete iClientEntity; |
|
446 iClientEntity = 0; |
|
447 |
|
448 iClientEntity = aClientEntity.AllocL(); |
|
449 iSetFlag[KPosClientEntity] |= KSetClientEntity; |
|
450 iSetFlag[KPosClientEntity] |= aOp; |
|
451 } |
|
452 |
|
453 |
|
454 EXPORT_C void CDecisionFilter::SetMajorPolicyVersion(const TUint16& aVersion, TComparisonOp aOp) |
|
455 /** |
|
456 Sets the major version of the policy file. |
|
457 |
|
458 @param aVersion Major policy version. |
|
459 @param aOp Comparision operator which is used to create SQL statement. |
|
460 */ |
|
461 { |
|
462 iMajorPolicyVersion = aVersion; |
|
463 iSetFlag[KPosMajorPolicyVersion] |= KSetMajorPolicyVersion; |
|
464 iSetFlag[KPosMajorPolicyVersion] |= aOp; |
|
465 } |
|
466 |
|
467 |
|
468 EXPORT_C void CDecisionFilter::SetRecordId(const TUint32& aId, TComparisonOp aOp) |
|
469 /** |
|
470 Sets the unique Id number of the decision record which is searched. |
|
471 |
|
472 @param aId A unique record Id. |
|
473 @param aOp Comparision operator which is used to create SQL statement. |
|
474 */ |
|
475 { |
|
476 iRecordId = aId; |
|
477 iSetFlag[KPosRecordId] |= KSetRecordId; |
|
478 iSetFlag[KPosRecordId] |= aOp; |
|
479 } |
|
480 |
|
481 |
|
482 EXPORT_C void CDecisionFilter::SetDescriptionL(const TDesC& aDescription, const TComparisonOp aOp) |
|
483 /** |
|
484 Sets the description field. A buffer is allocated on the heap and aDescription copied into it. |
|
485 The function leaves, if the buffer allocation fails. |
|
486 |
|
487 @param aDescription A copy of description and/or opaque. (Maximum length is 32 bytes) |
|
488 @param aOp Comparision operator which is used to create SQL statement. |
|
489 */ |
|
490 { |
|
491 delete iDescription; |
|
492 iDescription = 0; |
|
493 |
|
494 iDescription = aDescription.AllocL(); |
|
495 iSetFlag[KPosDescription] |= KSetDescription; |
|
496 iSetFlag[KPosDescription] |= aOp; |
|
497 } |
|
498 |
|
499 |
|
500 EXPORT_C void CDecisionFilter::SetResult(const TUint8& aResult, const TComparisonOp aOp) |
|
501 /** |
|
502 Sets the result field of the decision record which is searched. |
|
503 |
|
504 @param aResult Whether the request should be approved. |
|
505 @param aOp Comparision operator which is used to create SQL statement. |
|
506 */ |
|
507 { |
|
508 iResult = aResult; |
|
509 iSetFlag[KPosResult] |= KSetResult; |
|
510 iSetFlag[KPosResult] |= aOp; |
|
511 } |
|
512 |
|
513 |
|
514 EXPORT_C void CDecisionFilter::SetEvaluatorInfo(const TUint32& aEvaluatorInfo, const TComparisonOp aOp) |
|
515 /** |
|
516 Sets the evaluator info field of the decision record which is searched. |
|
517 |
|
518 @param aEvaluatorInfo Policy evaluator specific data |
|
519 @param aOp Comparision operator which is used to create SQL statement. |
|
520 */ |
|
521 { |
|
522 iEvaluatorInfo = aEvaluatorInfo; |
|
523 iSetFlag[KPosEvaluatorInfo] |= KSetEvaluatorInfo; |
|
524 iSetFlag[KPosEvaluatorInfo] |= aOp; |
|
525 } |
|
526 |
|
527 |
|
528 EXPORT_C void CDecisionFilter::ExternalizeL(RWriteStream& aStream) const |
|
529 /** |
|
530 Externalise this CDecisionFilter object to the specified stream. |
|
531 */ |
|
532 { |
|
533 aStream << iClientSid.iId; // TSecureId |
|
534 aStream << iEvaluatorId.iUid; // TUid |
|
535 aStream << iServiceId.iUid; // TUid |
|
536 aStream << iServerSid.iId; // TSecureId |
|
537 |
|
538 aStream << ((iFingerprint) ? (*iFingerprint) : (KNullDesC8())); // HBufC8* |
|
539 aStream << ((iClientEntity) ? (*iClientEntity) : (KNullDesC8())); // HBufC8* |
|
540 |
|
541 for(int i = 0; i < KFilterKeysNumber; ++i) |
|
542 { |
|
543 aStream.WriteUint16L(iSetFlag[i]);// TUint16 |
|
544 } |
|
545 |
|
546 aStream << iMajorPolicyVersion;// TUint16 |
|
547 aStream << iRecordId;// TUint32 |
|
548 } |
|
549 EXPORT_C void CDecisionFilter::InternalizeL(RReadStream& aStream) |
|
550 /** |
|
551 Internalise this CDecisionFilter object from the specified stream. |
|
552 */ |
|
553 { |
|
554 iClientSid.iId= aStream.ReadUint32L(); // TSecureId |
|
555 iEvaluatorId.iUid= aStream.ReadInt32L(); // TUid |
|
556 iServiceId.iUid= aStream.ReadInt32L(); // TUid |
|
557 iServerSid.iId= aStream.ReadUint32L(); // TSecureId |
|
558 |
|
559 // iFingerprint is always present in stream, so internalise it and then delete it if it is not setup. |
|
560 delete iFingerprint; |
|
561 iFingerprint = 0; |
|
562 iFingerprint = HBufC8::NewL(aStream, KMaskDesLength8); |
|
563 |
|
564 // iClientEntity is always present in stream, so internalise it and then delete it if it is not setup. |
|
565 delete iClientEntity; |
|
566 iClientEntity = 0; |
|
567 iClientEntity = HBufC8::NewL(aStream, KMaskDesLength8); |
|
568 |
|
569 for(int i = 0; i < KFilterKeysNumber; ++i) |
|
570 { |
|
571 iSetFlag[i] = aStream.ReadUint16L();// TUint16 |
|
572 } |
|
573 |
|
574 // Delete iFingerprint if not setup |
|
575 if((iSetFlag[KPosFingerprint] & KSetFingerprint) == 0) |
|
576 { |
|
577 delete iFingerprint; |
|
578 iFingerprint = 0; |
|
579 } |
|
580 |
|
581 // Delete iClientEntity if not setup |
|
582 if((iSetFlag[KPosClientEntity] & KSetClientEntity) == 0) |
|
583 { |
|
584 delete iClientEntity; |
|
585 iClientEntity = 0; |
|
586 } |
|
587 |
|
588 iMajorPolicyVersion = aStream.ReadUint16L();// TUint16 |
|
589 iRecordId = aStream.ReadUint32L();// TUint32 |
|
590 |
|
591 ValidateL(); |
|
592 } |
|
593 |
|
594 } // End of UserPromptService namespace |
|
595 // End of file |