telephonyserverplugins/simtsy/inc/CSimPacketService.h
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2001-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 Service class.  
       
    15 // It defines a Simulated packet-switched connection to a packet (GPRS and CDMA) network.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalAll
       
    22 */
       
    23 
       
    24 #ifndef __CSIMPACKETSERVICE_H__
       
    25 #define __CSIMPACKETSERVICE_H__
       
    26 
       
    27 #include <et_phone.h>
       
    28 #include <etelpckt.h>
       
    29 #include <testconfigfileparser.h>
       
    30 #include "csimtimer.h"
       
    31 #include "utils.h"
       
    32 #include "CSimPubSubChange.h"
       
    33 
       
    34 #include "CSimPacketContext.h"
       
    35 #include "CSimMbmsPacketContext.h"
       
    36 #include "mbmstypes.h"
       
    37 #include "pcktlist.h"
       
    38 
       
    39 const TInt KMaxContextPoolSize = 11;
       
    40 const TInt KGranularity = 2;
       
    41 const TInt KMaxMbmsContextSupportedByPhone = 7;
       
    42 const TInt KMaxMbmsContextSupportedByNetwork = 5;
       
    43 const TInt KMaxMbmsActiveContexts =10;
       
    44 const TInt KMaxMbmsMonitorContexts =15;
       
    45 
       
    46 enum TPacketEvent  //< Emum for the state machine
       
    47 	{
       
    48 	EPacketEventNone,
       
    49 	EPacketEventAttach,
       
    50 	EPacketEventDetach,
       
    51 	EPacketEventTimeOut
       
    52 	};
       
    53 
       
    54 
       
    55 const RPacketService::TStatus KPacketStateTableTerminator=(RPacketService::TStatus)999;
       
    56 
       
    57 struct TPacketStateChangeValidity			// Enum for packet state
       
    58 	{
       
    59 	RPacketService::TStatus iOldState;
       
    60 	RPacketService::TStatus iNewState;
       
    61 	TInt iError;
       
    62 	};
       
    63 
       
    64 //< This table is used to ensure that the TSY state changes are as accurate as possibly
       
    65 //< It makes sure that there is no state irregularities and the TSY does not skip any state.
       
    66 //< Returns KErrNone for a valid change state request (3rd column).
       
    67 const struct TPacketStateChangeValidity KPacketStateChangeValidity[]= {
       
    68 	{ RPacketService::EStatusUnattached,	RPacketService::EStatusAttached,	KErrNone },
       
    69 	
       
    70 	{ RPacketService::EStatusAttached,		RPacketService::EStatusActive,	KErrNone },
       
    71 	{ RPacketService::EStatusAttached,		RPacketService::EStatusUnattached,	KErrNone },
       
    72 
       
    73 	{ RPacketService::EStatusActive,		RPacketService::EStatusSuspended,	KErrNone },
       
    74 	{ RPacketService::EStatusActive,		RPacketService::EStatusAttached,	KErrNone },
       
    75 	{ RPacketService::EStatusActive,		RPacketService::EStatusUnattached,	KErrNone },
       
    76 	
       
    77 	{ RPacketService::EStatusSuspended,		RPacketService::EStatusUnattached,	KErrNone },
       
    78 	{ RPacketService::EStatusSuspended,		RPacketService::EStatusAttached,	KErrNone },
       
    79 	{ RPacketService::EStatusSuspended,		RPacketService::EStatusActive,		KErrNone },
       
    80 
       
    81 	{ KPacketStateTableTerminator,			KPacketStateTableTerminator,		KPacketStateTableTerminator}
       
    82 	};
       
    83 
       
    84 struct TDefaultGPRSConfigParam  //< Used for holding the default GPRS configuration parameters
       
    85 	{
       
    86 	TInt	iProtocolType;
       
    87 	TPtrC8	iGsnAddress;
       
    88 	TPtrC8	iProtocolAddress;
       
    89 	TUint	iPdpCompression;
       
    90 	TInt	iAnonymousAccess;
       
    91 	TBool	iUseEdge;
       
    92 	TProtocolConfigOption iProtocolConfigOption;
       
    93 	};
       
    94 
       
    95 struct TDefaultR99_R4ConfigParam	//< Used for holding the default Release99/4 configuration parameters
       
    96 	{
       
    97 	TInt	iProtocolType;
       
    98 	TPtrC8	iGsnAddress;
       
    99 	TPtrC8	iProtocolAddress;
       
   100 	TBool	iUseEdge;
       
   101 	TProtocolConfigOption iProtocolConfigOption;
       
   102 	};
       
   103 
       
   104 struct TDefaultR5ConfigParam		//< Used for holding the default Release 5 configuration parameters
       
   105 	{
       
   106 	TInt	iProtocolType;
       
   107 	TPtrC8	iGsnAddress;
       
   108 	TPtrC8	iProtocolAddress;
       
   109 	TInt	iAnonymousAccess;
       
   110 	TBool	iUseEdge;
       
   111 	TProtocolConfigOption iProtocolConfigOption;
       
   112 	TUint	iPdpHeaderCompression;
       
   113 	TUint	iPdpDataCompression;
       
   114 	};
       
   115 
       
   116 
       
   117 class TConfigData
       
   118 	{
       
   119 public:
       
   120 	static TInt Find(CArrayFixFlat<TConfigData>* aConfigArray,
       
   121 					 TTsyReqHandle aTsyReqHandle,
       
   122 					 TInt& aIndex);
       
   123 	TTsyReqHandle iTsyReqHandle;
       
   124 	TDes8* iData;
       
   125 	};
       
   126 
       
   127 
       
   128 class CSimPhone;
       
   129 class CSimIncomingContextManager;
       
   130 
       
   131 class CSimPacketService : public CSubSessionExtBase, public MTimerCallBack, public MPSSimObserver, public MPubSubChangeCallback
       
   132 	{
       
   133 	friend CSimPacketContext::~CSimPacketContext();
       
   134 	friend CSimMbmsPacketContext::~CSimMbmsPacketContext();
       
   135 
       
   136 public:
       
   137 	static CSimPacketService* NewL(CSimPhone* aPhone);
       
   138 	CSimPacketService(CSimPhone* aPhone);
       
   139 	void ConstructL();
       
   140 	~CSimPacketService();
       
   141 
       
   142 	virtual TInt ExtFunc(const TTsyReqHandle aTsyReqHandle,const TInt aIpc,const TDataPackage& aPackage);
       
   143 	virtual TReqMode ReqModeL(const TInt aIpc);
       
   144 	virtual CTelObject* OpenNewObjectByNameL(const TDesC& aName);
       
   145 	virtual CTelObject* OpenNewObjectL(TDes& aNewName);
       
   146 	virtual TInt CancelService(const TInt aIpc, const TTsyReqHandle aTsyReqHandle);
       
   147 	virtual void Init();
       
   148 	virtual TInt RegisterNotification(const TInt aIpc);
       
   149 	virtual TInt DeregisterNotification(const TInt aIpc);
       
   150 	virtual TInt NumberOfSlotsL(const TInt aIpc);
       
   151 	virtual RHandleBase* GlobalKernelObjectHandle();
       
   152 
       
   153 	CSimPhone* PhonePtr() const;  //< Returns a pointer to the phone object (iPhone)
       
   154 	TInt ChangeState(RPacketService::TStatus aNewState); //< Changes the state of the packetservice
       
   155 	const CTestConfigSection* CfgFile(); //< Returns a pointer to a section of the configuration file
       
   156 
       
   157 	TInt GetCurrentReleaseMode(const TTsyReqHandle aTsyReqHandle, RPacketService::TPacketReleaseMode* aReleaseMode);
       
   158 	TInt NotifyReleaseModeChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TPacketReleaseMode* aReleaseMode);
       
   159 
       
   160 	TInt EnumerateNifs(const TTsyReqHandle aTsyReqHandle, TInt& aCount);
       
   161 	TInt GetNifInfo(const TTsyReqHandle aTsyReqHandle, TInt aIndex, TDes8* aNifInfoV01);
       
   162 	TInt EnumerateContextsInNif(const TTsyReqHandle aTsyReqHandle, const TDesC* aExistingContextName, TInt& aCount);
       
   163 	TInt GetContextNameInNif(const TTsyReqHandle aTsyReqHandle, const TDesC* aExistingContextName, TInt aIndex, TDes* aContextName);
       
   164 
       
   165 	TInt GetCurrentReleaseModeCancel(const TTsyReqHandle aTsyReqHandle);
       
   166 	TInt NotifyReleaseModeChangeCancel(const TTsyReqHandle aTsyReqHandle);
       
   167 
       
   168 	TInt EnumerateNifsCancel(const TTsyReqHandle aTsyReqHandle);
       
   169 	TInt GetNifInfoCancel(const TTsyReqHandle aTsyReqHandle);
       
   170 	TInt EnumerateContextsInNifCancel(const TTsyReqHandle aTsyReqHandle);
       
   171 	TInt GetContextNameInNifCancel(const TTsyReqHandle aTsyReqHandle);
       
   172 	
       
   173 	void DecrementContextCount();
       
   174 	void DecrementMbmsContextCount();
       
   175 	
       
   176 	virtual void SimPSEvent(const CSimPubSub::TPubSubProperty aProperty, TInt aStatus);
       
   177 	virtual void PubSubCallback(TInt aIndex);
       
   178 private:
       
   179 	//< The Packet API methods implemented by the TSY
       
   180 	//< These will be called from the ExtFunc method above
       
   181 	TInt NotifyContextAdded(const TTsyReqHandle aTsyReqHandle, TDes* aContextId);
       
   182 	TInt NotifyContextAddedCancel(const TTsyReqHandle aTsyReqHandle);
       
   183 
       
   184 	TInt Attach(const TTsyReqHandle aTsyReqHandle);	
       
   185 	TInt AttachCancel(const TTsyReqHandle aTsyReqHandle);	
       
   186 
       
   187 	TInt Detach(const TTsyReqHandle aTsyReqHandle);	
       
   188 	TInt DetachCancel(const TTsyReqHandle aTsyReqHandle);	
       
   189 
       
   190 	TInt DoDetach();
       
   191 
       
   192 	TInt GetStatus(const TTsyReqHandle aTsyReqHandle,RPacketService::TStatus* aStatus);
       
   193 	TInt NotifyStatusChange(const TTsyReqHandle aTsyReqHandle,RPacketService::TStatus* aStatus);
       
   194 	TInt NotifyStatusChangeCancel(const TTsyReqHandle aTsyReqHandle);
       
   195 
       
   196 	TInt NotifyContextActivationRequested(const TTsyReqHandle aTsyReqHandle, TDes8* aContextParameters);
       
   197 	TInt NotifyContextActivationRequestedCancel(const TTsyReqHandle aTsyReqHandle);
       
   198 
       
   199 	TInt RejectActivationRequest(const TTsyReqHandle aTsyReqHandle);
       
   200 	TInt RejectActivationRequestCancel(const TTsyReqHandle aTsyReqHandle);
       
   201 
       
   202 	TInt EnumerateContexts(const TTsyReqHandle aTsyReqHandle,TInt* aCount, TInt* aMaxAllowed);
       
   203 	TInt EnumerateContextsCancel(const TTsyReqHandle aTsyReqHandle);
       
   204 	
       
   205 	TInt GetContextInfo(const TTsyReqHandle aTsyReqHandle,TInt* aIndex,RPacketService::TContextInfo* aInfo);
       
   206 	TInt GetContextInfoCancel(const TTsyReqHandle aTsyReqHandle);
       
   207 
       
   208 	TInt GetNtwkRegStatus(const TTsyReqHandle aTsyReqHandle,RPacketService::TRegistrationStatus* aRegistrationStatus);
       
   209 	TInt NotifyChangeOfNtwkRegStatus(const TTsyReqHandle aTsyReqHandle,RPacketService::TRegistrationStatus* aRegistrationStatus);
       
   210 	TInt NotifyChangeOfNtwkRegStatusCancel(const TTsyReqHandle aTsyReqHandle);
       
   211 
       
   212 	TInt GetMSClass(const TTsyReqHandle aTsyReqHandle, RPacketService::TMSClass* aCurrentClass, RPacketService::TMSClass* aMaxClass);
       
   213 	TInt GetMSClassCancel(const TTsyReqHandle aTsyReqHandle);
       
   214 
       
   215 	TInt SetMSClass(const TTsyReqHandle aTsyReqHandle, RPacketService::TMSClass* aClass);
       
   216 	TInt SetMSClassCancel(const TTsyReqHandle aTsyReqHandle);
       
   217 
       
   218 	TInt NotifyMSClassChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TMSClass* aNewClass);
       
   219 	TInt NotifyMSClassChangeCancel(const TTsyReqHandle aTsyReqHandle);
       
   220 
       
   221 	TInt GetStaticCaps(const TTsyReqHandle aTsyReqHandle, TUint* aCaps, RPacketContext::TProtocolType* aPdpType);
       
   222 
       
   223 	TInt GetDynamicCaps(const TTsyReqHandle aTsyReqHandle, RPacketService::TDynamicCapsFlags* aCaps);
       
   224 	TInt NotifyDynamicCapsChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TDynamicCapsFlags* aCaps);
       
   225 	TInt NotifyDynamicCapsChangeCancel(const TTsyReqHandle aTsyReqHandle);
       
   226 
       
   227 	TInt SetAttachMode(const TTsyReqHandle aTsyReqHandle, RPacketService::TAttachMode* aMode);
       
   228 	TInt GetAttachMode(const TTsyReqHandle aTsyReqHandle, RPacketService::TAttachMode* aMode);
       
   229 	TInt NotifyAttachModeChange(const TTsyReqHandle aTsyReqHandle, RPacketService::TAttachMode* aMode);
       
   230 	TInt NotifyAttachModeChangeCancel(const TTsyReqHandle aTsyReqHandle);
       
   231 
       
   232 	TInt SetDefaultContextParams(const TTsyReqHandle aTsyReqHandle, const TDesC8* aPckg);
       
   233 	TInt GetDefaultContextParams(const TTsyReqHandle aTsyReqHandle, TDes8* aPckg);
       
   234 	TInt GetGPRSDefaultContextParams(const TTsyReqHandle aTsyReqHandle, TDes8* aPckg);
       
   235 	
       
   236 	/* MBMS related APIs starts here*/
       
   237 	
       
   238 	TInt GetMbmsNetworkServiceStatus(const TTsyReqHandle aTsyReqHandle, TBool aAttemptAttach,TMbmsNetworkServiceStatus* aStatus);
       
   239 	TInt GetMbmsNetworkServiceStatusCancel(const TTsyReqHandle aTsyReqHandle);
       
   240 
       
   241 	TInt NotifyMbmsNetworkServiceStatusChange(const TTsyReqHandle aTsyReqHandle, TMbmsNetworkServiceStatus* aStatus);
       
   242 	TInt NotifyMbmsNetworkServiceStatusChangeCancel(const TTsyReqHandle aTsyReqHandle);
       
   243 	
       
   244 	TInt NotifyMbmsServiceAvailabilityChange(const TTsyReqHandle aTsyReqHandle);
       
   245 	TInt NotifyMbmsServiceAvailabilityChangeCancel(const TTsyReqHandle aTsyReqHandle);
       
   246 	
       
   247 	TInt UpdateMbmsMonitorServiceListL(const TTsyReqHandle aTsyReqHandle,TMbmsAction* aAction, TDes8* aBuffer=NULL);
       
   248 	TInt UpdateMbmsMonitorServiceListCancel(const TTsyReqHandle aTsyReqHandle);
       
   249 	
       
   250 	TInt EnumerateMbmsActiveServiceList(const TTsyReqHandle aTsyReqHandle, TInt* aCount, TInt* aMaxAllowed);
       
   251 	TInt EnumerateMbmsActiveServiceListCancel(const TTsyReqHandle aTsyReqHandle);
       
   252 	
       
   253 	TInt EnumerateMbmsMonitorServiceList(const TTsyReqHandle aTsyReqHandle, TInt* aCount, TInt* aMaxAllowed);
       
   254 	TInt EnumerateMbmsMonitorServiceListCancel(const TTsyReqHandle aTsyReqHandle);
       
   255 
       
   256 	/* MBMS related APIs ends here*/
       
   257 		
       
   258 	TInt ActionEvent(TPacketEvent aEvent);	//< The state machine for this class
       
   259 	virtual void TimerCallBack(TInt aId);	//< Timer Callback for the timeout events
       
   260 	void TimerCallBackPcktRegStatus();
       
   261 	void TimerCallBackReleaseMode();
       
   262 	void TimerCallBackNtwkRegStatus();
       
   263 	void TimerCallBackDeactivate();
       
   264 	void TimerCallBackDynamicCaps();
       
   265 	
       
   266 	void CompleteNtwkRegStatus(RPacketService::TRegistrationStatus aRegistrationStatus);
       
   267 	
       
   268 	TInt GetMbmsMonitoredServicesListPhase1(const TTsyReqHandle aTsyReqHandle, TClientId* aClient, TInt* aBufSize);
       
   269 	TInt ProcessGetMbmsMonitoredServicesListPhase1L(const TTsyReqHandle aTsyReqHandle, TClientId* aClient, TInt* aBufSize);
       
   270 	TInt GetMbmsMonitoredServicesListPhase2(const TTsyReqHandle aTsyReqHandle, TClientId* aClient, TDes8* aBufSize);
       
   271 	TInt GetMbmsMonitoredServicesListCancel(const TTsyReqHandle aTsyReqHandle);
       
   272 	
       
   273 	
       
   274 private: // Data
       
   275 	CSimPhone* iPhone;		//< Pointer to the phone object (The parent of this class)
       
   276 	TInt iContextCount;		//< Number of contexts currently opened
       
   277 	TInt iMbmsContextCount;	//< Number of MBMS contexts currently opened
       
   278 	TInt iMbmsContextNameInc; //< Used for Appending a number to the mbms context name "MBMS_CONTEXT"
       
   279 	TInt iPrimaryContextNameInc;	//< Used for Appending a number to the packet name "PRIMARY_PACKET_CONTEXT" 
       
   280 							//< to give each packet object opened a unique name
       
   281 	TInt iSecondaryContextNameInc;	//< Used for Appending a number to the packet name "SECONDARY_PACKET_CONTEXT" 
       
   282 							//< to give each packet object opened a unique name
       
   283 
       
   284 	RPacketService::TStatus iState;		//< Holds the current state of the packet service
       
   285 	RPacketService::TAttachMode iAttachMode; //< Attach mode for the packet service
       
   286 	RPacketService::TMSClass iMSClass;  //< We only support class B
       
   287 	
       
   288 	TTsyReqHandle iAttachRequestHandle;		//< The request handle for the attach request
       
   289 	TInt iAttachPause;		//< duration spent in attaching to network state
       
   290 	TInt iAttachFail;		//< Fail the attach request with this error
       
   291 
       
   292 	TTsyReqHandle iDetachRequestHandle; //< The request handle for the detach request
       
   293 	TInt iDetachPause;		//< duration spent in detaching from the network
       
   294 	TInt iDetachFail;		//< Fail the detach request with this error
       
   295 
       
   296 	TPacketEvent iCurrentEvent;	//< Holds the current event being processed (allows the tsy to cancel the request)
       
   297 	TNotifyData	iNotifyStatusChange;	//< Holds the notification data (a flag, TsyReqHandle and any raw data) 
       
   298 	TNotifyData iNotifyContextAdded;	//< Registers a client interest in being notified of a context being added to the network
       
   299 
       
   300 	TNotifyData	iNotifyChangeOfNtwk;	//< Registers a client interest in a change of network notification
       
   301 	TNotifyData	iNotifyMSClassChange;	//< Registers a client interest in a change of MSClass
       
   302 	
       
   303 	TNotifyData iNotifyChangeOfReleaseMode;
       
   304 	TNotifyData iNotifyChangeOfAttachMode;	//< Registers client interest in change of attach mode
       
   305 	
       
   306 	TNotifyData iNotifyMbmsNetworkStatusChange; //<Holds the notification data for the changes in the MBMS network status
       
   307 	TNotifyData iNotifyMbmsServAvailChange; //<Holds the notification data for the changes in the MBMS network service availability
       
   308 	
       
   309 	CSimPubSub::TPubSubProperty iNtwkRegStatusChangeProperty;
       
   310 	CSimPubSub *iNtwkRegStatusChange;
       
   311 	
       
   312 	CSimPubSubChange* iMbmsActivation;
       
   313 	
       
   314 	TNotifyData iNotifyDynamicCapsChange;	//< Registers client interest in change of Phone capabilities
       
   315 
       
   316 	CSimTimer* iPcktRegTimer;		//< Timer for the Packet registration
       
   317 	CSimTimer* iNtwkRegTimer;		//< Timer for the Network registration
       
   318 	CSimTimer* iReleaseModeTimer;	//< Timer for the Release mode
       
   319 	CSimTimer* iDynamicCapsTimer;   //< Timer for the Dynamic caps change simulation
       
   320 	CSimTimer* iTimer;	//< Pointer to the Timer object for callback
       
   321 	CSimTimer* iMbmsPcktTimer; //<Timer for the MBMS related Network information
       
   322 	RMutex iMutex;
       
   323 
       
   324 	struct TPacketRegStatus
       
   325 		{
       
   326 		TInt iDuration;				//< Duration of Registration Status
       
   327 		RPacketService::TStatus iStatus;	//< Registration Status that will be maintained through period iDuration
       
   328 		};
       
   329 
       
   330 	struct TNtwkRegStatus
       
   331 		{
       
   332 		TInt iDuration;				//< Duration of Registration Status
       
   333 		RPacketService::TRegistrationStatus iRegStatus;	//< Registration Status that will be maintained through period iDuration
       
   334 		};
       
   335 
       
   336 	struct TPacketReleaseMode
       
   337 		{
       
   338 		TInt iDuration;
       
   339 		TInt iReleaseMode;
       
   340 		};
       
   341 
       
   342 	struct TPacketDynamicCaps
       
   343 		{
       
   344 		TInt iDuration;				//< Duration of dynamic caps value
       
   345 		RPacketService::TDynamicCapsFlags iDynamicCaps;	//< Dynamic Caps value that will be maintained through period iDuration
       
   346 		};
       
   347 	
       
   348 	struct TMbmsBroadCastParams
       
   349 		{
       
   350 		TInt iDuration;
       
   351 		TMbmsNetworkServiceStatus iMbmsNetworkStatus;
       
   352 		};
       
   353 	
       
   354 	struct TMbmsMonitorListParams
       
   355 		{
       
   356 		TInt iDuration;
       
   357 		TUint16 iMCC;
       
   358 		TUint16 iMNC;
       
   359 		TUint iServiceId;
       
   360 		TMbmsScope iAccessBearer;
       
   361 		TMbmsServiceMode iServiceMode;
       
   362 		TMbmsAvailabilityStatus iAvailStatus;
       
   363 		TBool iIsEntryValid;
       
   364 		};
       
   365 
       
   366 	CArrayFixFlat<TPacketRegStatus>* iPcktRegStatusInfo;	//< List of packet registration changes.
       
   367 	TNotificationType iNtwkRegStatusNotificationType;
       
   368 	CArrayFixFlat<TNtwkRegStatus>*	 iNtwkRegStatusInfo;	// list of ntwk registration changes.
       
   369 	CArrayFixFlat<TPacketReleaseMode>* iPacketReleaseModeArray;
       
   370 	CArrayFixFlat<TPacketDynamicCaps>* iDynamicCapsArray; //< List of dynamic capabilities changes
       
   371 	CArrayFixFlat<TInt>* iSecondaryContextCountArray;
       
   372 	CArrayFixFlat<TMbmsBroadCastParams>* iMbmsBroadcastParamsArray; //List of MBMS Broadcast Service related information
       
   373 	CArrayFixFlat<TMbmsMonitorListParams>* iMbmsMonitorListParamsArray; // List of MBMS Broadcast Monitoring list parameters
       
   374 	CArrayPtrFlat<CPcktListReadAllAttempt>* iMbmsServicesList; // List containing the MBMS services for 2P retrieval
       
   375 
       
   376 	TInt iCurrentMbmsParamsIndex;
       
   377 	TInt iCurrentMbmsMonitorListIndex;
       
   378 	TInt iCurrentPacketReleaseMode;
       
   379 	TInt iPacketReleaseModeIndex;
       
   380 	TInt iCurrentDynamicCaps;
       
   381 	TInt iDynamicCapsIndex;
       
   382 	TInt iPcktRegStatIndex;					//< Current index from the iPcktRegStatInfo array
       
   383 	TInt iCurrentRegStatus;
       
   384 	TInt iNtwkRegStatIndex;					//< Current index from the iNtwkRegStatInfo array
       
   385 	TInt iUpdateMbmsServiceError;
       
   386 	TBool iPcktTimerBool;
       
   387 	
       
   388 	TTsyReqHandle iGetMbmsNetworkReqHandle;
       
   389 	TTsyReqHandle iEnumerateActiveListReqHandle;
       
   390 	TTsyReqHandle iEnumerateMonitorListReqHandle;
       
   391 	TTsyReqHandle iUpdateMbmsServiceReqHandle;
       
   392 
       
   393 	TDefaultGPRSConfigParam iGPRSDefaultConfig;
       
   394 	TDefaultR99_R4ConfigParam iR99_R4DefaultConfig;
       
   395 	TDefaultR5ConfigParam iR5DefaultConfig;
       
   396 
       
   397 	TBool iSecondaryContext;
       
   398 	TInt PrepareOpenSecondary(const TTsyReqHandle aTsyReqHandle, const TDesC* aOriginalContextName);
       
   399 	TInt iCurrentPrimaryContextIndex;
       
   400 
       
   401 	// this class is to enable a Nif to hold and access its contexts and its primary context's name
       
   402 	
       
   403 	// The above statement appears to be totally wrong and misleading.
       
   404 	// It has nothing to do with NIF's, it is just a way of partitioning PDP. 
       
   405 	// The 1st in the context is the primary context, the next contexts are the secondary contexts.
       
   406 	class TNifWrapper
       
   407 	{
       
   408 		private:
       
   409 			RPointerArray<CSimPacketContext> iContexts;	// this contains an array of CSimPacketContexts
       
   410 			TName iPrimaryContextName;				// the primary context name
       
   411 
       
   412 		public:
       
   413 			CSimPacketContext* GetContext(TInt aIndex)
       
   414 			{
       
   415 			return iContexts[aIndex];										// returns context at specified context
       
   416 			}; // returns the context at the specified index
       
   417 			//TArray<CSimPacketContext*> Array(){ return iContexts.Array();};		// returns the array of contexts
       
   418 			inline TInt NumberOfContexts() {return iContexts.Count();};			// returns number of contexts
       
   419 			inline void AddContext(CSimPacketContext* aContext) {iContexts.Append(aContext);};	// adds a context to the array
       
   420 			inline void Close()
       
   421 				{
       
   422 				// deletes contexts of nif
       
   423 				TInt count = iContexts.Count();
       
   424 				for(TInt i = 0; i<count; i++)
       
   425 					{
       
   426 					iContexts[i]->Close();
       
   427 					}
       
   428 				iContexts.Close();
       
   429 				};
       
   430 	};
       
   431 	
       
   432 	class TMbmsNifWrapper
       
   433 	{
       
   434 		private:
       
   435 			RPointerArray<CSimMbmsPacketContext> iContexts;	// this contains an array of CSimMbmsPacketContexts
       
   436 			TName iContextName;				// the MBMS packet context name
       
   437 
       
   438 		public:
       
   439 			inline CSimMbmsPacketContext* GetContext(TInt aIndex);
       
   440 			inline TInt NumberOfContexts(); 
       
   441 			inline void AddContext(CSimMbmsPacketContext* aContext);
       
   442 			inline void Close();
       
   443 	};
       
   444 
       
   445 	RArray<TNifWrapper> iNifWrappers;			// array of nifs; each nif holds a primary context and a number of secondary contexts
       
   446 	RArray<TMbmsNifWrapper> iMbmsNifWrappers; //array of MBMS nifs; each nif holds a MBMS broadcast contexts;
       
   447 											// shall be used for multicast contexts in future.
       
   448 	TConfigData iConfigData;
       
   449 	TInt iMbmsMonitorListCount;  //count of number of Monitor list
       
   450 			
       
   451 	CSimIncomingContextManager* iIncomingContextManager;
       
   452 		// Holds data to do with the incoming contexts.
       
   453 		// Note all messages come through RPacketService via SimPSEvent
       
   454 		// This applies to incoming, and network registration.
       
   455 	
       
   456 public:
       
   457 	inline RPacketService::TMSClass MSClass() const {return iMSClass; } //< Returns the Current MSClass object supported
       
   458 	};
       
   459 
       
   460 CSimMbmsPacketContext* CSimPacketService::TMbmsNifWrapper::GetContext(TInt aIndex)
       
   461 	{
       
   462 	return iContexts[aIndex];					// returns context at specified index
       
   463 	}; 
       
   464 
       
   465 TInt CSimPacketService::TMbmsNifWrapper::NumberOfContexts()
       
   466 	{// returns number of contexts
       
   467 	return iContexts.Count();
       
   468 	}
       
   469 
       
   470 void CSimPacketService::TMbmsNifWrapper::AddContext(CSimMbmsPacketContext* aContext)
       
   471 	{// adds a context to the array
       
   472 	iContexts.Append(aContext);
       
   473 	}
       
   474 
       
   475 void CSimPacketService::TMbmsNifWrapper::Close()
       
   476 	{
       
   477 	// deletes contexts of nif
       
   478 	TInt count = iContexts.Count();
       
   479 	for(TInt i = 0; i<count; i++)
       
   480 		{
       
   481 		iContexts[i]->Close();
       
   482 		}
       
   483 	iContexts.Close();
       
   484 	}
       
   485 
       
   486 #endif  //__CSIMPACKETSERVICE_H__