24
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Implements the Phone IMS Authorization/Authentication code.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include <testconfigfileparser.h>
|
|
23 |
#include <etelmmerr.h>
|
|
24 |
#include "CSimPhone.h"
|
|
25 |
#include "Simlog.h"
|
|
26 |
|
|
27 |
//
|
|
28 |
// CSimPhoneIMSAuth
|
|
29 |
//
|
|
30 |
|
|
31 |
CSimPhoneIMSAuth* CSimPhoneIMSAuth::NewL(CSimPhone* aPhone)
|
|
32 |
/**
|
|
33 |
* Standard two phase constructor.
|
|
34 |
* @param aPhone The phone object from which the Phone Smart Card applications will open
|
|
35 |
*/
|
|
36 |
{
|
|
37 |
CSimPhoneIMSAuth* obj=new(ELeave) CSimPhoneIMSAuth(aPhone);
|
|
38 |
CleanupStack::PushL(obj);
|
|
39 |
obj->ConstructL();
|
|
40 |
CleanupStack::Pop();
|
|
41 |
return obj;
|
|
42 |
}
|
|
43 |
|
|
44 |
CSimPhoneIMSAuth::CSimPhoneIMSAuth(CSimPhone* aPhone)
|
|
45 |
: iPhone(aPhone)
|
|
46 |
/**
|
|
47 |
* Trivial first phase constructor.
|
|
48 |
* @param aPhone The phone object from which this Phone SmartCard App was opened.
|
|
49 |
*/
|
|
50 |
{}
|
|
51 |
|
|
52 |
|
|
53 |
void CSimPhoneIMSAuth::ConstructL()
|
|
54 |
/**
|
|
55 |
* Second phase of the 2-phase constructor.
|
|
56 |
* Constructs all the member data and retrieves all the data from the config file specific to this class.
|
|
57 |
*
|
|
58 |
* @leave Leaves due to not enough memory or if any data member does not construct for any reason.
|
|
59 |
*/
|
|
60 |
{
|
|
61 |
iTimer=CSimTimer::NewL(iPhone);
|
|
62 |
iGetAuthorizationData = new CArrayPtrFlat<CListReadAllAttempt>(1);
|
|
63 |
LOGPHONE1("Starting to parse Phone IMS Authorization/Authentication config params...");
|
|
64 |
ParseAuthorizationInfoL();
|
|
65 |
ParseAuthenticationInfoL();
|
|
66 |
LOGPHONE1("Finished parsing Phone IMS Authorization/Authentication config params...");
|
|
67 |
}
|
|
68 |
|
|
69 |
|
|
70 |
CSimPhoneIMSAuth::~CSimPhoneIMSAuth()
|
|
71 |
/**
|
|
72 |
* Standard destructor. Any objects created by the ::ConstructL() function
|
|
73 |
* will be destroyed here.
|
|
74 |
*/
|
|
75 |
{
|
|
76 |
delete iTimer;
|
|
77 |
if(iGetAuthorizationData)
|
|
78 |
{
|
|
79 |
iGetAuthorizationData->ResetAndDestroy();
|
|
80 |
}
|
|
81 |
delete iGetAuthorizationData;
|
|
82 |
|
|
83 |
TInt authInfoCount = iAuthorizationInfoList.Count();
|
|
84 |
TInt ii;
|
|
85 |
for(ii = 0; ii < authInfoCount; ii++)
|
|
86 |
{
|
|
87 |
iAuthorizationInfoList[ii].iIMPUArray.Close();
|
|
88 |
}
|
|
89 |
iAuthorizationInfoList.Close();
|
|
90 |
|
|
91 |
iAuthenticationInfoList.Close();
|
|
92 |
|
|
93 |
//RAJ TODO
|
|
94 |
}
|
|
95 |
|
|
96 |
|
|
97 |
const CTestConfigSection* CSimPhoneIMSAuth::CfgFile()
|
|
98 |
/**
|
|
99 |
* Returns a pointer to the config file section
|
|
100 |
*
|
|
101 |
* @return CTestConfigSection a pointer to the configuration file data section
|
|
102 |
*/
|
|
103 |
{
|
|
104 |
LOGPHONE1(">>CSimPhoneIMSAuth::CfgFile");
|
|
105 |
return iPhone->CfgFile();
|
|
106 |
}
|
|
107 |
|
|
108 |
void CSimPhoneIMSAuth::TimerCallBack(TInt /*aId*/)
|
|
109 |
/**
|
|
110 |
* Timer callback function. When the timer goes off, it will call back into this
|
|
111 |
* function for further processing.
|
|
112 |
*
|
|
113 |
* @param aId an id identifying which timer callback is being called
|
|
114 |
*/
|
|
115 |
{
|
|
116 |
iTimerStarted = EFalse;
|
|
117 |
iCurrentAuthorizationInfo++;
|
|
118 |
if(iAuthInfoChangeNotifyPending)
|
|
119 |
{
|
|
120 |
iAuthInfoChangeNotifyPending = EFalse;
|
|
121 |
iPhone->ReqCompleted(iAuthInfoChangeNotifyReqHandle, KErrNone);
|
|
122 |
}
|
|
123 |
}
|
|
124 |
|
|
125 |
void CSimPhoneIMSAuth::ParseAuthorizationInfoL()
|
|
126 |
/**
|
|
127 |
* Parses the list of Authorization Info tags from the Config file
|
|
128 |
*
|
|
129 |
*/
|
|
130 |
{
|
|
131 |
const CTestConfigItem* item=NULL;
|
|
132 |
TInt ret=KErrNone;
|
|
133 |
TPtrC8 IMPI, IMPUValue, HNDN;
|
|
134 |
TInt IMPUCount, authorizationDataSource, infoChangeDelay;
|
|
135 |
TAuthorizationInfo authorizationInfo;
|
|
136 |
|
|
137 |
LOGPHONE1("Starting to Parse IMS Authorization Info");
|
|
138 |
TInt count = CfgFile()->ItemCount(KAuthorizationInfo);
|
|
139 |
|
|
140 |
TInt index;
|
|
141 |
for(index=0;index<count;index++)
|
|
142 |
{
|
|
143 |
item=CfgFile()->Item(KAuthorizationInfo,index);
|
|
144 |
TInt delimiterNum = 0;
|
|
145 |
if(!item)
|
|
146 |
{
|
|
147 |
break;
|
|
148 |
}
|
|
149 |
|
|
150 |
//Get the IMPI
|
|
151 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterNum,IMPI);
|
|
152 |
if(ret!=KErrNone)
|
|
153 |
{
|
|
154 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHORIZATION INFO TAG");
|
|
155 |
continue;
|
|
156 |
}
|
|
157 |
else
|
|
158 |
{
|
|
159 |
authorizationInfo.iIMPI.Copy(IMPI);
|
|
160 |
delimiterNum++;
|
|
161 |
}
|
|
162 |
|
|
163 |
//Get number of elements in the IMPU Array
|
|
164 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterNum,IMPUCount);
|
|
165 |
if(ret!=KErrNone)
|
|
166 |
{
|
|
167 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHORIZATION INFO TAG");
|
|
168 |
continue;
|
|
169 |
}
|
|
170 |
else
|
|
171 |
{
|
|
172 |
delimiterNum++;
|
|
173 |
RArray<RMobilePhone::TIMPU> IMPUArray;
|
|
174 |
TBool IMPUError = EFalse;
|
|
175 |
|
|
176 |
//Get the IMPU values
|
|
177 |
TInt ii;
|
|
178 |
for(ii = 0;ii < IMPUCount; ii++)
|
|
179 |
{
|
|
180 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterNum,IMPUValue);
|
|
181 |
if(ret!=KErrNone)
|
|
182 |
{
|
|
183 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHORIZATION INFO TAG");
|
|
184 |
IMPUError = ETrue;
|
|
185 |
break;
|
|
186 |
}
|
|
187 |
else
|
|
188 |
{
|
|
189 |
IMPUArray.Append(IMPUValue);
|
|
190 |
delimiterNum++;
|
|
191 |
}
|
|
192 |
}
|
|
193 |
|
|
194 |
if(IMPUError)
|
|
195 |
{
|
|
196 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHORIZATION INFO TAG");
|
|
197 |
continue;
|
|
198 |
}
|
|
199 |
else
|
|
200 |
{
|
|
201 |
authorizationInfo.iIMPUArray = IMPUArray;
|
|
202 |
}
|
|
203 |
}
|
|
204 |
|
|
205 |
//Get the HNDN
|
|
206 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterNum,HNDN);
|
|
207 |
if(ret!=KErrNone)
|
|
208 |
{
|
|
209 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHORIZATION INFO TAG");
|
|
210 |
continue;
|
|
211 |
}
|
|
212 |
else
|
|
213 |
{
|
|
214 |
authorizationInfo.iHomeNetworkDomainName.Copy(HNDN);
|
|
215 |
delimiterNum++;
|
|
216 |
}
|
|
217 |
|
|
218 |
//Get the Authorization Data Source
|
|
219 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterNum,authorizationDataSource);
|
|
220 |
if(ret!=KErrNone)
|
|
221 |
{
|
|
222 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHORIZATION INFO TAG");
|
|
223 |
continue;
|
|
224 |
}
|
|
225 |
else
|
|
226 |
{
|
|
227 |
authorizationInfo.iAuthenticationDataSource =
|
|
228 |
static_cast<RMobilePhone::TAuthorizationDataSource>(authorizationDataSource);
|
|
229 |
|
|
230 |
delimiterNum++;
|
|
231 |
}
|
|
232 |
|
|
233 |
//Get the Authorization Info change delay
|
|
234 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterNum,infoChangeDelay);
|
|
235 |
if(ret!=KErrNone)
|
|
236 |
{
|
|
237 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHORIZATION INFO TAG");
|
|
238 |
continue;
|
|
239 |
}
|
|
240 |
else
|
|
241 |
{
|
|
242 |
authorizationInfo.iInfoChangeDelay = infoChangeDelay;
|
|
243 |
}
|
|
244 |
|
|
245 |
iAuthorizationInfoList.Append(authorizationInfo);
|
|
246 |
}//end FOR Loop
|
|
247 |
iCurrentAuthorizationInfo = 0;
|
|
248 |
}
|
|
249 |
|
|
250 |
void CSimPhoneIMSAuth::ParseAuthenticationInfoL()
|
|
251 |
/**
|
|
252 |
* Parses the list of Authentication Info tags from the Config file
|
|
253 |
*
|
|
254 |
*/
|
|
255 |
{
|
|
256 |
const CTestConfigItem* item=NULL;
|
|
257 |
TInt ret=KErrNone;
|
|
258 |
TPtrC8 AUTN, RAND, RES, IK, CK, AUTS;
|
|
259 |
TInt authErr;
|
|
260 |
TAuthenticationInfo authenticationInfo;
|
|
261 |
|
|
262 |
LOGPHONE1("Starting to Parse IMS Authentication Info");
|
|
263 |
TInt count = CfgFile()->ItemCount(KAuthenticationInfo);
|
|
264 |
|
|
265 |
TInt index;
|
|
266 |
for(index=0; index<count; index++)
|
|
267 |
{
|
|
268 |
item=CfgFile()->Item(KAuthenticationInfo,index);
|
|
269 |
if(!item)
|
|
270 |
{
|
|
271 |
break;
|
|
272 |
}
|
|
273 |
|
|
274 |
//Get the AUTN
|
|
275 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,AUTN);
|
|
276 |
if(ret!=KErrNone)
|
|
277 |
{
|
|
278 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHENTICATION INFO TAG");
|
|
279 |
continue;
|
|
280 |
}
|
|
281 |
else
|
|
282 |
{
|
|
283 |
authenticationInfo.iAUTN.Copy(AUTN);
|
|
284 |
}
|
|
285 |
|
|
286 |
//Get the RAND
|
|
287 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,RAND);
|
|
288 |
if(ret!=KErrNone)
|
|
289 |
{
|
|
290 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHENTICATION INFO TAG");
|
|
291 |
continue;
|
|
292 |
}
|
|
293 |
else
|
|
294 |
{
|
|
295 |
authenticationInfo.iRAND.Copy(RAND);
|
|
296 |
}
|
|
297 |
|
|
298 |
//Get the RES
|
|
299 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,RES);
|
|
300 |
if(ret!=KErrNone)
|
|
301 |
{
|
|
302 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHENTICATION INFO TAG");
|
|
303 |
continue;
|
|
304 |
}
|
|
305 |
else
|
|
306 |
{
|
|
307 |
authenticationInfo.iRES.Copy(RES);
|
|
308 |
}
|
|
309 |
|
|
310 |
//Get the IK
|
|
311 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,IK);
|
|
312 |
if(ret!=KErrNone)
|
|
313 |
{
|
|
314 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHENTICATION INFO TAG");
|
|
315 |
continue;
|
|
316 |
}
|
|
317 |
else
|
|
318 |
{
|
|
319 |
authenticationInfo.iIK.Copy(IK);
|
|
320 |
}
|
|
321 |
|
|
322 |
//Get the CK
|
|
323 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,CK);
|
|
324 |
if(ret!=KErrNone)
|
|
325 |
{
|
|
326 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHENTICATION INFO TAG");
|
|
327 |
continue;
|
|
328 |
}
|
|
329 |
else
|
|
330 |
{
|
|
331 |
authenticationInfo.iCK.Copy(CK);
|
|
332 |
}
|
|
333 |
|
|
334 |
//Get the AUTS
|
|
335 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,AUTS);
|
|
336 |
if(ret!=KErrNone)
|
|
337 |
{
|
|
338 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHENTICATION INFO TAG");
|
|
339 |
continue;
|
|
340 |
}
|
|
341 |
else
|
|
342 |
{
|
|
343 |
authenticationInfo.iAUTS.Copy(AUTS);
|
|
344 |
}
|
|
345 |
|
|
346 |
//Get authentication error
|
|
347 |
ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,authErr);
|
|
348 |
if(ret!=KErrNone)
|
|
349 |
{
|
|
350 |
LOGPHONE1("ERROR IN CONFIGURATION FILE PARSING: BAD AUTHENTICATION INFO TAG");
|
|
351 |
continue;
|
|
352 |
}
|
|
353 |
else
|
|
354 |
{
|
|
355 |
authenticationInfo.iAuthenticationErr = authErr;
|
|
356 |
}
|
|
357 |
|
|
358 |
iAuthenticationInfoList.Append(authenticationInfo);
|
|
359 |
}//end FOR Loop
|
|
360 |
}
|
|
361 |
|
|
362 |
TInt CSimPhoneIMSAuth::GetAuthorizationInfoPhase1(const TTsyReqHandle aTsyReqHandle,
|
|
363 |
RMobilePhone::TClientId* aClientId,TInt* aBufSize)
|
|
364 |
{
|
|
365 |
LOGPHONE1("CSimPhoneIMSAuth::GetAuthorizationInfoPhase1 called");
|
|
366 |
TInt ret(KErrNone);
|
|
367 |
TInt leaveCode(KErrNone);
|
|
368 |
TRAP(leaveCode, ret=ProcessGetAuthorizationInfoPhase1L(aTsyReqHandle, aClientId, aBufSize););
|
|
369 |
if (leaveCode != KErrNone)
|
|
370 |
{
|
|
371 |
iPhone->ReqCompleted(aTsyReqHandle,leaveCode);
|
|
372 |
}
|
|
373 |
|
|
374 |
return ret;
|
|
375 |
}
|
|
376 |
|
|
377 |
|
|
378 |
TInt CSimPhoneIMSAuth::ProcessGetAuthorizationInfoPhase1L(const TTsyReqHandle aTsyReqHandle,
|
|
379 |
RMobilePhone::TClientId* aClientId, TInt* aBufSize)
|
|
380 |
{
|
|
381 |
LOGPHONE1("CSimPhoneIMSAuth::GetAuthorizationInfoPhase1 called");
|
|
382 |
|
|
383 |
// Store the streamed list and the client ID
|
|
384 |
CListReadAllAttempt* read=CListReadAllAttempt::NewL(*aClientId,aTsyReqHandle);
|
|
385 |
CleanupStack::PushL(read);
|
|
386 |
|
|
387 |
RMobilePhone::CImsAuthorizationInfoV5* iAuthInfo = RMobilePhone::CImsAuthorizationInfoV5::NewL();
|
|
388 |
CleanupStack::PushL(iAuthInfo);
|
|
389 |
|
|
390 |
// Check that the data structure is supported by the simulated TSY version
|
|
391 |
TInt err = iPhone->CheckSimTsyVersion(*iAuthInfo);
|
|
392 |
if(err != KErrNone)
|
|
393 |
{
|
|
394 |
iPhone->ReqCompleted(aTsyReqHandle, err);
|
|
395 |
CleanupStack::PopAndDestroy(2, read); // iAuthInfo, read
|
|
396 |
return KErrNone;
|
|
397 |
}
|
|
398 |
|
|
399 |
iAuthInfo->iIMPI = iAuthorizationInfoList[iCurrentAuthorizationInfo].iIMPI;
|
|
400 |
|
|
401 |
TInt IMPUCount = iAuthorizationInfoList[iCurrentAuthorizationInfo].iIMPUArray.Count();
|
|
402 |
TInt index;
|
|
403 |
for(index = 0; index < IMPUCount; index++)
|
|
404 |
{
|
|
405 |
iAuthInfo->iIMPUArray.Append(iAuthorizationInfoList[iCurrentAuthorizationInfo].iIMPUArray[index]);
|
|
406 |
}
|
|
407 |
|
|
408 |
iAuthInfo->iHomeNetworkDomainName =
|
|
409 |
iAuthorizationInfoList[iCurrentAuthorizationInfo].iHomeNetworkDomainName;
|
|
410 |
iAuthInfo->iAuthenticationDataSource =
|
|
411 |
iAuthorizationInfoList[iCurrentAuthorizationInfo].iAuthenticationDataSource;
|
|
412 |
|
|
413 |
HBufC8* iBuff=NULL;
|
|
414 |
iAuthInfo->ExternalizeL(iBuff);
|
|
415 |
CleanupStack::PopAndDestroy(iAuthInfo);
|
|
416 |
CleanupDeletePushL(iBuff);
|
|
417 |
|
|
418 |
CBufFlat* buf=CBufFlat::NewL(iBuff->Length());
|
|
419 |
CleanupStack::PushL(buf);
|
|
420 |
buf->InsertL(0,*iBuff);
|
|
421 |
|
|
422 |
read->iListBuf = buf;
|
|
423 |
CleanupStack::Pop(buf);
|
|
424 |
CleanupStack::PopAndDestroy(iBuff);
|
|
425 |
|
|
426 |
iGetAuthorizationData->AppendL(read);
|
|
427 |
CleanupStack::Pop(read);
|
|
428 |
|
|
429 |
// return the CBufBase’s size to client
|
|
430 |
*aBufSize=(read->iListBuf)->Size();
|
|
431 |
|
|
432 |
// Complete first phase of list retrieval
|
|
433 |
iPhone->ReqCompleted(aTsyReqHandle,KErrNone);
|
|
434 |
return KErrNone;
|
|
435 |
|
|
436 |
}
|
|
437 |
|
|
438 |
|
|
439 |
TInt CSimPhoneIMSAuth::GetAuthorizationInfoPhase2(const TTsyReqHandle aTsyReqHandle,
|
|
440 |
RMobilePhone::TClientId* aClientId, TDes8* aBuffer)
|
|
441 |
{
|
|
442 |
LOGPHONE1("CSimPhoneIMSAuth::GetAuthorizationInfoPhase2 called");
|
|
443 |
CListReadAllAttempt* read=NULL;
|
|
444 |
|
|
445 |
// Find the get Authorization Info attempt from this client
|
|
446 |
TInt index;
|
|
447 |
for (index = 0; index < iGetAuthorizationData->Count(); index++)
|
|
448 |
{
|
|
449 |
read = iGetAuthorizationData->At(index);
|
|
450 |
if ((read->iClient.iSessionHandle==aClientId->iSessionHandle) &&
|
|
451 |
(read->iClient.iSubSessionHandle==aClientId->iSubSessionHandle))
|
|
452 |
{
|
|
453 |
TPtr8 bufPtr((read->iListBuf)->Ptr(0));
|
|
454 |
// Copy the streamed list to the client
|
|
455 |
aBuffer->Copy(bufPtr);
|
|
456 |
delete read;
|
|
457 |
iGetAuthorizationData->Delete(index);
|
|
458 |
iPhone->ReqCompleted(aTsyReqHandle,KErrNone);
|
|
459 |
return KErrNone;
|
|
460 |
}
|
|
461 |
}
|
|
462 |
iPhone->ReqCompleted(aTsyReqHandle,KErrBadHandle);
|
|
463 |
return KErrNone;
|
|
464 |
}
|
|
465 |
|
|
466 |
|
|
467 |
TInt CSimPhoneIMSAuth::GetAuthorizationInfoCancel(const TTsyReqHandle aTsyReqHandle)
|
|
468 |
{
|
|
469 |
LOGPHONE1("CSimPhoneIMSAuth::GetAuthorizationInfoCancel called");
|
|
470 |
|
|
471 |
// Remove the read all attempt from iGetAuthorizationData
|
|
472 |
CListReadAllAttempt* read=NULL;
|
|
473 |
TInt index;
|
|
474 |
for (index = 0; index <iGetAuthorizationData->Count(); index++)
|
|
475 |
{
|
|
476 |
read = iGetAuthorizationData->At(index);
|
|
477 |
if (read->iReqHandle == aTsyReqHandle)
|
|
478 |
{
|
|
479 |
delete read;
|
|
480 |
iGetAuthorizationData->Delete(index);
|
|
481 |
break;
|
|
482 |
}
|
|
483 |
}
|
|
484 |
|
|
485 |
iPhone->ReqCompleted(aTsyReqHandle,KErrCancel);
|
|
486 |
return KErrNone;
|
|
487 |
}
|
|
488 |
|
|
489 |
|
|
490 |
TInt CSimPhoneIMSAuth::NotifyImsAuthorizationInfoChanged(const TTsyReqHandle aTsyReqHandle)
|
|
491 |
{
|
|
492 |
LOGPHONE1("CSimPhoneIMSAuth::NotifyImsAuthorizationInfoChanged called");
|
|
493 |
__ASSERT_ALWAYS(!iAuthInfoChangeNotifyPending,SimPanic(ENotificationReqAlreadyOutstanding));
|
|
494 |
|
|
495 |
TInt count=iAuthorizationInfoList.Count();
|
|
496 |
if(iCurrentAuthorizationInfo < count)
|
|
497 |
{
|
|
498 |
iTimer->Start(iAuthorizationInfoList[iCurrentAuthorizationInfo].iInfoChangeDelay,this);
|
|
499 |
iTimerStarted = ETrue;
|
|
500 |
}
|
|
501 |
|
|
502 |
iAuthInfoChangeNotifyPending=ETrue;
|
|
503 |
iAuthInfoChangeNotifyReqHandle = aTsyReqHandle;
|
|
504 |
|
|
505 |
return KErrNone;
|
|
506 |
}
|
|
507 |
|
|
508 |
|
|
509 |
TInt CSimPhoneIMSAuth::NotifyImsAuthorizationInfoChangedCancel(const TTsyReqHandle aTsyReqHandle)
|
|
510 |
{
|
|
511 |
LOGPHONE1("CSimPhoneIMSAuth::NotifyImsAuthorizationInfoChangedCancel called");
|
|
512 |
if(iAuthInfoChangeNotifyPending)
|
|
513 |
{
|
|
514 |
if(iTimerStarted)
|
|
515 |
{
|
|
516 |
iTimer->Cancel();
|
|
517 |
}
|
|
518 |
|
|
519 |
iAuthInfoChangeNotifyPending=EFalse;
|
|
520 |
iPhone->ReqCompleted(aTsyReqHandle, KErrCancel);
|
|
521 |
}
|
|
522 |
|
|
523 |
return KErrNone;
|
|
524 |
}
|
|
525 |
|
|
526 |
|
|
527 |
TInt CSimPhoneIMSAuth::GetAuthenticationData(const TTsyReqHandle aTsyReqHandle,TDes8* aAuthenticationData)
|
|
528 |
{
|
|
529 |
LOGPHONE1("CSimPhoneIMSAuth::AuthentificationData called");
|
|
530 |
|
|
531 |
RMobilePhone::TImsAuthenticateDataV5Pckg* authenticateDataPckgd =
|
|
532 |
(RMobilePhone::TImsAuthenticateDataV5Pckg*)aAuthenticationData;
|
|
533 |
RMobilePhone::TImsAuthenticateDataV5& authenticateData=(*authenticateDataPckgd)();
|
|
534 |
|
|
535 |
// Check that the data structure is supported by the simulated TSY version
|
|
536 |
TInt err = iPhone->CheckSimTsyVersion(authenticateData);
|
|
537 |
if(err != KErrNone)
|
|
538 |
{
|
|
539 |
iPhone->ReqCompleted(aTsyReqHandle, err);
|
|
540 |
return KErrNone;
|
|
541 |
}
|
|
542 |
|
|
543 |
TInt index;
|
|
544 |
for(index = 0; index < iAuthenticationInfoList.Count(); index++)
|
|
545 |
{
|
|
546 |
if(authenticateData.iAUTN == iAuthenticationInfoList[index].iAUTN &&
|
|
547 |
authenticateData.iRAND == iAuthenticationInfoList[index].iRAND)
|
|
548 |
{
|
|
549 |
TInt ret = iAuthenticationInfoList[index].iAuthenticationErr;
|
|
550 |
if(ret != KErrNone)
|
|
551 |
{
|
|
552 |
//return the AUTS and blank everything else
|
|
553 |
authenticateData.iAUTS = iAuthenticationInfoList[index].iAUTS;
|
|
554 |
authenticateData.iRES = _L8("");
|
|
555 |
authenticateData.iIK = _L8("");
|
|
556 |
authenticateData.iCK = _L8("");
|
|
557 |
}
|
|
558 |
else
|
|
559 |
{
|
|
560 |
authenticateData.iRES = iAuthenticationInfoList[index].iRES;
|
|
561 |
authenticateData.iIK = iAuthenticationInfoList[index].iIK;
|
|
562 |
authenticateData.iCK = iAuthenticationInfoList[index].iCK;
|
|
563 |
}
|
|
564 |
|
|
565 |
iPhone->ReqCompleted(aTsyReqHandle, ret);
|
|
566 |
return KErrNone;
|
|
567 |
}
|
|
568 |
}
|
|
569 |
|
|
570 |
iPhone->ReqCompleted(aTsyReqHandle, KErrCorrupt);
|
|
571 |
return KErrNone;
|
|
572 |
}
|
|
573 |
|
|
574 |
|
|
575 |
TInt CSimPhoneIMSAuth::GetAuthenticationDataCancel(const TTsyReqHandle aTsyReqHandle)
|
|
576 |
{
|
|
577 |
LOGPHONE1("CSimPhoneIMSAuth::AuthentificationDatCancel called");
|
|
578 |
iPhone->ReqCompleted(aTsyReqHandle, KErrCancel);
|
|
579 |
return KErrNone;
|
|
580 |
}
|