telephonyserverplugins/simtsy/inc/CSimPacketContext.h
changeset 0 3553901f7fa8
child 3 962e6306d9d2
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     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 definitions of the Simulator TSY Packet Context class.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalAll
       
    21 */
       
    22 
       
    23 #ifndef __CSIMPACKETCONTEXT_H__
       
    24 #define __CSIMPACKETCONTEXT_H__
       
    25 
       
    26 #include <et_phone.h>
       
    27 #include <etelpckt.h>
       
    28 #include <testconfigfileparser.h>
       
    29 #include "csimtimer.h"
       
    30 #include "utils.h"
       
    31 #include "CSimNtras.h"
       
    32 #include "CSimPubSubChange.h"
       
    33 #include "CSimPhone.h"
       
    34 #include <ctsy/serviceapi/cmmutility.h>
       
    35 
       
    36 const TUint KNotFound=0xfffffff;
       
    37 
       
    38 enum TContextEvent //< Enum for the state machine
       
    39 	{
       
    40 	EContextEventNone,
       
    41 	EContextEventActivate,
       
    42 	EContextEventDeactivate,
       
    43 	EContextEventDoDeactivate,
       
    44 	EContextEventSuspend,
       
    45 	EContextEventDelete,
       
    46 	EContextEventNtRas,
       
    47 	EContextEventTimeOut
       
    48 	};	
       
    49 
       
    50 const RPacketContext::TContextStatus KContextStateTableTerminator=(RPacketContext::TContextStatus)999;
       
    51 
       
    52 struct TContextStateChangeValidity
       
    53 	{
       
    54 	RPacketContext::TContextStatus iOldState;
       
    55 	RPacketContext::TContextStatus iNewState;
       
    56 	TInt iError;
       
    57 	};
       
    58 
       
    59 //< This table is used to ensure that the TSY state changes are as accurate as possibly
       
    60 //< It makes sure that there is no state irregularities and the TSY does not skip any state.
       
    61 //< Returns KErrNone for a valid change state request (3rd column).
       
    62 const struct TContextStateChangeValidity	KContextStateChangeValidity[]= {
       
    63 	{ RPacketContext::EStatusInactive,		RPacketContext::EStatusActivating,	KErrNone },
       
    64 	{ RPacketContext::EStatusInactive,		RPacketContext::EStatusDeleted,	KErrNone },
       
    65 
       
    66 	{ RPacketContext::EStatusActivating,	RPacketContext::EStatusActive,		KErrNone },
       
    67 	{ RPacketContext::EStatusActivating,	RPacketContext::EStatusInactive,	KErrNone },
       
    68 	{ RPacketContext::EStatusActivating,	RPacketContext::EStatusDeleted,	KErrNone },
       
    69 	
       
    70 	{ RPacketContext::EStatusActive,		RPacketContext::EStatusDeactivating, KErrNone },
       
    71 	{ RPacketContext::EStatusActive,		RPacketContext::EStatusSuspended,	KErrNone },
       
    72 	{ RPacketContext::EStatusActive,		RPacketContext::EStatusDeleted,	KErrNone },
       
    73 
       
    74 	{ RPacketContext::EStatusDeactivating,	RPacketContext::EStatusInactive,	KErrNone },
       
    75 	{ RPacketContext::EStatusDeactivating,	RPacketContext::EStatusActive,		KErrNone },
       
    76 	{ RPacketContext::EStatusDeactivating,	RPacketContext::EStatusDeleted,	KErrNone },
       
    77 
       
    78 	{ RPacketContext::EStatusSuspended,		RPacketContext::EStatusDeactivating, KErrNone },
       
    79 	{ RPacketContext::EStatusSuspended,		RPacketContext::EStatusActive,		KErrNone },
       
    80 	{ RPacketContext::EStatusSuspended,		RPacketContext::EStatusDeleted,	KErrNone },
       
    81 
       
    82 	{ RPacketContext::EStatusDeleted,		RPacketContext::EStatusInactive,	KErrNone },
       
    83 
       
    84 
       
    85 	{ KContextStateTableTerminator,			KContextStateTableTerminator,		KContextStateTableTerminator}
       
    86 	};
       
    87 
       
    88 
       
    89 struct TProtocolConfigOption	// used for authentication parameters 
       
    90 	{
       
    91 	TInt	iAuthProtocol;
       
    92 	TPtrC8	iUsername;
       
    93 	TPtrC8	iPassword;
       
    94 	TPtrC8	iChallenge;
       
    95 	TPtrC8	iResponse;
       
    96 	TPtrC8	iPrimaryDNS;
       
    97 	TPtrC8	iSecondaryDNS;
       
    98 	TUint	iId;
       
    99 	RPacketContext::TMiscProtocolBuffer iMiscBuffer;
       
   100 	};
       
   101 
       
   102 /**
       
   103 Used for holding valid GPRS/R99/R4/R99/R5 context configuration parameters
       
   104 */
       
   105 struct TContextConfigParam
       
   106 	{
       
   107 	TInt	iProtocolType;
       
   108 	TPtrC8	iGsnAddress;
       
   109 	TPtrC8	iProtocolAddress;
       
   110 	TInt	iAnonymousAccess;
       
   111 	TBool	iUseEdge;
       
   112 	TProtocolConfigOption iProtocolConfigOption;
       
   113 	TUint	iPdpHeaderCompression;
       
   114 	TUint	iPdpDataCompression;
       
   115 	};
       
   116 
       
   117 struct TConfigFail		// Used for failing SetConfig, DeleteTFT, CreateTFT, AddPacketFilter call
       
   118 	{
       
   119 	TName iContextName;
       
   120 	TInt32 iNumberOfTimes;
       
   121 	TInt32 iFailErrorCode;
       
   122 	};
       
   123 	
       
   124 struct TTftConfig
       
   125 	{
       
   126 	TName iContextName;
       
   127 	TInt32 iNumberOfFailures;
       
   128 	TInt32 iFailErrorCode;
       
   129 	TInt32 iDelay;
       
   130 	};
       
   131 
       
   132 struct TRel99ContextConfig		// Used holding the Rel99 configuration parameters
       
   133 	{
       
   134 		TName iContextName;
       
   135 		TUint iActivatePause;
       
   136 		TInt iActivateErrorCode;
       
   137 		TUint iDeactivatePause;
       
   138 		TUint iDeactivateErrorCode;
       
   139 		TUint iDeletionPause;
       
   140 		TUint iDeletionErrorCode;
       
   141 		TBool iConnectToNtRas;
       
   142 	};
       
   143 
       
   144 struct TNetworkRegStatus			// Used for holding the network registration
       
   145 	{
       
   146 		TInt iDuration;				
       
   147 		RPacketService::TRegistrationStatus iRegStatus;
       
   148 	};
       
   149 
       
   150 struct TNotifyContextStatusChange		// Used for notifying context status
       
   151 	{
       
   152 		TName iContextName;
       
   153 		TInt  iDuration;
       
   154 		RPacketContext::TContextStatus iStatus;
       
   155 	};
       
   156 
       
   157 struct TPacketFilterV3					// Used for holding packet filter configuration
       
   158 	{
       
   159 		TInt iId;							//< Packet filter identifier. Value range: 1 - 8
       
   160 		TInt iEvaluationPrecedenceIndex;	//< Evaluation Precedence Index. Value range: 255 (lowest) - 0 (highest)
       
   161 		TUint8 iSrcAddr[RPacketContext::KIPAddressSize];				//< Domain Source address
       
   162 		TUint8 iSrcAddrSubnetMask[RPacketContext::KIPAddressSize];		//< Domain Subnet mask
       
   163 		TInt iProtocolNumberOrNextHeader;	//< Protocol number (IPv4) or Next Header (IPv6) field of incoming packets. Value range 0 - 255
       
   164 		TInt iSrcPortMin;					//< Minimum source port number of incoming packets. Value range 0 - 65 535
       
   165 		TInt iSrcPortMax;					//< Maximum source port number of incoming packets. Value range 0 - 65 535
       
   166 		TInt iDestPortMin;					//< Lowest destination port number of incoming packets. Value range 0 - 65 535
       
   167 		TInt iDestPortMax;					//< Maximum destination port number of incoming packets. Value range 0 - 65 535
       
   168 		TUint32 iIPSecSPI;					//< Security Parameter Index, 32-bit field.
       
   169 		TUint16 iTOSorTrafficClass;			//< Type of Service (IPv4) or Traffic Class (IPv6). 1 octet TOS/Traffic class + 1 octet TOS/Traffic class Mask.
       
   170 		TUint32 iFlowLabel;		
       
   171 		TBool iAdded;
       
   172 		RPacketContext::TPacketFilterType iFilterType;
       
   173 	};
       
   174 
       
   175 struct TAuthorizationTokenResponse  //< Used for SIMTSY responses for authorization tokens
       
   176 	{
       
   177 	RPacketContext::TAuthorizationToken iAuthorizationToken;
       
   178 	TInt iResponse;
       
   179 	};
       
   180 
       
   181 /**
       
   182  * This class is used to hold the details of batch read requests between the first and
       
   183  * second phases of a "two phase read".  During the first phase, an instance of this class
       
   184  * is created containing a unique identifier to the request and the resulting information.
       
   185  * Once the second phase operation has identified this instance from a list and completed
       
   186  * the client request, this instance will be deleted.
       
   187  */
       
   188 class CPcktListReadAllAttempt : public CBase
       
   189 	{
       
   190 public:
       
   191 	static CPcktListReadAllAttempt* NewL(TClientId& aId, TTsyReqHandle aReqHandle);
       
   192 	~CPcktListReadAllAttempt();
       
   193 
       
   194 protected:
       
   195 	CPcktListReadAllAttempt(TClientId& aId, TTsyReqHandle aReqHandle);
       
   196 
       
   197 private:
       
   198 	void ConstructL();
       
   199 
       
   200 public:
       
   201 	CBufBase* iListBuf;					// < The result of the read operation.
       
   202 	TClientId iClient;					// < A unique identifier of the read request.
       
   203 	TTsyReqHandle iReqHandle;			// < The first phase request handle.
       
   204 	};
       
   205 
       
   206 
       
   207 class CSimPacketService;
       
   208 class CSimPacketQoS;
       
   209 class CATDialGPRSData;
       
   210 class CSimPacketContext : public CSubSessionExtBase, public MTimerCallBack, public MNTRasCallBack, public MPubSubChangeCallback
       
   211 	{
       
   212 public:
       
   213 	static CSimPacketContext* NewL(CSimPhone* aPhone, CSimPacketService* aPacketService, const TDesC& aContextName);
       
   214 	CSimPacketContext(CSimPhone* aPhone, CSimPacketService* aPacketService, const TName& aContextName);
       
   215 	void ConstructL();
       
   216 	~CSimPacketContext();
       
   217 
       
   218 	virtual TInt ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,const TDataPackage& aPackage);
       
   219 	virtual TReqMode ReqModeL(const TInt aIpc);
       
   220 	virtual CTelObject* OpenNewObjectByNameL(const TDesC& aName);
       
   221 	virtual CTelObject* OpenNewObjectL(TDes& aNewName);
       
   222 	virtual TInt CancelService(const TInt aIpc, const TTsyReqHandle aTsyReqHandle);
       
   223 	virtual void Init();
       
   224 	virtual TInt RegisterNotification(const TInt aIpc);
       
   225 	virtual TInt DeregisterNotification(const TInt aIpc);
       
   226 	virtual TInt NumberOfSlotsL(const TInt aIpc);
       
   227 
       
   228 	TInt AttemptDeactivateImmediately();
       
   229 	
       
   230 	TInt ChangeState(RPacketContext::TContextStatus aNewState); //< Changes the state of the packetcontext
       
   231 	const CTestConfigSection* CfgFile();
       
   232 	TInt ReActivate(CSimPacketService* aPacketService, const TName& aContextName);
       
   233 
       
   234 	void ConstructPacketFiltersL();
       
   235 
       
   236 	void PubSubCallback(TInt aId);
       
   237 
       
   238 private:
       
   239 	TInt GetProfileName(const TTsyReqHandle aTsyReqHandle, TName* aQoSProfile);
       
   240 
       
   241 	TInt SetConfig(const TTsyReqHandle aTsyReqHandle,const TDesC8* aConfig);
       
   242 	TInt SetConfigCancel(const TTsyReqHandle aTsyReqHandle);
       
   243 
       
   244 	TInt GetConfig(const TTsyReqHandle aTsyReqHandle,TDes8* aConfig);
       
   245 	TInt GetConfigCancel(const TTsyReqHandle aTsyReqHandle);
       
   246 
       
   247 	TInt NotifyConfigChanged(const TTsyReqHandle aTsyReqHandle, TDes8* aConfig);
       
   248 	TInt NotifyConfigChangedCancel(const TTsyReqHandle aTsyReqHandle);
       
   249 
       
   250 	TInt Activate(const TTsyReqHandle aTsyReqHandle);
       
   251 	TInt ActivateCancel(const TTsyReqHandle aTsyReqHandle);
       
   252 
       
   253 	TInt Deactivate(const TTsyReqHandle aTsyReqHandle);
       
   254 	TInt DeactivateCancel(const TTsyReqHandle aTsyReqHandle);
       
   255 
       
   256 	TInt Delete(const TTsyReqHandle aTsyReqHandle);
       
   257 	TInt DeleteCancel(const TTsyReqHandle aTsyReqHandle);
       
   258 
       
   259 	TInt LoanCommPort(const TTsyReqHandle aTsyReqHandle,RCall::TCommPort* aDataPort);
       
   260 	TInt LoanCommPortCancel(const TTsyReqHandle aTsyReqHandle);
       
   261 	TInt RecoverCommPort(const TTsyReqHandle aTsyReqHandle);
       
   262 	TInt RecoverCommPortCancel(const TTsyReqHandle aTsyReqHandle);
       
   263 
       
   264 	TInt GetStatus(const TTsyReqHandle aTsyReqHandle,RPacketContext::TContextStatus* aContextStatus);
       
   265 	TInt NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RPacketContext::TContextStatus* aContextStatus);
       
   266 	TInt NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle);
       
   267 
       
   268 	TInt GetDataVolumeTransferred(const TTsyReqHandle aTsyReqHandle,RPacketContext::TDataVolume* aVolume); 
       
   269 	TInt NotifyDataTransferred(const TTsyReqHandle aTsyReqHandle, RPacketContext::TDataVolume* aVolume, RPacketContext::TNotifyDataTransferredRequest* aData); 
       
   270 	TInt NotifyDataTransferredCancel(const TTsyReqHandle aTsyReqHandle); 
       
   271 
       
   272 	TInt GetLastErrorCause(const TTsyReqHandle aTsyReqHandle,TInt* aError);
       
   273 
       
   274 	IMPORT_C static TInt OpenNewSecondaryContext(CSimPacketService& aPacketService, 
       
   275 												const TDesC& anExistingContextName,
       
   276 												TDes& aNewContextName);
       
   277 
       
   278 	TInt CreateNewTFT(const TTsyReqHandle aTsyReqHandle, const TInt* aSize);
       
   279 	TInt DoCreateNewTFT();
       
   280 	TInt DeleteTFT(const TTsyReqHandle aTsyReqHandle);
       
   281 	TInt EnumeratePacketFilters(const TTsyReqHandle aTsyReqHandle, TInt& aCount);
       
   282 	TInt GetPacketFilterInfoL(const TTsyReqHandle aTsyReqHandle, TInt aIndex, TDes8* aPacketFilterInfo);
       
   283 	TInt AddPacketFilter(const TTsyReqHandle aTsyReqHandle, const TDesC8* aPacketFilterInfo);
       
   284 	TInt RemovePacketFilter(const TTsyReqHandle aTsyReqHandle, TInt aId);
       
   285 	TInt ModifyActiveContext(const TTsyReqHandle aTsyReqHandle);
       
   286 	TInt InitialiseContext(const TTsyReqHandle aTsyReqHandle, TDes8* aDataChannelV2Pckg); // This method supersedes the LoanCommPort() and RecoverCommPort() methods.
       
   287 	TInt DoInitialiseContext();
       
   288 	TInt GetDnsInfo(const TTsyReqHandle aTsyReqHandle, const TDesC8* aDnsInfo);			// retrieves primary and secondary DNS server names
       
   289 	TInt GetAddMediaAuthorization(const TTsyReqHandle aTsyReqHandle, TDes8* aBuffer);
       
   290 	TInt GetRemoveMediaAuthorization(const TTsyReqHandle aTsyReqHandle, RPacketContext::TAuthorizationToken* aAuthorizationToken);
       
   291 	TInt GetAddMediaAuthorizationCancel(const TTsyReqHandle aTsyReqHandle);
       
   292 	TInt GetRemoveMediaAuthorizationCancel(const TTsyReqHandle aTsyReqHandle);
       
   293 
       
   294 	TInt CreateNewTFTCancel(const TTsyReqHandle aTsyReqHandle);
       
   295 	TInt DeleteTFTCancel(const TTsyReqHandle aTsyReqHandle);
       
   296 	TInt EnumeratePacketFiltersCancel(const TTsyReqHandle aTsyReqHandle);
       
   297 	TInt GetPacketFilterInfoCancel(const TTsyReqHandle aTsyReqHandle);
       
   298 	TInt AddPacketFilterCancel(const TTsyReqHandle aTsyReqHandle);
       
   299 	TInt RemovePacketFilterCancel(const TTsyReqHandle aTsyReqHandle);
       
   300 	TInt ModifyActiveContextCancel(const TTsyReqHandle aTsyReqHandle);
       
   301 	TInt InitialiseContextCancel(const TTsyReqHandle aTsyReqHandle); // This method supersedes the LoanCommPort() and RecoverCommPort() methods.
       
   302 	TInt GetDnsInfoCancel(const TTsyReqHandle aTsyReqHandle);
       
   303 	
       
   304 	void TimerCallBackNotifyContextStatusChange();
       
   305 
       
   306 	void CompleteContextStatusChange(RPacketContext::TContextStatus& aStatus);
       
   307 	CSimPubSubChange *iContextStatusChange;
       
   308 
       
   309 private:
       
   310 
       
   311 	CSimPhone* iPhone;
       
   312 
       
   313 	TBool iDeleted;		//< Used to indicate whether this context is deleted or not
       
   314 	TBool iIsActive;	//< Used to indicate whether this context is active as only one 
       
   315 						//< context can be active at any one time.
       
   316 
       
   317 	CSimPacketService* iPacketService;	//< Pointer to the parent class
       
   318 	CSimPacketQoS* iPacketqos;			//< Pointer to the qos associated with this context
       
   319 	CSimNtRas* iNtRas;					//< pointer to the NtRas class that uses ntras to connect to network
       
   320 	TName iContextName;					//< Current Packet context name
       
   321 	TName iQoSName;
       
   322 	CSimTimer* iTimer;					//< pointer to the timer object
       
   323 	CSimTimer* iNotifyContextStatusChangeTimer;
       
   324 	CSimTimer* iNotifyContextConfigChangeTimer;
       
   325 	CSimTimer* iSetConfigTimer;
       
   326 	CSimTimer* iInitContextTimer;
       
   327 	CSimTimer* iCreateTftTimer;
       
   328 
       
   329 	TNotifyData	iNotifyStatusChange;					//< Holds the notification data (a flag, TsyReqHandle and any raw data) 
       
   330 	CArrayFixFlat<TContextConfigParam>* iContextConfigParams;	//< Pointer to a list of valid Context (GPRS/R99/R5) config parameters
       
   331 
       
   332 	CArrayFixFlat<TRel99ContextConfig>* iContextConfigsRel99;
       
   333 	TBool iTFTCreated;
       
   334 	TInt iNumTFTsCreated;
       
   335 	TInt iNumFiltersAdded;
       
   336 	CArrayFixFlat<TPacketFilterV3>* iPacketFilterInfoArray;
       
   337 	TInt GetContextStatusChangeCount();
       
   338 	TNotifyContextStatusChange& GetContextStatusChangeAt(TInt aIndex);
       
   339 	CArrayFixFlat<TNotifyContextStatusChange>* iNotifyContextStatusChangeArray;
       
   340 	CArrayFixFlat<TAuthorizationTokenResponse>* iAuthorizationTokenResponse; //< Holds tokens and desired responses for SIMTSY to report
       
   341 	CArrayFixFlat<RPacketContext::CTFTMediaAuthorizationV3>* iMediaAuthorization; //< Contains authorization token and flow Ids for verification
       
   342 
       
   343 	TInt iContextConfigParamsIndex;						//< index in iContextConfigParams
       
   344 
       
   345 
       
   346 	TNotifyData	iNotifyConfigGPRS;		//< Holds the GPRS context config change notification data (a flag, TsyReqHandle and any raw data) 
       
   347 	TNotifyData	iNotifyConfigR99;		//< Holds the R99 context config changenotification data (a flag, TsyReqHandle and any raw data)
       
   348 	TNotifyData	iNotifyConfigR5;		//< Holds the R5 context config changenotification data (a flag, TsyReqHandle and any raw data)
       
   349 	
       
   350 	TTsyReqHandle iActivateRequestHandle;	//< Request handle used for activating a context
       
   351 	TTsyReqHandle iDeactivateRequestHandle;	//< Request handle used for deactivating a context
       
   352 	TTsyReqHandle iDeleteRequestHandle;		//< Request handle used to complete a delete request
       
   353 	TBool iCommPortLoaned;		//< A flag indicating whether the CommPort is loaned.
       
   354 	TContextEvent iCurrentEvent;			//< holds the current event taking place. 
       
   355 
       
   356 	TInt iActivatePause;		//< duration spent in activating the context
       
   357 	TInt iActivateFail;			//< Fail the activate request with this error
       
   358 	TInt iDeactivatePause;		//< duration spent in deactivating the context
       
   359 	TInt iDeactivateFail;		//< Fail the deactivate request with this error
       
   360 	TInt iDeletePause;			//< duration spent in deleting the context
       
   361 	TInt iDeleteFail;			//< Fail the delete request with this error
       
   362 
       
   363 	TInt iQoSObjectCount;		//< used to append a number to the QoS object created
       
   364 
       
   365 	TConfigFail iSetConfigFail;
       
   366 	TConfigFail iDeleteTftFail;
       
   367 	TTftConfig iCreateTftConfig;
       
   368 	TConfigFail iAddPacketFilter;
       
   369 	
       
   370 	TInt iSetConfigDelay;
       
   371 	
       
   372 	class TNotifyContextConfigChangeData
       
   373 		{
       
   374 		public:
       
   375 		TInt iDelay;
       
   376 		TInt iNewContextConfigIndex;
       
   377 		};
       
   378 	CArrayFixFlat<TNotifyContextConfigChangeData> *iNotifyContextConfigChangeArray;
       
   379 	
       
   380 	class TSetConfigData
       
   381 		{
       
   382 		public:
       
   383 		static TInt Find(CArrayFixFlat<TSetConfigData>* aSetConfigArray, TTsyReqHandle aTsyReqHandle, TInt& aIndex);
       
   384 		TTsyReqHandle iTsyReqHandle;
       
   385 		TDesC8* iData;
       
   386 		};
       
   387 	CArrayFixFlat<TSetConfigData> *iSetConfigData;
       
   388 
       
   389 	class TCreateTftData
       
   390 		{
       
   391 		public:
       
   392 		TTsyReqHandle iTsyReqHandle;
       
   393 		TInt iSize;
       
   394 		};
       
   395 	TCreateTftData iCreateTftData;
       
   396 
       
   397 	TInt iSetConfigCallCount;
       
   398 	TInt iContextType;
       
   399 	TBool iTFTChangeBool;
       
   400 	TBool iCommReset;
       
   401 	TInt iNotifyContextStatusChangeIndex;
       
   402 	RPacketContext::TContextStatus iCurrentNotifyContextStatusChange;
       
   403 	TNotificationType iNotifyContextStatusChangeType;
       
   404 
       
   405 private:
       
   406 	virtual void NTRasCallBack(TInt aStatus);
       
   407 	TInt ActionEvent(TContextEvent aEvent,TInt aStatus);
       
   408 	RPacketService::TStatus ConvertToPacketServiceStatus(RPacketContext::TContextStatus aNewState);
       
   409 
       
   410 	TInt DoActivate();		//< this is where we try to connect to a network using ntras
       
   411 	TInt DoDeactivate();	//< deactivates the context by clossing the comm port
       
   412 	TInt DoDelete();		//< deletes the context
       
   413 
       
   414 	void GetCommSetupSettingsL();
       
   415 	void GetContextConfigParamSettingsL(TPtrC8 aTag);
       
   416 	void GetActivateSettings();
       
   417 	void GetSetConfigSettings();
       
   418 	void GetPacketFilterSettings();
       
   419 	void GetContextConfigRel99SettingsL();
       
   420 	void GetContextStatusChangeSettingsL();
       
   421 	void GetContextConfigChangeSettingsL();
       
   422 
       
   423 public:
       
   424 	TName ContextName() const;
       
   425 	inline TInt ContextType() const {return iContextType;  }
       
   426 	inline RPacketContext::TContextStatus ContextStatus() const {return iState; }
       
   427 	
       
   428 protected:
       
   429 	
       
   430 	RPacketContext::TContextStatus iState;				//< Holds the current state of the packet context
       
   431 
       
   432 	class TCommSetupItem
       
   433 		{
       
   434 		public:
       
   435 			TFileName iCsyName;					//< The CSY name used for comm communication
       
   436 			TCommConfigV01 iConfig;				//< The configuration to be used with the NTRas port.
       
   437 			TName iPortName;					//< The port to be used for read / write data read from the config file.
       
   438 			TName iContextName;
       
   439 			TBool iCommReset;
       
   440 			TInt iNumInitializeFailures;
       
   441 			TInt iErrorCode;
       
   442 			TInt iDelay;
       
   443 		};
       
   444 
       
   445 	class TInitContextData
       
   446 		{
       
   447 		public:
       
   448 		TTsyReqHandle iTsyReqHandle;
       
   449 		TDesC8* iChannel;
       
   450 		};
       
   451 	TInitContextData iInitContextData;
       
   452 	
       
   453 	CArrayFixFlat<TCommSetupItem>* iCommSetupArray;
       
   454 	virtual void TimerCallBack(TInt aId);
       
   455 	TCommSetupItem FindCommSettings();
       
   456 
       
   457 	};
       
   458 
       
   459 #endif