telephonyserver/etelpacketdata/cetel/etelpckt.cpp
changeset 0 3553901f7fa8
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 // ETel Multimode Packet Data API
       
    15 // GPRS Release 97/98, CDMAOne, CDMA2000, Release 99 and Release 4.
       
    16 // 
       
    17 // Copyright (c) Symbian Software Ltd. 2002-2009.  All rights reserved.
       
    18 // 
       
    19 //
       
    20 
       
    21 #include <et_clsvr.h>
       
    22 #include <etelext.h>
       
    23 
       
    24 // Packet Data header files
       
    25 #include "pcktptr.h"
       
    26 #include <pcktcs.h>
       
    27 #include "pcktlist.h"
       
    28 #include "etelpckt.h"
       
    29 
       
    30 
       
    31 // Used by ETel to instruct the TSY to create a name for the newly opened object
       
    32 _LIT(KETelNewContextName, "::");
       
    33 
       
    34 TPacketBase::TPacketBase()
       
    35 	{}
       
    36 
       
    37 EXPORT_C TInt TPacketBase::ExtensionId() const
       
    38 /**
       
    39 	Returns the value of iExtensionId for the associated class.
       
    40 	e.g. iExtensionId=KETelExtPcktV2 for all the V2 classes.
       
    41 
       
    42 	@return The protected data member iExtensionId, which specifies the API version number.
       
    43 
       
    44 */
       
    45 	{
       
    46 	return iExtensionId;
       
    47 	}
       
    48 
       
    49 /***********************************************************************************/
       
    50 //
       
    51 // RPacketContext
       
    52 //
       
    53 /***********************************************************************************/
       
    54 
       
    55 EXPORT_C RPacketContext::RPacketContext()
       
    56 	:iEtelPacketContextPtrHolder(NULL)
       
    57 
       
    58 /** 
       
    59 	Standard constructor. 
       
    60 */
       
    61 	{
       
    62 	}
       
    63 
       
    64 EXPORT_C void RPacketContext::ConstructL()
       
    65 /**
       
    66 	This function creates an instance of CPacketContextPtrHolder and assigns it to the
       
    67 	iEtelPacketContextPtrHolder pointer.
       
    68  
       
    69 */
       
    70 	{
       
    71 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder==NULL,PanicClient(EEtelPanicHandleNotClosed));
       
    72 	iEtelPacketContextPtrHolder = CPacketContextPtrHolder::NewL(CEtelPacketPtrHolder::EMaxNumPacketContextPtrSlots, CEtelPacketPtrHolder::EMaxNumPacketContextPtrCSlots);
       
    73 	}
       
    74 
       
    75 EXPORT_C void RPacketContext::Destruct()
       
    76 /**
       
    77 	This function deletes and NULLs the iEtelPacketContextPtrHolder pointer.
       
    78  
       
    79 */
       
    80 	{
       
    81 	delete iEtelPacketContextPtrHolder;
       
    82 	iEtelPacketContextPtrHolder = NULL;
       
    83 	}
       
    84 
       
    85 EXPORT_C TInt RPacketContext::OpenNewContext(RPacketService& aPacketNetwork,TDes& aContextName)
       
    86 // This function may be called by the client application.
       
    87 /**
       
    88 	Creates a primary PDP context (i.e. RPacketContext) on an existing RPacketService
       
    89 	connection.
       
    90 
       
    91 	There is a global mutex around this method and the RPacketService::OpenNewSecondaryContext()
       
    92 	method. There is a potential problem with an Open function that makes an initial "set-up"
       
    93 	function call - another client could also call OpenNewSecondaryContext() or
       
    94 	OpenNewContext() at the same time, and the wrong client's OpenNewObjectL() will reach the
       
    95 	TSY first. This would mean clients would receive handles to the wrong context!
       
    96 	To avoid this, the API code for both OpenNewContext() and OpenNewSecondaryContext() must
       
    97 	have a shared global mutex around it, so only one client can call either of these two
       
    98 	functions at any one time.
       
    99 	
       
   100 	The TSY will return KErrUmtsMaxNumOfContextExceededByPhone if the number of PDP contexts
       
   101 	supported by the phone is exceeded. The TSY will return KErrUmtsMaxNumOfContextExceededByNetwork
       
   102 	if the number of PDP contexts supported by the network is exceeded.
       
   103 
       
   104 	An opened RPacketContext must be closed explicitly by calling Close() to
       
   105 	prevent a resource (memory) leak.
       
   106 
       
   107 	@param aPacketNetwork An RPacketContext may only be opened from an existing RPacketService
       
   108 	subsession. A client application must therefore pass a reference to their previously
       
   109 	instantiated RPacketService object.
       
   110 
       
   111 	@param aContextName When the new context is created, the TSY will assign it a unique name
       
   112 	and pass this name back to the client using this parameter. The client can use this name to
       
   113 	uniquely identify the particular context.
       
   114 	@return KErrNone if successful, a system-wide error code if not.
       
   115 
       
   116 @capability None
       
   117 */
       
   118 	{
       
   119 	RSessionBase* session=&aPacketNetwork.SessionHandle();
       
   120 	__ASSERT_ALWAYS(session!=NULL,PanicClient(EEtelPanicNullHandle)); // client has no existing session with ETel
       
   121 
       
   122 	TRAPD(ret,ConstructL());
       
   123 	if (ret)
       
   124 		return ret;
       
   125 
       
   126 	TInt subSessionHandle=aPacketNetwork.SubSessionHandle();
       
   127 	__ASSERT_ALWAYS(subSessionHandle!=0,PanicClient(EEtelPanicNullHandle)); // client has no existing sub-session!
       
   128 	TPtrC name(KETelNewContextName); // necessary so that server knows to ask TSY for new name
       
   129 
       
   130 	SetSessionHandle(*session);
       
   131 	
       
   132 	aPacketNetwork.iMutex.Wait();					// wait for access to the mutex	
       
   133 
       
   134 
       
   135 
       
   136 	TIpcArgs args(&name,&aContextName,subSessionHandle);
       
   137 	ret= CreateSubSession(*session,EEtelOpenFromSubSession,args);
       
   138 	
       
   139 	aPacketNetwork.iMutex.Signal();					// Unblock the mutex
       
   140 
       
   141 	if (ret)
       
   142 		Destruct();
       
   143 
       
   144 	return ret;
       
   145 	}
       
   146 
       
   147 EXPORT_C TInt RPacketContext::OpenExistingContext(RPacketService& aPacketNetwork, const TDesC& aContextName)
       
   148 // This function may be called by the client application.
       
   149 /**
       
   150 	Opens a handle on an existing context (RPacketContext) object, either primary or secondary,
       
   151 	identified by a name.
       
   152 	
       
   153 	KErrNotFound is returned if the object does not exist.
       
   154 
       
   155 	An opened RPacketContext must be closed explicitly by calling Close() to
       
   156 	prevent a resource (memory) leak.
       
   157 	
       
   158 	@param aPacketNetwork This identifies the packet network (RPacketService) the particular
       
   159 	context to be opened belongs. All existing contexts must have an RPacketService parent.
       
   160 	
       
   161 	@param aContextName This uniquely identifies to ETel which existing RPacketContext object
       
   162 	the client wants to open. This name was previously assigned by the TSY when the specified
       
   163 	RPacketContext was created, using OpenNewContext().
       
   164 	
       
   165 	@return KErrNone if successful, KErrNotFound if the object does not exist.
       
   166 
       
   167 @capability None
       
   168 */
       
   169 	{
       
   170 	RSessionBase* session=&aPacketNetwork.SessionHandle();
       
   171 	__ASSERT_ALWAYS(session!=NULL,PanicClient(EEtelPanicNullHandle));
       
   172 	TRAPD(ret,ConstructL());
       
   173 	if (ret)
       
   174 		{
       
   175 		Destruct();
       
   176 		return ret;
       
   177 		}
       
   178 	TInt subSessionHandle=aPacketNetwork.SubSessionHandle();
       
   179 	__ASSERT_ALWAYS(subSessionHandle!=0,PanicClient(EEtelPanicNullHandle));
       
   180 	__ASSERT_ALWAYS(aContextName.Length()!=0,PanicClient(KErrBadName));
       
   181 
       
   182 	SetSessionHandle(*session);
       
   183 	TIpcArgs args(&aContextName,TIpcArgs::ENothing,subSessionHandle);
       
   184 	ret = CreateSubSession(*session,EEtelOpenByNameFromSubSession,args);
       
   185 	if (ret)
       
   186 		Destruct();
       
   187 	return ret;
       
   188 	}
       
   189 
       
   190 EXPORT_C void RPacketContext::Close()
       
   191 // This function may be called by the client application.
       
   192 /** Closes the client's current sub-session with ETel. Any outstanding requests
       
   193 	the client may have with ETel (notifications, for example) will be automatically
       
   194 	destroyed by ETel.
       
   195 	
       
   196 	An opened RPacketContext must be closed explicitly by calling Close() to
       
   197 	prevent a resource (memory) leak. 
       
   198 @capability None
       
   199 */
       
   200 	{
       
   201 	CloseSubSession(EEtelClose);
       
   202 	Destruct();
       
   203 	}
       
   204 
       
   205 EXPORT_C void RPacketContext::SetConfig(TRequestStatus& aStatus, const TDesC8& aConfig) const
       
   206 // This function may be called by the client application.
       
   207 /** 
       
   208 	Passes to the TSY all the parameters necessary to configure the particular 
       
   209 	context. The parameters are passed via a packaged TContextConfigGPRS/
       
   210 	TContextConfigCDMA/TContextConfigR99_R4/RPacketMbmsContext::TContextConfigMbmsV1
       
   211 	object depending on the current network mode.
       
   212 	
       
   213 	This is an asynchronous function.
       
   214 	
       
   215 	In the case of this function call, the value for each TContextConfigXXX parameter will be 
       
   216 	input by the client and probably obtained from CommDB. To determine how to correctly unpack 
       
   217 	the descriptor inside the TSY, the TSY must first cast the descriptor to a 
       
   218 	TPacketDataConfigBase pointer and check whether ExtensionId() returns a KConfigGPRS, 
       
   219 	KConfigCDMA,KConfigRel99Rel4 or KConfigMBMS. The TSY will then cast the descriptor to the correct 
       
   220 	TPacketDataConfigBase-derived class.
       
   221 	
       
   222 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextSetConfig) to cancel 
       
   223 	a previously placed asynchronous SetConfig() request.
       
   224 	
       
   225 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   226 	error codes.
       
   227 	@param aConfig A TContextConfigXXX object packaged as a TPckg<TContextConfigXXX>. 
       
   228 
       
   229 @capability WriteDeviceData
       
   230 */
       
   231 	{
       
   232 	Set(EPacketContextSetConfig, aStatus, aConfig);
       
   233 	}
       
   234 
       
   235 EXPORT_C void RPacketContext::GetConfig(TRequestStatus& aStatus, TDes8& aConfig) const
       
   236 // This function may be called by the client application.
       
   237 /** 
       
   238 	Gets the configuration of the current context. 
       
   239 	
       
   240 	This is an asynchronous function.
       
   241 	
       
   242 	In the case of this function call, the value for each TContextConfigXXX parameter will 
       
   243 	be input by the TSY.
       
   244 	
       
   245 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextGetConfig) to cancel 
       
   246 	a previously placed asynchronous GetConfig() request.
       
   247 	
       
   248 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   249 	error codes.
       
   250 	@param aConfig On completion, a TContextConfigXXX context configuration object packaged 
       
   251 	as a TPckg<TContextConfigXXX>.  
       
   252 
       
   253 @capability ReadDeviceData
       
   254 */
       
   255 	{
       
   256 	Get(EPacketContextGetConfig, aStatus, aConfig);
       
   257 	}
       
   258 
       
   259 EXPORT_C void RPacketContext::NotifyConfigChanged(TRequestStatus& aStatus, TDes8& aConfig) const
       
   260 // This function may be called by the client application.
       
   261 // At the RPacketContext level, there are only minor differences between GPRS and UMTS contexts.
       
   262 /**
       
   263 	Allows a client to be notified whenever a change in the current context is 
       
   264 	detected and gets the updated configuration.
       
   265 	
       
   266 	This is an asynchronous function.
       
   267 	
       
   268 	In the case of this function call, the value for each parameter will be input by the TSY.
       
   269 	
       
   270 	It should be noted that once the notification completes, the client must then re-post the 
       
   271 	notification if they wish to continue receiving the notification.
       
   272 	
       
   273 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextNotifyConfigChanged) 
       
   274 	to cancel a previously placed asynchronous NotifyConfigChanged() request.
       
   275 	
       
   276 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   277 	error codes.
       
   278 	@param aConfig On completion, a TContextConfigXXX context configuration object packaged 
       
   279 	as a TPckg<TContextConfigXXX>.
       
   280 
       
   281 @capability ReadDeviceData
       
   282 */
       
   283 	{
       
   284 	Get(EPacketContextNotifyConfigChanged, aStatus, aConfig);
       
   285 	}
       
   286 
       
   287 EXPORT_C void RPacketContext::Activate(TRequestStatus& aStatus) const
       
   288 // This function may be called by the client application.
       
   289 /**
       
   290 	Activates a context that has been previously configured using SetConfig(). 
       
   291 	Once this function completes, the context will remain in an 'Activating' state 
       
   292 	until a layer 2 connection (e.g.: PPP or SLIP) has been successfully negotiated 
       
   293 	between the phone and the packet network gateway. Once the link layer has 
       
   294 	been negotiated, the context can be considered to be 'Activated'.
       
   295 	
       
   296 	This is an asynchronous function.
       
   297 	
       
   298 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextActivate) to cancel 
       
   299 	a previously placed asynchronous Activate() request.
       
   300 	
       
   301 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   302 	error codes.
       
   303 
       
   304 @capability NetworkServices
       
   305 */
       
   306 	{
       
   307 	Blank(EPacketContextActivate,aStatus);
       
   308 	}
       
   309 
       
   310 EXPORT_C void RPacketContext::Deactivate(TRequestStatus& aStatus) const
       
   311 // This function may be called by the client application.
       
   312 /**
       
   313 	Deactivates a context previously configured on the phone.
       
   314 	
       
   315 	This is an asynchronous function.
       
   316 	
       
   317 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextDeactivate) to cancel 
       
   318 	a previously placed asynchronous Deactivate() request.
       
   319 	
       
   320 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide
       
   321 	error codes.
       
   322 
       
   323 @capability NetworkServices
       
   324 */
       
   325 	{
       
   326 	Blank(EPacketContextDeactivate, aStatus);
       
   327 	}
       
   328 
       
   329 EXPORT_C void RPacketContext::Delete(TRequestStatus& aStatus) const
       
   330 /** Deletes a context previously configured on the phone.
       
   331 	
       
   332 	This asynchronous function may be called by the client application.
       
   333 	
       
   334 	Although the context is deleted from the TSY (and/or ME), the client's 
       
   335 	RPacketContext/RPacketMbmsContext subsession remains. 
       
   336 	To remove this, a client must call Close(). 
       
   337 	
       
   338 	This is an asynchronous function.
       
   339 	
       
   340 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextDelete) to cancel 
       
   341 	a previously placed asynchronous Delete() request.
       
   342 	
       
   343 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   344 	error codes.
       
   345 
       
   346 @capability WriteDeviceData
       
   347 */
       
   348 	{
       
   349 	Blank(EPacketContextDelete, aStatus);
       
   350 	}
       
   351 
       
   352 EXPORT_C void RPacketContext::LoanCommPort(TRequestStatus& aStatus, RCall::TCommPort& aDataPort) const
       
   353 /** 
       
   354 	Provides a client with details of the comm port to be used for sending/receiving 
       
   355 	user data in version 1 of the API. This comm port is used by Network Interfaces, NIFs, 
       
   356 	(for example: PPP.NIF) to send and receive data. In a 2-box device this port would generally 
       
   357 	be the same as that used by the TSY to set up and control the connection. 
       
   358 	In a 1-box device this port would generally be different to the port used 
       
   359 	by the TSY to set up and control the connection.
       
   360 	
       
   361 	This asynchronous function may be called by the client application.
       
   362 	
       
   363 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextLoanCommPort) to 
       
   364 	cancel a previously placed asynchronous LoanCommPort() request.
       
   365 	
       
   366 	@deprecated Superceded in v7.0S
       
   367 	
       
   368 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   369 	error codes.
       
   370 	@param aDataPort A reference to a TCommPort class containing information on 
       
   371 	the port, including its name and the associated CSY used to access it. 
       
   372 
       
   373 @capability NetworkServices
       
   374 */
       
   375 	{
       
   376 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   377 
       
   378 	TPtr8& ptr1=iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotDataPort,aDataPort);
       
   379 
       
   380 	Get(EPacketContextLoanCommPort,aStatus,ptr1);
       
   381 	}
       
   382 
       
   383 EXPORT_C void RPacketContext::RecoverCommPort(TRequestStatus& aStatus) const
       
   384 /**
       
   385 	Allows a client, who previously called LoanCommPort(), to inform ETel and hence 
       
   386 	the TSY that it has finished with the comm port, in version 1 of the API.
       
   387 	
       
   388 	This asynchronous function may be called by the client application.
       
   389 	
       
   390 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextRecoverCommPort) 
       
   391 	to cancel a previously placed asynchronous RecoverCommPort() request.
       
   392 	
       
   393 	@deprecated Superceded in v7.0S.
       
   394 	
       
   395 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   396 	error codes.
       
   397 
       
   398 @capability NetworkServices
       
   399 */
       
   400 	{
       
   401 	Blank(EPacketContextRecoverCommPort, aStatus);
       
   402 	}
       
   403 
       
   404 EXPORT_C TInt RPacketContext::GetStatus(TContextStatus& aContextStatus) const
       
   405 /**
       
   406 	Allows a client to get the current status of the context.
       
   407 	
       
   408 	This synchronous function may be called by the client application.
       
   409 	
       
   410 	@param aContextStatus On return, the current status of the context.
       
   411 	@return KErrNone if successful, a system-wide error code if not.
       
   412 
       
   413 @capability None
       
   414 */
       
   415 	{
       
   416 	TPckg<TContextStatus> ptr1(aContextStatus);
       
   417 	return Get(EPacketContextGetStatus, ptr1);
       
   418 	}
       
   419 
       
   420 EXPORT_C void RPacketContext::NotifyStatusChange(TRequestStatus& aStatus,TContextStatus& aContextStatus)
       
   421 // This function may be called by the client application.
       
   422 /**
       
   423 	Allows a client to receive a notification whenever a change in the status of
       
   424 	the context is detected and gets the new context status.
       
   425 	
       
   426 	This is an asynchronous function.
       
   427 	
       
   428 	Once the notification completes, the client must re-post the notification 
       
   429 	if they wish to continue receiving further status change notifications.
       
   430 	
       
   431 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextNotifyStatusChange) 
       
   432 	to cancel a previously placed asynchronous NotifyStatusChange() request.
       
   433 
       
   434 	@param aStatus KErrNone if successful, otherwise another of the system-wide 
       
   435 	error codes.
       
   436 	@param aContextStatus On completion, the new context status.
       
   437 
       
   438 @capability None
       
   439 */
       
   440 	{
       
   441 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   442 
       
   443 	TPtr8& ptr1=iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotContextStatus,aContextStatus);
       
   444 
       
   445 	Get(EPacketContextNotifyStatusChange,aStatus,ptr1);
       
   446 	}	
       
   447 
       
   448 EXPORT_C TInt RPacketContext::GetProfileName(TName& aQoSProfile) const
       
   449 /**
       
   450 	Allows a client to retrieve the name of the Quality of Service profile 
       
   451 	(RPacketQoS) associated with the context.
       
   452 	
       
   453 	This is an synchronous function.
       
   454 	
       
   455 	@param aQoSProfile On return, a reference to the name of the existing QoS 
       
   456 	profile. If no profile has been defined then this name will be NULL.
       
   457 	@return KErrNone if successful, a system-wide error code if not.
       
   458 
       
   459 @capability None
       
   460 */
       
   461 	{
       
   462 	TPckg<TName> ptr1(aQoSProfile);
       
   463 	return Get(EPacketContextGetProfileName, ptr1); 
       
   464 	}
       
   465 
       
   466 EXPORT_C TInt RPacketContext::GetDataVolumeTransferred(TDataVolume& aVolume) const
       
   467 /**
       
   468 	Allows a client to get details on the current amount of data transmitted and 
       
   469 	received over the airlink since the context was activated, in version 1 of the API.
       
   470 	
       
   471 	This synchronous method may be called by the client application.
       
   472 	
       
   473 	@deprecated Use asynchronous version from v7.0S.
       
   474 	@param aVolume On return, a reference to TDataVolume with the current amount 
       
   475 	of data transmitted and received.
       
   476 	@return KErrNone if successful, a system-wide error code if not.
       
   477 
       
   478 @capability ReadUserData
       
   479 */
       
   480 	{
       
   481 	TPckg<TDataVolume> ptr1(aVolume);
       
   482 	return Get(EPacketContextGetDataVolumeTransferred, ptr1);
       
   483 	}
       
   484 
       
   485 EXPORT_C void RPacketContext::GetDataVolumeTransferred(TRequestStatus& aStatus, TDataVolume& aVolume) const
       
   486 //This function may be called by the client.
       
   487 /**
       
   488 	Allows a client to get details on the current amount of data transmitted and received over the airlink 
       
   489 	since the context was activated, for version 2 of this API onwards.
       
   490 	
       
   491 	This is an asynchronous function. Note that the synchronous variant of this method is deprecated.
       
   492 	
       
   493 	Introduced in v7.0S.
       
   494 	
       
   495 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide error codes.
       
   496 	@param aVolume On return, a reference to TDataVolume with the current amount of data transmitted and 
       
   497 	received.
       
   498 
       
   499 @capability ReadUserData
       
   500 */
       
   501 	{
       
   502 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   503 	TPtr8& ptr1 = iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetDataVolumeTransferred, aVolume);
       
   504 	
       
   505 	Get(EPacketContextGetDataVolumeTransferred, aStatus, ptr1);
       
   506 	}
       
   507 
       
   508 EXPORT_C void RPacketContext::NotifyDataTransferred(TRequestStatus& aStatus, TDataVolume& aVolume, TUint aRcvdGranularity,TUint aSentGranularity) const
       
   509 // This function may be called by the client application.
       
   510 /**
       
   511 	Allows a client to be notified of a change in the volume of data transmitted 
       
   512 	and received over the airlink since the context was activated and gets the 
       
   513 	new volume.
       
   514 	
       
   515 	The notification will only complete when the change in volume increases by 
       
   516 	a client-specified amount (granularity). The default granularity for each 
       
   517 	direction (rx/tx) is 4KB. 
       
   518 	
       
   519 	This is an asynchronous function.
       
   520 
       
   521 	Once the notification completes, the client must then re-post the notification 
       
   522 	if they wish to continue receiving further notifications.
       
   523 
       
   524 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextNotifyDataTransferred) 
       
   525 	to cancel a previously placed asynchronous NotifyDataTransferred() request.
       
   526 
       
   527 	@param aStatus KErrNone if successful, otherwise another of the system-wide 
       
   528 	error codes.
       
   529 	@param aVolume On return, a reference to the current amount of data transmitted 
       
   530 	and received.
       
   531 	@param aRcvdGranularity The granularity for the volume of received data.
       
   532 	@param aSentGranularity The granularity for the volume of transmitted data.
       
   533 
       
   534 @capability ReadUserData
       
   535 */
       
   536 	{
       
   537 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   538 	
       
   539 	iEtelPacketContextPtrHolder->iNotifyDataTransferRequest.iRcvdGranularity=aRcvdGranularity;
       
   540 	iEtelPacketContextPtrHolder->iNotifyDataTransferRequest.iSentGranularity=aSentGranularity;
       
   541 
       
   542 	TPtr8& ptr1=iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotDataVolume,aVolume);
       
   543 	TPtr8& ptr2=iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotGranularity,iEtelPacketContextPtrHolder->iNotifyDataTransferRequest);
       
   544 
       
   545 	Get(EPacketContextNotifyDataTransferred, aStatus, ptr1, ptr2);
       
   546 	}
       
   547 
       
   548 EXPORT_C void RPacketContext::GetConnectionSpeed(TRequestStatus& aStatus, TUint& aRate) const
       
   549 // This function may be called by the client application.
       
   550 /**
       
   551 	Gets the current connection speed.
       
   552 	
       
   553 	This is an asynchronous function.
       
   554 
       
   555 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextGetConnectionSpeed) 
       
   556 	to cancel a previously placed asynchronous GetConnectionSpeed() request.
       
   557 
       
   558 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   559 	error codes.
       
   560 	@param aRate On return, the current connection bandwidth in bits per second. 
       
   561 
       
   562 @capability None
       
   563 */
       
   564 	{
       
   565 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   566 	TPtr8& ptr1 = iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetSpeed, aRate);
       
   567 	Get(EPacketContextGetConnectionSpeed, aStatus, ptr1);
       
   568 	}
       
   569 
       
   570 EXPORT_C void RPacketContext::NotifyConnectionSpeedChange(TRequestStatus& aStatus, TUint& aRate) const
       
   571 //This function may be called by the client.
       
   572 /**
       
   573 	Allows a client to be notified whenever the current connection speed changes 
       
   574 	and gets the current connection speed.
       
   575 	
       
   576 	This is an asynchronous function.
       
   577 	
       
   578 	Once the notification completes, the client must then re-post the notification 
       
   579 	if they wish to continue receiving further notifications.
       
   580 	
       
   581 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextNotifyConnectionSpeedChange) 
       
   582 	to cancel a previously placed asynchronous NotifyConnectionSpeedChange() request.
       
   583 	
       
   584 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   585 	error codes.
       
   586 	@param aRate On return, the current connection bandwidth in bits per second.
       
   587 
       
   588 @capability None
       
   589 */
       
   590 	{
       
   591 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   592 	TPtr8& ptr1=iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotNotifySpeed, aRate);
       
   593 	Get(EPacketContextNotifyConnectionSpeedChange, aStatus, ptr1);
       
   594 	}
       
   595 
       
   596 EXPORT_C void RPacketContext::GetConnectionInfo(TRequestStatus& aStatus, TDes8& aInfo) const
       
   597 // This function may be called by the client.
       
   598 /**
       
   599 	Gets the current connection information.
       
   600 	
       
   601 	This is an asynchronous function.
       
   602 	
       
   603 	In the case of this function call, the members of class TConnectionInfoV1 or any later
       
   604 	derived versions supplied by the client will be returned, eg. TConnectionInfoVx.
       
   605 
       
   606 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketContextGetConnectionInfo) 
       
   607 	to cancel a previously placed asynchronous GetConnectionInfo() request.
       
   608 
       
   609 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   610 	error codes.
       
   611 	@param aInfo TConnectionInfoV1 or any later derived versions supplied by the client packaged
       
   612 	as a TPckg<TConnectionInfoVx>.
       
   613 
       
   614 	N.B. only supported if telephony was built with SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW macro
       
   615 @capability None
       
   616 */
       
   617 	{
       
   618 	Get(EPacketContextGetConnectionInfo, aStatus, aInfo);
       
   619 	}
       
   620 	
       
   621 EXPORT_C void RPacketContext::NotifyConnectionInfoChange(TRequestStatus& aStatus, TDes8& aInfo) const
       
   622 // This function may be called by the client.
       
   623 /**
       
   624 	Allows a client to be notified whenever the connection information changes 
       
   625 	and gets the updated connection information.
       
   626 	
       
   627 	This is an asynchronous function.
       
   628 	
       
   629 	Once the notification completes, the client must then re-post the notification 
       
   630 	if they wish to continue receiving further notifications.
       
   631 
       
   632 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide 
       
   633 	error codes.
       
   634 	@param aInfo TConnectionInfoV1 or any later derived versions supplied by the client packaged
       
   635 	as a TPckg<TConnectionInfoVx>.
       
   636 
       
   637 	N.B. only supported if telephony was built with SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW macro
       
   638 @capability None
       
   639 */
       
   640 	{
       
   641 	Get(EPacketContextNotifyConnectionInfoChange, aStatus, aInfo);
       
   642 	}		
       
   643 
       
   644 EXPORT_C TInt RPacketContext::GetLastErrorCause(TInt& aError) const
       
   645 /**
       
   646 	Gets the most recent error to have occurred. This may be used, for instance,
       
   647 	to retrieve which error caused PPP to close down prematurely.
       
   648 	
       
   649 	This function may be called by the client.
       
   650 	
       
   651 	@param aError On return, the last error received or generated by the TSY.
       
   652 	@return KErrNone if successful, a system-wide error code if not.
       
   653 
       
   654 @capability None
       
   655 */
       
   656 	{
       
   657 	TPckg<TInt> ptr1(aError);
       
   658 	return Get(EPacketContextGetLastErrorCause, ptr1);
       
   659 	}
       
   660 
       
   661 EXPORT_C void RPacketContext::InitialiseContext(TRequestStatus& aStatus, TDes8& aDataChannelV2) const
       
   662 //This function may be called by the client.
       
   663 /**
       
   664 	Enables asynchronous resource reservation for a new primary or secondary context at the creation phase,
       
   665 	since version 2 of the API.
       
   666 	
       
   667 	This is an asynchronous function.
       
   668 	
       
   669 	Supersedes the LoanCommPort() and RecoverCommPort() methods, which are now deprecated.
       
   670 	This new method enables asynchronous resource reservation for a new primary or
       
   671 	secondary context at the creation phase.
       
   672 	
       
   673 	The InitialiseContext() method still contains the information that was previously in the
       
   674 	LoanCommPort() method, i.e. details of the comm port to be used for sending/receiving user
       
   675 	data. It however has an additional member which will return any additional information
       
   676 	generated by context creation.
       
   677 	
       
   678 	Introduced in v7.0S
       
   679 	
       
   680 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide
       
   681 	error codes.
       
   682 	@param aDataChannelV2 Reference to a TDataChannelV2 class packaged inside a TPckg<> class.
       
   683 	The TDataChannelV2 class contains the members of the struct used previously by the
       
   684 	deprecated LoanCommPort() method as well as an additional member which will now return
       
   685 	technical information generated when a context is created, for instance, a context name or
       
   686 	id. This name/id is different from that assigned by the TSY when the OpenNewContext() or
       
   687 	OpenNewSecondaryContext() methods are called.
       
   688 
       
   689 @capability NetworkServices
       
   690 */
       
   691  	{
       
   692 	Get(EPacketContextInitialiseContext, aStatus, aDataChannelV2);
       
   693 	}
       
   694 
       
   695 EXPORT_C void RPacketContext::EnumeratePacketFilters(TRequestStatus& aStatus, TInt& aCount) const
       
   696 /**
       
   697 	This asynchronous method may be called by the client application.
       
   698 	It returns the number of defined packet filters in the Traffic Flow Template (TFT) associated
       
   699 	with this context since version 2 of the API.
       
   700 	Supported from v7.0S.
       
   701 	
       
   702 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide error codes.
       
   703 	@param aCount Number of packet filters in the TFT.
       
   704 
       
   705 @capability ReadDeviceData
       
   706 */
       
   707 	{
       
   708 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   709 	TPtr8& ptr1 = iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotEnumeratePacketFilters, aCount);
       
   710 	Get(EPacketContextEnumeratePacketFilters, aStatus, ptr1);
       
   711 	}
       
   712 
       
   713 EXPORT_C void RPacketContext::GetPacketFilterInfo(TRequestStatus& aStatus, TInt aIndex, TDes8& aPacketFilterInfo) const
       
   714 /**
       
   715 	This asynchronous method may be called by the client application.
       
   716 	Retrieves information about the packet filter specified by the aIndex parameter since version 2 of this API.
       
   717 	It is usual to use this function in conjunction with the EnumeratePacketFilters() method,
       
   718 	which returns the current number of defined packet filters in the TFT in its 'aCount' argument.
       
   719 	
       
   720 	Supported from v7.0S
       
   721 	
       
   722 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide error codes.
       
   723 	
       
   724 	@param aIndex Specifies packet filter for which information is to be retrieved.
       
   725 	The valid range for aIndex will be between 0 and (n-1) where n is the number returned in
       
   726 	aCount. If an invalid index is specified the method will return KErrArgument in its aStatus.
       
   727 	
       
   728 	@param aPacketFilterInfo	Reference to a TPacketFilterV2 class packaged inside a TPckg<> class.
       
   729 
       
   730 @capability ReadDeviceData
       
   731 @capability NetworkServices
       
   732 */
       
   733 	{
       
   734 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   735 
       
   736 	iEtelPacketContextPtrHolder->iGetPacketFilterInfoIndex = aIndex;
       
   737 	TPtr8& ptr1=iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetPacketFilterInfo,iEtelPacketContextPtrHolder->iGetPacketFilterInfoIndex);
       
   738 
       
   739 	Get(EPacketContextGetPacketFilterInfo, aStatus, ptr1, aPacketFilterInfo);
       
   740 	}
       
   741 
       
   742 EXPORT_C void RPacketContext::AddPacketFilter(TRequestStatus& aStatus, const TDesC8& aPacketFilterInfo) const
       
   743 /**
       
   744 	This asychronous method may be called by the client application.
       
   745 	It sets up a packet filter in the TFT belonging to this context with the ID specified
       
   746 	in the packet filter information since version 2 of this API.
       
   747 	Supported from v7.0S .
       
   748 	
       
   749 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide error codes.
       
   750 	@param aPacketFilterInfo	Reference to a TPacketFilterV2 class packaged inside a TPckg<> class.
       
   751 
       
   752 @capability WriteDeviceData
       
   753 @capability NetworkServices
       
   754 */
       
   755 	{
       
   756 	Set(EPacketContextAddPacketFilter, aStatus, aPacketFilterInfo);
       
   757 	}
       
   758 
       
   759 EXPORT_C void RPacketContext::RemovePacketFilter(TRequestStatus& aStatus, TInt aId) const
       
   760 /**
       
   761 	This asynchronous method may be called by the client application.
       
   762 	Removes a packet filter from the TFT belonging to this context, since version 2 of the API.
       
   763 	
       
   764 	Supported from v7.0S
       
   765 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide error codes.
       
   766 	@param aId Specifies the packet filter.
       
   767 
       
   768 @capability WriteDeviceData
       
   769 @capability NetworkServices
       
   770 */
       
   771 	{
       
   772 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   773 
       
   774 	iEtelPacketContextPtrHolder->iRemovePacketFilterId = aId;
       
   775 	TPtr8& ptr1=iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotRemovePacketFilter,iEtelPacketContextPtrHolder->iRemovePacketFilterId);
       
   776 
       
   777 	Set(EPacketContextRemovePacketFilter, aStatus, ptr1);
       
   778 	}
       
   779 
       
   780 EXPORT_C void RPacketContext::ModifyActiveContext(TRequestStatus& aStatus) const
       
   781 /**
       
   782 	This asynchronous method may be called by the client application.
       
   783 	It invokes an MS-initiated  modification of an active context in the network since version 2 of the API.
       
   784 	The client must previously have altered either the requested QoS profile of the context
       
   785 	and/or the TFT whilst the context was active before calling this method.
       
   786 	
       
   787 	Supported from v7.0S
       
   788 	
       
   789 	@param aStatus On return, KErrNone if successful, otherwise another of the system-wide error codes.
       
   790 
       
   791 @capability NetworkServices
       
   792 */
       
   793 	{
       
   794 	Blank(EPacketContextModifyActiveContext, aStatus);
       
   795 	}
       
   796 
       
   797 EXPORT_C TInt RPacketContext::OpenNewSecondaryContext(RPacketService& aPacketService, const TDesC& aExistingContextName, TDes& aNewContextName)
       
   798 // This function may be called by the client application.
       
   799 /**
       
   800 	Creates a new secondary context from an existing context (either primary or secondary)
       
   801 	since version 2 of the API.
       
   802 	
       
   803 	The configuration of the existing context is used by the new one so the client need not
       
   804 	call the RPacketContext::SetConfig() method.
       
   805 	
       
   806 	Immediately after the creation of the newly created secondary context, a client must -
       
   807 	a) ensure that they specify the requested QoS using an RPacketQoS object;
       
   808 	b) add a packet filter to the secondary object. This assumes that there already exists a
       
   809 	primary or secondary context for this NIF without a TFT. If this is not the case, it is
       
   810 	not mandatory that a packet filter is added to this new secondary context before activation.
       
   811 	The TSY will return KErrNotSupported if it does not support secondary contexts.
       
   812 	
       
   813 	The TSY will return KErrUmtsMaxNumOfContextExceededByPhone if the number of PDP contexts
       
   814 	supported by the phone is exceeded. The TSY will return KErrUmtsMaxNumOfContextExceededByNetwork
       
   815 	if the number of PDP contexts supported by the network is exceeded.
       
   816 	
       
   817 	There is a global mutex around this method and the RPacketService::OpenNewContext() method.
       
   818 	There is a potential thread timing issue with an Open function that makes an initial "set-up"
       
   819 	function call - another client could also call OpenNewSecondaryContext() or OpenNewContext()
       
   820 	at the same time, and the wrong client's OpenNewObjectL() will reach the TSY first. This would
       
   821 	mean clients would receive handles to the wrong context! To avoid this, the API code for
       
   822 	both OpenNewContext() and OpenNewSecondaryContext() must have a shared global mutex around
       
   823 	it, so only one client can call either of these two functions at any one time.
       
   824 	
       
   825 	@param aPacketService An RPacketContext may only be opened from an existing RPacketService subsession.
       
   826 	A client application must therefore pass a reference to their previously instantiated RPacketService object.
       
   827 	
       
   828 	@param aExistingContextName : Name of the existing context which is to spawn a secondary
       
   829 	context.
       
   830 	
       
   831 	@param aNewContextName : New Secondary context name is assigned by the TSY.
       
   832 
       
   833 @capability None
       
   834 */
       
   835 	{
       
   836 	RSessionBase* session=&aPacketService.SessionHandle();
       
   837 	__ASSERT_ALWAYS(session!=NULL,PanicClient(EEtelPanicNullHandle));
       
   838 	TRAPD(ret,ConstructL());
       
   839 	if (ret)
       
   840 		{
       
   841 		Destruct();
       
   842 		return ret;
       
   843 		}
       
   844 	TInt subSessionHandle=aPacketService.SubSessionHandle();
       
   845 	__ASSERT_ALWAYS(subSessionHandle!=0,PanicClient(EEtelPanicNullHandle));
       
   846 
       
   847 	TPtrC name(KETelNewContextName);	// The server knows to ask the TSY for a new name.
       
   848 
       
   849 	SetSessionHandle(*session);
       
   850 
       
   851 	aPacketService.iMutex.Wait();					// wait for access to the mutex
       
   852 	
       
   853 	TInt retVal=aPacketService.PrepareOpenSecondary(aExistingContextName);
       
   854 
       
   855 	if (retVal)
       
   856 		{		
       
   857 		aPacketService.iMutex.Signal();				// Unblock the mutex
       
   858 		return retVal;
       
   859 		}
       
   860 	TIpcArgs args(&name,&aNewContextName,subSessionHandle);
       
   861 	ret = CreateSubSession(*session,EEtelOpenFromSubSession,args);
       
   862 		
       
   863 	aPacketService.iMutex.Signal();					// Unblock the mutex
       
   864 	
       
   865 	if (ret)
       
   866 		Destruct();
       
   867 
       
   868 	return ret;
       
   869 	}
       
   870 
       
   871 
       
   872 EXPORT_C RPacketContext::TContextConfigGPRS::TContextConfigGPRS()
       
   873 : TPacketDataConfigBase(), iPdpType(EPdpTypeIPv4), iAccessPointName(NULL), iPdpAddress(NULL),
       
   874   iPdpCompression(0), iAnonymousAccessReqd(ENotRequired), iUseEdge(EFalse),
       
   875   iProtocolConfigOption(), iNWIContext(EFalse)
       
   876  /**
       
   877 	Standard constructor. Sets the member data values to the defaults.
       
   878 	This class contains member data compatible with parameters required for configuring a
       
   879 	context on the GPRS and UMTS packet networks. 
       
   880 	
       
   881 	The iExtensionId parameter, set automatically by ETel, is used by the TSY when unpacking this 
       
   882 	class from a TPckg<> to indicate it is to be unpacked as a TContextConfigGPRS class.
       
   883  */
       
   884 	{
       
   885 	iExtensionId = KConfigGPRS;
       
   886 	};
       
   887 	
       
   888 EXPORT_C RPacketContext::TContextConfigR99_R4::TContextConfigR99_R4()
       
   889 : TPacketDataConfigBase(), iPdpType(EPdpTypeIPv4), iAccessPointName(NULL), iPdpAddress(NULL), 
       
   890   iUseEdge(EFalse), iProtocolConfigOption(), iNWIContext(EFalse), iPFI(EBestEffort)
       
   891 /**
       
   892 	Standard constructor. Sets the member data values to the defaults.
       
   893 	
       
   894 	This class contains member data compatible with parameters required for configuring a 
       
   895 	context on the R99/R4 packet networks.	
       
   896 	The iExtensionId parameter, set automatically by ETel, is used by the TSY when unpacking this 
       
   897 	class from a TPckg<> to indicate it is to be unpacked as a TContextConfigR99_R4 class.
       
   898 */
       
   899 	{
       
   900 	iExtensionId = KConfigRel99Rel4;
       
   901 	};
       
   902 	
       
   903 EXPORT_C RPacketContext::TContextConfigCDMA::TContextConfigCDMA()
       
   904 : TPacketDataConfigBase(), iServiceOption(KLowSpeedData), iProtocolType(EPdpTypePPP)
       
   905 /**
       
   906 	Standard constructor. Sets all the member data values to the defaults.
       
   907 	 
       
   908 	The iExtensionId parameter, set automatically by ETel, is used by the TSY when unpacking this 
       
   909 	class from a TPckg<> to indicate it is to be unpacked as a TContextConfigCDMA class.
       
   910 	The Service option is set to KLowSpeedData (Default: Assume IWF/PDSN supports 2G service
       
   911 	option. (exact value of "LowSpeedData" is to be decided by TSY implementation)). 
       
   912 	The Protocol type is set to EPdpTypePPP (Default: Assume IWF/PDSN supports PPP link layer)
       
   913  */
       
   914 	{
       
   915 	iExtensionId = KConfigCDMA;
       
   916 	};
       
   917 
       
   918 EXPORT_C RPacketContext::TConnectionInfoV1::TConnectionInfoV1()
       
   919 : TConnectionInfoBase(), iHSDPACategory(0), iHSUPACategory(0)
       
   920 /**
       
   921 	Standard constructor. Sets the member data values to the defaults.
       
   922 	
       
   923 	This class contains miscellaneous information about packet data connection.
       
   924 
       
   925 	The iExtensionId parameter, set automatically by ETel, is used by the TSY 
       
   926 	when unpacking this class from a TPckg<> to indicate it is to be unpacked 
       
   927 	as a TConnectionInfoV1 class.
       
   928 */
       
   929 	{
       
   930 	iExtensionId = KConnectionInfoV1;
       
   931 	iValid = 0;
       
   932 	};
       
   933 
       
   934 EXPORT_C void RPacketContext::GetDnsInfo(TRequestStatus& aStatus, TDes8& aDnsInfo) const
       
   935 /**
       
   936 	Extracts DNS server names from the context since version 2 of the API.
       
   937 	
       
   938 	Supported from v7.0S.
       
   939 	
       
   940 	@param aStatus TRequestStatus object with which error code is returned
       
   941 	@param aDnsInfo Packaged TDnsInfoV2 object.
       
   942 	
       
   943 	GetDNSInfo() is needed when the client uses dynamic IPv4 PDP addresses. 
       
   944 	After the context is activated the client needs to know the actual primary 
       
   945 	and secondary DNS addresses to use when sending packet data. As the network 
       
   946 	may have supplied these addresses there is a need for an API method to get 
       
   947 	these addresses from the TSY.
       
   948  
       
   949 @capability ReadDeviceData
       
   950 */
       
   951 	{
       
   952 		__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle)); 
       
   953 		Get(EPacketContextGetDNSInfo, aStatus, aDnsInfo);
       
   954 	};
       
   955 
       
   956 
       
   957 EXPORT_C RPacketContext::TDnsInfoV2::TDnsInfoV2()
       
   958 : TPacketBase(), iPrimaryDns(0), iSecondaryDns(0)
       
   959 /**
       
   960 	Standard constructor since version 2 of the API.
       
   961 	
       
   962 	@see KETelExtPcktV2
       
   963 */
       
   964 	{
       
   965 	iExtensionId = KETelExtPcktV2;
       
   966 	}
       
   967 
       
   968 EXPORT_C RPacketContext::TProtocolConfigOptionV2::TProtocolConfigOptionV2()
       
   969 : TPacketBase(), iChallenge(0), iResponse(0), iId(0), iDnsAddresses(),
       
   970   iMiscBuffer(0)
       
   971 /**
       
   972 	Constructor for TProtocolConfigOptionV2 class
       
   973 
       
   974 	This class will hold authentication data encapsulated in TAuthInfo as well as further data that 
       
   975 	may be required for CHAP protocol authentication, such a challenge and response
       
   976 */
       
   977 	{
       
   978 	iExtensionId = KETelExtPcktV2;
       
   979 
       
   980 	//
       
   981 	// Initialise the TAuthInfo structure...
       
   982 	//
       
   983 	iAuthInfo.iProtocol = EProtocolNone;
       
   984 	iAuthInfo.iUsername.Zero();
       
   985 	iAuthInfo.iPassword.Zero();
       
   986 	};
       
   987 
       
   988 EXPORT_C RPacketContext::TDataChannelV2::TDataChannelV2()
       
   989 : TPacketBase(), iCsy(NULL), iPort(NULL), iChannelId(NULL)
       
   990 /**
       
   991 	Standard constructor since version 2 of the API.
       
   992 	
       
   993 	The member data are initialized to NULL. The client should set 
       
   994 	the data to valid values. Note that the iCsy and iPort data 
       
   995 	members are deprecated.
       
   996 */
       
   997 	{
       
   998 	iExtensionId = KETelExtPcktV2;
       
   999 	};
       
  1000 
       
  1001 EXPORT_C RPacketContext::TPacketFilterV2::TPacketFilterV2()
       
  1002 : TPacketBase(), iId(0), iEvaluationPrecedenceIndex(0), iProtocolNumberOrNextHeader(0), iSrcPortMin(0),
       
  1003   iSrcPortMax(0), iDestPortMin(0), iDestPortMax(0), iIPSecSPI(0), iTOSorTrafficClass(0),
       
  1004   iFlowLabel(0)
       
  1005 /**
       
  1006 	Standard constructor since version 2 of the API.
       
  1007 	
       
  1008 	All the member data are initialized to zero. The client should set the required parameters
       
  1009 	to valid values.
       
  1010 	
       
  1011 	Some of the parameters are optional while others are mutually exclusive. Only the Packet 
       
  1012 	filter identifier (iId) and the precedence index (iEvaluationPrecedenceIndex) are 
       
  1013 	mandatory.
       
  1014 */
       
  1015 	{
       
  1016 	iExtensionId = KETelExtPcktV2;
       
  1017 	TInt i;							//< loop variable
       
  1018 
       
  1019 	// Initialize the Domain Source address and Domain Subnet Mask
       
  1020 	for (i=0; i<KIPAddressSize; i++)				
       
  1021 		{
       
  1022 		iSrcAddr[i] = 0;			//< Optional parameter. Zero value implies Not applicable	
       
  1023 		iSrcAddrSubnetMask[i] = 0;	//< Optional parameter. Zero value implies Not applicable
       
  1024 		}
       
  1025 	};
       
  1026 
       
  1027 EXPORT_C void RPacketContext::CreateNewTFT(TRequestStatus& aStatus, const TInt aSize) const
       
  1028 /**
       
  1029 	This asynchronous method may be called by the client application. 
       
  1030 	Creates a new Traffic Flow Template.
       
  1031 	
       
  1032 	@param aStatus TRequestStatus reference, enables asynchronous function call.
       
  1033 	@param aSize Number of filters that the TFT contains.
       
  1034 
       
  1035 @capability NetworkServices
       
  1036 */
       
  1037 	{
       
  1038 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1039 	
       
  1040 	iEtelPacketContextPtrHolder->iCreateTFTSize = aSize;
       
  1041 		
       
  1042 	TPtr8& ptr1=iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotCreateTFT, iEtelPacketContextPtrHolder->iCreateTFTSize);
       
  1043 		
       
  1044 	Set(EPacketContextCreateNewTFT, aStatus, ptr1);	
       
  1045 	}
       
  1046 	
       
  1047 EXPORT_C void RPacketContext::DeleteTFT(TRequestStatus& aStatus) const
       
  1048 /**
       
  1049 	This asynchronous method may be called by the client application. 
       
  1050 	Deletes the existing traffic flow template (including all filters) for this context object.  
       
  1051 	
       
  1052 	@param aStatus TRequestStatus reference, enables asynchronous function call.
       
  1053 
       
  1054 @capability NetworkServices
       
  1055 */
       
  1056 	{		
       
  1057 	Blank(EPacketContextDeleteTFT, aStatus);	
       
  1058 	}
       
  1059 
       
  1060 EXPORT_C RPacketContext::TPacketFilterV3::TPacketFilterV3(TPacketFilterType aType)
       
  1061 		:iType(aType), iAllowedDataBitmap(0), iPresentDataBitmap(0)
       
  1062 /**
       
  1063 	Standard Constructor: Version 3 of the API
       
  1064 	
       
  1065 	iType is set to aType which is passed as parameter and can be of the type EPacketFilterTypeOne,
       
  1066 	EPacketFilterTypeTwo or EPacketFilterTypeThree.
       
  1067 	iPresentDataBitmap is initialised to zero.
       
  1068 	iAllowedDataBitmap is set to a valid combination of TPacketFilterV3DataBitmapPos according to
       
  1069 	aType.
       
  1070 	
       
  1071 	@param aType TPacketFilterType - Can take any of the following values: EPacketFilterTypeOne,
       
  1072 	EPacketFilterTypeTwo or EPacketFilterTypeThree.
       
  1073 */
       
  1074 	{
       
  1075 	iExtensionId = KETelExtPcktV3;
       
  1076 
       
  1077 	iAllowedDataBitmap = EPacketFilterSrcAddr | EPacketFilterSrcAddrSubnetMask;
       
  1078 	switch (iType)
       
  1079 		{
       
  1080 		case EPacketFilterTypeOne:
       
  1081 			{			
       
  1082 			iAllowedDataBitmap|=
       
  1083 				(
       
  1084 				EPacketFilterProtocolNumberOrNextHeader |
       
  1085 				EPacketFilterSrcPortMin | EPacketFilterSrcPortMax | 
       
  1086 				EPacketFilterDestPortMin | EPacketFilterDestPortMax |
       
  1087 				EPacketFilterTOSorTrafficClass
       
  1088 				);
       
  1089 			break;
       
  1090 			}
       
  1091 		case EPacketFilterTypeTwo:
       
  1092 			{
       
  1093 			iAllowedDataBitmap|=
       
  1094 				(			
       
  1095 			 	EPacketFilterProtocolNumberOrNextHeader |				
       
  1096 			 	EPacketFilterIPSecSPI |
       
  1097 				EPacketFilterTOSorTrafficClass 
       
  1098 				);
       
  1099 			break;
       
  1100 			}
       
  1101 		case EPacketFilterTypeThree:
       
  1102 			{
       
  1103 			iAllowedDataBitmap|=
       
  1104 				(				 
       
  1105 				EPacketFilterTOSorTrafficClass |
       
  1106 				EPacketFilterFlowLabel 
       
  1107 				);
       
  1108 			break;
       
  1109 			}
       
  1110 		default:
       
  1111 		 	break;
       
  1112 		}
       
  1113 	}
       
  1114 	
       
  1115 EXPORT_C RPacketContext::TPacketFilterV3::TPacketFilterV3()
       
  1116 		:iType(EPacketFilterTypeUnknown), iAllowedDataBitmap(0), iPresentDataBitmap(0)
       
  1117 /**
       
  1118 	Default Constructor
       
  1119 	
       
  1120 	iType is set to EPacketFilterTypeUnknown
       
  1121 */
       
  1122 	{
       
  1123 		iExtensionId = KETelExtPcktV3;
       
  1124 	}
       
  1125 
       
  1126 EXPORT_C TBool RPacketContext::TPacketFilterV3::SetSrcAddr(TIPAddress &aSrcAddr)
       
  1127 /**
       
  1128 	This method may be called by the client application. 
       
  1129 	Sets the iSrcAddr to a SrcAddr only if a valid combination of bitmap is present.
       
  1130 	
       
  1131 	@param aSrcAddr TIPAddress value to be set.
       
  1132 
       
  1133 */
       
  1134 	{
       
  1135 	if(!(EPacketFilterSrcAddr & iAllowedDataBitmap))
       
  1136 		return EFalse;
       
  1137 	Mem::Copy(iSrcAddr,aSrcAddr,sizeof(TIPAddress));
       
  1138 	iPresentDataBitmap |= EPacketFilterSrcAddr;
       
  1139 	return ETrue;
       
  1140 	}
       
  1141 		
       
  1142 EXPORT_C TBool RPacketContext::TPacketFilterV3::SetSrcAddrSubnetMask(TIPAddress &aSrcAddrSubnetMask)				
       
  1143 /**
       
  1144 	This method may be called by the client application. 
       
  1145 	Sets the iSrcAddrSubnetMask to aSrcAddrSubnetMask only if a valid combination of bitmap is present.
       
  1146 	
       
  1147 	@param aSrcAddrSubnetMask TIPAddress value to be set.
       
  1148 
       
  1149 */
       
  1150 	{
       
  1151 	if(!(EPacketFilterSrcAddrSubnetMask &	iAllowedDataBitmap))
       
  1152 		return EFalse;
       
  1153 	Mem::Copy(iSrcAddrSubnetMask,aSrcAddrSubnetMask,sizeof(TIPAddress));
       
  1154 	iPresentDataBitmap |= EPacketFilterSrcAddrSubnetMask;
       
  1155 	return ETrue;
       
  1156 	}
       
  1157 
       
  1158 EXPORT_C TBool RPacketContext::TPacketFilterV3::SetProtocolNumberOrNextHeader(TInt aProtocolNumberOrNextHeader)
       
  1159 /**
       
  1160 	This method may be called by the client application. 
       
  1161 	Sets the iProtocolNumberOrNextHeader to aProtocolNumberOrNextHeader only if a valid combination of bitmap is present.
       
  1162 	
       
  1163 	@param aProtocolNumberOrNextHeader TInt value to be set.
       
  1164 
       
  1165 */
       
  1166 	{
       
  1167 	if(!(EPacketFilterProtocolNumberOrNextHeader & iAllowedDataBitmap))
       
  1168 		return EFalse;
       
  1169 	iProtocolNumberOrNextHeader=aProtocolNumberOrNextHeader;	
       
  1170 	iPresentDataBitmap |= EPacketFilterProtocolNumberOrNextHeader;
       
  1171 	return ETrue;
       
  1172 	}
       
  1173 		
       
  1174 EXPORT_C TBool RPacketContext::TPacketFilterV3::SetSrcPortMin(TInt aSrcPortMin)					 		
       
  1175 /**
       
  1176 	This method may be called by the client application. 
       
  1177 	Sets the iSrcPortMin to aSrcPortMin only if a valid combination of bitmap is present.
       
  1178 	
       
  1179 	@param aSrcPortMin TInt value to be set.
       
  1180 
       
  1181 */
       
  1182 	{
       
  1183 	if(!(EPacketFilterSrcPortMin & iAllowedDataBitmap))
       
  1184 		return EFalse;
       
  1185 	iSrcPortMin=aSrcPortMin;
       
  1186 	iPresentDataBitmap |= EPacketFilterSrcPortMin;
       
  1187 	return ETrue;
       
  1188 	}
       
  1189 
       
  1190 EXPORT_C TBool RPacketContext::TPacketFilterV3::SetSrcPortMax(TInt aSrcPortMax)
       
  1191 /**
       
  1192 	This method may be called by the client application. 
       
  1193 	Sets the iSrcPortMax to aSrcPortMax only if a valid combination of bitmap is present.
       
  1194 	
       
  1195 	@param aSrcPortMax TInt value to be set.
       
  1196 
       
  1197 */
       
  1198 	{
       
  1199 	if(!(EPacketFilterSrcPortMax & iAllowedDataBitmap))
       
  1200 		return EFalse;
       
  1201 	iSrcPortMax=aSrcPortMax;
       
  1202 	iPresentDataBitmap |= EPacketFilterSrcPortMax;
       
  1203 	return ETrue;
       
  1204 	}
       
  1205 			
       
  1206 EXPORT_C TBool RPacketContext::TPacketFilterV3::SetDestPortMin(TInt aDestPortMin)
       
  1207 /**
       
  1208 	This method may be called by the client application. 
       
  1209 	Sets the iDestPortMin to aDestPortMin only if a valid combination of bitmap is present.
       
  1210 	
       
  1211 	@param aDestPortMin TInt value to be set.
       
  1212 
       
  1213 */
       
  1214 	{
       
  1215 	if(!(EPacketFilterDestPortMin & iAllowedDataBitmap))
       
  1216 		return EFalse;
       
  1217 	iDestPortMin=aDestPortMin;
       
  1218 	iPresentDataBitmap |= EPacketFilterDestPortMin;
       
  1219 	return ETrue;
       
  1220 	}
       
  1221 
       
  1222 EXPORT_C TBool RPacketContext::TPacketFilterV3::SetDestPortMax(TInt aDestPortMax)
       
  1223 /**
       
  1224 	This method may be called by the client application. 
       
  1225 	Sets the iDestPortMax to aDestPortMax only if a valid combination of bitmap is present.
       
  1226 	
       
  1227 	@param aDestPortMax TInt value to be set.
       
  1228 
       
  1229 */					
       
  1230 	{
       
  1231 	if(!(EPacketFilterDestPortMax &	iAllowedDataBitmap))
       
  1232 		return EFalse;
       
  1233 	iDestPortMax=aDestPortMax;
       
  1234 	iPresentDataBitmap |= EPacketFilterDestPortMax;
       
  1235 	return ETrue;
       
  1236 	}
       
  1237 		 	
       
  1238 EXPORT_C TBool RPacketContext::TPacketFilterV3::SetSPI(TUint32 aIPSecSPI)	
       
  1239 /**
       
  1240 	This method may be called by the client application. 
       
  1241 	Sets the iIPSecSPI to aIPSecSPI only if a valid combination of bitmap is present.
       
  1242 	
       
  1243 	@param aIPSecSPI TUint32 value to be set.
       
  1244 
       
  1245 */			
       
  1246 	{
       
  1247 	if(!(EPacketFilterIPSecSPI &	iAllowedDataBitmap))
       
  1248 		return EFalse;
       
  1249 	iIPSecSPI=aIPSecSPI;
       
  1250 	iPresentDataBitmap |= EPacketFilterIPSecSPI;
       
  1251 	return ETrue;
       
  1252 	}
       
  1253 	
       
  1254 EXPORT_C TBool RPacketContext::TPacketFilterV3::SetTOSorTrafficClass(TUint16 aTOSorTrafficClass)
       
  1255 /**
       
  1256 	This method may be called by the client application. 
       
  1257 	Sets the iTOSorTrafficClass to aTOSorTrafficClass only if a valid combination of bitmap is present.
       
  1258 	
       
  1259 	@param aTOSorTrafficClass TUint16 value to be set.
       
  1260 
       
  1261 */
       
  1262 	{
       
  1263 	if(!(EPacketFilterTOSorTrafficClass &	iAllowedDataBitmap))
       
  1264 		return EFalse;
       
  1265 	iTOSorTrafficClass=aTOSorTrafficClass;
       
  1266 	iPresentDataBitmap |= EPacketFilterTOSorTrafficClass;
       
  1267 	return ETrue;
       
  1268 	}
       
  1269 
       
  1270 EXPORT_C TBool RPacketContext::TPacketFilterV3::SetFlowLabel(TUint32 aFlowLabel)
       
  1271 /**
       
  1272 	This method may be called by the client application.
       
  1273 	Sets the iFlowLabel to aFlowLabel only if a valid combination of bitmap is present.
       
  1274 
       
  1275 	@param aFlowLabel TUint32 value to be set.
       
  1276 
       
  1277 */
       
  1278 	{
       
  1279 	if(!(EPacketFilterFlowLabel &	iAllowedDataBitmap))
       
  1280 		return EFalse;
       
  1281 	iFlowLabel=aFlowLabel;
       
  1282 	iPresentDataBitmap|=EPacketFilterFlowLabel ;
       
  1283 	return ETrue;
       
  1284 	}
       
  1285 
       
  1286 RPacketContext::CTFTMediaAuthorizationV3::CTFTMediaAuthorizationV3()
       
  1287 {
       
  1288 	iExtensionId = KETelExtPcktV3;
       
  1289 }
       
  1290 
       
  1291 EXPORT_C RPacketContext::CTFTMediaAuthorizationV3* RPacketContext::CTFTMediaAuthorizationV3::NewL()
       
  1292 {
       
  1293 	CTFTMediaAuthorizationV3* self = new(ELeave) CTFTMediaAuthorizationV3;
       
  1294 	return self;
       
  1295 }
       
  1296 
       
  1297 EXPORT_C RPacketContext::CTFTMediaAuthorizationV3::~CTFTMediaAuthorizationV3()
       
  1298 {
       
  1299 	iFlowIds.Reset();
       
  1300 	iFlowIds.Close();
       
  1301 }
       
  1302 
       
  1303 EXPORT_C void RPacketContext::CTFTMediaAuthorizationV3::ExternalizeL(HBufC8*& aBuffer) const
       
  1304 {
       
  1305 /**
       
  1306 Serialize data to the buffer.
       
  1307 If aBuffer points to already allocated memory, client has to be aware that it won't have
       
  1308 access to this location anymore as method reallocates memory and updates aBuffer accordingly.
       
  1309 Therefore, value passed in should not be freed upon completion of the method neither put onto
       
  1310 the cleanup stack before method is invoked.
       
  1311 
       
  1312 After completion of the API, it's clients responsibility to control life scope
       
  1313 of allocated memory passed back via aBuffer.
       
  1314 
       
  1315 @param aBuffer Heap-based buffer which will contain the serialized data.
       
  1316 */
       
  1317 	TUint uintLen=sizeof(TUint);
       
  1318 	TUint uintLen16 = sizeof(TUint16);
       
  1319 	TUint size= uintLen/* extension id*/ + uintLen /* Authorization Token length*/ + iAuthorizationToken.Length();
       
  1320 	TUint count=iFlowIds.Count();
       
  1321 	size+=uintLen; /** number of iFlowIds elements*/
       
  1322 	size+= count*(uintLen16+uintLen16);
       
  1323 
       
  1324 	if(aBuffer)
       
  1325 		{
       
  1326 	 	delete aBuffer;
       
  1327 	 	aBuffer=NULL;
       
  1328 	 	}
       
  1329 	aBuffer=HBufC8::NewL(size);
       
  1330 	aBuffer->Des().SetLength(size);
       
  1331 
       
  1332 	TInt cursor(0);
       
  1333 
       
  1334 	Mem::Copy(const_cast<TUint8*>(aBuffer->Des().Ptr()+cursor),(const TUint8*)(&iExtensionId),uintLen);
       
  1335 	cursor+=uintLen;
       
  1336 
       
  1337 	TUint len=iAuthorizationToken.Length();
       
  1338 	Mem::Copy(const_cast<TUint8*>(aBuffer->Des().Ptr()+cursor),&len,uintLen);
       
  1339 	cursor+=uintLen;
       
  1340 	Mem::Copy(const_cast<TUint8*>(aBuffer->Des().Ptr()+cursor),iAuthorizationToken.Ptr(),len);
       
  1341 	cursor+=len;
       
  1342 
       
  1343 	Mem::Copy(const_cast<TUint8*>(aBuffer->Des().Ptr()+cursor),(const TUint8* )(&count),uintLen);
       
  1344 	cursor+=uintLen;
       
  1345 
       
  1346 	for(TUint i=0;i<count;i++)
       
  1347 		{
       
  1348 		Mem::Copy((TUint16*)(aBuffer->Des().Ptr()+cursor),(const TUint16* )(&iFlowIds[i].iMediaComponentNumber),uintLen16);
       
  1349 		cursor+=uintLen16;
       
  1350 
       
  1351 		Mem::Copy((TUint16*)(aBuffer->Des().Ptr()+cursor),(const TUint16* )(&iFlowIds[i].iIPFlowNumber),uintLen16);
       
  1352 		cursor+=uintLen16;
       
  1353 		}
       
  1354 
       
  1355 }
       
  1356 
       
  1357 EXPORT_C void RPacketContext::CTFTMediaAuthorizationV3::InternalizeL(TDes8& aBuffer)
       
  1358 {
       
  1359 	iFlowIds.Reset();
       
  1360 
       
  1361 	TUint uintLen=sizeof(TUint);
       
  1362 	TInt cursor=0;
       
  1363 
       
  1364 	if(aBuffer.Length() < cursor + uintLen)
       
  1365 		User::Leave(KErrOverflow);	
       
  1366 
       
  1367 	Mem::Copy(&iExtensionId,aBuffer.Ptr(),uintLen);
       
  1368 	cursor+=uintLen; 
       
  1369 	
       
  1370 	if(aBuffer.Length() < cursor + uintLen)
       
  1371 		User::Leave(KErrOverflow);
       
  1372 
       
  1373 	TInt len(0);
       
  1374 	Mem::Copy(&len,aBuffer.Ptr()+cursor,uintLen);
       
  1375 	cursor+=uintLen;
       
  1376 		
       
  1377 	if(aBuffer.Length() < cursor + len)
       
  1378 		User::Leave(KErrOverflow);
       
  1379 	iAuthorizationToken.Copy(aBuffer.MidTPtr(cursor,len));
       
  1380 	cursor+=len;
       
  1381 
       
  1382 
       
  1383 	if(aBuffer.Length() < cursor + uintLen)
       
  1384 		User::Leave(KErrOverflow);
       
  1385 	TUint count(0);
       
  1386 	Mem::Copy(&count,aBuffer.Ptr()+cursor,uintLen);
       
  1387 	cursor+=uintLen;
       
  1388 
       
  1389 	RPacketContext::CTFTMediaAuthorizationV3::TFlowIdentifier flowIdentifier;
       
  1390 	
       
  1391 	TUint uintLen16 = sizeof(TUint16);
       
  1392 	for(TUint i=0;i<count;i++)
       
  1393 		{
       
  1394 		if(aBuffer.Length() < cursor + uintLen16 + uintLen16)
       
  1395 			User::Leave(KErrOverflow);
       
  1396 		Mem::Copy(&flowIdentifier.iMediaComponentNumber,aBuffer.Ptr()+cursor,uintLen16);
       
  1397 		cursor+=uintLen16;
       
  1398 		Mem::Copy(&flowIdentifier.iIPFlowNumber,aBuffer.Ptr()+cursor,uintLen16);
       
  1399 		cursor+=uintLen16;
       
  1400 		
       
  1401 		iFlowIds.Append(flowIdentifier);
       
  1402 		}
       
  1403 }
       
  1404 	
       
  1405 EXPORT_C TUint RPacketContext::CTFTMediaAuthorizationV3::ExtensionId() const
       
  1406 {
       
  1407 	return iExtensionId;	
       
  1408 }
       
  1409 
       
  1410 EXPORT_C void RPacketContext::AddMediaAuthorizationL(TRequestStatus& aStatus, CTFTMediaAuthorizationV3& aMediaAuthorization) const
       
  1411 /**
       
  1412 	Adds a new set of Authorization Token and Flow Identifiers to the packet context object.
       
  1413 	This asynchronous method may be called by the client application. 
       
  1414 	
       
  1415 	@param aStatus TRequestStatus reference, enables asynchronous function call.
       
  1416 	@param aMediaAuthorization a reference to a CTFTMediaAuthorizationV3 object containing the data that is to be added.
       
  1417 
       
  1418 @capability NetworkServices
       
  1419 @capability WriteDeviceData
       
  1420 */
       
  1421 {
       
  1422 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle)); 
       
  1423 	
       
  1424 	delete iEtelPacketContextPtrHolder->iStoreNetworkBuf;
       
  1425 	iEtelPacketContextPtrHolder->iStoreNetworkBuf = NULL;
       
  1426 		
       
  1427 	aMediaAuthorization.ExternalizeL(iEtelPacketContextPtrHolder->iStoreNetworkBuf);
       
  1428 	
       
  1429 	(iEtelPacketContextPtrHolder->iStoreNetworkPtr).Set((iEtelPacketContextPtrHolder->iStoreNetworkBuf)->Des());
       
  1430 	
       
  1431 	Set(EPacketAddMediaAuthorization,aStatus,iEtelPacketContextPtrHolder->iStoreNetworkPtr);	
       
  1432 	
       
  1433 }
       
  1434 
       
  1435 EXPORT_C void RPacketContext::RemoveMediaAuthorization(TRequestStatus& aStatus, TAuthorizationToken& aAuthorizationToken) const
       
  1436 /**
       
  1437 	Removes the Authorization Token and Flow Identifiers set from the packet context object. This is identified by aAuthorizationToken.
       
  1438 	This asynchronous method may be called by the client application. 
       
  1439 		
       
  1440 	@param aStatus TRequestStatus reference, enables asynchronous function call.
       
  1441 	@param aAuthorizationToken identifier to the Authorization Token that is to be removed.
       
  1442 
       
  1443 @capability NetworkServices
       
  1444 @capability WriteDeviceData
       
  1445 */
       
  1446 {
       
  1447 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1448 
       
  1449 	TPtr8& ptr1=iEtelPacketContextPtrHolder->Set(CEtelPacketPtrHolder::ESlotRemoveMediaAuthorization,aAuthorizationToken);
       
  1450 
       
  1451 	Set(EPacketRemoveMediaAuthorization, aStatus, ptr1);
       
  1452 
       
  1453 }
       
  1454 
       
  1455 EXPORT_C RPacketContext::TContextConfig_R5::TContextConfig_R5()
       
  1456 : TContextConfigR99_R4(), iPdpHeaderCompression(ENoHeaderCompression), iPdpDataCompression(ENoDataCompression)
       
  1457 /**
       
  1458 	Standard constructor. Sets the member data values to the defaults.
       
  1459 	
       
  1460 	This class contains member data compatible with parameters required for configuring a 
       
  1461 	context on the R5 packet networks.	
       
  1462 */
       
  1463 	{
       
  1464 	iExtensionId = KConfigRel5;
       
  1465 	};
       
  1466 	
       
  1467 /***********************************************************************************/
       
  1468 //
       
  1469 // RPacketService
       
  1470 //
       
  1471 /***********************************************************************************/
       
  1472 
       
  1473 EXPORT_C RPacketService::RPacketService()
       
  1474 	:iEtelPacketPtrHolder(NULL)
       
  1475 /** Standard constructor. */
       
  1476 	{
       
  1477 	}
       
  1478 
       
  1479 EXPORT_C void RPacketService::ConstructL()
       
  1480 /**
       
  1481 	ConstructL for the RPacketService class
       
  1482  
       
  1483 @capability None
       
  1484 */
       
  1485 	{
       
  1486 	__ASSERT_ALWAYS(iEtelPacketPtrHolder==NULL,PanicClient(EEtelPanicHandleNotClosed));
       
  1487 	iEtelPacketPtrHolder = CPacketPtrHolder::NewL(CEtelPacketPtrHolder::EMaxNumPacketPtrSlots, CEtelPacketPtrHolder::EMaxNumPacketPtrCSlots);
       
  1488 	}
       
  1489 
       
  1490 EXPORT_C void RPacketService::Destruct()
       
  1491 /**
       
  1492 	Destruct() method for the RPacketService class
       
  1493 
       
  1494 @capability None
       
  1495 */
       
  1496 	{
       
  1497 	delete iEtelPacketPtrHolder;
       
  1498 	iEtelPacketPtrHolder = NULL;
       
  1499 	}	
       
  1500 
       
  1501 EXPORT_C TInt RPacketService::Open(RPhone& aPhone)
       
  1502 // This function may be called by the client.
       
  1503 /**
       
  1504 	Creates a RPacketService subsession from an existing RPhone session.
       
  1505 	
       
  1506 	An opened RPacketService must be closed explicitily by calling Close() to
       
  1507 	prevent a resource (memory) leak.
       
  1508 	
       
  1509 	@param aPhone A reference to an existing RPhone session the client has previously
       
  1510 	created.
       
  1511 	@return KErrNone if successful. 
       
  1512 
       
  1513 @capability None
       
  1514 */
       
  1515 	{
       
  1516 	RSessionBase* session=&aPhone.SessionHandle();
       
  1517 	__ASSERT_ALWAYS(session!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1518 	TInt subSessionHandle=aPhone.SubSessionHandle();
       
  1519 	__ASSERT_ALWAYS(subSessionHandle!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1520 
       
  1521 	TRAPD(ret,ConstructL());
       
  1522 	if (ret)
       
  1523 		return ret;
       
  1524 
       
  1525 	SetSessionHandle(*session);
       
  1526 	TIpcArgs args(&KPacketName,TIpcArgs::ENothing,subSessionHandle);
       
  1527 	ret= CreateSubSession(*session,EEtelOpenFromSubSession,args);		
       
  1528 	
       
  1529 	if (ret)
       
  1530 		{		
       
  1531 		Destruct();
       
  1532 		return ret;
       
  1533 		}
       
  1534 
       
  1535 // initialise synchronisation mutex in EKA2
       
  1536 		TInt mutexHandle= SendReceive(EEtelGlobalKernelObjectHandle);
       
  1537 		if(mutexHandle <=0)
       
  1538 		{
       
  1539 		 Destruct();
       
  1540 		 return KErrBadHandle;
       
  1541 		}
       
  1542 		ret= iMutex.SetReturnedHandle(mutexHandle);
       
  1543 		if( ret != KErrNone)
       
  1544 			Destruct();
       
  1545 
       
  1546 	return ret;	
       
  1547 	}
       
  1548 
       
  1549 EXPORT_C void RPacketService::Close()
       
  1550 // This function may be called by the client.
       
  1551 /**
       
  1552 	Closes the RPacketService subsession.
       
  1553 	
       
  1554 	An opened RPacketService must be closed explicitily by calling Close() to
       
  1555 	prevent a resource (memory) leak.
       
  1556 
       
  1557 @capability None
       
  1558 */
       
  1559 	{
       
  1560 	iMutex.Close();	
       
  1561 	CloseSubSession(EEtelClose);
       
  1562 	Destruct();
       
  1563 	}
       
  1564 
       
  1565 EXPORT_C void RPacketService::NotifyContextAdded(TRequestStatus& aStatus, TDes& aContextId) const
       
  1566 //This function may be called by the client.
       
  1567 /**
       
  1568 	Notifies the client whenever a new context (RPacketContext) is configured 
       
  1569 	on the phone by a client using RPacketContext::SetConfig(). 
       
  1570 	
       
  1571 	This is an asynchronous function.
       
  1572 	
       
  1573 	Once the notification completes, the client must then re-post the notification 
       
  1574 	if they wish to continue receiving further notifications.
       
  1575 	
       
  1576 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketNotifyContextAdded) to cancel 
       
  1577 	a previously placed asynchronous NotifyContextAdded() request.
       
  1578 	
       
  1579 	@param aStatus On completion, KErrNone if successful, a system-wide error 
       
  1580 	code if not.
       
  1581 	@param aContextId On completion, the name of the newly added context. The name 
       
  1582 	is assigned by the TSY and uniquely identifies the particular context.
       
  1583 
       
  1584 @capability None
       
  1585 */
       
  1586 	{
       
  1587 	Get(EPacketNotifyContextAdded,aStatus,aContextId);
       
  1588 	}
       
  1589 
       
  1590 EXPORT_C void RPacketService::Attach(TRequestStatus& aStatus) const
       
  1591 // This function may be called by the client.
       
  1592 /**
       
  1593 	Causes the phone to attempt an attach to the packet network, if it is not already 
       
  1594 	attached.
       
  1595 	
       
  1596 	This is an asynchronous function since attachment may take anything up to one 
       
  1597 	minute in the worst case scenario.
       
  1598 	
       
  1599 	Attachment may take anything up to one minute in the worst case scenario.
       
  1600 	
       
  1601 	It is not often necessary to use this function as there is a separate setting 
       
  1602 	to tell the phone either to attach at start-up, or to attach when a context 
       
  1603 	is created. It is intended that this function only be utilized if the user 
       
  1604 	has an option to choose exactly when to attach and detach.
       
  1605 	
       
  1606 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketAttach) to cancel a previously 
       
  1607 	placed asynchronous Attach() request.
       
  1608 	
       
  1609 	@param aStatus On completion, KErrNone if successful, KErrAlreadyExists if 
       
  1610 	the phone was already attached to a packet network, KErrPacketNetworkFailure 
       
  1611 	if the phone cannot attach.
       
  1612 
       
  1613 @capability NetworkServices
       
  1614 */
       
  1615 	{
       
  1616 	Blank(EPacketAttach,aStatus);
       
  1617 	}
       
  1618 
       
  1619 EXPORT_C void RPacketService::Detach(TRequestStatus& aStatus) const
       
  1620 //This function may be called by the client.
       
  1621 /**
       
  1622 	Causes the phone to attempt to detach from the packet network, if it is not already.
       
  1623 	
       
  1624 	This is an asynchronous function.
       
  1625 	
       
  1626 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketDetach) to cancel a previously 
       
  1627 	placed asynchronous Detach() request.
       
  1628 	
       
  1629 	@param aStatus On completion, KErrNone if successful, KErrAlreadyExists if 
       
  1630 	the phone was already detached, KErrInUse if at least one context is active.
       
  1631 
       
  1632 @capability NetworkServices
       
  1633 */
       
  1634 	{
       
  1635 	Blank(EPacketDetach, aStatus);
       
  1636 	}
       
  1637 
       
  1638 EXPORT_C TInt RPacketService::GetStatus(TStatus& aPacketStatus) const
       
  1639 // This function may be called by the client.
       
  1640 /**
       
  1641 	Gets the status of the current packet service.
       
  1642 	
       
  1643 	This is a synchronous function.
       
  1644 	
       
  1645 	@param aPacketStatus On return, the current packet service status.
       
  1646 	@return KErrNone if successful, otherwise another of the system wide error codes.
       
  1647 
       
  1648 @capability None
       
  1649 */
       
  1650 	{
       
  1651 	TPckg<TStatus> ptr1(aPacketStatus);
       
  1652 	return Get(EPacketGetStatus, ptr1);
       
  1653 	}
       
  1654 
       
  1655 EXPORT_C void RPacketService::NotifyStatusChange(TRequestStatus& aStatus,TStatus& aPacketStatus) const
       
  1656 //This function may be called by the client.
       
  1657 /**
       
  1658 	Allows a client to be notified of a change in the status of the connection 
       
  1659 	to the packet service.
       
  1660 	
       
  1661 	This is an asynchronous function.
       
  1662 	
       
  1663 	Once the notification completes, the client must then re-post the notification 
       
  1664 	if they wish to continue receiving further notifications.
       
  1665 	
       
  1666 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketNotifyStatusChange) to cancel 
       
  1667 	a previously placed asynchronous NotifyStatusChange() request.
       
  1668 	
       
  1669 	@param aStatus On completion, KErrNone if successful, otherwise another of the system wide error codes.
       
  1670 	@param aPacketStatus On completion, the new packet status 
       
  1671 
       
  1672 @capability None
       
  1673 */
       
  1674 	{
       
  1675 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1676 
       
  1677 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotPacketStatus,aPacketStatus);
       
  1678 
       
  1679 	Get(EPacketNotifyStatusChange,aStatus,ptr1);
       
  1680 	}
       
  1681 
       
  1682 EXPORT_C void RPacketService::NotifyContextActivationRequested(TRequestStatus& aStatus, TDes8& aContextParameters) const
       
  1683 /**
       
  1684 	Completes when the phone receives a request from the packet network to activate 
       
  1685 	a PDP context.
       
  1686 	
       
  1687 	This is an asynchronous function.
       
  1688 	
       
  1689 	Depending on the type of network, the aContextParameters may contain the PDP 
       
  1690 	type requested, the PDP address for this context, and possibly the Access 
       
  1691 	Point Name (APN) of the gateway to connect to.
       
  1692 	
       
  1693 	To determine how to correctly unpack the aContextParameters descriptor inside the 
       
  1694 	TSY, the TSY must first cast the descriptor to a TPacketDataConfigBase pointer and 
       
  1695 	check whether ExtensionId() returns KConfigGPRS, KConfigCDMA or KConfigRel99Rel4. 
       
  1696 	The TSY will then cast the descriptor to the correct TPacketDataConfigBase-derived 
       
  1697 	class.
       
  1698 	
       
  1699 	Once the notification completes, the client must then re-post the notification 
       
  1700 	if they wish to continue receiving further notifications.
       
  1701 	
       
  1702 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketNotifyContextActivationRequested) 
       
  1703 	to cancel a previously placed asynchronous NotifyContextActivationRequested() 
       
  1704 	request.
       
  1705 	
       
  1706 	@param aStatus On completion, KErrNone if successful, or a system-wide error 
       
  1707 	code if not successful.
       
  1708 	@param aContextParameters A TContextConfigXXX context configuration object packaged 
       
  1709 	as a TPckg<TContextConfigXXX>.
       
  1710 
       
  1711 @capability None
       
  1712 */
       
  1713 	{
       
  1714 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1715 	Get(EPacketNotifyContextActivationRequested, aStatus, aContextParameters);
       
  1716 	}
       
  1717 
       
  1718 EXPORT_C void RPacketService::RejectActivationRequest(TRequestStatus& aStatus) const
       
  1719 /**
       
  1720 	Causes the phone to reject the network's request for a PDP context activation.
       
  1721 	
       
  1722 	This is an asynchronous function.
       
  1723 	
       
  1724 	There is no corresponding "accept" message for the phone to send. To accept, 
       
  1725 	the phone should simply begin to activate a PDP context with the appropriate 
       
  1726 	IP address before the network's timer expires. On GPRS, this timer last between 
       
  1727 	5 and 8 seconds, but may effectively last between around 25 and 40 seconds, 
       
  1728 	as the specifications state that the activation request should be re-sent 
       
  1729 	up to five times.
       
  1730 	
       
  1731 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketRejectActivationRequest) 
       
  1732 	to cancel a previously placed asynchronous RejectActivationRequest() request.
       
  1733 	
       
  1734 	@param aStatus On completion, KErrNone if successful, or a system-wide error 
       
  1735 	code if not successful.
       
  1736 
       
  1737 @capability NetworkServices
       
  1738 */
       
  1739 	{
       
  1740 	Blank(EPacketRejectActivationRequest, aStatus);
       
  1741 	}
       
  1742 
       
  1743 EXPORT_C void RPacketService::EnumerateContexts(TRequestStatus& aStatus, TInt& aCount, TInt& aMaxAllowed) const
       
  1744 //This function may be called by the client.
       
  1745 /**
       
  1746 	Retrieves both the number of opened contexts in the TSY, whether active or inactive, and 
       
  1747 	the maximum possible number of contexts.
       
  1748 	
       
  1749 	This is an asynchronous function.
       
  1750 
       
  1751 	Allows a client to determine whether they can open a new context.
       
  1752 	
       
  1753 	The maximum number of possible contexts is not the maximum number of simultaneously 
       
  1754 	active contexts, but the total number allowed. (The maximum possible number 
       
  1755 	of simultaneously active contexts is currently limited to 1). Clients are 
       
  1756 	thus able to determine whether they can open a new context or not.
       
  1757 	
       
  1758 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketEnumerateContexts) to cancel 
       
  1759 	a previously placed asynchronous EnumerateContexts() request.
       
  1760 	
       
  1761 	@param aStatus On completion, KErrNone if successful, or a system-wide error 
       
  1762 	code if not successful.
       
  1763 	@param aCount On completion, the number of opened contexts existing in the TSY.
       
  1764 	@param aMaxAllowed On completion, the maximum number of opened contexts that 
       
  1765 	are allowed in the TSY, or -1 if the maximum number of opened contexts is 
       
  1766 	not available.
       
  1767 
       
  1768 @capability None
       
  1769 */
       
  1770 	{
       
  1771 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1772 
       
  1773 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotEnumerateCount,aCount);
       
  1774 	TPtr8& ptr2=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotEnumerateMaxCount,aMaxAllowed);
       
  1775 	Get(EPacketEnumerateContexts, aStatus, ptr1, ptr2);
       
  1776 	}
       
  1777 
       
  1778 EXPORT_C void RPacketService::GetContextInfo(TRequestStatus& aStatus,TInt aIndex,TContextInfo& aInfo) const
       
  1779 /**
       
  1780 	Retrieves information about a particular context.
       
  1781 	
       
  1782 	It is usual to use this function in conjunction with the EnumerateContexts() 
       
  1783 	function, which returns the current number of opened contexts.
       
  1784 	
       
  1785 	This is an asynchronous function.
       
  1786 	
       
  1787 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketGetContextInfo) to cancel 
       
  1788 	a previously placed asynchronous GetContextInfo() request.
       
  1789 	
       
  1790 	@param aStatus On completion, KErrNone if successful, or KErrArgument if the aIndex is invalid. 
       
  1791 	@param aIndex The index of the context to get. The valid range for aIndex will be between 0 and 
       
  1792 	(n-1) where n is the number of open contexts returned by EnumerateContexts().
       
  1793 	@param aInfo On completion, the context information.
       
  1794 
       
  1795 @capability None
       
  1796 */
       
  1797 	{
       
  1798 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1799 	
       
  1800 	iEtelPacketPtrHolder->iGetContextInfoIndex = aIndex;
       
  1801 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotContextInfoIndex,iEtelPacketPtrHolder->iGetContextInfoIndex);
       
  1802 	TPtr8& ptr2=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotContextInfo,aInfo);
       
  1803 
       
  1804 	Get(EPacketGetContextInfo,aStatus, ptr1, ptr2);
       
  1805 	}
       
  1806 
       
  1807 EXPORT_C void RPacketService::GetNtwkRegStatus(TRequestStatus& aStatus, TRegistrationStatus& aRegistrationStatus) const
       
  1808 // This function may be called by the client.
       
  1809 
       
  1810 /**
       
  1811 	Retrieves the current registration status of the phone on the packet network.
       
  1812 	
       
  1813 	This is an asynchronous function.
       
  1814 	
       
  1815 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketGetNtwkRegStatus) to cancel 
       
  1816 	a previously placed asynchronous GetNtwkRegStatus() request.
       
  1817 	
       
  1818 	@param aStatus On completion, KErrNone if successful, or a system-wide error 
       
  1819 	code if not successful.
       
  1820 	@param aRegistrationStatus On completion, the current registration status of 
       
  1821 	the	phone on the packet network.
       
  1822 
       
  1823 @capability None
       
  1824 */
       
  1825 	{
       
  1826 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1827 
       
  1828 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetNtwkReg,aRegistrationStatus);
       
  1829 	Get(EPacketGetNtwkRegStatus, aStatus, ptr1);
       
  1830 	}
       
  1831 
       
  1832 EXPORT_C void RPacketService::NotifyChangeOfNtwkRegStatus(TRequestStatus& aStatus,TRegistrationStatus& aRegistrationStatus) const
       
  1833 // This asynchronous function may be called by the client.
       
  1834 /**
       
  1835 	Allows a client to be notified whenever a change in the status of the packet 
       
  1836 	network registration is detected.
       
  1837 	
       
  1838 	This is an asynchronous function.
       
  1839 	
       
  1840 	Once the notification completes, the client must then re-post the notification 
       
  1841 	if they wish to continue receiving further notifications.
       
  1842 	
       
  1843 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketNotifyChangeOfNtwkRegStatus) 
       
  1844 	to cancel a previously placed asynchronous NotifyChangeOfNtwkRegStatus() request.
       
  1845 	
       
  1846 	@param aStatus On completion, KErrNone if successful, or a system-wide error 
       
  1847 	code if not successful.
       
  1848 	@param aRegistrationStatus On completion, the new registration status of the 
       
  1849 	phone on the packet network. 
       
  1850 
       
  1851 @capability None
       
  1852 */
       
  1853 	{
       
  1854 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1855 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotRegStatus,aRegistrationStatus);
       
  1856 
       
  1857 	Get(EPacketNotifyChangeOfNtwkRegStatus,aStatus,ptr1);
       
  1858 	}
       
  1859 
       
  1860 EXPORT_C void RPacketService::GetMSClass(TRequestStatus& aStatus, TMSClass& aCurrentClass, TMSClass& aMaxClass) const
       
  1861 /**
       
  1862 	Gets both the current class and the highest class of the mobile phone.
       
  1863 	
       
  1864 	This is an asynchronous function.
       
  1865 	
       
  1866 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketGetMSClass) to cancel a 
       
  1867 	previously placed asynchronous GetMSClass() request.
       
  1868 	
       
  1869 	@param aStatus On completion, KErrNone if successful, or another of the system-wide error 
       
  1870 	codes.
       
  1871 	@param aCurrentClass On completion, the current class of the phone.
       
  1872 	@param aMaxClass On completion, the highest possible class the phone can emulate.
       
  1873 
       
  1874 @capability None
       
  1875 */
       
  1876 	{
       
  1877 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1878 
       
  1879 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotCurrentMsClass,aCurrentClass);
       
  1880 	TPtr8& ptr2=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotMaxMsClass,aMaxClass);
       
  1881 
       
  1882 	Get(EPacketGetMSClass, aStatus, ptr1, ptr2);
       
  1883 	}
       
  1884 
       
  1885 EXPORT_C void RPacketService::SetMSClass(TRequestStatus& aStatus, TMSClass aClass) const
       
  1886 /** 
       
  1887 	Sets the current packet class of the mobile station. This should never be higher 
       
  1888 	than the maximum packet class of the mobile station. 
       
  1889 	
       
  1890 	It is expected that this function will be used to force a ClassSuspensionRequired 
       
  1891 	mobile into a Class C mode of operation: either packet or circuit-switched only. 
       
  1892 	This is useful, for instance, in a situation where the user is billed for incoming 
       
  1893 	circuit-switched calls (a practice of U.S. network operators) and does not wish to 
       
  1894 	be available for incoming calls for long periods of time, but does want to keep the 
       
  1895 	packet side of the phone always on and always connected.
       
  1896 	
       
  1897 	This is an asynchronous function.
       
  1898 	
       
  1899 	Once the notification completes, the client must then re-post the notification 
       
  1900 	if they wish to continue receiving further notifications.
       
  1901 	
       
  1902 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketSetMSClass) to cancel a 
       
  1903 	previously placed asynchronous SetMSClass() request.
       
  1904 	
       
  1905 	@param aStatus On completion, KErrNone if successful, orKErrTooBig if the 
       
  1906 	requested class is higher than the maximum class supported by the phone.
       
  1907 	@param aClass The new packet class for the mobile station.
       
  1908 	
       
  1909 @capability NetworkServices
       
  1910 @capability WriteDeviceData
       
  1911 */
       
  1912 	{
       
  1913 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1914 	
       
  1915 	iEtelPacketPtrHolder->iMSClass = aClass;
       
  1916 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotSetMsClass,iEtelPacketPtrHolder->iMSClass);
       
  1917 
       
  1918 	Set(EPacketSetMSClass, aStatus, ptr1);
       
  1919 	}
       
  1920 
       
  1921 EXPORT_C void RPacketService::NotifyMSClassChange(TRequestStatus& aStatus, TMSClass& aNewClass) const
       
  1922 /**
       
  1923 	Completes when there is a change in the current GPRS class of the mobile station.
       
  1924 	
       
  1925 	This is an asynchronous function.
       
  1926 	
       
  1927 	Once the notification completes, the client must then re-post the notification 
       
  1928 	if they wish to continue receiving further notifications.
       
  1929 	
       
  1930 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketNotifyMSClassChange) to 
       
  1931 	cancel a previously placed asynchronous NotifyMSClassChange() request.
       
  1932 	
       
  1933 	@param aStatus On completion, KErrNone if successful, otherwise another of the system
       
  1934 	wide error codes.
       
  1935 	@param aNewClass On completion, the new packet class.
       
  1936 	
       
  1937 @capability None
       
  1938 */
       
  1939 	{
       
  1940 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1941 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotNtfMsClass,aNewClass);
       
  1942 
       
  1943 	Get(EPacketNotifyMSClassChange, aStatus, ptr1);
       
  1944 	}
       
  1945 
       
  1946 EXPORT_C TInt RPacketService::GetStaticCaps(TUint& aCaps, RPacketContext::TProtocolType aPdpType) const
       
  1947 /**
       
  1948 	Retrieves those capabilities of the TSY/phone that are static.
       
  1949 	
       
  1950 	This is a synchronous function.
       
  1951 	
       
  1952 	@param aCaps On return, a bitmask of the TStaticMiscCaps static capabilities.
       
  1953 	@param aPdpType The static parameters may be different depending on the PdpType 
       
  1954 	supported on the phone. Hence the client must pass in the current PdpType 
       
  1955 	for which they wish to receive static capabilities.
       
  1956 	@return KErrNone if successful, a system-wide error code if not. 
       
  1957 	
       
  1958 @capability None
       
  1959 */
       
  1960 	{
       
  1961 	TPckg<TUint> ptr1(aCaps);
       
  1962 	TPckg<RPacketContext::TProtocolType> ptr2(aPdpType);
       
  1963 	return Get(EPacketGetStaticCaps, ptr1, ptr2);
       
  1964 	}
       
  1965 
       
  1966 EXPORT_C TInt RPacketService::GetDynamicCaps(TDynamicCapsFlags& aCaps) const
       
  1967 /**
       
  1968 	Retrieves those capabilities of the TSY/phone that are dynamic.
       
  1969 	
       
  1970 	This is a synchronous function.
       
  1971 	
       
  1972 	@param aCaps On return, a bitmask of the RPacketService::TDynamicCaps dynamic capabilities.
       
  1973 	@return KErrNone if successful, a system-wide error code if not. 
       
  1974 	
       
  1975 @capability None
       
  1976 */
       
  1977 	{
       
  1978 	TPckg<TDynamicCapsFlags> ptr1(aCaps);
       
  1979 	return Get(EPacketGetDynamicCaps, ptr1);
       
  1980 	}
       
  1981 
       
  1982 EXPORT_C void RPacketService::NotifyDynamicCapsChange(TRequestStatus& aStatus, TDynamicCapsFlags& aCaps) const
       
  1983 /**
       
  1984 	Completes when the dynamic packet data capabilities change.
       
  1985 	
       
  1986 	This is an asynchronous function.
       
  1987 	
       
  1988 	Once the notification completes, the client must then re-post the notification 
       
  1989 	if they wish to continue receiving further notifications.
       
  1990 	
       
  1991 	A common usage of the dynamic capabilities functions would be for GetDynamicCaps() to be 
       
  1992 	called first to retrieve the current set of capabilities, and then the NotifyDynamicCapsChange()
       
  1993 	request to be posted to be kept informed of any changes.
       
  1994 	
       
  1995 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketNotifyDynamicCapsChange) 
       
  1996 	to cancel a previously placed asynchronous NotifyDynamicCapsChange() request.
       
  1997 	
       
  1998 	@param aStatus On completion, KErrNone if successful, a system-wide error 
       
  1999 	code if not.
       
  2000 	@param aCaps On completion, a bitmask of the new RPacketService::TDynamicCaps dynamic capabilities.
       
  2001 
       
  2002 @capability None
       
  2003 */
       
  2004 	{
       
  2005 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2006 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotDynamicCaps,aCaps);
       
  2007 
       
  2008 	Get(EPacketNotifyDynamicCapsChange,aStatus,ptr1);
       
  2009 	}
       
  2010 
       
  2011 EXPORT_C void RPacketService::SetPreferredBearer(TRequestStatus& aStatus, TPreferredBearer aBearer) const
       
  2012 /** 
       
  2013 	Sets the preferred bearer for the Mobile Terminal to use when as default when 
       
  2014 	dropping from Class B operation to Class C. This could happen when the Mobile 
       
  2015 	Terminal moves into a Routing Area of cells or new GPRS network which operates 
       
  2016 	in Network Mode III. (Class C operation requires that the Mobile Terminal 
       
  2017 	is attached to either GSM or GPRS, not both.)
       
  2018 	
       
  2019 	Should the Mobile Terminal be a Class C only device, this function is used 
       
  2020 	simply to switch bearers. If the required bearer is GSM, the Mobile Terminal 
       
  2021 	will immediately attempt to attach to the GSM service. If GPRS, the Mobile 
       
  2022 	Terminal may either immediately attempt to attach to the GPRS service or wait 
       
  2023 	until context activation to attach, depending on the current attach mode as 
       
  2024 	defined by TAttachMode.
       
  2025 	
       
  2026 	This is an asynchronous function.
       
  2027 	
       
  2028 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketSetPrefBearer) to cancel 
       
  2029 	a previously placed asynchronous SetPreferredBearer() request.
       
  2030 	
       
  2031 	@param aStatus On completion, KErrNone if successful, a system-wide error 
       
  2032 	code if not.
       
  2033 	@param aBearer The new preferred bearer. 
       
  2034 
       
  2035 @capability NetworkServices
       
  2036 @capability WriteDeviceData
       
  2037 */
       
  2038 	{
       
  2039 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2040 	
       
  2041 	iEtelPacketPtrHolder->iPrefBearer = aBearer;
       
  2042 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotSetPrefBearer,iEtelPacketPtrHolder->iPrefBearer);
       
  2043 
       
  2044 	Set(EPacketSetPrefBearer,aStatus, ptr1);
       
  2045 	}
       
  2046 
       
  2047 EXPORT_C TInt RPacketService::GetPreferredBearer(TPreferredBearer& aBearer) const
       
  2048 /**
       
  2049 	Note that the synchronous variant of this method is deprecated. The asynchronous variant instead should be used.
       
  2050 	 
       
  2051 	Retrieves the currently selected preferred bearer to attach to when in Class C 
       
  2052 	operation. The TSY should cache this value, so the function should return quickly 
       
  2053 	hence there is no need for an asynchronous version. 
       
  2054 	
       
  2055 	@deprecated  The synchronous variant of this method is deprecated. The asynchronous variant instead should be used.
       
  2056 	@param aBearer On return will contain the selected preferred bearer.
       
  2057 	@return Result code. KErrNone if successful. 
       
  2058 
       
  2059 @capability None
       
  2060 */
       
  2061 	{
       
  2062 	TPckg<TPreferredBearer> ptr1(aBearer);
       
  2063 	return Get(EPacketGetPrefBearer, ptr1);
       
  2064 	}
       
  2065 	
       
  2066 EXPORT_C void RPacketService::GetPreferredBearer(TRequestStatus& aStatus, TPreferredBearer& aBearer) const
       
  2067 /**
       
  2068 	This asynchronous function retrieves the currently selected preferred bearer to attach to 
       
  2069 	when in Class C operation. 
       
  2070 	 
       
  2071 	@param aStatus A reference to a TRequestStatus which on completion will contain the result code.
       
  2072 	@param aBearer On completion will contain the selected preferred bearer. 
       
  2073 
       
  2074 @capability None
       
  2075 */
       
  2076 	{
       
  2077 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2078 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetPrefBearer,aBearer);
       
  2079 	
       
  2080 	Get(EPacketGetPrefBearer, aStatus, ptr1);
       
  2081 	}
       
  2082 
       
  2083 EXPORT_C TInt RPacketService::SetAttachMode(TAttachMode aMode) const
       
  2084 /**
       
  2085 	Sets when the attachment to the GPRS network should occur, in version 1 of the API. 
       
  2086 	
       
  2087 	In either mode, the manual Attach() and Detach() functions will force the attach or detach 
       
  2088 	respectively, as long as it is a valid action.
       
  2089 	
       
  2090 	@deprecated The asynchronous version should be used from v7.0S.
       
  2091 	
       
  2092 	@param aMode The attach mode.
       
  2093 	@return KErrNone if successful, a system-wide error code if not.
       
  2094 
       
  2095 @capability WriteDeviceData
       
  2096 */
       
  2097 	{
       
  2098 	TPckg<TAttachMode> ptr1(aMode);
       
  2099 	return Set(EPacketSetAttachMode, ptr1);
       
  2100 	}
       
  2101 
       
  2102 EXPORT_C void RPacketService::SetAttachMode(TRequestStatus& aStatus, TAttachMode aMode) const
       
  2103 /**
       
  2104 	This asynchronous method may be called by the client. It has superseded the synchronous
       
  2105 	variant of this method.
       
  2106 	
       
  2107 	It sets when the 'attach' to the packet network should occur.
       
  2108 	
       
  2109 	@param aStatus A reference to a TRequestStatus.
       
  2110 	@param aMode This parameter contains instructions for this method: RPacketService::EAttachWhenPossible
       
  2111 	and RPacketService::EAttachWhenNeeded.
       
  2112  
       
  2113 @capability WriteDeviceData
       
  2114 */
       
  2115 	{
       
  2116 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2117 	
       
  2118 	iEtelPacketPtrHolder->iAttachMode = aMode;
       
  2119 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotSetAttachMode,iEtelPacketPtrHolder->iAttachMode);
       
  2120 
       
  2121 	Set(EPacketSetAttachMode, aStatus, ptr1);
       
  2122 	}
       
  2123 
       
  2124 EXPORT_C TInt RPacketService::GetAttachMode(TAttachMode& aMode) const
       
  2125 /**
       
  2126 	Retrieves the current mode of GPRS Attach mode, in version 1 of the API. 
       
  2127 	
       
  2128 	@deprecated The asynchronous version should be used from v7.0S.
       
  2129 	
       
  2130 	@param aMode On return, the current attachment mode.
       
  2131 	@return KErrNone if successful, a system-wide error code if not.
       
  2132 
       
  2133 @capability None
       
  2134 */
       
  2135 	{
       
  2136 	TPckg<TAttachMode> ptr1(aMode);
       
  2137 	return Get(EPacketGetAttachMode, ptr1);
       
  2138 	}
       
  2139 
       
  2140 EXPORT_C void RPacketService::GetAttachMode(TRequestStatus& aStatus, TAttachMode& aMode) const
       
  2141 /**
       
  2142 	This asynchronous method may be called by the client. It has superseded the synchronous
       
  2143 	variant of this method.
       
  2144 	It will retrieve the current mode of the packet network attach operation.
       
  2145 	
       
  2146 	@param aStatus This is a reference to aTRequestStatus.
       
  2147 	@param aMode Has 2 values: RPacketService::EAttachWhenPossible and RPacketService::EAttachWhenNeeded.
       
  2148 
       
  2149 @capability None
       
  2150 */
       
  2151 	{
       
  2152 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2153 	TPtr8& ptr1 = iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetAttachMode, aMode);
       
  2154 	
       
  2155 	Get(EPacketGetAttachMode, aStatus, ptr1);
       
  2156 	}
       
  2157 	
       
  2158 EXPORT_C void RPacketService::NotifyAttachModeChange(TRequestStatus& aStatus, TAttachMode& aMode) const
       
  2159 /**
       
  2160 	Notifies the client when there is a change in the current mode of the packet network attach operation. 
       
  2161 	 
       
  2162 	@param aStatus This is a reference to a TRequestStatus.
       
  2163 	@param aMode Has 2 values: RPacketService::EAttachWhenPossible and RPacketService::EAttachWhenNeeded.
       
  2164 
       
  2165 @capability None
       
  2166 */
       
  2167 	{
       
  2168 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2169 	TPtr8& ptr1 = iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotNotifyAttachModeChange, aMode);
       
  2170 	
       
  2171 	Get(EPacketNotifyAttachModeChange, aStatus, ptr1);
       
  2172 	}
       
  2173 
       
  2174 EXPORT_C TInt RPacketService::SetDefaultContextParams(const TDesC8& aPckg) const
       
  2175 //This function may be called by the client.
       
  2176 /** 
       
  2177 	Sets the default context parameters in the phone, in version 1 of the API. 
       
  2178 	The default context parameters are the parameters which the phone will use if no 
       
  2179 	context parameters have been explicitly set up via either the ETel API or AT 
       
  2180 	commands from an external PC.
       
  2181 	
       
  2182 	The actual context parameters are set up in the RPacketContext::TContextConfigGPRS 
       
  2183 	or RPacketContext::TContextConfigCDMA structure. 
       
  2184 	
       
  2185 	To determine how to correctly unpack the descriptor inside the TSY, the TSY must 
       
  2186 	first cast the descriptor to a TPacketDataConfigBase pointer and check whether 
       
  2187 	ExtensionId() returns KConfigGPRS, KConfigCDMA or KConfigRel99Rel4. The TSY will then 
       
  2188 	cast the descriptor to the correct TPacketDataConfigBase-derived class.
       
  2189 	
       
  2190 	@deprecated The asynchronous version should be used from v7.0S.
       
  2191 	
       
  2192 	@param aPckg A TContextConfigXXX context configuration class packaged as a 
       
  2193 	TPckg<TContextConfigXXX>.  
       
  2194 	@return KErrNone if successful, or a system-wide error code if not.
       
  2195 
       
  2196 @capability WriteDeviceData
       
  2197 */
       
  2198 	{
       
  2199 	return Set(EPacketSetDefaultContextParams, aPckg);
       
  2200 	}
       
  2201 
       
  2202 EXPORT_C void RPacketService::SetDefaultContextParams(TRequestStatus& aStatus, const TDesC8& aPckg) const
       
  2203 /**
       
  2204 	This asynchronous method may be called by the client. It has superseded the synchronous
       
  2205 	variant of this method.
       
  2206 
       
  2207 	It will set the default context parameters in the ME. These are the parameters the ME will
       
  2208 	use if no explicit context parameters have previously been set up.
       
  2209 
       
  2210 	@param aStatus A reference to a TRequestStatus.
       
  2211 	@param aPckg A TContextConfigGPRS or TContextConfigCDMA context configuration class packaged 
       
  2212 	inside a TPckg<TContextConfigGPRS> or TPckg<TContextConfigCDMA> class. 
       
  2213 	
       
  2214 	To determine how to correctly unpack the descriptor inside the TSY, the TSY must first cast 
       
  2215 	The descriptor to a TPacketDataConfigBase pointer and check the iExtensionId. 
       
  2216 	Depending on the iExtensionId, the TSY will then cast the descriptor to the correct 
       
  2217 	TPacketDataConfigBase-derived class.
       
  2218 
       
  2219 @capability WriteDeviceData
       
  2220 */
       
  2221 	{
       
  2222 	Set(EPacketSetDefaultContextParams, aStatus, aPckg);
       
  2223 	}
       
  2224 
       
  2225 EXPORT_C TInt RPacketService::GetDefaultContextParams(TDes8& aPckg) const
       
  2226 /**
       
  2227 	Retrieves the default context parameters that are stored in the phone, in version 1 of the API.
       
  2228 	
       
  2229 	@deprecated The asynchronous version should be used from v7.0S.
       
  2230 	
       
  2231 	@param aPckg On return, a RPacketContext::TContextConfigGPRS or RPacketContext::TContextConfigCDMA 
       
  2232 	context configuration class packaged inside a TPckg<TContextConfigGPRS> or 
       
  2233 	TPckg<TContextConfigCDMA> class. To determine how to correctly unpack the 
       
  2234 	descriptor inside the TSY, the TSY must first cast the descriptor to a TPacketDataConfigBase 
       
  2235 	pointer and check whether ExtensionId() returns KConfigGPRS, KConfigCDMA or KConfigRel99Rel4.
       
  2236 	@return KErrNone if successful, or a system-wide error code if not.
       
  2237 
       
  2238 @capability ReadDeviceData
       
  2239 */
       
  2240 	{
       
  2241 	return Get(EPacketGetDefaultContextParams, aPckg);
       
  2242 	}
       
  2243 
       
  2244 EXPORT_C void RPacketService::GetDefaultContextParams(TRequestStatus& aStatus, TDes8& aPckg) const
       
  2245 /**
       
  2246 	This asynchronous method may be called by the client. It has superseded the synchronous
       
  2247 	variant of this method.
       
  2248 	
       
  2249 	It will retrieve the default context parameters that are stored in the ME.
       
  2250 	
       
  2251 	@param aStatus This is a reference to a TRequestStatus.
       
  2252 	@param aPckg On completion contains the packaged default context parameters. aPckg should be
       
  2253 	a TPckg of a TPacketDataConfigBase derived class.
       
  2254 
       
  2255 	@see RPacketContext::TContextConfigCDMA
       
  2256 	@see RPacketContext::TContextConfigGPRS
       
  2257 	@see RPacketContext::TContextConfigR99_R4
       
  2258 	@see RPacketContext::TContextConfig_R5
       
  2259 
       
  2260 @capability ReadDeviceData
       
  2261 */
       
  2262 	{
       
  2263 	Get(EPacketGetDefaultContextParams, aStatus, aPckg);
       
  2264 	}
       
  2265 
       
  2266 EXPORT_C void RPacketService::GetCurrentReleaseMode(TRequestStatus& aStatus, TPacketReleaseMode& aReleaseMode) const
       
  2267 /**
       
  2268 	This asynchronous method may be called by the client application.
       
  2269 	It returns the current packet network release mode(Release97/98, Release 99 or Release 4).
       
  2270 	
       
  2271 	@param aStatus This is a reference to a TRequestStatus.
       
  2272 	@param aNetworkMode On completion contains the retrieved release mode.
       
  2273 
       
  2274 @capability None
       
  2275 */
       
  2276 	{
       
  2277 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2278 	TPtr8& ptr1 = iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetCurrentReleaseMode, aReleaseMode);
       
  2279 	
       
  2280 	Get(EPacketGetCurrentReleaseMode, aStatus, ptr1);
       
  2281 	}
       
  2282 
       
  2283 EXPORT_C void RPacketService::NotifyReleaseModeChange(TRequestStatus& aStatus, TPacketReleaseMode& aReleaseMode) const
       
  2284 /**
       
  2285 	This asynchronous notification function may be called by the client.
       
  2286 	
       
  2287 	It completes if the packet release mode of the network changes.
       
  2288 	
       
  2289 	@param aStatus This is a reference to a TRequestStatus.
       
  2290 	@param aReleaseMode This will contain the new mode (Release97/98, Release 99 or Release 4)
       
  2291 
       
  2292 @capability None
       
  2293 */
       
  2294 	{
       
  2295 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2296 
       
  2297 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotNotifyModeChange, aReleaseMode);
       
  2298 
       
  2299 	Get(EPacketNotifyReleaseModeChange,aStatus, ptr1);
       
  2300 	}
       
  2301 
       
  2302 EXPORT_C void RPacketService::EnumerateNifs(TRequestStatus& aStatus, TInt& aCount) const
       
  2303 /**
       
  2304 	This asynchronous method may be called by the client application.
       
  2305 	
       
  2306 	It returns the number of defined packet network interfaces in the parameter aCount. 
       
  2307 	One network interface (NIF) exists per local IP address, but there may be several PDP contexts
       
  2308 	per NIF, i.e. one primary and several secondary contexts, all sharing the IP address and other
       
  2309 	configuration information such as PDP type and APN. 
       
  2310 	
       
  2311 	@param aCount Number of defined packet network interfaces
       
  2312 
       
  2313 @capability None
       
  2314 */
       
  2315 	{
       
  2316 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2317 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotEnumerateNifs,aCount);
       
  2318 
       
  2319 	Get(EPacketEnumerateNifs, aStatus, ptr1);
       
  2320 	}
       
  2321 
       
  2322 EXPORT_C void RPacketService::GetNifInfo(TRequestStatus& aStatus, TInt aIndex, TDes8& aNifInfoV2) const
       
  2323 /**
       
  2324 	This asynchronous method may be called by the client application.
       
  2325 	It retrieves information about the network interface specified by the aIndex parameter.
       
  2326 	It is usual to use this function in conjunction with the EnumerateNifs() method, which
       
  2327 	returns the current number of defined packet Network interfaces in its 'aCount' argument. 
       
  2328 	
       
  2329 	@param aStatus TRequestStatus reference, enables asynchronous function call
       
  2330 
       
  2331 	@param aIndex Specifies network interface for which information is to be retrieved.
       
  2332 	The valid range for aIndex will be between 0 and (n-1) where n is the number returned in
       
  2333 	aCount. If an invalid index is specified the method will return KErrArgument in its aStatus.
       
  2334 	
       
  2335 	@param aNifInfoV2 Reference to a TNifInfoV2 class packaged inside a TPckg<> class. Contains the
       
  2336 	returned Network Interface information
       
  2337  
       
  2338 @capability ReadDeviceData
       
  2339 */
       
  2340 	{
       
  2341 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2342 	
       
  2343 	iEtelPacketPtrHolder->iGetNifInfoIndex = aIndex;
       
  2344 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetNifInfo,iEtelPacketPtrHolder->iGetNifInfoIndex);
       
  2345 
       
  2346 	Get(EPacketGetNifInfo,aStatus, ptr1, aNifInfoV2);
       
  2347 	}
       
  2348 
       
  2349 EXPORT_C void RPacketService::EnumerateContextsInNif(TRequestStatus& aStatus, const TDesC& aExistingContextName, TInt& aCount) const
       
  2350 /**
       
  2351 	This asynchronous method may be called by the client application.
       
  2352 	
       
  2353 	It retrieves the number of contexts sharing a particular network interface, including the 
       
  2354 	primary context (if it still exists) and the context specified in aExistingContextName.
       
  2355 	
       
  2356 	@param aStatus TRequestStatus reference, enables asynchronous function call
       
  2357 	@param aExistingContextName The name of any context belonging to the network interface (NIF)
       
  2358 	@param aCount Contains the number of contexts sharing a NIF.
       
  2359 
       
  2360 @capability ReadDeviceData
       
  2361 */
       
  2362 	{
       
  2363 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2364 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotEnumerateContextsInNif,aCount); 
       
  2365 
       
  2366 	SetAndGet(EPacketEnumerateContextsInNif, aStatus, ptr1, aExistingContextName); 
       
  2367 	}
       
  2368 
       
  2369 EXPORT_C void RPacketService::GetContextNameInNif(TRequestStatus& aStatus, const TDesC& aExistingContextName, TInt aIndex, TDes& aContextName) const
       
  2370 /**
       
  2371 	This asynchronous method may be called by the client application.
       
  2372 	
       
  2373 	It retrieves the name of the context specified by aIndex for a particular network interface,
       
  2374 	which is determined by aExistingContextName
       
  2375 	
       
  2376 	@param aStatus TRequestStatus reference, enables asynchronous function call
       
  2377 	@param aExistingContextName The name of any context belonging to the network interface (NIF)
       
  2378 	@param aIndex Integer between 0 and (n-1) where n is the number of existing contexts 
       
  2379 	sharing this network interface (as provided by EnumerateContextsInNif() method).
       
  2380 	@param aContextName The name of the context specified by aIndex is returned in this parameter.
       
  2381 
       
  2382 @capability ReadDeviceData
       
  2383 */
       
  2384 	{
       
  2385 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2386 
       
  2387 	iEtelPacketPtrHolder->iGetContextNameInNif.iIndex=aIndex;
       
  2388 	iEtelPacketPtrHolder->iGetContextNameInNif.iExistingContextName=aExistingContextName;
       
  2389 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetContextNameInNif,iEtelPacketPtrHolder->iGetContextNameInNif); 
       
  2390 	
       
  2391 	Get(EPacketGetContextNameInNif, aStatus, ptr1, aContextName); 
       
  2392 	}
       
  2393 
       
  2394 TInt RPacketService::PrepareOpenSecondary(const TDesC& aOriginalContextName)
       
  2395 /**
       
  2396 	This is an internal API method. It is not intended for direct client access.
       
  2397 	It is called from RPacketContext::OpenNewSecondaryContext().
       
  2398 	
       
  2399 	It passes the name of the context (which is to spawn a secondary context) to the TSY.
       
  2400 	This alerts the TSY to the fact that the next context creation call is going to be
       
  2401 	for a secondary context.
       
  2402 	
       
  2403 	@param aOriginalContextName Name of the original context that this secondary context is 
       
  2404 	spawned from.
       
  2405 	@return KErrNone if successful, KErrNotSupported if the TSY does not support
       
  2406 	secondary contexts.
       
  2407  */
       
  2408 	{
       
  2409 	__ASSERT_ALWAYS(aOriginalContextName.Length()!=0,PanicClient(KErrBadName));
       
  2410 	return Set(EPacketPrepareOpenSecondary, aOriginalContextName);
       
  2411 	}
       
  2412 
       
  2413 EXPORT_C RPacketService::TNifInfoV2::TNifInfoV2()
       
  2414 : TPacketBase(), iContextName(NULL), iNumberOfContexts(0), iNifStatus(RPacketContext::EStatusUnknown),
       
  2415   iPdpAddress(NULL), iContextType(RPacketService::EUnspecified)
       
  2416 /**
       
  2417 	Constructor for TNifInfoV2 class
       
  2418 	
       
  2419 	This class contains network information (NIF) parameters.
       
  2420 	The member data are initialized to zero, NULL, or unknown. The client should set the 
       
  2421 	parameters to valid values.
       
  2422 */
       
  2423 	{
       
  2424 	iExtensionId = KETelExtPcktV2;
       
  2425 	};
       
  2426 	
       
  2427 EXPORT_C void RPacketService::DeactivateNIF(TRequestStatus& aStatus, const TDesC& aContextName) const
       
  2428 /**
       
  2429 	This asynchronous method may be called by the client application.
       
  2430 	
       
  2431 	Invokes a packet network deactivation of all associated contexts sharing the same network interaface (NIF)
       
  2432 	with the specified context (aContextName argument) using the tear down indication when requesting the deactivation 
       
  2433 	operation for the specified context. 
       
  2434  
       
  2435 	@param aStatus TRequestStatus reference, enables asynchronous function call.
       
  2436 	@param aContextName Name of Context to be deactivated.
       
  2437 
       
  2438 @capability NetworkServices
       
  2439 */
       
  2440 	{
       
  2441 	Set(EPacketDeactivateNIF, aStatus, aContextName);
       
  2442 	}
       
  2443 	
       
  2444 TPacketType::TPacketType()
       
  2445 	{}
       
  2446 
       
  2447 EXPORT_C TInt TPacketType::ExtensionId() const
       
  2448 /**
       
  2449  * This method returns the packet API extension number of the class
       
  2450  *
       
  2451  * @return TInt An integer that will indicate the version of the type
       
  2452  * @capability None
       
  2453 */
       
  2454 	{
       
  2455 	return iExtensionId;
       
  2456 	}	
       
  2457 	
       
  2458 void TPacketType::InternalizeL(RReadStream& aStream)
       
  2459 /**
       
  2460  * This method internalizes the packet type from a stream 
       
  2461  *
       
  2462  * @param aStream The read stream containing the packet type
       
  2463  */
       
  2464 	{
       
  2465 	iExtensionId=aStream.ReadInt32L();	
       
  2466 	}
       
  2467 
       
  2468 void TPacketType::ExternalizeL(RWriteStream& aStream) const
       
  2469 /**
       
  2470  * This method externalizes the packet type into a stream 
       
  2471  *
       
  2472  * @param aStream The write stream that will contain the packet type
       
  2473  */
       
  2474 	{
       
  2475 	aStream.WriteInt32L(iExtensionId);
       
  2476 	}
       
  2477 
       
  2478 EXPORT_C RPacketService::TMbmsServiceAvailabilityV1::TMbmsServiceAvailabilityV1() 
       
  2479 	{
       
  2480 	iExtensionId=KETelExtPcktV1;
       
  2481 	}		
       
  2482 
       
  2483 void RPacketService::TMbmsServiceAvailabilityV1::InternalizeL(RReadStream& aStream)
       
  2484 /**
       
  2485  * This method internalizes the MBMS Service availability parameters from a stream 
       
  2486  *
       
  2487  * @param aStream The read stream containing the MBMS Service availability parameters
       
  2488  */
       
  2489 	{
       
  2490 	TPacketType::InternalizeL(aStream);
       
  2491 	iTmgi.SetServiceId(STATIC_CAST(TUint,aStream.ReadUint32L()));
       
  2492 	iTmgi.SetMCC(STATIC_CAST(TUint16,aStream.ReadUint32L()));
       
  2493 	iTmgi.SetMNC(STATIC_CAST(TUint16,aStream.ReadUint32L()));
       
  2494 	iMbmsServiceMode = STATIC_CAST(TMbmsServiceMode,aStream.ReadUint32L());
       
  2495 	iMbmsAvailabilityStatus = STATIC_CAST(TMbmsAvailabilityStatus,aStream.ReadUint32L());
       
  2496 	iMbmsAccessBearer = STATIC_CAST(TMbmsScope,aStream.ReadUint32L());
       
  2497 	}
       
  2498 
       
  2499 void RPacketService::TMbmsServiceAvailabilityV1::ExternalizeL(RWriteStream& aStream) const
       
  2500 /**
       
  2501  * This method externalizes the MBMS Service availability parameters into a stream 
       
  2502  *
       
  2503  * @param aStream The write stream that will contain the MBMS Service availability parameters 
       
  2504  */
       
  2505 	{
       
  2506 	TPacketType::ExternalizeL(aStream);
       
  2507 	
       
  2508 	aStream.WriteInt32L(iTmgi.GetServiceId());
       
  2509 	aStream.WriteInt32L(iTmgi.GetMCC());
       
  2510 	aStream.WriteInt32L(iTmgi.GetMNC());
       
  2511 	aStream.WriteInt32L(iMbmsServiceMode);
       
  2512 	aStream.WriteInt32L(iMbmsAvailabilityStatus);
       
  2513 	aStream.WriteInt32L(iMbmsAccessBearer);
       
  2514 	}
       
  2515 
       
  2516 EXPORT_C void RPacketService::NotifyMbmsServiceAvailabilityChange(TRequestStatus& aStatus) const
       
  2517 /**
       
  2518 	Notifies the client that changes have been made to the MBMS Service availability list. 
       
  2519 	When it completes, it does not return the new version of the list so the client will have to 
       
  2520 	retrieve the list again if interested in the new list.
       
  2521 
       
  2522 	@param aReqStatus returns the result code after the asynchronous call completes.
       
  2523 
       
  2524 @capability None
       
  2525 */
       
  2526 	{
       
  2527 	Blank(EPacketNotifyMbmsServiceAvailabilityChange,aStatus);
       
  2528 	}
       
  2529 	
       
  2530 EXPORT_C void RPacketService::UpdateMbmsMonitorServiceListL(TRequestStatus& aStatus,const TMbmsAction aAction, CPcktMbmsMonitoredServiceList* aLists) const
       
  2531 /**
       
  2532 	Updates the MBMS monitor service availability list with the entries as per the action mentioned in second parameter.
       
  2533 	The list, which is supplied by the client in an instance of CRetrievePcktMbmsServiceAvailability, should not
       
  2534 	contain more entries than can be stored.
       
  2535 	This method will store all the mbms service availability list entries in the CPcktMbmsMonitoredServiceList
       
  2536 	into the packet storage.
       
  2537 	   
       
  2538 	@param aReqStatus returns the result code after the asynchronous call completes.
       
  2539 			Completes with KErrNotFound, if all the supplied entries are invalid for removal.
       
  2540 			Completes with KErrMbmsImpreciseServiceEntries, if some of the valid entries cannot be removed.
       
  2541 	@param aAction Holds the MBMS action(add, remove or remove all).
       
  2542 	@param aLists List of Mbms service availability to be stored phone-side.
       
  2543 
       
  2544 @capability WriteDeviceData
       
  2545 */
       
  2546 	{
       
  2547 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2548 	delete iEtelPacketPtrHolder->iStoreMbmsBuf;
       
  2549 	iEtelPacketPtrHolder->iStoreMbmsBuf = NULL;
       
  2550 	if(aAction == ERemoveAllEntries)
       
  2551 		{
       
  2552 		iEtelPacketPtrHolder->iMbmsAction = aAction;
       
  2553 		TPtrC8& ptr1=iEtelPacketPtrHolder->SetC(CEtelPacketPtrHolder::ESlotUpdateMbmsMonitorServiceListL,iEtelPacketPtrHolder->iMbmsAction);
       
  2554 		Set(EPacketUpdateMbmsMonitorServiceList,aStatus,ptr1);
       
  2555 		}
       
  2556 	else 
       
  2557 		{
       
  2558 		__ASSERT_ALWAYS(aLists!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2559 		iEtelPacketPtrHolder->iStoreMbmsBuf=aLists->StoreLC();
       
  2560 		CleanupStack::Pop();
       
  2561 		iEtelPacketPtrHolder->iMbmsAction = aAction;
       
  2562 		TPtrC8& ptr1=iEtelPacketPtrHolder->SetC(CEtelPacketPtrHolder::ESlotUpdateMbmsMonitorServiceListL,iEtelPacketPtrHolder->iMbmsAction);
       
  2563 		(iEtelPacketPtrHolder->iStoreMbmsPtr).Set((iEtelPacketPtrHolder->iStoreMbmsBuf)->Ptr(0));
       
  2564 		Set(EPacketUpdateMbmsMonitorServiceList,aStatus,ptr1,iEtelPacketPtrHolder->iStoreMbmsPtr);
       
  2565 		}
       
  2566 	}
       
  2567 
       
  2568 EXPORT_C void RPacketService::NotifyMbmsNetworkServiceStatusChange(TRequestStatus& aStatus, TMbmsNetworkServiceStatus& aServiceStatus) const
       
  2569 /**
       
  2570 	Allows a client to be notified whenever a change in the MBMS network service status identified.
       
  2571 	There can be 3 states that MBMS feature availability could return,
       
  2572 	Unknown - when UE is not GMM Attached.
       
  2573 	Supported - When UE is GMM Attached and it is known that cell supports MBMS.
       
  2574 	Not Supported - When UE is GMM Attached and it is known that cell does not support MBMS.
       
  2575 
       
  2576 	This is an asynchronous function.
       
  2577 	
       
  2578 	Once the notification completes, the client must re-post the notification 
       
  2579 	if the client wish to continue receiving further notifications.
       
  2580 	
       
  2581 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketNotifyMbmsNetworkServiceStatusChange) 
       
  2582 	to cancel a previously placed asynchronous NotifyMbmsNetworkServiceStatusChange() request.
       
  2583 	
       
  2584 	@param aStatus On completion, KErrNone if successful, or a system-wide error 
       
  2585 	code if not successful.
       
  2586 	@param aServiceStatus On completion, the current mbms network service status of
       
  2587 	the	phone.
       
  2588 
       
  2589 @capability ReadDeviceData
       
  2590 */	
       
  2591 	{
       
  2592 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2593 
       
  2594 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotNotifyMbmsNetworkServiceStatusChange,aServiceStatus);
       
  2595 
       
  2596 	Get(EPacketNotifyMbmsNetworkServiceStatusChange,aStatus,ptr1);
       
  2597 	}
       
  2598 		
       
  2599 EXPORT_C void RPacketService::GetMbmsNetworkServiceStatus(TRequestStatus& aStatus,TBool aAttemptAttach, TMbmsNetworkServiceStatus& aServiceStatus) const
       
  2600 /**
       
  2601 	Retrieves the MBMS network status of the phone. The indication of cell support for MBMS feature 
       
  2602 	is only known from GMM Attach response from network or during Routing Area update.
       
  2603 	A consequence of this is that it is required for the UE to be in GMM Attach mode in order 
       
  2604 	for either of these messages to be received. 
       
  2605 	If the UE is not in GMM ATTACH then it is unable to determine MBMS network support.
       
  2606 
       
  2607 	There can be 3 states that MBMS feature availability could return,
       
  2608 	Unknown - when UE is not GMM Attached.
       
  2609 	Supported - When UE is GMM Attached and it is known that cell supports MBMS.
       
  2610 	Not Supported - When UE is GMM Attached and it is know that cell does not support MBMS.
       
  2611 
       
  2612 	This is an asynchronous function.
       
  2613 	
       
  2614 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketGetMbmsNetworkServiceStatus) to cancel 
       
  2615 	a previously placed asynchronous GetMbmsNetworkServiceStatus() request.
       
  2616 	
       
  2617 	@param aStatus On completion, KErrNone if successful, or a system-wide error 
       
  2618 	code if not successful.
       
  2619 	@param aAttemptAttach On completion, the MBMS attach information,if it is true 
       
  2620 	then GMM attached is perfomed, else any of the states is returned.
       
  2621 	@param aServiceStatus On completion, the current mbms network service status of
       
  2622 	the	phone.
       
  2623 		
       
  2624 @capability ReadDeviceData
       
  2625 */
       
  2626 	{
       
  2627 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2628 	
       
  2629 	iEtelPacketPtrHolder->iMbmsAttemptAttach = aAttemptAttach;
       
  2630 	TPtr8& ptr1 = iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetMbmsNetworkServiceStatus, iEtelPacketPtrHolder->iMbmsAttemptAttach);
       
  2631 	TPtr8& ptr2 = iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotGetMbmsNetworkServiceStatus2, aServiceStatus);
       
  2632 
       
  2633 	Get(EPacketGetMbmsNetworkServiceStatus, aStatus, ptr1,ptr2);
       
  2634 	}
       
  2635 	
       
  2636 EXPORT_C void RPacketService::EnumerateMbmsMonitorServiceList(TRequestStatus& aStatus, TInt& aCount, TInt& aMaxAllowed) const
       
  2637 /**
       
  2638 	Retrieves both, the number of services in the Mbms Monitor service list in the TSY, and 
       
  2639 	the maximum possible number of Mbms Monitor services.
       
  2640 	
       
  2641 	This is an asynchronous function.
       
  2642 
       
  2643 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketEnumerateMbmsMonitorServiceList) to cancel 
       
  2644 	a previously placed asynchronous EnumerateMbmsMonitorServiceList() request.
       
  2645 	
       
  2646 	@param aStatus On completion, KErrNone if successful, or a system-wide error 
       
  2647 	code if not successful.
       
  2648 	@param aCount On completion, the number of Mbms Monitor services existing in the TSY.
       
  2649 	@param aMaxAllowed On completion, the maximum number of Mbms Monitor services that 
       
  2650 	are allowed in the TSY.
       
  2651 
       
  2652 @capability ReadDeviceData
       
  2653 */
       
  2654 	{
       
  2655 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2656 
       
  2657 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotEnumerateMbmsMonitorCount,aCount);
       
  2658 	TPtr8& ptr2=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotEnumerateMbmsMonitorMaxCount,aMaxAllowed);
       
  2659 	Get(EPacketEnumerateMbmsMonitorServiceList, aStatus, ptr1, ptr2);
       
  2660 	}
       
  2661 	
       
  2662 EXPORT_C void RPacketService::EnumerateMbmsActiveServiceList(TRequestStatus& aStatus, TInt& aCount, TInt& aMaxAllowed) const
       
  2663 /**
       
  2664 	Retrieves both, the number of services in the Mbms Active service list in the TSY, and 
       
  2665 	the maximum possible number of Mbms Active services.
       
  2666 	
       
  2667 	This is an asynchronous function.
       
  2668 
       
  2669 	Use RTelSubSessionBase::CancelAsyncRequest(EPacketEnumerateMbmsActiveServiceList) to cancel 
       
  2670 	a previously placed asynchronous EnumerateMbmsActiveServiceList() request.
       
  2671 	
       
  2672 	@param aStatus On completion, KErrNone if successful, or a system-wide error 
       
  2673 	code if not successful.
       
  2674 	@param aCount On completion, the number of Mbms Active services existing in the TSY.
       
  2675 	@param aMaxAllowed On completion, the maximum number of Mbms Active services that 
       
  2676 	are allowed in the TSY.
       
  2677 
       
  2678 @capability ReadDeviceData
       
  2679 */
       
  2680 	{
       
  2681 	__ASSERT_ALWAYS(iEtelPacketPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2682 
       
  2683 	TPtr8& ptr1=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotEnumerateMbmsActiveCount,aCount);
       
  2684 	TPtr8& ptr2=iEtelPacketPtrHolder->Set(CEtelPacketPtrHolder::ESlotEnumerateMbmsActiveMaxCount,aMaxAllowed);
       
  2685 	Get(EPacketEnumerateMbmsActiveServiceList, aStatus, ptr1, ptr2);
       
  2686 	}	
       
  2687 /***********************************************************************************/
       
  2688 //
       
  2689 // RPacketMbmsContext
       
  2690 //
       
  2691 /***********************************************************************************/
       
  2692 	
       
  2693 EXPORT_C RPacketMbmsContext::RPacketMbmsContext()
       
  2694 /** 
       
  2695 	Standard constructor. 
       
  2696 */
       
  2697 	{
       
  2698 	}
       
  2699 	
       
  2700 EXPORT_C RPacketMbmsContext::TContextConfigMbmsV1::TContextConfigMbmsV1()
       
  2701 : TPacketDataConfigBase()
       
  2702  /**
       
  2703 	Standard constructor. Sets the member data values to the defaults.
       
  2704 	This class contains member data compatible with parameters required for configuring a
       
  2705 	MBMS Broadcast context. 
       
  2706 	
       
  2707 	The iExtensionId parameter, set automatically by ETel, is used by the TSY when unpacking this 
       
  2708 	class from a TPckg<> to indicate it is to be unpacked as a TContextConfigMbmsV1 class.
       
  2709  */
       
  2710 	{
       
  2711 	iExtensionId = KConfigMBMS;
       
  2712 	};
       
  2713 
       
  2714 EXPORT_C TInt RPacketMbmsContext::OpenNewContext(RPacketService& aPacketNetwork,TDes& aContextName)
       
  2715 /**
       
  2716 	Creates a MBMS context (i.e. RPacketMbmsContext) on an existing RPacketService
       
  2717 	connection.
       
  2718 		
       
  2719 	The TSY will return KErrUmtsMaxNumOfContextExceededByPhone if the number of MBMS contexts
       
  2720 	supported by the phone is exceeded. The TSY will return KErrUmtsMaxNumOfContextExceededByNetwork
       
  2721 	if the number of MBMS contexts supported by the network is exceeded.
       
  2722 
       
  2723 	An opened RPacketMbmsContext must be closed explicitly by calling Close() to
       
  2724 	prevent a resource (memory) leak.
       
  2725 
       
  2726 	@param aPacketNetwork An RPacketMbmsContext may only be opened from an existing RPacketService
       
  2727 	subsession. A client application must therefore pass a reference to their previously
       
  2728 	instantiated RPacketService object.
       
  2729 
       
  2730 	@param aContextName Set as the hint for the TSY to identify the Mbms Context.
       
  2731 	@return KErrNone if successful, a system-wide error code if not.
       
  2732 
       
  2733 @capability None
       
  2734 */
       
  2735 	{
       
  2736 	RSessionBase* session=&aPacketNetwork.SessionHandle();
       
  2737 	__ASSERT_ALWAYS(session!=NULL,PanicClient(EEtelPanicNullHandle)); // client has no existing session with ETel
       
  2738 
       
  2739 	TRAPD(ret,ConstructL());
       
  2740 	if (ret)
       
  2741 		{
       
  2742 		return ret;
       
  2743 		}
       
  2744 
       
  2745 	TInt subSessionHandle=aPacketNetwork.SubSessionHandle();
       
  2746 	__ASSERT_ALWAYS(subSessionHandle!=0,PanicClient(EEtelPanicNullHandle)); // client has no existing sub-session!
       
  2747 	TPtrC name(KETelNewContextName); // necessary so that server knows to ask TSY for new name
       
  2748 
       
  2749 	SetSessionHandle(*session);
       
  2750 	
       
  2751 	aContextName = KMBMSContextName; //set this as the hint for the TSY to use to create correct(MBMS) object
       
  2752 
       
  2753    	TIpcArgs args(&name,&aContextName,subSessionHandle);
       
  2754 	ret= CreateSubSession(*session,EEtelOpenFromSubSession,args);
       
  2755 	
       
  2756 	if (ret)
       
  2757 		{
       
  2758 		Destruct();
       
  2759 		}
       
  2760 		
       
  2761 	return ret;
       
  2762 	}
       
  2763 
       
  2764 EXPORT_C void RPacketMbmsContext::UpdateMbmsSessionList(TRequestStatus& aStatus,const TMbmsAction aAction, const TMbmsSessionId aSessionId) const	
       
  2765 /** 
       
  2766 	Provides MBMS client the facility to add a new session to be received or remove
       
  2767 	an existing session to/from the mbms services table.
       
  2768 	
       
  2769 	@param aStatus On completion, KErrNone if successful.
       
  2770 			Completes with KErrNotFound, if the supplied session is invalid for removal. 
       
  2771 			In the above case the action would be ERemoveEntries.
       
  2772 			Completes with KErrMbmsImpreciseServiceEntries, if some of the valid sessions cannot be removed.
       
  2773 			In the above case the action would be ERemoveAllEntries.
       
  2774 			Or a system-wide error code if not successful.
       
  2775 	@param aAction The session action information which can be either add,remove or removeall.
       
  2776 	@param aSessionId The MBMS session identifier which need to be received or removed.
       
  2777 
       
  2778 @capability WriteDeviceData
       
  2779 */	
       
  2780 	{
       
  2781 	__ASSERT_ALWAYS(iEtelPacketContextPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
  2782 
       
  2783 	iEtelPacketContextPtrHolder->iMbmsAction = aAction;
       
  2784 	TPtrC8& ptr1=iEtelPacketContextPtrHolder->SetC(CEtelPacketPtrHolder::ESlotUpdateMbmsSessionList,iEtelPacketContextPtrHolder->iMbmsAction);
       
  2785 	iEtelPacketContextPtrHolder->iSessionId = aSessionId;
       
  2786 	TPtrC8& ptr2=iEtelPacketContextPtrHolder->SetC(CEtelPacketPtrHolder::ESlotUpdateMbmsSessionList2,iEtelPacketContextPtrHolder->iSessionId);
       
  2787 
       
  2788 	Set(EPacketContextUpdateMbmsSessionList, aStatus, ptr1,ptr2);
       
  2789 	}
       
  2790 	
       
  2791 EXPORT_C void RPacketMbmsContext::Close()
       
  2792 /** 
       
  2793 	Closes the client's current sub-session with ETel. Any outstanding requests
       
  2794 	the client may have with ETel (notifications, for example) will be automatically
       
  2795 	destroyed.
       
  2796 	
       
  2797 	An opened RPacketMbmsContext must be closed explicitly by calling Close() to
       
  2798 	prevent a resource (memory) leak. 
       
  2799 	
       
  2800 @capability None
       
  2801 */
       
  2802 	{
       
  2803 	CloseSubSession(EEtelClose);
       
  2804 	Destruct();
       
  2805 	}	
       
  2806 
       
  2807 EXPORT_C RPacketMbmsContext::CMbmsSession* RPacketMbmsContext::CMbmsSession::NewL()
       
  2808 /**
       
  2809  * Creates an instance of CMbmsSession
       
  2810  */
       
  2811 	{
       
  2812 	CMbmsSession *self = new(ELeave)CMbmsSession;
       
  2813 	return self;
       
  2814 	}
       
  2815 
       
  2816 EXPORT_C void RPacketMbmsContext::CMbmsSession::InternalizeL(const TDesC8& aBuffer)
       
  2817 /**
       
  2818  * This method internalizes the CMbmsSession from the aBuffer.
       
  2819  * @param	aBuffer	Holds the streamed data of CMbmsSession type.
       
  2820  */
       
  2821 	{
       
  2822 	iSessionIdList.Reset();
       
  2823 	TUint uintLen=sizeof(TUint);
       
  2824 	TInt cursor=0;
       
  2825 	if(aBuffer.Length() < cursor + uintLen)
       
  2826 		User::Leave(KErrOverflow);	
       
  2827 	Mem::Copy(&iExtensionId,aBuffer.Ptr(),uintLen);
       
  2828 	cursor+=uintLen; 
       
  2829 	if(aBuffer.Length() < cursor + uintLen)
       
  2830 		User::Leave(KErrOverflow);
       
  2831 	TUint count(0);
       
  2832 	Mem::Copy(&count,aBuffer.Ptr()+cursor,uintLen);
       
  2833 	cursor+=uintLen;
       
  2834 	TUint session=0;
       
  2835 	for(TUint i=0;i<count;i++)
       
  2836 		{
       
  2837 		if(aBuffer.Length() < cursor + uintLen)
       
  2838 			User::Leave(KErrOverflow);
       
  2839 		Mem::Copy(&session,aBuffer.Ptr()+cursor,uintLen);
       
  2840 		cursor+=uintLen;
       
  2841 		iSessionIdList.Append(session);
       
  2842 		}
       
  2843 	}
       
  2844 	
       
  2845 EXPORT_C void RPacketMbmsContext::CMbmsSession::ExternalizeL(HBufC8*& aBuffer)
       
  2846 /**
       
  2847  * This method externalizes the CMbmsSession into the aBuffer.
       
  2848  * @param	aBuffer	Holds the streamed data of CMbmsSession type.
       
  2849  */
       
  2850 	{
       
  2851 	TUint uintLen=sizeof(TUint);
       
  2852 	TUint size = uintLen; //ExtensionId
       
  2853 	TUint count=iSessionIdList.Count();
       
  2854 	size += uintLen; //Number of iSessionIdList elements
       
  2855 	size += count*(uintLen);
       
  2856 	if(aBuffer)
       
  2857 		{
       
  2858 	 	delete aBuffer;
       
  2859 	 	aBuffer=NULL;
       
  2860 	 	}
       
  2861 	aBuffer=HBufC8::NewL(size);
       
  2862 	aBuffer->Des().SetLength(size);
       
  2863 	TInt cursor(0);
       
  2864 	Mem::Copy(const_cast<TUint8*>(aBuffer->Des().Ptr()+cursor),(const TUint8*)(&iExtensionId),uintLen);
       
  2865 	cursor+=uintLen;
       
  2866 	Mem::Copy(const_cast<TUint8*>(aBuffer->Des().Ptr()+cursor),(const TUint8* )(&count),uintLen);
       
  2867 	cursor+=uintLen;
       
  2868 	for(TUint i=0;i<count;i++)
       
  2869 		{
       
  2870 		Mem::Copy((TUint8*)(aBuffer->Des().Ptr()+cursor),(const TUint8* )(&iSessionIdList[i]),uintLen);
       
  2871 		cursor+=uintLen;
       
  2872 		}
       
  2873 	}
       
  2874 
       
  2875 EXPORT_C TUint RPacketMbmsContext::CMbmsSession::ExtensionId() const
       
  2876 /**
       
  2877  * Returns the value of iExtensionId for the associated class.
       
  2878  * e.g. iExtensionId=KETelExtPcktV1 for all the V1 classes.
       
  2879  *
       
  2880  * @return The protected data member iExtensionId, which specifies the API version number.
       
  2881  */
       
  2882 	{
       
  2883 	return iExtensionId;
       
  2884 	}
       
  2885 
       
  2886 RPacketMbmsContext::CMbmsSession::CMbmsSession()
       
  2887 /**
       
  2888  * Standard constructor.
       
  2889  */  
       
  2890 	{
       
  2891 	iExtensionId = KETelExtPcktV1;
       
  2892 	}
       
  2893 
       
  2894 EXPORT_C RPacketMbmsContext::CMbmsSession::~CMbmsSession()
       
  2895 /**
       
  2896  * Standard destructor
       
  2897  */
       
  2898 	{
       
  2899 	iSessionIdList.Reset();
       
  2900 	iSessionIdList.Close();
       
  2901 	}
       
  2902