0
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 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 |
// INCLUDE FILES
|
|
19 |
#include "cmmsecuritymesshandler.h"
|
|
20 |
#include "cmmphonetsender.h"
|
|
21 |
#include "cmmstaticutility.h"
|
|
22 |
#include "cmmmessagerouter.h"
|
|
23 |
#include "cmmnetmesshandler.h"
|
|
24 |
#include "cmmcallmesshandler.h"
|
|
25 |
#include "tsylogger.h" // logging
|
|
26 |
#include "osttracedefinitions.h"
|
|
27 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
28 |
#include "cmmsecuritymesshandlertraces.h"
|
|
29 |
#endif
|
|
30 |
|
|
31 |
#include <etelmm.h>
|
|
32 |
#include <tisi.h>
|
|
33 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
|
|
34 |
#include <mtcisi.h>
|
|
35 |
#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
36 |
#include <mceisi.h>
|
|
37 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
38 |
#include <ctsy/pluginapi/cmmdatapackage.h>
|
|
39 |
#include <ctsy/serviceapi/gsmerror.h>
|
|
40 |
#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
|
|
41 |
#include <uiccisi.h>
|
|
42 |
|
|
43 |
// EXTERNAL DATA STRUCTURES
|
|
44 |
//None
|
|
45 |
|
|
46 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
47 |
//None
|
|
48 |
|
|
49 |
// CONSTANTS
|
|
50 |
// hard-coded transaction id for ISA messages
|
|
51 |
const TUint8 KSecurityTransId = 7;
|
|
52 |
|
|
53 |
// Maximum size of UICC_SB_PIN and UICC_SB_PUK
|
|
54 |
const TUint8 KMaxSizeUiccSbPin = 16;
|
|
55 |
const TUint8 KMaxSizeUiccSbPuk = 16;
|
|
56 |
|
|
57 |
// Key reference for universal PIN
|
|
58 |
const TUint8 KUniversalPinKeyReference = 0x11;
|
|
59 |
|
|
60 |
// constants for getting/setting FDN state
|
|
61 |
const TUint8 KUiccServiceFdn = 0x02; // service in EFust
|
|
62 |
const TUint8 KIccServiceFdn = 0x03; // service in EFsst
|
|
63 |
const TUint8 KIccServiceAdn = 0x02; // service in EFsst
|
|
64 |
const TUint8 KFdnStateMask = 0x01;
|
|
65 |
const TUint8 KServiceActivated = 0x01;
|
|
66 |
const TUint8 KServiceNotActivated = 0x00;
|
|
67 |
const TUint8 KFileStatusIndex = 0x0B;
|
|
68 |
const TUint8 KInvalidated = 0x00;
|
|
69 |
const TUint8 KNotInvalidated = 0x01;
|
|
70 |
const TUint8 KInvalidateFlagMask = 0x01;
|
|
71 |
|
|
72 |
const TUint8 KSw1Position = 0x02;
|
|
73 |
const TUint8 KSw2Position = 0x01;
|
|
74 |
|
|
75 |
const TUint16 KElemAdnIcc = 0x6F3A;
|
|
76 |
|
|
77 |
// MACROS
|
|
78 |
//None
|
|
79 |
|
|
80 |
// LOCAL CONSTANTS AND MACROS
|
|
81 |
const TUint8 KSecPadding = 0x00; // Filler byte for ISI messages
|
|
82 |
|
|
83 |
//TICCType enumerates the SIM card types
|
|
84 |
enum TICCType
|
|
85 |
{
|
|
86 |
EICCTypeSim2GGsm = 0,
|
|
87 |
EICCTypeSim3G,
|
|
88 |
EICCTypeSimUnknown
|
|
89 |
};
|
|
90 |
|
|
91 |
// MODULE DATA STRUCTURES
|
|
92 |
//None
|
|
93 |
|
|
94 |
// LOCAL FUNCTION PROTOTYPES
|
|
95 |
//None
|
|
96 |
|
|
97 |
|
|
98 |
// -----------------------------------------------------------------------------
|
|
99 |
// CMmSecurityMessHandler::CMmSecurityMessHandler
|
|
100 |
// C++ default constructor
|
|
101 |
// -----------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
CMmSecurityMessHandler::CMmSecurityMessHandler()
|
|
104 |
{
|
|
105 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::CMmSecurityMessHandler");
|
|
106 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_CMMSECURITYMESSHANDLER, "CMmSecurityMessHandler::CMmSecurityMessHandler" );
|
|
107 |
//none
|
|
108 |
}
|
|
109 |
|
|
110 |
// -----------------------------------------------------------------------------
|
|
111 |
// CMmSecurityMessHandler::NewL
|
|
112 |
// Two-phased constructor.
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
//
|
|
115 |
CMmSecurityMessHandler* CMmSecurityMessHandler::NewL(
|
|
116 |
CMmPhoNetSender* aPhoNetSender, //pointer to the phonet sender
|
|
117 |
CMmPhoNetReceiver* aPhoNetReceiver, //pointer to the phonet sender
|
|
118 |
CMmNetMessHandler* aNetMessHandler, //pointer to the net mess handler
|
|
119 |
CMmCallMessHandler* aCallMessHandler, //pointer to the call mess handler
|
|
120 |
CMmMessageRouter* aMessageRouter,
|
|
121 |
CMmUiccMessHandler* aUiccMessHandler )
|
|
122 |
{
|
|
123 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::NewL");
|
|
124 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_NEWL, "CMmSecurityMessHandler::NewL" );
|
|
125 |
CMmSecurityMessHandler* const securityMessHandler =
|
|
126 |
new ( ELeave ) CMmSecurityMessHandler();
|
|
127 |
|
|
128 |
CleanupStack::PushL( securityMessHandler );
|
|
129 |
securityMessHandler->iPhoNetSender = aPhoNetSender;
|
|
130 |
securityMessHandler->iNetMessHandler = aNetMessHandler;
|
|
131 |
securityMessHandler->iCallMessHandler = aCallMessHandler;
|
|
132 |
securityMessHandler->iMessageRouter = aMessageRouter;
|
|
133 |
securityMessHandler->iMmUiccMessHandler = aUiccMessHandler;
|
|
134 |
|
|
135 |
securityMessHandler->ConstructL();
|
|
136 |
|
|
137 |
// UICC
|
|
138 |
aPhoNetReceiver->RegisterL( securityMessHandler, PN_UICC, UICC_IND );
|
|
139 |
aPhoNetReceiver->RegisterL( securityMessHandler, PN_UICC, UICC_RESP );
|
|
140 |
aPhoNetReceiver->RegisterL( securityMessHandler, PN_UICC, UICC_CARD_IND );
|
|
141 |
aPhoNetReceiver->RegisterL( securityMessHandler, PN_UICC, UICC_PIN_IND );
|
|
142 |
aPhoNetReceiver->RegisterL( securityMessHandler, PN_UICC, UICC_PIN_RESP );
|
|
143 |
|
|
144 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
|
|
145 |
//MTC
|
|
146 |
aPhoNetReceiver->RegisterL(
|
|
147 |
securityMessHandler, PN_MTC, MTC_STATE_INFO_IND );
|
|
148 |
aPhoNetReceiver->RegisterL(
|
|
149 |
securityMessHandler, PN_MTC, MTC_RF_STATUS_QUERY_RESP );
|
|
150 |
aPhoNetReceiver->RegisterL(
|
|
151 |
securityMessHandler, PN_MTC, MTC_STATE_QUERY_RESP );
|
|
152 |
#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
153 |
// MCE
|
|
154 |
aPhoNetReceiver->RegisterL(
|
|
155 |
securityMessHandler, PN_MODEM_MCE, MCE_MODEM_STATE_IND );
|
|
156 |
aPhoNetReceiver->RegisterL(
|
|
157 |
securityMessHandler, PN_MODEM_MCE, MCE_MODEM_STATE_QUERY_RESP );
|
|
158 |
aPhoNetReceiver->RegisterL(
|
|
159 |
securityMessHandler, PN_MODEM_MCE, MCE_RF_STATE_QUERY_RESP );
|
|
160 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
161 |
|
|
162 |
CleanupStack::Pop( securityMessHandler );
|
|
163 |
return securityMessHandler;
|
|
164 |
}
|
|
165 |
|
|
166 |
// -----------------------------------------------------------------------------
|
|
167 |
// CMmSecurityMessHandler::ConstructL
|
|
168 |
// Symbian 2nd phase constructor. Initialises internal attributes.
|
|
169 |
// -----------------------------------------------------------------------------
|
|
170 |
//
|
|
171 |
void CMmSecurityMessHandler::ConstructL()
|
|
172 |
{
|
|
173 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ConstructL");
|
|
174 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_CONSTRUCTL, "CMmSecurityMessHandler::ConstructL" );
|
|
175 |
|
|
176 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
|
|
177 |
// Initialize the current MTC state to poweroff, and do the first state query
|
|
178 |
iBootState.iMtcCurrentState = MTC_POWER_OFF;
|
|
179 |
MtcStateQueryReq( KSecurityTransId );
|
|
180 |
#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
181 |
// Initialize the current modem state to poweroff
|
|
182 |
iBootState.iMceCurrentState = MCE_POWER_OFF;
|
|
183 |
|
|
184 |
// Query modem state and RF state
|
|
185 |
MceModemStateQueryReq();
|
|
186 |
MceRfStateQueryReq();
|
|
187 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
188 |
|
|
189 |
iPukCodeRequired = EFalse;
|
|
190 |
|
|
191 |
iApplicationId = 0;
|
|
192 |
iPinId = 0;
|
|
193 |
// This flags indicates if PIN attempts left query in case
|
|
194 |
iPinAttemptsLeftQuery = EFalse;
|
|
195 |
// This flags indicates if lock state query in case
|
|
196 |
iLockStateQuery = EFalse;
|
|
197 |
iCodeType = RMobilePhone::ESecurityCodePin1;
|
|
198 |
|
|
199 |
iFdnSetting = RMobilePhone::EFdnSetOff;
|
|
200 |
}
|
|
201 |
|
|
202 |
// -----------------------------------------------------------------------------
|
|
203 |
// CMmSecurityMessHandler::~CMmSecurityMessHandler
|
|
204 |
// Destructor
|
|
205 |
// -----------------------------------------------------------------------------
|
|
206 |
//
|
|
207 |
CMmSecurityMessHandler::~CMmSecurityMessHandler()
|
|
208 |
{
|
|
209 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::~CMmSecurityMessHandler");
|
|
210 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_CMMSECURITYMESSHANDLER, "CMmSecurityMessHandler::~CMmSecurityMessHandler" );
|
|
211 |
}
|
|
212 |
|
|
213 |
// -----------------------------------------------------------------------------
|
|
214 |
// CMmSecurityMessHandler::ExtFuncL
|
|
215 |
// Dispatches Etel requests to DOS level handlers
|
|
216 |
// -----------------------------------------------------------------------------
|
|
217 |
//
|
|
218 |
TInt CMmSecurityMessHandler::ExtFuncL(
|
|
219 |
TInt aIpc,
|
|
220 |
const CMmDataPackage* aDataPackage )
|
|
221 |
{
|
|
222 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::ExtFuncL, aIpc: %d", aIpc);
|
|
223 |
OstTrace1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_EXTFUNCL, "CMmSecurityMessHandler::ExtFuncL;aIpc=%d", aIpc );
|
|
224 |
|
|
225 |
TInt ret( KErrNone );
|
|
226 |
|
|
227 |
TUint8 transId( KSecurityTransId );
|
|
228 |
|
|
229 |
switch ( aIpc )
|
|
230 |
{
|
|
231 |
case EMobilePhoneGetLockInfo:
|
|
232 |
{
|
|
233 |
// Unpack data
|
|
234 |
RMobilePhone::TMobilePhoneLock* aLock( NULL );
|
|
235 |
RMobilePhone::TMobilePhoneLockInfoV1* aLockInfo( NULL );
|
|
236 |
aDataPackage->UnPackData( &aLock, &aLockInfo);
|
|
237 |
// Set flag to indicate that this is lock state query
|
|
238 |
iLockStateQuery = ETrue;
|
|
239 |
switch( *aLock )
|
|
240 |
{
|
|
241 |
case RMobilePhone::ELockPhoneDevice: // Device lock
|
|
242 |
{
|
|
243 |
// Not yet supported in modemadaptation
|
|
244 |
ret = KErrNotSupported;
|
|
245 |
break;
|
|
246 |
}
|
|
247 |
case RMobilePhone::ELockPhoneToICC: // Lock to current (U)SIM
|
|
248 |
{
|
|
249 |
// Not yet supported in modemadaptation
|
|
250 |
ret = KErrNotSupported;
|
|
251 |
break;
|
|
252 |
}
|
|
253 |
case RMobilePhone::ELockICC: // PIN
|
|
254 |
case RMobilePhone::ELockPin2: // PIN2
|
|
255 |
{
|
|
256 |
UiccPinReqStateQuery( *aLock );
|
|
257 |
break;
|
|
258 |
}
|
|
259 |
case RMobilePhone::ELockUniversalPin:
|
|
260 |
{
|
|
261 |
// UPIN is supported only in 3G
|
|
262 |
if ( UICC_CARD_TYPE_UICC ==
|
|
263 |
iMmUiccMessHandler->GetCardType() )
|
|
264 |
{
|
|
265 |
UiccPinReqStateQuery( *aLock );
|
|
266 |
}
|
|
267 |
else
|
|
268 |
{
|
|
269 |
ret = KErrNotSupported;
|
|
270 |
}
|
|
271 |
break;
|
|
272 |
}
|
|
273 |
default:
|
|
274 |
{
|
|
275 |
ret = KErrNotSupported;
|
|
276 |
break;
|
|
277 |
}
|
|
278 |
} // End of switch( *aLock )
|
|
279 |
break;
|
|
280 |
}
|
|
281 |
case EMobilePhoneChangeSecurityCode:
|
|
282 |
{
|
|
283 |
//unpack data
|
|
284 |
RMobilePhone::TMobilePhoneSecurityCode* type( NULL );
|
|
285 |
RMobilePhone::TMobilePhonePasswordChangeV1* change( NULL );
|
|
286 |
aDataPackage->UnPackData( &type, &change );
|
|
287 |
ret = SecCodeChangeReq( transId, type, change );
|
|
288 |
break;
|
|
289 |
}
|
|
290 |
case EMobilePhoneAbortSecurityCode:
|
|
291 |
{
|
|
292 |
// Just complete the cancelling to client
|
|
293 |
// UICC server doesn't support cancelling process.
|
|
294 |
iMessageRouter->Complete(
|
|
295 |
EMobilePhoneAbortSecurityCode,
|
|
296 |
KErrNone );
|
|
297 |
break;
|
|
298 |
}
|
|
299 |
case EMobilePhoneVerifySecurityCode:
|
|
300 |
{
|
|
301 |
//unpack data
|
|
302 |
RMobilePhone::TMobilePhoneSecurityCode* type( NULL );
|
|
303 |
RMobilePhone::TCodeAndUnblockCode* codes( NULL );
|
|
304 |
aDataPackage->UnPackData( &type, &codes );
|
|
305 |
ret = VerifySecurityCode( type, codes );
|
|
306 |
break;
|
|
307 |
}
|
|
308 |
case EMobilePhoneGetSecurityCodeInfo:
|
|
309 |
{
|
|
310 |
// Set flag to indicate that this is PIN attempts left query
|
|
311 |
iPinAttemptsLeftQuery = ETrue;
|
|
312 |
//unpack data
|
|
313 |
RMobilePhone::TMobilePhoneSecurityCode* type( NULL );
|
|
314 |
aDataPackage->UnPackData( &type );
|
|
315 |
// Save code type for completing
|
|
316 |
iCodeType = *type;
|
|
317 |
TUint8 cardType( iMmUiccMessHandler->GetCardType() );
|
|
318 |
|
|
319 |
// Initialize lock type to PIN1
|
|
320 |
RMobilePhone::TMobilePhoneLock lock( RMobilePhone::ELockICC );
|
|
321 |
if ( RMobilePhone::ESecurityCodePin2 == *type )
|
|
322 |
{
|
|
323 |
if ( UICC_CARD_TYPE_UICC != cardType )
|
|
324 |
{
|
|
325 |
ret = KErrNotSupported;
|
|
326 |
}
|
|
327 |
lock = RMobilePhone::ELockPin2;
|
|
328 |
}
|
|
329 |
else if ( RMobilePhone::ESecurityUniversalPin == *type )
|
|
330 |
{
|
|
331 |
if ( UICC_CARD_TYPE_UICC != cardType )
|
|
332 |
{
|
|
333 |
ret = KErrNotSupported;
|
|
334 |
}
|
|
335 |
lock = RMobilePhone::ELockUniversalPin;
|
|
336 |
}
|
|
337 |
if ( KErrNone == ret )
|
|
338 |
{
|
|
339 |
ret = UiccPinReqStateQuery( lock );
|
|
340 |
}
|
|
341 |
break;
|
|
342 |
}
|
|
343 |
case EMobilePhoneSetLockSetting:
|
|
344 |
{
|
|
345 |
//unpack data
|
|
346 |
TLockAndSetting* lockAndSetting( NULL );
|
|
347 |
RMobilePhone::TMobilePassword* password( NULL );
|
|
348 |
aDataPackage->UnPackData( &lockAndSetting, &password );
|
|
349 |
|
|
350 |
RMobilePhone::TMobilePhoneLock lock( *(lockAndSetting->iLock ) );
|
|
351 |
RMobilePhone::TMobilePhoneLockSetting setting(
|
|
352 |
*(lockAndSetting->iSetting ) );
|
|
353 |
|
|
354 |
// PIN code disabling/enabling is don in UICC server
|
|
355 |
if ( lock == RMobilePhone::ELockICC ||
|
|
356 |
lock == RMobilePhone::ELockPin2 ||
|
|
357 |
lock == RMobilePhone::ELockUniversalPin )
|
|
358 |
{
|
|
359 |
ret = UiccPinReqChangeState( lock, setting, *password );
|
|
360 |
}
|
|
361 |
else
|
|
362 |
{
|
|
363 |
// Not yet supported in modemadaptation
|
|
364 |
ret = KErrNotSupported;
|
|
365 |
}
|
|
366 |
break;
|
|
367 |
}
|
|
368 |
case EMmTsySecurityGetSimActivePinStateIPC:
|
|
369 |
{
|
|
370 |
GetActivePin();
|
|
371 |
break;
|
|
372 |
}
|
|
373 |
case EMmTsyBootNotifySimStatusReadyIPC:
|
|
374 |
{
|
|
375 |
UiccReq();
|
|
376 |
break;
|
|
377 |
}
|
|
378 |
case EMmTsySimGetICCType:
|
|
379 |
{
|
|
380 |
GetIccType();
|
|
381 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
|
|
382 |
//NOTE:
|
|
383 |
// It is possible that the query below is not needed anymore, because always
|
|
384 |
// in CMmSecurityMessHandler::ConstructL(), the MtcStateQueryReq() is called, which
|
|
385 |
// eventually in its response calls also MtcRfStatusQueryReq()
|
|
386 |
ret = MtcRfStatusQueryReq( transId );
|
|
387 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
388 |
break;
|
|
389 |
}
|
|
390 |
case EMobilePhoneSetFdnSetting:
|
|
391 |
{
|
|
392 |
TUint8 cardType( iMmUiccMessHandler->GetCardType() );
|
|
393 |
RMobilePhone::TMobilePhoneFdnSetting* fdnSetting( NULL );
|
|
394 |
aDataPackage->UnPackData( &fdnSetting );
|
|
395 |
iFdnSetting = *fdnSetting;
|
|
396 |
|
|
397 |
if( UICC_CARD_TYPE_UICC == cardType )
|
|
398 |
{
|
|
399 |
ret = ReadEfEst( ETrIdSetFdnStateReadEst );
|
|
400 |
}
|
|
401 |
else if( UICC_CARD_TYPE_ICC == cardType )
|
|
402 |
{
|
|
403 |
ret = ReadEfAdnFileInfo( ETrIdSetFdnStateReadFileInfo );
|
|
404 |
}
|
|
405 |
else
|
|
406 |
{
|
|
407 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ExtFuncL: unknown card type, FDN state not set");
|
|
408 |
OstTrace0( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_EXTFUNCL, "CMmSecurityMessHandler::ExtFuncL: unknown card type, FDN state not set" );
|
|
409 |
ret = KErrGeneral;
|
|
410 |
}
|
|
411 |
break;
|
|
412 |
}
|
|
413 |
case EMobilePhoneGetFdnStatus:
|
|
414 |
{
|
|
415 |
TUint8 cardType( iMmUiccMessHandler->GetCardType() );
|
|
416 |
if( UICC_CARD_TYPE_UICC == cardType )
|
|
417 |
{
|
|
418 |
// read EFest
|
|
419 |
ret = ReadEfEst( ETrIdGetFdnStateReadEst );
|
|
420 |
}
|
|
421 |
else if( UICC_CARD_TYPE_ICC == cardType )
|
|
422 |
{
|
|
423 |
// read file info for EFadn
|
|
424 |
ret = ReadEfAdnFileInfo( ETrIdGetFdnStateReadFileInfo );
|
|
425 |
}
|
|
426 |
else
|
|
427 |
{
|
|
428 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ExtFuncL: unknown card type, FDN state cannot be solved");
|
|
429 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_EXTFUNCL, "CMmSecurityMessHandler::ExtFuncL: unknown card type, FDN state cannot be solved" );
|
|
430 |
ret = KErrGeneral;
|
|
431 |
}
|
|
432 |
break;
|
|
433 |
}
|
|
434 |
case EMobilePhoneGetCurrentActiveUSimApplication:
|
|
435 |
{
|
|
436 |
GetActiveUsimApplication();
|
|
437 |
break;
|
|
438 |
}
|
|
439 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
|
|
440 |
case EMmTsyBootGetRFStatusIPC:
|
|
441 |
{
|
|
442 |
//This should not be in any use at the moment
|
|
443 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ExtFuncL - EMmTsyBootGetRFStatusIPC (NOT IN USE!!!)");
|
|
444 |
OstTrace0( TRACE_NORMAL, DUP5_CMMSECURITYMESSHANDLER_EXTFUNCL, "CMmSecurityMessHandler::ExtFuncL, EMmTsyBootGetRFStatusIPC (NOT IN USE!!!)" );
|
|
445 |
ret = MtcRfStatusQueryReq( transId );
|
|
446 |
break;
|
|
447 |
}
|
|
448 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
449 |
default:
|
|
450 |
{
|
|
451 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::ExtFuncL - Unknown IPC: %d", aIpc);
|
|
452 |
OstTrace1( TRACE_NORMAL, DUP6_CMMSECURITYMESSHANDLER_EXTFUNCL, "CMmSecurityMessHandler::ExtFuncL;Unknown aIpc=%d", aIpc );
|
|
453 |
ret = KErrNotSupported;
|
|
454 |
break;
|
|
455 |
}
|
|
456 |
}
|
|
457 |
|
|
458 |
return ret;
|
|
459 |
}
|
|
460 |
|
|
461 |
|
|
462 |
// -----------------------------------------------------------------------------
|
|
463 |
// CMmSecurityMessHandler::ReceiveMessageL
|
|
464 |
// Called when an ISI message has been received.
|
|
465 |
// -----------------------------------------------------------------------------
|
|
466 |
//
|
|
467 |
void CMmSecurityMessHandler::ReceiveMessageL(
|
|
468 |
const TIsiReceiveC &aIsiMessage ) // received ISI message
|
|
469 |
{
|
|
470 |
TInt resource (aIsiMessage.Get8bit(ISI_HEADER_OFFSET_RESOURCEID));
|
|
471 |
TInt messageId(aIsiMessage.Get8bit(ISI_HEADER_OFFSET_MESSAGEID));
|
|
472 |
|
|
473 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::ReceiveMessageL - resource: %d, msgId: %d", resource, messageId);
|
|
474 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_RECEIVEMESSAGEL, "CMmSecurityMessHandler::ReceiveMessageL;resource=%d;messageId=%d", resource, messageId );
|
|
475 |
|
|
476 |
switch ( resource )
|
|
477 |
{
|
|
478 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
|
|
479 |
case PN_MTC:
|
|
480 |
{
|
|
481 |
switch( messageId )
|
|
482 |
{
|
|
483 |
case MTC_STATE_INFO_IND:
|
|
484 |
{
|
|
485 |
MtcStateInfoIndL( aIsiMessage );
|
|
486 |
break;
|
|
487 |
}
|
|
488 |
case MTC_STATE_QUERY_RESP:
|
|
489 |
{
|
|
490 |
MtcStateQueryRespL( aIsiMessage );
|
|
491 |
break;
|
|
492 |
}
|
|
493 |
case MTC_RF_STATUS_QUERY_RESP:
|
|
494 |
{
|
|
495 |
MtcRfStatusQueryResp( aIsiMessage );
|
|
496 |
break;
|
|
497 |
}
|
|
498 |
default:
|
|
499 |
{
|
|
500 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::ReceiveMessageL - PN_MTC - unknown msgId: %d", messageId);
|
|
501 |
//OstTrace1( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_RECEIVEMESSAGEL, "CMmSecurityMessHandler::ReceiveMessageL;PN_MTC - unknown messageId=%d", messageId );
|
|
502 |
break;
|
|
503 |
}
|
|
504 |
} // end switch ( messageId )
|
|
505 |
break; // end case PN_MTC
|
|
506 |
}
|
|
507 |
#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
508 |
case PN_MODEM_MCE:
|
|
509 |
{
|
|
510 |
switch( messageId )
|
|
511 |
{
|
|
512 |
case MCE_MODEM_STATE_IND:
|
|
513 |
{
|
|
514 |
MceModemStateInd( aIsiMessage );
|
|
515 |
break;
|
|
516 |
}
|
|
517 |
case MCE_MODEM_STATE_QUERY_RESP:
|
|
518 |
{
|
|
519 |
MceModemStateQueryResp( aIsiMessage );
|
|
520 |
break;
|
|
521 |
}
|
|
522 |
case MCE_RF_STATE_QUERY_RESP:
|
|
523 |
{
|
|
524 |
MceRfStateQueryResp( aIsiMessage );
|
|
525 |
break;
|
|
526 |
}
|
|
527 |
default:
|
|
528 |
{
|
|
529 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::ReceiveMessageL - PN_MTC - unknown msgId: %d", messageId);
|
|
530 |
OstTrace1( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_RECEIVEMESSAGEL, "CMmSecurityMessHandler::ReceiveMessageL;PN_MTC - unknown messageId=%d", messageId );
|
|
531 |
break;
|
|
532 |
}
|
|
533 |
} // end switch ( messageId )
|
|
534 |
break; // end case PN_MODEM_MCE
|
|
535 |
}
|
|
536 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
537 |
case PN_UICC:
|
|
538 |
{
|
|
539 |
switch( messageId )
|
|
540 |
{
|
|
541 |
case UICC_RESP:
|
|
542 |
{
|
|
543 |
UiccResp( aIsiMessage );
|
|
544 |
break;
|
|
545 |
}
|
|
546 |
case UICC_IND:
|
|
547 |
{
|
|
548 |
UiccInd( aIsiMessage );
|
|
549 |
break;
|
|
550 |
}
|
|
551 |
case UICC_CARD_IND:
|
|
552 |
{
|
|
553 |
UiccCardInd( aIsiMessage );
|
|
554 |
break;
|
|
555 |
}
|
|
556 |
case UICC_PIN_IND:
|
|
557 |
{
|
|
558 |
UiccPinInd( aIsiMessage );
|
|
559 |
break;
|
|
560 |
}
|
|
561 |
case UICC_PIN_RESP:
|
|
562 |
{
|
|
563 |
UiccPinResp( aIsiMessage );
|
|
564 |
break;
|
|
565 |
}
|
|
566 |
default:
|
|
567 |
{
|
|
568 |
break;
|
|
569 |
}
|
|
570 |
}
|
|
571 |
break;
|
|
572 |
}
|
|
573 |
default:
|
|
574 |
{
|
|
575 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::ReceiveMessageL - unknown resource: %d", resource);
|
|
576 |
OstTrace1( TRACE_NORMAL, DUP5_CMMSECURITYMESSHANDLER_RECEIVEMESSAGEL, "CMmSecurityMessHandler::ReceiveMessageL;resource=%d", resource );
|
|
577 |
break; // server not known
|
|
578 |
}
|
|
579 |
} // end of switch
|
|
580 |
}
|
|
581 |
|
|
582 |
|
|
583 |
// -----------------------------------------------------------------------------
|
|
584 |
// CMmSecurityMessHandler::VerifySecurityCode
|
|
585 |
// -----------------------------------------------------------------------------
|
|
586 |
//
|
|
587 |
TInt CMmSecurityMessHandler::VerifySecurityCode(
|
|
588 |
RMobilePhone::TMobilePhoneSecurityCode* aType,
|
|
589 |
RMobilePhone::TCodeAndUnblockCode* aCodes )
|
|
590 |
{
|
|
591 |
TInt ret( KErrNotReady );
|
|
592 |
RMobilePhone::TMobilePassword code( aCodes->iCode );
|
|
593 |
RMobilePhone::TMobilePassword unblockCode( aCodes->iUnblockCode );
|
|
594 |
|
|
595 |
TFLOGSTRING4("TSY: CMmSecurityMessHandler::VerifySecurityCode - code type: %d, code: %S, unblock code: %S",*aType, &code, &unblockCode);
|
|
596 |
OstTraceExt3( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_SECCODEVERIFYREQ, "CMmSecurityMessHandler::VerifySecurityCode;code=%S;unblockCode=%S;aType=%hhu", code, unblockCode, *aType );
|
|
597 |
|
|
598 |
switch( *aType )
|
|
599 |
{
|
|
600 |
// PIN codes are verified in UICC server
|
|
601 |
case RMobilePhone::ESecurityCodePin1:
|
|
602 |
case RMobilePhone::ESecurityCodePin2:
|
|
603 |
case RMobilePhone::ESecurityUniversalPin:
|
|
604 |
{
|
|
605 |
ret = UiccPinReqVerify( UICC_PIN_VERIFY, code, unblockCode );
|
|
606 |
break;
|
|
607 |
}
|
|
608 |
// PUK codes are verified in UICC server
|
|
609 |
case RMobilePhone::ESecurityCodePuk1:
|
|
610 |
case RMobilePhone::ESecurityCodePuk2:
|
|
611 |
case RMobilePhone::ESecurityUniversalPuk:
|
|
612 |
{
|
|
613 |
if ( *aType == RMobilePhone::ESecurityCodePuk1 )
|
|
614 |
{
|
|
615 |
iPukCodeRequired = EFalse;
|
|
616 |
}
|
|
617 |
ret = UiccPinReqVerify( UICC_PIN_UNBLOCK, code, unblockCode );
|
|
618 |
break;
|
|
619 |
}
|
|
620 |
default:
|
|
621 |
{
|
|
622 |
break;
|
|
623 |
}
|
|
624 |
}
|
|
625 |
return ret;
|
|
626 |
}
|
|
627 |
|
|
628 |
|
|
629 |
// -----------------------------------------------------------------------------
|
|
630 |
// CMmSecurityMessHandler::SecCodeChangeReq
|
|
631 |
//
|
|
632 |
// -----------------------------------------------------------------------------
|
|
633 |
//
|
|
634 |
TInt CMmSecurityMessHandler::SecCodeChangeReq(
|
|
635 |
TUint8 aTransactionId,
|
|
636 |
RMobilePhone::TMobilePhoneSecurityCode* aType,
|
|
637 |
RMobilePhone::TMobilePhonePasswordChangeV1* aChange ) // Old&new password
|
|
638 |
{
|
|
639 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::SecCodeChangeReq - traId: %d, type: %d", aTransactionId, *aType);
|
|
640 |
OstTraceExt2( TRACE_NORMAL, CMMSECURITYMESSHANDLER_SECCODECHANGEREQ, "CMmSecurityMessHandler::SecCodeChangeReq;aTransactionId=%hhu;aType=%d", aTransactionId, *aType );
|
|
641 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::SecCodeChangeReq - old password: %S", &(aChange->iOldPassword));
|
|
642 |
OstTraceExt1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_SECCODECHANGEREQ, "CMmSecurityMessHandler::SecCodeChangeReq;aChange->iOldPassword=%S", aChange->iOldPassword );
|
|
643 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::SecCodeChangeReq - new password: %S", &(aChange->iNewPassword));
|
|
644 |
OstTraceExt1( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_SECCODECHANGEREQ, "CMmSecurityMessHandler::SecCodeChangeReq;aChange->iNewPassword=%S", aChange->iNewPassword );
|
|
645 |
|
|
646 |
TInt ret( KErrNone );
|
|
647 |
|
|
648 |
if ( RMobilePhone::ESecurityCodePin1 == *aType ||
|
|
649 |
RMobilePhone::ESecurityCodePin2 == *aType ||
|
|
650 |
RMobilePhone::ESecurityUniversalPin == *aType )
|
|
651 |
{
|
|
652 |
ret = UiccPinReqChange(
|
|
653 |
*aType,
|
|
654 |
aChange->iOldPassword,
|
|
655 |
aChange->iNewPassword );
|
|
656 |
}
|
|
657 |
else
|
|
658 |
{
|
|
659 |
ret = KErrNotSupported;
|
|
660 |
}
|
|
661 |
return ret;
|
|
662 |
}
|
|
663 |
|
|
664 |
// -----------------------------------------------------------------------------
|
|
665 |
// CMmSecurityMessHandler::UiccReq
|
|
666 |
// Builds UICC_REQ ISI message and sends it via phonet
|
|
667 |
// -----------------------------------------------------------------------------
|
|
668 |
//
|
|
669 |
TInt CMmSecurityMessHandler::UiccReq() const
|
|
670 |
{
|
|
671 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccReq");
|
|
672 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCREQ, "CMmSecurityMessHandler::UiccReq" );
|
|
673 |
|
|
674 |
// Create UICC_REQ message for querying card status
|
|
675 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
676 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
677 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId );
|
|
678 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_REQ );
|
|
679 |
isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_REQ_OFFSET_SERVICETYPE,
|
|
680 |
UICC_STATUS_GET );
|
|
681 |
|
|
682 |
return iPhoNetSender->Send( isiMsg.Complete() );
|
|
683 |
}
|
|
684 |
|
|
685 |
// -----------------------------------------------------------------------------
|
|
686 |
// CMmSecurityMessHandler::UiccResp
|
|
687 |
// Breaks UICC_RESP ISI-message and completes "notify SIM ready"
|
|
688 |
// to CommonTSY.
|
|
689 |
// -----------------------------------------------------------------------------
|
|
690 |
//
|
|
691 |
void CMmSecurityMessHandler::UiccResp( const TIsiReceiveC& aIsiMessage )
|
|
692 |
{
|
|
693 |
// Get service type
|
|
694 |
TUint8 serviceType( aIsiMessage.Get8bit(
|
|
695 |
ISI_HEADER_SIZE + UICC_RESP_OFFSET_SERVICETYPE ) );
|
|
696 |
|
|
697 |
// Get status
|
|
698 |
TUint8 status( aIsiMessage.Get8bit(
|
|
699 |
ISI_HEADER_SIZE + UICC_RESP_OFFSET_STATUS ) );
|
|
700 |
|
|
701 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::UiccResp, service type: %d, status: %d", serviceType, status );
|
|
702 |
OstTraceExt2( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCRESP, "CMmSecurityMessHandler::UiccResp;serviceType=%d;status=%d", serviceType, status );
|
|
703 |
|
|
704 |
if ( UICC_STATUS_GET == serviceType && UICC_STATUS_OK == status )
|
|
705 |
{
|
|
706 |
if ( !iBootState.iSIMReady )
|
|
707 |
{
|
|
708 |
// Set UICC as ready so that initialization can start
|
|
709 |
iBootState.iSIMReady = ETrue;
|
|
710 |
|
|
711 |
// let's cache service table and CPHS information table
|
|
712 |
iMmUiccMessHandler->InitializeSimServiceTableCache();
|
|
713 |
iMmUiccMessHandler->InitializeCphsInformationCache();
|
|
714 |
}
|
|
715 |
}
|
|
716 |
}
|
|
717 |
|
|
718 |
// -----------------------------------------------------------------------------
|
|
719 |
// CMmSecurityMessHandler::UiccInd
|
|
720 |
// Breaks UICC_IND ISI-message and completes "notify SIM ready"
|
|
721 |
// to CommonTSY.
|
|
722 |
// -----------------------------------------------------------------------------
|
|
723 |
//
|
|
724 |
void CMmSecurityMessHandler::UiccInd( const TIsiReceiveC& aIsiMessage )
|
|
725 |
{
|
|
726 |
// Get service type
|
|
727 |
TUint8 serviceType( aIsiMessage.Get8bit(
|
|
728 |
ISI_HEADER_SIZE + UICC_IND_OFFSET_SERVICETYPE ) );
|
|
729 |
|
|
730 |
TFLOGSTRING2("TSY: CMmCustomMessHandler::UiccInd, service type: %d", serviceType );
|
|
731 |
OstTraceExt1( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCIND, "CMmSecurityMessHandler::UiccInd;serviceType=%hhu", serviceType );
|
|
732 |
|
|
733 |
if ( UICC_START_UP_COMPLETE == serviceType )
|
|
734 |
{
|
|
735 |
// Set UICC state to ready
|
|
736 |
iBootState.iSIMReady = ETrue;
|
|
737 |
|
|
738 |
// let's cache service table and CPHS information table
|
|
739 |
iMmUiccMessHandler->InitializeSimServiceTableCache();
|
|
740 |
iMmUiccMessHandler->InitializeCphsInformationCache();
|
|
741 |
}
|
|
742 |
}
|
|
743 |
|
|
744 |
// -----------------------------------------------------------------------------
|
|
745 |
// CMmSecurityMessHandler::UiccCardInd
|
|
746 |
// Breaks UICC_CARD_IND ISI-message
|
|
747 |
// -----------------------------------------------------------------------------
|
|
748 |
//
|
|
749 |
void CMmSecurityMessHandler::UiccCardInd( const TIsiReceiveC& aIsiMessage )
|
|
750 |
{
|
|
751 |
// Get service type
|
|
752 |
TUint8 serviceType( aIsiMessage.Get8bit(
|
|
753 |
ISI_HEADER_SIZE + UICC_CARD_IND_OFFSET_SERVICETYPE ) );
|
|
754 |
|
|
755 |
TFLOGSTRING2("TSY: CMmCustomMessHandler::UiccCardInd, service type: %d", serviceType );
|
|
756 |
OstTraceExt1( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCCARDIND, "CMmSecurityMessHandler::UiccCardInd;serviceType=%hhu", serviceType );
|
|
757 |
|
|
758 |
if ( UICC_CARD_REMOVED == serviceType )
|
|
759 |
{
|
|
760 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccCardInd - SIM Removed!");
|
|
761 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_UICCCARDIND, "CMmSecurityMessHandler::UiccCardInd - SIM Removed!" );
|
|
762 |
// Change old boot state from TSY to not ready
|
|
763 |
iBootState.iSecReady = EFalse;
|
|
764 |
iBootState.iPinRequired = EFalse;
|
|
765 |
iBootState.iPinVerified = EFalse;
|
|
766 |
}
|
|
767 |
}
|
|
768 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
|
|
769 |
// -----------------------------------------------------------------------------
|
|
770 |
// CMmSecurityMessHandler::MtcStateInfoIndL
|
|
771 |
// Breaks a SIM_IND MTC_STATE_INFO_IND-message ISI-message and completes
|
|
772 |
// EMmTsyBootNotifyModemStatusReadyIPC to client
|
|
773 |
// -----------------------------------------------------------------------------
|
|
774 |
//
|
|
775 |
void CMmSecurityMessHandler::MtcStateInfoIndL(
|
|
776 |
const TIsiReceiveC& aIsiMessage )
|
|
777 |
{
|
|
778 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MtcStateInfoIndL");
|
|
779 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MTCSTATEINFOINDL, "CMmSecurityMessHandler::MtcStateInfoIndL" );
|
|
780 |
|
|
781 |
TUint8 state( aIsiMessage.Get8bit( ISI_HEADER_SIZE + MTC_STATE_INFO_IND_OFFSET_STATE ) );
|
|
782 |
TUint8 action( aIsiMessage.Get8bit( ISI_HEADER_SIZE + MTC_STATE_INFO_IND_OFFSET_ACTION ) );
|
|
783 |
|
|
784 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::MtcStateInfoIndL action: 0x%02x, state: 0x%02x", action, state);
|
|
785 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MTCSTATEINFOINDL, "CMmSecurityMessHandler::MtcStateInfoIndL;action=%hhx;state=%hhx", action, state );
|
|
786 |
|
|
787 |
//1. CMT_STATE_READY _AND_ CURRENT_STATE_NEW
|
|
788 |
if ( ( MTC_NOS_READY == action || MTC_READY == action ) &&
|
|
789 |
iBootState.iMtcCurrentState != state )
|
|
790 |
{
|
|
791 |
iBootState.iMtcCurrentState = state;
|
|
792 |
|
|
793 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcStateInfoIndL - CMT state transition occurred");
|
|
794 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_MTCSTATEINFOINDL, "CMmSecurityMessHandler::MtcStateInfoIndL, CMT state transition occurred" );
|
|
795 |
if ( MTC_NORMAL == state )
|
|
796 |
{
|
|
797 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MtcStateInfoIndL - MTC_NORMAL");
|
|
798 |
OstTrace0( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_MTCSTATEINFOINDL, "CMmSecurityMessHandler::MtcStateInfoIndL, MTC_NORMAL" );
|
|
799 |
iMessageRouter->Complete( EMmTsyBootNotifyModemStatusReadyIPC,
|
|
800 |
KErrNone );
|
|
801 |
}
|
|
802 |
//no else
|
|
803 |
|
|
804 |
//to complete EMmTsyBootGetRFStatusIPC
|
|
805 |
MtcRfStatusQueryReq( KSecurityTransId );
|
|
806 |
|
|
807 |
if ( MTC_NORMAL == state || MTC_RF_INACTIVE == state )
|
|
808 |
{
|
|
809 |
//Dataport opening must be delayed to here instead of
|
|
810 |
//CallMessHandler::ConstructL() to make sure CommonTSY is ready.
|
|
811 |
//Either dataport should not be opened before CSD server
|
|
812 |
//is started (not started in MTC_ALARM or MTC_CHARGING states).
|
|
813 |
iCallMessHandler->InitializeDataportL();
|
|
814 |
}
|
|
815 |
//no else
|
|
816 |
}
|
|
817 |
//2. CMT_STATE_READY ( _AND_ CURRENT_STATE_OLD )
|
|
818 |
else if( ( MTC_NOS_READY == action || MTC_READY == action ) )
|
|
819 |
{
|
|
820 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MtcStateInfoIndL - CMT state already active");
|
|
821 |
OstTrace0( TRACE_NORMAL, DUP4_CMMSECURITYMESSHANDLER_MTCSTATEINFOINDL, "CMmSecurityMessHandler::MtcStateInfoIndL, CMT state already active" );
|
|
822 |
}
|
|
823 |
//no else //3. CMT_STATE_NOT_READY - no action done in between state transition
|
|
824 |
}
|
|
825 |
|
|
826 |
// -----------------------------------------------------------------------------
|
|
827 |
// CMmSecurityMessHandler::MtcRfStatusQueryReq
|
|
828 |
// Creates MTC_RF_STATUS_QUERY_REQ-message ISI-message and sends it via
|
|
829 |
// phonet
|
|
830 |
// -----------------------------------------------------------------------------
|
|
831 |
//
|
|
832 |
TInt CMmSecurityMessHandler::MtcRfStatusQueryReq(
|
|
833 |
TUint8 aTransactionId ) const
|
|
834 |
{
|
|
835 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MtcRfStatusQueryReq");
|
|
836 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MTCRFSTATUSQUERYREQ, "CMmSecurityMessHandler::MtcRfStatusQueryReq" );
|
|
837 |
|
|
838 |
TBuf8<2> fillerData;
|
|
839 |
fillerData.AppendFill( KSecPadding, 2 ); // Padding bytes
|
|
840 |
|
|
841 |
TInt ret = iPhoNetSender->Send( PN_MTC,
|
|
842 |
aTransactionId,
|
|
843 |
MTC_RF_STATUS_QUERY_REQ, fillerData );
|
|
844 |
return ret;
|
|
845 |
}
|
|
846 |
|
|
847 |
// -----------------------------------------------------------------------------
|
|
848 |
// CMmSecurityMessHandler::MtcRfStatusQueryResp
|
|
849 |
// Breaks a MTC_RF_STATUS_QUERY_RESP-message ISI-message and completes
|
|
850 |
// to client
|
|
851 |
// -----------------------------------------------------------------------------
|
|
852 |
//
|
|
853 |
void CMmSecurityMessHandler::MtcRfStatusQueryResp(
|
|
854 |
const TIsiReceiveC& aIsiMessage ) const
|
|
855 |
{
|
|
856 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcRfStatusQueryResp" );
|
|
857 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MTCRFSTATUSQUERYRESP, "CMmSecurityMessHandler::MtcRfStatusQueryResp" );
|
|
858 |
|
|
859 |
TUint8 currentRfState = aIsiMessage.Get8bit( ISI_HEADER_SIZE +
|
|
860 |
MTC_RF_STATUS_QUERY_RESP_OFFSET_CURRENT );
|
|
861 |
|
|
862 |
//Defaults to RF ON
|
|
863 |
TRfStateInfo statusInfo ( ERfsStateInfoNormal );
|
|
864 |
|
|
865 |
//RF IS OFF ( this state is not updated when MTC_NORMAL )
|
|
866 |
if( MTC_RF_OFF == currentRfState )
|
|
867 |
{
|
|
868 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcRfStatusQueryResp - RF OFF" );
|
|
869 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MTCRFSTATUSQUERYRESP, "CMmSecurityMessHandler::MtcRfStatusQueryResp, RF OFF" );
|
|
870 |
statusInfo = ERfsStateInfoInactive;
|
|
871 |
}
|
|
872 |
TFLOGSTRING2("TSY: OFFLINE MODE IS: %d", statusInfo );
|
|
873 |
OstTrace1( TRACE_NORMAL, DUP4_CMMSECURITYMESSHANDLER_MTCRFSTATUSQUERYRESP, "CMmSecurityMessHandler::MtcRfStatusQueryResp;statusInfo=%d", statusInfo );
|
|
874 |
|
|
875 |
CMmDataPackage dataPackage;
|
|
876 |
dataPackage.PackData ( &statusInfo );
|
|
877 |
|
|
878 |
//inform the upper layer about the new status of the rf
|
|
879 |
iMessageRouter->Complete( EMmTsyBootGetRFStatusIPC, &dataPackage, KErrNone );
|
|
880 |
}
|
|
881 |
|
|
882 |
// -----------------------------------------------------------------------------
|
|
883 |
// CMmSecurityMessHandler::MtcStateQueryReq
|
|
884 |
// Creates a MTC_STATE_QUERY_REQ-message ISI-message and sends it via
|
|
885 |
// phonet
|
|
886 |
// -----------------------------------------------------------------------------
|
|
887 |
//
|
|
888 |
TInt CMmSecurityMessHandler::MtcStateQueryReq(
|
|
889 |
TUint8 aTransactionId
|
|
890 |
) const
|
|
891 |
{
|
|
892 |
|
|
893 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MtcStateQueryReq called" );
|
|
894 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MTCSTATEQUERYREQ, "CMmSecurityMessHandler::MtcStateQueryReq" );
|
|
895 |
|
|
896 |
TBuf8<2> fillerData;
|
|
897 |
fillerData.AppendFill( KSecPadding, 2 ); // Padding bytes
|
|
898 |
|
|
899 |
TInt ret = iPhoNetSender->Send( PN_MTC, aTransactionId, MTC_STATE_QUERY_REQ, fillerData );
|
|
900 |
return ret;
|
|
901 |
}
|
|
902 |
|
|
903 |
// -----------------------------------------------------------------------------
|
|
904 |
// CMmSecurityMessHandler::MtcStateQueryRespL
|
|
905 |
// Breaks a SIM_IND MTC_STATE_QUERY_RESP-message ISI-message and completes
|
|
906 |
// EMmTsyBootNotifyModemStatusReadyIPC to client. If the CMT is not ready with
|
|
907 |
// its transition, renews MTC_STATE_QUERY_REQ
|
|
908 |
// -----------------------------------------------------------------------------
|
|
909 |
//
|
|
910 |
void CMmSecurityMessHandler::MtcStateQueryRespL(
|
|
911 |
const TIsiReceiveC& aIsiMessage )
|
|
912 |
{
|
|
913 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcStateQueryRespL");
|
|
914 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MTCSTATEQUERYRESPL, "CMmSecurityMessHandler::MtcStateQueryRespL" );
|
|
915 |
|
|
916 |
TUint8 currentState = aIsiMessage.Get8bit(ISI_HEADER_SIZE + MTC_STATE_QUERY_RESP_OFFSET_CURRENT);
|
|
917 |
TUint8 nextState = aIsiMessage.Get8bit(ISI_HEADER_SIZE + MTC_STATE_QUERY_RESP_OFFSET_TARGET);
|
|
918 |
|
|
919 |
TFLOGSTRING3("NTSY: CMmSecurityMessHandler::MtcStateQueryRespL - (current: 0x%02x, next: 0x%02x)",currentState, nextState );
|
|
920 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MTCSTATEQUERYRESPL, "CMmSecurityMessHandler::MtcStateQueryRespL;currentState=%hhx;nextState=%hhx", currentState, nextState );
|
|
921 |
|
|
922 |
//CMT side is ready when state transistion is completed (in all normal cases this should be the case)
|
|
923 |
|
|
924 |
//1. CMT_STATE_READY _AND_ CURRENT_STATE_NEW
|
|
925 |
if( currentState == nextState && iBootState.iMtcCurrentState != currentState )
|
|
926 |
{
|
|
927 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcStateQueryRespL - CMT ready." );
|
|
928 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_MTCSTATEQUERYRESPL, "CMmSecurityMessHandler::MtcStateQueryRespL, CMT ready" );
|
|
929 |
iBootState.iMtcCurrentState = currentState;
|
|
930 |
|
|
931 |
if( MTC_NORMAL == currentState )
|
|
932 |
{
|
|
933 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcStateQueryRespL - EMmTsyBootNotifyModemStatusReadyIPC");
|
|
934 |
OstTrace0( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_MTCSTATEQUERYRESPL, "CMmSecurityMessHandler::MtcStateQueryRespL, EMmTsyBootNotifyModemStatusReadyIPC" );
|
|
935 |
iMessageRouter->Complete( EMmTsyBootNotifyModemStatusReadyIPC, KErrNone );
|
|
936 |
}
|
|
937 |
//to complete EMmTsyBootGetRFStatusIPC
|
|
938 |
MtcRfStatusQueryReq( KSecurityTransId );
|
|
939 |
}
|
|
940 |
//2. CMT_STATE_NOT_READY - renew state query, if transition is not yet ready
|
|
941 |
else if ( currentState != nextState )
|
|
942 |
{
|
|
943 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcStateQueryRespL - CMT state transition not ready.");
|
|
944 |
OstTrace0( TRACE_NORMAL, DUP4_CMMSECURITYMESSHANDLER_MTCSTATEQUERYRESPL, "CMmSecurityMessHandler::MtcStateQueryRespL, CMT state transition not ready" );
|
|
945 |
MtcStateQueryReq( KSecurityTransId );
|
|
946 |
}
|
|
947 |
//no else //3. CMT_STATE_READY _AND_ CURRENT_STATE_OLD - no action needed if state already active
|
|
948 |
|
|
949 |
if ( nextState == currentState &&
|
|
950 |
( MTC_NORMAL == currentState || MTC_RF_INACTIVE == currentState ) )
|
|
951 |
{
|
|
952 |
//Dataport opening must be delayed to here instead of
|
|
953 |
//CallMessHandler::ConstructL() to make sure CommonTSY is ready.
|
|
954 |
//Either dataport should not be opened before CSD server
|
|
955 |
//is started (not started in MTC_ALARM or MTC_CHARGING states).
|
|
956 |
iCallMessHandler->InitializeDataportL();
|
|
957 |
}
|
|
958 |
//no else
|
|
959 |
}
|
|
960 |
#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
961 |
// -----------------------------------------------------------------------------
|
|
962 |
// CMmSecurityMessHandler::MceModemStateInd
|
|
963 |
// Breaks a MCE_MODEM_STATE_IND ISI-message and completes
|
|
964 |
// EMmTsyBootNotifyModemStatusReadyIPC to client
|
|
965 |
// -----------------------------------------------------------------------------
|
|
966 |
//
|
|
967 |
void CMmSecurityMessHandler::MceModemStateInd( const TIsiReceiveC& aIsiMessage )
|
|
968 |
{
|
|
969 |
TUint8 state( aIsiMessage.Get8bit(
|
|
970 |
ISI_HEADER_SIZE + MCE_MODEM_STATE_IND_OFFSET_STATE ) );
|
|
971 |
TUint8 action( aIsiMessage.Get8bit(
|
|
972 |
ISI_HEADER_SIZE + MCE_MODEM_STATE_IND_OFFSET_ACTION ) );
|
|
973 |
|
|
974 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::MceModemStateInd action: 0x%02x, state: 0x%02x", action, state);
|
|
975 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MCEMODEMSTATEIND, "CMmSecurityMessHandler::MceModemStateInd;state=%hhx;action=%hhx", state, action );
|
|
976 |
|
|
977 |
// Modem is ready and CMT status has been changed
|
|
978 |
if ( MCE_READY == action && iBootState.iMceCurrentState != state )
|
|
979 |
{
|
|
980 |
iBootState.iMceCurrentState = state;
|
|
981 |
|
|
982 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceModemStateInd - CMT state transition occurred - MCE_NORMAL");
|
|
983 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MCEMODEMSTATEIND, "CMmSecurityMessHandler::MceModemStateInd - CMT state transition occurred - MCE_NORMAL" );
|
|
984 |
|
|
985 |
iMessageRouter->Complete(
|
|
986 |
EMmTsyBootNotifyModemStatusReadyIPC,
|
|
987 |
KErrNone );
|
|
988 |
|
|
989 |
// Dataport opening must be delayed to here instead of
|
|
990 |
// CallMessHandler::ConstructL() to make sure CommonTSY is ready.
|
|
991 |
iCallMessHandler->InitializeDataportL();
|
|
992 |
|
|
993 |
// To complete EMmTsyBootGetRFStatusIPC
|
|
994 |
MceRfStateQueryReq();
|
|
995 |
}
|
|
996 |
// Modem is ready but CMT status has not been changed
|
|
997 |
else if( MCE_READY == action && iBootState.iMceCurrentState == state )
|
|
998 |
{
|
|
999 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MceModemStateInd - CMT state mot changed");
|
|
1000 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_MCEMODEMSTATEIND, "CMmSecurityMessHandler::MceModemStateInd - CMT state not changed" );
|
|
1001 |
}
|
|
1002 |
// No else, modem state not ready - no action needed
|
|
1003 |
}
|
|
1004 |
|
|
1005 |
// -----------------------------------------------------------------------------
|
|
1006 |
// CMmSecurityMessHandler::MceRfStateQueryReq
|
|
1007 |
// Creates MCE_RF_STATE_QUERY_REQ ISI-message and sends it via phonet
|
|
1008 |
// -----------------------------------------------------------------------------
|
|
1009 |
//
|
|
1010 |
TInt CMmSecurityMessHandler::MceRfStateQueryReq() const
|
|
1011 |
{
|
|
1012 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MceRfStateQueryReq");
|
|
1013 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MCERFSTATEQUERYREQ, "CMmSecurityMessHandler::MceRfStateQueryReq" );
|
|
1014 |
|
|
1015 |
// Create MCE_RF_STATE_QUERY_REQ message for querying modem state
|
|
1016 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
1017 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_MODEM_MCE );
|
|
1018 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId );
|
|
1019 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, MCE_RF_STATE_QUERY_REQ );
|
|
1020 |
isiMsg.Set16bit(
|
|
1021 |
ISI_HEADER_SIZE + MCE_RF_STATE_QUERY_REQ_OFFSET_FILLERBYTE1,
|
|
1022 |
KSecPadding );
|
|
1023 |
|
|
1024 |
return iPhoNetSender->Send( isiMsg.Complete() );
|
|
1025 |
}
|
|
1026 |
|
|
1027 |
// -----------------------------------------------------------------------------
|
|
1028 |
// CMmSecurityMessHandler::MceRfStateQueryResp
|
|
1029 |
// Breaks a MCE_RF_STATE_QUERY_RESP ISI-message and completes to client
|
|
1030 |
// -----------------------------------------------------------------------------
|
|
1031 |
//
|
|
1032 |
void CMmSecurityMessHandler::MceRfStateQueryResp(
|
|
1033 |
const TIsiReceiveC& aIsiMessage ) const
|
|
1034 |
{
|
|
1035 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceRfStateQueryResp" );
|
|
1036 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MCERFSTATEQUERYRESP, "CMmSecurityMessHandler::MceRfStateQueryResp" );
|
|
1037 |
|
|
1038 |
TUint8 currentRfState( aIsiMessage.Get8bit(
|
|
1039 |
ISI_HEADER_SIZE + MCE_RF_STATE_QUERY_RESP_OFFSET_CURRENT ) );
|
|
1040 |
|
|
1041 |
// Default is RF OFF
|
|
1042 |
TRfStateInfo statusInfo( ERfsStateInfoInactive );
|
|
1043 |
|
|
1044 |
if( MCE_RF_ON == currentRfState )
|
|
1045 |
{
|
|
1046 |
statusInfo = ERfsStateInfoNormal;
|
|
1047 |
}
|
|
1048 |
|
|
1049 |
TFLOGSTRING2("NTSY: CMmSecurityMessHandler::MceRfStateQueryResp: RF State is: %d", statusInfo );
|
|
1050 |
OstTrace1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MCERFSTATEQUERYRESP, "CMmSecurityMessHandler::MceRfStateQueryResp;statusInfo=%d", statusInfo );
|
|
1051 |
|
|
1052 |
CMmDataPackage dataPackage;
|
|
1053 |
dataPackage.PackData ( &statusInfo );
|
|
1054 |
// Complete RF state
|
|
1055 |
iMessageRouter->Complete(
|
|
1056 |
EMmTsyBootGetRFStatusIPC,
|
|
1057 |
&dataPackage,
|
|
1058 |
KErrNone );
|
|
1059 |
}
|
|
1060 |
|
|
1061 |
// -----------------------------------------------------------------------------
|
|
1062 |
// CMmSecurityMessHandler::MceModemStateQueryReq
|
|
1063 |
// Creates a MCE_MODEM_STATE_QUERY_REQ ISI-message and sends it via
|
|
1064 |
// phonet
|
|
1065 |
// -----------------------------------------------------------------------------
|
|
1066 |
//
|
|
1067 |
TInt CMmSecurityMessHandler::MceModemStateQueryReq() const
|
|
1068 |
{
|
|
1069 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MceModemStateQueryReq" );
|
|
1070 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYREQ, "CMmSecurityMessHandler::MceModemStateQueryReq" );
|
|
1071 |
|
|
1072 |
// Create MCE_MODEM_STATE_QUERY_REQ message for querying modem state
|
|
1073 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
1074 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_MODEM_MCE );
|
|
1075 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId );
|
|
1076 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, MCE_MODEM_STATE_QUERY_REQ );
|
|
1077 |
isiMsg.Set16bit(
|
|
1078 |
ISI_HEADER_SIZE +
|
|
1079 |
MCE_MODEM_STATE_QUERY_REQ_OFFSET_FILLERBYTE1, KSecPadding );
|
|
1080 |
|
|
1081 |
return iPhoNetSender->Send( isiMsg.Complete() );
|
|
1082 |
}
|
|
1083 |
|
|
1084 |
// -----------------------------------------------------------------------------
|
|
1085 |
// CMmSecurityMessHandler::MceStateQueryRespL
|
|
1086 |
// Breaks a MCE_MODEM_STATE_QUERY_RESP message ISI-message and completes
|
|
1087 |
// EMmTsyBootNotifyModemStatusReadyIPC to client. If the CMT is not ready with
|
|
1088 |
// its transition, renews MTC_STATE_QUERY_REQ
|
|
1089 |
// -----------------------------------------------------------------------------
|
|
1090 |
//
|
|
1091 |
void CMmSecurityMessHandler::MceModemStateQueryResp(
|
|
1092 |
const TIsiReceiveC& aIsiMessage )
|
|
1093 |
{
|
|
1094 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceModemStateQueryResp");
|
|
1095 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYRESP, "CMmSecurityMessHandler::MceModemStateQueryResp" );
|
|
1096 |
|
|
1097 |
TUint8 currentState( aIsiMessage.Get8bit(
|
|
1098 |
ISI_HEADER_SIZE + MCE_MODEM_STATE_QUERY_RESP_OFFSET_CURRENT ) );
|
|
1099 |
TUint8 nextState( aIsiMessage.Get8bit(
|
|
1100 |
ISI_HEADER_SIZE + MCE_MODEM_STATE_QUERY_RESP_OFFSET_TARGET ) );
|
|
1101 |
|
|
1102 |
TFLOGSTRING3("NTSY: CMmSecurityMessHandler::MceModemStateQueryResp - (current: 0x%02x, next: 0x%02x)",currentState, nextState );
|
|
1103 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYRESP, "CMmSecurityMessHandler::MceModemStateQueryResp;currentState=%hhx;nextState=%hhx", currentState, nextState );
|
|
1104 |
|
|
1105 |
// CMT side is ready when state transistion is completed
|
|
1106 |
// (in all normal cases this should be the case)
|
|
1107 |
|
|
1108 |
// Modem is ready and CMT status has been changed
|
|
1109 |
if( currentState == nextState &&
|
|
1110 |
iBootState.iMceCurrentState != currentState )
|
|
1111 |
{
|
|
1112 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceModemStateQueryResp - CMT ready." );
|
|
1113 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYRESP, "CMmSecurityMessHandler::MceModemStateQueryResp - CMT ready" );
|
|
1114 |
|
|
1115 |
iBootState.iMceCurrentState = currentState;
|
|
1116 |
|
|
1117 |
if( MCE_NORMAL == currentState )
|
|
1118 |
{
|
|
1119 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceModemStateQueryResp - EMmTsyBootNotifyModemStatusReadyIPC");
|
|
1120 |
OstTrace0( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYRESP, "CMmSecurityMessHandler::MceModemStateQueryResp- EMmTsyBootNotifyModemStatusReadyIPC" );
|
|
1121 |
iMessageRouter->Complete(
|
|
1122 |
EMmTsyBootNotifyModemStatusReadyIPC,
|
|
1123 |
KErrNone );
|
|
1124 |
|
|
1125 |
// Dataport opening must be delayed to here instead of
|
|
1126 |
// CallMessHandler::ConstructL() to make sure CommonTSY is ready.
|
|
1127 |
iCallMessHandler->InitializeDataportL();
|
|
1128 |
}
|
|
1129 |
}
|
|
1130 |
// Renew state query, if transition is not yet ready
|
|
1131 |
else if ( currentState != nextState )
|
|
1132 |
{
|
|
1133 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceModemStateQueryResp - CMT state transition not ready.");
|
|
1134 |
OstTrace0( TRACE_NORMAL, DUP4_CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYRESP, "CMmSecurityMessHandler::MceModemStateQueryResp -- CMT state transition not ready" );
|
|
1135 |
MceModemStateQueryReq();
|
|
1136 |
}
|
|
1137 |
}
|
|
1138 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
|
|
1139 |
|
|
1140 |
// -----------------------------------------------------------------------------
|
|
1141 |
// CMmSecurityMessHandler::UiccPinInd
|
|
1142 |
// Breaks a UICC_PIN_IND ISI-message.
|
|
1143 |
// -----------------------------------------------------------------------------
|
|
1144 |
//
|
|
1145 |
void CMmSecurityMessHandler::UiccPinInd( const TIsiReceiveC& aIsiMessage )
|
|
1146 |
{
|
|
1147 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPININD, "CMmSecurityMessHandler::UiccPinInd" );
|
|
1148 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinInd");
|
|
1149 |
|
|
1150 |
// Event to be completed
|
|
1151 |
RMobilePhone::TMobilePhoneSecurityEvent event( RMobilePhone::ENoICCFound );
|
|
1152 |
|
|
1153 |
// Save application ID, needed in UICC_PIN_VERIFY_REQ
|
|
1154 |
iApplicationId = aIsiMessage.Get8bit(
|
|
1155 |
ISI_HEADER_SIZE + UICC_PIN_IND_OFFSET_APPLID );
|
|
1156 |
|
|
1157 |
// Get service type
|
|
1158 |
TUint8 serviceType( aIsiMessage.Get8bit(
|
|
1159 |
ISI_HEADER_SIZE + UICC_PIN_IND_OFFSET_SERVICETYPE ) );
|
|
1160 |
// Get PIN ID
|
|
1161 |
// TS 102.221 Table 9.3: PIN mapping into key references
|
|
1162 |
// PIN1: '01','02','03','04','05','06','07','08'
|
|
1163 |
// PIN2: '81','82','83','84', '85','86','87','88'
|
|
1164 |
// UPIN: '11'
|
|
1165 |
// PIN ID is needed when verifying PIN/PUK code
|
|
1166 |
iPinId = aIsiMessage.Get8bit(
|
|
1167 |
ISI_HEADER_SIZE + UICC_PIN_IND_OFFSET_PINID );
|
|
1168 |
|
|
1169 |
if ( UICC_PIN_VERIFY_NEEDED == serviceType )
|
|
1170 |
{
|
|
1171 |
// PIN1
|
|
1172 |
if ( 0x01 <= iPinId && 0x08 >= iPinId )
|
|
1173 |
{
|
|
1174 |
event = RMobilePhone::EPin1Required;
|
|
1175 |
}
|
|
1176 |
// PIN2
|
|
1177 |
else if ( 0x81 <= iPinId && 0x88 >= iPinId )
|
|
1178 |
{
|
|
1179 |
event = RMobilePhone::EPin2Required;
|
|
1180 |
}
|
|
1181 |
// UPIN
|
|
1182 |
else if ( 0x11 == iPinId )
|
|
1183 |
{
|
|
1184 |
event = RMobilePhone::EUniversalPinRequired;
|
|
1185 |
}
|
|
1186 |
// No else
|
|
1187 |
}
|
|
1188 |
else if ( UICC_PIN_UNBLOCK_NEEDED == serviceType )
|
|
1189 |
{
|
|
1190 |
// PIN1
|
|
1191 |
if ( 0x01 <= iPinId && 0x08 >= iPinId )
|
|
1192 |
{
|
|
1193 |
event = RMobilePhone::EPuk1Required;
|
|
1194 |
iPukCodeRequired = ETrue;
|
|
1195 |
}
|
|
1196 |
// PIN2
|
|
1197 |
else if ( 0x81 <= iPinId && 0x88 >= iPinId )
|
|
1198 |
{
|
|
1199 |
event = RMobilePhone::EPuk2Required;
|
|
1200 |
}
|
|
1201 |
// UPIN
|
|
1202 |
else if ( 0x11 == iPinId )
|
|
1203 |
{
|
|
1204 |
event = RMobilePhone::EUniversalPukRequired;
|
|
1205 |
}
|
|
1206 |
// No else
|
|
1207 |
}
|
|
1208 |
// Complete notify security event
|
|
1209 |
CMmDataPackage dataPackage;
|
|
1210 |
dataPackage.PackData( &event );
|
|
1211 |
iMessageRouter->Complete(
|
|
1212 |
EMobilePhoneNotifySecurityEvent,
|
|
1213 |
&dataPackage,
|
|
1214 |
KErrNone );
|
|
1215 |
}
|
|
1216 |
|
|
1217 |
// -----------------------------------------------------------------------------
|
|
1218 |
// CMmSecurityMessHandler::UiccPinReqVerify
|
|
1219 |
// Creates and sends UICC_PIN_REQ ISI message.
|
|
1220 |
// -----------------------------------------------------------------------------
|
|
1221 |
//
|
|
1222 |
TInt CMmSecurityMessHandler::UiccPinReqVerify(
|
|
1223 |
const TUint8 aServiceType,
|
|
1224 |
const RMobilePhone::TMobilePassword& aCode,
|
|
1225 |
const RMobilePhone::TMobilePassword& aUnblockCode )
|
|
1226 |
{
|
|
1227 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinReqVerify");
|
|
1228 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPINREQ, "CMmSecurityMessHandler::UiccPinReqVerify" );
|
|
1229 |
|
|
1230 |
TUint8 numOfSubblocks( 1 ); // in case of PIN verify
|
|
1231 |
TUint8 pinQualifier( UICC_PIN_OLD ); // in case of PIN verify
|
|
1232 |
TUint messageOffset( ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ );
|
|
1233 |
|
|
1234 |
if ( UICC_PIN_UNBLOCK == aServiceType )
|
|
1235 |
{
|
|
1236 |
numOfSubblocks = 2;
|
|
1237 |
pinQualifier = UICC_PIN_NEW;
|
|
1238 |
}
|
|
1239 |
|
|
1240 |
// Create UICC_REQ message for querying card status
|
|
1241 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
1242 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
1243 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId );
|
|
1244 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_PIN_REQ );
|
|
1245 |
isiMsg.Set8bit(
|
|
1246 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_SERVICETYPE,
|
|
1247 |
aServiceType );
|
|
1248 |
isiMsg.Set8bit(
|
|
1249 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_APPLID,
|
|
1250 |
iApplicationId );
|
|
1251 |
// 3x filler
|
|
1252 |
isiMsg.Set8bit(
|
|
1253 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1,
|
|
1254 |
KSecPadding );
|
|
1255 |
isiMsg.Set8bit(
|
|
1256 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 1,
|
|
1257 |
KSecPadding );
|
|
1258 |
isiMsg.Set8bit(
|
|
1259 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 2,
|
|
1260 |
KSecPadding );
|
|
1261 |
isiMsg.Set8bit(
|
|
1262 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_NSB,
|
|
1263 |
numOfSubblocks );
|
|
1264 |
|
|
1265 |
// In case unblocking request, create UICC_SB_PUK
|
|
1266 |
if ( UICC_PIN_UNBLOCK == aServiceType )
|
|
1267 |
{
|
|
1268 |
TBuf8<KMaxSizeUiccSbPuk> uiccSbPukBuf( 0 );
|
|
1269 |
TIsiSubBlock uiccSbPuk(
|
|
1270 |
uiccSbPukBuf,
|
|
1271 |
UICC_SB_PUK,
|
|
1272 |
EIsiSubBlockTypeId16Len16 );
|
|
1273 |
|
|
1274 |
uiccSbPukBuf.Append( iPinId ); // PIN ID
|
|
1275 |
uiccSbPukBuf.Append( aUnblockCode.Length() ); // Length of PUK code
|
|
1276 |
uiccSbPukBuf.Append( aUnblockCode ); // PUK code
|
|
1277 |
|
|
1278 |
// Append subblock to ISI message
|
|
1279 |
isiMsg.CopyData(
|
|
1280 |
messageOffset,
|
|
1281 |
uiccSbPuk.CompleteSubBlock() );
|
|
1282 |
|
|
1283 |
messageOffset += uiccSbPukBuf.Length();
|
|
1284 |
}
|
|
1285 |
|
|
1286 |
// Create succlock UICC_SB_PIN
|
|
1287 |
TBuf8<KMaxSizeUiccSbPin> uiccSbPinBuf( 0 );
|
|
1288 |
TIsiSubBlock uiccSbPin(
|
|
1289 |
uiccSbPinBuf,
|
|
1290 |
UICC_SB_PIN,
|
|
1291 |
EIsiSubBlockTypeId16Len16 );
|
|
1292 |
|
|
1293 |
// PIN ID
|
|
1294 |
uiccSbPinBuf.Append( iPinId );
|
|
1295 |
uiccSbPinBuf.Append( pinQualifier ); // PIN qualifier
|
|
1296 |
uiccSbPinBuf.Append( aCode.Length() ); // Length of PIN code
|
|
1297 |
uiccSbPinBuf.Append( aCode ); // PIN code
|
|
1298 |
|
|
1299 |
// Append subblock to ISI message
|
|
1300 |
isiMsg.CopyData(
|
|
1301 |
messageOffset,
|
|
1302 |
uiccSbPin.CompleteSubBlock() );
|
|
1303 |
|
|
1304 |
return iPhoNetSender->Send( isiMsg.Complete() );
|
|
1305 |
}
|
|
1306 |
|
|
1307 |
// -----------------------------------------------------------------------------
|
|
1308 |
// CMmSecurityMessHandler::UiccPinResp
|
|
1309 |
// Breaks a UICC_PIN_IND ISI-message.
|
|
1310 |
// -----------------------------------------------------------------------------
|
|
1311 |
//
|
|
1312 |
void CMmSecurityMessHandler::UiccPinResp( const TIsiReceiveC& aIsiMessage )
|
|
1313 |
{
|
|
1314 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPINRESP, "CMmSecurityMessHandler::UiccPinResp" );
|
|
1315 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinResp");
|
|
1316 |
|
|
1317 |
// Get service type and status
|
|
1318 |
TUint8 serviceType( aIsiMessage.Get8bit(
|
|
1319 |
ISI_HEADER_SIZE + UICC_PIN_RESP_OFFSET_SERVICETYPE ) );
|
|
1320 |
TUint8 status( aIsiMessage.Get8bit(
|
|
1321 |
ISI_HEADER_SIZE + UICC_PIN_RESP_OFFSET_STATUS ) );
|
|
1322 |
|
|
1323 |
switch( serviceType )
|
|
1324 |
{
|
|
1325 |
case UICC_PIN_VERIFY:
|
|
1326 |
case UICC_PIN_UNBLOCK:
|
|
1327 |
{
|
|
1328 |
HandleUiccPinVerifyResp( status, aIsiMessage );
|
|
1329 |
break;
|
|
1330 |
}
|
|
1331 |
case UICC_PIN_INFO:
|
|
1332 |
{
|
|
1333 |
HandleUiccPinInfoResp( status, aIsiMessage );
|
|
1334 |
break;
|
|
1335 |
}
|
|
1336 |
case UICC_PIN_CHANGE:
|
|
1337 |
{
|
|
1338 |
HandleUiccPinChangeResp( status, aIsiMessage );
|
|
1339 |
break;
|
|
1340 |
}
|
|
1341 |
case UICC_PIN_ENABLE:
|
|
1342 |
case UICC_PIN_DISABLE:
|
|
1343 |
case UICC_PIN_SUBSTITUTE:
|
|
1344 |
{
|
|
1345 |
HandleUiccPinStateChangeResp( status, aIsiMessage );
|
|
1346 |
break;
|
|
1347 |
}
|
|
1348 |
default:
|
|
1349 |
{
|
|
1350 |
break;
|
|
1351 |
}
|
|
1352 |
}
|
|
1353 |
}
|
|
1354 |
|
|
1355 |
// -----------------------------------------------------------------------------
|
|
1356 |
// CMmSecurityMessHandler::UiccPinReqStateQuery
|
|
1357 |
// Creates and sends UICC_PIN_REQ ISI message.
|
|
1358 |
// -----------------------------------------------------------------------------
|
|
1359 |
//
|
|
1360 |
TInt CMmSecurityMessHandler::UiccPinReqStateQuery(
|
|
1361 |
const RMobilePhone::TMobilePhoneLock aLock )
|
|
1362 |
{
|
|
1363 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinReqStateQuery");
|
|
1364 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPINREQSTATEQUERY, "CMmSecurityMessHandler::UiccPinReqStateQuery" );
|
|
1365 |
|
|
1366 |
TUint8 pinId( 0 );
|
|
1367 |
|
|
1368 |
if ( RMobilePhone::ELockICC == aLock )
|
|
1369 |
{
|
|
1370 |
pinId = iMmUiccMessHandler->GetPin1KeyReference();
|
|
1371 |
}
|
|
1372 |
else if ( RMobilePhone::ELockPin2 == aLock )
|
|
1373 |
{
|
|
1374 |
pinId = iMmUiccMessHandler->GetPin2KeyReference();
|
|
1375 |
}
|
|
1376 |
else
|
|
1377 |
{
|
|
1378 |
pinId = 0x11; // UPIN
|
|
1379 |
}
|
|
1380 |
// Create UICC_REQ message for querying card status
|
|
1381 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
1382 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
1383 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId );
|
|
1384 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_PIN_REQ );
|
|
1385 |
isiMsg.Set8bit(
|
|
1386 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_SERVICETYPE,
|
|
1387 |
UICC_PIN_INFO );
|
|
1388 |
isiMsg.Set8bit(
|
|
1389 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_APPLID,
|
|
1390 |
iApplicationId );
|
|
1391 |
// 3x filler
|
|
1392 |
isiMsg.Set8bit(
|
|
1393 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1,
|
|
1394 |
KSecPadding );
|
|
1395 |
isiMsg.Set8bit(
|
|
1396 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 1,
|
|
1397 |
KSecPadding );
|
|
1398 |
isiMsg.Set8bit(
|
|
1399 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 2,
|
|
1400 |
KSecPadding );
|
|
1401 |
isiMsg.Set8bit(
|
|
1402 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_NSB,
|
|
1403 |
1 ); // One subblock, UICC_SB_PIN_REF
|
|
1404 |
|
|
1405 |
// Create succlock UICC_SB_PIN_REF
|
|
1406 |
TBuf8<KMaxSizeUiccSbPin> uiccSbPinRefBuf( 0 );
|
|
1407 |
TIsiSubBlock uiccSbPinRef(
|
|
1408 |
uiccSbPinRefBuf,
|
|
1409 |
UICC_SB_PIN_REF,
|
|
1410 |
EIsiSubBlockTypeId16Len16 );
|
|
1411 |
|
|
1412 |
// PIN ID
|
|
1413 |
uiccSbPinRefBuf.Append( pinId );
|
|
1414 |
uiccSbPinRefBuf.Append( KSecPadding ); // PIN qualifier
|
|
1415 |
uiccSbPinRefBuf.Append( KSecPadding ); // Length of PIN code
|
|
1416 |
uiccSbPinRefBuf.Append( KSecPadding ); // PIN code
|
|
1417 |
|
|
1418 |
// Append subblock to ISI message
|
|
1419 |
isiMsg.CopyData(
|
|
1420 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ,
|
|
1421 |
uiccSbPinRef.CompleteSubBlock() );
|
|
1422 |
|
|
1423 |
return iPhoNetSender->Send( isiMsg.Complete() );
|
|
1424 |
}
|
|
1425 |
|
|
1426 |
// -----------------------------------------------------------------------------
|
|
1427 |
// CMmSecurityMessHandler::UiccPinReqChange
|
|
1428 |
// Creates and sends UICC_PIN_REQ ISI message.
|
|
1429 |
// -----------------------------------------------------------------------------
|
|
1430 |
//
|
|
1431 |
TInt CMmSecurityMessHandler::UiccPinReqChange(
|
|
1432 |
RMobilePhone::TMobilePhoneSecurityCode& aType,
|
|
1433 |
const RMobilePhone::TMobilePassword& aOldCode,
|
|
1434 |
const RMobilePhone::TMobilePassword& aNewCode )
|
|
1435 |
{
|
|
1436 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinReqChange");
|
|
1437 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPINREQCHANGE, "CMmSecurityMessHandler::UiccPinReqChange" );
|
|
1438 |
|
|
1439 |
TUint8 pinId( 0 );
|
|
1440 |
if ( RMobilePhone::ESecurityCodePin1 == aType )
|
|
1441 |
{
|
|
1442 |
pinId = iMmUiccMessHandler->GetPin1KeyReference();
|
|
1443 |
}
|
|
1444 |
else if ( RMobilePhone::ESecurityCodePin2 == aType )
|
|
1445 |
{
|
|
1446 |
pinId = iMmUiccMessHandler->GetPin2KeyReference();
|
|
1447 |
}
|
|
1448 |
else
|
|
1449 |
{
|
|
1450 |
pinId = KUniversalPinKeyReference;
|
|
1451 |
}
|
|
1452 |
|
|
1453 |
// Create UICC_REQ message for changing PIN code
|
|
1454 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
1455 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
1456 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId );
|
|
1457 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_PIN_REQ );
|
|
1458 |
isiMsg.Set8bit(
|
|
1459 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_SERVICETYPE,
|
|
1460 |
UICC_PIN_CHANGE );
|
|
1461 |
isiMsg.Set8bit(
|
|
1462 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_APPLID,
|
|
1463 |
iApplicationId );
|
|
1464 |
// 3x filler
|
|
1465 |
isiMsg.Set8bit(
|
|
1466 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1,
|
|
1467 |
KSecPadding );
|
|
1468 |
isiMsg.Set8bit(
|
|
1469 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 1,
|
|
1470 |
KSecPadding );
|
|
1471 |
isiMsg.Set8bit(
|
|
1472 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 2,
|
|
1473 |
KSecPadding );
|
|
1474 |
isiMsg.Set8bit(
|
|
1475 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_NSB,
|
|
1476 |
2 ); // Two UICC_SB_PIN subblocks
|
|
1477 |
|
|
1478 |
// Create succlock UICC_SB_PIN for new PIN code
|
|
1479 |
TBuf8<KMaxSizeUiccSbPin> uiccSbPinBuf( 0 );
|
|
1480 |
TIsiSubBlock uiccSbPinOld(
|
|
1481 |
uiccSbPinBuf,
|
|
1482 |
UICC_SB_PIN,
|
|
1483 |
EIsiSubBlockTypeId16Len16 );
|
|
1484 |
|
|
1485 |
// PIN ID
|
|
1486 |
uiccSbPinBuf.Append( pinId );
|
|
1487 |
uiccSbPinBuf.Append( UICC_PIN_OLD ); // PIN qualifier
|
|
1488 |
uiccSbPinBuf.Append( aOldCode.Length() ); // Length of PIN code
|
|
1489 |
uiccSbPinBuf.Append( aOldCode ); // PIN code
|
|
1490 |
|
|
1491 |
// Append subblock to ISI message
|
|
1492 |
isiMsg.CopyData(
|
|
1493 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ,
|
|
1494 |
uiccSbPinOld.CompleteSubBlock() );
|
|
1495 |
|
|
1496 |
TUint sbLength( uiccSbPinBuf.Length() );
|
|
1497 |
|
|
1498 |
// Create succlock UICC_SB_PIN for old PIN code
|
|
1499 |
uiccSbPinBuf.Zero();
|
|
1500 |
TIsiSubBlock uiccSbPinNew(
|
|
1501 |
uiccSbPinBuf,
|
|
1502 |
UICC_SB_PIN,
|
|
1503 |
EIsiSubBlockTypeId16Len16 );
|
|
1504 |
|
|
1505 |
// PIN ID
|
|
1506 |
uiccSbPinBuf.Append( pinId );
|
|
1507 |
uiccSbPinBuf.Append( UICC_PIN_NEW ); // PIN qualifier
|
|
1508 |
uiccSbPinBuf.Append( aNewCode.Length() ); // Length of PIN code
|
|
1509 |
uiccSbPinBuf.Append( aNewCode ); // PIN code
|
|
1510 |
|
|
1511 |
// Append subblock to ISI message
|
|
1512 |
isiMsg.CopyData(
|
|
1513 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ + sbLength,
|
|
1514 |
uiccSbPinNew.CompleteSubBlock() );
|
|
1515 |
|
|
1516 |
return iPhoNetSender->Send( isiMsg.Complete() );
|
|
1517 |
}
|
|
1518 |
|
|
1519 |
|
|
1520 |
// -----------------------------------------------------------------------------
|
|
1521 |
// CMmSecurityMessHandler::UiccPinReqChangeState
|
|
1522 |
// Creates and sends UICC_PIN_REQ ISI message.
|
|
1523 |
// -----------------------------------------------------------------------------
|
|
1524 |
//
|
|
1525 |
TInt CMmSecurityMessHandler::UiccPinReqChangeState(
|
|
1526 |
const RMobilePhone::TMobilePhoneLock aLock,
|
|
1527 |
const RMobilePhone::TMobilePhoneLockSetting& aSetting,
|
|
1528 |
const RMobilePhone::TMobilePassword& aCode )
|
|
1529 |
{
|
|
1530 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinReqChangeState");
|
|
1531 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPINREQCHANGESTATE, "CMmSecurityMessHandler::UiccPinReqChangeState" );
|
|
1532 |
|
|
1533 |
TInt ret( KErrNone );
|
|
1534 |
TUint8 pinId( KUniversalPinKeyReference );
|
|
1535 |
TUint8 pinIdToBeSubstituted( KUniversalPinKeyReference );
|
|
1536 |
TUint8 pinIdSubstitution( KUniversalPinKeyReference );
|
|
1537 |
TUint8 setting( UICC_PIN_SUBSTITUTE );
|
|
1538 |
// Set PIN ID
|
|
1539 |
if ( RMobilePhone::ELockICC == aLock )
|
|
1540 |
{
|
|
1541 |
pinId = iMmUiccMessHandler->GetPin1KeyReference();
|
|
1542 |
pinIdSubstitution = pinId; // Replace UPIN by PIN
|
|
1543 |
}
|
|
1544 |
else if ( RMobilePhone::ELockPin2 == aLock )
|
|
1545 |
{
|
|
1546 |
pinId = iMmUiccMessHandler->GetPin2KeyReference();
|
|
1547 |
}
|
|
1548 |
else
|
|
1549 |
{
|
|
1550 |
pinIdToBeSubstituted = iMmUiccMessHandler->GetPin1KeyReference();
|
|
1551 |
}
|
|
1552 |
|
|
1553 |
// Set new state to be changed
|
|
1554 |
if ( RMobilePhone::ELockSetEnabled == aSetting )
|
|
1555 |
{
|
|
1556 |
setting = UICC_PIN_ENABLE;
|
|
1557 |
}
|
|
1558 |
else if ( RMobilePhone::ELockSetDisabled == aSetting )
|
|
1559 |
{
|
|
1560 |
setting = UICC_PIN_DISABLE;
|
|
1561 |
}
|
|
1562 |
else if ( RMobilePhone::ELockReplaced == aSetting )
|
|
1563 |
{
|
|
1564 |
// PIN 1 ID is always used in case of substitute
|
|
1565 |
pinId = iMmUiccMessHandler->GetPin1KeyReference();
|
|
1566 |
}
|
|
1567 |
else
|
|
1568 |
{
|
|
1569 |
ret = KErrNotSupported;
|
|
1570 |
}
|
|
1571 |
|
|
1572 |
if ( KErrNone == ret )
|
|
1573 |
{
|
|
1574 |
// Create UICC_REQ message for changing PIN code state
|
|
1575 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
1576 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
1577 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId );
|
|
1578 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_PIN_REQ );
|
|
1579 |
isiMsg.Set8bit(
|
|
1580 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_SERVICETYPE,
|
|
1581 |
setting );
|
|
1582 |
isiMsg.Set8bit(
|
|
1583 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_APPLID,
|
|
1584 |
iApplicationId );
|
|
1585 |
// 3x filler
|
|
1586 |
isiMsg.Set8bit(
|
|
1587 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1,
|
|
1588 |
KSecPadding );
|
|
1589 |
isiMsg.Set8bit(
|
|
1590 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 1,
|
|
1591 |
KSecPadding );
|
|
1592 |
isiMsg.Set8bit(
|
|
1593 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 2,
|
|
1594 |
KSecPadding );
|
|
1595 |
isiMsg.Set8bit(
|
|
1596 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_NSB,
|
|
1597 |
1 ); // UICC_SB_PIN
|
|
1598 |
|
|
1599 |
// Create succlock UICC_SB_PIN for PIN code
|
|
1600 |
TBuf8<KMaxSizeUiccSbPin> uiccSbPinBuf( 0 );
|
|
1601 |
TIsiSubBlock uiccSbPin(
|
|
1602 |
uiccSbPinBuf,
|
|
1603 |
UICC_SB_PIN,
|
|
1604 |
EIsiSubBlockTypeId16Len16 );
|
|
1605 |
uiccSbPinBuf.Append( pinId ); // PIN ID
|
|
1606 |
uiccSbPinBuf.Append( UICC_PIN_OLD ); // PIN qualifier
|
|
1607 |
uiccSbPinBuf.Append( aCode.Length() ); // Length of PIN code
|
|
1608 |
uiccSbPinBuf.Append( aCode ); // PIN code
|
|
1609 |
// Append subblock to ISI message
|
|
1610 |
isiMsg.CopyData(
|
|
1611 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ,
|
|
1612 |
uiccSbPin.CompleteSubBlock() );
|
|
1613 |
|
|
1614 |
// If request was to replace PIN by UPIN or vice versa
|
|
1615 |
// subblock UICC_SB_PIN_SUBST is also added
|
|
1616 |
if ( UICC_PIN_SUBSTITUTE == setting )
|
|
1617 |
{
|
|
1618 |
TBuf8<SIZE_UICC_SB_PIN_SUBST> uiccSbPinSubstBuf( 0 );
|
|
1619 |
TIsiSubBlock uiccSbPinSubst(
|
|
1620 |
uiccSbPinSubstBuf,
|
|
1621 |
UICC_SB_PIN_SUBST,
|
|
1622 |
EIsiSubBlockTypeId16Len16 );
|
|
1623 |
uiccSbPinSubstBuf.Append( pinIdToBeSubstituted );
|
|
1624 |
uiccSbPinSubstBuf.Append( pinIdSubstitution );
|
|
1625 |
uiccSbPinSubstBuf.Append( KSecPadding );
|
|
1626 |
uiccSbPinSubstBuf.Append( KSecPadding );
|
|
1627 |
// Append subblock to ISI message
|
|
1628 |
isiMsg.CopyData(
|
|
1629 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ + uiccSbPinBuf.Length(),
|
|
1630 |
uiccSbPinSubst.CompleteSubBlock() );
|
|
1631 |
}
|
|
1632 |
|
|
1633 |
ret = iPhoNetSender->Send( isiMsg.Complete() );
|
|
1634 |
}
|
|
1635 |
return ret;
|
|
1636 |
}
|
|
1637 |
|
|
1638 |
|
|
1639 |
// -----------------------------------------------------------------------------
|
|
1640 |
// CMmSecurityMessHandler::HandleUiccPinVerifyResp
|
|
1641 |
// -----------------------------------------------------------------------------
|
|
1642 |
//
|
|
1643 |
void CMmSecurityMessHandler::HandleUiccPinVerifyResp(
|
|
1644 |
const TUint8 aStatus,
|
|
1645 |
const TIsiReceiveC& aIsiMessage )
|
|
1646 |
{
|
|
1647 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::HandleUiccPinVerifyResp");
|
|
1648 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_HANDLEUICCPINVERIFYRESP, "CMmSecurityMessHandler::HandleUiccPinVerifyResp" );
|
|
1649 |
|
|
1650 |
TInt ret( KErrNone );
|
|
1651 |
|
|
1652 |
if ( UICC_STATUS_OK != aStatus )
|
|
1653 |
{
|
|
1654 |
ret = KErrGeneral;
|
|
1655 |
// Subblock UICC_SB_STATUS_WORD contains cause information
|
|
1656 |
TUint uiccSbStatusWordOffset( 0 );
|
|
1657 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
|
|
1658 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_RESP,
|
|
1659 |
UICC_SB_STATUS_WORD,
|
|
1660 |
EIsiSubBlockTypeId16Len16,
|
|
1661 |
uiccSbStatusWordOffset ) )
|
|
1662 |
{
|
|
1663 |
TUint8 sw1( aIsiMessage.Get8bit(
|
|
1664 |
uiccSbStatusWordOffset +
|
|
1665 |
UICC_SB_STATUS_WORD_OFFSET_SW1 ) );
|
|
1666 |
TUint8 sw2( aIsiMessage.Get8bit(
|
|
1667 |
uiccSbStatusWordOffset +
|
|
1668 |
UICC_SB_STATUS_WORD_OFFSET_SW2 ) );
|
|
1669 |
|
|
1670 |
// Get status words and map to symbian error codes
|
|
1671 |
TUint16 statusWord( sw1 << 8 | sw2 );
|
|
1672 |
|
|
1673 |
// Map status word to symbian error codes. See status word coding from
|
|
1674 |
// TS 102.221 V7.11.0 Chapter 10.2.1
|
|
1675 |
|
|
1676 |
// 0x63CX: PIN was not correct and there are 'X' retries left
|
|
1677 |
if ( 0x63 == sw1 && 0x0C == ( sw2 >> 4 ) )
|
|
1678 |
{
|
|
1679 |
ret = CMmStaticUtility::EpocErrorCode(
|
|
1680 |
KErrAccessDenied,
|
|
1681 |
KErrGsm0707IncorrectPassword );
|
|
1682 |
}
|
|
1683 |
else if ( 0x6983 == statusWord ) // Authentication/PIN method blocked
|
|
1684 |
{
|
|
1685 |
ret = CMmStaticUtility::EpocErrorCode(
|
|
1686 |
KErrAccessDenied,
|
|
1687 |
KErrGsmSSPasswordAttemptsViolation );
|
|
1688 |
}
|
|
1689 |
// No else, KErrGeneral is returned
|
|
1690 |
}
|
|
1691 |
} // End of if ( UICC_STATUS_OK != status )
|
|
1692 |
|
|
1693 |
iMessageRouter->Complete( EMobilePhoneVerifySecurityCode, ret );
|
|
1694 |
}
|
|
1695 |
|
|
1696 |
|
|
1697 |
// -----------------------------------------------------------------------------
|
|
1698 |
// CMmSecurityMessHandler::HandleUiccPinInfoResp
|
|
1699 |
// -----------------------------------------------------------------------------
|
|
1700 |
//
|
|
1701 |
void CMmSecurityMessHandler::HandleUiccPinInfoResp(
|
|
1702 |
const TUint8 aStatus,
|
|
1703 |
const TIsiReceiveC& aIsiMessage )
|
|
1704 |
{
|
|
1705 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::HandleUiccPinInfoResp");
|
|
1706 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_HANDLEUICCPININFORESP, "CMmSecurityMessHandler::HandleUiccPinInfoResp" );
|
|
1707 |
|
|
1708 |
TInt ret( KErrNone );
|
|
1709 |
CMmDataPackage dataPackage;
|
|
1710 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
|
|
1711 |
lockInfo.iStatus = RMobilePhone::EStatusLockUnknown;
|
|
1712 |
lockInfo.iSetting = RMobilePhone::ELockSetUnknown;
|
|
1713 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5 securityInfo;
|
|
1714 |
TUint8 pinStatus( UICC_STATUS_UNKNOWN );
|
|
1715 |
TUint8 pinAttemptsLeft( 0 );
|
|
1716 |
TUint8 pukAttemptsLeft( 0 );
|
|
1717 |
|
|
1718 |
// Subblock UICC_SB_PIN_INFO
|
|
1719 |
TUint uiccSbPinInfoOffset( 0 );
|
|
1720 |
if ( UICC_STATUS_OK == aStatus &&
|
|
1721 |
KErrNone == aIsiMessage.FindSubBlockOffsetById(
|
|
1722 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_RESP,
|
|
1723 |
UICC_SB_PIN_INFO,
|
|
1724 |
EIsiSubBlockTypeId16Len16,
|
|
1725 |
uiccSbPinInfoOffset ) )
|
|
1726 |
{
|
|
1727 |
pinStatus = aIsiMessage.Get8bit(
|
|
1728 |
uiccSbPinInfoOffset +
|
|
1729 |
UICC_SB_PIN_INFO_OFFSET_PINSTATUS );
|
|
1730 |
pinAttemptsLeft = aIsiMessage.Get8bit(
|
|
1731 |
uiccSbPinInfoOffset +
|
|
1732 |
UICC_SB_PIN_INFO_OFFSET_PINATT );
|
|
1733 |
pukAttemptsLeft = aIsiMessage.Get8bit(
|
|
1734 |
uiccSbPinInfoOffset +
|
|
1735 |
UICC_SB_PIN_INFO_OFFSET_PUKATT );
|
|
1736 |
|
|
1737 |
// This is PIN attempts left query
|
|
1738 |
if ( iPinAttemptsLeftQuery )
|
|
1739 |
{
|
|
1740 |
// PIN codes
|
|
1741 |
if ( RMobilePhone::ESecurityCodePin1 == iCodeType ||
|
|
1742 |
RMobilePhone::ESecurityCodePin2 == iCodeType ||
|
|
1743 |
RMobilePhone::ESecurityUniversalPin == iCodeType )
|
|
1744 |
{
|
|
1745 |
securityInfo.iRemainingEntryAttempts = pinAttemptsLeft;
|
|
1746 |
}
|
|
1747 |
else // PUK codes
|
|
1748 |
{
|
|
1749 |
securityInfo.iRemainingEntryAttempts = pukAttemptsLeft;
|
|
1750 |
}
|
|
1751 |
}
|
|
1752 |
if ( iLockStateQuery ) // This is lock state query
|
|
1753 |
{
|
|
1754 |
// Set PIN setting
|
|
1755 |
if ( UICC_STATUS_PIN_ENABLED == pinStatus)
|
|
1756 |
{
|
|
1757 |
lockInfo.iSetting = RMobilePhone::ELockSetEnabled;
|
|
1758 |
}
|
|
1759 |
else if ( UICC_STATUS_PIN_DISABLED == pinStatus )
|
|
1760 |
{
|
|
1761 |
lockInfo.iSetting = RMobilePhone::ELockSetDisabled;
|
|
1762 |
}
|
|
1763 |
// Set PIN status
|
|
1764 |
if ( 0 != pinAttemptsLeft )
|
|
1765 |
{
|
|
1766 |
lockInfo.iStatus = RMobilePhone::EStatusUnlocked;
|
|
1767 |
}
|
|
1768 |
else
|
|
1769 |
{
|
|
1770 |
lockInfo.iStatus = RMobilePhone::EStatusBlocked;
|
|
1771 |
}
|
|
1772 |
dataPackage.PackData( &lockInfo.iStatus, & lockInfo.iSetting );
|
|
1773 |
}
|
|
1774 |
}
|
|
1775 |
else // UICC status was not OK or subblock was not found
|
|
1776 |
{
|
|
1777 |
ret = KErrNotFound;
|
|
1778 |
}
|
|
1779 |
|
|
1780 |
// Complete PIN attempts left query
|
|
1781 |
if ( iPinAttemptsLeftQuery )
|
|
1782 |
{
|
|
1783 |
iPinAttemptsLeftQuery = EFalse;
|
|
1784 |
dataPackage.PackData( &iCodeType, &securityInfo );
|
|
1785 |
iMessageRouter->Complete(
|
|
1786 |
EMobilePhoneGetSecurityCodeInfo,
|
|
1787 |
&dataPackage,
|
|
1788 |
ret );
|
|
1789 |
iPinAttemptsLeftQuery = EFalse;
|
|
1790 |
}
|
|
1791 |
if ( iLockStateQuery ) // Complete PIN state query
|
|
1792 |
{
|
|
1793 |
dataPackage.PackData( &lockInfo.iStatus, & lockInfo.iSetting );
|
|
1794 |
// Complete PIN info
|
|
1795 |
iMessageRouter->Complete(
|
|
1796 |
EMobilePhoneGetLockInfo,
|
|
1797 |
&dataPackage,
|
|
1798 |
ret );
|
|
1799 |
iLockStateQuery = EFalse;
|
|
1800 |
}
|
|
1801 |
}
|
|
1802 |
|
|
1803 |
|
|
1804 |
// -----------------------------------------------------------------------------
|
|
1805 |
// CMmSecurityMessHandler::HandleUiccPinChangeResp
|
|
1806 |
// -----------------------------------------------------------------------------
|
|
1807 |
//
|
|
1808 |
void CMmSecurityMessHandler::HandleUiccPinChangeResp(
|
|
1809 |
const TUint8 aStatus,
|
|
1810 |
const TIsiReceiveC& aIsiMessage )
|
|
1811 |
{
|
|
1812 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::HandleUiccPinChangeResp");
|
|
1813 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_HANDLEUICCPINCHANGERESP, "CMmSecurityMessHandler::HandleUiccPinChangeResp" );
|
|
1814 |
|
|
1815 |
TInt ret( KErrNone );
|
|
1816 |
if ( UICC_STATUS_OK != aStatus )
|
|
1817 |
{
|
|
1818 |
ret = KErrNotSupported;
|
|
1819 |
// Subblock UICC_SB_STATUS_WORD contains cause information
|
|
1820 |
TUint uiccSbStatusWordOffset( 0 );
|
|
1821 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
|
|
1822 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_RESP,
|
|
1823 |
UICC_SB_STATUS_WORD,
|
|
1824 |
EIsiSubBlockTypeId16Len16,
|
|
1825 |
uiccSbStatusWordOffset ) )
|
|
1826 |
{
|
|
1827 |
TUint8 sw1( aIsiMessage.Get8bit(
|
|
1828 |
uiccSbStatusWordOffset +
|
|
1829 |
UICC_SB_STATUS_WORD_OFFSET_SW1 ) );
|
|
1830 |
TUint8 sw2( aIsiMessage.Get8bit(
|
|
1831 |
uiccSbStatusWordOffset +
|
|
1832 |
UICC_SB_STATUS_WORD_OFFSET_SW2 ) );
|
|
1833 |
|
|
1834 |
// Get status words and map to symbian error codes
|
|
1835 |
TUint16 statusWord( sw1 << 8 | sw2 );
|
|
1836 |
|
|
1837 |
// Map status word to symbian error codes. See status word coding
|
|
1838 |
// from TS 102.221 V7.11.0 Chapter 10.2.1
|
|
1839 |
|
|
1840 |
// 0x63CX: PIN was not correct and there are 'X' retries left
|
|
1841 |
if ( 0x63 == sw1 && 0x0C == ( sw2 >> 4 ) )
|
|
1842 |
{
|
|
1843 |
ret = CMmStaticUtility::EpocErrorCode(
|
|
1844 |
KErrAccessDenied,
|
|
1845 |
KErrGsm0707IncorrectPassword );
|
|
1846 |
}
|
|
1847 |
else if ( 0x6983 == statusWord ) // Authent./PIN method blocked
|
|
1848 |
{
|
|
1849 |
ret = CMmStaticUtility::EpocErrorCode(
|
|
1850 |
KErrLocked,
|
|
1851 |
KErrGsmSSPasswordAttemptsViolation );
|
|
1852 |
}
|
|
1853 |
else if ( 0x6A81 == statusWord ) // Wrong parameters
|
|
1854 |
{
|
|
1855 |
ret = CMmStaticUtility::EpocErrorCode(
|
|
1856 |
KErrArgument,
|
|
1857 |
KErrGsmInvalidParameter );
|
|
1858 |
}
|
|
1859 |
// No else, KErrNotSupported is returned
|
|
1860 |
}
|
|
1861 |
}
|
|
1862 |
iMessageRouter->Complete ( EMobilePhoneChangeSecurityCode, ret );
|
|
1863 |
}
|
|
1864 |
|
|
1865 |
|
|
1866 |
// -----------------------------------------------------------------------------
|
|
1867 |
// CMmSecurityMessHandler::HandleUiccPinStateChangeResp
|
|
1868 |
// -----------------------------------------------------------------------------
|
|
1869 |
//
|
|
1870 |
void CMmSecurityMessHandler::HandleUiccPinStateChangeResp(
|
|
1871 |
const TUint8 aStatus,
|
|
1872 |
const TIsiReceiveC& aIsiMessage )
|
|
1873 |
{
|
|
1874 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::HandleUiccPinStateChangeResp");
|
|
1875 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_HANDLEUICCPINSTATECHANGERESP, "CMmSecurityMessHandler::HandleUiccPinStateChangeResp" );
|
|
1876 |
|
|
1877 |
TInt ret( KErrNone );
|
|
1878 |
// Status and setting values are not used in CTSY, set to 'unknown'
|
|
1879 |
RMobilePhone::TMobilePhoneLockStatus status(
|
|
1880 |
RMobilePhone::EStatusLockUnknown );
|
|
1881 |
RMobilePhone::TMobilePhoneLockSetting setting(
|
|
1882 |
RMobilePhone::ELockSetUnknown );
|
|
1883 |
|
|
1884 |
TUint8 serviceType( aIsiMessage.Get8bit(
|
|
1885 |
ISI_HEADER_SIZE + UICC_PIN_RESP_OFFSET_SERVICETYPE ) );
|
|
1886 |
|
|
1887 |
if ( UICC_STATUS_OK != aStatus )
|
|
1888 |
{
|
|
1889 |
ret = KErrNotSupported;
|
|
1890 |
// Subblock UICC_SB_STATUS_WORD contains cause information
|
|
1891 |
TUint uiccSbStatusWordOffset( 0 );
|
|
1892 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
|
|
1893 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_RESP,
|
|
1894 |
UICC_SB_STATUS_WORD,
|
|
1895 |
EIsiSubBlockTypeId16Len16,
|
|
1896 |
uiccSbStatusWordOffset ) )
|
|
1897 |
{
|
|
1898 |
TUint8 sw1( aIsiMessage.Get8bit(
|
|
1899 |
uiccSbStatusWordOffset +
|
|
1900 |
UICC_SB_STATUS_WORD_OFFSET_SW1 ) );
|
|
1901 |
TUint8 sw2( aIsiMessage.Get8bit(
|
|
1902 |
uiccSbStatusWordOffset +
|
|
1903 |
UICC_SB_STATUS_WORD_OFFSET_SW2 ) );
|
|
1904 |
|
|
1905 |
// Get status words and map to symbian error codes
|
|
1906 |
TUint16 statusWord( sw1 << 8 | sw2 );
|
|
1907 |
|
|
1908 |
// Map status word to symbian error codes. See status word coding from
|
|
1909 |
// TS 102.221 V7.11.0 Chapter 10.2.1
|
|
1910 |
|
|
1911 |
// 0x63CX: PIN was not correct and there are 'X' retries left
|
|
1912 |
if ( 0x63 == sw1 && 0x0C == ( sw2 >> 4 ) )
|
|
1913 |
{
|
|
1914 |
ret = CMmStaticUtility::EpocErrorCode(
|
|
1915 |
KErrAccessDenied,
|
|
1916 |
KErrGsm0707IncorrectPassword );
|
|
1917 |
}
|
|
1918 |
else if ( 0x6983 == statusWord ) // Authentication/PIN method blocked
|
|
1919 |
{
|
|
1920 |
ret = CMmStaticUtility::EpocErrorCode(
|
|
1921 |
KErrAccessDenied,
|
|
1922 |
KErrGsmSSPasswordAttemptsViolation );
|
|
1923 |
}
|
|
1924 |
// No else, KErrNotSupported is returned
|
|
1925 |
}
|
|
1926 |
}
|
|
1927 |
else if ( UICC_PIN_SUBSTITUTE == serviceType )
|
|
1928 |
{
|
|
1929 |
// If response status is OK PIN/UPIN was substituted.
|
|
1930 |
// Update active pin
|
|
1931 |
iMmUiccMessHandler->ChangeActivePin();
|
|
1932 |
}
|
|
1933 |
|
|
1934 |
CMmDataPackage dataPackage;
|
|
1935 |
dataPackage.PackData( &status, &setting );
|
|
1936 |
iMessageRouter->Complete(
|
|
1937 |
EMobilePhoneSetLockSetting,
|
|
1938 |
&dataPackage,
|
|
1939 |
ret );
|
|
1940 |
}
|
|
1941 |
|
|
1942 |
// -----------------------------------------------------------------------------
|
|
1943 |
// CMmSecurityMessHandler::GetIccType
|
|
1944 |
// Read ICC type and completes it
|
|
1945 |
// -----------------------------------------------------------------------------
|
|
1946 |
//
|
|
1947 |
void CMmSecurityMessHandler::GetIccType()
|
|
1948 |
{
|
|
1949 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::GetIccType");
|
|
1950 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_GETICCTYPE, "CMmSecurityMessHandler::GetIccType" );
|
|
1951 |
|
|
1952 |
TInt ret( KErrNone );
|
|
1953 |
TICCType type ( EICCTypeSimUnknown );
|
|
1954 |
TUint8 applicationType( iMmUiccMessHandler->GetApplicationType() );
|
|
1955 |
|
|
1956 |
if ( UICC_APPL_TYPE_UICC_USIM == applicationType )
|
|
1957 |
{
|
|
1958 |
type = EICCTypeSim3G;
|
|
1959 |
}
|
|
1960 |
else if ( UICC_APPL_TYPE_ICC_SIM == applicationType )
|
|
1961 |
{
|
|
1962 |
type = EICCTypeSim2GGsm;
|
|
1963 |
}
|
|
1964 |
else
|
|
1965 |
{
|
|
1966 |
ret = KErrGeneral;
|
|
1967 |
}
|
|
1968 |
|
|
1969 |
// Complete the request
|
|
1970 |
CMmDataPackage dataPackage;
|
|
1971 |
dataPackage.PackData( &type );
|
|
1972 |
|
|
1973 |
iMessageRouter->Complete( EMmTsySimGetICCType, &dataPackage, ret );
|
|
1974 |
}
|
|
1975 |
|
|
1976 |
// -----------------------------------------------------------------------------
|
|
1977 |
// CMmSecurityMessHandler::GetActivePin
|
|
1978 |
// Reads active PIN and completes it
|
|
1979 |
// -----------------------------------------------------------------------------
|
|
1980 |
//
|
|
1981 |
void CMmSecurityMessHandler::GetActivePin()
|
|
1982 |
{
|
|
1983 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::GetActivePin");
|
|
1984 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_GETACTIVEPIN, "CMmSecurityMessHandler::GetActivePin" );
|
|
1985 |
RMobilePhone::TMobilePhoneSecurityCode activePin(
|
|
1986 |
iMmUiccMessHandler->GetActivePin());
|
|
1987 |
CMmDataPackage dataPackage;
|
|
1988 |
dataPackage.PackData( &activePin );
|
|
1989 |
iMessageRouter->Complete(
|
|
1990 |
EMmTsySecurityGetSimActivePinStateIPC,
|
|
1991 |
&dataPackage,
|
|
1992 |
KErrNone );
|
|
1993 |
}
|
|
1994 |
|
|
1995 |
// -----------------------------------------------------------------------------
|
|
1996 |
// CMmSecurityMessHandler::GetActiveUsimApplication
|
|
1997 |
// Read AID of active USIM application and complete
|
|
1998 |
// -----------------------------------------------------------------------------
|
|
1999 |
//
|
|
2000 |
void CMmSecurityMessHandler::GetActiveUsimApplication()
|
|
2001 |
{
|
|
2002 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::GetActiveUsimApplication");
|
|
2003 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_GETACTIVEUSIMAPPLICATION, "CMmSecurityMessHandler::GetActiveUsimApplication" );
|
|
2004 |
|
|
2005 |
RMobilePhone::TAID aid( iMmUiccMessHandler->GetAid() );
|
|
2006 |
CMmDataPackage dataPackage;
|
|
2007 |
dataPackage.PackData( &aid );
|
|
2008 |
iMessageRouter->Complete(
|
|
2009 |
EMobilePhoneGetCurrentActiveUSimApplication,
|
|
2010 |
&dataPackage,
|
|
2011 |
KErrNone );
|
|
2012 |
}
|
|
2013 |
|
|
2014 |
// -----------------------------------------------------------------------------
|
|
2015 |
// CMmSecurityMessHandler::GetPukCodeReq
|
|
2016 |
// Returns iPukCodeRequired
|
|
2017 |
// -----------------------------------------------------------------------------
|
|
2018 |
//
|
|
2019 |
TInt CMmSecurityMessHandler::GetPukCodeReq()
|
|
2020 |
{
|
|
2021 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::GetPukCodeReq");
|
|
2022 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_GETPUKCODEREQ, "CMmSecurityMessHandler::GetPukCodeReq" );
|
|
2023 |
return iPukCodeRequired;
|
|
2024 |
}
|
|
2025 |
|
|
2026 |
// -----------------------------------------------------------------------------
|
|
2027 |
// CMmSecurityMessHandler::SetFdnStateUicc
|
|
2028 |
// sets FDN state in case of UICC card
|
|
2029 |
// -----------------------------------------------------------------------------
|
|
2030 |
//
|
|
2031 |
TInt CMmSecurityMessHandler::ReadEfEst( TUiccTrId aTraId )
|
|
2032 |
{
|
|
2033 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ReadEfEst");
|
|
2034 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_READEFEST, "CMmSecurityMessHandler::ReadEfEst" );
|
|
2035 |
|
|
2036 |
// Set parameters for UICC_APPL_CMD_REQ message
|
|
2037 |
TUiccReadTransparent params;
|
|
2038 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
|
|
2039 |
params.trId = aTraId;
|
|
2040 |
params.dataAmount = 0;
|
|
2041 |
params.dataOffset = 0;
|
|
2042 |
params.fileId = KElemEst;
|
|
2043 |
params.fileIdSfi = 0x05;
|
|
2044 |
params.serviceType = UICC_APPL_READ_TRANSPARENT;
|
|
2045 |
|
|
2046 |
// File id path
|
|
2047 |
params.filePath.Append( KMasterFileId >> 8 );
|
|
2048 |
params.filePath.Append( KMasterFileId );
|
|
2049 |
params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
|
|
2050 |
|
|
2051 |
return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
|
|
2052 |
}
|
|
2053 |
|
|
2054 |
// -----------------------------------------------------------------------------
|
|
2055 |
// CMmSecurityMessHandler::ProcessUiccMsg
|
|
2056 |
// Handles data received from UICC server
|
|
2057 |
// -----------------------------------------------------------------------------
|
|
2058 |
//
|
|
2059 |
TInt CMmSecurityMessHandler::ProcessUiccMsg(
|
|
2060 |
TInt aTraId,
|
|
2061 |
TInt aStatus,
|
|
2062 |
const TDesC8& aFileData )
|
|
2063 |
{
|
|
2064 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ProcessUiccMsg");
|
|
2065 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_PROCESSUICCMSG, "CMmSecurityMessHandler::ProcessUiccMsg" );
|
|
2066 |
|
|
2067 |
TInt ret( KErrNone );
|
|
2068 |
|
|
2069 |
switch( aTraId )
|
|
2070 |
{
|
|
2071 |
case ETrIdSetFdnStateReadEst:
|
|
2072 |
{
|
|
2073 |
FdnSetReadEfEstResp( aStatus, aFileData );
|
|
2074 |
break;
|
|
2075 |
}
|
|
2076 |
case ETrIdGetFdnStateReadEst:
|
|
2077 |
{
|
|
2078 |
FdnGetReadEfEstResp( aStatus, aFileData );
|
|
2079 |
break;
|
|
2080 |
}
|
|
2081 |
case ETrIdSetFdnStateWriteEst:
|
|
2082 |
{
|
|
2083 |
WriteEfEstResp( aStatus );
|
|
2084 |
break;
|
|
2085 |
}
|
|
2086 |
case ETrIdSetFdnIcc:
|
|
2087 |
{
|
|
2088 |
FdnStateCommandResp( aStatus, aFileData );
|
|
2089 |
break;
|
|
2090 |
}
|
|
2091 |
case ETrIdSetFdnStateReadFileInfo:
|
|
2092 |
{
|
|
2093 |
FdnSetReadEfAdnFileInfoResp( aStatus, aFileData );
|
|
2094 |
break;
|
|
2095 |
}
|
|
2096 |
case ETrIdGetFdnStateReadFileInfo:
|
|
2097 |
{
|
|
2098 |
FdnGetReadEfAdnFileInfoResp( aStatus, aFileData );
|
|
2099 |
break;
|
|
2100 |
}
|
|
2101 |
default:
|
|
2102 |
{
|
|
2103 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ProcessUiccMsg - unknown transaction ID" );
|
|
2104 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_PROCESSUICCMSG, "CMmSecurityMessHandler::ProcessUiccMsg - unknown transaction ID" );
|
|
2105 |
break;
|
|
2106 |
}
|
|
2107 |
}
|
|
2108 |
return ret;
|
|
2109 |
}
|
|
2110 |
|
|
2111 |
// -----------------------------------------------------------------------------
|
|
2112 |
// CMmSecurityMessHandler::FdnSetReadEfEstResp
|
|
2113 |
// Handles response for EFest reading in case of setting FDN state
|
|
2114 |
// -----------------------------------------------------------------------------
|
|
2115 |
//
|
|
2116 |
void CMmSecurityMessHandler::FdnSetReadEfEstResp(
|
|
2117 |
TInt aStatus,
|
|
2118 |
const TDesC8& aFileData )
|
|
2119 |
{
|
|
2120 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfEstResp");
|
|
2121 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_FDNSETREADEFESTRESP, "CMmSecurityMessHandler::FdnSetReadEfEstResp" );
|
|
2122 |
|
|
2123 |
if( UICC_STATUS_OK == aStatus )
|
|
2124 |
{
|
|
2125 |
TUint8 fdnState( aFileData[0] & KFdnStateMask );
|
|
2126 |
TUint8 fdnStateToBeSet( 0 );
|
|
2127 |
|
|
2128 |
if( iMmUiccMessHandler->GetServiceStatus( KUiccServiceFdn ) )
|
|
2129 |
{
|
|
2130 |
if( RMobilePhone::EFdnSetOn == iFdnSetting )
|
|
2131 |
{
|
|
2132 |
fdnStateToBeSet = KServiceActivated;
|
|
2133 |
}
|
|
2134 |
else
|
|
2135 |
{
|
|
2136 |
fdnStateToBeSet = KServiceNotActivated;
|
|
2137 |
}
|
|
2138 |
|
|
2139 |
if( fdnState != fdnStateToBeSet )
|
|
2140 |
{
|
|
2141 |
// update the EFest
|
|
2142 |
TUiccWriteTransparent params;
|
|
2143 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
|
|
2144 |
params.trId = ETrIdSetFdnStateWriteEst;
|
|
2145 |
params.dataOffset = 0;
|
|
2146 |
params.dataAmount = 1; // only one byte is update
|
|
2147 |
params.fileId = KElemEst;
|
|
2148 |
params.fileIdSfi = 0x05;
|
|
2149 |
params.serviceType = UICC_APPL_UPDATE_TRANSPARENT;
|
|
2150 |
// File id path
|
|
2151 |
params.filePath.Append( KMasterFileId >> 8 );
|
|
2152 |
params.filePath.Append( KMasterFileId );
|
|
2153 |
params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
|
|
2154 |
|
|
2155 |
// File data to be updated.
|
|
2156 |
TUint8 data = aFileData[0] & 0xFE;
|
|
2157 |
data += fdnStateToBeSet;
|
|
2158 |
params.fileData.Append( data );
|
|
2159 |
|
|
2160 |
iMmUiccMessHandler->CreateUiccApplCmdReq( params );
|
|
2161 |
}
|
|
2162 |
else
|
|
2163 |
{
|
|
2164 |
// state is already correct, let's just complete the request
|
|
2165 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfEstResp: FDN state already correct, let's complete");
|
|
2166 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_FDNSETREADEFESTRESP, "CMmSecurityMessHandler::FdnSetReadEfEstResp: FDN state already correct, let's complete" );
|
|
2167 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNone );
|
|
2168 |
}
|
|
2169 |
}
|
|
2170 |
else
|
|
2171 |
{
|
|
2172 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfEstResp: FDN state not supported in EFust");
|
|
2173 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_FDNSETREADEFESTRESP, "CMmSecurityMessHandler::FdnSetReadEfEstResp: FDN state not supported in EFust" );
|
|
2174 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNotSupported );
|
|
2175 |
}
|
|
2176 |
}
|
|
2177 |
else
|
|
2178 |
{
|
|
2179 |
// error in reading EFest, let's complete the request
|
|
2180 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::FdnSetReadEfEstResp: reading failed, 0x%x", aStatus);
|
|
2181 |
OstTrace1( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_FDNSETREADEFESTRESP, "CMmSecurityMessHandler::FdnSetReadEfEstResp: reading failed, 0x%x", aStatus );
|
|
2182 |
|
|
2183 |
// compete setting of FDN state
|
|
2184 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrGeneral );
|
|
2185 |
}
|
|
2186 |
}
|
|
2187 |
|
|
2188 |
// -----------------------------------------------------------------------------
|
|
2189 |
// CMmSecurityMessHandler::FdnGetReadEfEstResp
|
|
2190 |
// Handles response for EFest reading in case of getting FDN state
|
|
2191 |
// -----------------------------------------------------------------------------
|
|
2192 |
//
|
|
2193 |
void CMmSecurityMessHandler::FdnGetReadEfEstResp(
|
|
2194 |
TInt aStatus,
|
|
2195 |
const TDesC8& aFileData )
|
|
2196 |
{
|
|
2197 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnGetReadEfEstResp");
|
|
2198 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_FDNGETREADEFESTRESP, "CMmSecurityMessHandler::FdnGetReadEfEstResp" );
|
|
2199 |
|
|
2200 |
RMobilePhone::TMobilePhoneFdnStatus fdnSetting( RMobilePhone::EFdnNotActive );
|
|
2201 |
|
|
2202 |
if( UICC_STATUS_OK == aStatus )
|
|
2203 |
{
|
|
2204 |
TUint8 fdnState( aFileData[0] & KFdnStateMask );
|
|
2205 |
|
|
2206 |
// let's check that FDN is supported in EFust
|
|
2207 |
if( iMmUiccMessHandler->GetServiceStatus( KUiccServiceFdn ) )
|
|
2208 |
{
|
|
2209 |
if( KServiceActivated == fdnState )
|
|
2210 |
{
|
|
2211 |
fdnSetting = RMobilePhone::EFdnActive;
|
|
2212 |
}
|
|
2213 |
// no else because of in this case FDN is not active
|
|
2214 |
// and fdnSetting is already set to state not active.
|
|
2215 |
}
|
|
2216 |
else
|
|
2217 |
{
|
|
2218 |
// FDN not supported in EFust
|
|
2219 |
fdnSetting = RMobilePhone::EFdnNotSupported;
|
|
2220 |
}
|
|
2221 |
CMmDataPackage dataPackage;
|
|
2222 |
dataPackage.PackData ( &fdnSetting );
|
|
2223 |
// Complete the status to the client
|
|
2224 |
iMessageRouter->Complete( EMobilePhoneGetFdnStatus, &dataPackage, KErrNone );
|
|
2225 |
}
|
|
2226 |
else
|
|
2227 |
{
|
|
2228 |
// error in reading EFest, let's complete the request
|
|
2229 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::FdnGetReadEfEstResp: reading failed, 0x%x", aStatus);
|
|
2230 |
OstTrace1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_FDNGETREADEFESTRESP, "CMmSecurityMessHandler::FdnGetReadEfEstResp: reading failed, 0x%x", aStatus );
|
|
2231 |
|
|
2232 |
fdnSetting = RMobilePhone::EFdnNotSupported;
|
|
2233 |
CMmDataPackage dataPackage;
|
|
2234 |
dataPackage.PackData ( &fdnSetting );
|
|
2235 |
iMessageRouter->Complete( EMobilePhoneGetFdnStatus, &dataPackage, KErrGeneral );
|
|
2236 |
}
|
|
2237 |
}
|
|
2238 |
|
|
2239 |
|
|
2240 |
// -----------------------------------------------------------------------------
|
|
2241 |
// CMmSecurityMessHandler::HandleWriteEfEstResp
|
|
2242 |
// Handles response for EFest update
|
|
2243 |
// -----------------------------------------------------------------------------
|
|
2244 |
//
|
|
2245 |
void CMmSecurityMessHandler::WriteEfEstResp( const TInt aStatus )
|
|
2246 |
{
|
|
2247 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::WriteEfEstResp");
|
|
2248 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_WRITEEFESTRESP, "CMmSecurityMessHandler::WriteEfEstResp" );
|
|
2249 |
|
|
2250 |
if( UICC_STATUS_OK == aStatus )
|
|
2251 |
{
|
|
2252 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::WriteEfEstResp: FDN state set succesfully");
|
|
2253 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_WRITEEFESTRESP, "CMmSecurityMessHandler::WriteEfEstResp: FDN state set succesfully" );
|
|
2254 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNone );
|
|
2255 |
}
|
|
2256 |
else
|
|
2257 |
{
|
|
2258 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::WriteEfEstResp: FDN state set failed");
|
|
2259 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_WRITEEFESTRESP, "CMmSecurityMessHandler::WriteEfEstResp: FDN state set failed" );
|
|
2260 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrGeneral );
|
|
2261 |
}
|
|
2262 |
}
|
|
2263 |
|
|
2264 |
// -----------------------------------------------------------------------------
|
|
2265 |
// CMmSecurityMessHandler::SendFdnStateCommand
|
|
2266 |
// sends INVALIDATE/REHABILITATE command for setting FDN state
|
|
2267 |
// in case of ICC card
|
|
2268 |
// -----------------------------------------------------------------------------
|
|
2269 |
//
|
|
2270 |
TInt CMmSecurityMessHandler::SendFdnStateCommand()
|
|
2271 |
{
|
|
2272 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::SendFdnStateCommand");
|
|
2273 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_SENDFDNSTATECOMMAND, "CMmSecurityMessHandler::SendFdnStateCommand" );
|
|
2274 |
|
|
2275 |
TInt ret( 0 );
|
|
2276 |
TUiccSendApdu params;
|
|
2277 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
|
|
2278 |
params.serviceType = UICC_APPL_APDU_SEND;
|
|
2279 |
params.fileId = UICC_EF_ID_NOT_PRESENT;
|
|
2280 |
params.fileIdSfi = UICC_SFI_NOT_PRESENT;
|
|
2281 |
params.filePath.Append( KMasterFileId >> 8 );
|
|
2282 |
params.filePath.Append( KMasterFileId );
|
|
2283 |
params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
|
|
2284 |
params.trId = ETrIdSetFdnIcc;
|
|
2285 |
params.apdu.Append( 0xA0 ); // CLA
|
|
2286 |
|
|
2287 |
if( RMobilePhone::EFdnSetOn == iFdnSetting )
|
|
2288 |
{
|
|
2289 |
//INVALIDATE
|
|
2290 |
params.apdu.Append( 0x04 ); // INS
|
|
2291 |
params.apdu.Append( 0 ); // P1
|
|
2292 |
params.apdu.Append( 0 ); // P2
|
|
2293 |
params.apdu.Append( 2 ); // Lc
|
|
2294 |
params.apdu.Append( KElemAdnIcc >> 8 ); // File id
|
|
2295 |
params.apdu.Append( KElemAdnIcc ); // File id
|
|
2296 |
ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
|
|
2297 |
}
|
|
2298 |
else if( RMobilePhone::EFdnSetOff == iFdnSetting )
|
|
2299 |
{
|
|
2300 |
// REHABILITATE
|
|
2301 |
params.apdu.Append( 0x44 ); // INS
|
|
2302 |
params.apdu.Append( 0 ); // P1
|
|
2303 |
params.apdu.Append( 0 ); // P2
|
|
2304 |
params.apdu.Append( 2 ); // Lc
|
|
2305 |
params.apdu.Append( KElemAdnIcc >> 8 ); // File id
|
|
2306 |
params.apdu.Append( KElemAdnIcc ); // File id
|
|
2307 |
ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params );
|
|
2308 |
}
|
|
2309 |
else
|
|
2310 |
{
|
|
2311 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::SendFdnStateCommand: unknown FDN state");
|
|
2312 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_SENDFDNSTATECOMMAND, "CMmSecurityMessHandler::SendFdnStateCommand: unknown FDN state" );
|
|
2313 |
ret = KErrArgument;
|
|
2314 |
}
|
|
2315 |
|
|
2316 |
return ret;
|
|
2317 |
}
|
|
2318 |
|
|
2319 |
// -----------------------------------------------------------------------------
|
|
2320 |
// CMmSecurityMessHandler::FdnStateCommandResp
|
|
2321 |
// handles response to the INVALIDATE/REHABILITATE command in case of ICC card
|
|
2322 |
// -----------------------------------------------------------------------------
|
|
2323 |
//
|
|
2324 |
void CMmSecurityMessHandler::FdnStateCommandResp(
|
|
2325 |
TInt aStatus,
|
|
2326 |
const TDesC8& aFileData )
|
|
2327 |
{
|
|
2328 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::SendFdnStateCommand");
|
|
2329 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_FDNSTATECOMMANDRESP, "CMmSecurityMessHandler::FdnStateCommandResp" );
|
|
2330 |
|
|
2331 |
if( UICC_STATUS_OK == aStatus )
|
|
2332 |
{
|
|
2333 |
// get the status word
|
|
2334 |
TUint8 sw1( aFileData[aFileData.Length() - KSw1Position] );
|
|
2335 |
TUint8 sw2( aFileData[aFileData.Length() - KSw2Position] );
|
|
2336 |
|
|
2337 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::SendFdnStateCommand: sw1: 0x%x, sw2: 0x%x", sw1, sw2);
|
|
2338 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_FDNSTATECOMMANDRESP, "CMmSecurityMessHandler::FdnStateCommandResp: sw1: 0x%x, sw2: 0x%x", sw1, sw2 );
|
|
2339 |
|
|
2340 |
TInt ret( KErrGeneral );
|
|
2341 |
|
|
2342 |
if( ( 0x90 == sw1 && 0x00 == sw2 ) ||
|
|
2343 |
( 0x91 == sw1 ) )
|
|
2344 |
{
|
|
2345 |
ret = KErrNone;
|
|
2346 |
}
|
|
2347 |
else if( 0x69 == sw1 )
|
|
2348 |
{
|
|
2349 |
ret = KErrAccessDenied;
|
|
2350 |
}
|
|
2351 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, ret );
|
|
2352 |
}
|
|
2353 |
else
|
|
2354 |
{
|
|
2355 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::SendFdnStateCommand, Fdn state set failed: 0x%x", aStatus);
|
|
2356 |
OstTrace1( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_FDNSTATECOMMANDRESP, "CMmSecurityMessHandler::FdnStateCommandResp, Fdn state set failed: 0x%x", aStatus );
|
|
2357 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrGeneral );
|
|
2358 |
}
|
|
2359 |
}
|
|
2360 |
|
|
2361 |
// -----------------------------------------------------------------------------
|
|
2362 |
// CMmSecurityMessHandler::ReadEfAdnFileInfo
|
|
2363 |
// Sends file info request for EFadn in case of ICC card
|
|
2364 |
// -----------------------------------------------------------------------------
|
|
2365 |
//
|
|
2366 |
TInt CMmSecurityMessHandler::ReadEfAdnFileInfo( TUiccTrId aTraId )
|
|
2367 |
{
|
|
2368 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ReadEfAdnFileInfo");
|
|
2369 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_READEFADNFILEINFO, "CMmSecurityMessHandler::ReadEfAdnFileInfo" );
|
|
2370 |
|
|
2371 |
TUiccApplFileInfo params;
|
|
2372 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
|
|
2373 |
params.serviceType = UICC_APPL_FILE_INFO;
|
|
2374 |
params.fileId = KElemAdnIcc;
|
|
2375 |
params.fileIdSfi = UICC_SFI_NOT_PRESENT;
|
|
2376 |
params.filePath.Append( KMasterFileId >> 8 );
|
|
2377 |
params.filePath.Append( KMasterFileId );
|
|
2378 |
params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
|
|
2379 |
params.trId = aTraId;
|
|
2380 |
|
|
2381 |
return iMmUiccMessHandler->CreateUiccApplCmdReq( params );
|
|
2382 |
}
|
|
2383 |
|
|
2384 |
// -----------------------------------------------------------------------------
|
|
2385 |
// CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp
|
|
2386 |
// Handles response for file info reading for EFadn in case of ICC card
|
|
2387 |
// when FDN state is set
|
|
2388 |
// -----------------------------------------------------------------------------
|
|
2389 |
//
|
|
2390 |
void CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp(
|
|
2391 |
TInt aStatus,
|
|
2392 |
const TDesC8& aFileData )
|
|
2393 |
{
|
|
2394 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp");
|
|
2395 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_FDNSETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp" );
|
|
2396 |
|
|
2397 |
if( UICC_STATUS_OK == aStatus )
|
|
2398 |
{
|
|
2399 |
// let's check is ADN and FDN supported in EFest
|
|
2400 |
if( iMmUiccMessHandler->GetServiceStatus( KIccServiceFdn ) &&
|
|
2401 |
iMmUiccMessHandler->GetServiceStatus( KIccServiceAdn ) )
|
|
2402 |
{
|
|
2403 |
// let's check the current FDN status.
|
|
2404 |
// If EFadn is invalidated, FDN is enabled, otherwise FDN
|
|
2405 |
// is disabled
|
|
2406 |
TUint8 invalidationFlag( aFileData[KFileStatusIndex] & KInvalidateFlagMask );
|
|
2407 |
|
|
2408 |
if( ( KInvalidated == invalidationFlag &&
|
|
2409 |
RMobilePhone::EFdnSetOn == iFdnSetting ) ||
|
|
2410 |
( KNotInvalidated == invalidationFlag &&
|
|
2411 |
RMobilePhone::EFdnSetOff == iFdnSetting ) )
|
|
2412 |
{
|
|
2413 |
// Current FDN state is already correct, so we can
|
|
2414 |
// complete the request
|
|
2415 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: FDN state already correct, let's complete");
|
|
2416 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_FDNSETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: FDN state already correct, let's complete" );
|
|
2417 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNone );
|
|
2418 |
}
|
|
2419 |
else
|
|
2420 |
{
|
|
2421 |
// Current FDN state is not correct, we need to change it
|
|
2422 |
SendFdnStateCommand();
|
|
2423 |
}
|
|
2424 |
}
|
|
2425 |
else
|
|
2426 |
{
|
|
2427 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: FDN or ADN not supported in EFsst");
|
|
2428 |
OstTrace0( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_FDNSETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: FDN or ADN not supported in EFsst" );
|
|
2429 |
|
|
2430 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNotSupported );
|
|
2431 |
}
|
|
2432 |
}
|
|
2433 |
else
|
|
2434 |
{
|
|
2435 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: reading failed: 0x%x", aStatus);
|
|
2436 |
OstTrace1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_FDNSETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: reading failed: 0x%x", aStatus );
|
|
2437 |
|
|
2438 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNotSupported );
|
|
2439 |
}
|
|
2440 |
}
|
|
2441 |
|
|
2442 |
// -----------------------------------------------------------------------------
|
|
2443 |
// CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp
|
|
2444 |
// Handles response for file info reading for EFadn in case of ICC card
|
|
2445 |
// when FDN state is get
|
|
2446 |
// -----------------------------------------------------------------------------
|
|
2447 |
//
|
|
2448 |
void CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp(
|
|
2449 |
TInt aStatus,
|
|
2450 |
const TDesC8& aFileData )
|
|
2451 |
{
|
|
2452 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp");
|
|
2453 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_FDNGETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp" );
|
|
2454 |
|
|
2455 |
RMobilePhone::TMobilePhoneFdnStatus fdnSetting( RMobilePhone::EFdnNotActive );
|
|
2456 |
|
|
2457 |
if( UICC_STATUS_OK == aStatus )
|
|
2458 |
{
|
|
2459 |
if( iMmUiccMessHandler->GetServiceStatus( KIccServiceFdn ) &&
|
|
2460 |
iMmUiccMessHandler->GetServiceStatus( KIccServiceAdn ) )
|
|
2461 |
{
|
|
2462 |
TUint8 invalidationFlag( aFileData[KFileStatusIndex] & KInvalidateFlagMask );
|
|
2463 |
|
|
2464 |
if( KInvalidated == invalidationFlag )
|
|
2465 |
{
|
|
2466 |
fdnSetting = RMobilePhone::EFdnActive;
|
|
2467 |
}
|
|
2468 |
// no else because of FDN is not active and fdnSetting is
|
|
2469 |
// already set to this value.
|
|
2470 |
}
|
|
2471 |
else
|
|
2472 |
{
|
|
2473 |
fdnSetting = RMobilePhone::EFdnNotSupported;
|
|
2474 |
}
|
|
2475 |
|
|
2476 |
CMmDataPackage dataPackage;
|
|
2477 |
dataPackage.PackData ( &fdnSetting );
|
|
2478 |
// Complete the status to the client
|
|
2479 |
iMessageRouter->Complete( EMobilePhoneGetFdnStatus, &dataPackage, KErrNone );
|
|
2480 |
}
|
|
2481 |
else
|
|
2482 |
{
|
|
2483 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp: reading failed: 0x%x", aStatus);
|
|
2484 |
OstTrace1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_FDNGETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp: reading failed: 0x%x", aStatus );
|
|
2485 |
|
|
2486 |
fdnSetting = RMobilePhone::EFdnNotSupported;
|
|
2487 |
CMmDataPackage dataPackage;
|
|
2488 |
dataPackage.PackData ( &fdnSetting );
|
|
2489 |
iMessageRouter->Complete( EMobilePhoneGetFdnStatus, &dataPackage, KErrNotSupported );
|
|
2490 |
}
|
|
2491 |
}
|
|
2492 |
|
|
2493 |
// End of File
|