24
+ − 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), iLastError(KErrNone), iErrorCodeForGetLastErrorCause(KErrNone)
+ − 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
*aError = iLastError;
+ − 2490
ReqCompleted(aTsyReqHandle,iErrorCodeForGetLastErrorCause);
+ − 2491
iErrorCodeForGetLastErrorCause = KErrNone;
+ − 2492
return KErrNone;
+ − 2493
}
+ − 2494
+ − 2495
void CSimPacketContext::TimerCallBack(TInt aId)
+ − 2496
/**
+ − 2497
* Timer callback function. When the timer goes off, it will call back into this
+ − 2498
* function for further processing.
+ − 2499
*/
+ − 2500
{
+ − 2501
TInt newIndex = KErrNotFound;
+ − 2502
+ − 2503
switch(aId)
+ − 2504
{
+ − 2505
case ETimerIdPcktContextStatusChange:
+ − 2506
TimerCallBackNotifyContextStatusChange();
+ − 2507
break;
+ − 2508
case ETimerIdPcktContextSetConfig:
+ − 2509
SetConfig(iSetConfigData->At(0).iTsyReqHandle, iSetConfigData->At(0).iData);
+ − 2510
iSetConfigData->Delete(0);
+ − 2511
if (iSetConfigData->Count() != 0)
+ − 2512
iSetConfigTimer->Start(iSetConfigDelay,this,ETimerIdPcktContextSetConfig);
+ − 2513
break;
+ − 2514
case ETimerIdPcktContextConfigChange:
+ − 2515
//Check the validity of the new context config param index before applying it
+ − 2516
newIndex = (iNotifyContextConfigChangeArray->At(0)).iNewContextConfigIndex;
+ − 2517
if(newIndex <= iContextConfigParams->Count() - 1)
+ − 2518
{
+ − 2519
//Change the context config param index to point to the new context configuration
+ − 2520
iContextConfigParamsIndex = newIndex;
+ − 2521
+ − 2522
// Check for and complete any pending notifications
+ − 2523
if(iNotifyConfigGPRS.iNotifyPending)
+ − 2524
{
+ − 2525
iNotifyConfigGPRS.iNotifyPending=EFalse;
+ − 2526
CSimContextHelper::ConvertConfigParams(iContextConfigParams->At(iContextConfigParamsIndex),
+ − 2527
*(RPacketContext::TContextConfigGPRS*)iNotifyConfigGPRS.iNotifyData);
+ − 2528
ReqCompleted(iNotifyConfigGPRS.iNotifyHandle,KErrNone);
+ − 2529
}
+ − 2530
+ − 2531
if(iNotifyConfigR99.iNotifyPending)
+ − 2532
{
+ − 2533
iNotifyConfigR99.iNotifyPending=EFalse;
+ − 2534
CSimContextHelper::ConvertConfigParams(iContextConfigParams->At(iContextConfigParamsIndex),
+ − 2535
*(RPacketContext::TContextConfigR99_R4*)iNotifyConfigR99.iNotifyData);
+ − 2536
ReqCompleted(iNotifyConfigR99.iNotifyHandle,KErrNone);
+ − 2537
}
+ − 2538
+ − 2539
if(iNotifyConfigR5.iNotifyPending)
+ − 2540
{
+ − 2541
iNotifyConfigR5.iNotifyPending=EFalse;
+ − 2542
CSimContextHelper::ConvertConfigParams(iContextConfigParams->At(iContextConfigParamsIndex),
+ − 2543
*(RPacketContext::TContextConfig_R5*)iNotifyConfigR5.iNotifyData);
+ − 2544
ReqCompleted(iNotifyConfigR5.iNotifyHandle,KErrNone);
+ − 2545
}
+ − 2546
}
+ − 2547
+ − 2548
else
+ − 2549
{
+ − 2550
LOGMISC1(">>CSimPacketContext.cpp: Invalid new context config param index");
+ − 2551
}
+ − 2552
+ − 2553
//Delete the current NotifyContextConfigChange item and set the next one if possible
+ − 2554
iNotifyContextConfigChangeArray->Delete(0);
+ − 2555
+ − 2556
if(iNotifyContextConfigChangeArray->Count() > 0)
+ − 2557
{
+ − 2558
TInt delay = (iNotifyContextConfigChangeArray->At(0)).iDelay;
+ − 2559
iNotifyContextConfigChangeTimer->Start(delay,this, ETimerIdPcktContextConfigChange);
+ − 2560
}
+ − 2561
break;
+ − 2562
+ − 2563
case ETimerIdPcktContextInitContext:
+ − 2564
DoInitialiseContext();
+ − 2565
break;
+ − 2566
case ETimerIdPcktContextCreateTft:
+ − 2567
DoCreateNewTFT();
+ − 2568
break;
+ − 2569
default:
+ − 2570
{
+ − 2571
LOGPACKET1(">>CSimPacketContext::TimerCallBack");
+ − 2572
TInt ret=ActionEvent(EContextEventTimeOut,KErrNone);
+ − 2573
__ASSERT_ALWAYS(ret==KErrNone,SimPanic(ETimeOutEventActionFailed)); // Note: this is very crude error handling and should be replaced by something rather more elegant.
+ − 2574
LOGPACKET1("<<CSimPacketContext::TimerCallBack");
+ − 2575
iTFTChangeBool = EFalse;
+ − 2576
break;
+ − 2577
}
+ − 2578
}
+ − 2579
}
+ − 2580
+ − 2581
void CSimPacketContext::PubSubCallback(TInt aIndex)
+ − 2582
{
+ − 2583
TInt length = iNotifyContextStatusChangeArray->Count();
+ − 2584
if (aIndex < length)
+ − 2585
{
+ − 2586
TNotifyContextStatusChange& statusChange = iNotifyContextStatusChangeArray->At(aIndex);
+ − 2587
if (statusChange.iContextName.Compare(iContextName) == 0)
+ − 2588
{
+ − 2589
CompleteContextStatusChange(statusChange.iStatus);
+ − 2590
}
+ − 2591
}
+ − 2592
}
+ − 2593
+ − 2594
/**
+ − 2595
* This is for the NotifyContextStatusChange timer callback
+ − 2596
*/
+ − 2597
void CSimPacketContext::TimerCallBackNotifyContextStatusChange()
+ − 2598
{
+ − 2599
if(GetContextStatusChangeCount() <= iNotifyContextStatusChangeIndex)
+ − 2600
{
+ − 2601
// the index is out of bounds
+ − 2602
return;
+ − 2603
}
+ − 2604
TNotifyContextStatusChange& statusChange = GetContextStatusChangeAt(iNotifyContextStatusChangeIndex);
+ − 2605
+ − 2606
CompleteContextStatusChange(statusChange.iStatus);
+ − 2607
+ − 2608
iNotifyContextStatusChangeIndex++;
+ − 2609
if (GetContextStatusChangeCount() > iNotifyContextStatusChangeIndex)
+ − 2610
{
+ − 2611
// start timer again
+ − 2612
iNotifyContextStatusChangeTimer->Start(GetContextStatusChangeAt(iNotifyContextStatusChangeIndex).iDuration,this,ETimerIdPcktContextStatusChange);
+ − 2613
}
+ − 2614
}
+ − 2615
+ − 2616
void CSimPacketContext::CompleteContextStatusChange(RPacketContext::TContextStatus& aStatus)
+ − 2617
{
+ − 2618
iCurrentNotifyContextStatusChange = aStatus;
+ − 2619
+ − 2620
ChangeState(iCurrentNotifyContextStatusChange);
+ − 2621
if (RPacketContext::EStatusDeleted == iCurrentNotifyContextStatusChange)
+ − 2622
{
+ − 2623
DoDelete();
+ − 2624
}
+ − 2625
}
+ − 2626
+ − 2627
void CSimPacketContext::NTRasCallBack(TInt aStatus)
+ − 2628
/**
+ − 2629
* NTRas callback function. This function will be called when the NTRAS
+ − 2630
* Server has responded.
+ − 2631
*
+ − 2632
* @param aStatus Standard error value, indicating the success or failure of the NTRAS
+ − 2633
* connection.
+ − 2634
*/
+ − 2635
{
+ − 2636
__ASSERT_ALWAYS(ActionEvent(EContextEventNtRas,aStatus) == KErrNone,SimPanic(EGeneral));
+ − 2637
if(iCommReset)
+ − 2638
iNtRas->Terminate();
+ − 2639
}
+ − 2640
+ − 2641
RPacketService::TStatus CSimPacketContext::ConvertToPacketServiceStatus(RPacketContext::TContextStatus aNewState)
+ − 2642
/**
+ − 2643
* Converts Packet Context Status (RPacketContext::TContextStatus) to
+ − 2644
* Packet Service Status (RPacketService::TStatus)
+ − 2645
*
+ − 2646
* @param aNewState the Context status to convert to packet service status
+ − 2647
* @return RPacketService::TStatus The packet service status conversion
+ − 2648
*/
+ − 2649
{
+ − 2650
RPacketService::TStatus serviceStatus;
+ − 2651
switch (aNewState)
+ − 2652
{
+ − 2653
case RPacketContext::EStatusInactive:
+ − 2654
case RPacketContext::EStatusActivating:
+ − 2655
case RPacketContext::EStatusDeleted:
+ − 2656
serviceStatus = RPacketService::EStatusAttached;
+ − 2657
break;
+ − 2658
case RPacketContext::EStatusActive:
+ − 2659
case RPacketContext::EStatusDeactivating:
+ − 2660
serviceStatus = RPacketService::EStatusActive;
+ − 2661
break;
+ − 2662
case RPacketContext::EStatusSuspended:
+ − 2663
serviceStatus = RPacketService::EStatusSuspended;
+ − 2664
break;
+ − 2665
default:
+ − 2666
serviceStatus = RPacketService::EStatusUnattached;
+ − 2667
break;
+ − 2668
}
+ − 2669
return serviceStatus;
+ − 2670
}
+ − 2671
+ − 2672
+ − 2673
TInt CSimPacketContext::ChangeState(RPacketContext::TContextStatus aNewState)
+ − 2674
/**
+ − 2675
* Attempt to change state.
+ − 2676
* First validate that the requested state change is ok. If it is then proceed to change
+ − 2677
* the state and complete any pending state change notification.
+ − 2678
*
+ − 2679
* @param aNewState the new state to change to
+ − 2680
* @return Error indication if change of state is successful or not
+ − 2681
*/
+ − 2682
{
+ − 2683
LOGPACKET2(">>CSimPacketContext::ChangeState [newState=%d]", aNewState);
+ − 2684
__ASSERT_ALWAYS(aNewState!=RPacketContext::EStatusUnknown,SimPanic(ECallStatusUnknownIllegal));
+ − 2685
+ − 2686
if(iState==aNewState)
+ − 2687
return KErrNone;
+ − 2688
+ − 2689
TInt ret=KErrGeneral;
+ − 2690
const struct TContextStateChangeValidity* stateChangePnt=KContextStateChangeValidity;
+ − 2691
while(stateChangePnt->iOldState!=KContextStateTableTerminator)
+ − 2692
{
+ − 2693
if((stateChangePnt->iOldState==iState) && (stateChangePnt->iNewState==aNewState))
+ − 2694
{
+ − 2695
ret=stateChangePnt->iError;
+ − 2696
break;
+ − 2697
}
+ − 2698
stateChangePnt++;
+ − 2699
}
+ − 2700
+ − 2701
if(ret!=KErrNone)
+ − 2702
return ret;
+ − 2703
+ − 2704
//Request permission from the phone to change the state of the packet connection
+ − 2705
ret = iPacketService->ChangeState(ConvertToPacketServiceStatus(aNewState));
+ − 2706
if(ret!=KErrNone)
+ − 2707
return ret;
+ − 2708
+ − 2709
// Actually change the state.
+ − 2710
iState=aNewState;
+ − 2711
+ − 2712
// Check for a pending line state notification.
+ − 2713
if(iNotifyStatusChange.iNotifyPending)
+ − 2714
{
+ − 2715
iNotifyStatusChange.iNotifyPending=EFalse;
+ − 2716
*(RPacketContext::TContextStatus*)iNotifyStatusChange.iNotifyData=iState;
+ − 2717
ReqCompleted(iNotifyStatusChange.iNotifyHandle,KErrNone);
+ − 2718
}
+ − 2719
+ − 2720
+ − 2721
LOGPACKET1("<<CSimPacketContext::ChangeState");
+ − 2722
return KErrNone;
+ − 2723
}
+ − 2724
+ − 2725
TInt CSimPacketContext::ActionEvent(TContextEvent aEvent,TInt aStatus)
+ − 2726
/**
+ − 2727
* Entry point when an event has occured that may advance the state machine.
+ − 2728
* The aEvent parameter describes the event.
+ − 2729
*
+ − 2730
* This function contains the main state machine for the packet Context.
+ − 2731
*
+ − 2732
* @param aEvent The Packet Context event to handle
+ − 2733
* @return value represents the error state caused by the attempted state machine jump.
+ − 2734
*/
+ − 2735
{
+ − 2736
TInt ret=KErrNone;
+ − 2737
__ASSERT_ALWAYS(iState!=RPacketContext::EStatusUnknown,SimPanic(ECallStatusUnknownIllegal));
+ − 2738
+ − 2739
TBool found = EFalse;
+ − 2740
TInt i = 0;
+ − 2741
TInt count = iContextConfigsRel99->Count();
+ − 2742
for(i = 0; i<count; i++)
+ − 2743
{
+ − 2744
if(iContextName.Compare(iContextConfigsRel99->At(i).iContextName)==0)
+ − 2745
{
+ − 2746
found = ETrue;
+ − 2747
break;
+ − 2748
}
+ − 2749
}
+ − 2750
+ − 2751
switch(aEvent)
+ − 2752
{
+ − 2753
case EContextEventActivate:
+ − 2754
LOGPACKET1(">>CSimPacketContext::ActionEvent = [EContextEventActivate]");
+ − 2755
if(iState==RPacketContext::EStatusInactive)
+ − 2756
{
+ − 2757
iCurrentEvent=EContextEventActivate;
+ − 2758
ret = ChangeState(RPacketContext::EStatusActivating);
+ − 2759
if(ret!=KErrNone)
+ − 2760
ReqCompleted(iActivateRequestHandle,ret);
+ − 2761
else
+ − 2762
{
+ − 2763
if(!found)
+ − 2764
iTimer->Start(iActivatePause,this);
+ − 2765
else
+ − 2766
iTimer->Start(iContextConfigsRel99->At(i).iActivatePause,this);
+ − 2767
}
+ − 2768
}
+ − 2769
else
+ − 2770
ReqCompleted(iActivateRequestHandle, KErrGprsActivationRejected);
+ − 2771
break;
+ − 2772
+ − 2773
case EContextEventDeactivate:
+ − 2774
LOGPACKET1(">>CSimPacketContext::ActionEvent = [EContextEventDeactivate]");
+ − 2775
if(iState==RPacketContext::EStatusActive)
+ − 2776
{
+ − 2777
iCurrentEvent=EContextEventDeactivate;
+ − 2778
ret = ChangeState(RPacketContext::EStatusDeactivating);
+ − 2779
if(ret!=KErrNone)
+ − 2780
ReqCompleted(iDeactivateRequestHandle,ret);
+ − 2781
else
+ − 2782
{
+ − 2783
if (!found)
+ − 2784
iTimer->Start(iDeactivatePause,this);
+ − 2785
else
+ − 2786
iTimer->Start(iContextConfigsRel99->At(i).iDeactivatePause,this);
+ − 2787
}
+ − 2788
}
+ − 2789
else
+ − 2790
ReqCompleted(iDeactivateRequestHandle, KErrNone);
+ − 2791
break;
+ − 2792
+ − 2793
case EContextEventDelete:
+ − 2794
LOGPACKET1(">>CSimPacketContext::ActionEvent = [EContextEventDelete]");
+ − 2795
if(iState==RPacketContext::EStatusInactive)
+ − 2796
{
+ − 2797
iCurrentEvent=EContextEventDelete;
+ − 2798
+ − 2799
if (!found)
+ − 2800
iTimer->Start(iDeletePause,this);
+ − 2801
else
+ − 2802
iTimer->Start(iContextConfigsRel99->At(i).iDeletionPause,this);
+ − 2803
}
+ − 2804
else
+ − 2805
ReqCompleted(iDeleteRequestHandle, KErrInUse);
+ − 2806
break;
+ − 2807
+ − 2808
case EContextEventNtRas:
+ − 2809
if((iState==RPacketContext::EStatusActivating) && (iCurrentEvent==EContextEventNtRas))
+ − 2810
{
+ − 2811
if(aStatus!=KErrNone)
+ − 2812
{
+ − 2813
ReqCompleted(iActivateRequestHandle,aStatus);
+ − 2814
ret=ChangeState(RPacketContext::EStatusInactive);
+ − 2815
__ASSERT_ALWAYS(ret==KErrNone,SimPanic(EIllegalStateInconsistancy));
+ − 2816
return KErrNone;
+ − 2817
}
+ − 2818
else
+ − 2819
{
+ − 2820
ret=ChangeState(RPacketContext::EStatusActive);
+ − 2821
ReqCompleted(iActivateRequestHandle,ret);
+ − 2822
iIsActive = ETrue;
+ − 2823
return KErrNone;
+ − 2824
}
+ − 2825
}
+ − 2826
iCurrentEvent=EContextEventNone;
+ − 2827
break;
+ − 2828
+ − 2829
case EContextEventTimeOut:
+ − 2830
LOGPACKET1(">>CSimPacketContext::ActionEvent = [EContextEventTimeOut]");
+ − 2831
switch(iCurrentEvent)
+ − 2832
{
+ − 2833
case EContextEventNone:
+ − 2834
break;
+ − 2835
case EContextEventActivate:
+ − 2836
if(iState==RPacketContext::EStatusActivating)
+ − 2837
{
+ − 2838
TInt activateValue;
+ − 2839
if (found)
+ − 2840
activateValue = iContextConfigsRel99->At(i).iActivateErrorCode;
+ − 2841
else
+ − 2842
activateValue = iActivateFail;
+ − 2843
if(activateValue == KContextGoToInactiveWithErrorWhenTryingToGetLastErrorCode)
+ − 2844
{
+ − 2845
//this will allow context activation move to the next state but with context being inactive
+ − 2846
ret=ChangeState(RPacketContext::EStatusInactive);
+ − 2847
iCurrentEvent=EContextEventNone;
+ − 2848
iLastError = activateValue;
+ − 2849
iErrorCodeForGetLastErrorCause=KErrGeneral;
+ − 2850
+ − 2851
iContextConfigsRel99->At(i).iActivateErrorCode = iLastError;
+ − 2852
ReqCompleted(iActivateRequestHandle, KErrNone);
+ − 2853
+ − 2854
break;
+ − 2855
}
+ − 2856
if(activateValue <= KContextGoToInactiveWithExtendedErrorCode && activateValue > KContextGoToInactiveWithNormalErrorCode)
+ − 2857
{
+ − 2858
//this will allow context activation move to the next state but with context being inactive
+ − 2859
//tsy extended error case
+ − 2860
ret=ChangeState(RPacketContext::EStatusInactive);
+ − 2861
iCurrentEvent=EContextEventNone;
+ − 2862
iLastError = activateValue - KContextGoToInactiveWithExtendedErrorCode;
+ − 2863
//move the error code to the higher 16 bit.
+ − 2864
iLastError<<=16;
+ − 2865
+ − 2866
iContextConfigsRel99->At(i).iActivateErrorCode = iLastError;
+ − 2867
ReqCompleted(iActivateRequestHandle, KErrNone);
+ − 2868
+ − 2869
break;
+ − 2870
}
+ − 2871
if(activateValue <= KContextGoToInactiveWithNormalErrorCode && activateValue > KLimitForErrorCodeForContextGoToInactive)
+ − 2872
{
+ − 2873
//this will allow context activation move to the next state but with context being inactive
+ − 2874
//normal error case
+ − 2875
ret=ChangeState(RPacketContext::EStatusInactive);
+ − 2876
iCurrentEvent=EContextEventNone;
+ − 2877
iLastError = activateValue - KContextGoToInactiveWithNormalErrorCode;
+ − 2878
+ − 2879
iContextConfigsRel99->At(i).iActivateErrorCode = iLastError;
+ − 2880
ReqCompleted(iActivateRequestHandle, KErrNone);
+ − 2881
+ − 2882
break;
+ − 2883
}
+ − 2884
else
+ − 2885
if(activateValue != KErrNone)
+ − 2886
{
+ − 2887
ReqCompleted(iActivateRequestHandle,activateValue);
+ − 2888
ret=ChangeState(RPacketContext::EStatusInactive);
+ − 2889
iCurrentEvent=EContextEventNone;
+ − 2890
activateValue = KErrNone;
+ − 2891
+ − 2892
if (found)
+ − 2893
iContextConfigsRel99->At(i).iActivateErrorCode = activateValue;
+ − 2894
else
+ − 2895
iActivateFail = activateValue;
+ − 2896
break;
+ − 2897
}
+ − 2898
else
+ − 2899
{
+ − 2900
if (found)
+ − 2901
{
+ − 2902
if (iContextConfigsRel99->At(i).iConnectToNtRas)
+ − 2903
{
+ − 2904
ret = DoActivate();
+ − 2905
if (ret == KErrNone)
+ − 2906
iCurrentEvent=EContextEventNtRas;
+ − 2907
else
+ − 2908
iCurrentEvent=EContextEventNone;
+ − 2909
}
+ − 2910
else
+ − 2911
{
+ − 2912
iCurrentEvent=EContextEventNone;
+ − 2913
ReqCompleted(iActivateRequestHandle,activateValue);
+ − 2914
ret=ChangeState(RPacketContext::EStatusActive);
+ − 2915
iIsActive = ETrue;
+ − 2916
}
+ − 2917
}
+ − 2918
else
+ − 2919
{
+ − 2920
ret = DoActivate();
+ − 2921
if (ret == KErrNone)
+ − 2922
iCurrentEvent=EContextEventNtRas;
+ − 2923
else
+ − 2924
iCurrentEvent=EContextEventNone;
+ − 2925
}
+ − 2926
}
+ − 2927
}
+ − 2928
break;
+ − 2929
case EContextEventDeactivate:
+ − 2930
TInt deActivateValue;
+ − 2931
if (found)
+ − 2932
deActivateValue = iContextConfigsRel99->At(i).iDeactivateErrorCode;
+ − 2933
else
+ − 2934
deActivateValue = iDeactivateFail;
+ − 2935
+ − 2936
if(iState==RPacketContext::EStatusDeactivating)
+ − 2937
{
+ − 2938
if(deActivateValue != KErrNone)
+ − 2939
{
+ − 2940
ReqCompleted(iDeactivateRequestHandle,deActivateValue);
+ − 2941
ret=ChangeState(RPacketContext::EStatusActive);
+ − 2942
deActivateValue = KErrNone;
+ − 2943
+ − 2944
if (found)
+ − 2945
iContextConfigsRel99->At(i).iDeactivateErrorCode = deActivateValue;
+ − 2946
else
+ − 2947
iDeactivateFail = deActivateValue;
+ − 2948
break;
+ − 2949
}
+ − 2950
else {
+ − 2951
ret=ChangeState(RPacketContext::EStatusInactive);
+ − 2952
if(ret==KErrNone)
+ − 2953
{
+ − 2954
ret = DoDeactivate();
+ − 2955
if(ret==KErrNone)
+ − 2956
{
+ − 2957
ReqCompleted(iDeactivateRequestHandle,deActivateValue);
+ − 2958
iIsActive=EFalse;
+ − 2959
}
+ − 2960
else
+ − 2961
ReqCompleted(iDeactivateRequestHandle,ret);
+ − 2962
}
+ − 2963
else
+ − 2964
ReqCompleted(iDeactivateRequestHandle,ret);
+ − 2965
}
+ − 2966
}
+ − 2967
iCurrentEvent=EContextEventNone;
+ − 2968
break;
+ − 2969
case EContextEventDelete:
+ − 2970
TInt deleteValue;
+ − 2971
if (found)
+ − 2972
deleteValue = iContextConfigsRel99->At(i).iDeletionErrorCode;
+ − 2973
else
+ − 2974
deleteValue = iDeleteFail;
+ − 2975
+ − 2976
if(iState==RPacketContext::EStatusInactive)
+ − 2977
{
+ − 2978
if(deleteValue != KErrNone)
+ − 2979
{
+ − 2980
ReqCompleted(iDeleteRequestHandle,deleteValue);
+ − 2981
deleteValue = KErrNone;
+ − 2982
if (found)
+ − 2983
iContextConfigsRel99->At(i).iDeletionErrorCode = deleteValue;
+ − 2984
else
+ − 2985
iDeleteFail = deleteValue;
+ − 2986
break;
+ − 2987
}
+ − 2988
else {
+ − 2989
ret=ChangeState(RPacketContext::EStatusDeleted);
+ − 2990
if(ret==KErrNone)
+ − 2991
{
+ − 2992
ret = DoDelete();
+ − 2993
if(ret==KErrNone)
+ − 2994
ReqCompleted(iDeleteRequestHandle,deleteValue);
+ − 2995
else
+ − 2996
ReqCompleted(iDeleteRequestHandle,ret);
+ − 2997
}
+ − 2998
else
+ − 2999
ReqCompleted(iDeleteRequestHandle,ret);
+ − 3000
}
+ − 3001
}
+ − 3002
iCurrentEvent=EContextEventNone;
+ − 3003
break;
+ − 3004
default: //in case of EContextEventTimeOut
+ − 3005
break;
+ − 3006
}
+ − 3007
break;
+ − 3008
+ − 3009
default:
+ − 3010
break;
+ − 3011
}
+ − 3012
return ret;
+ − 3013
}
+ − 3014
+ − 3015
const CTestConfigSection* CSimPacketContext::CfgFile()
+ − 3016
/**
+ − 3017
* Return a pointer to the Configuration File Section
+ − 3018
*
+ − 3019
* @return CTestConfigSection pointer to the configuration file section
+ − 3020
*/
+ − 3021
{
+ − 3022
return iPacketService->CfgFile();
+ − 3023
}
+ − 3024
+ − 3025
TInt CSimPacketContext::ModifyActiveContext(const TTsyReqHandle aTsyReqHandle)
+ − 3026
{
+ − 3027
if (iState==RPacketContext::EStatusInactive)
+ − 3028
{
+ − 3029
ReqCompleted(aTsyReqHandle, KErrNotReady);
+ − 3030
return KErrNone;
+ − 3031
}
+ − 3032
+ − 3033
// check if QoS profile has changed or TFTs have changed
+ − 3034
if (iPacketqos != NULL)
+ − 3035
{
+ − 3036
if (iPacketqos->PerformProfileChange() == KErrNone || iTFTChangeBool)
+ − 3037
{
+ − 3038
iTFTChangeBool = EFalse;
+ − 3039
ReqCompleted(aTsyReqHandle, KErrNone);
+ − 3040
return KErrNone;
+ − 3041
}
+ − 3042
else
+ − 3043
{
+ − 3044
ReqCompleted(aTsyReqHandle, KErrNotReady);
+ − 3045
return KErrNone;
+ − 3046
}
+ − 3047
}
+ − 3048
else if (iTFTChangeBool)
+ − 3049
{
+ − 3050
iTFTChangeBool = EFalse;
+ − 3051
ReqCompleted(aTsyReqHandle, KErrNone);
+ − 3052
return KErrNone;
+ − 3053
}
+ − 3054
else
+ − 3055
{
+ − 3056
ReqCompleted(aTsyReqHandle, KErrNotReady);
+ − 3057
return KErrNone;
+ − 3058
}
+ − 3059
}
+ − 3060
+ − 3061
/**
+ − 3062
* This function enumerates the number of packet filters
+ − 3063
*/
+ − 3064
TInt CSimPacketContext::EnumeratePacketFilters(const TTsyReqHandle aTsyReqHandle, TInt& aCount)
+ − 3065
{
+ − 3066
aCount = iNumFiltersAdded;
+ − 3067
ReqCompleted(aTsyReqHandle, KErrNone);
+ − 3068
return KErrNone;
+ − 3069
}
+ − 3070
+ − 3071
/**
+ − 3072
* This function returns info regarding the packet filter specified by the index passed -
+ − 3073
* used in conjunction with EnumeratePacketFilters()
+ − 3074
*/
+ − 3075
TInt CSimPacketContext::GetPacketFilterInfoL(const TTsyReqHandle aTsyReqHandle, TInt aIndex, TDes8* aPacketFilterInfo)
+ − 3076
{
+ − 3077
// if index is invalid, return error code
+ − 3078
if (aIndex < 0 || aIndex > (iNumFiltersAdded -1))
+ − 3079
{
+ − 3080
ReqCompleted(aTsyReqHandle, KErrArgument);
+ − 3081
return KErrNone;
+ − 3082
}
+ − 3083
else
+ − 3084
{
+ − 3085
TInt ii;
+ − 3086
TInt addedFilterCount = -1;
+ − 3087
+ − 3088
//find the requested filter
+ − 3089
for(ii = 0; ii < iPacketFilterInfoArray->Count(); ii++)
+ − 3090
{
+ − 3091
if(iPacketFilterInfoArray->At(ii).iAdded)
+ − 3092
{
+ − 3093
addedFilterCount++;
+ − 3094
+ − 3095
//when the filter is found write the data to the client
+ − 3096
if(addedFilterCount == aIndex)
+ − 3097
{
+ − 3098
TPacketFilterV3 theFilter = iPacketFilterInfoArray->At(ii);
+ − 3099
+ − 3100
// Check that the data structure is supported by the simulated TSY version
+ − 3101
TInt err = KErrNone;
+ − 3102
if(iPhone->iSimTsyVersion < 3) // same version as TPacketFilterVx
+ − 3103
{
+ − 3104
(void)User::Leave(KErrNotSupported);
+ − 3105
}
+ − 3106
+ − 3107
RPacketContext::TPacketFilterV2Pckg* clientFilterPckg =
+ − 3108
(RPacketContext::TPacketFilterV2Pckg*)aPacketFilterInfo;
+ − 3109
RPacketContext::TPacketFilterV2& clientFilter = (*clientFilterPckg)();
+ − 3110
+ − 3111
// Check that the data structure is supported by the simulated TSY version
+ − 3112
err = iPhone->CheckSimTsyVersion(clientFilter);
+ − 3113
if(err != KErrNone)
+ − 3114
{
+ − 3115
iPhone->ReqCompleted(aTsyReqHandle, err);
+ − 3116
return KErrNone;
+ − 3117
}
+ − 3118
+ − 3119
if(clientFilter.ExtensionId()==KETelExtPcktV2)
+ − 3120
{
+ − 3121
clientFilter.iDestPortMax = theFilter.iDestPortMax;
+ − 3122
clientFilter.iDestPortMin = theFilter.iDestPortMin;
+ − 3123
clientFilter.iEvaluationPrecedenceIndex = theFilter.iEvaluationPrecedenceIndex;
+ − 3124
clientFilter.iFlowLabel = theFilter.iFlowLabel;
+ − 3125
clientFilter.iId = theFilter.iId;
+ − 3126
clientFilter.iIPSecSPI = theFilter.iIPSecSPI;
+ − 3127
clientFilter.iProtocolNumberOrNextHeader = theFilter.iProtocolNumberOrNextHeader;
+ − 3128
clientFilter.iSrcPortMax = theFilter.iSrcPortMax;
+ − 3129
clientFilter.iSrcPortMin = theFilter.iSrcPortMin;
+ − 3130
clientFilter.iTOSorTrafficClass = theFilter.iTOSorTrafficClass;
+ − 3131
+ − 3132
TInt xx;
+ − 3133
for(xx = 0; xx<RPacketContext::KIPAddressSize; xx++)
+ − 3134
{
+ − 3135
clientFilter.iSrcAddr[xx] = theFilter.iSrcAddr[xx];
+ − 3136
clientFilter.iSrcAddrSubnetMask[xx] = theFilter.iSrcAddrSubnetMask[xx];
+ − 3137
}
+ − 3138
ReqCompleted(aTsyReqHandle, KErrNone);
+ − 3139
return KErrNone;
+ − 3140
}
+ − 3141
else if((clientFilter.ExtensionId()==KETelExtPcktV3) &&
+ − 3142
theFilter.iFilterType != RPacketContext::EPacketFilterTypeUnknown)
+ − 3143
{
+ − 3144
RPacketContext::TPacketFilterV3Pckg* clientFilterV3Pckg =
+ − 3145
(RPacketContext::TPacketFilterV3Pckg*)aPacketFilterInfo;
+ − 3146
RPacketContext::TPacketFilterV3& clientFilterV3 = (*clientFilterV3Pckg)();
+ − 3147
+ − 3148
// Check that the data structure is supported by the simulated TSY version
+ − 3149
TInt err = iPhone->CheckSimTsyVersion(clientFilterV3);
+ − 3150
if(err != KErrNone)
+ − 3151
{
+ − 3152
iPhone->ReqCompleted(aTsyReqHandle, err);
+ − 3153
return KErrNone;
+ − 3154
}
+ − 3155
+ − 3156
RPacketContext::TPacketFilterV3 filterV3(theFilter.iFilterType);
+ − 3157
+ − 3158
// Check that the data structure is supported by the simulated TSY version
+ − 3159
err = iPhone->CheckSimTsyVersion(filterV3);
+ − 3160
if(err != KErrNone)
+ − 3161
{
+ − 3162
iPhone->ReqCompleted(aTsyReqHandle, err);
+ − 3163
return KErrNone;
+ − 3164
}
+ − 3165
+ − 3166
filterV3.iId = theFilter.iId;
+ − 3167
filterV3.iEvaluationPrecedenceIndex = theFilter.iEvaluationPrecedenceIndex;
+ − 3168
filterV3.SetTOSorTrafficClass(theFilter.iTOSorTrafficClass);
+ − 3169
+ − 3170
TInt yy;
+ − 3171
for(yy = 0; yy<RPacketContext::KIPAddressSize; yy++)
+ − 3172
{
+ − 3173
filterV3.SetSrcAddr(theFilter.iSrcAddr);
+ − 3174
filterV3.SetSrcAddrSubnetMask(theFilter.iSrcAddrSubnetMask);
+ − 3175
}
+ − 3176
if((theFilter.iFilterType == RPacketContext::EPacketFilterTypeOne) ||
+ − 3177
(theFilter.iFilterType == RPacketContext::EPacketFilterTypeTwo))
+ − 3178
{
+ − 3179
filterV3.SetProtocolNumberOrNextHeader(theFilter.iProtocolNumberOrNextHeader);
+ − 3180
}
+ − 3181
+ − 3182
if(theFilter.iFilterType == RPacketContext::EPacketFilterTypeOne)
+ − 3183
{
+ − 3184
filterV3.SetDestPortMin(theFilter.iDestPortMin);
+ − 3185
filterV3.SetDestPortMax(theFilter.iDestPortMax);
+ − 3186
filterV3.SetSrcPortMin(theFilter.iSrcPortMin);
+ − 3187
filterV3.SetSrcPortMax(theFilter.iSrcPortMax);
+ − 3188
}
+ − 3189
+ − 3190
if((theFilter.iFilterType == RPacketContext::EPacketFilterTypeTwo))
+ − 3191
{
+ − 3192
filterV3.SetSPI(theFilter.iIPSecSPI);
+ − 3193
}
+ − 3194
+ − 3195
if((theFilter.iFilterType == RPacketContext::EPacketFilterTypeThree))
+ − 3196
{
+ − 3197
filterV3.SetFlowLabel(theFilter.iFlowLabel);
+ − 3198
}
+ − 3199
+ − 3200
clientFilterV3 = filterV3;
+ − 3201
ReqCompleted(aTsyReqHandle, KErrNone);
+ − 3202
return KErrNone;
+ − 3203
}
+ − 3204
else
+ − 3205
{
+ − 3206
//cannot convert a filterV2 in the TSY to the filterV3 data typed passed in by client
+ − 3207
ReqCompleted(aTsyReqHandle, KErrCorrupt);
+ − 3208
return KErrNone;
+ − 3209
}
+ − 3210
}//end if(addedFilterCount == aIndex)
+ − 3211
}//end if(iPacketFilterInfoArray->At(ii).iAdded)
+ − 3212
else
+ − 3213
{
+ − 3214
continue;
+ − 3215
}
+ − 3216
+ − 3217
}//end for loop
+ − 3218
//filter was not found
+ − 3219
ReqCompleted(aTsyReqHandle, KErrCorrupt);
+ − 3220
return KErrNone;
+ − 3221
}//end else
+ − 3222
}
+ − 3223
+ − 3224
/**
+ − 3225
* Create TFT
+ − 3226
*/
+ − 3227
TInt CSimPacketContext::CreateNewTFT(const TTsyReqHandle aTsyReqHandle, const TInt* aSize)
+ − 3228
{
+ − 3229
if (iCreateTftConfig.iNumberOfFailures > 0)
+ − 3230
{
+ − 3231
iCreateTftConfig.iNumberOfFailures--;
+ − 3232
ReqCompleted(aTsyReqHandle, iCreateTftConfig.iFailErrorCode);
+ − 3233
return KErrNone;
+ − 3234
}
+ − 3235
iCreateTftTimer->Start(iCreateTftConfig.iDelay, this, ETimerIdPcktContextCreateTft);
+ − 3236
iCreateTftData.iTsyReqHandle = aTsyReqHandle;
+ − 3237
iCreateTftData.iSize = *aSize;
+ − 3238
return KErrNone;
+ − 3239
}
+ − 3240
+ − 3241
TInt CSimPacketContext::DoCreateNewTFT()
+ − 3242
{
+ − 3243
iTFTCreated = ETrue;
+ − 3244
iNumTFTsCreated = iCreateTftData.iSize;
+ − 3245
iTFTChangeBool = ETrue;
+ − 3246
for (TInt i = 0; i < iPacketFilterInfoArray->Count(); i++)
+ − 3247
{
+ − 3248
iPacketFilterInfoArray->At(i).iAdded = EFalse;
+ − 3249
}
+ − 3250
iNumFiltersAdded = 0;
+ − 3251
ReqCompleted(iCreateTftData.iTsyReqHandle, KErrNone);
+ − 3252
return KErrNone;
+ − 3253
}
+ − 3254
+ − 3255
/**
+ − 3256
* Delete TFT
+ − 3257
*/
+ − 3258
TInt CSimPacketContext::DeleteTFT(const TTsyReqHandle aTsyReqHandle)
+ − 3259
{
+ − 3260
if (iDeleteTftFail.iNumberOfTimes > 0)
+ − 3261
{
+ − 3262
iDeleteTftFail.iNumberOfTimes--;
+ − 3263
ReqCompleted(aTsyReqHandle, iDeleteTftFail.iFailErrorCode);
+ − 3264
return KErrNone;
+ − 3265
}
+ − 3266
iTFTCreated = EFalse;
+ − 3267
iNumTFTsCreated = -1;
+ − 3268
iTFTChangeBool = ETrue;
+ − 3269
for (TInt i = 0; i < iPacketFilterInfoArray->Count(); i++)
+ − 3270
{
+ − 3271
iPacketFilterInfoArray->At(i).iAdded = EFalse;
+ − 3272
}
+ − 3273
iNumFiltersAdded = 0;
+ − 3274
ReqCompleted(aTsyReqHandle, KErrNone);
+ − 3275
return KErrNone;
+ − 3276
}
+ − 3277
+ − 3278
/**
+ − 3279
* This method adds the packet filter to the array if it is not already there
+ − 3280
*/
+ − 3281
TInt CSimPacketContext::AddPacketFilter(const TTsyReqHandle aTsyReqHandle, const TDesC8* aPacketFilterInfo)
+ − 3282
{
+ − 3283
if (iAddPacketFilter.iNumberOfTimes > 0)
+ − 3284
{
+ − 3285
iAddPacketFilter.iNumberOfTimes--;
+ − 3286
ReqCompleted(aTsyReqHandle, iAddPacketFilter.iFailErrorCode);
+ − 3287
return KErrNone;
+ − 3288
}
+ − 3289
+ − 3290
TPckg<RPacketContext::TPacketFilterV2>* packetFilter = (TPckg<RPacketContext::TPacketFilterV2>*)aPacketFilterInfo;
+ − 3291
RPacketContext::TPacketFilterV2& packetFilterBase = (*packetFilter)();
+ − 3292
+ − 3293
// Check that the data structure is supported by the simulated TSY version
+ − 3294
TInt err = iPhone->CheckSimTsyVersion(packetFilterBase);
+ − 3295
if(err != KErrNone)
+ − 3296
{
+ − 3297
iPhone->ReqCompleted(aTsyReqHandle, err);
+ − 3298
return KErrNone;
+ − 3299
}
+ − 3300
+ − 3301
TBool found = EFalse;
+ − 3302
+ − 3303
TInt ii;
+ − 3304
for(ii = 0; ii<iPacketFilterInfoArray->Count(); ii++)
+ − 3305
{
+ − 3306
TPacketFilterV3& configFilter = iPacketFilterInfoArray->At(ii);
+ − 3307
const TInt KReservedPortZero = 0;
+ − 3308
+ − 3309
if((configFilter.iId == packetFilterBase.iId) &&
+ − 3310
(configFilter.iEvaluationPrecedenceIndex == packetFilterBase.iEvaluationPrecedenceIndex) &&
+ − 3311
(configFilter.iProtocolNumberOrNextHeader == packetFilterBase.iProtocolNumberOrNextHeader) &&
+ − 3312
(configFilter.iSrcPortMin == packetFilterBase.iSrcPortMin) &&
+ − 3313
(configFilter.iSrcPortMax == packetFilterBase.iSrcPortMax) &&
+ − 3314
((configFilter.iDestPortMin == KReservedPortZero) || (configFilter.iDestPortMin == packetFilterBase.iDestPortMin)) &&
+ − 3315
((configFilter.iDestPortMax == KReservedPortZero) || (configFilter.iDestPortMax == packetFilterBase.iDestPortMax)) &&
+ − 3316
(configFilter.iIPSecSPI == packetFilterBase.iIPSecSPI) &&
+ − 3317
(configFilter.iTOSorTrafficClass == packetFilterBase.iTOSorTrafficClass) &&
+ − 3318
(configFilter.iFlowLabel == packetFilterBase.iFlowLabel))
+ − 3319
{
+ − 3320
TInt xx;
+ − 3321
for(xx = 0; xx<RPacketContext::KIPAddressSize; xx++)
+ − 3322
{
+ − 3323
if((configFilter.iSrcAddr[xx] == packetFilterBase.iSrcAddr[xx]) &&
+ − 3324
(configFilter.iSrcAddrSubnetMask[xx] == packetFilterBase.iSrcAddrSubnetMask[xx]))
+ − 3325
{
+ − 3326
found=ETrue;
+ − 3327
}
+ − 3328
else
+ − 3329
{
+ − 3330
found=EFalse;
+ − 3331
break;
+ − 3332
}
+ − 3333
}
+ − 3334
+ − 3335
if(found)
+ − 3336
{
+ − 3337
// checking the maximum number of packet filter per a pdp context
+ − 3338
if(iNumFiltersAdded >= KMaxNumberOfTftFilters )
+ − 3339
{
+ − 3340
ReqCompleted(aTsyReqHandle, KErrOverflow);
+ − 3341
return KErrNone;
+ − 3342
}
+ − 3343
iTFTChangeBool = ETrue;
+ − 3344
configFilter.iAdded = ETrue;
+ − 3345
iNumFiltersAdded++ ;
+ − 3346
ReqCompleted(aTsyReqHandle, KErrNone);
+ − 3347
return KErrNone;
+ − 3348
}
+ − 3349
}
+ − 3350
}
+ − 3351
ReqCompleted(aTsyReqHandle, KErrGeneral);
+ − 3352
return KErrNone;
+ − 3353
}
+ − 3354
+ − 3355
/**
+ − 3356
* This function removes the packet filter from the array if the packet filter is found in the array
+ − 3357
*/
+ − 3358
TInt CSimPacketContext::RemovePacketFilter(const TTsyReqHandle aTsyReqHandle, TInt aId)
+ − 3359
{
+ − 3360
TInt total= iPacketFilterInfoArray->Count();
+ − 3361
TBool found = EFalse;
+ − 3362
+ − 3363
for (TInt i = 0; i<total; i++)
+ − 3364
{
+ − 3365
if ((iPacketFilterInfoArray->At(i).iId == aId) &&
+ − 3366
(iPacketFilterInfoArray->At(i).iAdded))
+ − 3367
{
+ − 3368
iPacketFilterInfoArray->At(i).iAdded = EFalse;
+ − 3369
iNumFiltersAdded-- ;
+ − 3370
ReqCompleted(aTsyReqHandle, KErrNone);
+ − 3371
found = ETrue;
+ − 3372
iTFTChangeBool = ETrue;
+ − 3373
break;
+ − 3374
}
+ − 3375
}
+ − 3376
+ − 3377
if (!found)
+ − 3378
{
+ − 3379
ReqCompleted(aTsyReqHandle, KErrArgument);
+ − 3380
return KErrNone;
+ − 3381
}
+ − 3382
return KErrNone;
+ − 3383
}
+ − 3384
+ − 3385
/**
+ − 3386
* This function initialises the context
+ − 3387
*/
+ − 3388
TInt CSimPacketContext::InitialiseContext(const TTsyReqHandle aTsyReqHandle, TDes8* aDataChannelV2Pckg)
+ − 3389
{
+ − 3390
TCommSetupItem item = FindCommSettings();
+ − 3391
if (item.iNumInitializeFailures != 0)
+ − 3392
{
+ − 3393
item.iNumInitializeFailures--;
+ − 3394
ReqCompleted(aTsyReqHandle, item.iErrorCode);
+ − 3395
}
+ − 3396
else
+ − 3397
{
+ − 3398
iInitContextData.iTsyReqHandle = aTsyReqHandle;
+ − 3399
iInitContextData.iChannel = aDataChannelV2Pckg;
+ − 3400
iInitContextTimer->Start(item.iDelay, this, ETimerIdPcktContextInitContext);
+ − 3401
}
+ − 3402
return KErrNone;
+ − 3403
}
+ − 3404
+ − 3405
TInt CSimPacketContext::DoInitialiseContext()
+ − 3406
{
+ − 3407
RPacketContext::TDataChannelV2Pckg* channel = (RPacketContext::TDataChannelV2Pckg*)iInitContextData.iChannel;
+ − 3408
RPacketContext::TDataChannelV2& channelV2 = (*channel)();
+ − 3409
+ − 3410
// Check that the data structure is supported by the simulated TSY version
+ − 3411
TInt err = iPhone->CheckSimTsyVersion(channelV2);
+ − 3412
if(err != KErrNone)
+ − 3413
{
+ − 3414
ReqCompleted(iInitContextData.iTsyReqHandle, err);
+ − 3415
return KErrNone;
+ − 3416
}
+ − 3417
+ − 3418
TCommSetupItem item = FindCommSettings();
+ − 3419
channelV2.iPort = item.iPortName;
+ − 3420
channelV2.iCsy = item.iCsyName;
+ − 3421
channelV2.iChannelId = item.iPortName;
+ − 3422
+ − 3423
ReqCompleted(iInitContextData.iTsyReqHandle, KErrNone);
+ − 3424
+ − 3425
return KErrNone;
+ − 3426
}
+ − 3427
+ − 3428
/**
+ − 3429
* Cancel method, returns KErrNone
+ − 3430
*/
+ − 3431
TInt CSimPacketContext::EnumeratePacketFiltersCancel(const TTsyReqHandle /*aTsyReqHandle*/)
+ − 3432
{
+ − 3433
return KErrNone;
+ − 3434
}
+ − 3435
+ − 3436
/**
+ − 3437
* Cancel method, returns KErrNone
+ − 3438
*/
+ − 3439
TInt CSimPacketContext::GetPacketFilterInfoCancel(const TTsyReqHandle /*aTsyReqHandle*/)
+ − 3440
{
+ − 3441
return KErrNone;
+ − 3442
}
+ − 3443
+ − 3444
/**
+ − 3445
* Cancel method, returns KErrNone
+ − 3446
*/
+ − 3447
TInt CSimPacketContext::AddPacketFilterCancel(const TTsyReqHandle /*aTsyReqHandle*/)
+ − 3448
{
+ − 3449
return KErrNone;
+ − 3450
}
+ − 3451
+ − 3452
/**
+ − 3453
* Cancel method, returns KErrNone
+ − 3454
*/
+ − 3455
TInt CSimPacketContext::CreateNewTFTCancel(const TTsyReqHandle aTsyReqHandle)
+ − 3456
{
+ − 3457
iCreateTftTimer->Cancel();
+ − 3458
+ − 3459
ReqCompleted(aTsyReqHandle, KErrCancel);
+ − 3460
+ − 3461
return KErrNone;
+ − 3462
}
+ − 3463
+ − 3464
/**
+ − 3465
* Cancel method, returns KErrNone
+ − 3466
*/
+ − 3467
TInt CSimPacketContext::DeleteTFTCancel(const TTsyReqHandle /*aTsyReqHandle*/)
+ − 3468
{
+ − 3469
return KErrNone;
+ − 3470
}
+ − 3471
+ − 3472
/**
+ − 3473
* Cancel method, returns KErrNone
+ − 3474
*/
+ − 3475
TInt CSimPacketContext::RemovePacketFilterCancel(const TTsyReqHandle /*aTsyReqHandle*/)
+ − 3476
{
+ − 3477
return KErrNone;
+ − 3478
}
+ − 3479
+ − 3480
/**
+ − 3481
* Cancel method, returns KErrNone
+ − 3482
*/
+ − 3483
TInt CSimPacketContext::ModifyActiveContextCancel(const TTsyReqHandle /*aTsyReqHandle*/)
+ − 3484
{
+ − 3485
return KErrNone;
+ − 3486
}
+ − 3487
+ − 3488
/**
+ − 3489
* Cancel method, returns KErrNone
+ − 3490
*/
+ − 3491
TInt CSimPacketContext::InitialiseContextCancel(const TTsyReqHandle aTsyReqHandle)
+ − 3492
{
+ − 3493
iInitContextTimer->Cancel();
+ − 3494
+ − 3495
ReqCompleted(aTsyReqHandle, KErrCancel);
+ − 3496
+ − 3497
return KErrNone;
+ − 3498
}
+ − 3499
+ − 3500
CSimPacketContext::TCommSetupItem CSimPacketContext::FindCommSettings()
+ − 3501
{
+ − 3502
TInt count=iCommSetupArray->Count();
+ − 3503
TCommSetupItem def;
+ − 3504
+ − 3505
//Do a default initialization.
+ − 3506
def.iCsyName.Copy(KDefaultCsyName);
+ − 3507
def.iPortName.Copy(KDefaultPortName);
+ − 3508
def.iConfig.iRate=KDefaultCommPortRate;
+ − 3509
def.iConfig.iHandshake=KDefaultHandshake;
+ − 3510
def.iContextName=KDefaultSetting;
+ − 3511
def.iCommReset = EFalse;
+ − 3512
def.iNumInitializeFailures = 0;
+ − 3513
def.iErrorCode = KErrNone;
+ − 3514
def.iDelay = 0;
+ − 3515
+ − 3516
for(TInt i=0; i<count; i++)
+ − 3517
{
+ − 3518
TCommSetupItem comm = iCommSetupArray->At(i);
+ − 3519
if(comm.iContextName.Compare(iContextName)==KErrNone)
+ − 3520
return comm;
+ − 3521
if(comm.iContextName.Compare(KDefaultSetting)==KErrNone)
+ − 3522
def=comm;
+ − 3523
}
+ − 3524
return def;
+ − 3525
}
+ − 3526
+ − 3527
TName CSimPacketContext::ContextName() const
+ − 3528
{
+ − 3529
return iContextName;
+ − 3530
}
+ − 3531
+ − 3532
TInt CSimPacketContext::GetDnsInfo(const TTsyReqHandle aTsyReqHandle, const TDesC8* aDnsInfo)
+ − 3533
{
+ − 3534
/**
+ − 3535
* GetDnsInfo method to extract DNS server names from context
+ − 3536
*
+ − 3537
* @param aStatus TRequestStatus object with which error code is returned
+ − 3538
* @param aDnsInfo packaged TDnsInfoV2 object passed as TDes8
+ − 3539
*
+ − 3540
* GetDNSInfo() is needed when the client uses dynamic IPv4 PDP addresses.
+ − 3541
* After the context is activated the client needs to know the actual primary
+ − 3542
* and secondary DNS addresses to use when sending packet data. As the network
+ − 3543
* may have supplied these addresses there is a need for an API method to get
+ − 3544
* these addresses from the TSY.
+ − 3545
*/
+ − 3546
RPacketContext::TTDnsInfoV2Pckg* dnsInfoV2Pckg = (RPacketContext::TTDnsInfoV2Pckg*)aDnsInfo;
+ − 3547
RPacketContext::TDnsInfoV2& dnsInfoV2 = (*dnsInfoV2Pckg)();
+ − 3548
+ − 3549
// Check that the data structure is supported by the simulated TSY version
+ − 3550
TInt err = iPhone->CheckSimTsyVersion(dnsInfoV2);
+ − 3551
if(err != KErrNone)
+ − 3552
{
+ − 3553
iPhone->ReqCompleted(aTsyReqHandle, err);
+ − 3554
return KErrNone;
+ − 3555
}
+ − 3556
+ − 3557
TContextConfigParam config = iContextConfigParams->At(iContextConfigParamsIndex);
+ − 3558
+ − 3559
dnsInfoV2.iPrimaryDns.Copy(config.iProtocolConfigOption.iPrimaryDNS);
+ − 3560
dnsInfoV2.iSecondaryDns.Copy(config.iProtocolConfigOption.iSecondaryDNS);
+ − 3561
+ − 3562
ReqCompleted(aTsyReqHandle,KErrNone);
+ − 3563
return KErrNone;
+ − 3564
}
+ − 3565
+ − 3566
TInt CSimPacketContext::GetDnsInfoCancel(const TTsyReqHandle /*aTsyReqHandle*/)
+ − 3567
/**
+ − 3568
* GetDnsInfoCancel - Cancels an asynchronous GetDnsInfo method.
+ − 3569
*/
+ − 3570
{
+ − 3571
return KErrNone;
+ − 3572
}
+ − 3573
+ − 3574
TInt CSimPacketContext::GetAddMediaAuthorization(const TTsyReqHandle aTsyReqHandle, TDes8* aBuffer)
+ − 3575
/**
+ − 3576
* GetAddMediaAuthorization method to verify provided media authorization and return desired result
+ − 3577
*
+ − 3578
* @param aTsyReqHandle The request handle for completing the request
+ − 3579
* @param aBuffer Packaged CTFTMediaAuthorizationV3 object passed as TDes8
+ − 3580
*
+ − 3581
* GetAddMediaAuthorization() checks the provided media authorization against a predefined authorization
+ − 3582
* set up from the configuration file. If the authorization is valid the function will return the desired
+ − 3583
* response, also set up from the configuration file. If there is a mismatch between authorizations, KErrCorrupt
+ − 3584
* returned.
+ − 3585
*/
+ − 3586
{
+ − 3587
TBool validMediaAuthorization = TRUE;
+ − 3588
RPacketContext::CTFTMediaAuthorizationV3* mediaAuthV3 = NULL;
+ − 3589
+ − 3590
// Check that the data structure is supported by the simulated TSY version
+ − 3591
TInt err = iPhone->CheckSimTsyVersion(*mediaAuthV3);
+ − 3592
if(err != KErrNone)
+ − 3593
{
+ − 3594
iPhone->ReqCompleted(aTsyReqHandle, err);
+ − 3595
return KErrNone;
+ − 3596
}
+ − 3597
+ − 3598
TRAPD(ret, mediaAuthV3 = RPacketContext::CTFTMediaAuthorizationV3::NewL());
+ − 3599
if (ret != KErrNone)
+ − 3600
{
+ − 3601
LOGPACKET1("CSimPacketContext::GetAddMediaAuthorization NewL call fail");
+ − 3602
return ret;
+ − 3603
}
+ − 3604
+ − 3605
TRAP(ret, mediaAuthV3->InternalizeL(*aBuffer) );
+ − 3606
if (ret != KErrNone)
+ − 3607
{
+ − 3608
delete mediaAuthV3;
+ − 3609
LOGPACKET1("CSimPacketContext::GetAddMediaAuthorization InternalizeL call fail");
+ − 3610
return ret;
+ − 3611
}
+ − 3612
+ − 3613
for (TUint i=0; i<iAuthorizationTokenResponse->Count(); i++)
+ − 3614
{
+ − 3615
if (!(mediaAuthV3->iAuthorizationToken).Compare(iAuthorizationTokenResponse->At(i).iAuthorizationToken))
+ − 3616
{
+ − 3617
for (TUint j=0; j<iMediaAuthorization->At(i).iFlowIds.Count(); j++)
+ − 3618
{
+ − 3619
if ((mediaAuthV3->iFlowIds[j].iMediaComponentNumber != iMediaAuthorization->At(i).iFlowIds[j].iMediaComponentNumber) ||
+ − 3620
(mediaAuthV3->iFlowIds[j].iIPFlowNumber != iMediaAuthorization->At(i).iFlowIds[j].iIPFlowNumber))
+ − 3621
{
+ − 3622
validMediaAuthorization = FALSE;
+ − 3623
}
+ − 3624
}
+ − 3625
if (validMediaAuthorization)
+ − 3626
{
+ − 3627
ReqCompleted(aTsyReqHandle,iAuthorizationTokenResponse->At(i).iResponse);
+ − 3628
delete mediaAuthV3;
+ − 3629
return KErrNone;
+ − 3630
}
+ − 3631
}
+ − 3632
}
+ − 3633
+ − 3634
// No match found, respond with corrupted
+ − 3635
ReqCompleted(aTsyReqHandle,KErrCorrupt);
+ − 3636
delete mediaAuthV3;
+ − 3637
+ − 3638
return KErrNone;
+ − 3639
}
+ − 3640
+ − 3641
TInt CSimPacketContext::GetRemoveMediaAuthorization(const TTsyReqHandle aTsyReqHandle, RPacketContext::TAuthorizationToken* aAuthorizationToken)
+ − 3642
/**
+ − 3643
* GetRemoveMediaAuthorization method to verify provided media authorization and return desired result
+ − 3644
*
+ − 3645
* @param aTsyReqHandle The request handle for completing the request
+ − 3646
* @param aAuthorizationToken Authorization token to be checked
+ − 3647
*
+ − 3648
* GetRemoveMediaAuthorization() checks the provided authorization token against predefined tokens and responses
+ − 3649
* from config file. If a match is found the associated desired response is returned, otherwise KErrCorrupt is reported.
+ − 3650
*/
+ − 3651
{
+ − 3652
for (TUint i=0; i<iAuthorizationTokenResponse->Count(); i++)
+ − 3653
{
+ − 3654
if (!((*aAuthorizationToken).Compare(iAuthorizationTokenResponse->At(i).iAuthorizationToken)))
+ − 3655
{
+ − 3656
ReqCompleted(aTsyReqHandle,iAuthorizationTokenResponse->At(i).iResponse);
+ − 3657
return KErrNone;
+ − 3658
}
+ − 3659
}
+ − 3660
+ − 3661
// No match found, respond with corrupted
+ − 3662
ReqCompleted(aTsyReqHandle,KErrCorrupt);
+ − 3663
return KErrNone;
+ − 3664
}
+ − 3665
+ − 3666
TInt CSimPacketContext::GetAddMediaAuthorizationCancel(const TTsyReqHandle /*aTsyReqHandle*/)
+ − 3667
/**
+ − 3668
* Cancel method, returns KErrNone
+ − 3669
*/
+ − 3670
{
+ − 3671
return KErrNone;
+ − 3672
}
+ − 3673
+ − 3674
TInt CSimPacketContext::GetRemoveMediaAuthorizationCancel(const TTsyReqHandle /*aTsyReqHandle*/)
+ − 3675
/**
+ − 3676
* Cancel method, returns KErrNone
+ − 3677
*/
+ − 3678
{
+ − 3679
return KErrNone;
+ − 3680
}
+ − 3681
+ − 3682