|
1 // Copyright (c) 2002-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 // This file contains the implementation of the Similator TSY Packet Context functionality. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include "Simlog.h" |
|
23 #include "CSimPhone.h" |
|
24 #include "CSimPacketContext.h" |
|
25 #include "CSimPacketService.h" |
|
26 #include "CSimPacketQoS.h" |
|
27 #include "utils.h" |
|
28 |
|
29 #include "CSimContextHelper.h" |
|
30 |
|
31 const TInt KUnsetInteger = 0; |
|
32 |
|
33 CPcktListReadAllAttempt* CPcktListReadAllAttempt::NewL(TClientId& aId, TTsyReqHandle aReqHandle) |
|
34 /** |
|
35 * Standard two phase constructor. |
|
36 * @param aId The client ID (session and sub-session handles) that uniquely identifies a client performing a two phase read. |
|
37 * @param aReqHandle The TSY request handle of the client request associated with a two phase read. |
|
38 * @return CPcktListReadAllAttempt* The newly created object. |
|
39 */ |
|
40 { |
|
41 CPcktListReadAllAttempt* read=new(ELeave) CPcktListReadAllAttempt(aId, aReqHandle); |
|
42 CleanupStack::PushL(read); |
|
43 read->ConstructL(); |
|
44 CleanupStack::Pop(); |
|
45 return read; |
|
46 } |
|
47 |
|
48 CPcktListReadAllAttempt::CPcktListReadAllAttempt(TClientId& aId, TTsyReqHandle aReqHandle) |
|
49 : iReqHandle(aReqHandle) |
|
50 /** |
|
51 * Trivial first phase constructor. |
|
52 * @param aId The client ID (session and sub-session handles) that uniquely identifies a client performing a two phase read. |
|
53 * @param aReqHandle The TSY request handle of the client request associated with a two phase read. |
|
54 */ |
|
55 { |
|
56 iClient.iSessionHandle=aId.iSessionHandle; |
|
57 iClient.iSubSessionHandle=aId.iSubSessionHandle; |
|
58 } |
|
59 |
|
60 void CPcktListReadAllAttempt::ConstructL() |
|
61 /** |
|
62 * Trivial second phase constructor. |
|
63 */ |
|
64 { |
|
65 User::LeaveIfError(iListBuf!=NULL); |
|
66 } |
|
67 |
|
68 CPcktListReadAllAttempt::~CPcktListReadAllAttempt() |
|
69 /** |
|
70 * Trivial destructor. |
|
71 */ |
|
72 { |
|
73 delete iListBuf; |
|
74 } |
|
75 |
|
76 |
|
77 CSimPacketContext* CSimPacketContext::NewL(CSimPhone* aPhone, CSimPacketService* aPacketService, const TDesC& aContextName) |
|
78 /** |
|
79 * Standard two phase constructor |
|
80 * |
|
81 * @param aPacketService Pointer to the Packet Service object (CSimPacketService) |
|
82 * @param aContextName name for this packet context |
|
83 * @return CSimPacketContext pointer to the packet context object created. |
|
84 * @leave Leaves if no memory or object is not created for any reason. |
|
85 */ |
|
86 { |
|
87 CSimPacketContext* packetContext = new(ELeave) CSimPacketContext(aPhone, aPacketService, aContextName); |
|
88 CleanupStack::PushL(packetContext); |
|
89 packetContext->ConstructL(); |
|
90 CleanupStack::Pop(); |
|
91 return packetContext; |
|
92 } |
|
93 |
|
94 void CSimPacketContext::Init() |
|
95 {} |
|
96 |
|
97 CSimPacketContext::CSimPacketContext(CSimPhone* aPhone, CSimPacketService* aPacketService, const TName& aContextName) |
|
98 : iPhone(aPhone), iDeleted(EFalse),iIsActive(EFalse),iPacketService(aPacketService),iContextName(aContextName), |
|
99 iTFTCreated(EFalse), iNumTFTsCreated(-1), iNumFiltersAdded(0), |
|
100 iContextConfigParamsIndex(0), iCommPortLoaned(EFalse),iQoSObjectCount(0), |
|
101 iNotifyContextConfigChangeArray(NULL), iSetConfigData(NULL), iSetConfigCallCount(0), iTFTChangeBool(0), |
|
102 iNotifyContextStatusChangeIndex(0),iState(RPacketContext::EStatusInactive) |
|
103 |
|
104 /** |
|
105 * Trivial Constructor. Initialises all the data members |
|
106 * |
|
107 * @param aPacketService Pointer to the Packet Service object (CSimPacketService) |
|
108 * @param aContextName name for this packet context |
|
109 */ |
|
110 { |
|
111 iNotifyStatusChange.iNotifyPending = EFalse; |
|
112 iNotifyConfigGPRS.iNotifyPending= EFalse; |
|
113 iNotifyConfigR99.iNotifyPending= EFalse; |
|
114 iNotifyConfigR5.iNotifyPending= EFalse; |
|
115 } |
|
116 |
|
117 void CSimPacketContext::ConstructL() |
|
118 /** |
|
119 * Second phase of the 2-phase constructor. |
|
120 * Constructs all the member data and retrieves all the data from the config file specific to this class. |
|
121 * |
|
122 * @leave Leaves no memory or any data member does not construct for any reason. |
|
123 */ |
|
124 { |
|
125 LOGPACKET1("CSimPacketContext: Entered constructor"); |
|
126 |
|
127 iSetConfigData = new (ELeave) CArrayFixFlat<TSetConfigData>(1); |
|
128 iNotifyContextConfigChangeArray = new (ELeave) CArrayFixFlat<TNotifyContextConfigChangeData>(1); |
|
129 iContextConfigParams = new (ELeave) CArrayFixFlat<TContextConfigParam>(KNumberofConfigs); |
|
130 iAuthorizationTokenResponse = new (ELeave) CArrayFixFlat<TAuthorizationTokenResponse>(KNumberofConfigs); |
|
131 iMediaAuthorization = new (ELeave) CArrayFixFlat<RPacketContext::CTFTMediaAuthorizationV3>(KNumberofConfigs); |
|
132 |
|
133 iNtRas = CSimNtRas::NewL(iPhone); |
|
134 iTimer = CSimTimer::NewL(iPhone); |
|
135 iNotifyContextStatusChangeTimer = CSimTimer::NewL(iPhone); |
|
136 iSetConfigTimer = CSimTimer::NewL(iPhone); |
|
137 iInitContextTimer = CSimTimer::NewL(iPhone); |
|
138 iCreateTftTimer = CSimTimer::NewL(iPhone); |
|
139 iNotifyContextConfigChangeTimer= CSimTimer::NewL(iPhone); |
|
140 iContextStatusChange = CSimPubSubChange::NewL(this, CSimPubSub::TPubSubProperty(KUidPSSimTsyCategory, KPSSimtsyPacketContextStatusChange, KPSSimtsyPacketContextStatusChangeKeyType)); |
|
141 |
|
142 LOGPACKET1("Starting to Load and Parse Packet Context the Config File"); |
|
143 |
|
144 GetCommSetupSettingsL(); |
|
145 GetContextConfigParamSettingsL(KSetContextConfigGPRS()); |
|
146 GetContextConfigParamSettingsL(KSetContextConfigRel99()); |
|
147 GetContextConfigParamSettingsL(KSetContextConfigRel5()); |
|
148 GetActivateSettings(); |
|
149 GetSetConfigSettings(); |
|
150 GetPacketFilterSettings(); |
|
151 GetContextConfigRel99SettingsL(); |
|
152 ConstructPacketFiltersL(); |
|
153 GetContextStatusChangeSettingsL(); |
|
154 GetContextConfigChangeSettingsL(); |
|
155 |
|
156 TInt nestedItemNumber; // used for nested loop |
|
157 const CTestConfigItem* item2; // used for nested items |
|
158 |
|
159 TUint count = CfgFile()->ItemCount(KAuthorizationToken); |
|
160 |
|
161 TUint itemPosition = 0; |
|
162 TUint itemOffSet = 0; |
|
163 for(TInt i=0;i<count;i++) // set up AuthorizationToken info |
|
164 { |
|
165 const CTestConfigItem *item = CfgFile()->Item(KAuthorizationToken,i); |
|
166 if(!item) |
|
167 break; |
|
168 |
|
169 RPacketContext::CTFTMediaAuthorizationV3* mediaAuthorization = RPacketContext::CTFTMediaAuthorizationV3::NewL(); |
|
170 CleanupStack::PushL(mediaAuthorization); |
|
171 TAuthorizationTokenResponse authorizationTokenResponse; |
|
172 TPtrC8 authorizationToken; |
|
173 TInt desiredResponse; |
|
174 TInt numberOfFlowIds; |
|
175 |
|
176 TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,authorizationToken); |
|
177 |
|
178 if(ret!=KErrNone) |
|
179 { |
|
180 LOGPARSERR("CTFTMediaAuthorizationV3::authorizationToken",ret,0,&KAuthorizationToken); |
|
181 CleanupStack::PopAndDestroy(mediaAuthorization); |
|
182 continue; |
|
183 } |
|
184 else |
|
185 { |
|
186 mediaAuthorization->iAuthorizationToken.Copy(authorizationToken); // Set up for media authorization |
|
187 authorizationTokenResponse.iAuthorizationToken.Copy(authorizationToken); // Set up for token response |
|
188 } |
|
189 |
|
190 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,desiredResponse); |
|
191 |
|
192 if(ret!=KErrNone || desiredResponse > 0) |
|
193 { |
|
194 LOGPARSERR("desiredResponse",ret,1,&KAuthorizationToken); |
|
195 CleanupStack::PopAndDestroy(mediaAuthorization); |
|
196 continue; |
|
197 } |
|
198 else |
|
199 { |
|
200 authorizationTokenResponse.iResponse = desiredResponse; |
|
201 } |
|
202 |
|
203 iAuthorizationTokenResponse->AppendL(authorizationTokenResponse); |
|
204 |
|
205 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,numberOfFlowIds); |
|
206 |
|
207 for(nestedItemNumber=itemPosition+itemOffSet;nestedItemNumber<itemOffSet+numberOfFlowIds;nestedItemNumber++) |
|
208 { |
|
209 item2 = CfgFile()->Item(KFlowIdentifier,nestedItemNumber); |
|
210 |
|
211 if(!item2) |
|
212 break; |
|
213 |
|
214 RPacketContext::CTFTMediaAuthorizationV3::TFlowIdentifier iFlowIdentifier; |
|
215 TInt mediaComponentNumber; |
|
216 TInt IPFlowNumber; |
|
217 |
|
218 ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,0,mediaComponentNumber); |
|
219 |
|
220 if(ret!=KErrNone || mediaComponentNumber < 0) |
|
221 { |
|
222 LOGPARSERR("CTFTMediaAuthorizationV3::mediaComponentNumber",ret,0,&KFlowIdentifier); |
|
223 continue; |
|
224 } |
|
225 else |
|
226 { |
|
227 iFlowIdentifier.iMediaComponentNumber = mediaComponentNumber; |
|
228 } |
|
229 |
|
230 ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,1,IPFlowNumber); |
|
231 |
|
232 if(ret!=KErrNone || IPFlowNumber < 0) |
|
233 { |
|
234 LOGPARSERR("CTFTMediaAuthorizationV3::IPFlowNumber",ret,1,&KFlowIdentifier); |
|
235 continue; |
|
236 } |
|
237 else |
|
238 { |
|
239 iFlowIdentifier.iIPFlowNumber = IPFlowNumber; |
|
240 } |
|
241 |
|
242 mediaAuthorization->iFlowIds.Append(iFlowIdentifier); |
|
243 } |
|
244 itemOffSet+=numberOfFlowIds; |
|
245 iMediaAuthorization->AppendL(*mediaAuthorization); // Add completed media authorization to array |
|
246 CleanupStack::Pop(mediaAuthorization); |
|
247 } |
|
248 |
|
249 LOGPACKET1("...Finished parsing Packet Context config parameters..."); |
|
250 } |
|
251 |
|
252 void CSimPacketContext::GetCommSetupSettingsL() |
|
253 { |
|
254 iCommSetupArray = new (ELeave) CArrayFixFlat<TCommSetupItem>(KNumberofConfigs); |
|
255 |
|
256 TInt count = CfgFile()->ItemCount(KCommSetup); |
|
257 if(count==0) |
|
258 { |
|
259 TCommSetupItem comm; |
|
260 |
|
261 comm.iCsyName.Copy(KDefaultCsyName); |
|
262 comm.iPortName.Copy(KDefaultPortName); |
|
263 comm.iConfig.iRate=KDefaultCommPortRate; |
|
264 comm.iConfig.iHandshake=KDefaultHandshake; |
|
265 comm.iContextName=KDefaultSetting; |
|
266 comm.iCommReset = EFalse; |
|
267 comm.iNumInitializeFailures = 0; |
|
268 comm.iErrorCode = KErrNone; |
|
269 comm.iDelay = 0; |
|
270 iCommSetupArray->AppendL(comm); |
|
271 } |
|
272 |
|
273 for(TInt i=0;i<count;i++) |
|
274 { |
|
275 const CTestConfigItem* item = CfgFile()->Item(KCommSetup,i); |
|
276 |
|
277 if(item) |
|
278 { |
|
279 TCommSetupItem comm; |
|
280 TPtrC8 portName,csyName,contextName; |
|
281 TInt commReset, numInitializeFailures, errorCode, delay; |
|
282 |
|
283 TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,csyName); |
|
284 if(ret!=KErrNone) |
|
285 { |
|
286 LOGPARSERR("CommSetUp::csyName",ret,0,&KCommSetup); |
|
287 comm.iCsyName.Copy(KDefaultCsyName); |
|
288 } |
|
289 else |
|
290 comm.iCsyName.Copy(csyName); |
|
291 |
|
292 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,portName); |
|
293 if(ret!=KErrNone) |
|
294 { |
|
295 LOGPARSERR("CommSetUp::portName",ret,1,&KCommSetup); |
|
296 comm.iPortName.Copy(KDefaultPortName); |
|
297 } |
|
298 else |
|
299 comm.iPortName.Copy(portName); |
|
300 |
|
301 TInt dataRate,handshake; |
|
302 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,dataRate); |
|
303 if(ret!=KErrNone) |
|
304 { |
|
305 LOGPARSERR("CommSetUp::dataRate",ret,2,&KCommSetup); |
|
306 comm.iConfig.iRate=KDefaultCommPortRate; |
|
307 } |
|
308 else |
|
309 comm.iConfig.iRate=(TBps)dataRate; |
|
310 |
|
311 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,handshake); |
|
312 if(ret!=KErrNone) |
|
313 { |
|
314 LOGPARSERR("CommSetUp::handShake",ret,3,&KCommSetup); |
|
315 comm.iConfig.iHandshake=KDefaultHandshake; |
|
316 } |
|
317 else |
|
318 comm.iConfig.iHandshake=(TUint)handshake; |
|
319 |
|
320 |
|
321 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,contextName); |
|
322 if(ret!=KErrNone) |
|
323 { |
|
324 LOGPARSERR("CommSetUp::contextName",ret,4,&KCommSetup); |
|
325 comm.iContextName=KDefaultSetting; |
|
326 } |
|
327 else |
|
328 comm.iContextName.Copy(contextName); |
|
329 |
|
330 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,commReset); |
|
331 if(ret!=KErrNone) |
|
332 { |
|
333 LOGPARSERR("CommSetUp::commReset",ret,5,&KCommSetup); |
|
334 comm.iCommReset=EFalse; |
|
335 } |
|
336 else |
|
337 comm.iCommReset = commReset; |
|
338 |
|
339 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,numInitializeFailures); |
|
340 if(ret!=KErrNone) |
|
341 { |
|
342 comm.iNumInitializeFailures = 0; |
|
343 } |
|
344 else |
|
345 comm.iNumInitializeFailures = numInitializeFailures; |
|
346 |
|
347 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,errorCode); |
|
348 if(ret!=KErrNone) |
|
349 { |
|
350 comm.iErrorCode = KErrNone; |
|
351 } |
|
352 else |
|
353 comm.iErrorCode = errorCode; |
|
354 |
|
355 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,8,delay); |
|
356 if(ret!=KErrNone) |
|
357 { |
|
358 comm.iDelay = 0; |
|
359 } |
|
360 else |
|
361 comm.iDelay = delay; |
|
362 |
|
363 iCommSetupArray->AppendL(comm); |
|
364 } |
|
365 } |
|
366 } |
|
367 |
|
368 |
|
369 |
|
370 void CSimPacketContext::GetContextConfigParamSettingsL(TPtrC8 aTag) |
|
371 { |
|
372 CSimContextHelper::GetContextConfigParamSettingsL( CfgFile(), aTag, iContextConfigParams ); |
|
373 } |
|
374 |
|
375 |
|
376 void CSimPacketContext::GetActivateSettings() |
|
377 { |
|
378 TInt ret; |
|
379 const CTestConfigItem* item=CfgFile()->Item(KActivatePauseDuration); //< Find the Activate data item |
|
380 if(item) |
|
381 { //< then retrieve the activation pause |
|
382 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,iActivatePause); |
|
383 if(ret!=KErrNone) |
|
384 iActivatePause = KDefaultPauseDuration; |
|
385 |
|
386 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,iActivateFail); |
|
387 if(ret==KErrNotFound) |
|
388 iActivateFail = KErrNone; |
|
389 } |
|
390 |
|
391 item=CfgFile()->Item(KDeactivatePauseDuration); //< Find the Deactivate data item |
|
392 if(item) |
|
393 { //< then retrieve the deactivation pause |
|
394 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,iDeactivatePause); |
|
395 if(ret!=KErrNone) |
|
396 iDeactivatePause = KDefaultPauseDuration; |
|
397 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,iDeactivateFail); |
|
398 if(ret==KErrNotFound) |
|
399 iDeactivateFail = KErrNone; |
|
400 } |
|
401 |
|
402 item=CfgFile()->Item(KDeletePauseDuration); //< Find the Delete data item |
|
403 if(item) |
|
404 { //< then retrieve the delete pause |
|
405 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,iDeletePause); |
|
406 if(ret!=KErrNone) |
|
407 iDeletePause = KDefaultPauseDuration; |
|
408 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,iDeleteFail); |
|
409 if(ret==KErrNotFound) |
|
410 iDeleteFail = KErrNone; |
|
411 } |
|
412 } |
|
413 |
|
414 void CSimPacketContext::GetSetConfigSettings() |
|
415 { |
|
416 iSetConfigDelay = 0; |
|
417 const CTestConfigItem* item=iPacketService->CfgFile()->Item(KSetConfigDelay); |
|
418 if(item) |
|
419 { |
|
420 TInt delay = 0; |
|
421 TInt ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0,delay); |
|
422 |
|
423 if(ret != KErrNone || delay < 0) |
|
424 { |
|
425 LOGPARSERR("SetConfigDelay",ret,0,&KSetConfigDelay); |
|
426 } |
|
427 else |
|
428 { |
|
429 iSetConfigDelay = delay; |
|
430 } |
|
431 } |
|
432 |
|
433 item=iPacketService->CfgFile()->Item(KSetConfigFail); // Set the SetConfigFail struct |
|
434 if(item) |
|
435 { |
|
436 TPtrC8 contextName, numberOfTimes, failErrorCode; |
|
437 TInt32 digit = 0; |
|
438 TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName); |
|
439 |
|
440 if(ret!=KErrNone) |
|
441 { |
|
442 LOGPARSERR("SetConfigFail::contextName",ret,0,&KSetConfigFail); |
|
443 } |
|
444 else |
|
445 { |
|
446 iSetConfigFail.iContextName.Copy(contextName); |
|
447 } |
|
448 |
|
449 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,numberOfTimes); |
|
450 if(ret!=KErrNone) |
|
451 { |
|
452 LOGPARSERR("SetConfigFail::numberOfTimes",ret,1,&KSetConfigFail); |
|
453 } |
|
454 else |
|
455 { |
|
456 if(AsciiToNum(numberOfTimes, digit)==KErrNone) |
|
457 iSetConfigFail.iNumberOfTimes = digit; |
|
458 } |
|
459 |
|
460 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,failErrorCode); |
|
461 if(ret!=KErrNone) |
|
462 { |
|
463 LOGPARSERR("SetConfigFail::failErrorCode",ret,2,&KSetConfigFail); |
|
464 } |
|
465 else |
|
466 { |
|
467 if(AsciiToNum(failErrorCode, digit)==KErrNone) |
|
468 iSetConfigFail.iFailErrorCode = digit; |
|
469 } |
|
470 } |
|
471 } |
|
472 |
|
473 void CSimPacketContext::GetContextConfigChangeSettingsL() |
|
474 { |
|
475 TNotifyContextConfigChangeData configChangeData; |
|
476 |
|
477 TUint count = CfgFile()->ItemCount(KNotifyContextConfigChange); |
|
478 TInt index; |
|
479 for(index = 0; index < count; index++) |
|
480 { |
|
481 const CTestConfigItem *item = |
|
482 CfgFile()->Item(KNotifyContextConfigChange,index); |
|
483 |
|
484 if(!item) |
|
485 { |
|
486 break; |
|
487 } |
|
488 |
|
489 //Get the Notify Context Config Change Delay value |
|
490 TInt ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,0, |
|
491 configChangeData.iDelay); |
|
492 if(ret!=KErrNone) |
|
493 { |
|
494 LOGPARSERR("NotifyContextConfigChange::delay",ret,0,&KNotifyContextConfigChange); |
|
495 continue; |
|
496 } |
|
497 |
|
498 //Get the Notify Context Config Change, config index value |
|
499 ret = CTestConfig::GetElement(item->Value(),KStdDelimiter,1, |
|
500 configChangeData.iNewContextConfigIndex); |
|
501 if(ret!=KErrNone) |
|
502 { |
|
503 LOGPARSERR("NotifyContextConfigChange::NewContextConfigIndex", |
|
504 ret,0,&KNotifyContextConfigChange); |
|
505 continue; |
|
506 } |
|
507 |
|
508 iNotifyContextConfigChangeArray->AppendL(configChangeData); |
|
509 } |
|
510 } |
|
511 |
|
512 void CSimPacketContext::GetPacketFilterSettings() |
|
513 { |
|
514 TInt ret; |
|
515 const CTestConfigItem* item=iPacketService->CfgFile()->Item(KDeleteTftFail); |
|
516 if(item) |
|
517 { |
|
518 TPtrC8 contextName, numberOfTimes, failErrorCode; |
|
519 TInt32 digit = 0; |
|
520 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName); |
|
521 |
|
522 if(ret!=KErrNone) |
|
523 { |
|
524 LOGPARSERR("SetConfigFail::contextName",ret,0,&KDeleteTftFail); |
|
525 } |
|
526 else |
|
527 { |
|
528 iDeleteTftFail.iContextName.Copy(contextName); |
|
529 } |
|
530 |
|
531 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,numberOfTimes); |
|
532 if(ret!=KErrNone) |
|
533 { |
|
534 LOGPARSERR("SetConfigFail::numberOfTimes",ret,1,&KDeleteTftFail); |
|
535 } |
|
536 else |
|
537 { |
|
538 if(AsciiToNum(numberOfTimes, digit)==KErrNone) |
|
539 iDeleteTftFail.iNumberOfTimes = digit; |
|
540 } |
|
541 |
|
542 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,failErrorCode); |
|
543 if(ret!=KErrNone) |
|
544 { |
|
545 LOGPARSERR("SetConfigFail::failErrorCode",ret,2,&KDeleteTftFail); |
|
546 } |
|
547 else |
|
548 { |
|
549 if(AsciiToNum(failErrorCode, digit)==KErrNone) |
|
550 iDeleteTftFail.iFailErrorCode = digit; |
|
551 } |
|
552 } |
|
553 |
|
554 item=iPacketService->CfgFile()->Item(KCreateTftConfig); |
|
555 if(item) |
|
556 { |
|
557 TPtrC8 contextName, numberOfTimes, failErrorCode; |
|
558 TInt32 digit = 0; |
|
559 TInt delay = 0; |
|
560 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName); |
|
561 if(ret!=KErrNone) |
|
562 { |
|
563 LOGPARSERR("SetConfigFail::contextName",ret,0,&KCreateTftConfig); |
|
564 } |
|
565 else |
|
566 { |
|
567 iCreateTftConfig.iContextName.Copy(contextName); |
|
568 } |
|
569 |
|
570 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,numberOfTimes); |
|
571 if(ret!=KErrNone) |
|
572 { |
|
573 LOGPARSERR("SetConfigFail::numberOfTimes",ret,1,&KCreateTftConfig); |
|
574 } |
|
575 else |
|
576 { |
|
577 if(AsciiToNum(numberOfTimes, digit)==KErrNone) |
|
578 iCreateTftConfig.iNumberOfFailures = digit; |
|
579 } |
|
580 |
|
581 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,failErrorCode); |
|
582 if(ret!=KErrNone) |
|
583 { |
|
584 LOGPARSERR("SetConfigFail::failErrorCode",ret,2,&KCreateTftConfig); |
|
585 } |
|
586 else |
|
587 { |
|
588 if(AsciiToNum(failErrorCode, digit)==KErrNone) |
|
589 iCreateTftConfig.iFailErrorCode = digit; |
|
590 } |
|
591 |
|
592 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,delay); |
|
593 if(ret!=KErrNone) |
|
594 { |
|
595 LOGPARSERR("SetConfigFail::failErrorCode",ret,3,&KCreateTftConfig); |
|
596 } |
|
597 else |
|
598 { |
|
599 iCreateTftConfig.iDelay = delay; |
|
600 } |
|
601 } |
|
602 |
|
603 item=iPacketService->CfgFile()->Item(KAddPacketFilter); |
|
604 if(item) |
|
605 { |
|
606 TPtrC8 contextName, numberOfTimes, failErrorCode; |
|
607 TInt32 digit = 0; |
|
608 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName); |
|
609 |
|
610 if(ret!=KErrNone) |
|
611 { |
|
612 LOGPARSERR("SetConfigFail::contextName",ret,0,&KAddPacketFilter); |
|
613 } |
|
614 else |
|
615 { |
|
616 iAddPacketFilter.iContextName.Copy(contextName); |
|
617 } |
|
618 |
|
619 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,numberOfTimes); |
|
620 if(ret!=KErrNone) |
|
621 { |
|
622 LOGPARSERR("SetConfigFail::numberOfTimes",ret,1,&KAddPacketFilter); |
|
623 } |
|
624 else |
|
625 { |
|
626 if(AsciiToNum(numberOfTimes, digit)==KErrNone) |
|
627 iAddPacketFilter.iNumberOfTimes = digit; |
|
628 } |
|
629 |
|
630 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,failErrorCode); |
|
631 if(ret!=KErrNone) |
|
632 { |
|
633 LOGPARSERR("SetConfigFail::failErrorCode",ret,2,&KAddPacketFilter); |
|
634 } |
|
635 else |
|
636 { |
|
637 if(AsciiToNum(failErrorCode, digit)==KErrNone) |
|
638 iAddPacketFilter.iFailErrorCode = digit; |
|
639 } |
|
640 |
|
641 } |
|
642 } |
|
643 |
|
644 void CSimPacketContext::GetContextConfigRel99SettingsL() |
|
645 { |
|
646 iContextConfigsRel99 = new(ELeave) CArrayFixFlat<TRel99ContextConfig>(KNumberofConfigs); |
|
647 |
|
648 TInt count = CfgFile()->ItemCount(KContextConfigRel99); // set up the Rel 99 context configuration parameters |
|
649 for(TInt i=0;i<count;i++) |
|
650 { |
|
651 const CTestConfigItem* item = CfgFile()->Item(KContextConfigRel99,i); |
|
652 if(!item) |
|
653 break; |
|
654 |
|
655 TPtrC8 contextName; |
|
656 TInt activatePause, activateErrorCode, aDeactivatePause, deactivateErrorCode, deletionPause; |
|
657 TInt deletionErrorCode; |
|
658 TBool connectToNtRas; |
|
659 TRel99ContextConfig contextConfigRel99; |
|
660 |
|
661 TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName); |
|
662 |
|
663 if(ret!=KErrNone) |
|
664 { |
|
665 LOGPARSERR("ContextConfigRel99::contextName",ret,0,KContextConfigRel99); |
|
666 } |
|
667 else |
|
668 { |
|
669 contextConfigRel99.iContextName.Copy(contextName); |
|
670 } |
|
671 |
|
672 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,activatePause); |
|
673 if(ret!=KErrNone) |
|
674 { |
|
675 LOGPARSERR("ContextConfigRel99::activatePause",ret,1,&KContextConfigRel99); |
|
676 continue; |
|
677 } |
|
678 else |
|
679 contextConfigRel99.iActivatePause = activatePause; |
|
680 |
|
681 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,activateErrorCode); |
|
682 if(ret!=KErrNone) |
|
683 { |
|
684 LOGPARSERR("ContextConfigRel99::activateErrorCode",ret,2,&KContextConfigRel99); |
|
685 continue; |
|
686 } |
|
687 else |
|
688 contextConfigRel99.iActivateErrorCode = activateErrorCode; |
|
689 |
|
690 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,aDeactivatePause); |
|
691 if(ret!=KErrNone) |
|
692 { |
|
693 LOGPARSERR("ContextConfigRel99::deactivatePause",ret,3,&KContextConfigRel99); |
|
694 continue; |
|
695 } |
|
696 else |
|
697 contextConfigRel99.iDeactivatePause = aDeactivatePause; |
|
698 |
|
699 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,deactivateErrorCode); |
|
700 if(ret!=KErrNone) |
|
701 { |
|
702 LOGPARSERR("ContextConfigRel99::deactivateErrorCode",ret,4,&KContextConfigRel99); |
|
703 continue; |
|
704 } |
|
705 else |
|
706 contextConfigRel99.iDeactivateErrorCode = deactivateErrorCode; |
|
707 |
|
708 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,deletionPause); |
|
709 if(ret!=KErrNone) |
|
710 { |
|
711 LOGPARSERR("ContextConfigRel99::deletetionPause",ret,5,&KContextConfigRel99); |
|
712 continue; |
|
713 } |
|
714 else |
|
715 contextConfigRel99.iDeletionPause = deletionPause; |
|
716 |
|
717 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6, deletionErrorCode); |
|
718 if(ret!=KErrNone) |
|
719 { |
|
720 LOGPARSERR("ContextConfigRel99::deletionErrorCode",ret,6,&KContextConfigRel99); |
|
721 continue; |
|
722 } |
|
723 else |
|
724 contextConfigRel99.iDeletionErrorCode = deletionErrorCode; |
|
725 |
|
726 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7, connectToNtRas); |
|
727 if(ret!=KErrNone) |
|
728 { |
|
729 contextConfigRel99.iConnectToNtRas = ETrue; |
|
730 } |
|
731 else |
|
732 contextConfigRel99.iConnectToNtRas = connectToNtRas; |
|
733 |
|
734 iContextConfigsRel99->AppendL(contextConfigRel99); |
|
735 } |
|
736 } |
|
737 |
|
738 /** |
|
739 Retrieves the (aIndex+1)th packet context status with the current context's context name |
|
740 ie. if aIndex is 0, the 1st context status entry is returned and if aIndex is 1, the 2nd is returned |
|
741 */ |
|
742 TNotifyContextStatusChange& CSimPacketContext::GetContextStatusChangeAt(TInt aIndex) |
|
743 { |
|
744 TInt count = 0; |
|
745 for (TInt i = 0; i < iNotifyContextStatusChangeArray->Count(); i++) |
|
746 { |
|
747 if (iContextName.Compare(iNotifyContextStatusChangeArray->At(i).iContextName) == 0) |
|
748 { |
|
749 if (count == aIndex) |
|
750 { |
|
751 return iNotifyContextStatusChangeArray->At(i); |
|
752 } |
|
753 else |
|
754 { |
|
755 count++; |
|
756 } |
|
757 } |
|
758 } |
|
759 return iNotifyContextStatusChangeArray->At(0); |
|
760 } |
|
761 |
|
762 /** |
|
763 Retrieves the number of context status changes entries configured for the current packet context |
|
764 */ |
|
765 TInt CSimPacketContext::GetContextStatusChangeCount() |
|
766 { |
|
767 TInt count = 0; |
|
768 for (TInt i = 0; i < iNotifyContextStatusChangeArray->Count(); i++) |
|
769 { |
|
770 if (iContextName.Compare(iNotifyContextStatusChangeArray->At(i).iContextName) == 0) |
|
771 { |
|
772 count++; |
|
773 } |
|
774 } |
|
775 return count; |
|
776 } |
|
777 |
|
778 void CSimPacketContext::GetContextStatusChangeSettingsL() |
|
779 { |
|
780 TPtrC8 contextStatusChangeType; |
|
781 TInt ret; |
|
782 |
|
783 iNotifyContextStatusChangeArray = new (ELeave) CArrayFixFlat<TNotifyContextStatusChange>(KNumberofConfigs); |
|
784 |
|
785 // default to using timer to drive context status changes |
|
786 iNotifyContextStatusChangeType = ETimer; |
|
787 const CTestConfigItem* item = CfgFile()->Item(KNotifyContextStatusChangeType); |
|
788 if (item) |
|
789 { |
|
790 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextStatusChangeType); |
|
791 if(ret==KErrNone && contextStatusChangeType.Compare(KNotificationTypePublishSubscribe)==0) |
|
792 iNotifyContextStatusChangeType = EPublishAndSubscribe; |
|
793 } |
|
794 |
|
795 TInt count = CfgFile()->ItemCount(KNotifyContextStatusChange); |
|
796 |
|
797 for(TInt i=0;i<count;i++) // set up NotifyContextStatusChange info |
|
798 { |
|
799 item = CfgFile()->Item(KNotifyContextStatusChange,i); |
|
800 if(!item) |
|
801 break; |
|
802 |
|
803 TNotifyContextStatusChange notifyContextStatusChange; |
|
804 TPtrC8 contextName; |
|
805 TInt duration, contextStatus; |
|
806 |
|
807 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,contextName); |
|
808 |
|
809 if(ret!=KErrNone) |
|
810 { |
|
811 LOGPARSERR("NotifyContextStatusChange::contextName",ret,0,&KNotifyContextStatusChange); |
|
812 continue; |
|
813 } |
|
814 else |
|
815 { |
|
816 notifyContextStatusChange.iContextName.Copy(contextName); |
|
817 } |
|
818 |
|
819 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,duration); |
|
820 if(ret!=KErrNone) |
|
821 { |
|
822 LOGPARSERR("NotifyContextStatusChange::duration",ret,1,&KNotifyContextStatusChange); |
|
823 continue; |
|
824 } |
|
825 else |
|
826 notifyContextStatusChange.iDuration = duration; |
|
827 |
|
828 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,contextStatus); |
|
829 if(ret!=KErrNone) |
|
830 { |
|
831 LOGPARSERR("NotifyContextStatusChange::duration",ret,2,&KNotifyContextStatusChange); |
|
832 continue; |
|
833 } |
|
834 else |
|
835 notifyContextStatusChange.iStatus = (RPacketContext::TContextStatus)contextStatus; |
|
836 |
|
837 iNotifyContextStatusChangeArray->AppendL(notifyContextStatusChange); |
|
838 |
|
839 if(GetContextStatusChangeCount() != 0) |
|
840 { |
|
841 iCurrentNotifyContextStatusChange=(RPacketContext::TContextStatus)GetContextStatusChangeAt(0).iStatus; |
|
842 if (iNotifyContextStatusChangeType == ETimer) |
|
843 { |
|
844 iNotifyContextStatusChangeIndex=0; |
|
845 iNotifyContextStatusChangeTimer->Start(GetContextStatusChangeAt(0).iDuration,this,ETimerIdPcktContextStatusChange); |
|
846 } |
|
847 } |
|
848 } |
|
849 } |
|
850 |
|
851 void CSimPacketContext::ConstructPacketFiltersL() |
|
852 { |
|
853 iPacketFilterInfoArray = new (ELeave) CArrayFixFlat<TPacketFilterV3>(KNumberofConfigs); |
|
854 |
|
855 const CTestConfigItem* item; |
|
856 TInt count, ret; |
|
857 count = CfgFile()->ItemCount(KPacketFilterInfo); |
|
858 |
|
859 for(TInt i=0;i<count;i++) // set up Packet filter info |
|
860 { |
|
861 item = CfgFile()->Item(KPacketFilterInfo,i); |
|
862 if(!item) |
|
863 break; |
|
864 |
|
865 TPtrC8 srcAddr, srcAddrSubnetMask; |
|
866 TInt id, evaluationPrecedenceIndex, protocolNumberOrNextHeader; |
|
867 TInt srcPortMin, srcPortMax, destPortMin, destPortMax, ipSecSPI, toSorTrafficClass; |
|
868 TInt flowLabel, filterType; |
|
869 TPacketFilterV3 packetFilter; |
|
870 |
|
871 // Check that the data structure is supported by the simulated TSY version |
|
872 if(iPhone->iSimTsyVersion < 3) // same version as TPacketFilterVx |
|
873 { |
|
874 (void)User::Leave(KErrNotSupported); |
|
875 } |
|
876 |
|
877 |
|
878 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,id); |
|
879 |
|
880 if(ret!=KErrNone) |
|
881 { |
|
882 LOGPARSERR("PacketFilterInfo::id",ret,0,&KPacketFilterInfo); |
|
883 continue; |
|
884 } |
|
885 else |
|
886 { |
|
887 packetFilter.iId= id; |
|
888 } |
|
889 |
|
890 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,evaluationPrecedenceIndex); |
|
891 |
|
892 if(ret!=KErrNone) |
|
893 { |
|
894 LOGPARSERR("PacketFilterInfo::evaluationPrecedenceIndex",ret,1,&KPacketFilterInfo); |
|
895 continue; |
|
896 } |
|
897 else |
|
898 { |
|
899 packetFilter.iEvaluationPrecedenceIndex= evaluationPrecedenceIndex; |
|
900 } |
|
901 |
|
902 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,srcAddr); |
|
903 |
|
904 if(ret!=KErrNone) |
|
905 { |
|
906 LOGPARSERR("PacketFilterInfo::srcAddr",ret,2,&KPacketFilterInfo); |
|
907 continue; |
|
908 } |
|
909 else |
|
910 { |
|
911 TUint8 digit=0; |
|
912 TPtrC8 address; |
|
913 |
|
914 ret=CTestConfig::GetElement(srcAddr,'.',0, address); |
|
915 if((AsciiToNum(address, digit)==KErrNone) |
|
916 && (ret == KErrNone)) |
|
917 packetFilter.iSrcAddr[0] = digit; |
|
918 else |
|
919 packetFilter.iSrcAddr[0] = 0; |
|
920 ret=CTestConfig::GetElement(srcAddr,'.',1, address); |
|
921 if((AsciiToNum(address, digit)==KErrNone) |
|
922 && (ret == KErrNone)) |
|
923 packetFilter.iSrcAddr[1] = digit; |
|
924 else |
|
925 packetFilter.iSrcAddr[1] = 0; |
|
926 ret=CTestConfig::GetElement(srcAddr,'.',2, address); |
|
927 if((AsciiToNum(address, digit)==KErrNone) |
|
928 && (ret == KErrNone)) |
|
929 packetFilter.iSrcAddr[2] = digit; |
|
930 else |
|
931 packetFilter.iSrcAddr[2] = 0; |
|
932 ret=CTestConfig::GetElement(srcAddr,'.',3, address); |
|
933 if((AsciiToNum(address, digit)==KErrNone) |
|
934 && (ret == KErrNone)) |
|
935 packetFilter.iSrcAddr[3] = digit; |
|
936 else |
|
937 packetFilter.iSrcAddr[3] = 0; |
|
938 ret=CTestConfig::GetElement(srcAddr,'.',4, address); |
|
939 if((AsciiToNum(address, digit)==KErrNone) |
|
940 && (ret == KErrNone)) |
|
941 packetFilter.iSrcAddr[4] = digit; |
|
942 else |
|
943 packetFilter.iSrcAddr[4] = 0; |
|
944 ret=CTestConfig::GetElement(srcAddr,'.',5, address); |
|
945 if((AsciiToNum(address, digit)==KErrNone) |
|
946 && (ret == KErrNone)) |
|
947 packetFilter.iSrcAddr[5] = digit; |
|
948 else |
|
949 packetFilter.iSrcAddr[5] = 0; |
|
950 ret=CTestConfig::GetElement(srcAddr,'.',6, address); |
|
951 if((AsciiToNum(address, digit)==KErrNone) |
|
952 && (ret == KErrNone)) |
|
953 packetFilter.iSrcAddr[6] = digit; |
|
954 else |
|
955 packetFilter.iSrcAddr[6] = 0; |
|
956 ret=CTestConfig::GetElement(srcAddr,'.',7, address); |
|
957 if((AsciiToNum(address, digit)==KErrNone) |
|
958 && (ret == KErrNone)) |
|
959 packetFilter.iSrcAddr[7] = digit; |
|
960 else |
|
961 packetFilter.iSrcAddr[7] = 0; |
|
962 ret=CTestConfig::GetElement(srcAddr,'.',8, address); |
|
963 if((AsciiToNum(address, digit)==KErrNone) |
|
964 && (ret == KErrNone)) |
|
965 packetFilter.iSrcAddr[8] = digit; |
|
966 else |
|
967 packetFilter.iSrcAddr[8] = 0; |
|
968 ret=CTestConfig::GetElement(srcAddr,'.',9, address); |
|
969 if((AsciiToNum(address, digit)==KErrNone) |
|
970 && (ret == KErrNone)) |
|
971 packetFilter.iSrcAddr[9] = digit; |
|
972 else |
|
973 packetFilter.iSrcAddr[9] = 0; |
|
974 ret=CTestConfig::GetElement(srcAddr,'.',10, address); |
|
975 if((AsciiToNum(address, digit)==KErrNone) |
|
976 && (ret == KErrNone)) |
|
977 packetFilter.iSrcAddr[10] = digit; |
|
978 else |
|
979 packetFilter.iSrcAddr[10] = 0; |
|
980 ret=CTestConfig::GetElement(srcAddr,'.',11, address); |
|
981 if((AsciiToNum(address, digit)==KErrNone) |
|
982 && (ret == KErrNone)) |
|
983 packetFilter.iSrcAddr[11] = digit; |
|
984 else |
|
985 packetFilter.iSrcAddr[11] = 0; |
|
986 ret=CTestConfig::GetElement(srcAddr,'.',12, address); |
|
987 if((AsciiToNum(address, digit)==KErrNone) |
|
988 && (ret == KErrNone)) |
|
989 packetFilter.iSrcAddr[12] = digit; |
|
990 else |
|
991 packetFilter.iSrcAddr[12] = 0; |
|
992 ret=CTestConfig::GetElement(srcAddr,'.',13, address); |
|
993 if((AsciiToNum(address, digit)==KErrNone) |
|
994 && (ret == KErrNone)) |
|
995 packetFilter.iSrcAddr[13] = digit; |
|
996 else |
|
997 packetFilter.iSrcAddr[13] = 0; |
|
998 ret=CTestConfig::GetElement(srcAddr,'.',14, address); |
|
999 if((AsciiToNum(address, digit)==KErrNone) |
|
1000 && (ret == KErrNone)) |
|
1001 packetFilter.iSrcAddr[14] = digit; |
|
1002 else |
|
1003 packetFilter.iSrcAddr[14] = 0; |
|
1004 ret=CTestConfig::GetElement(srcAddr,'.',15, address); |
|
1005 if((AsciiToNum(address, digit)==KErrNone) |
|
1006 && (ret == KErrNone)) |
|
1007 packetFilter.iSrcAddr[15] = digit; |
|
1008 else |
|
1009 packetFilter.iSrcAddr[15] = 0; |
|
1010 |
|
1011 } |
|
1012 |
|
1013 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,srcAddrSubnetMask); |
|
1014 |
|
1015 if(ret!=KErrNone) |
|
1016 { |
|
1017 LOGPARSERR("PacketFilterInfo::srcAddrSubnetMask",ret,3,&KPacketFilterInfo); |
|
1018 continue; |
|
1019 } |
|
1020 else |
|
1021 { |
|
1022 TUint8 digit=0; |
|
1023 TPtrC8 address; |
|
1024 |
|
1025 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',0, address); |
|
1026 if((AsciiToNum(address, digit)==KErrNone) |
|
1027 && (ret == KErrNone)) |
|
1028 packetFilter.iSrcAddrSubnetMask[0] = digit; |
|
1029 else |
|
1030 packetFilter.iSrcAddrSubnetMask[0] = 0; |
|
1031 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',1, address); |
|
1032 if((AsciiToNum(address, digit)==KErrNone) |
|
1033 && (ret == KErrNone)) |
|
1034 packetFilter.iSrcAddrSubnetMask[1] = digit; |
|
1035 else |
|
1036 packetFilter.iSrcAddrSubnetMask[1] = 0; |
|
1037 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',2, address); |
|
1038 if((AsciiToNum(address, digit)==KErrNone) |
|
1039 && (ret == KErrNone)) |
|
1040 packetFilter.iSrcAddrSubnetMask[2] = digit; |
|
1041 else |
|
1042 packetFilter.iSrcAddrSubnetMask[2] = 0; |
|
1043 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',3, address); |
|
1044 if((AsciiToNum(address, digit)==KErrNone) |
|
1045 && (ret == KErrNone)) |
|
1046 packetFilter.iSrcAddrSubnetMask[3] = digit; |
|
1047 else |
|
1048 packetFilter.iSrcAddrSubnetMask[3] = 0; |
|
1049 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',4, address); |
|
1050 if((AsciiToNum(address, digit)==KErrNone) |
|
1051 && (ret == KErrNone)) |
|
1052 packetFilter.iSrcAddrSubnetMask[4] = digit; |
|
1053 else |
|
1054 packetFilter.iSrcAddrSubnetMask[4] = 0; |
|
1055 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',5, address); |
|
1056 if((AsciiToNum(address, digit)==KErrNone) |
|
1057 && (ret == KErrNone)) |
|
1058 packetFilter.iSrcAddrSubnetMask[5] = digit; |
|
1059 else |
|
1060 packetFilter.iSrcAddrSubnetMask[5] = 0; |
|
1061 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',6, address); |
|
1062 if((AsciiToNum(address, digit)==KErrNone) |
|
1063 && (ret == KErrNone)) |
|
1064 packetFilter.iSrcAddrSubnetMask[6] = digit; |
|
1065 else |
|
1066 packetFilter.iSrcAddrSubnetMask[6] = 0; |
|
1067 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',7, address); |
|
1068 if((AsciiToNum(address, digit)==KErrNone) |
|
1069 && (ret == KErrNone)) |
|
1070 packetFilter.iSrcAddrSubnetMask[7] = digit; |
|
1071 else |
|
1072 packetFilter.iSrcAddrSubnetMask[7] = 0; |
|
1073 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',8, address); |
|
1074 if((AsciiToNum(address, digit)==KErrNone) |
|
1075 && (ret == KErrNone)) |
|
1076 packetFilter.iSrcAddrSubnetMask[8] = digit; |
|
1077 else |
|
1078 packetFilter.iSrcAddrSubnetMask[8] = 0; |
|
1079 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',9, address); |
|
1080 if((AsciiToNum(address, digit)==KErrNone) |
|
1081 && (ret == KErrNone)) |
|
1082 packetFilter.iSrcAddrSubnetMask[9] = digit; |
|
1083 else |
|
1084 packetFilter.iSrcAddrSubnetMask[9] = 0; |
|
1085 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',10, address); |
|
1086 if((AsciiToNum(address, digit)==KErrNone) |
|
1087 && (ret == KErrNone)) |
|
1088 packetFilter.iSrcAddrSubnetMask[10] = digit; |
|
1089 else |
|
1090 packetFilter.iSrcAddrSubnetMask[10] = 0; |
|
1091 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',11, address); |
|
1092 if((AsciiToNum(address, digit)==KErrNone) |
|
1093 && (ret == KErrNone)) |
|
1094 packetFilter.iSrcAddrSubnetMask[11] = digit; |
|
1095 else |
|
1096 packetFilter.iSrcAddrSubnetMask[11] = 0; |
|
1097 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',12, address); |
|
1098 if((AsciiToNum(address, digit)==KErrNone) |
|
1099 && (ret == KErrNone)) |
|
1100 packetFilter.iSrcAddrSubnetMask[12] = digit; |
|
1101 else |
|
1102 packetFilter.iSrcAddrSubnetMask[12] = 0; |
|
1103 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',13, address); |
|
1104 if((AsciiToNum(address, digit)==KErrNone) |
|
1105 && (ret == KErrNone)) |
|
1106 packetFilter.iSrcAddrSubnetMask[13] = digit; |
|
1107 else |
|
1108 packetFilter.iSrcAddrSubnetMask[13] = 0; |
|
1109 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',14, address); |
|
1110 if((AsciiToNum(address, digit)==KErrNone) |
|
1111 && (ret == KErrNone)) |
|
1112 packetFilter.iSrcAddrSubnetMask[14] = digit; |
|
1113 else |
|
1114 packetFilter.iSrcAddrSubnetMask[14] = 0; |
|
1115 ret=CTestConfig::GetElement(srcAddrSubnetMask,'.',15, address); |
|
1116 if((AsciiToNum(address, digit)==KErrNone) |
|
1117 && (ret == KErrNone)) |
|
1118 packetFilter.iSrcAddrSubnetMask[15] = digit; |
|
1119 else |
|
1120 packetFilter.iSrcAddrSubnetMask[15] = 0; |
|
1121 } |
|
1122 |
|
1123 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,protocolNumberOrNextHeader); |
|
1124 |
|
1125 if(ret!=KErrNone) |
|
1126 { |
|
1127 LOGPARSERR("PacketFilterInfo::protocolNumberOrNextNumber",ret,4,&KPacketFilterInfo); |
|
1128 packetFilter.iProtocolNumberOrNextHeader = KUnsetInteger; |
|
1129 } |
|
1130 else |
|
1131 { |
|
1132 packetFilter.iProtocolNumberOrNextHeader= protocolNumberOrNextHeader; |
|
1133 } |
|
1134 |
|
1135 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,srcPortMin); |
|
1136 |
|
1137 if(ret!=KErrNone) |
|
1138 { |
|
1139 LOGPARSERR("PacketFilterInfo::srcPortMin",ret,5,&KPacketFilterInfo); |
|
1140 packetFilter.iSrcPortMin = KUnsetInteger; |
|
1141 } |
|
1142 else |
|
1143 { |
|
1144 packetFilter.iSrcPortMin= srcPortMin; |
|
1145 } |
|
1146 |
|
1147 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,srcPortMax); |
|
1148 |
|
1149 if(ret!=KErrNone) |
|
1150 { |
|
1151 LOGPARSERR("PacketFilterInfo::srcPortMax",ret,6,&KPacketFilterInfo); |
|
1152 packetFilter.iSrcPortMax = KUnsetInteger; |
|
1153 } |
|
1154 else |
|
1155 { |
|
1156 packetFilter.iSrcPortMax= srcPortMax; |
|
1157 } |
|
1158 |
|
1159 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,destPortMin); |
|
1160 |
|
1161 if(ret!=KErrNone) |
|
1162 { |
|
1163 LOGPARSERR("PacketFilterInfo::destPortMin",ret,7,&KPacketFilterInfo); |
|
1164 packetFilter.iDestPortMin = KUnsetInteger; |
|
1165 } |
|
1166 else |
|
1167 { |
|
1168 packetFilter.iDestPortMin= destPortMin; |
|
1169 } |
|
1170 |
|
1171 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,8,destPortMax); |
|
1172 |
|
1173 if(ret!=KErrNone) |
|
1174 { |
|
1175 LOGPARSERR("PacketFilterInfo::srcPortMax",ret,8,&KPacketFilterInfo); |
|
1176 packetFilter.iDestPortMax = KUnsetInteger; |
|
1177 } |
|
1178 else |
|
1179 { |
|
1180 packetFilter.iDestPortMax= destPortMax; |
|
1181 } |
|
1182 |
|
1183 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,9,ipSecSPI); |
|
1184 |
|
1185 if(ret!=KErrNone) |
|
1186 { |
|
1187 LOGPARSERR("PacketFilterInfo::ipSecSPI",ret,9,&KPacketFilterInfo); |
|
1188 packetFilter.iIPSecSPI = KUnsetInteger; |
|
1189 } |
|
1190 else |
|
1191 { |
|
1192 packetFilter.iIPSecSPI= ipSecSPI; |
|
1193 } |
|
1194 |
|
1195 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,10,toSorTrafficClass); |
|
1196 |
|
1197 if(ret!=KErrNone) |
|
1198 { |
|
1199 LOGPARSERR("PacketFilterInfo::toSorTrafficClass",ret,10,&KPacketFilterInfo); |
|
1200 continue; |
|
1201 } |
|
1202 else |
|
1203 { |
|
1204 packetFilter.iTOSorTrafficClass = (TUint16)toSorTrafficClass; |
|
1205 } |
|
1206 |
|
1207 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,11,flowLabel); |
|
1208 |
|
1209 if(ret!=KErrNone) |
|
1210 { |
|
1211 LOGPARSERR("PacketFilterInfo::flowLabel",ret,11,&KPacketFilterInfo); |
|
1212 packetFilter.iFlowLabel = KUnsetInteger; |
|
1213 } |
|
1214 else |
|
1215 { |
|
1216 packetFilter.iFlowLabel = flowLabel; |
|
1217 } |
|
1218 |
|
1219 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,12,filterType); |
|
1220 |
|
1221 if(ret!=KErrNone) |
|
1222 { |
|
1223 if(ret == KErrNotFound) |
|
1224 { |
|
1225 LOGCONFIG1("CONFIGURATION FILE PARSING - PacketFilterInfo::TPacketFilterV2 info encountered"); |
|
1226 packetFilter.iFilterType = RPacketContext::EPacketFilterTypeUnknown; |
|
1227 } |
|
1228 else |
|
1229 { |
|
1230 LOGPARSERR("PacketFilterInfo::filterType",ret,12,&KPacketFilterInfo); |
|
1231 continue; |
|
1232 } |
|
1233 } |
|
1234 else |
|
1235 { |
|
1236 packetFilter.iFilterType = static_cast<RPacketContext::TPacketFilterType>(filterType); |
|
1237 } |
|
1238 |
|
1239 packetFilter.iAdded = EFalse; |
|
1240 TRAP_IGNORE(iPacketFilterInfoArray->AppendL(packetFilter)); |
|
1241 } |
|
1242 } |
|
1243 |
|
1244 CSimPacketContext::~CSimPacketContext() |
|
1245 /** |
|
1246 * Trivial Destructor |
|
1247 * Closes all CObject type objects and destroys all other objects created in the ConstructL() |
|
1248 * |
|
1249 */ |
|
1250 { |
|
1251 LOGPACKET1("CSimPacketContext: Entered destructor"); |
|
1252 |
|
1253 if (iContextConfigParams != NULL) |
|
1254 { |
|
1255 iContextConfigParams->Delete(0, iContextConfigParams->Count()); |
|
1256 delete iContextConfigParams; |
|
1257 } |
|
1258 if (iContextConfigsRel99 != NULL) |
|
1259 { |
|
1260 iContextConfigsRel99->Delete(0,iContextConfigsRel99->Count()); |
|
1261 delete iContextConfigsRel99; |
|
1262 } |
|
1263 if (iCommSetupArray != NULL) |
|
1264 { |
|
1265 iCommSetupArray->Delete(0, iCommSetupArray->Count()); |
|
1266 delete iCommSetupArray; |
|
1267 } |
|
1268 if (iNtRas != NULL) |
|
1269 delete iNtRas; |
|
1270 |
|
1271 if (iTimer != NULL) |
|
1272 delete iTimer; |
|
1273 |
|
1274 if (iSetConfigTimer != NULL) |
|
1275 delete iSetConfigTimer; |
|
1276 |
|
1277 if (iInitContextTimer != NULL) |
|
1278 delete iInitContextTimer; |
|
1279 |
|
1280 if (iCreateTftTimer != NULL) |
|
1281 delete iCreateTftTimer; |
|
1282 |
|
1283 if (iNotifyContextStatusChangeTimer != NULL) |
|
1284 delete iNotifyContextStatusChangeTimer; |
|
1285 |
|
1286 if (iNotifyContextConfigChangeTimer != NULL) |
|
1287 delete iNotifyContextConfigChangeTimer; |
|
1288 |
|
1289 if (iPacketFilterInfoArray != NULL) |
|
1290 { |
|
1291 iPacketFilterInfoArray->Delete(0, iPacketFilterInfoArray->Count()); |
|
1292 delete iPacketFilterInfoArray; |
|
1293 } |
|
1294 if (iNotifyContextStatusChangeArray != NULL) |
|
1295 { |
|
1296 iNotifyContextStatusChangeArray->Delete(0, iNotifyContextStatusChangeArray->Count()); |
|
1297 delete iNotifyContextStatusChangeArray; |
|
1298 } |
|
1299 iPacketService->DecrementContextCount(); |
|
1300 |
|
1301 if (iAuthorizationTokenResponse != NULL) |
|
1302 { |
|
1303 iAuthorizationTokenResponse->Delete(0, iAuthorizationTokenResponse->Count()); |
|
1304 delete iAuthorizationTokenResponse; |
|
1305 } |
|
1306 |
|
1307 if (iMediaAuthorization != NULL) |
|
1308 { |
|
1309 for(TUint i=0; i<iMediaAuthorization->Count(); i++) |
|
1310 { |
|
1311 if (iMediaAuthorization->At(i).iFlowIds.Count() > 0) |
|
1312 { |
|
1313 iMediaAuthorization->At(i).iFlowIds.Reset(); |
|
1314 } |
|
1315 } |
|
1316 iMediaAuthorization->Delete(0, iMediaAuthorization->Count()); |
|
1317 delete iMediaAuthorization; |
|
1318 } |
|
1319 |
|
1320 delete iContextStatusChange; |
|
1321 |
|
1322 if(iSetConfigData !=NULL ) |
|
1323 { |
|
1324 iSetConfigData->Delete(0, iSetConfigData->Count()); |
|
1325 delete iSetConfigData; |
|
1326 } |
|
1327 |
|
1328 if(iNotifyContextConfigChangeArray !=NULL) |
|
1329 { |
|
1330 iNotifyContextConfigChangeArray->Delete(0,iNotifyContextConfigChangeArray->Count()); |
|
1331 delete iNotifyContextConfigChangeArray; |
|
1332 } |
|
1333 } |
|
1334 |
|
1335 CTelObject* CSimPacketContext::OpenNewObjectByNameL(const TDesC& aName) |
|
1336 /** |
|
1337 * Returns a pointer to an existing QoS object identified by name. |
|
1338 * This is not support and if called will leave. |
|
1339 * |
|
1340 * @param aName name of the QoS object to be opened |
|
1341 * @return CTelObject will return null and leave |
|
1342 * @leave Leaves with KErrNotSupported if the name is not as expected. |
|
1343 */ |
|
1344 { |
|
1345 if (aName.Compare(iQoSName) == KErrNone) |
|
1346 { |
|
1347 return iPacketqos; |
|
1348 } |
|
1349 |
|
1350 User::Leave(KErrNotSupported); |
|
1351 return NULL; |
|
1352 } |
|
1353 |
|
1354 |
|
1355 CTelObject* CSimPacketContext::OpenNewObjectL(TDes& aNewName) |
|
1356 /** |
|
1357 * Creates a new CSimPacketQoS object and returns a pointer to it. |
|
1358 * |
|
1359 * @param aNewName new name of the object created |
|
1360 * @return CTelObject pointer to the CSimPacketQos object created |
|
1361 * @leave Leaves if out of memory. |
|
1362 */ |
|
1363 { |
|
1364 aNewName.Append(KSimPacketQosName); |
|
1365 aNewName.AppendNum(++iQoSObjectCount); |
|
1366 iQoSName.Copy(aNewName); |
|
1367 iPacketqos = CSimPacketQoS::NewL(iPhone, this); |
|
1368 return iPacketqos; |
|
1369 } |
|
1370 |
|
1371 CTelObject::TReqMode CSimPacketContext::ReqModeL(const TInt aIpc) |
|
1372 /** |
|
1373 * ReqModeL is called from the server's CTelObject::ReqAnalyserL |
|
1374 * in order to check the type of request it has. |
|
1375 * |
|
1376 * |
|
1377 * @param aIpc the ipc number that identifies the client request |
|
1378 * @return CTelObject::TReqMode The request mode to be used for this request |
|
1379 * @leave Leaves if not supported by this tsy |
|
1380 */ |
|
1381 { |
|
1382 CTelObject::TReqMode ret=0; |
|
1383 switch (aIpc) |
|
1384 { |
|
1385 case EPacketContextSetConfig: |
|
1386 case EPacketContextActivate: |
|
1387 case EPacketContextDeactivate: |
|
1388 case EPacketContextDelete: |
|
1389 case EPacketContextLoanCommPort: |
|
1390 case EPacketContextRecoverCommPort: |
|
1391 case EPacketContextGetConfig: |
|
1392 case EPacketContextGetStatus: |
|
1393 case EPacketContextGetDataVolumeTransferred: |
|
1394 case EPacketContextGetLastErrorCause: |
|
1395 case EPacketContextInitialiseContext: |
|
1396 case EPacketContextEnumeratePacketFilters: |
|
1397 case EPacketContextGetPacketFilterInfo: |
|
1398 case EPacketContextAddPacketFilter: |
|
1399 case EPacketContextRemovePacketFilter: |
|
1400 case EPacketContextModifyActiveContext: |
|
1401 case EPacketContextGetProfileName: |
|
1402 case EPacketContextGetDNSInfo: |
|
1403 case EPacketAddMediaAuthorization: |
|
1404 case EPacketRemoveMediaAuthorization: |
|
1405 case EPacketContextCreateNewTFT: |
|
1406 case EPacketContextDeleteTFT: |
|
1407 break; |
|
1408 |
|
1409 case EPacketContextNotifyConfigChanged: |
|
1410 case EPacketContextNotifyStatusChange: |
|
1411 case EPacketContextNotifyDataTransferred: |
|
1412 ret=KReqModeMultipleCompletionEnabled | KReqModeRePostImmediately; |
|
1413 break; |
|
1414 |
|
1415 default: |
|
1416 User::Leave(KErrNotSupported); |
|
1417 break; |
|
1418 } |
|
1419 |
|
1420 return ret; |
|
1421 } |
|
1422 |
|
1423 TInt CSimPacketContext::GetProfileName(const TTsyReqHandle aTsyReqHandle, TName* aQoSProfile) |
|
1424 { |
|
1425 /** |
|
1426 * This synchronous method allows a client to retrieve the name |
|
1427 * of the QoS profile. The profile name is passed back in the aQoSProfile parameter |
|
1428 */ |
|
1429 aQoSProfile->Copy(iQoSName); |
|
1430 ReqCompleted(aTsyReqHandle,KErrNone); |
|
1431 return KErrNone; |
|
1432 } |
|
1433 |
|
1434 TInt CSimPacketContext::RegisterNotification(const TInt aIpc) |
|
1435 /** |
|
1436 * RegisterNotification is called when the server recognises that this notification |
|
1437 * is being posted for the first time on this sub-session object. |
|
1438 * |
|
1439 * It enables the TSY to "turn on" any regular notification messages that it may receive |
|
1440 * from the phone |
|
1441 * |
|
1442 * @param aIpc the ipc number that identifies the client request |
|
1443 * @return err KErrNone if fine |
|
1444 */ |
|
1445 { |
|
1446 switch (aIpc) |
|
1447 { |
|
1448 case EPacketContextNotifyConfigChanged: |
|
1449 case EPacketContextNotifyStatusChange: |
|
1450 case EPacketContextNotifyDataTransferred: |
|
1451 return KErrNone; |
|
1452 default: |
|
1453 // Unknown or invalid IPC |
|
1454 LOGPACKET1("CSimPacketContext: Register error, unknown IPC"); |
|
1455 return KErrNotSupported; |
|
1456 } |
|
1457 } |
|
1458 |
|
1459 TInt CSimPacketContext::DeregisterNotification(const TInt aIpc) |
|
1460 /** |
|
1461 * DeregisterNotification is called when the server recognises that this notification |
|
1462 * will not be posted again because the last client to have a handle on this sub-session |
|
1463 * object has just closed the handle. |
|
1464 * |
|
1465 * It enables the TSY to "turn off" any regular notification messages that it may |
|
1466 * receive from the phone |
|
1467 * |
|
1468 * @param aIpc the ipc number that identifies the client request |
|
1469 * @return err KErrNone if fine |
|
1470 */ |
|
1471 { |
|
1472 switch (aIpc) |
|
1473 { |
|
1474 case EPacketContextNotifyConfigChanged: |
|
1475 case EPacketContextNotifyStatusChange: |
|
1476 case EPacketContextNotifyDataTransferred: |
|
1477 LOGPACKET1("CSimPacketContext: DeregisterNotification"); |
|
1478 return KErrNone; |
|
1479 default: |
|
1480 // Unknown or invalid IPC |
|
1481 LOGPACKET1("CSimPacketContext: Deregister error, unknown IPC"); |
|
1482 return KErrNotSupported; |
|
1483 } |
|
1484 } |
|
1485 |
|
1486 TInt CSimPacketContext::NumberOfSlotsL(const TInt aIpc) |
|
1487 /** |
|
1488 * NumberOfSlotsL is called by the server when it is registering a new notification |
|
1489 * It enables the TSY to tell the server how many buffer slots to allocate for |
|
1490 * "repost immediately" notifications that may trigger before clients collect them |
|
1491 * |
|
1492 * @param aIpc the ipc number that identifies the client request |
|
1493 * @return err KErrNone if fine |
|
1494 */ |
|
1495 { |
|
1496 TInt numberOfSlots=1; |
|
1497 switch (aIpc) |
|
1498 { |
|
1499 case EPacketContextNotifyConfigChanged: |
|
1500 case EPacketContextNotifyStatusChange: |
|
1501 case EPacketContextNotifyDataTransferred: |
|
1502 LOGPACKET1("CGprsDGprsTsy: Registered with 5 slots"); |
|
1503 numberOfSlots=5; |
|
1504 break; |
|
1505 default: |
|
1506 // Unknown or invalid IPC |
|
1507 LOGPACKET1("CSimPacketContext: Number of Slots error, unknown IPC"); |
|
1508 User::Leave(KErrNotSupported); |
|
1509 break; |
|
1510 } |
|
1511 return numberOfSlots; |
|
1512 } |
|
1513 |
|
1514 |
|
1515 TInt CSimPacketContext::ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc, |
|
1516 const TDataPackage& aPackage) |
|
1517 /** |
|
1518 * ExtFunc is called by the server when it has a "extended", i.e. non-core ETel request |
|
1519 * for the TSY to process. |
|
1520 * A request handle, request type and request data are passed to the TSY |
|
1521 * |
|
1522 * @param aTsyReqHandle The request handle for completing the request |
|
1523 * @param aIpc Ipc representing the request |
|
1524 * @param aPackage any data associated with the request |
|
1525 * @return err KErrNone if request completes ok |
|
1526 */ |
|
1527 { |
|
1528 //< if this context has been deleted then the client can not do anything with it |
|
1529 //< if the client wants to use this class, the client must open a new object by |
|
1530 //< name with the name for this context and this will reactivate the context. |
|
1531 if(iDeleted && (aIpc != EPacketContextGetStatus)) |
|
1532 { |
|
1533 ReqCompleted(aTsyReqHandle,KErrNotReady); |
|
1534 return KErrNone; |
|
1535 } |
|
1536 |
|
1537 TAny* dataPtr=aPackage.Ptr1(); |
|
1538 TAny* dataPtr2=aPackage.Ptr2(); |
|
1539 |
|
1540 switch (aIpc) |
|
1541 { |
|
1542 case EPacketContextSetConfig: |
|
1543 { |
|
1544 if (iSetConfigCallCount <= iSetConfigFail.iNumberOfTimes |
|
1545 || iSetConfigFail.iNumberOfTimes==0) |
|
1546 { |
|
1547 if (iSetConfigDelay > 0) |
|
1548 { |
|
1549 TSetConfigData setConfigData; |
|
1550 setConfigData.iTsyReqHandle = aTsyReqHandle; |
|
1551 setConfigData.iData = aPackage.Des1n(); |
|
1552 |
|
1553 TRAPD(ret, iSetConfigData->AppendL(setConfigData) ); |
|
1554 if (ret != KErrNone) |
|
1555 { |
|
1556 LOGPACKET1("CSimPacketContext::ExtFunc AppendL call fail"); |
|
1557 return ret; |
|
1558 } |
|
1559 |
|
1560 iSetConfigTimer->Start(iSetConfigDelay,this,ETimerIdPcktContextSetConfig); |
|
1561 } |
|
1562 else |
|
1563 { |
|
1564 SetConfig(aTsyReqHandle, aPackage.Des1n()); |
|
1565 } |
|
1566 iSetConfigCallCount++; |
|
1567 return KErrNone; |
|
1568 } |
|
1569 else |
|
1570 { |
|
1571 iSetConfigCallCount=0; |
|
1572 iSetConfigFail.iNumberOfTimes = 0; |
|
1573 |
|
1574 ReqCompleted(aTsyReqHandle, iSetConfigFail.iFailErrorCode); |
|
1575 return KErrNone; // if SetConfig() has been called the number of times allowed in SetConfigFail, fail request |
|
1576 } |
|
1577 } |
|
1578 case EPacketContextGetProfileName: |
|
1579 return GetProfileName(aTsyReqHandle, REINTERPRET_CAST(TName*,dataPtr)); |
|
1580 case EPacketContextSetConfigCancel: |
|
1581 return SetConfigCancel(aTsyReqHandle); |
|
1582 case EPacketContextGetConfig: |
|
1583 return GetConfig(aTsyReqHandle, aPackage.Des1n()); |
|
1584 case EPacketContextGetConfigCancel: |
|
1585 return GetConfigCancel(aTsyReqHandle); |
|
1586 case EPacketContextNotifyConfigChanged: |
|
1587 return NotifyConfigChanged(aTsyReqHandle, aPackage.Des1n()); |
|
1588 case EPacketContextNotifyConfigChangedCancel: |
|
1589 return NotifyConfigChangedCancel(aTsyReqHandle); |
|
1590 case EPacketContextActivate: |
|
1591 { //< Ensures that theres only one context active as only one active context is |
|
1592 //<permitted at any one time |
|
1593 if(iIsActive) |
|
1594 { |
|
1595 ReqCompleted(aTsyReqHandle,KErrEtelCallAlreadyActive); |
|
1596 return KErrNone; |
|
1597 } |
|
1598 else |
|
1599 return Activate(aTsyReqHandle); |
|
1600 } |
|
1601 case EPacketContextActivateCancel: |
|
1602 return ActivateCancel(aTsyReqHandle); |
|
1603 case EPacketContextDeactivate: |
|
1604 return Deactivate(aTsyReqHandle); |
|
1605 case EPacketContextDeactivateCancel: |
|
1606 return DeactivateCancel(aTsyReqHandle); |
|
1607 case EPacketContextDelete: |
|
1608 return Delete(aTsyReqHandle); |
|
1609 case EPacketContextDeleteCancel: |
|
1610 return DeleteCancel(aTsyReqHandle); |
|
1611 case EPacketContextLoanCommPort: |
|
1612 return LoanCommPort(aTsyReqHandle, |
|
1613 REINTERPRET_CAST(RCall::TCommPort*, dataPtr)); |
|
1614 case EPacketContextLoanCommPortCancel: |
|
1615 return LoanCommPortCancel(aTsyReqHandle); |
|
1616 case EPacketContextRecoverCommPort: |
|
1617 return RecoverCommPort(aTsyReqHandle); |
|
1618 case EPacketContextRecoverCommPortCancel: |
|
1619 return RecoverCommPortCancel(aTsyReqHandle); |
|
1620 case EPacketContextGetStatus: |
|
1621 return GetStatus(aTsyReqHandle, |
|
1622 REINTERPRET_CAST(RPacketContext::TContextStatus*, dataPtr)); |
|
1623 case EPacketContextNotifyStatusChange: |
|
1624 return NotifyStatusChange(aTsyReqHandle, |
|
1625 REINTERPRET_CAST(RPacketContext::TContextStatus*, dataPtr)); |
|
1626 case EPacketContextNotifyStatusChangeCancel: |
|
1627 return NotifyStatusChangeCancel(aTsyReqHandle); |
|
1628 case EPacketContextGetDataVolumeTransferred: |
|
1629 return GetDataVolumeTransferred(aTsyReqHandle, |
|
1630 REINTERPRET_CAST(RPacketContext::TDataVolume*, dataPtr)); |
|
1631 case EPacketContextNotifyDataTransferred: |
|
1632 return NotifyDataTransferred(aTsyReqHandle, |
|
1633 REINTERPRET_CAST(RPacketContext::TDataVolume*, dataPtr), |
|
1634 REINTERPRET_CAST(RPacketContext::TNotifyDataTransferredRequest*, dataPtr2)); |
|
1635 case EPacketContextNotifyDataTransferredCancel: |
|
1636 return NotifyDataTransferredCancel(aTsyReqHandle); |
|
1637 case EPacketContextGetLastErrorCause: |
|
1638 return GetLastErrorCause(aTsyReqHandle, |
|
1639 REINTERPRET_CAST(TInt*, dataPtr)); |
|
1640 case EPacketContextInitialiseContextCancel: |
|
1641 return InitialiseContextCancel(aTsyReqHandle); |
|
1642 case EPacketContextEnumeratePacketFiltersCancel: |
|
1643 return EnumeratePacketFiltersCancel(aTsyReqHandle); |
|
1644 case EPacketContextGetPacketFilterInfoCancel: |
|
1645 return GetPacketFilterInfoCancel(aTsyReqHandle); |
|
1646 case EPacketContextAddPacketFilterCancel: |
|
1647 return AddPacketFilterCancel(aTsyReqHandle); |
|
1648 case EPacketContextRemovePacketFilterCancel: |
|
1649 return RemovePacketFilterCancel(aTsyReqHandle); |
|
1650 case EPacketContextModifyActiveContextCancel: |
|
1651 return ModifyActiveContextCancel(aTsyReqHandle); |
|
1652 case EPacketContextInitialiseContext: |
|
1653 return InitialiseContext(aTsyReqHandle, aPackage.Des1n()); |
|
1654 case EPacketContextEnumeratePacketFilters: |
|
1655 return EnumeratePacketFilters(aTsyReqHandle, *REINTERPRET_CAST(TInt*, dataPtr)); |
|
1656 case EPacketContextGetPacketFilterInfo: |
|
1657 TInt retValue; |
|
1658 TRAPD(err, retValue = GetPacketFilterInfoL(aTsyReqHandle, *REINTERPRET_CAST(TInt*, dataPtr), aPackage.Des2n())); |
|
1659 if(err != KErrNone) |
|
1660 { |
|
1661 retValue = err; |
|
1662 } |
|
1663 return retValue; |
|
1664 case EPacketContextAddPacketFilter: |
|
1665 return AddPacketFilter(aTsyReqHandle, aPackage.Des1n()); |
|
1666 case EPacketContextRemovePacketFilter: |
|
1667 return RemovePacketFilter(aTsyReqHandle, *REINTERPRET_CAST(TInt*, dataPtr)); |
|
1668 case EPacketContextModifyActiveContext: |
|
1669 return ModifyActiveContext(aTsyReqHandle); |
|
1670 case EPacketContextGetDNSInfo: |
|
1671 return GetDnsInfo(aTsyReqHandle, aPackage.Des1n()); |
|
1672 case EPacketContextGetDNSInfoCancel: |
|
1673 return GetDnsInfoCancel(aTsyReqHandle); |
|
1674 case EPacketAddMediaAuthorization: |
|
1675 return GetAddMediaAuthorization(aTsyReqHandle, aPackage.Des1n()); |
|
1676 case EPacketAddMediaAuthorizationCancel: |
|
1677 return GetAddMediaAuthorizationCancel(aTsyReqHandle); |
|
1678 case EPacketRemoveMediaAuthorization: |
|
1679 return GetRemoveMediaAuthorization(aTsyReqHandle, reinterpret_cast<RPacketContext::TAuthorizationToken*>(dataPtr)); |
|
1680 case EPacketRemoveMediaAuthorizationCancel: |
|
1681 return GetRemoveMediaAuthorizationCancel(aTsyReqHandle); |
|
1682 case EPacketContextCreateNewTFT: |
|
1683 return CreateNewTFT(aTsyReqHandle, REINTERPRET_CAST(TInt*, dataPtr)); |
|
1684 case EPacketContextCreateNewTFTCancel: |
|
1685 return CreateNewTFTCancel(aTsyReqHandle); |
|
1686 case EPacketContextDeleteTFT: |
|
1687 return DeleteTFT(aTsyReqHandle); |
|
1688 case EPacketContextDeleteTFTCancel: |
|
1689 return DeleteTFTCancel(aTsyReqHandle); |
|
1690 default: |
|
1691 return KErrNotSupported; |
|
1692 } |
|
1693 } |
|
1694 |
|
1695 TInt CSimPacketContext::CancelService(const TInt aIpc,const TTsyReqHandle aTsyReqHandle) |
|
1696 /** |
|
1697 * CancelService is called by the server when it is "cleaning-up" any still outstanding |
|
1698 * asynchronous requests before closing a client's sub-session. |
|
1699 * This will happen if a client closes its R-class handle without cancelling outstanding asynchronous requests. |
|
1700 * |
|
1701 * @param aTsyReqHandle The request handle for completing the request |
|
1702 * @param aIpc Ipc representing the request |
|
1703 * @return err KErrNone if request completes ok |
|
1704 */ |
|
1705 { |
|
1706 LOGPACKET1("CSimPacketContext: - CancelService called"); |
|
1707 switch (aIpc) |
|
1708 { |
|
1709 case EPacketContextSetConfig: |
|
1710 return SetConfigCancel(aTsyReqHandle); |
|
1711 case EPacketContextGetConfig: |
|
1712 return GetConfigCancel(aTsyReqHandle); |
|
1713 case EPacketContextNotifyConfigChanged: |
|
1714 return NotifyConfigChangedCancel(aTsyReqHandle); |
|
1715 case EPacketContextActivate: |
|
1716 return ActivateCancel(aTsyReqHandle); |
|
1717 case EPacketContextDeactivate: |
|
1718 return DeactivateCancel(aTsyReqHandle); |
|
1719 case EPacketContextDelete: |
|
1720 return DeleteCancel(aTsyReqHandle); |
|
1721 case EPacketContextLoanCommPort: |
|
1722 return LoanCommPortCancel(aTsyReqHandle); |
|
1723 case EPacketContextRecoverCommPort: |
|
1724 return RecoverCommPortCancel(aTsyReqHandle); |
|
1725 case EPacketContextNotifyStatusChange: |
|
1726 return NotifyStatusChangeCancel(aTsyReqHandle); |
|
1727 case EPacketContextNotifyDataTransferred: |
|
1728 return NotifyDataTransferredCancel(aTsyReqHandle); |
|
1729 case EPacketContextInitialiseContext: |
|
1730 return InitialiseContextCancel(aTsyReqHandle); |
|
1731 case EPacketContextEnumeratePacketFilters: |
|
1732 return EnumeratePacketFiltersCancel(aTsyReqHandle); |
|
1733 case EPacketContextGetPacketFilterInfo: |
|
1734 return GetPacketFilterInfoCancel(aTsyReqHandle); |
|
1735 case EPacketContextAddPacketFilter: |
|
1736 return AddPacketFilterCancel(aTsyReqHandle); |
|
1737 case EPacketContextRemovePacketFilter: |
|
1738 return RemovePacketFilterCancel(aTsyReqHandle); |
|
1739 case EPacketContextModifyActiveContext: |
|
1740 return ModifyActiveContextCancel(aTsyReqHandle); |
|
1741 case EPacketContextGetDNSInfo: |
|
1742 return GetDnsInfoCancel(aTsyReqHandle); |
|
1743 case EPacketAddMediaAuthorization: |
|
1744 return GetAddMediaAuthorizationCancel(aTsyReqHandle); |
|
1745 case EPacketRemoveMediaAuthorization: |
|
1746 return GetRemoveMediaAuthorizationCancel(aTsyReqHandle); |
|
1747 case EPacketContextCreateNewTFT: |
|
1748 return CreateNewTFTCancel(aTsyReqHandle); |
|
1749 case EPacketContextDeleteTFT: |
|
1750 return DeleteTFTCancel(aTsyReqHandle); |
|
1751 default: |
|
1752 return KErrGeneral; |
|
1753 } |
|
1754 } |
|
1755 |
|
1756 TInt CSimPacketContext::TSetConfigData::Find(CArrayFixFlat<TSetConfigData>* aSetConfigArray, TTsyReqHandle aTsyReqHandle, TInt& aIndex) |
|
1757 { |
|
1758 for (TInt i = 0; i < aSetConfigArray->Count(); i++) |
|
1759 { |
|
1760 if (aSetConfigArray->At(i).iTsyReqHandle == aTsyReqHandle) |
|
1761 { |
|
1762 aIndex = i; |
|
1763 return KErrNone; |
|
1764 } |
|
1765 } |
|
1766 aIndex = -1; |
|
1767 return KErrNotFound; |
|
1768 } |
|
1769 |
|
1770 TInt CSimPacketContext::SetConfig(const TTsyReqHandle aTsyReqHandle,const TDesC8* aConfig) |
|
1771 /** |
|
1772 * Sets the configuration |
|
1773 * |
|
1774 * @param aTsyReqHandle Tsy Request handle for the client request |
|
1775 * @param aConfig pointer containing the parameters to set to. |
|
1776 * @return KErrNone |
|
1777 |
|
1778 */ |
|
1779 { |
|
1780 LOGPACKET1("CSimPacketContext::SetConfig called"); |
|
1781 |
|
1782 TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aConfig; |
|
1783 TPacketDataConfigBase& configBaseV1 = (*configBase)(); |
|
1784 |
|
1785 TInt err = KErrGeneral; |
|
1786 |
|
1787 //Extract the config params to be set |
|
1788 TContextConfigParam contextConfigToSet; |
|
1789 |
|
1790 if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS) |
|
1791 { |
|
1792 TPckg<RPacketContext::TContextConfigGPRS>* configParam = (TPckg<RPacketContext::TContextConfigGPRS>*)aConfig; |
|
1793 RPacketContext::TContextConfigGPRS& contextConfigV1 = (*configParam)(); |
|
1794 |
|
1795 CSimContextHelper::SetTContextConfigParamFromTContextConfigGPRS( contextConfigToSet, contextConfigV1 ); |
|
1796 } |
|
1797 |
|
1798 if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4) |
|
1799 { |
|
1800 TPckg<RPacketContext::TContextConfigR99_R4>* configParam = (TPckg<RPacketContext::TContextConfigR99_R4>*)aConfig; |
|
1801 RPacketContext::TContextConfigR99_R4& contextConfigV1 = (*configParam)(); |
|
1802 |
|
1803 CSimContextHelper::SetTContextConfigParamFromTContextConfigR99_R4( contextConfigToSet, contextConfigV1 ); |
|
1804 } |
|
1805 |
|
1806 if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5) |
|
1807 { |
|
1808 TPckg<RPacketContext::TContextConfig_R5>* configParam = (TPckg<RPacketContext::TContextConfig_R5>*)aConfig; |
|
1809 RPacketContext::TContextConfig_R5& contextConfigV1 = (*configParam)(); |
|
1810 |
|
1811 CSimContextHelper::SetTContextConfigParamFromTContextConfig_R5( contextConfigToSet, contextConfigV1 ); |
|
1812 } |
|
1813 |
|
1814 // Check the context config params to be set with the pre-defined |
|
1815 // list of allowed config params |
|
1816 if((configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS)|| |
|
1817 configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4|| |
|
1818 configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5) |
|
1819 { |
|
1820 |
|
1821 TInt index; |
|
1822 for(index=0; index < iContextConfigParams->Count(); index++) |
|
1823 { |
|
1824 TContextConfigParam thisConfig = iContextConfigParams->At(index); |
|
1825 |
|
1826 if ( !CSimContextHelper::EqualTContextConfigParam(contextConfigToSet, thisConfig ) ) |
|
1827 { |
|
1828 err = KErrCorrupt; |
|
1829 } |
|
1830 else |
|
1831 { |
|
1832 err = KErrNone; |
|
1833 iContextConfigParamsIndex = index; |
|
1834 |
|
1835 //Check for and complete any pending notifications |
|
1836 if(iNotifyConfigGPRS.iNotifyPending) |
|
1837 { |
|
1838 iNotifyConfigGPRS.iNotifyPending=EFalse; |
|
1839 CSimContextHelper::ConvertConfigParams(thisConfig, *(RPacketContext::TContextConfigGPRS*)iNotifyConfigGPRS.iNotifyData); |
|
1840 ReqCompleted(iNotifyConfigGPRS.iNotifyHandle,KErrNone); |
|
1841 } |
|
1842 |
|
1843 if(iNotifyConfigR99.iNotifyPending) |
|
1844 { |
|
1845 iNotifyConfigR99.iNotifyPending=EFalse; |
|
1846 CSimContextHelper::ConvertConfigParams(thisConfig, *(RPacketContext::TContextConfigR99_R4*)iNotifyConfigR99.iNotifyData); |
|
1847 ReqCompleted(iNotifyConfigR99.iNotifyHandle,KErrNone); |
|
1848 } |
|
1849 |
|
1850 if(iNotifyConfigR5.iNotifyPending) |
|
1851 { |
|
1852 iNotifyConfigR5.iNotifyPending=EFalse; |
|
1853 CSimContextHelper::ConvertConfigParams(thisConfig, *(RPacketContext::TContextConfig_R5*)iNotifyConfigR5.iNotifyData); |
|
1854 ReqCompleted(iNotifyConfigR5.iNotifyHandle,KErrNone); |
|
1855 } |
|
1856 break; |
|
1857 } |
|
1858 }//end for loop |
|
1859 ReqCompleted(aTsyReqHandle,err); |
|
1860 }//end if((configBaseV1.... |
|
1861 |
|
1862 else |
|
1863 { |
|
1864 ReqCompleted(aTsyReqHandle,KErrCorrupt); |
|
1865 } |
|
1866 |
|
1867 return KErrNone; |
|
1868 } |
|
1869 |
|
1870 TInt CSimPacketContext::SetConfigCancel(const TTsyReqHandle aTsyReqHandle) |
|
1871 /** |
|
1872 * Cancels the Setconfig request. |
|
1873 * |
|
1874 * @param aTsyReqHandle Tsy Request handle for the client request |
|
1875 * @return err KErrNone |
|
1876 */ |
|
1877 { |
|
1878 TInt index = 0; |
|
1879 if (TSetConfigData::Find(iSetConfigData, aTsyReqHandle, index) == KErrNone) |
|
1880 { |
|
1881 iSetConfigData->Delete(index); |
|
1882 } |
|
1883 if (iSetConfigData->Count() == 0) |
|
1884 iSetConfigTimer->Cancel(); |
|
1885 |
|
1886 ReqCompleted(aTsyReqHandle, KErrCancel); |
|
1887 |
|
1888 return KErrNone; |
|
1889 } |
|
1890 |
|
1891 TInt CSimPacketContext::GetConfig(const TTsyReqHandle aTsyReqHandle,TDes8* aConfig) |
|
1892 /** |
|
1893 * Retrieves and returns the configuration |
|
1894 * |
|
1895 * @param aTsyReqHandle Tsy Request handle for the client request |
|
1896 * @param aConfig pointer to the data to retrieve |
|
1897 * @return KErrNone |
|
1898 */ |
|
1899 { |
|
1900 LOGPACKET1("CSimPacketContext::GetConfig called"); |
|
1901 TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aConfig; |
|
1902 TPacketDataConfigBase& configBaseV1 = (*configBase)(); |
|
1903 |
|
1904 // GPRS configuration |
|
1905 if(configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigGPRS) |
|
1906 { |
|
1907 TContextConfigParam config = iContextConfigParams->At(iContextConfigParamsIndex); |
|
1908 |
|
1909 TPckg<RPacketContext::TContextConfigGPRS>* contextConfigGPRSPckg = (TPckg<RPacketContext::TContextConfigGPRS>*)aConfig; |
|
1910 RPacketContext::TContextConfigGPRS& contextConfigV1 = (*contextConfigGPRSPckg)(); |
|
1911 |
|
1912 CSimContextHelper::ConvertConfigParams(config, contextConfigV1); |
|
1913 |
|
1914 ReqCompleted(aTsyReqHandle,KErrNone); |
|
1915 } |
|
1916 |
|
1917 // R99/R4 configuration |
|
1918 else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4) |
|
1919 { |
|
1920 TContextConfigParam config = iContextConfigParams->At(iContextConfigParamsIndex); |
|
1921 |
|
1922 TPckg<RPacketContext::TContextConfigR99_R4>* configRel99Pckg = (TPckg<RPacketContext::TContextConfigR99_R4>*)aConfig; |
|
1923 RPacketContext::TContextConfigR99_R4& configRel99 = (*configRel99Pckg)(); |
|
1924 |
|
1925 CSimContextHelper::ConvertConfigParams(config, configRel99); |
|
1926 |
|
1927 ReqCompleted(aTsyReqHandle,KErrNone); |
|
1928 } |
|
1929 |
|
1930 // R5 configuration |
|
1931 else if (configBaseV1.ExtensionId()==TPacketDataConfigBase::KConfigRel5) |
|
1932 { |
|
1933 TContextConfigParam config = iContextConfigParams->At(iContextConfigParamsIndex); |
|
1934 |
|
1935 TPckg<RPacketContext::TContextConfig_R5>* configRel5Pckg = (TPckg<RPacketContext::TContextConfig_R5>*)aConfig; |
|
1936 RPacketContext::TContextConfig_R5& configRel5 = (*configRel5Pckg)(); |
|
1937 |
|
1938 CSimContextHelper::ConvertConfigParams(config, configRel5); |
|
1939 |
|
1940 ReqCompleted(aTsyReqHandle,KErrNone); |
|
1941 } |
|
1942 return KErrNone; |
|
1943 } |
|
1944 |
|
1945 TInt CSimPacketContext::GetConfigCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
1946 /** |
|
1947 * Cancels the Getconfig request. This method will do nothing in this version of SimTSY. |
|
1948 * |
|
1949 * @param aTsyReqHandle Tsy Request handle for the client request |
|
1950 * @return err KErrNone |
|
1951 */ |
|
1952 { |
|
1953 return KErrNone; |
|
1954 } |
|
1955 |
|
1956 TInt CSimPacketContext::NotifyConfigChanged(const TTsyReqHandle aTsyReqHandle, TDes8* aConfig) |
|
1957 /** |
|
1958 * Records a client interest in being notified of a change in the Context Configuration. |
|
1959 * |
|
1960 * @param aTsyReqHandle Tsy Request handle for the client request |
|
1961 * @param aConfig pointer to the context config to store the config info when the config changes. |
|
1962 * @return KErrNone |
|
1963 */ |
|
1964 { |
|
1965 TPckg<TPacketDataConfigBase>* configBase = (TPckg<TPacketDataConfigBase>*)aConfig; |
|
1966 TPacketDataConfigBase& configBaseV1 = (*configBase)(); |
|
1967 |
|
1968 if(configBaseV1.ExtensionId() == TPacketDataConfigBase::KConfigGPRS) |
|
1969 { |
|
1970 __ASSERT_ALWAYS(!iNotifyConfigGPRS.iNotifyPending,SimPanic(ENotificationAlreadyPending)); |
|
1971 |
|
1972 iNotifyConfigGPRS.iNotifyPending = ETrue; |
|
1973 iNotifyConfigGPRS.iNotifyHandle = aTsyReqHandle; |
|
1974 iNotifyConfigGPRS.iNotifyData = &configBaseV1; |
|
1975 } |
|
1976 else if(configBaseV1.ExtensionId() == TPacketDataConfigBase::KConfigRel99Rel4) |
|
1977 { |
|
1978 __ASSERT_ALWAYS(!iNotifyConfigR99.iNotifyPending,SimPanic(ENotificationAlreadyPending)); |
|
1979 |
|
1980 iNotifyConfigR99.iNotifyPending = ETrue; |
|
1981 iNotifyConfigR99.iNotifyHandle = aTsyReqHandle; |
|
1982 iNotifyConfigR99.iNotifyData = &configBaseV1; |
|
1983 } |
|
1984 else if(configBaseV1.ExtensionId() == TPacketDataConfigBase::KConfigRel5) |
|
1985 { |
|
1986 __ASSERT_ALWAYS(!iNotifyConfigR5.iNotifyPending,SimPanic(ENotificationAlreadyPending)); |
|
1987 |
|
1988 iNotifyConfigR5.iNotifyPending = ETrue; |
|
1989 iNotifyConfigR5.iNotifyHandle = aTsyReqHandle; |
|
1990 iNotifyConfigR5.iNotifyData = &configBaseV1; |
|
1991 } |
|
1992 |
|
1993 return KErrNone; |
|
1994 } |
|
1995 |
|
1996 TInt CSimPacketContext::NotifyConfigChangedCancel(const TTsyReqHandle aTsyReqHandle) |
|
1997 /** |
|
1998 * Cancel a client's interest in being notified when the context configuration changes |
|
1999 * This is acheived simply by resetting the flag that indicates a notification is pending. |
|
2000 * |
|
2001 * @param aTsyReqHandle Tsy Request handle for the client cancel request |
|
2002 * @return KErrNone |
|
2003 */ |
|
2004 { |
|
2005 LOGPACKET1("CSimPacketContext::NotifyConfigChangedCancel called"); |
|
2006 if(iNotifyConfigGPRS.iNotifyPending && |
|
2007 iNotifyConfigGPRS.iNotifyHandle == aTsyReqHandle) |
|
2008 { |
|
2009 iNotifyConfigGPRS.iNotifyPending=EFalse; |
|
2010 ReqCompleted(aTsyReqHandle,KErrCancel); |
|
2011 } |
|
2012 else if(iNotifyConfigR99.iNotifyPending && |
|
2013 iNotifyConfigR99.iNotifyHandle == aTsyReqHandle) |
|
2014 { |
|
2015 iNotifyConfigR99.iNotifyPending=EFalse; |
|
2016 ReqCompleted(aTsyReqHandle,KErrCancel); |
|
2017 } |
|
2018 else if(iNotifyConfigR5.iNotifyPending && |
|
2019 iNotifyConfigR5.iNotifyHandle == aTsyReqHandle) |
|
2020 { |
|
2021 iNotifyConfigR5.iNotifyPending=EFalse; |
|
2022 ReqCompleted(aTsyReqHandle,KErrCancel); |
|
2023 } |
|
2024 |
|
2025 return KErrNone; |
|
2026 } |
|
2027 |
|
2028 TInt CSimPacketContext::AttemptDeactivateImmediately() |
|
2029 /** |
|
2030 * Called when client wishes to Detach when there is an active context. |
|
2031 * This will deactivate the context immediately from the network. |
|
2032 * |
|
2033 * @return KErrNone if deactivated successfully. |
|
2034 */ |
|
2035 { |
|
2036 if((iState==RPacketContext::EStatusActive) || (iState==RPacketContext::EStatusActivating)) |
|
2037 { |
|
2038 iCurrentEvent=EContextEventDeactivate; |
|
2039 TInt ret = ChangeState(RPacketContext::EStatusDeactivating); |
|
2040 if(ret!=KErrNone) |
|
2041 return ret; |
|
2042 return ChangeState(RPacketContext::EStatusInactive); |
|
2043 } |
|
2044 return KErrNone; |
|
2045 } |
|
2046 |
|
2047 TInt CSimPacketContext::ReActivate(CSimPacketService* aPacketService, const TName& aContextName) |
|
2048 /** |
|
2049 * This method is called by the packet Service to Re-Initialise a Deleted context. |
|
2050 * If the context is deleted then the client cannot retrieve any |
|
2051 * infomation or use the context in any way. |
|
2052 * In order for the client to use the context again, the client must |
|
2053 * open an object by name passing |
|
2054 * the name of this context as a pararemter. |
|
2055 * |
|
2056 * @param aPacketService pointer to the parent class CSimPacketService. |
|
2057 * @param aContextName Must be the same name as the name for this context. |
|
2058 * @return KErrNone if no problem in re-initialising this context. |
|
2059 */ |
|
2060 { |
|
2061 if(iContextName.Compare(aContextName) != KErrNone) |
|
2062 { |
|
2063 return KErrBadName; |
|
2064 } |
|
2065 |
|
2066 iPacketService = aPacketService; |
|
2067 |
|
2068 if(iDeleted) |
|
2069 { |
|
2070 |
|
2071 TInt ret = ChangeState(RPacketContext::EStatusInactive); |
|
2072 if (ret != KErrNone) |
|
2073 { |
|
2074 return ret; |
|
2075 } |
|
2076 |
|
2077 iDeleted = EFalse; |
|
2078 iContextConfigParamsIndex = 0; |
|
2079 iNotifyStatusChange.iNotifyPending = EFalse; |
|
2080 iNotifyConfigGPRS.iNotifyPending = EFalse; |
|
2081 iNotifyConfigR99.iNotifyPending = EFalse; |
|
2082 iNotifyConfigR5.iNotifyPending = EFalse; |
|
2083 |
|
2084 } |
|
2085 return KErrNone; |
|
2086 } |
|
2087 |
|
2088 TInt CSimPacketContext::DoDeactivate() |
|
2089 /** |
|
2090 * This method is called when timer events for deactivate context has completed. |
|
2091 * It will then try to terminate the NTRas Connection. |
|
2092 * |
|
2093 * @return KErrNone |
|
2094 */ |
|
2095 { |
|
2096 iNotifyContextConfigChangeTimer->Cancel(); |
|
2097 iNtRas->Terminate(); |
|
2098 return KErrNone; |
|
2099 } |
|
2100 |
|
2101 TInt CSimPacketContext::Deactivate(const TTsyReqHandle aTsyReqHandle) |
|
2102 /** |
|
2103 * Client calls this method to try to Deactivate an active context. |
|
2104 * In this method, we'll store the TsyReqHandle for later completion then call ActionEvent |
|
2105 * state machine to handle the event which will kick off a timer. |
|
2106 * The Actual Deactivation will take place in the DoDeactivate method. |
|
2107 * |
|
2108 * @param aTsyReqHandle Tsy Request handle for the client request |
|
2109 * @return KErrNone |
|
2110 */ |
|
2111 { |
|
2112 LOGPACKET1("CSimPacketContext::Deactivate called"); |
|
2113 iDeactivateRequestHandle = aTsyReqHandle; |
|
2114 TInt ret; |
|
2115 ret = ActionEvent(EContextEventDeactivate,KErrNone); |
|
2116 return ret; |
|
2117 } |
|
2118 |
|
2119 TInt CSimPacketContext::DeactivateCancel(const TTsyReqHandle aTsyReqHandle) |
|
2120 /** |
|
2121 * Client calls this method to try and cancel a Deactivate request. |
|
2122 * This will only complete successfully if and only if the Deactivate request has not completed. |
|
2123 * i.e. if we haven't already deactivated the context. |
|
2124 * |
|
2125 * @param aTsyReqHandle Tsy Request handle for the client cancel request |
|
2126 * @return KErrNone |
|
2127 */ |
|
2128 { |
|
2129 LOGPACKET1("CSimPacketContext::DeactivateCancel called"); |
|
2130 if(((iState == RPacketContext::EStatusInactive) || (iState == RPacketContext::EStatusDeactivating)) && |
|
2131 (iCurrentEvent==EContextEventDeactivate)) |
|
2132 { |
|
2133 iTimer->Cancel(); |
|
2134 iCurrentEvent= EContextEventNone; |
|
2135 TInt ret = ChangeState(RPacketContext::EStatusActive); |
|
2136 if(ret!= KErrNone) |
|
2137 ReqCompleted(aTsyReqHandle,ret); |
|
2138 ReqCompleted(aTsyReqHandle,KErrCancel); |
|
2139 } |
|
2140 |
|
2141 return KErrNone; |
|
2142 } |
|
2143 |
|
2144 TInt CSimPacketContext::DoActivate() |
|
2145 /** |
|
2146 * This method is called when timer events for Activate context has completed. |
|
2147 * It will then try to Set up the NtRas Connection and open a port for client use. |
|
2148 * |
|
2149 * @return KErrNone |
|
2150 */ |
|
2151 { |
|
2152 TCommConfigV01 commConfig; |
|
2153 TCommSetupItem item = FindCommSettings(); |
|
2154 |
|
2155 if (iPacketqos) |
|
2156 { |
|
2157 iPacketqos->ClearChangeQoSPending(); |
|
2158 } |
|
2159 commConfig.iRate=item.iConfig.iRate; |
|
2160 commConfig.iDataBits=EData8; |
|
2161 commConfig.iStopBits=EStop1; |
|
2162 commConfig.iHandshake=item.iConfig.iHandshake; |
|
2163 iCommReset=item.iCommReset; |
|
2164 TInt ras = iNtRas->Connect(item.iCsyName,item.iPortName,commConfig,this); |
|
2165 |
|
2166 TContextConfigParam thisConfig = iContextConfigParams->At(iContextConfigParamsIndex); |
|
2167 |
|
2168 // Check for and complete any pending notifications |
|
2169 if(iNotifyConfigGPRS.iNotifyPending) |
|
2170 { |
|
2171 iNotifyConfigGPRS.iNotifyPending=EFalse; |
|
2172 CSimContextHelper::ConvertConfigParams(thisConfig, *(RPacketContext::TContextConfigGPRS*)iNotifyConfigGPRS.iNotifyData); |
|
2173 ReqCompleted(iNotifyConfigGPRS.iNotifyHandle,KErrNone); |
|
2174 } |
|
2175 |
|
2176 if(iNotifyConfigR99.iNotifyPending) |
|
2177 { |
|
2178 iNotifyConfigR99.iNotifyPending=EFalse; |
|
2179 CSimContextHelper::ConvertConfigParams(thisConfig, *(RPacketContext::TContextConfigR99_R4*)iNotifyConfigR99.iNotifyData); |
|
2180 ReqCompleted(iNotifyConfigR99.iNotifyHandle,KErrNone); |
|
2181 } |
|
2182 |
|
2183 if(iNotifyConfigR5.iNotifyPending) |
|
2184 { |
|
2185 iNotifyConfigR5.iNotifyPending=EFalse; |
|
2186 CSimContextHelper::ConvertConfigParams(thisConfig, *(RPacketContext::TContextConfig_R5*)iNotifyConfigR5.iNotifyData); |
|
2187 ReqCompleted(iNotifyConfigR5.iNotifyHandle,KErrNone); |
|
2188 } |
|
2189 |
|
2190 // start the timer for the simulated network-side context parameter changes |
|
2191 if(iNotifyContextConfigChangeArray->Count() > 0) |
|
2192 { |
|
2193 TInt delay = (iNotifyContextConfigChangeArray->At(0)).iDelay; |
|
2194 iNotifyContextConfigChangeTimer->Start(delay,this,ETimerIdPcktContextConfigChange); |
|
2195 } |
|
2196 |
|
2197 return ras; |
|
2198 } |
|
2199 |
|
2200 |
|
2201 TInt CSimPacketContext::Activate(const TTsyReqHandle aTsyReqHandle) |
|
2202 /** |
|
2203 * Client calls this method to try to Activate a context. |
|
2204 * In this method, we'll store the TsyReqHandle for later completion then call ActionEvent |
|
2205 * state machine to handle the event which will kick off a timer. |
|
2206 * The Actual Activation will take place in the DoActivate method. |
|
2207 * |
|
2208 * @param aTsyReqHandle Tsy Request handle for the client request |
|
2209 * @return KErrNone |
|
2210 */ |
|
2211 { |
|
2212 iActivateRequestHandle = aTsyReqHandle; |
|
2213 TInt ret; |
|
2214 ret = ActionEvent(EContextEventActivate,KErrNone); |
|
2215 return ret; |
|
2216 } |
|
2217 |
|
2218 |
|
2219 TInt CSimPacketContext::ActivateCancel(const TTsyReqHandle aTsyReqHandle) |
|
2220 /** |
|
2221 * Client calls this method to try and cancel an Activate request. |
|
2222 * This will only complete successfully if and only if the Activate request has not completed. |
|
2223 * i.e. if we haven't already activated the context. |
|
2224 * |
|
2225 * @param aTsyReqHandle Tsy Request handle for the client cancel request |
|
2226 * @return KErrNone |
|
2227 */ |
|
2228 { |
|
2229 LOGPACKET1("CSimPacketContext::ActivateCancel called"); |
|
2230 if(((iState == RPacketContext::EStatusInactive) || (iState == RPacketContext::EStatusActivating)) && |
|
2231 (iCurrentEvent==EContextEventActivate)) |
|
2232 { |
|
2233 iTimer->Cancel(); |
|
2234 iCurrentEvent= EContextEventNone; |
|
2235 TInt ret = ChangeState(RPacketContext::EStatusInactive); |
|
2236 if(ret!= KErrNone) |
|
2237 ReqCompleted(aTsyReqHandle,ret); |
|
2238 else |
|
2239 ReqCompleted(aTsyReqHandle,KErrCancel); |
|
2240 } |
|
2241 else if (iState == RPacketContext::EStatusDeleted) |
|
2242 { |
|
2243 ReqCompleted(aTsyReqHandle,KErrCancel); |
|
2244 } |
|
2245 |
|
2246 return KErrNone; |
|
2247 } |
|
2248 |
|
2249 TInt CSimPacketContext::DoDelete() |
|
2250 /** |
|
2251 * This method is called when timer events for Delete context has completed. |
|
2252 * It will then try to Terminate the NtRas Connection and then set the context as deleted. |
|
2253 * Once the context is deleted then the client cannot retrieve any information about the context |
|
2254 * or use the context. calling ReActivateContext will reinstate this context. |
|
2255 * |
|
2256 * @return KErrNone |
|
2257 */ |
|
2258 { |
|
2259 iDeleted = ETrue; |
|
2260 iNtRas->Terminate(); |
|
2261 iQoSObjectCount--; |
|
2262 return KErrNone; |
|
2263 } |
|
2264 |
|
2265 |
|
2266 TInt CSimPacketContext::Delete(const TTsyReqHandle aTsyReqHandle) |
|
2267 /** |
|
2268 * Client calls this method to try to Delete this context. |
|
2269 * In this method, we'll store the TsyReqHandle for later completion then call ActionEvent |
|
2270 * state machine to handle the event which will kick off a timer. |
|
2271 * The Actual Delete will take place in the DoDelete method. |
|
2272 * |
|
2273 * This request will only succeed if the context already exist (had been created) and also not |
|
2274 * previously deleted. |
|
2275 * |
|
2276 * @param aTsyReqHandle Tsy Request handle for the client request |
|
2277 * @return KErrNone |
|
2278 */ |
|
2279 { |
|
2280 LOGPACKET1("CSimPacketContext::Delete called"); |
|
2281 iDeleteRequestHandle = aTsyReqHandle; |
|
2282 TInt ret; |
|
2283 ret = ActionEvent(EContextEventDelete,KErrNone); |
|
2284 return ret; |
|
2285 } |
|
2286 |
|
2287 TInt CSimPacketContext::DeleteCancel(const TTsyReqHandle aTsyReqHandle) |
|
2288 /** |
|
2289 * Client calls this method to try and cancel a Delete context request. |
|
2290 * This will only complete successfully if and only if the Delete request has not completed. |
|
2291 * i.e. if we haven't already Deleted the context. |
|
2292 * |
|
2293 * @param aTsyReqHandle Tsy Request handle for the client cancel request |
|
2294 * @return KErrNone |
|
2295 */ |
|
2296 { |
|
2297 LOGPACKET1("CSimPacketContext::DeleteCancel called"); |
|
2298 if((iState == RPacketContext::EStatusInactive) && (iCurrentEvent==EContextEventDelete)) |
|
2299 { |
|
2300 iTimer->Cancel(); |
|
2301 iCurrentEvent= EContextEventNone; |
|
2302 ReqCompleted(aTsyReqHandle,KErrCancel); |
|
2303 } |
|
2304 return KErrNone; |
|
2305 } |
|
2306 |
|
2307 TInt CSimPacketContext::LoanCommPort(const TTsyReqHandle aTsyReqHandle,RCall::TCommPort* aDataPort) |
|
2308 /** |
|
2309 * The method will return to the client the port it has opened previously in the Activate method |
|
2310 * |
|
2311 * @param aTsyReqHandle Tsy Request handle for the client request |
|
2312 * @param aDataPort Pointer to the port and csy name for the opened port. |
|
2313 * @return KErrNone |
|
2314 */ |
|
2315 { |
|
2316 LOGPACKET1("CSimPacketContext::LoanCommPort called"); |
|
2317 |
|
2318 if(iState != RPacketContext::EStatusActive) |
|
2319 { |
|
2320 ReqCompleted(aTsyReqHandle, KErrEtelCallNotActive); |
|
2321 return KErrNone; |
|
2322 } |
|
2323 if (iCommPortLoaned) |
|
2324 { |
|
2325 ReqCompleted(aTsyReqHandle, KErrEtelPortAlreadyLoaned); |
|
2326 return KErrNone; |
|
2327 } |
|
2328 |
|
2329 TCommSetupItem item = FindCommSettings(); |
|
2330 aDataPort->iCsy.Copy(item.iCsyName); |
|
2331 aDataPort->iPort.Copy(item.iPortName); |
|
2332 iCommPortLoaned = ETrue; |
|
2333 ReqCompleted(aTsyReqHandle,KErrNone); |
|
2334 |
|
2335 return KErrNone; |
|
2336 } |
|
2337 |
|
2338 TInt CSimPacketContext::LoanCommPortCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
2339 /** |
|
2340 * Cancels a client loan port request. This method will do nothing. |
|
2341 * |
|
2342 * @param aTsyReqHandle Tsy Request handle for the client cancel request |
|
2343 * @return KErrNone |
|
2344 */ |
|
2345 { |
|
2346 LOGPACKET1("CSimPacketContext::LoanCommPortCancel called"); |
|
2347 return KErrNone; |
|
2348 } |
|
2349 |
|
2350 TInt CSimPacketContext::RecoverCommPort(const TTsyReqHandle aTsyReqHandle) |
|
2351 /** |
|
2352 * In this method we'll try and terminate the NtRas connection and reover the port. |
|
2353 * |
|
2354 * @param aTsyReqHandle Tsy Request handle for the client request |
|
2355 * @return KErrNone |
|
2356 */ |
|
2357 { |
|
2358 LOGPACKET1("CSimPacketContext::RecoverCommPort called"); |
|
2359 if (!iCommPortLoaned) |
|
2360 { |
|
2361 ReqCompleted(aTsyReqHandle, KErrEtelPortNotLoanedToClient); |
|
2362 return KErrNone; |
|
2363 } |
|
2364 iNtRas->Terminate(); |
|
2365 iCommPortLoaned = EFalse; |
|
2366 ReqCompleted(aTsyReqHandle,KErrNone); |
|
2367 return KErrNone; |
|
2368 } |
|
2369 |
|
2370 TInt CSimPacketContext::RecoverCommPortCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
2371 /** |
|
2372 * Attempt to cancel a RecoverCommPort request. This method does nothing |
|
2373 * |
|
2374 * @param aTsyReqHandle Tsy Request handle for the client cancel request |
|
2375 * @return KErrNone |
|
2376 */ |
|
2377 { |
|
2378 LOGPACKET1("CSimPacketContext::RecoverCommPortCancel called"); |
|
2379 return KErrNone; |
|
2380 } |
|
2381 |
|
2382 TInt CSimPacketContext::GetStatus(const TTsyReqHandle aTsyReqHandle,RPacketContext::TContextStatus* aContextStatus) |
|
2383 /** |
|
2384 * Retrieves and returns the current status of the Packet context in the aContextStatus parameter. |
|
2385 * |
|
2386 * @param aTsyReqHandle Tsy Request handle for the client cancel request |
|
2387 * @param aContextStatus pointer to the status of the packet context. |
|
2388 * @return KerrNone |
|
2389 */ |
|
2390 { |
|
2391 LOGPACKET1("CSimPacketContext::GetStatus called"); |
|
2392 *aContextStatus = iState; |
|
2393 ReqCompleted(aTsyReqHandle,KErrNone); |
|
2394 return KErrNone; |
|
2395 } |
|
2396 |
|
2397 TInt CSimPacketContext::NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RPacketContext::TContextStatus* aContextStatus) |
|
2398 /** |
|
2399 * Record a client's interest in being notified of the state of the packet contexts. |
|
2400 * First check that there isn't already a notification pending (the ETel Server should protect |
|
2401 * against this) and then record the information necessary to complete the request later, when |
|
2402 * the status does actually change. |
|
2403 * |
|
2404 * @param aTsyReqHandle Tsy Request handle for the client request |
|
2405 * @param aContextStatus pointer to the packet context status |
|
2406 * @return KErrNone |
|
2407 */ |
|
2408 { |
|
2409 LOGPACKET1("CSimPacketContext::NotifyStatusChange called"); |
|
2410 __ASSERT_ALWAYS(!iNotifyStatusChange.iNotifyPending,SimPanic(ENotificationAlreadyPending)); |
|
2411 iNotifyStatusChange.iNotifyPending = ETrue; |
|
2412 iNotifyStatusChange.iNotifyHandle = aTsyReqHandle; |
|
2413 iNotifyStatusChange.iNotifyData = aContextStatus; |
|
2414 return KErrNone; |
|
2415 } |
|
2416 |
|
2417 |
|
2418 |
|
2419 TInt CSimPacketContext::NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle) |
|
2420 /** |
|
2421 * Cancel a client's interest in being notified when the packet context status changes. |
|
2422 * This is acheived simply by resetting the flag that indicates a notification is pending. |
|
2423 * |
|
2424 * @param aTsyReqHandle Tsy Request handle for the client cancel request |
|
2425 * @return KErrNone |
|
2426 */ |
|
2427 { |
|
2428 LOGPACKET1("CSimPacketContext::NotifyStatusChangeCancel called"); |
|
2429 if(iNotifyStatusChange.iNotifyPending) |
|
2430 { |
|
2431 iNotifyStatusChange.iNotifyPending=EFalse; |
|
2432 ReqCompleted(aTsyReqHandle,KErrCancel); |
|
2433 } |
|
2434 return KErrNone; |
|
2435 } |
|
2436 |
|
2437 TInt CSimPacketContext::GetDataVolumeTransferred(const TTsyReqHandle aTsyReqHandle,RPacketContext::TDataVolume* /*aVolume*/) |
|
2438 /** |
|
2439 * Retrieves and returns the to the client the amount of data sent over the serial port. |
|
2440 * This method is not supported and will request complete with KErrNotSupported |
|
2441 * |
|
2442 * @param aTsyReqHandle Tsy Request handle for the client request |
|
2443 * @param aVolume pointer to the volume of data trasferred so far. |
|
2444 * @return KErrNone |
|
2445 */ |
|
2446 { |
|
2447 LOGPACKET1("CSimPacketContext::GetDataVolumeTransferred called"); |
|
2448 ReqCompleted(aTsyReqHandle,KErrNotSupported); |
|
2449 return KErrNone; |
|
2450 } |
|
2451 |
|
2452 TInt CSimPacketContext::NotifyDataTransferred(const TTsyReqHandle aTsyReqHandle, RPacketContext::TDataVolume* /*aVolume*/, RPacketContext::TNotifyDataTransferredRequest* /*aData*/) |
|
2453 /** |
|
2454 * Notifies the client when data is sent or received over the comm port |
|
2455 * This method is not supported in this version of the TSY. |
|
2456 * |
|
2457 * @param aTsyReqHandle Tsy Request handle for the client request |
|
2458 * @param aVolume pointer to the volume of data trasferred so far. |
|
2459 * @param aData indicates to the client whether the data was sent or received. |
|
2460 * @return KErrNone |
|
2461 */ |
|
2462 { |
|
2463 ReqCompleted(aTsyReqHandle,KErrNotSupported); |
|
2464 return KErrNone; |
|
2465 } |
|
2466 |
|
2467 TInt CSimPacketContext::NotifyDataTransferredCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
2468 /** |
|
2469 * Cancels the NotifyDataTransferred request |
|
2470 * |
|
2471 * @param aTsyReqHandle Tsy Request handle for the client cancel request |
|
2472 * @return KerrNone |
|
2473 */ |
|
2474 { |
|
2475 LOGPACKET1("CSimPacketContext::NotifyDataTransferredCancel called"); |
|
2476 return KErrNone; |
|
2477 } |
|
2478 |
|
2479 TInt CSimPacketContext::GetLastErrorCause(const TTsyReqHandle aTsyReqHandle,TInt* /*aError*/) |
|
2480 /** |
|
2481 * This method is not supported in this TSY |
|
2482 * |
|
2483 * @param aTsyReqHandle Tsy Request handle for the client request |
|
2484 * @param aError pointer to the last error cause |
|
2485 * @return KerrNone |
|
2486 */ |
|
2487 { |
|
2488 LOGPACKET1("CSimPacketContext::GetLastErrorCause called"); |
|
2489 ReqCompleted(aTsyReqHandle,KErrNotSupported); |
|
2490 return KErrNone; |
|
2491 } |
|
2492 |
|
2493 void CSimPacketContext::TimerCallBack(TInt aId) |
|
2494 /** |
|
2495 * Timer callback function. When the timer goes off, it will call back into this |
|
2496 * function for further processing. |
|
2497 */ |
|
2498 { |
|
2499 TInt newIndex = KErrNotFound; |
|
2500 |
|
2501 switch(aId) |
|
2502 { |
|
2503 case ETimerIdPcktContextStatusChange: |
|
2504 TimerCallBackNotifyContextStatusChange(); |
|
2505 break; |
|
2506 case ETimerIdPcktContextSetConfig: |
|
2507 SetConfig(iSetConfigData->At(0).iTsyReqHandle, iSetConfigData->At(0).iData); |
|
2508 iSetConfigData->Delete(0); |
|
2509 if (iSetConfigData->Count() != 0) |
|
2510 iSetConfigTimer->Start(iSetConfigDelay,this,ETimerIdPcktContextSetConfig); |
|
2511 break; |
|
2512 case ETimerIdPcktContextConfigChange: |
|
2513 //Check the validity of the new context config param index before applying it |
|
2514 newIndex = (iNotifyContextConfigChangeArray->At(0)).iNewContextConfigIndex; |
|
2515 if(newIndex <= iContextConfigParams->Count() - 1) |
|
2516 { |
|
2517 //Change the context config param index to point to the new context configuration |
|
2518 iContextConfigParamsIndex = newIndex; |
|
2519 |
|
2520 // Check for and complete any pending notifications |
|
2521 if(iNotifyConfigGPRS.iNotifyPending) |
|
2522 { |
|
2523 iNotifyConfigGPRS.iNotifyPending=EFalse; |
|
2524 CSimContextHelper::ConvertConfigParams(iContextConfigParams->At(iContextConfigParamsIndex), |
|
2525 *(RPacketContext::TContextConfigGPRS*)iNotifyConfigGPRS.iNotifyData); |
|
2526 ReqCompleted(iNotifyConfigGPRS.iNotifyHandle,KErrNone); |
|
2527 } |
|
2528 |
|
2529 if(iNotifyConfigR99.iNotifyPending) |
|
2530 { |
|
2531 iNotifyConfigR99.iNotifyPending=EFalse; |
|
2532 CSimContextHelper::ConvertConfigParams(iContextConfigParams->At(iContextConfigParamsIndex), |
|
2533 *(RPacketContext::TContextConfigR99_R4*)iNotifyConfigR99.iNotifyData); |
|
2534 ReqCompleted(iNotifyConfigR99.iNotifyHandle,KErrNone); |
|
2535 } |
|
2536 |
|
2537 if(iNotifyConfigR5.iNotifyPending) |
|
2538 { |
|
2539 iNotifyConfigR5.iNotifyPending=EFalse; |
|
2540 CSimContextHelper::ConvertConfigParams(iContextConfigParams->At(iContextConfigParamsIndex), |
|
2541 *(RPacketContext::TContextConfig_R5*)iNotifyConfigR5.iNotifyData); |
|
2542 ReqCompleted(iNotifyConfigR5.iNotifyHandle,KErrNone); |
|
2543 } |
|
2544 } |
|
2545 |
|
2546 else |
|
2547 { |
|
2548 LOGMISC1(">>CSimPacketContext.cpp: Invalid new context config param index"); |
|
2549 } |
|
2550 |
|
2551 //Delete the current NotifyContextConfigChange item and set the next one if possible |
|
2552 iNotifyContextConfigChangeArray->Delete(0); |
|
2553 |
|
2554 if(iNotifyContextConfigChangeArray->Count() > 0) |
|
2555 { |
|
2556 TInt delay = (iNotifyContextConfigChangeArray->At(0)).iDelay; |
|
2557 iNotifyContextConfigChangeTimer->Start(delay,this, ETimerIdPcktContextConfigChange); |
|
2558 } |
|
2559 break; |
|
2560 |
|
2561 case ETimerIdPcktContextInitContext: |
|
2562 DoInitialiseContext(); |
|
2563 break; |
|
2564 case ETimerIdPcktContextCreateTft: |
|
2565 DoCreateNewTFT(); |
|
2566 break; |
|
2567 default: |
|
2568 { |
|
2569 LOGPACKET1(">>CSimPacketContext::TimerCallBack"); |
|
2570 TInt ret=ActionEvent(EContextEventTimeOut,KErrNone); |
|
2571 __ASSERT_ALWAYS(ret==KErrNone,SimPanic(ETimeOutEventActionFailed)); // Note: this is very crude error handling and should be replaced by something rather more elegant. |
|
2572 LOGPACKET1("<<CSimPacketContext::TimerCallBack"); |
|
2573 iTFTChangeBool = EFalse; |
|
2574 break; |
|
2575 } |
|
2576 } |
|
2577 } |
|
2578 |
|
2579 void CSimPacketContext::PubSubCallback(TInt aIndex) |
|
2580 { |
|
2581 TInt length = iNotifyContextStatusChangeArray->Count(); |
|
2582 if (aIndex < length) |
|
2583 { |
|
2584 TNotifyContextStatusChange& statusChange = iNotifyContextStatusChangeArray->At(aIndex); |
|
2585 if (statusChange.iContextName.Compare(iContextName) == 0) |
|
2586 { |
|
2587 CompleteContextStatusChange(statusChange.iStatus); |
|
2588 } |
|
2589 } |
|
2590 } |
|
2591 |
|
2592 /** |
|
2593 * This is for the NotifyContextStatusChange timer callback |
|
2594 */ |
|
2595 void CSimPacketContext::TimerCallBackNotifyContextStatusChange() |
|
2596 { |
|
2597 if(GetContextStatusChangeCount() <= iNotifyContextStatusChangeIndex) |
|
2598 { |
|
2599 // the index is out of bounds |
|
2600 return; |
|
2601 } |
|
2602 TNotifyContextStatusChange& statusChange = GetContextStatusChangeAt(iNotifyContextStatusChangeIndex); |
|
2603 |
|
2604 CompleteContextStatusChange(statusChange.iStatus); |
|
2605 |
|
2606 iNotifyContextStatusChangeIndex++; |
|
2607 if (GetContextStatusChangeCount() > iNotifyContextStatusChangeIndex) |
|
2608 { |
|
2609 // start timer again |
|
2610 iNotifyContextStatusChangeTimer->Start(GetContextStatusChangeAt(iNotifyContextStatusChangeIndex).iDuration,this,ETimerIdPcktContextStatusChange); |
|
2611 } |
|
2612 } |
|
2613 |
|
2614 void CSimPacketContext::CompleteContextStatusChange(RPacketContext::TContextStatus& aStatus) |
|
2615 { |
|
2616 iCurrentNotifyContextStatusChange = aStatus; |
|
2617 |
|
2618 ChangeState(iCurrentNotifyContextStatusChange); |
|
2619 if (RPacketContext::EStatusDeleted == iCurrentNotifyContextStatusChange) |
|
2620 { |
|
2621 DoDelete(); |
|
2622 } |
|
2623 } |
|
2624 |
|
2625 void CSimPacketContext::NTRasCallBack(TInt aStatus) |
|
2626 /** |
|
2627 * NTRas callback function. This function will be called when the NTRAS |
|
2628 * Server has responded. |
|
2629 * |
|
2630 * @param aStatus Standard error value, indicating the success or failure of the NTRAS |
|
2631 * connection. |
|
2632 */ |
|
2633 { |
|
2634 __ASSERT_ALWAYS(ActionEvent(EContextEventNtRas,aStatus) == KErrNone,SimPanic(EGeneral)); |
|
2635 if(iCommReset) |
|
2636 iNtRas->Terminate(); |
|
2637 } |
|
2638 |
|
2639 RPacketService::TStatus CSimPacketContext::ConvertToPacketServiceStatus(RPacketContext::TContextStatus aNewState) |
|
2640 /** |
|
2641 * Converts Packet Context Status (RPacketContext::TContextStatus) to |
|
2642 * Packet Service Status (RPacketService::TStatus) |
|
2643 * |
|
2644 * @param aNewState the Context status to convert to packet service status |
|
2645 * @return RPacketService::TStatus The packet service status conversion |
|
2646 */ |
|
2647 { |
|
2648 RPacketService::TStatus serviceStatus; |
|
2649 switch (aNewState) |
|
2650 { |
|
2651 case RPacketContext::EStatusInactive: |
|
2652 case RPacketContext::EStatusActivating: |
|
2653 case RPacketContext::EStatusDeleted: |
|
2654 serviceStatus = RPacketService::EStatusAttached; |
|
2655 break; |
|
2656 case RPacketContext::EStatusActive: |
|
2657 case RPacketContext::EStatusDeactivating: |
|
2658 serviceStatus = RPacketService::EStatusActive; |
|
2659 break; |
|
2660 case RPacketContext::EStatusSuspended: |
|
2661 serviceStatus = RPacketService::EStatusSuspended; |
|
2662 break; |
|
2663 default: |
|
2664 serviceStatus = RPacketService::EStatusUnattached; |
|
2665 break; |
|
2666 } |
|
2667 return serviceStatus; |
|
2668 } |
|
2669 |
|
2670 |
|
2671 TInt CSimPacketContext::ChangeState(RPacketContext::TContextStatus aNewState) |
|
2672 /** |
|
2673 * Attempt to change state. |
|
2674 * First validate that the requested state change is ok. If it is then proceed to change |
|
2675 * the state and complete any pending state change notification. |
|
2676 * |
|
2677 * @param aNewState the new state to change to |
|
2678 * @return Error indication if change of state is successful or not |
|
2679 */ |
|
2680 { |
|
2681 LOGPACKET2(">>CSimPacketContext::ChangeState [newState=%d]", aNewState); |
|
2682 __ASSERT_ALWAYS(aNewState!=RPacketContext::EStatusUnknown,SimPanic(ECallStatusUnknownIllegal)); |
|
2683 |
|
2684 if(iState==aNewState) |
|
2685 return KErrNone; |
|
2686 |
|
2687 TInt ret=KErrGeneral; |
|
2688 const struct TContextStateChangeValidity* stateChangePnt=KContextStateChangeValidity; |
|
2689 while(stateChangePnt->iOldState!=KContextStateTableTerminator) |
|
2690 { |
|
2691 if((stateChangePnt->iOldState==iState) && (stateChangePnt->iNewState==aNewState)) |
|
2692 { |
|
2693 ret=stateChangePnt->iError; |
|
2694 break; |
|
2695 } |
|
2696 stateChangePnt++; |
|
2697 } |
|
2698 |
|
2699 if(ret!=KErrNone) |
|
2700 return ret; |
|
2701 |
|
2702 //Request permission from the phone to change the state of the packet connection |
|
2703 ret = iPacketService->ChangeState(ConvertToPacketServiceStatus(aNewState)); |
|
2704 if(ret!=KErrNone) |
|
2705 return ret; |
|
2706 |
|
2707 // Actually change the state. |
|
2708 iState=aNewState; |
|
2709 |
|
2710 // Check for a pending line state notification. |
|
2711 if(iNotifyStatusChange.iNotifyPending) |
|
2712 { |
|
2713 iNotifyStatusChange.iNotifyPending=EFalse; |
|
2714 *(RPacketContext::TContextStatus*)iNotifyStatusChange.iNotifyData=iState; |
|
2715 ReqCompleted(iNotifyStatusChange.iNotifyHandle,KErrNone); |
|
2716 } |
|
2717 |
|
2718 |
|
2719 LOGPACKET1("<<CSimPacketContext::ChangeState"); |
|
2720 return KErrNone; |
|
2721 } |
|
2722 |
|
2723 TInt CSimPacketContext::ActionEvent(TContextEvent aEvent,TInt aStatus) |
|
2724 /** |
|
2725 * Entry point when an event has occured that may advance the state machine. |
|
2726 * The aEvent parameter describes the event. |
|
2727 * |
|
2728 * This function contains the main state machine for the packet Context. |
|
2729 * |
|
2730 * @param aEvent The Packet Context event to handle |
|
2731 * @return value represents the error state caused by the attempted state machine jump. |
|
2732 */ |
|
2733 { |
|
2734 TInt ret=KErrNone; |
|
2735 __ASSERT_ALWAYS(iState!=RPacketContext::EStatusUnknown,SimPanic(ECallStatusUnknownIllegal)); |
|
2736 |
|
2737 TBool found = EFalse; |
|
2738 TInt i = 0; |
|
2739 TInt count = iContextConfigsRel99->Count(); |
|
2740 for(i = 0; i<count; i++) |
|
2741 { |
|
2742 if(iContextName.Compare(iContextConfigsRel99->At(i).iContextName)==0) |
|
2743 { |
|
2744 found = ETrue; |
|
2745 break; |
|
2746 } |
|
2747 } |
|
2748 |
|
2749 switch(aEvent) |
|
2750 { |
|
2751 case EContextEventActivate: |
|
2752 LOGPACKET1(">>CSimPacketContext::ActionEvent = [EContextEventActivate]"); |
|
2753 if(iState==RPacketContext::EStatusInactive) |
|
2754 { |
|
2755 iCurrentEvent=EContextEventActivate; |
|
2756 ret = ChangeState(RPacketContext::EStatusActivating); |
|
2757 if(ret!=KErrNone) |
|
2758 ReqCompleted(iActivateRequestHandle,ret); |
|
2759 else |
|
2760 { |
|
2761 if(!found) |
|
2762 iTimer->Start(iActivatePause,this); |
|
2763 else |
|
2764 iTimer->Start(iContextConfigsRel99->At(i).iActivatePause,this); |
|
2765 } |
|
2766 } |
|
2767 else |
|
2768 ReqCompleted(iActivateRequestHandle, KErrGprsActivationRejected); |
|
2769 break; |
|
2770 |
|
2771 case EContextEventDeactivate: |
|
2772 LOGPACKET1(">>CSimPacketContext::ActionEvent = [EContextEventDeactivate]"); |
|
2773 if(iState==RPacketContext::EStatusActive) |
|
2774 { |
|
2775 iCurrentEvent=EContextEventDeactivate; |
|
2776 ret = ChangeState(RPacketContext::EStatusDeactivating); |
|
2777 if(ret!=KErrNone) |
|
2778 ReqCompleted(iDeactivateRequestHandle,ret); |
|
2779 else |
|
2780 { |
|
2781 if (!found) |
|
2782 iTimer->Start(iDeactivatePause,this); |
|
2783 else |
|
2784 iTimer->Start(iContextConfigsRel99->At(i).iDeactivatePause,this); |
|
2785 } |
|
2786 } |
|
2787 else |
|
2788 ReqCompleted(iDeactivateRequestHandle, KErrNone); |
|
2789 break; |
|
2790 |
|
2791 case EContextEventDelete: |
|
2792 LOGPACKET1(">>CSimPacketContext::ActionEvent = [EContextEventDelete]"); |
|
2793 if(iState==RPacketContext::EStatusInactive) |
|
2794 { |
|
2795 iCurrentEvent=EContextEventDelete; |
|
2796 |
|
2797 if (!found) |
|
2798 iTimer->Start(iDeletePause,this); |
|
2799 else |
|
2800 iTimer->Start(iContextConfigsRel99->At(i).iDeletionPause,this); |
|
2801 } |
|
2802 else |
|
2803 ReqCompleted(iDeleteRequestHandle, KErrInUse); |
|
2804 break; |
|
2805 |
|
2806 case EContextEventNtRas: |
|
2807 if((iState==RPacketContext::EStatusActivating) && (iCurrentEvent==EContextEventNtRas)) |
|
2808 { |
|
2809 if(aStatus!=KErrNone) |
|
2810 { |
|
2811 ReqCompleted(iActivateRequestHandle,aStatus); |
|
2812 ret=ChangeState(RPacketContext::EStatusInactive); |
|
2813 __ASSERT_ALWAYS(ret==KErrNone,SimPanic(EIllegalStateInconsistancy)); |
|
2814 return KErrNone; |
|
2815 } |
|
2816 else |
|
2817 { |
|
2818 ret=ChangeState(RPacketContext::EStatusActive); |
|
2819 ReqCompleted(iActivateRequestHandle,ret); |
|
2820 iIsActive = ETrue; |
|
2821 return KErrNone; |
|
2822 } |
|
2823 } |
|
2824 iCurrentEvent=EContextEventNone; |
|
2825 break; |
|
2826 |
|
2827 case EContextEventTimeOut: |
|
2828 LOGPACKET1(">>CSimPacketContext::ActionEvent = [EContextEventTimeOut]"); |
|
2829 switch(iCurrentEvent) |
|
2830 { |
|
2831 case EContextEventNone: |
|
2832 break; |
|
2833 case EContextEventActivate: |
|
2834 if(iState==RPacketContext::EStatusActivating) |
|
2835 { |
|
2836 TInt activateValue; |
|
2837 if (found) |
|
2838 activateValue = iContextConfigsRel99->At(i).iActivateErrorCode; |
|
2839 else |
|
2840 activateValue = iActivateFail; |
|
2841 |
|
2842 if(activateValue != KErrNone) |
|
2843 { |
|
2844 ReqCompleted(iActivateRequestHandle,activateValue); |
|
2845 ret=ChangeState(RPacketContext::EStatusInactive); |
|
2846 iCurrentEvent=EContextEventNone; |
|
2847 activateValue = KErrNone; |
|
2848 |
|
2849 if (found) |
|
2850 iContextConfigsRel99->At(i).iActivateErrorCode = activateValue; |
|
2851 else |
|
2852 iActivateFail = activateValue; |
|
2853 break; |
|
2854 } |
|
2855 else |
|
2856 { |
|
2857 if (found) |
|
2858 { |
|
2859 if (iContextConfigsRel99->At(i).iConnectToNtRas) |
|
2860 { |
|
2861 ret = DoActivate(); |
|
2862 if (ret == KErrNone) |
|
2863 iCurrentEvent=EContextEventNtRas; |
|
2864 else |
|
2865 iCurrentEvent=EContextEventNone; |
|
2866 } |
|
2867 else |
|
2868 { |
|
2869 iCurrentEvent=EContextEventNone; |
|
2870 ReqCompleted(iActivateRequestHandle,activateValue); |
|
2871 ret=ChangeState(RPacketContext::EStatusActive); |
|
2872 iIsActive = ETrue; |
|
2873 } |
|
2874 } |
|
2875 else |
|
2876 { |
|
2877 ret = DoActivate(); |
|
2878 if (ret == KErrNone) |
|
2879 iCurrentEvent=EContextEventNtRas; |
|
2880 else |
|
2881 iCurrentEvent=EContextEventNone; |
|
2882 } |
|
2883 } |
|
2884 } |
|
2885 break; |
|
2886 case EContextEventDeactivate: |
|
2887 TInt deActivateValue; |
|
2888 if (found) |
|
2889 deActivateValue = iContextConfigsRel99->At(i).iDeactivateErrorCode; |
|
2890 else |
|
2891 deActivateValue = iDeactivateFail; |
|
2892 |
|
2893 if(iState==RPacketContext::EStatusDeactivating) |
|
2894 { |
|
2895 if(deActivateValue != KErrNone) |
|
2896 { |
|
2897 ReqCompleted(iDeactivateRequestHandle,deActivateValue); |
|
2898 ret=ChangeState(RPacketContext::EStatusActive); |
|
2899 deActivateValue = KErrNone; |
|
2900 |
|
2901 if (found) |
|
2902 iContextConfigsRel99->At(i).iDeactivateErrorCode = deActivateValue; |
|
2903 else |
|
2904 iDeactivateFail = deActivateValue; |
|
2905 break; |
|
2906 } |
|
2907 else { |
|
2908 ret=ChangeState(RPacketContext::EStatusInactive); |
|
2909 if(ret==KErrNone) |
|
2910 { |
|
2911 ret = DoDeactivate(); |
|
2912 if(ret==KErrNone) |
|
2913 { |
|
2914 ReqCompleted(iDeactivateRequestHandle,deActivateValue); |
|
2915 iIsActive=EFalse; |
|
2916 } |
|
2917 else |
|
2918 ReqCompleted(iDeactivateRequestHandle,ret); |
|
2919 } |
|
2920 else |
|
2921 ReqCompleted(iDeactivateRequestHandle,ret); |
|
2922 } |
|
2923 } |
|
2924 iCurrentEvent=EContextEventNone; |
|
2925 break; |
|
2926 case EContextEventDelete: |
|
2927 TInt deleteValue; |
|
2928 if (found) |
|
2929 deleteValue = iContextConfigsRel99->At(i).iDeletionErrorCode; |
|
2930 else |
|
2931 deleteValue = iDeleteFail; |
|
2932 |
|
2933 if(iState==RPacketContext::EStatusInactive) |
|
2934 { |
|
2935 if(deleteValue != KErrNone) |
|
2936 { |
|
2937 ReqCompleted(iDeleteRequestHandle,deleteValue); |
|
2938 deleteValue = KErrNone; |
|
2939 if (found) |
|
2940 iContextConfigsRel99->At(i).iDeletionErrorCode = deleteValue; |
|
2941 else |
|
2942 iDeleteFail = deleteValue; |
|
2943 break; |
|
2944 } |
|
2945 else { |
|
2946 ret=ChangeState(RPacketContext::EStatusDeleted); |
|
2947 if(ret==KErrNone) |
|
2948 { |
|
2949 ret = DoDelete(); |
|
2950 if(ret==KErrNone) |
|
2951 ReqCompleted(iDeleteRequestHandle,deleteValue); |
|
2952 else |
|
2953 ReqCompleted(iDeleteRequestHandle,ret); |
|
2954 } |
|
2955 else |
|
2956 ReqCompleted(iDeleteRequestHandle,ret); |
|
2957 } |
|
2958 } |
|
2959 iCurrentEvent=EContextEventNone; |
|
2960 break; |
|
2961 default: //in case of EContextEventTimeOut |
|
2962 break; |
|
2963 } |
|
2964 break; |
|
2965 |
|
2966 default: |
|
2967 break; |
|
2968 } |
|
2969 return ret; |
|
2970 } |
|
2971 |
|
2972 const CTestConfigSection* CSimPacketContext::CfgFile() |
|
2973 /** |
|
2974 * Return a pointer to the Configuration File Section |
|
2975 * |
|
2976 * @return CTestConfigSection pointer to the configuration file section |
|
2977 */ |
|
2978 { |
|
2979 return iPacketService->CfgFile(); |
|
2980 } |
|
2981 |
|
2982 TInt CSimPacketContext::ModifyActiveContext(const TTsyReqHandle aTsyReqHandle) |
|
2983 { |
|
2984 if (iState==RPacketContext::EStatusInactive) |
|
2985 { |
|
2986 ReqCompleted(aTsyReqHandle, KErrNotReady); |
|
2987 return KErrNone; |
|
2988 } |
|
2989 |
|
2990 // check if QoS profile has changed or TFTs have changed |
|
2991 if (iPacketqos != NULL) |
|
2992 { |
|
2993 if (iPacketqos->PerformProfileChange() == KErrNone || iTFTChangeBool) |
|
2994 { |
|
2995 iTFTChangeBool = EFalse; |
|
2996 ReqCompleted(aTsyReqHandle, KErrNone); |
|
2997 return KErrNone; |
|
2998 } |
|
2999 else |
|
3000 { |
|
3001 ReqCompleted(aTsyReqHandle, KErrNotReady); |
|
3002 return KErrNone; |
|
3003 } |
|
3004 } |
|
3005 else if (iTFTChangeBool) |
|
3006 { |
|
3007 iTFTChangeBool = EFalse; |
|
3008 ReqCompleted(aTsyReqHandle, KErrNone); |
|
3009 return KErrNone; |
|
3010 } |
|
3011 else |
|
3012 { |
|
3013 ReqCompleted(aTsyReqHandle, KErrNotReady); |
|
3014 return KErrNone; |
|
3015 } |
|
3016 } |
|
3017 |
|
3018 /** |
|
3019 * This function enumerates the number of packet filters |
|
3020 */ |
|
3021 TInt CSimPacketContext::EnumeratePacketFilters(const TTsyReqHandle aTsyReqHandle, TInt& aCount) |
|
3022 { |
|
3023 aCount = iNumFiltersAdded; |
|
3024 ReqCompleted(aTsyReqHandle, KErrNone); |
|
3025 return KErrNone; |
|
3026 } |
|
3027 |
|
3028 /** |
|
3029 * This function returns info regarding the packet filter specified by the index passed - |
|
3030 * used in conjunction with EnumeratePacketFilters() |
|
3031 */ |
|
3032 TInt CSimPacketContext::GetPacketFilterInfoL(const TTsyReqHandle aTsyReqHandle, TInt aIndex, TDes8* aPacketFilterInfo) |
|
3033 { |
|
3034 // if index is invalid, return error code |
|
3035 if (aIndex < 0 || aIndex > (iNumFiltersAdded -1)) |
|
3036 { |
|
3037 ReqCompleted(aTsyReqHandle, KErrArgument); |
|
3038 return KErrNone; |
|
3039 } |
|
3040 else |
|
3041 { |
|
3042 TInt ii; |
|
3043 TInt addedFilterCount = -1; |
|
3044 |
|
3045 //find the requested filter |
|
3046 for(ii = 0; ii < iPacketFilterInfoArray->Count(); ii++) |
|
3047 { |
|
3048 if(iPacketFilterInfoArray->At(ii).iAdded) |
|
3049 { |
|
3050 addedFilterCount++; |
|
3051 |
|
3052 //when the filter is found write the data to the client |
|
3053 if(addedFilterCount == aIndex) |
|
3054 { |
|
3055 TPacketFilterV3 theFilter = iPacketFilterInfoArray->At(ii); |
|
3056 |
|
3057 // Check that the data structure is supported by the simulated TSY version |
|
3058 TInt err = KErrNone; |
|
3059 if(iPhone->iSimTsyVersion < 3) // same version as TPacketFilterVx |
|
3060 { |
|
3061 (void)User::Leave(KErrNotSupported); |
|
3062 } |
|
3063 |
|
3064 RPacketContext::TPacketFilterV2Pckg* clientFilterPckg = |
|
3065 (RPacketContext::TPacketFilterV2Pckg*)aPacketFilterInfo; |
|
3066 RPacketContext::TPacketFilterV2& clientFilter = (*clientFilterPckg)(); |
|
3067 |
|
3068 // Check that the data structure is supported by the simulated TSY version |
|
3069 err = iPhone->CheckSimTsyVersion(clientFilter); |
|
3070 if(err != KErrNone) |
|
3071 { |
|
3072 iPhone->ReqCompleted(aTsyReqHandle, err); |
|
3073 return KErrNone; |
|
3074 } |
|
3075 |
|
3076 if(clientFilter.ExtensionId()==KETelExtPcktV2) |
|
3077 { |
|
3078 clientFilter.iDestPortMax = theFilter.iDestPortMax; |
|
3079 clientFilter.iDestPortMin = theFilter.iDestPortMin; |
|
3080 clientFilter.iEvaluationPrecedenceIndex = theFilter.iEvaluationPrecedenceIndex; |
|
3081 clientFilter.iFlowLabel = theFilter.iFlowLabel; |
|
3082 clientFilter.iId = theFilter.iId; |
|
3083 clientFilter.iIPSecSPI = theFilter.iIPSecSPI; |
|
3084 clientFilter.iProtocolNumberOrNextHeader = theFilter.iProtocolNumberOrNextHeader; |
|
3085 clientFilter.iSrcPortMax = theFilter.iSrcPortMax; |
|
3086 clientFilter.iSrcPortMin = theFilter.iSrcPortMin; |
|
3087 clientFilter.iTOSorTrafficClass = theFilter.iTOSorTrafficClass; |
|
3088 |
|
3089 TInt xx; |
|
3090 for(xx = 0; xx<RPacketContext::KIPAddressSize; xx++) |
|
3091 { |
|
3092 clientFilter.iSrcAddr[xx] = theFilter.iSrcAddr[xx]; |
|
3093 clientFilter.iSrcAddrSubnetMask[xx] = theFilter.iSrcAddrSubnetMask[xx]; |
|
3094 } |
|
3095 ReqCompleted(aTsyReqHandle, KErrNone); |
|
3096 return KErrNone; |
|
3097 } |
|
3098 else if((clientFilter.ExtensionId()==KETelExtPcktV3) && |
|
3099 theFilter.iFilterType != RPacketContext::EPacketFilterTypeUnknown) |
|
3100 { |
|
3101 RPacketContext::TPacketFilterV3Pckg* clientFilterV3Pckg = |
|
3102 (RPacketContext::TPacketFilterV3Pckg*)aPacketFilterInfo; |
|
3103 RPacketContext::TPacketFilterV3& clientFilterV3 = (*clientFilterV3Pckg)(); |
|
3104 |
|
3105 // Check that the data structure is supported by the simulated TSY version |
|
3106 TInt err = iPhone->CheckSimTsyVersion(clientFilterV3); |
|
3107 if(err != KErrNone) |
|
3108 { |
|
3109 iPhone->ReqCompleted(aTsyReqHandle, err); |
|
3110 return KErrNone; |
|
3111 } |
|
3112 |
|
3113 RPacketContext::TPacketFilterV3 filterV3(theFilter.iFilterType); |
|
3114 |
|
3115 // Check that the data structure is supported by the simulated TSY version |
|
3116 err = iPhone->CheckSimTsyVersion(filterV3); |
|
3117 if(err != KErrNone) |
|
3118 { |
|
3119 iPhone->ReqCompleted(aTsyReqHandle, err); |
|
3120 return KErrNone; |
|
3121 } |
|
3122 |
|
3123 filterV3.iId = theFilter.iId; |
|
3124 filterV3.iEvaluationPrecedenceIndex = theFilter.iEvaluationPrecedenceIndex; |
|
3125 filterV3.SetTOSorTrafficClass(theFilter.iTOSorTrafficClass); |
|
3126 |
|
3127 TInt yy; |
|
3128 for(yy = 0; yy<RPacketContext::KIPAddressSize; yy++) |
|
3129 { |
|
3130 filterV3.SetSrcAddr(theFilter.iSrcAddr); |
|
3131 filterV3.SetSrcAddrSubnetMask(theFilter.iSrcAddrSubnetMask); |
|
3132 } |
|
3133 if((theFilter.iFilterType == RPacketContext::EPacketFilterTypeOne) || |
|
3134 (theFilter.iFilterType == RPacketContext::EPacketFilterTypeTwo)) |
|
3135 { |
|
3136 filterV3.SetProtocolNumberOrNextHeader(theFilter.iProtocolNumberOrNextHeader); |
|
3137 } |
|
3138 |
|
3139 if(theFilter.iFilterType == RPacketContext::EPacketFilterTypeOne) |
|
3140 { |
|
3141 filterV3.SetDestPortMin(theFilter.iDestPortMin); |
|
3142 filterV3.SetDestPortMax(theFilter.iDestPortMax); |
|
3143 filterV3.SetSrcPortMin(theFilter.iSrcPortMin); |
|
3144 filterV3.SetSrcPortMax(theFilter.iSrcPortMax); |
|
3145 } |
|
3146 |
|
3147 if((theFilter.iFilterType == RPacketContext::EPacketFilterTypeTwo)) |
|
3148 { |
|
3149 filterV3.SetSPI(theFilter.iIPSecSPI); |
|
3150 } |
|
3151 |
|
3152 if((theFilter.iFilterType == RPacketContext::EPacketFilterTypeThree)) |
|
3153 { |
|
3154 filterV3.SetFlowLabel(theFilter.iFlowLabel); |
|
3155 } |
|
3156 |
|
3157 clientFilterV3 = filterV3; |
|
3158 ReqCompleted(aTsyReqHandle, KErrNone); |
|
3159 return KErrNone; |
|
3160 } |
|
3161 else |
|
3162 { |
|
3163 //cannot convert a filterV2 in the TSY to the filterV3 data typed passed in by client |
|
3164 ReqCompleted(aTsyReqHandle, KErrCorrupt); |
|
3165 return KErrNone; |
|
3166 } |
|
3167 }//end if(addedFilterCount == aIndex) |
|
3168 }//end if(iPacketFilterInfoArray->At(ii).iAdded) |
|
3169 else |
|
3170 { |
|
3171 continue; |
|
3172 } |
|
3173 |
|
3174 }//end for loop |
|
3175 //filter was not found |
|
3176 ReqCompleted(aTsyReqHandle, KErrCorrupt); |
|
3177 return KErrNone; |
|
3178 }//end else |
|
3179 } |
|
3180 |
|
3181 /** |
|
3182 * Create TFT |
|
3183 */ |
|
3184 TInt CSimPacketContext::CreateNewTFT(const TTsyReqHandle aTsyReqHandle, const TInt* aSize) |
|
3185 { |
|
3186 if (iCreateTftConfig.iNumberOfFailures > 0) |
|
3187 { |
|
3188 iCreateTftConfig.iNumberOfFailures--; |
|
3189 ReqCompleted(aTsyReqHandle, iCreateTftConfig.iFailErrorCode); |
|
3190 return KErrNone; |
|
3191 } |
|
3192 iCreateTftTimer->Start(iCreateTftConfig.iDelay, this, ETimerIdPcktContextCreateTft); |
|
3193 iCreateTftData.iTsyReqHandle = aTsyReqHandle; |
|
3194 iCreateTftData.iSize = *aSize; |
|
3195 return KErrNone; |
|
3196 } |
|
3197 |
|
3198 TInt CSimPacketContext::DoCreateNewTFT() |
|
3199 { |
|
3200 iTFTCreated = ETrue; |
|
3201 iNumTFTsCreated = iCreateTftData.iSize; |
|
3202 iTFTChangeBool = ETrue; |
|
3203 for (TInt i = 0; i < iPacketFilterInfoArray->Count(); i++) |
|
3204 { |
|
3205 iPacketFilterInfoArray->At(i).iAdded = EFalse; |
|
3206 } |
|
3207 iNumFiltersAdded = 0; |
|
3208 ReqCompleted(iCreateTftData.iTsyReqHandle, KErrNone); |
|
3209 return KErrNone; |
|
3210 } |
|
3211 |
|
3212 /** |
|
3213 * Delete TFT |
|
3214 */ |
|
3215 TInt CSimPacketContext::DeleteTFT(const TTsyReqHandle aTsyReqHandle) |
|
3216 { |
|
3217 if (iDeleteTftFail.iNumberOfTimes > 0) |
|
3218 { |
|
3219 iDeleteTftFail.iNumberOfTimes--; |
|
3220 ReqCompleted(aTsyReqHandle, iDeleteTftFail.iFailErrorCode); |
|
3221 return KErrNone; |
|
3222 } |
|
3223 iTFTCreated = EFalse; |
|
3224 iNumTFTsCreated = -1; |
|
3225 iTFTChangeBool = ETrue; |
|
3226 for (TInt i = 0; i < iPacketFilterInfoArray->Count(); i++) |
|
3227 { |
|
3228 iPacketFilterInfoArray->At(i).iAdded = EFalse; |
|
3229 } |
|
3230 iNumFiltersAdded = 0; |
|
3231 ReqCompleted(aTsyReqHandle, KErrNone); |
|
3232 return KErrNone; |
|
3233 } |
|
3234 |
|
3235 /** |
|
3236 * This method adds the packet filter to the array if it is not already there |
|
3237 */ |
|
3238 TInt CSimPacketContext::AddPacketFilter(const TTsyReqHandle aTsyReqHandle, const TDesC8* aPacketFilterInfo) |
|
3239 { |
|
3240 if (iAddPacketFilter.iNumberOfTimes > 0) |
|
3241 { |
|
3242 iAddPacketFilter.iNumberOfTimes--; |
|
3243 ReqCompleted(aTsyReqHandle, iAddPacketFilter.iFailErrorCode); |
|
3244 return KErrNone; |
|
3245 } |
|
3246 |
|
3247 TPckg<RPacketContext::TPacketFilterV2>* packetFilter = (TPckg<RPacketContext::TPacketFilterV2>*)aPacketFilterInfo; |
|
3248 RPacketContext::TPacketFilterV2& packetFilterBase = (*packetFilter)(); |
|
3249 |
|
3250 // Check that the data structure is supported by the simulated TSY version |
|
3251 TInt err = iPhone->CheckSimTsyVersion(packetFilterBase); |
|
3252 if(err != KErrNone) |
|
3253 { |
|
3254 iPhone->ReqCompleted(aTsyReqHandle, err); |
|
3255 return KErrNone; |
|
3256 } |
|
3257 |
|
3258 TBool found = EFalse; |
|
3259 |
|
3260 TInt ii; |
|
3261 for(ii = 0; ii<iPacketFilterInfoArray->Count(); ii++) |
|
3262 { |
|
3263 TPacketFilterV3& configFilter = iPacketFilterInfoArray->At(ii); |
|
3264 const TInt KReservedPortZero = 0; |
|
3265 |
|
3266 if((configFilter.iId == packetFilterBase.iId) && |
|
3267 (configFilter.iEvaluationPrecedenceIndex == packetFilterBase.iEvaluationPrecedenceIndex) && |
|
3268 (configFilter.iProtocolNumberOrNextHeader == packetFilterBase.iProtocolNumberOrNextHeader) && |
|
3269 (configFilter.iSrcPortMin == packetFilterBase.iSrcPortMin) && |
|
3270 (configFilter.iSrcPortMax == packetFilterBase.iSrcPortMax) && |
|
3271 ((configFilter.iDestPortMin == KReservedPortZero) || (configFilter.iDestPortMin == packetFilterBase.iDestPortMin)) && |
|
3272 ((configFilter.iDestPortMax == KReservedPortZero) || (configFilter.iDestPortMax == packetFilterBase.iDestPortMax)) && |
|
3273 (configFilter.iIPSecSPI == packetFilterBase.iIPSecSPI) && |
|
3274 (configFilter.iTOSorTrafficClass == packetFilterBase.iTOSorTrafficClass) && |
|
3275 (configFilter.iFlowLabel == packetFilterBase.iFlowLabel)) |
|
3276 { |
|
3277 TInt xx; |
|
3278 for(xx = 0; xx<RPacketContext::KIPAddressSize; xx++) |
|
3279 { |
|
3280 if((configFilter.iSrcAddr[xx] == packetFilterBase.iSrcAddr[xx]) && |
|
3281 (configFilter.iSrcAddrSubnetMask[xx] == packetFilterBase.iSrcAddrSubnetMask[xx])) |
|
3282 { |
|
3283 found=ETrue; |
|
3284 } |
|
3285 else |
|
3286 { |
|
3287 found=EFalse; |
|
3288 break; |
|
3289 } |
|
3290 } |
|
3291 |
|
3292 if(found) |
|
3293 { |
|
3294 // checking the maximum number of packet filter per a pdp context |
|
3295 if(iNumFiltersAdded >= KMaxNumberOfTftFilters ) |
|
3296 { |
|
3297 ReqCompleted(aTsyReqHandle, KErrOverflow); |
|
3298 return KErrNone; |
|
3299 } |
|
3300 iTFTChangeBool = ETrue; |
|
3301 configFilter.iAdded = ETrue; |
|
3302 iNumFiltersAdded++ ; |
|
3303 ReqCompleted(aTsyReqHandle, KErrNone); |
|
3304 return KErrNone; |
|
3305 } |
|
3306 } |
|
3307 } |
|
3308 ReqCompleted(aTsyReqHandle, KErrGeneral); |
|
3309 return KErrNone; |
|
3310 } |
|
3311 |
|
3312 /** |
|
3313 * This function removes the packet filter from the array if the packet filter is found in the array |
|
3314 */ |
|
3315 TInt CSimPacketContext::RemovePacketFilter(const TTsyReqHandle aTsyReqHandle, TInt aId) |
|
3316 { |
|
3317 TInt total= iPacketFilterInfoArray->Count(); |
|
3318 TBool found = EFalse; |
|
3319 |
|
3320 for (TInt i = 0; i<total; i++) |
|
3321 { |
|
3322 if ((iPacketFilterInfoArray->At(i).iId == aId) && |
|
3323 (iPacketFilterInfoArray->At(i).iAdded)) |
|
3324 { |
|
3325 iPacketFilterInfoArray->At(i).iAdded = EFalse; |
|
3326 iNumFiltersAdded-- ; |
|
3327 ReqCompleted(aTsyReqHandle, KErrNone); |
|
3328 found = ETrue; |
|
3329 iTFTChangeBool = ETrue; |
|
3330 break; |
|
3331 } |
|
3332 } |
|
3333 |
|
3334 if (!found) |
|
3335 { |
|
3336 ReqCompleted(aTsyReqHandle, KErrArgument); |
|
3337 return KErrNone; |
|
3338 } |
|
3339 return KErrNone; |
|
3340 } |
|
3341 |
|
3342 /** |
|
3343 * This function initialises the context |
|
3344 */ |
|
3345 TInt CSimPacketContext::InitialiseContext(const TTsyReqHandle aTsyReqHandle, TDes8* aDataChannelV2Pckg) |
|
3346 { |
|
3347 TCommSetupItem item = FindCommSettings(); |
|
3348 if (item.iNumInitializeFailures != 0) |
|
3349 { |
|
3350 item.iNumInitializeFailures--; |
|
3351 ReqCompleted(aTsyReqHandle, item.iErrorCode); |
|
3352 } |
|
3353 else |
|
3354 { |
|
3355 iInitContextData.iTsyReqHandle = aTsyReqHandle; |
|
3356 iInitContextData.iChannel = aDataChannelV2Pckg; |
|
3357 iInitContextTimer->Start(item.iDelay, this, ETimerIdPcktContextInitContext); |
|
3358 } |
|
3359 return KErrNone; |
|
3360 } |
|
3361 |
|
3362 TInt CSimPacketContext::DoInitialiseContext() |
|
3363 { |
|
3364 RPacketContext::TDataChannelV2Pckg* channel = (RPacketContext::TDataChannelV2Pckg*)iInitContextData.iChannel; |
|
3365 RPacketContext::TDataChannelV2& channelV2 = (*channel)(); |
|
3366 |
|
3367 // Check that the data structure is supported by the simulated TSY version |
|
3368 TInt err = iPhone->CheckSimTsyVersion(channelV2); |
|
3369 if(err != KErrNone) |
|
3370 { |
|
3371 ReqCompleted(iInitContextData.iTsyReqHandle, err); |
|
3372 return KErrNone; |
|
3373 } |
|
3374 |
|
3375 TCommSetupItem item = FindCommSettings(); |
|
3376 channelV2.iPort = item.iPortName; |
|
3377 channelV2.iCsy = item.iCsyName; |
|
3378 channelV2.iChannelId = item.iPortName; |
|
3379 |
|
3380 ReqCompleted(iInitContextData.iTsyReqHandle, KErrNone); |
|
3381 |
|
3382 return KErrNone; |
|
3383 } |
|
3384 |
|
3385 /** |
|
3386 * Cancel method, returns KErrNone |
|
3387 */ |
|
3388 TInt CSimPacketContext::EnumeratePacketFiltersCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
3389 { |
|
3390 return KErrNone; |
|
3391 } |
|
3392 |
|
3393 /** |
|
3394 * Cancel method, returns KErrNone |
|
3395 */ |
|
3396 TInt CSimPacketContext::GetPacketFilterInfoCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
3397 { |
|
3398 return KErrNone; |
|
3399 } |
|
3400 |
|
3401 /** |
|
3402 * Cancel method, returns KErrNone |
|
3403 */ |
|
3404 TInt CSimPacketContext::AddPacketFilterCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
3405 { |
|
3406 return KErrNone; |
|
3407 } |
|
3408 |
|
3409 /** |
|
3410 * Cancel method, returns KErrNone |
|
3411 */ |
|
3412 TInt CSimPacketContext::CreateNewTFTCancel(const TTsyReqHandle aTsyReqHandle) |
|
3413 { |
|
3414 iCreateTftTimer->Cancel(); |
|
3415 |
|
3416 ReqCompleted(aTsyReqHandle, KErrCancel); |
|
3417 |
|
3418 return KErrNone; |
|
3419 } |
|
3420 |
|
3421 /** |
|
3422 * Cancel method, returns KErrNone |
|
3423 */ |
|
3424 TInt CSimPacketContext::DeleteTFTCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
3425 { |
|
3426 return KErrNone; |
|
3427 } |
|
3428 |
|
3429 /** |
|
3430 * Cancel method, returns KErrNone |
|
3431 */ |
|
3432 TInt CSimPacketContext::RemovePacketFilterCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
3433 { |
|
3434 return KErrNone; |
|
3435 } |
|
3436 |
|
3437 /** |
|
3438 * Cancel method, returns KErrNone |
|
3439 */ |
|
3440 TInt CSimPacketContext::ModifyActiveContextCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
3441 { |
|
3442 return KErrNone; |
|
3443 } |
|
3444 |
|
3445 /** |
|
3446 * Cancel method, returns KErrNone |
|
3447 */ |
|
3448 TInt CSimPacketContext::InitialiseContextCancel(const TTsyReqHandle aTsyReqHandle) |
|
3449 { |
|
3450 iInitContextTimer->Cancel(); |
|
3451 |
|
3452 ReqCompleted(aTsyReqHandle, KErrCancel); |
|
3453 |
|
3454 return KErrNone; |
|
3455 } |
|
3456 |
|
3457 CSimPacketContext::TCommSetupItem CSimPacketContext::FindCommSettings() |
|
3458 { |
|
3459 TInt count=iCommSetupArray->Count(); |
|
3460 TCommSetupItem def; |
|
3461 |
|
3462 //Do a default initialization. |
|
3463 def.iCsyName.Copy(KDefaultCsyName); |
|
3464 def.iPortName.Copy(KDefaultPortName); |
|
3465 def.iConfig.iRate=KDefaultCommPortRate; |
|
3466 def.iConfig.iHandshake=KDefaultHandshake; |
|
3467 def.iContextName=KDefaultSetting; |
|
3468 def.iCommReset = EFalse; |
|
3469 def.iNumInitializeFailures = 0; |
|
3470 def.iErrorCode = KErrNone; |
|
3471 def.iDelay = 0; |
|
3472 |
|
3473 for(TInt i=0; i<count; i++) |
|
3474 { |
|
3475 TCommSetupItem comm = iCommSetupArray->At(i); |
|
3476 if(comm.iContextName.Compare(iContextName)==KErrNone) |
|
3477 return comm; |
|
3478 if(comm.iContextName.Compare(KDefaultSetting)==KErrNone) |
|
3479 def=comm; |
|
3480 } |
|
3481 return def; |
|
3482 } |
|
3483 |
|
3484 TName CSimPacketContext::ContextName() const |
|
3485 { |
|
3486 return iContextName; |
|
3487 } |
|
3488 |
|
3489 TInt CSimPacketContext::GetDnsInfo(const TTsyReqHandle aTsyReqHandle, const TDesC8* aDnsInfo) |
|
3490 { |
|
3491 /** |
|
3492 * GetDnsInfo method to extract DNS server names from context |
|
3493 * |
|
3494 * @param aStatus TRequestStatus object with which error code is returned |
|
3495 * @param aDnsInfo packaged TDnsInfoV2 object passed as TDes8 |
|
3496 * |
|
3497 * GetDNSInfo() is needed when the client uses dynamic IPv4 PDP addresses. |
|
3498 * After the context is activated the client needs to know the actual primary |
|
3499 * and secondary DNS addresses to use when sending packet data. As the network |
|
3500 * may have supplied these addresses there is a need for an API method to get |
|
3501 * these addresses from the TSY. |
|
3502 */ |
|
3503 RPacketContext::TTDnsInfoV2Pckg* dnsInfoV2Pckg = (RPacketContext::TTDnsInfoV2Pckg*)aDnsInfo; |
|
3504 RPacketContext::TDnsInfoV2& dnsInfoV2 = (*dnsInfoV2Pckg)(); |
|
3505 |
|
3506 // Check that the data structure is supported by the simulated TSY version |
|
3507 TInt err = iPhone->CheckSimTsyVersion(dnsInfoV2); |
|
3508 if(err != KErrNone) |
|
3509 { |
|
3510 iPhone->ReqCompleted(aTsyReqHandle, err); |
|
3511 return KErrNone; |
|
3512 } |
|
3513 |
|
3514 TContextConfigParam config = iContextConfigParams->At(iContextConfigParamsIndex); |
|
3515 |
|
3516 dnsInfoV2.iPrimaryDns.Copy(config.iProtocolConfigOption.iPrimaryDNS); |
|
3517 dnsInfoV2.iSecondaryDns.Copy(config.iProtocolConfigOption.iSecondaryDNS); |
|
3518 |
|
3519 ReqCompleted(aTsyReqHandle,KErrNone); |
|
3520 return KErrNone; |
|
3521 } |
|
3522 |
|
3523 TInt CSimPacketContext::GetDnsInfoCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
3524 /** |
|
3525 * GetDnsInfoCancel - Cancels an asynchronous GetDnsInfo method. |
|
3526 */ |
|
3527 { |
|
3528 return KErrNone; |
|
3529 } |
|
3530 |
|
3531 TInt CSimPacketContext::GetAddMediaAuthorization(const TTsyReqHandle aTsyReqHandle, TDes8* aBuffer) |
|
3532 /** |
|
3533 * GetAddMediaAuthorization method to verify provided media authorization and return desired result |
|
3534 * |
|
3535 * @param aTsyReqHandle The request handle for completing the request |
|
3536 * @param aBuffer Packaged CTFTMediaAuthorizationV3 object passed as TDes8 |
|
3537 * |
|
3538 * GetAddMediaAuthorization() checks the provided media authorization against a predefined authorization |
|
3539 * set up from the configuration file. If the authorization is valid the function will return the desired |
|
3540 * response, also set up from the configuration file. If there is a mismatch between authorizations, KErrCorrupt |
|
3541 * returned. |
|
3542 */ |
|
3543 { |
|
3544 TBool validMediaAuthorization = TRUE; |
|
3545 RPacketContext::CTFTMediaAuthorizationV3* mediaAuthV3 = NULL; |
|
3546 |
|
3547 // Check that the data structure is supported by the simulated TSY version |
|
3548 TInt err = iPhone->CheckSimTsyVersion(*mediaAuthV3); |
|
3549 if(err != KErrNone) |
|
3550 { |
|
3551 iPhone->ReqCompleted(aTsyReqHandle, err); |
|
3552 return KErrNone; |
|
3553 } |
|
3554 |
|
3555 TRAPD(ret, mediaAuthV3 = RPacketContext::CTFTMediaAuthorizationV3::NewL()); |
|
3556 if (ret != KErrNone) |
|
3557 { |
|
3558 LOGPACKET1("CSimPacketContext::GetAddMediaAuthorization NewL call fail"); |
|
3559 return ret; |
|
3560 } |
|
3561 |
|
3562 TRAP(ret, mediaAuthV3->InternalizeL(*aBuffer) ); |
|
3563 if (ret != KErrNone) |
|
3564 { |
|
3565 delete mediaAuthV3; |
|
3566 LOGPACKET1("CSimPacketContext::GetAddMediaAuthorization InternalizeL call fail"); |
|
3567 return ret; |
|
3568 } |
|
3569 |
|
3570 for (TUint i=0; i<iAuthorizationTokenResponse->Count(); i++) |
|
3571 { |
|
3572 if (!(mediaAuthV3->iAuthorizationToken).Compare(iAuthorizationTokenResponse->At(i).iAuthorizationToken)) |
|
3573 { |
|
3574 for (TUint j=0; j<iMediaAuthorization->At(i).iFlowIds.Count(); j++) |
|
3575 { |
|
3576 if ((mediaAuthV3->iFlowIds[j].iMediaComponentNumber != iMediaAuthorization->At(i).iFlowIds[j].iMediaComponentNumber) || |
|
3577 (mediaAuthV3->iFlowIds[j].iIPFlowNumber != iMediaAuthorization->At(i).iFlowIds[j].iIPFlowNumber)) |
|
3578 { |
|
3579 validMediaAuthorization = FALSE; |
|
3580 } |
|
3581 } |
|
3582 if (validMediaAuthorization) |
|
3583 { |
|
3584 ReqCompleted(aTsyReqHandle,iAuthorizationTokenResponse->At(i).iResponse); |
|
3585 delete mediaAuthV3; |
|
3586 return KErrNone; |
|
3587 } |
|
3588 } |
|
3589 } |
|
3590 |
|
3591 // No match found, respond with corrupted |
|
3592 ReqCompleted(aTsyReqHandle,KErrCorrupt); |
|
3593 delete mediaAuthV3; |
|
3594 |
|
3595 return KErrNone; |
|
3596 } |
|
3597 |
|
3598 TInt CSimPacketContext::GetRemoveMediaAuthorization(const TTsyReqHandle aTsyReqHandle, RPacketContext::TAuthorizationToken* aAuthorizationToken) |
|
3599 /** |
|
3600 * GetRemoveMediaAuthorization method to verify provided media authorization and return desired result |
|
3601 * |
|
3602 * @param aTsyReqHandle The request handle for completing the request |
|
3603 * @param aAuthorizationToken Authorization token to be checked |
|
3604 * |
|
3605 * GetRemoveMediaAuthorization() checks the provided authorization token against predefined tokens and responses |
|
3606 * from config file. If a match is found the associated desired response is returned, otherwise KErrCorrupt is reported. |
|
3607 */ |
|
3608 { |
|
3609 for (TUint i=0; i<iAuthorizationTokenResponse->Count(); i++) |
|
3610 { |
|
3611 if (!((*aAuthorizationToken).Compare(iAuthorizationTokenResponse->At(i).iAuthorizationToken))) |
|
3612 { |
|
3613 ReqCompleted(aTsyReqHandle,iAuthorizationTokenResponse->At(i).iResponse); |
|
3614 return KErrNone; |
|
3615 } |
|
3616 } |
|
3617 |
|
3618 // No match found, respond with corrupted |
|
3619 ReqCompleted(aTsyReqHandle,KErrCorrupt); |
|
3620 return KErrNone; |
|
3621 } |
|
3622 |
|
3623 TInt CSimPacketContext::GetAddMediaAuthorizationCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
3624 /** |
|
3625 * Cancel method, returns KErrNone |
|
3626 */ |
|
3627 { |
|
3628 return KErrNone; |
|
3629 } |
|
3630 |
|
3631 TInt CSimPacketContext::GetRemoveMediaAuthorizationCancel(const TTsyReqHandle /*aTsyReqHandle*/) |
|
3632 /** |
|
3633 * Cancel method, returns KErrNone |
|
3634 */ |
|
3635 { |
|
3636 return KErrNone; |
|
3637 } |
|
3638 |
|
3639 |