|
1 /* |
|
2 * Copyright (c) 2006-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 "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 #ifndef CMMSECURITYTSY_H |
|
21 #define CMMSECURITYTSY_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <et_tsy.h> |
|
26 #include <etelmm.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CMmPhoneTsy; |
|
30 class CMmDataPackage; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * CMmPhoneTsy contains mode-independent phone functionality. |
|
36 * Extension request handles and parameters are stored as attributes. |
|
37 */ |
|
38 NONSHARABLE_CLASS( CMmSecurityTsy ) : public CBase |
|
39 { |
|
40 private: |
|
41 |
|
42 /** |
|
43 * Struct to hold GetSecurityCodeInfo requests data. |
|
44 */ |
|
45 struct TGetSecurityCodeInfoRequest |
|
46 { |
|
47 /** ETel request handle */ |
|
48 TTsyReqHandle iReqHandle; |
|
49 /** Security code type */ |
|
50 RMobilePhone::TMobilePhoneSecurityCode iSecurityCode; |
|
51 /** Pointer to client-side data */ |
|
52 TDes8* iSecurityCodeInfo; |
|
53 }; |
|
54 |
|
55 public: // Constructors and destructor |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * return CMmPhoneTsy*: created phone object |
|
60 */ |
|
61 static CMmSecurityTsy* NewL( CMmPhoneTsy* aPhoneTsy ); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 virtual ~CMmSecurityTsy(); |
|
67 |
|
68 // New functions |
|
69 |
|
70 /** |
|
71 * Handles extended client requests. Uses TRAP to ensure functioning on |
|
72 * memory allocation failure |
|
73 * |
|
74 * |
|
75 * @param aTsyReqHandle TSY request handle |
|
76 * @param aIpc request IPC number |
|
77 * @param aPackage packaged request parameters |
|
78 * @return result of the request |
|
79 */ |
|
80 TInt DoExtFuncL( const TTsyReqHandle aTsyReqHandle, |
|
81 const TInt aIpc, |
|
82 const TDataPackage& aPackage ); |
|
83 |
|
84 /** |
|
85 * Cancels request that's IPC number and request handle are given in |
|
86 * parameters |
|
87 * |
|
88 * |
|
89 * @param aIpc request IPC number |
|
90 * @param aTsyReqHandle TSY request handle |
|
91 * @return result of the request |
|
92 */ |
|
93 virtual TInt CancelService( const TInt aIpc, |
|
94 const TTsyReqHandle aTsyReqHandle ); |
|
95 |
|
96 /** |
|
97 * Completes security capabilities change notification |
|
98 * |
|
99 * |
|
100 * @param aDataPackage |
|
101 * @return KErrNone |
|
102 */ |
|
103 virtual TInt CompleteNotifySecurityCapsChange( TUint32 aCaps ); |
|
104 |
|
105 /** |
|
106 * Notifies client about security event |
|
107 * |
|
108 * |
|
109 * @param aEvent security event |
|
110 * @param aErrorCode error/success code |
|
111 */ |
|
112 virtual void CompleteNotifySecurityEventL( |
|
113 RMobilePhone::TMobilePhoneSecurityEvent aEvent, |
|
114 TInt aErrorCode ); |
|
115 |
|
116 /** |
|
117 * Completes lock state setting |
|
118 * |
|
119 * |
|
120 * @param aErrorCode: error/success code |
|
121 * @param aStatus current lock status |
|
122 * @param aSetting current lock setting |
|
123 * |
|
124 */ |
|
125 virtual void CompleteSetLockSetting( TInt aErrorCode, |
|
126 RMobilePhone::TMobilePhoneLockStatus aStatus, |
|
127 RMobilePhone::TMobilePhoneLockSetting aSetting ); |
|
128 |
|
129 /** |
|
130 * Completes security code change |
|
131 * |
|
132 * @param aErrorCode |
|
133 * @return KErrNone |
|
134 */ |
|
135 virtual TInt CompleteChangeSecurityCode( TInt aErrorCode ); |
|
136 |
|
137 /** |
|
138 * Completes security code verification |
|
139 * |
|
140 * |
|
141 * @param aErrorCode |
|
142 */ |
|
143 virtual void CompleteVerifySecurityCodeL( TInt aErrorCode ); |
|
144 |
|
145 /** |
|
146 * Completes security code verification aborting |
|
147 * |
|
148 * |
|
149 * @param aErrorCode |
|
150 */ |
|
151 virtual void CompleteAbortSecurityCode( TInt aErrorCode ); |
|
152 |
|
153 /** |
|
154 * Completes lock information notification |
|
155 * |
|
156 * |
|
157 * @param aDataPackage |
|
158 * @return KErrNone |
|
159 */ |
|
160 virtual void CompleteNotifyLockInfoChange( |
|
161 CMmDataPackage* aDataPackage, TInt aErrorCode ); |
|
162 |
|
163 /** |
|
164 * Sets iPin1DisableSupported flag to EFalse, no support for PIN |
|
165 * disable |
|
166 * |
|
167 * |
|
168 */ |
|
169 virtual void SetPin1DisableNotSupported(); |
|
170 |
|
171 /** |
|
172 * Complete get lock info request |
|
173 * |
|
174 * |
|
175 * @param aDataPackage |
|
176 */ |
|
177 virtual void CompleteGetLockInfo( CMmDataPackage* aDataPackage, |
|
178 TInt aErrorCode ); |
|
179 |
|
180 /** |
|
181 * Complete GetSecurityCodeInfo request |
|
182 * |
|
183 * @param aDataPackage |
|
184 * @param aErrorCode |
|
185 */ |
|
186 virtual void CompleteGetSecurityCodeInfo( |
|
187 CMmDataPackage* aDataPackage, TInt aErrorCode ); |
|
188 |
|
189 /** |
|
190 * Complete NotifySecurityCodeInfoChange notification |
|
191 * |
|
192 * @param aDataPackage |
|
193 * @param aErrorCode |
|
194 */ |
|
195 virtual void CompleteNotifySecurityCodeInfoChange( |
|
196 CMmDataPackage* aDataPackage, TInt aErrorCode ); |
|
197 |
|
198 private: |
|
199 |
|
200 /** |
|
201 * C++ default constructor. |
|
202 */ |
|
203 CMmSecurityTsy(void); |
|
204 |
|
205 /** |
|
206 * Class attributes are created in ConstructL |
|
207 */ |
|
208 void ConstructL( void ); |
|
209 |
|
210 /** |
|
211 * Delivers current security capabilies |
|
212 * |
|
213 * |
|
214 * @param aTsyReqHandle |
|
215 * @param aCaps |
|
216 * @return KErrNone |
|
217 */ |
|
218 virtual TInt GetSecurityCaps( const TTsyReqHandle aTsyReqHandle, |
|
219 TUint32* aCaps ); |
|
220 |
|
221 /** |
|
222 * Sets TSY to notify if security capabilities change |
|
223 * |
|
224 * |
|
225 * @param aCaps |
|
226 * @return KErrNone |
|
227 */ |
|
228 virtual TInt NotifySecurityCapsChange( TUint32* aCaps ); |
|
229 |
|
230 /** |
|
231 * Cancels notification request about security capabilities change |
|
232 * |
|
233 * |
|
234 * @param aTsyReqHandle |
|
235 * @return KErrNone |
|
236 */ |
|
237 virtual TInt NotifySecurityCapsChangeCancel( |
|
238 const TTsyReqHandle aTsyReqHandle ); |
|
239 |
|
240 /** |
|
241 * Delivers current lock information |
|
242 * |
|
243 * |
|
244 * @param aPackage Parameters where lock information is stored |
|
245 * @return KErrNone or KErrArgument |
|
246 */ |
|
247 virtual TInt GetLockInfoL( const TDataPackage& aPackage ); |
|
248 |
|
249 /** |
|
250 * Sets TSY notify if lock information changes |
|
251 * |
|
252 * |
|
253 * @param aLock |
|
254 * @param aLockInfo |
|
255 * @return KErrNone |
|
256 */ |
|
257 virtual TInt NotifyLockInfoChange( |
|
258 RMobilePhone::TMobilePhoneLock* aLock, |
|
259 TDes8* aLockInfo ); |
|
260 |
|
261 /** |
|
262 * Cancel notification request about lock information change |
|
263 * |
|
264 * |
|
265 * @param aTsyReqHandle |
|
266 * @return KErrNone |
|
267 */ |
|
268 virtual TInt NotifyLockInfoChangeCancel( |
|
269 const TTsyReqHandle aTsyReqHandle ); |
|
270 |
|
271 /** |
|
272 * Checks if setting a new setting for a lock is possible |
|
273 * |
|
274 * |
|
275 * @param aTsyReqHandle |
|
276 * @param aPackage |
|
277 * @return KErrNone |
|
278 */ |
|
279 virtual TInt SetLockSettingL( const TTsyReqHandle aTsyReqHandle, |
|
280 const TDataPackage& aPackage ); |
|
281 |
|
282 /** |
|
283 * Cancel the request about lock setting, can be cancelled if no ISI |
|
284 * sending done yet. |
|
285 * |
|
286 * |
|
287 * @param aTsyReqHandle |
|
288 * @return KErrNone |
|
289 */ |
|
290 virtual TInt SetLockSettingCancel( const TTsyReqHandle aTsyReqHandle ); |
|
291 |
|
292 /** |
|
293 * Cancel the request about lock setting, can be cancelled if no ISI |
|
294 * sending done yet. |
|
295 * |
|
296 * |
|
297 * @param aTsyReqHandle |
|
298 * @return KErrNone |
|
299 */ |
|
300 virtual TInt GetLockInfoCancel ( const TTsyReqHandle aTsyReqHandle ); |
|
301 |
|
302 /** |
|
303 * Sets new setting for a lock |
|
304 * |
|
305 * |
|
306 * @param aPackage |
|
307 * @return KErrNone |
|
308 */ |
|
309 virtual TInt LockSettingL( const TTsyReqHandle aTsyReqHandle, |
|
310 const TDataPackage& aPackage ); |
|
311 |
|
312 /** |
|
313 * Replaces old security code with new one |
|
314 * |
|
315 * |
|
316 * @param aType |
|
317 * @param aChange |
|
318 * @return Error value |
|
319 */ |
|
320 virtual TInt ChangeSecurityCodeL( const TTsyReqHandle aTsyReqHandle, |
|
321 const TDataPackage& aPackage ); |
|
322 |
|
323 /** |
|
324 * Sets TSY notify if security event appears |
|
325 * |
|
326 * |
|
327 * @param aEven |
|
328 * @return KErrNone |
|
329 */ |
|
330 virtual TInt NotifySecurityEventL( |
|
331 RMobilePhone::TMobilePhoneSecurityEvent* aEvent ); |
|
332 |
|
333 /** |
|
334 * Cancel notification request about lock information change |
|
335 * |
|
336 * |
|
337 * @const aTsyReqHandle |
|
338 * @return KErrNone |
|
339 */ |
|
340 virtual TInt NotifySecurityEventCancel( |
|
341 const TTsyReqHandle aTsyReqHandle ); |
|
342 |
|
343 /** |
|
344 * Verifies current security code |
|
345 * |
|
346 * |
|
347 * @param aTsyReqHandle |
|
348 * @param aType |
|
349 * @param aCodes |
|
350 * @return KErrNone |
|
351 */ |
|
352 virtual TInt VerifySecurityCodeL( const TTsyReqHandle aTsyReqHandle, |
|
353 const TDataPackage& aPackage ); |
|
354 |
|
355 /** |
|
356 * Aborts current security code verification query |
|
357 * |
|
358 * |
|
359 * @param aTsyReqHandle |
|
360 * @param aPackage |
|
361 * @return KErrNone |
|
362 */ |
|
363 virtual TInt AbortSecurityCodeL( const TTsyReqHandle aTsyReqHandle, |
|
364 const TDataPackage& aPackage ); |
|
365 |
|
366 /** |
|
367 * This method retrieves the current number of remaining entry |
|
368 * attemps of security code. |
|
369 * |
|
370 * @param aTsyReqHandle |
|
371 * @param aSecurityCode |
|
372 * @param aSecurityCodeInfo |
|
373 * @return Error value |
|
374 */ |
|
375 virtual TInt GetSecurityCodeInfoL( const TTsyReqHandle aTsyReqHandle, |
|
376 RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, |
|
377 TDes8* aSecurityCodeInfo ); |
|
378 |
|
379 /** |
|
380 * Cancel GetSecurityCodeInfo request |
|
381 * |
|
382 * @param aTsyReqHandle |
|
383 * @return Error value |
|
384 */ |
|
385 virtual TInt GetSecurityCodeInfoCancel( |
|
386 const TTsyReqHandle aTsyReqHandle ); |
|
387 |
|
388 /** |
|
389 * Notifies security code info changes |
|
390 * |
|
391 * @param aSecurityCode |
|
392 * @param aSecurityCodeInfo |
|
393 * @return Error value |
|
394 */ |
|
395 virtual TInt NotifySecurityCodeInfoChange( |
|
396 RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, |
|
397 TDes8* aSecurityCodeInfo ); |
|
398 |
|
399 /** |
|
400 * Cancel notification about security code info changes |
|
401 * |
|
402 * @param aTsyReqHandle |
|
403 * @return Error value |
|
404 */ |
|
405 virtual TInt NotifySecurityCodeInfoChangeCancel( |
|
406 const TTsyReqHandle aTsyReqHandle ); |
|
407 |
|
408 /** |
|
409 * It resets the (GetSecurityCodeInfo) request handle. |
|
410 * |
|
411 * @param aSecurityCode Security Code. |
|
412 */ |
|
413 virtual void ResetGetSecurityCodeInfoTsyReqHandle( |
|
414 const RMobilePhone::TMobilePhoneSecurityCode aSecurityCode ); |
|
415 |
|
416 /** |
|
417 * Checks that security codes are well formed. |
|
418 * |
|
419 *@param aCodeType The security code to check, e.g. PIN, PUK, etc. |
|
420 *@param aCodes The code that needs to be checked. |
|
421 */ |
|
422 TBool AreCodesWellFormed( |
|
423 const RMobilePhone::TMobilePhoneSecurityCode& aCodeType, |
|
424 const RMobilePhone::TCodeAndUnblockCode& aCodes ) const; |
|
425 |
|
426 private: // Data |
|
427 |
|
428 /** |
|
429 * Pointer to phone tsy |
|
430 */ |
|
431 CMmPhoneTsy* iMmPhoneTsy; |
|
432 |
|
433 /** |
|
434 * get lock info |
|
435 */ |
|
436 TDes8* iRetGetLockInfo; |
|
437 |
|
438 /** |
|
439 * notify phone lock change |
|
440 */ |
|
441 RMobilePhone::TMobilePhoneLock* iRetNotifyPhoneLockChange; |
|
442 |
|
443 /** |
|
444 * notify phone lock info change |
|
445 */ |
|
446 TDes8* iRetNotifyLockInfoChange; |
|
447 |
|
448 /** |
|
449 * Set Lock Setting phone lock |
|
450 */ |
|
451 RMobilePhone::TMobilePhoneLock iLockSettingPhoneLock; |
|
452 |
|
453 /** |
|
454 * Set Lock Setting |
|
455 */ |
|
456 RMobilePhone::TMobilePhoneLockSetting iLockSetting; |
|
457 |
|
458 /** |
|
459 * notify security event |
|
460 */ |
|
461 RMobilePhone::TMobilePhoneSecurityEvent* iRetNotifySecurityEvent; |
|
462 |
|
463 /** |
|
464 * notify security capabilities change |
|
465 */ |
|
466 TUint32* iRetNotifySecurityCapsChange; |
|
467 |
|
468 /** |
|
469 * Lock type |
|
470 */ |
|
471 RMobilePhone::TMobilePhoneSecurityCode iLockType; |
|
472 |
|
473 /** |
|
474 * Is PIN1 disable supported |
|
475 */ |
|
476 TBool iPin1DisableSupported; |
|
477 |
|
478 /** |
|
479 * Is Puk code verify |
|
480 */ |
|
481 TBool iPukCodeVerify; |
|
482 |
|
483 /** |
|
484 * Is Phone password verify |
|
485 */ |
|
486 TBool iPhonePasswordVerify; |
|
487 |
|
488 /** |
|
489 * Is security codes checked for client after boot |
|
490 */ |
|
491 TBool iSecurityCheckedForBoot; |
|
492 |
|
493 /** |
|
494 * member enum for storing the last requested pin |
|
495 */ |
|
496 enum TLastPinRequested |
|
497 { |
|
498 EPinUnknown, |
|
499 EPin1Requested, |
|
500 EPin2Requested |
|
501 }; |
|
502 |
|
503 /** |
|
504 * State while changing active code from PIN to UPIN |
|
505 */ |
|
506 TLastPinRequested iLastPinRequested; |
|
507 |
|
508 /** |
|
509 * ETrue if requested through TSY and not yet completed to client. |
|
510 */ |
|
511 TBool iIsSecurityCodeRequestCachedInBoot; |
|
512 |
|
513 /** These states are used when changing active code |
|
514 from PIN to UPIN */ |
|
515 enum TActiveCodeToUpinState |
|
516 { |
|
517 EActiveCodeToUpinIdle, |
|
518 EActiveCodeToUpinAskUpin, |
|
519 EActiveCodeToUpinAskPin, |
|
520 }; |
|
521 |
|
522 /** |
|
523 * State while changing active code from PIN to UPIN |
|
524 */ |
|
525 TActiveCodeToUpinState iActiveCodeToUpinState; |
|
526 |
|
527 /** |
|
528 * Security code info. Pointer to client side data. |
|
529 * Not Own. |
|
530 */ |
|
531 TDes8* iRetSecurityCodeInfo; |
|
532 |
|
533 /** |
|
534 * Security code. Pointer to client side data. |
|
535 * Not Own. |
|
536 */ |
|
537 RMobilePhone::TMobilePhoneSecurityCode* iRetNotifySecurityCode; |
|
538 |
|
539 /** |
|
540 * Security code info. Pointer to client side data. |
|
541 * Not Own. |
|
542 */ |
|
543 TDes8* iRetNotifySecurityCodeInfo; |
|
544 |
|
545 /** |
|
546 * Array for buffering Get Security Code Info requests |
|
547 */ |
|
548 RPointerArray< TGetSecurityCodeInfoRequest > iGetSecurityCodeInfoRequests; |
|
549 |
|
550 }; |
|
551 #endif // CMMSECURITYTSY_H |
|
552 |
|
553 // End of File |