telephonyserverplugins/common_tsy/commontsy/src/mmpacket/Cmmpacketcontexttsy.cpp
changeset 0 3553901f7fa8
child 16 fe8b59ab9fa0
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2006-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 //
       
    15 
       
    16 
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "Cmmpacketcontexttsy.h"
       
    20 #include "Cmmpacketcontextlist.h"
       
    21 #include "cmmpacketservicegsmwcdmaext.h"
       
    22 #include "CMmPacketTsy.h"
       
    23 #include <ctsy/tflogger.h>
       
    24 #include "MmTsy_timeoutdefs.h"
       
    25 #include "MmTsy_numberOfSlots.h"
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 
       
    30 CMmPacketContextTsy::CMmPacketContextTsy()
       
    31     {
       
    32     }
       
    33 
       
    34 CMmPacketContextTsy* CMmPacketContextTsy::NewL(
       
    35         CMmPacketServiceTsy* const aMmPacketService,
       
    36         const TInfoName& aHostCID, 
       
    37         const TDes& aName,  
       
    38         const TUint8 aProxyId ) 
       
    39     {
       
    40 TFLOGSTRING2( "TSY: CMmPacketContextTsy::NewL. Context name:%S", &aName );
       
    41 
       
    42     CMmPacketContextTsy* packetContext = new ( ELeave ) CMmPacketContextTsy();
       
    43 
       
    44     CleanupClosePushL( *packetContext );
       
    45     packetContext->iMmPacketService = aMmPacketService;
       
    46     packetContext->iContextName = aName;
       
    47     packetContext->iProxyId = aProxyId;
       
    48     packetContext->iHostCID = aHostCID;
       
    49     packetContext->ConstructL();
       
    50     CleanupStack::Pop();
       
    51     
       
    52     return packetContext;
       
    53     }
       
    54 
       
    55 void CMmPacketContextTsy::ConstructL()
       
    56     {
       
    57     InitModulesL();
       
    58     InitInternalAttributes();    
       
    59     }
       
    60     
       
    61 CMmPacketContextTsy::~CMmPacketContextTsy()
       
    62     {
       
    63 TFLOGSTRING2( "TSY: CMmPacketContextTsy::~CMmPacketContextTsy. Context name: %S", &iContextName );
       
    64 	
       
    65 	if( iMmPacketService )
       
    66 		{
       
    67 			
       
    68 		iMmPacketService->PacketContextList()->RemoveObject( this );
       
    69 
       
    70 	    // Set Dynamic Caps
       
    71 	    iMmPacketService->ActivePacketServiceExtension()->SetDynamicCapsFlag(
       
    72 	        RPacketService::KCapsActivate, EFalse );
       
    73 	    
       
    74 	    if ( iIsDialUpContext )
       
    75 	        {
       
    76 	        iMmPacketService->ResetPointerToDialUpContext( iContextName );
       
    77 	        }
       
    78 	    
       
    79 		}
       
    80 		
       
    81     delete iMmPacketContextGsmWcdmaExt;
       
    82     delete iTsyReqHandleStore;
       
    83 
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CMmPacketContextTsy::InitModulesL
       
    88 // Initialises extension modules for CMmPacketContextTsy
       
    89 // (other items were commented in a header).
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 void CMmPacketContextTsy::InitModulesL()
       
    93     {
       
    94 
       
    95     iMmPacketContextGsmWcdmaExt = 
       
    96         CMmPacketContextGsmWcdmaExt::NewL( this, iMmPacketService );
       
    97 
       
    98 #ifdef REQHANDLE_TIMER   
       
    99     // Create req handle store
       
   100     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL(  this,
       
   101         iMmPacketService->PhoneTsy(), EMaxNumOfPacketContextRequests,
       
   102         iPacketContextReqHandles );
       
   103 
       
   104 #else
       
   105         // Create req handle store
       
   106     iTsyReqHandleStore = CMmTsyReqHandleStore::NewL( 
       
   107         EMaxNumOfPacketContextRequests, iPacketContextReqHandles );
       
   108 
       
   109 #endif // REQHANDLE_TIMER
       
   110 
       
   111     }
       
   112 
       
   113 // ---------------------------------------------------------------------------
       
   114 // CMmPacketContextTsy::InitInternalAttributes
       
   115 // Initialises miscellaneous internal attributes.
       
   116 // (other items were commented in a header).
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 void CMmPacketContextTsy::InitInternalAttributes()
       
   120     {
       
   121     iQoSProfile = NULL;
       
   122     iQoSProfileName.Zero();
       
   123 
       
   124     iLastErrorCause = KErrNone;
       
   125     iContextStatus = RPacketContext::EStatusUnknown;
       
   126     iContextStatusBeforeSuspending = RPacketContext::EStatusUnknown;
       
   127     iConnectionSpeed = 0;
       
   128     iNotifyConnectionSpeed = 0;
       
   129     iIsDialUpContext = EFalse;
       
   130 
       
   131     if ( iContextName.Compare( KStringExternal )== 0 
       
   132          || iContextName.Compare( KStringExternal2 )== 0 )
       
   133         {
       
   134         iIsDialUpContext = ETrue;
       
   135         }
       
   136     }
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // CMmPacketContextTsy::Init
       
   140 // Initialisation method that is called from ETel Server.
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 void CMmPacketContextTsy::Init()
       
   144     {
       
   145     }
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // CMmPacketContextTsy::ExtFunc
       
   149 // TRAP's all CMmPacketContextTsy related MM Packet API requests in case that
       
   150 // they fail. This method functions only as a centralized TRAP for the
       
   151 // DoExtFuncL method that does the actual mapping of IPC number to TSY method
       
   152 // call.
       
   153 // (other items were commented in a header).
       
   154 // ---------------------------------------------------------------------------
       
   155 //
       
   156 TInt CMmPacketContextTsy::ExtFunc( 
       
   157         const TTsyReqHandle aTsyReqHandle, 
       
   158         const TInt aIpc, 
       
   159         const TDataPackage& aPackage )  
       
   160     {
       
   161 TFLOGSTRING3( "TSY: CMmPacketContextTsy::ExtFunc. IPC: %d Context name:%S", aIpc, &iContextName );
       
   162 
       
   163     TInt ret( KErrNone );
       
   164     TInt trapError( KErrNone );
       
   165 
       
   166     // Reset last tsy request type
       
   167     iReqHandleType = EMultimodePacketContextReqHandleUnknown;
       
   168 
       
   169     // Trap the call of DoExtFuncL
       
   170     TRAP( trapError, ret = DoExtFuncL( aTsyReqHandle, aIpc, aPackage ) );
       
   171 
       
   172     if ( KErrNone != trapError )
       
   173         {
       
   174         ReqCompleted( aTsyReqHandle, trapError );
       
   175         }
       
   176 
       
   177     else if ( KErrNone != ret )
       
   178         {
       
   179         ReqCompleted( aTsyReqHandle, ret );
       
   180         }
       
   181 
       
   182     if ( EMultimodePacketContextReqHandleUnknown != iReqHandleType )
       
   183         {
       
   184 #ifdef REQHANDLE_TIMER
       
   185         SetTypeOfResponse( iReqHandleType, aTsyReqHandle );
       
   186 #else
       
   187         iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, aTsyReqHandle );
       
   188 #endif // REQHANDLE_TIMER
       
   189         }
       
   190 
       
   191     return KErrNone;
       
   192     }
       
   193 
       
   194 // ---------------------------------------------------------------------------
       
   195 // CMmPacketContextTsy::DoExtFuncL
       
   196 // Packet Data specific functionality of CMmPacketContextTsy::ExtFunc
       
   197 // ---------------------------------------------------------------------------
       
   198 //
       
   199 TInt CMmPacketContextTsy::DoExtFuncL( 
       
   200         const TTsyReqHandle aTsyReqHandle,      
       
   201         const TInt aIpc,      
       
   202         const TDataPackage& aPackage )   
       
   203     {
       
   204 TFLOGSTRING3( "TSY: CMmPacketContextTsy::DoExtFuncL. IPC: %d Handle:%d",
       
   205                 aIpc, aTsyReqHandle );
       
   206 
       
   207     TInt ret( KErrNotSupported );
       
   208 
       
   209     TAny* dataPtr = aPackage.Ptr1();
       
   210     TAny* dataPtr2 = aPackage.Ptr2();
       
   211 
       
   212     switch ( aIpc )
       
   213         {
       
   214         case EPacketContextNotifyStatusChange:
       
   215             ret = NotifyStatusChange( 
       
   216                 REINTERPRET_CAST( RPacketContext::TContextStatus*, dataPtr ) );
       
   217             break;
       
   218         case EPacketContextNotifyConfigChanged:
       
   219             ret = NotifyConfigChanged( 
       
   220                 REINTERPRET_CAST( TPacketDataConfigBase*, dataPtr ) );
       
   221             break;
       
   222         case EPacketContextNotifyConnectionSpeedChange:
       
   223             ret = NotifyConnectionSpeedChange( 
       
   224                 REINTERPRET_CAST( TUint*, dataPtr ) );
       
   225             break;
       
   226         case EPacketContextInitialiseContext:
       
   227             {
       
   228             TDes8* paramData = aPackage.Des1n();
       
   229             
       
   230             if(paramData != NULL)
       
   231             	{
       
   232             	if(sizeof(RPacketContext::TDataChannelV2) > paramData->MaxLength())
       
   233             		{
       
   234             		ret = KErrArgument;
       
   235             		}
       
   236             	else
       
   237             		{
       
   238             		ret = InitialiseContextL( reinterpret_cast< RPacketContext::TDataChannelV2*>( dataPtr ));
       
   239             		}
       
   240             	}
       
   241             else
       
   242             	{
       
   243             	ret = KErrArgument;
       
   244             	}
       
   245             break;
       
   246             }
       
   247         case EPacketContextSetConfig:
       
   248             ret = SetConfigL( 
       
   249                 REINTERPRET_CAST( TPacketDataConfigBase*, dataPtr ) );
       
   250             break;
       
   251         case EPacketContextActivate:
       
   252             ret = ActivateL();
       
   253             break;
       
   254         case EPacketContextDeactivate:
       
   255             ret = DeactivateL();
       
   256             break;
       
   257         case EPacketContextDelete:
       
   258             ret = DeleteL();
       
   259             break;
       
   260         case EPacketContextGetStatus:
       
   261             ret = GetStatus( aTsyReqHandle, 
       
   262                 REINTERPRET_CAST( RPacketContext::TContextStatus*, dataPtr ) );
       
   263             break;
       
   264         case EPacketContextGetConfig:
       
   265             ret = GetConfig( aTsyReqHandle, 
       
   266                 REINTERPRET_CAST( TPacketDataConfigBase*, dataPtr ) );
       
   267             break;
       
   268         case EPacketContextGetProfileName:
       
   269             ret = GetProfileName( aTsyReqHandle, 
       
   270                 REINTERPRET_CAST( TInfoName*, dataPtr ) );
       
   271             break;
       
   272         case EPacketContextGetConnectionSpeed:
       
   273             ret = GetConnectionSpeed( aTsyReqHandle, 
       
   274                 REINTERPRET_CAST( TUint*, dataPtr ) );
       
   275             break;
       
   276         case EPacketContextGetLastErrorCause:
       
   277             ret = GetLastErrorCause( aTsyReqHandle, 
       
   278                 REINTERPRET_CAST( TInt*, dataPtr ) );
       
   279             break;
       
   280         case EPacketContextGetDataVolumeTransferred:
       
   281             ret = GetDataVolumeTransferredL( aTsyReqHandle,
       
   282                 REINTERPRET_CAST( RPacketContext::TDataVolume*, dataPtr ) );
       
   283             break;
       
   284         case EPacketContextEnumeratePacketFilters:
       
   285             ret = EnumeratePacketFilters( aTsyReqHandle,
       
   286                 REINTERPRET_CAST( TInt*, dataPtr ) );
       
   287             break;
       
   288         case EPacketContextGetPacketFilterInfo:
       
   289             {
       
   290             TDes8* paramData = aPackage.Des2n();
       
   291             
       
   292             if (paramData)
       
   293             	{
       
   294             	TInt paramLength = paramData->MaxLength();
       
   295             	
       
   296             	RPacketContext::TPacketFilterV2 temp;
       
   297             	RPacketContext::TPacketFilterV2Pckg tempPckg(temp);
       
   298             	
       
   299             	TInt expectedLength = tempPckg.MaxLength();
       
   300 
       
   301 				if (paramLength == expectedLength)
       
   302 					{
       
   303 		            ret = GetPacketFilterInfo( aTsyReqHandle, REINTERPRET_CAST( TInt*, dataPtr ), REINTERPRET_CAST( TPacketBase*, dataPtr2 ) );
       
   304 					}
       
   305 				else
       
   306 					{
       
   307 					ret = KErrArgument;
       
   308 					}
       
   309             	}
       
   310             else
       
   311             	{
       
   312             	ret = KErrArgument;
       
   313             	}
       
   314             	
       
   315             }
       
   316             break;
       
   317         case EPacketContextAddPacketFilter:
       
   318             ret = AddPacketFilterL( aTsyReqHandle, aPackage.Des1n() );
       
   319             break;
       
   320         case EPacketContextRemovePacketFilter:
       
   321 #ifdef USING_CTSY_DISPATCHER            
       
   322         	ret = RemovePacketFilter( REINTERPRET_CAST( TInt*, dataPtr ) );
       
   323 #else
       
   324         	ret = RemovePacketFilter( aTsyReqHandle,
       
   325                 REINTERPRET_CAST( TInt*, dataPtr ) );     
       
   326 #endif        	
       
   327         	break;
       
   328         case EPacketContextModifyActiveContext:
       
   329             ret = ModifyActiveContextL();
       
   330             break;
       
   331         case EPacketContextGetDNSInfo:
       
   332             ret = GetDnsInfo( aTsyReqHandle, aPackage.Des1n() );
       
   333             break;
       
   334         case EPacketAddMediaAuthorization:
       
   335 	        ret = AddMediaAuthorizationL( aTsyReqHandle, aPackage.Des1n() );
       
   336 	        break;
       
   337 	    case EPacketRemoveMediaAuthorization:
       
   338 	        ret = RemoveMediaAuthorization( aTsyReqHandle, 
       
   339 	        		REINTERPRET_CAST( RPacketContext::TAuthorizationToken*,
       
   340                     dataPtr ) );
       
   341 	        break;	        
       
   342 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   343         case EPacketContextGetConnectionInfo:
       
   344             ret = GetConnectionInfo( aTsyReqHandle, 
       
   345                 reinterpret_cast<TConnectionInfoBase*>( dataPtr ) );            
       
   346             break;
       
   347         case EPacketContextNotifyConnectionInfoChange:
       
   348             ret = NotifyConnectionInfoChange(
       
   349                 reinterpret_cast<TConnectionInfoBase*>( dataPtr ) ); 
       
   350             break;      
       
   351 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   352         // These requests currently not supported
       
   353         //case EPacketContextLoanCommPort:
       
   354         //case EPacketContextRecoverCommPort:
       
   355         //case EPacketContextNotifyDataTransferred:
       
   356         default:
       
   357             break;
       
   358         }
       
   359 
       
   360     return ret;
       
   361     }
       
   362 
       
   363 // ---------------------------------------------------------------------------
       
   364 // CMmPacketContextTsy::ReqModeL
       
   365 // Returns request mode for given IPC.
       
   366 // ---------------------------------------------------------------------------
       
   367 //
       
   368 CTelObject::TReqMode CMmPacketContextTsy::ReqModeL( 
       
   369         const TInt aIpc ) 
       
   370     {
       
   371 TFLOGSTRING2( "TSY: CMmPacketContextTsy::ReqModeL. IPC: %d", aIpc );
       
   372 
       
   373     CTelObject::TReqMode reqMode( 0 );
       
   374     TBool doLeave( EFalse );
       
   375 
       
   376     switch ( aIpc )
       
   377         {
       
   378         // All disabled
       
   379         // TSYs wishing to implement their own buffering algorithm will place 
       
   380         // all requests in this category.  
       
   381 
       
   382         // Get methods that do not use DOS and return immediately. 
       
   383         // Flow control not required.
       
   384         case EPacketContextGetConnectionSpeed:
       
   385         case EPacketContextGetLastErrorCause:
       
   386         case EPacketContextGetProfileName:
       
   387         case EPacketContextEnumeratePacketFilters:
       
   388         case EPacketContextGetPacketFilterInfo:
       
   389 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   390         case EPacketContextGetConnectionInfo:                      
       
   391 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   392 
       
   393         // Other methods that do not use DOS and return immediately. 
       
   394         // Flow control not required.
       
   395     
       
   396         // Methods that can propably take a long time and cannot therefore be
       
   397         // flow controlled. Solution: All these methods must check req handle
       
   398         // table before handling the request. In case that the request table 
       
   399         // indicates that same method has been called and has not been 
       
   400         // completed, the method should return KErrServerBusy.
       
   401             if ( iIsDialUpContext )
       
   402                 {
       
   403                 doLeave = ETrue;
       
   404                 break;
       
   405                 }
       
   406         case EPacketContextGetStatus:
       
   407         case EPacketContextGetConfig:
       
   408             break;
       
   409 
       
   410         // KReqModeFlowControlObeyed
       
   411         // Commands that change the state of the phone, e.g. clearing the AoC 
       
   412         // counter, are commands that the TSY should only deal with one at 
       
   413         // a time.
       
   414 
       
   415         case EPacketContextInitialiseContext:
       
   416         case EPacketContextActivate:
       
   417         case EPacketContextDelete:
       
   418         case EPacketContextSetConfig:
       
   419         case EPacketContextAddPacketFilter:
       
   420         case EPacketContextRemovePacketFilter:
       
   421         case EPacketContextModifyActiveContext:
       
   422         case EPacketContextGetDNSInfo:
       
   423         case EPacketAddMediaAuthorization:
       
   424         case EPacketRemoveMediaAuthorization:
       
   425             if ( iIsDialUpContext )
       
   426                 {
       
   427                 doLeave = ETrue;
       
   428                 break;
       
   429                 }
       
   430         case EPacketContextDeactivate:
       
   431         case EPacketContextGetDataVolumeTransferred:
       
   432 
       
   433             {
       
   434             reqMode = KReqModeFlowControlObeyed;
       
   435             break;
       
   436             }
       
   437 
       
   438         // KReqModeMultipleCompletionEnabled | ReqModePostImmediately
       
   439         // Requests that notify a client about a change of state.
       
   440         // Since these requests do not require the issuing of any modem 
       
   441         // commands, they do not have to obey flow control.
       
   442         // The TSY never gets more than one of these outstanding.
       
   443         case EPacketContextNotifyConfigChanged:
       
   444         case EPacketContextNotifyConnectionSpeedChange:
       
   445             if ( iIsDialUpContext )
       
   446                 {
       
   447                 doLeave = ETrue;
       
   448                 break;
       
   449                 }
       
   450         case EPacketContextNotifyStatusChange:
       
   451 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   452         case EPacketContextNotifyConnectionInfoChange:           
       
   453 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   454             reqMode = KReqModeMultipleCompletionEnabled |
       
   455                 KReqModeRePostImmediately;
       
   456             break;
       
   457 
       
   458         // Cancel Requests
       
   459         // It's not necessary to include the Cancel methods in ReqModeL at all.
       
   460         // The ETel server never calls ReqModeL with a Cancel IPC.
       
   461 
       
   462         // Other variations of return values are unusable.
       
   463         // Following requests are not supported
       
   464         //case EPacketContextNotifyDataTransferred:
       
   465         //case EPacketContextLoanCommPort:
       
   466         //case EPacketContextRecoverCommPort:
       
   467         // Default
       
   468         default:
       
   469             doLeave = ETrue;
       
   470             break;
       
   471         }
       
   472 
       
   473     if ( doLeave )
       
   474         {
       
   475         User::Leave( KErrNotSupported );
       
   476         }
       
   477 
       
   478     return reqMode;
       
   479     }
       
   480 
       
   481 // ---------------------------------------------------------------------------
       
   482 // CMmPacketContextTsy::NumberOfSlotsL
       
   483 // Returns number of slots to be used for given IPC.
       
   484 // (other items were commented in a header).
       
   485 // ---------------------------------------------------------------------------
       
   486 //
       
   487 TInt CMmPacketContextTsy::NumberOfSlotsL(    
       
   488         const TInt aIpc )                            
       
   489     {
       
   490     TInt numberOfSlots( 0 );
       
   491 
       
   492     switch ( aIpc )
       
   493         {
       
   494         case EPacketContextNotifyStatusChange:
       
   495             numberOfSlots = KMmPacketContextNotifyStatusChangeSlots;
       
   496             break;
       
   497         case EPacketContextNotifyConfigChanged:
       
   498             numberOfSlots = KMmPacketContextNotifyConfigChangedSlots;
       
   499             break;
       
   500         case EPacketContextNotifyConnectionSpeedChange:
       
   501             numberOfSlots = KMmPacketContextNotifyConnectionSpeedChangeSlots;
       
   502             break;
       
   503 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   504         case EPacketContextNotifyConnectionInfoChange:
       
   505             numberOfSlots = KMmPacketContextNotifyConnectionInfoChangeSlots;
       
   506             break;                       
       
   507 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   508         default:
       
   509             // Unknown or invalid IPC
       
   510             User::Leave( KErrNotSupported );
       
   511             break;
       
   512 
       
   513         }  
       
   514 TFLOGSTRING3( "TSY: CMmPacketContextTsy::NumberOfSlotsL. IPC: %d Number of slots: %d",
       
   515                 aIpc, numberOfSlots );
       
   516 
       
   517     return numberOfSlots;
       
   518 
       
   519     }
       
   520 
       
   521 // ---------------------------------------------------------------------------
       
   522 // CMmPacketContextTsy::CancelService
       
   523 // Cancel the outstanding request.ETel Server when it is "cleaning-up" any
       
   524 //  outstanding asynchronous requests before closing a client's sub-session.
       
   525 //  This will happen if a client closes its R-class handle without cancelling
       
   526 //  outstanding asynchronous requests. Only Packet API requests are handled 
       
   527 //  here. Client can also cancel a request by calling CancelAsyncRequest 
       
   528 //  (defined in etel.h). The ETel server passes this kind of cancel requests
       
   529 //  to CancelService.
       
   530 // (other items were commented in a header).
       
   531 // ---------------------------------------------------------------------------
       
   532 //
       
   533 TInt CMmPacketContextTsy::CancelService(    
       
   534         const TInt aIpc,                            
       
   535         const TTsyReqHandle aTsyReqHandle )         
       
   536     {
       
   537 TFLOGSTRING3( "TSY: CMmPacketContextTsy::CancelService. IPC: %d Handle:%d",
       
   538                 aIpc, aTsyReqHandle );
       
   539 
       
   540     TInt ret( KErrNone );
       
   541 	TTsyReqHandle reqHandle( NULL );
       
   542     // Reset last tsy request type
       
   543     iReqHandleType = EMultimodePacketContextReqHandleUnknown;
       
   544 
       
   545     switch ( aIpc )
       
   546         {
       
   547         // TSY has started a request and it is not possible to then cancel 
       
   548         // this request. The best thing for the TSY to do in this case is to
       
   549         // proceed as though the Cancel never happened. The server's call to
       
   550         // the TSY cancel function will return synchronously. The TSY then
       
   551         // continues to wait for the original acknowledgement and when it
       
   552         // receives it, the TSY will complete the original request.
       
   553         case EPacketContextInitialiseContext:
       
   554         case EPacketContextActivate:
       
   555         case EPacketContextDeactivate:
       
   556         case EPacketContextDelete:
       
   557         case EPacketContextSetConfig:
       
   558         case EPacketContextGetConfig:
       
   559         case EPacketContextGetConnectionSpeed:
       
   560         case EPacketContextGetDataVolumeTransferred:
       
   561         case EPacketContextEnumeratePacketFilters:
       
   562         case EPacketContextGetPacketFilterInfo:
       
   563         case EPacketContextAddPacketFilter:
       
   564         case EPacketContextRemovePacketFilter:
       
   565         case EPacketContextModifyActiveContext:
       
   566         case EPacketContextGetDNSInfo:
       
   567         case EPacketAddMediaAuthorization:
       
   568         case EPacketRemoveMediaAuthorization:
       
   569 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   570         case EPacketContextGetConnectionInfo:                     
       
   571 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   572             break;
       
   573         // Notification Cancels, no special requirements.
       
   574         case EPacketContextNotifyStatusChange:
       
   575             iRetNotifyStatus = NULL;
       
   576             iReqHandleType = EMultimodePacketContextNotifyStatusChange;
       
   577             break;
       
   578         case EPacketContextNotifyConfigChanged:
       
   579             reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
       
   580                 EMultimodePacketContextNotifyConfigChanged );
       
   581             if ( aTsyReqHandle == reqHandle )
       
   582                 {
       
   583                 iRetNotifyConfig = NULL;
       
   584                 iReqHandleType = EMultimodePacketContextNotifyConfigChanged;
       
   585                 }
       
   586             else
       
   587                 {
       
   588                 reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
       
   589                     EMultimodePacketContextNotifyConfigChanged99 );
       
   590                 if ( aTsyReqHandle == reqHandle )
       
   591                     {
       
   592                     iRetNotifyConfig2 = NULL;
       
   593                     iReqHandleType =
       
   594                         EMultimodePacketContextNotifyConfigChanged99;
       
   595                     }
       
   596                 }
       
   597             break;
       
   598         case EPacketContextNotifyConnectionSpeedChange:
       
   599             iRetNotifyConnectionSpeed = NULL;
       
   600             iReqHandleType = 
       
   601                 EMultimodePacketContextNotifyConnectionSpeedChange;
       
   602             break;
       
   603 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   604         case EPacketContextNotifyConnectionInfoChange:
       
   605             iRetNotifyConnectionInfo = NULL;
       
   606             iReqHandleType =
       
   607                 EMultimodePacketContextNotifyConnectionInfoChange;
       
   608             break;                       
       
   609 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   610         // IPCs that are not supported
       
   611         //case EPacketContextLoanCommPort:
       
   612         //case EPacketContextRecoverCommPort:
       
   613         //case EPacketContextNotifyDataTransferred:
       
   614         // Default
       
   615         default:
       
   616             ret = KErrNotSupported;
       
   617             break;
       
   618         }
       
   619 
       
   620     if ( EMultimodePacketContextReqHandleUnknown != iReqHandleType )
       
   621         {
       
   622         // Reset tsy request handle
       
   623         iTsyReqHandleStore->ResetTsyReqHandle( iReqHandleType );
       
   624 
       
   625         // Complete request
       
   626         CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, KErrCancel );
       
   627         }
       
   628 
       
   629     return ret;
       
   630     }
       
   631 
       
   632 // ---------------------------------------------------------------------------
       
   633 // CMmPacketContextTsy::RegisterNotification
       
   634 // Register notification. RegisterNotification is called when the ETel Server
       
   635 // recognises that this notification is being posted for the first time on
       
   636 // this subsession object.It enables the TSY to "turn on" any regular 
       
   637 // notification messages that it may receive from DOS. If this object is
       
   638 // Dial-Up context only supported notification is 
       
   639 // EPacketContextNotifyStatusChange.
       
   640 // (other items were commented in a header).
       
   641 // ---------------------------------------------------------------------------
       
   642 //
       
   643 TInt CMmPacketContextTsy::RegisterNotification( 
       
   644         const TInt aIpc )              
       
   645     {
       
   646 TFLOGSTRING2( "TSY: CMmPacketContextTsy::RegisterNotification. IPC: %d", aIpc );
       
   647 
       
   648     TInt ret( KErrNone );
       
   649 
       
   650     switch ( aIpc )
       
   651         {
       
   652         case EPacketContextNotifyConfigChanged:
       
   653         case EPacketContextNotifyConnectionSpeedChange:
       
   654             if ( iIsDialUpContext )
       
   655                 {
       
   656                 ret = KErrNotSupported;
       
   657                 break;
       
   658                 }
       
   659         case EPacketContextNotifyStatusChange:          
       
   660 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   661         case EPacketContextNotifyConnectionInfoChange:                       
       
   662 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   663             break;
       
   664         //case EPacketContextNotifyDataTransferred:
       
   665         default:
       
   666             // Not supported
       
   667             ret = KErrNotSupported;
       
   668             break;
       
   669         }
       
   670 
       
   671     return ret;
       
   672     }
       
   673 
       
   674 // ---------------------------------------------------------------------------
       
   675 // CMmPacketContextTsy::DeregisterNotification
       
   676 // Deregister notification. DeregisterNotification is called when the ETel
       
   677 // Server recognises that this notification will not be posted again because 
       
   678 // the last client to have a handle on this sub-session object has just closed 
       
   679 // the handle. It enables the TSY to "turn off" any regular notification
       
   680 // messages that it may receive from DOS. If this object is Dial-Up context
       
   681 // only supported notification is EPacketContextNotifyStatusChange.
       
   682 // (other items were commented in a header).
       
   683 // ---------------------------------------------------------------------------
       
   684 //
       
   685 TInt CMmPacketContextTsy::DeregisterNotification(
       
   686         const TInt aIpc )                          
       
   687     {
       
   688 TFLOGSTRING2( "TSY: CMmPacketContextTsy::DeregisterNotification. IPC: %d", aIpc );
       
   689 
       
   690     TInt ret( KErrNone );
       
   691 
       
   692     switch ( aIpc )
       
   693         {
       
   694         case EPacketContextNotifyConfigChanged:
       
   695         case EPacketContextNotifyConnectionSpeedChange:
       
   696             if ( iIsDialUpContext )
       
   697                 {
       
   698                 ret = KErrNotSupported;
       
   699                 break;
       
   700                 }
       
   701         case EPacketContextNotifyStatusChange:
       
   702 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   703         case EPacketContextNotifyConnectionInfoChange:                    
       
   704 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   705             break;
       
   706         //case EPacketContextNotifyDataTransferred:
       
   707         default:
       
   708             // Not supported
       
   709             ret = KErrNotSupported;
       
   710             break;
       
   711         }
       
   712 
       
   713     return ret;
       
   714     }
       
   715 
       
   716 // ---------------------------------------------------------------------------
       
   717 // CMmPacketContextTsy::OpenNewObjectL
       
   718 // Create new QoS object and return a pointer to it.
       
   719 // (other items were commented in a header).
       
   720 // ---------------------------------------------------------------------------
       
   721 //
       
   722 CTelObject* CMmPacketContextTsy::OpenNewObjectL(    
       
   723         TDes& aNewName )                          
       
   724     {
       
   725 TFLOGSTRING( "TSY: CMmPacketContextTsy::OpenNewObjectL." );
       
   726 
       
   727     // Each context can have only one QoS
       
   728     if ( NULL != iQoSProfile )
       
   729         {
       
   730 TFLOGSTRING2( "TSY: CMmPacketContextTsy::OpenNewObjectL. Leaves with: %d", KErrAlreadyExists );
       
   731         User::Leave( KErrAlreadyExists );
       
   732         }
       
   733     
       
   734     else
       
   735         {
       
   736         // Create new QoS object
       
   737         iQoSProfile = CMmPacketQoSTsy::NewL( iMmPacketService, this );
       
   738 
       
   739         iQoSProfileName.Copy( iContextName );
       
   740         aNewName.Copy( iQoSProfileName );
       
   741         }
       
   742 TFLOGSTRING2( "TSY: CMmPacketContextTsy::OpenNewObjectL. aNewName: %S", &aNewName );
       
   743 
       
   744     return iQoSProfile;
       
   745     }
       
   746 
       
   747 // ---------------------------------------------------------------------------
       
   748 // CMmPacketContextTsy::OpenNewObjectByNameL
       
   749 // Return a pointer to QoS if it exists. The ETel Server calls this method 
       
   750 // after some client has requested to open existing QoS object. The TSY 
       
   751 // classes must not use this method.
       
   752 // (other items were commented in a header).
       
   753 // ---------------------------------------------------------------------------
       
   754 //
       
   755 CTelObject* CMmPacketContextTsy::OpenNewObjectByNameL(    
       
   756         const TDesC& aName )                     
       
   757     {
       
   758 TFLOGSTRING2( "TSY: CMmPacketContextTsy::OpenNewObjectByNameL. aName: %S", &aName );
       
   759 
       
   760     if ( aName != iQoSProfileName )
       
   761         {
       
   762 TFLOGSTRING2( "TSY: CMmPacketContextTsy::OpenNewObjectByNameL. Leaves with: %d", KErrNotFound );
       
   763         User::Leave( KErrNotFound );
       
   764         }
       
   765 
       
   766     return iQoSProfile;
       
   767     }
       
   768 
       
   769 // ---------------------------------------------------------------------------
       
   770 // CMmPacketContextTsy::InitialiseContextL
       
   771 // This function initialises the context created previously.
       
   772 // (other items were commented in a header).
       
   773 // ---------------------------------------------------------------------------
       
   774 //
       
   775 TInt CMmPacketContextTsy::InitialiseContextL(RPacketContext::TDataChannelV2* aDataChannel )
       
   776     {
       
   777 TFLOGSTRING( "TSY: CMmPacketContextTsy::InitialiseContextL." );
       
   778 
       
   779     TInt ret( KErrNone );
       
   780 
       
   781     // Initialise Context
       
   782     ret = iMmPacketContextGsmWcdmaExt->InitialiseContextL(aDataChannel);
       
   783 
       
   784     if ( KErrNone == ret )
       
   785         {
       
   786         // Store the request handle
       
   787         iReqHandleType = EMultimodePacketContextInitialiseContext;
       
   788         }
       
   789 
       
   790     return ret;
       
   791     }
       
   792 
       
   793 // ---------------------------------------------------------------------------
       
   794 // CMmPacketContextTsy::CompleteInitialiseContext
       
   795 // Complete the asynchronous InitialiseContext request.
       
   796 // (other items were commented in a header).
       
   797 // ---------------------------------------------------------------------------
       
   798 //
       
   799 void CMmPacketContextTsy::CompleteInitialiseContext(const TInt aResult )     
       
   800     {
       
   801 TFLOGSTRING2( "TSY: CMmPacketContextTsy::CompleteInitialiseContext. Error: %d", aResult );
       
   802 
       
   803     // Reset the req handle. Returns the deleted req handle
       
   804     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
   805         EMultimodePacketContextInitialiseContext );
       
   806 
       
   807     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
   808         {
       
   809                // Complete the client request
       
   810         CMmPacketContextTsy::ReqCompleted( reqHandle, aResult );
       
   811         }
       
   812 
       
   813     }
       
   814 
       
   815 // ---------------------------------------------------------------------------
       
   816 // CMmPacketContextTsy::ActivateL
       
   817 // Activate a context. This function activates a context that has been
       
   818 // previously configured using the SetConfig() method from RPacketContext.
       
   819 // Once this function completes, the context will remain in an 'Activating'
       
   820 // state until PPP has been successfully negotiated between the phone & the
       
   821 // packet network gateway.Once PPP is negotiated, the context can be 
       
   822 // considered to be 'Activated'.
       
   823 // (other items were commented in a header).
       
   824 // ---------------------------------------------------------------------------
       
   825 //
       
   826 TInt CMmPacketContextTsy::ActivateL()
       
   827     {
       
   828 TFLOGSTRING2( "TSY: CMmPacketContextTsy::ActivateL. Context name:%S", &iContextName );
       
   829 
       
   830     TInt ret( KErrGprsServicesNotAllowed );
       
   831 
       
   832     if ( iMmPacketService->IsActivationAllowed() )
       
   833         {
       
   834         // Call ActivateL
       
   835         ret = iMmPacketContextGsmWcdmaExt->ActivateL();
       
   836         }
       
   837 
       
   838     if ( KErrNone == ret )
       
   839         {
       
   840         // Store the request handle
       
   841         iReqHandleType = EMultimodePacketContextActivate;
       
   842         }
       
   843 
       
   844     return ret;        
       
   845     }
       
   846 
       
   847 // ---------------------------------------------------------------------------
       
   848 // CMmPacketContextTsy::CompleteActivate
       
   849 // Complete the asynchronous Activate request.
       
   850 // (other items were commented in a header).
       
   851 // ---------------------------------------------------------------------------
       
   852 //
       
   853 void CMmPacketContextTsy::CompleteActivate( 
       
   854         const TInt aResult )
       
   855     {
       
   856 TFLOGSTRING2( "TSY: CMmPacketContextTsy::CompleteActivate. Error: %d", aResult );
       
   857     // Reset the req handle. Returns the deleted req handle
       
   858     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
   859         EMultimodePacketContextActivate );
       
   860 
       
   861     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
   862         {
       
   863        
       
   864         // Complete the client request
       
   865         CMmPacketContextTsy::ReqCompleted( reqHandle, aResult );
       
   866         }
       
   867     }
       
   868 
       
   869 // ---------------------------------------------------------------------------
       
   870 // CMmPacketContextTsy::Deactivate
       
   871 // Deactivate a context previously configured on the phone.
       
   872 // (other items were commented in a header).
       
   873 // ---------------------------------------------------------------------------
       
   874 //
       
   875 TInt CMmPacketContextTsy::DeactivateL()
       
   876     {
       
   877 TFLOGSTRING2( "TSY: CMmPacketContextTsy::DeactivateL. Context name:%S", &iContextName );
       
   878     TInt ret( KErrNone );
       
   879 
       
   880     // Call Deactivate
       
   881     ret = iMmPacketContextGsmWcdmaExt->DeactivateL();
       
   882 
       
   883     if ( KErrNone == ret )
       
   884         {
       
   885         // Store the request handle
       
   886         iReqHandleType = EMultimodePacketContextDeactivate;
       
   887         }
       
   888 
       
   889     return ret;  
       
   890     }
       
   891 
       
   892 // ---------------------------------------------------------------------------
       
   893 // CMmPacketContextTsy::CompleteDeactivate
       
   894 // Complete the asynchronous Deactivate request.
       
   895 // (other items were commented in a header).
       
   896 // ---------------------------------------------------------------------------
       
   897 //
       
   898 void CMmPacketContextTsy::CompleteDeactivate( 
       
   899         const TInt aResult )    
       
   900     {
       
   901 TFLOGSTRING2( "TSY: CMmPacketContextTsy::CompleteDeactivate. Error: %d", aResult );
       
   902     // Reset the req handle. Returns the deleted req handle
       
   903     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
   904         EMultimodePacketContextDeactivate );
       
   905 
       
   906     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
   907         {
       
   908         
       
   909         // Complete the client request
       
   910         CMmPacketContextTsy::ReqCompleted( reqHandle, aResult );
       
   911         }
       
   912     }
       
   913 
       
   914 // ---------------------------------------------------------------------------
       
   915 // CMmPacketContextTsy::DeleteL
       
   916 // Delete a context id previously created on the phone.
       
   917 // Note that although the context is considered as 'deleted', the 
       
   918 // client's RPacketContext subsession remains. To remove this, a client must
       
   919 // call Close() from RPacketContext.
       
   920 // (other items were commented in a header).
       
   921 // ---------------------------------------------------------------------------
       
   922 //
       
   923 TInt CMmPacketContextTsy::DeleteL()
       
   924     {
       
   925 TFLOGSTRING2( "TSY: CMmPacketContextTsy::DeleteL. Context name:%S", &iContextName );
       
   926 
       
   927     TInt ret( KErrNone );
       
   928 
       
   929     // Call DeleteL
       
   930     ret = iMmPacketContextGsmWcdmaExt->DeleteL();
       
   931 
       
   932     if ( KErrNone == ret )
       
   933         {
       
   934         // Store the request handle
       
   935         iReqHandleType = EMultimodePacketContextDelete;
       
   936         }
       
   937 
       
   938     return ret;
       
   939     }
       
   940 
       
   941 // ---------------------------------------------------------------------------
       
   942 // CMmPacketContextTsy::CompleteDelete
       
   943 // Complete the asynchronous Delete request.
       
   944 // (other items were commented in a header).
       
   945 // ---------------------------------------------------------------------------
       
   946 //
       
   947 void CMmPacketContextTsy::CompleteDelete( 
       
   948         const TInt aResult )        
       
   949     {
       
   950 TFLOGSTRING2( "TSY: CMmPacketContextTsy::CompleteDelete. Error: %d", aResult );
       
   951     // Reset the req handle. Returns the deleted req handle
       
   952     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
   953         EMultimodePacketContextDelete );
       
   954 
       
   955     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
   956         {
       
   957         // Complete the client request
       
   958         CMmPacketContextTsy::ReqCompleted( reqHandle, aResult );
       
   959         }
       
   960     }
       
   961 
       
   962 // ---------------------------------------------------------------------------
       
   963 // CMmPacketContextTsy::GetConfig
       
   964 // Requests the current configuration of the context.
       
   965 // (other items were commented in a header).
       
   966 // ---------------------------------------------------------------------------
       
   967 //
       
   968 TInt CMmPacketContextTsy::GetConfig(
       
   969         const TTsyReqHandle aTsyReqHandle,    
       
   970         TPacketDataConfigBase* const aConfig )  
       
   971     {
       
   972 TFLOGSTRING2( "TSY: CMmPacketContextTsy::GetConfig. Context name:%S", &iContextName );
       
   973 
       
   974     // Get config
       
   975     TInt ret = iMmPacketContextGsmWcdmaExt->GetConfig( aConfig );
       
   976 
       
   977     // Complete Request
       
   978     CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, ret );
       
   979 
       
   980     return KErrNone;
       
   981     }
       
   982 
       
   983 // ---------------------------------------------------------------------------
       
   984 // CMmPacketContextTsy::GetConnectionSpeed
       
   985 // Allows a client to get the current connection speed.
       
   986 // (other items were commented in a header).
       
   987 // ---------------------------------------------------------------------------
       
   988 //
       
   989 TInt CMmPacketContextTsy::GetConnectionSpeed(
       
   990         const TTsyReqHandle aTsyReqHandle,         
       
   991         TUint* const aRate ) 
       
   992     {
       
   993 TFLOGSTRING3( "TSY: CMmPacketContextTsy::GetConnectionSpeed. Context name: %S Connection Speed:%d bps",
       
   994              &iContextName, iConnectionSpeed );
       
   995 
       
   996     // Get current connection speed rate
       
   997     *aRate = iConnectionSpeed;
       
   998 
       
   999     // Complete Request
       
  1000     CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, KErrNone );
       
  1001 
       
  1002     return KErrNone;
       
  1003     }
       
  1004 
       
  1005 // ---------------------------------------------------------------------------
       
  1006 // CMmPacketContextTsy::GetDataVolumeTransferred
       
  1007 // This function gets the data volume transferred.
       
  1008 // (other items were commented in a header).
       
  1009 // ---------------------------------------------------------------------------
       
  1010 //
       
  1011 TInt CMmPacketContextTsy::GetDataVolumeTransferredL(
       
  1012         const TTsyReqHandle aTsyReqHandle,   
       
  1013         RPacketContext::TDataVolume* const aVolume ) 
       
  1014     {
       
  1015 TFLOGSTRING2( "TSY: CMmPacketContextTsy::GetDataVolumeTransferredL. Context name:%S", &iContextName );
       
  1016 
       
  1017     TInt ret( KErrNone );
       
  1018 
       
  1019     if ( RPacketContext::EStatusDeleted != iContextStatus )
       
  1020         {
       
  1021         // Get data volume transferred
       
  1022         ret = iMmPacketContextGsmWcdmaExt->GetDataVolumeTransferredL();
       
  1023 
       
  1024         if ( KErrNone == ret )
       
  1025             {
       
  1026             // Store pointer
       
  1027             iRetDataVolume = aVolume;
       
  1028             // Store the request handle type
       
  1029             iReqHandleType = EMultimodePacketContextGetDataVolumeTransferred;
       
  1030             }
       
  1031         }
       
  1032     else
       
  1033         {
       
  1034         // Get current data volume
       
  1035         *aVolume = iDataVolume;
       
  1036         // Complete request
       
  1037         CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, KErrNone );
       
  1038         }
       
  1039 
       
  1040     return ret;
       
  1041     }
       
  1042 
       
  1043 // ---------------------------------------------------------------------------
       
  1044 // CMmPacketContextTsy::CompleteGetDataVolumeTransferred
       
  1045 // Complete the asynchronous GetDataVolumeTransferred request.
       
  1046 // (other items were commented in a header).
       
  1047 // ---------------------------------------------------------------------------
       
  1048 //
       
  1049 void CMmPacketContextTsy::CompleteGetDataVolumeTransferred( 
       
  1050         const TInt aResult )  
       
  1051     {
       
  1052 TFLOGSTRING2( "TSY: CMmPacketContextTsy::CompleteGetDataVolumeTransferred. Error: %d", aResult );
       
  1053 
       
  1054     // Reset the req handle. Returns the deleted req handle
       
  1055     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  1056         EMultimodePacketContextGetDataVolumeTransferred );
       
  1057 
       
  1058     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
  1059         {
       
  1060         
       
  1061         if ( KErrNone == aResult )
       
  1062             {
       
  1063             *iRetDataVolume = iDataVolume;
       
  1064             }
       
  1065 
       
  1066         // Null ret pointer
       
  1067         iRetDataVolume = NULL;
       
  1068 
       
  1069         // Complete the client request
       
  1070         CMmPacketContextTsy::ReqCompleted( reqHandle, aResult );
       
  1071         }
       
  1072 
       
  1073     }
       
  1074 
       
  1075 // ---------------------------------------------------------------------------
       
  1076 // CMmPacketContextTsy::GetLastErrorCause
       
  1077 // This function retrieves the last error cause to have occurred.
       
  1078 // (other items were commented in a header).
       
  1079 // ---------------------------------------------------------------------------
       
  1080 //
       
  1081 TInt CMmPacketContextTsy::GetLastErrorCause(
       
  1082         const TTsyReqHandle aTsyReqHandle,  
       
  1083         TInt* const aError )    
       
  1084     {
       
  1085 TFLOGSTRING3( "TSY: CMmPacketContextTsy::GetLastErrorCause. Context name:%S Last error cause: %d",
       
  1086              &iContextName, iLastErrorCause );
       
  1087 
       
  1088     *aError = iLastErrorCause;
       
  1089     CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, KErrNone );
       
  1090 
       
  1091     return KErrNone;
       
  1092     }
       
  1093 
       
  1094 // ---------------------------------------------------------------------------
       
  1095 // CMmPacketContextTsy::GetProfileName
       
  1096 // Allows a client to retrieve the name of the QoS profile. The QoS profile is
       
  1097 // associated with the context. If no QoS profile has been defined by the
       
  1098 // client, the name to be returned will be NULL.
       
  1099 // (other items were commented in a header).
       
  1100 // ---------------------------------------------------------------------------
       
  1101 //
       
  1102 TInt CMmPacketContextTsy::GetProfileName(
       
  1103         const TTsyReqHandle aTsyReqHandle, 
       
  1104         TInfoName* const aQoSProfile )  
       
  1105     {
       
  1106     if ( NULL != iQoSProfile )
       
  1107         {
       
  1108         *aQoSProfile = iQoSProfileName;
       
  1109         }
       
  1110     else
       
  1111         {
       
  1112         // QoS profile not found
       
  1113         aQoSProfile->Zero();
       
  1114         }
       
  1115 
       
  1116 TFLOGSTRING3( "TSY: CMmPacketContextTsy::GetProfileName. Context name: %S QoS Profile Name: %S",
       
  1117              &iContextName, aQoSProfile );
       
  1118 
       
  1119     CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, KErrNone );
       
  1120     return KErrNone;
       
  1121     }
       
  1122 
       
  1123 // ---------------------------------------------------------------------------
       
  1124 // CMmPacketContextTsy::GetStatus
       
  1125 // Allows a client to get the current status of the context.
       
  1126 // (other items were commented in a header).
       
  1127 // ---------------------------------------------------------------------------
       
  1128 //
       
  1129 TInt CMmPacketContextTsy::GetStatus(
       
  1130         const TTsyReqHandle aTsyReqHandle,   
       
  1131         RPacketContext::TContextStatus* const aContextStatus )
       
  1132     {
       
  1133 TFLOGSTRING3( "TSY: CMmPacketContextTsy::GetStatus. Context name: %S Context Status:%d",
       
  1134              &iContextName, iContextStatus );
       
  1135     *aContextStatus = iContextStatus;
       
  1136     CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, KErrNone );
       
  1137 
       
  1138     return KErrNone;
       
  1139     }
       
  1140 
       
  1141 // ---------------------------------------------------------------------------
       
  1142 // CMmPacketContextTsy::NotifyConfigChanged
       
  1143 // Requests notification when configuration of context changes.
       
  1144 // (other items were commented in a header).
       
  1145 // ---------------------------------------------------------------------------
       
  1146 //
       
  1147 TInt CMmPacketContextTsy::NotifyConfigChanged(
       
  1148         TPacketDataConfigBase* const aConfig )  
       
  1149     {
       
  1150 TFLOGSTRING( "TSY: CMmPacketContextTsy::NotifyConfigChanged." );
       
  1151 
       
  1152     // Call NotifyConfigChanged from extension
       
  1153     TInt ret = iMmPacketContextGsmWcdmaExt->NotifyConfigChanged( *aConfig );
       
  1154 
       
  1155     if ( KErrNone == ret )
       
  1156         {
       
  1157         if ( TPacketDataConfigBase::KConfigGPRS == aConfig->ExtensionId() )
       
  1158             {
       
  1159             // Store pointer
       
  1160             iRetNotifyConfig = aConfig;
       
  1161             // Store req handle type
       
  1162             iReqHandleType = EMultimodePacketContextNotifyConfigChanged;
       
  1163             }
       
  1164 
       
  1165         else
       
  1166             {
       
  1167             // Store pointer
       
  1168             iRetNotifyConfig2 = aConfig;
       
  1169             // Store req handle type
       
  1170             iReqHandleType = EMultimodePacketContextNotifyConfigChanged99;
       
  1171             }
       
  1172         }
       
  1173 
       
  1174     return ret;
       
  1175     }
       
  1176 
       
  1177 // ---------------------------------------------------------------------------
       
  1178 // CMmPacketContextTsy::CompleteNotifyConfigChanged
       
  1179 // Complete notification when the context configuration changes.
       
  1180 // (other items were commented in a header).
       
  1181 // ---------------------------------------------------------------------------
       
  1182 //
       
  1183 void CMmPacketContextTsy::CompleteNotifyConfigChanged()
       
  1184     {
       
  1185 TFLOGSTRING2( "TSY: CMmPacketContextTsy::CompleteNotifyConfigChanged.  Context name:%S",
       
  1186                 &iContextName );
       
  1187 
       
  1188     // Get and reset req handle for R97/98 config notify
       
  1189     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  1190         EMultimodePacketContextNotifyConfigChanged );
       
  1191 
       
  1192     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
  1193         {
       
  1194         // Get current configuration
       
  1195         iMmPacketContextGsmWcdmaExt->GetConfig( iRetNotifyConfig );
       
  1196         // Null ret pointer
       
  1197         iRetNotifyConfig = NULL;
       
  1198         // Complete the client request
       
  1199         CMmPacketContextTsy::ReqCompleted( reqHandle, KErrNone );
       
  1200         }
       
  1201     
       
  1202     // Get and reset req handle for R99_R4 config notify
       
  1203     reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  1204         EMultimodePacketContextNotifyConfigChanged99 );
       
  1205 
       
  1206     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
  1207         {
       
  1208         // Get current configuration
       
  1209         iMmPacketContextGsmWcdmaExt->GetConfig( iRetNotifyConfig2 );
       
  1210         // Null ret pointer
       
  1211         iRetNotifyConfig2 = NULL;
       
  1212         // Complete the client request
       
  1213        CMmPacketContextTsy::ReqCompleted( reqHandle, KErrNone );
       
  1214         }
       
  1215     }
       
  1216 
       
  1217 // ---------------------------------------------------------------------------
       
  1218 // CMmPacketContextTsy::NotifyConnectionSpeedChange
       
  1219 // Requests notification when connection speed changes.
       
  1220 // (other items were commented in a header).
       
  1221 // ---------------------------------------------------------------------------
       
  1222 //
       
  1223 TInt CMmPacketContextTsy::NotifyConnectionSpeedChange(
       
  1224         TUint* const aRate )    
       
  1225     {
       
  1226 TFLOGSTRING( "TSY: CMmPacketContextTsy::NotifyConnectionSpeedChange." );
       
  1227 
       
  1228     // Store pointer
       
  1229     iRetNotifyConnectionSpeed = aRate;
       
  1230     // Store req handle type
       
  1231     iReqHandleType = EMultimodePacketContextNotifyConnectionSpeedChange;
       
  1232 
       
  1233     return KErrNone;
       
  1234     }
       
  1235 
       
  1236 // ---------------------------------------------------------------------------
       
  1237 // CMmPacketContextTsy::CompleteNotifyConnectionSpeedChange
       
  1238 // Complete the notification when the connection speed changes.
       
  1239 // (other items were commented in a header).
       
  1240 // ---------------------------------------------------------------------------
       
  1241 //
       
  1242 void CMmPacketContextTsy::CompleteNotifyConnectionSpeedChange(
       
  1243         TInt const aConnectionSpeed )
       
  1244     {
       
  1245     iConnectionSpeed = aConnectionSpeed;
       
  1246     
       
  1247     if ( iNotifyConnectionSpeed != iConnectionSpeed )
       
  1248         {
       
  1249 TFLOGSTRING3( "TSY: CMmPacketContextTsy::CompleteNotifyConnectionSpeedChange. Context name:%S Connection Speed:%d bps",
       
  1250             &iContextName, iConnectionSpeed );
       
  1251 
       
  1252         // Store the connection speed internally
       
  1253         iNotifyConnectionSpeed = iConnectionSpeed;
       
  1254 
       
  1255         // Get and reset req handle
       
  1256         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  1257             EMultimodePacketContextNotifyConnectionSpeedChange );
       
  1258 
       
  1259         if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
  1260             {
       
  1261             // Get current connection speed
       
  1262             *iRetNotifyConnectionSpeed = iNotifyConnectionSpeed;
       
  1263             // Null ret pointer
       
  1264             iRetNotifyConnectionSpeed = NULL;
       
  1265             // Complete the client request
       
  1266             CMmPacketContextTsy::ReqCompleted( reqHandle, KErrNone );
       
  1267             }
       
  1268         }
       
  1269     }
       
  1270 
       
  1271 // ---------------------------------------------------------------------------
       
  1272 // CMmPacketContextTsy::NotifyStatusChange
       
  1273 // Requests notification when the status of the context changes.
       
  1274 // (other items were commented in a header).
       
  1275 // ---------------------------------------------------------------------------
       
  1276 //
       
  1277 TInt CMmPacketContextTsy::NotifyStatusChange(
       
  1278         RPacketContext::TContextStatus* const aContextStatus )
       
  1279     {
       
  1280 TFLOGSTRING2( "TSY: CMmPacketContextTsy::NotifyStatusChange. Context name:%S", &iContextName );
       
  1281     iRetNotifyStatus = aContextStatus;
       
  1282     iReqHandleType = EMultimodePacketContextNotifyStatusChange;
       
  1283 
       
  1284     return KErrNone;
       
  1285     }
       
  1286 
       
  1287 // ---------------------------------------------------------------------------
       
  1288 // CMmPacketContextTsy::CompleteNotifyStatusChange
       
  1289 // Complete the notification when the context status changes.
       
  1290 // (other items were commented in a header).
       
  1291 // ---------------------------------------------------------------------------
       
  1292 //
       
  1293 void CMmPacketContextTsy::CompleteNotifyStatusChange(
       
  1294         const RPacketContext::TContextStatus aContextStatus ) 
       
  1295     {
       
  1296 
       
  1297     if ( aContextStatus != iContextStatus )
       
  1298         {
       
  1299         iContextStatus = aContextStatus;
       
  1300 TFLOGSTRING3( "TSY: CMmPacketContextTsy::CompleteNotifyStatusChange. Context name: %S  Context status:%d",
       
  1301                     &iContextName, iContextStatus );
       
  1302 
       
  1303         if ( RPacketContext::EStatusActive == iContextStatus ||
       
  1304              RPacketContext::EStatusInactive == iContextStatus ||
       
  1305              RPacketContext::EStatusDeleted == iContextStatus )
       
  1306             {
       
  1307             iMmPacketService->ContextStatusChanged( iContextStatus );
       
  1308             if( RPacketContext::EStatusDeleted == iContextStatus )
       
  1309                 {
       
  1310                 iMmPacketContextGsmWcdmaExt->SetContextStatusBeforeDeactivation(
       
  1311                     RPacketContext::EStatusDeleted );
       
  1312                 }
       
  1313             }
       
  1314 
       
  1315         // Reset req handle. Returns the deleted req handle
       
  1316         TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( 
       
  1317             EMultimodePacketContextNotifyStatusChange );
       
  1318 
       
  1319         if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
  1320             {
       
  1321             // Get current status
       
  1322             *iRetNotifyStatus = aContextStatus;
       
  1323             // Null ret pointer
       
  1324             iRetNotifyStatus = NULL;
       
  1325             // Complete the client request
       
  1326             CMmPacketContextTsy::ReqCompleted( reqHandle, KErrNone );
       
  1327             }
       
  1328         }
       
  1329     }
       
  1330 
       
  1331 // ---------------------------------------------------------------------------
       
  1332 // CMmPacketContextTsy::SetConfigL
       
  1333 // Configure a context to the phone.
       
  1334 // (other items were commented in a header).
       
  1335 // ---------------------------------------------------------------------------
       
  1336 //
       
  1337 TInt CMmPacketContextTsy::SetConfigL(
       
  1338         TPacketDataConfigBase* const aConfig ) 
       
  1339     {
       
  1340 TFLOGSTRING2( "TSY: CMmPacketContextTsy::SetConfigL. Context name:%S", &iContextName );
       
  1341 
       
  1342     // Call SetConfigL
       
  1343     TInt ret = iMmPacketContextGsmWcdmaExt->SetConfigL( aConfig );
       
  1344 
       
  1345     if ( KErrNone == ret )
       
  1346         {
       
  1347         // Store the request handle type
       
  1348         iReqHandleType = EMultimodePacketContextSetConfig;
       
  1349         }
       
  1350 
       
  1351     return ret;
       
  1352     }
       
  1353 
       
  1354 // ---------------------------------------------------------------------------
       
  1355 // CMmPacketContextTsy::CompleteSetConfig
       
  1356 // Complete the asynchronous SetConfig request.
       
  1357 // (other items were commented in a header).
       
  1358 // ---------------------------------------------------------------------------
       
  1359 //
       
  1360 void CMmPacketContextTsy::CompleteSetConfig( 
       
  1361         const TInt aError,   
       
  1362         TBool aIsAddMediaAuthorizationCalled )
       
  1363     {
       
  1364 TFLOGSTRING2( "TSY: CMmPacketContextTsy::CompleteSetConfig. Error: %d", aError );
       
  1365     
       
  1366     TTsyReqHandle reqHandle( EMultimodePacketContextReqHandleUnknown );
       
  1367     //if context exists eg. its name length is bigger than zero
       
  1368     if( 0 == CMmPacketContextTsy::HostCID().Length() )
       
  1369         {
       
  1370         reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  1371             EMultimodePacketContextSetConfig );
       
  1372         }
       
  1373 
       
  1374     else
       
  1375         {
       
  1376         if( aIsAddMediaAuthorizationCalled )
       
  1377         	{
       
  1378         	reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  1379             				EMultimodePacketContextAddMediaAuthorization );	
       
  1380         	}
       
  1381 		else
       
  1382 			{       
       
  1383 #ifdef USING_CTSY_DISPATCHER
       
  1384 			// Distinguish between RemovePacketFilter and AddPacketFilter
       
  1385 			if (iReqHandleType == EMultimodePacketContextRemovePacketFilter)
       
  1386 				{
       
  1387 				reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( EMultimodePacketContextRemovePacketFilter );
       
  1388 				}
       
  1389 			else
       
  1390 				{
       
  1391 				reqHandle = iTsyReqHandleStore->ResetTsyReqHandle( EMultimodePacketContextAddPacketFilter );
       
  1392 				}
       
  1393 #else			
       
  1394         	reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  1395             				EMultimodePacketContextAddPacketFilter );
       
  1396 #endif //USING_CTSY_DISPATCHER																       
       
  1397         	}
       
  1398         }
       
  1399         
       
  1400     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
  1401         {
       
  1402                             
       
  1403         // Complete the client request
       
  1404         CMmPacketContextTsy::ReqCompleted( reqHandle, aError );
       
  1405         }
       
  1406     }
       
  1407 
       
  1408 // ---------------------------------------------------------------------------
       
  1409 // CMmPacketContextTsy::SetDataVolume
       
  1410 // Set the volume of transferred data.
       
  1411 // (other items were commented in a header).
       
  1412 // ---------------------------------------------------------------------------
       
  1413 //
       
  1414 void CMmPacketContextTsy::SetDataVolume(
       
  1415         const TInt /* aResult */,
       
  1416         RPacketContext::TDataVolume dataVolume )
       
  1417     {
       
  1418 
       
  1419 TFLOGSTRING( "TSY: CMmPacketContextTsy::SetDataVolume" );
       
  1420    
       
  1421     if ( dataVolume.iBytesSent < iDataVolume.iBytesSent )
       
  1422         {
       
  1423         // The value of sent data has turned around the 4 GB
       
  1424         iDataVolume.iOverflowCounterSent++;
       
  1425         }
       
  1426     iDataVolume.iBytesSent = dataVolume.iBytesSent;
       
  1427 
       
  1428 
       
  1429     if ( dataVolume.iBytesReceived < iDataVolume.iBytesReceived )
       
  1430         {
       
  1431         // The value of received data has turned around the 4 GB
       
  1432         iDataVolume.iOverflowCounterReceived++;
       
  1433         }
       
  1434     iDataVolume.iBytesReceived = dataVolume.iBytesReceived;
       
  1435        
       
  1436     }
       
  1437 
       
  1438 // ---------------------------------------------------------------------------
       
  1439 // CMmPacketContextTsy::SetLastErrorCause
       
  1440 // Set the last error cause.
       
  1441 // (other items were commented in a header).
       
  1442 // ---------------------------------------------------------------------------
       
  1443 //
       
  1444 void CMmPacketContextTsy::SetLastErrorCause(
       
  1445         const TInt aErrorCause ) 
       
  1446     {
       
  1447     if ( RPacketContext::EStatusActivating == iContextStatus  || 
       
  1448      	RPacketContext::EStatusDeactivating == iContextStatus   )
       
  1449         {
       
  1450         iLastErrorCause =  aErrorCause;           
       
  1451         }
       
  1452 
       
  1453 TFLOGSTRING3( "TSY: CMmPacketContextTsy::SetLastErrorCause.  aErrorCause: %d iLastErrorCause:%d", 
       
  1454              aErrorCause, iLastErrorCause );
       
  1455 
       
  1456     }
       
  1457 
       
  1458 // ---------------------------------------------------------------------------
       
  1459 // CMmPacketContextTsy::ContextStatus
       
  1460 // Return current context status.
       
  1461 // (other items were commented in a header).
       
  1462 // ---------------------------------------------------------------------------
       
  1463 //
       
  1464 RPacketContext::TContextStatus CMmPacketContextTsy::ContextStatus() const
       
  1465     {
       
  1466     return iContextStatus;
       
  1467     }
       
  1468 
       
  1469 // ---------------------------------------------------------------------------
       
  1470 // CMmPacketContextTsy::ContextSuspended
       
  1471 // Suspend the context.
       
  1472 // (other items were commented in a header).
       
  1473 // ---------------------------------------------------------------------------
       
  1474 //
       
  1475 void CMmPacketContextTsy::ContextSuspended()
       
  1476     {
       
  1477 TFLOGSTRING2( "TSY: CMmPacketContextTsy::ContextSuspended. Context status before suspending: %d",
       
  1478                 iContextStatus );
       
  1479 
       
  1480     if ( ( RPacketContext::EStatusActivating == iContextStatus ) ||
       
  1481          ( RPacketContext::EStatusActive == iContextStatus ) ||
       
  1482          ( RPacketContext::EStatusDeactivating == iContextStatus ) )
       
  1483         {
       
  1484         iContextStatusBeforeSuspending = iContextStatus;
       
  1485         CMmPacketContextTsy::CompleteNotifyStatusChange( 
       
  1486 									RPacketContext::EStatusSuspended );
       
  1487         }
       
  1488     }
       
  1489 
       
  1490 // ---------------------------------------------------------------------------
       
  1491 // CMmPacketContextTsy::ContextResumed
       
  1492 // Resume the suspended context.
       
  1493 // (other items were commented in a header).
       
  1494 // ---------------------------------------------------------------------------
       
  1495 //
       
  1496 void CMmPacketContextTsy::ContextResumed()
       
  1497     {
       
  1498     if ( RPacketContext::EStatusSuspended == iContextStatus )
       
  1499         {
       
  1500         CMmPacketContextTsy::CompleteNotifyStatusChange( 
       
  1501 									iContextStatusBeforeSuspending );
       
  1502         }
       
  1503 
       
  1504     iContextStatusBeforeSuspending = RPacketContext::EStatusUnknown;
       
  1505 
       
  1506 TFLOGSTRING2( "TSY: CMmPacketContextTsy::ContextResumed. Context status when resumed: %d",
       
  1507                 iContextStatus );
       
  1508 
       
  1509     }
       
  1510 
       
  1511 // ---------------------------------------------------------------------------
       
  1512 // CMmPacketContextTsy::PacketContextGsmWcdmaExt
       
  1513 // Return pointer to the CMmPacketContextGsmWcdmaExt.
       
  1514 // (other items were commented in a header).
       
  1515 // ---------------------------------------------------------------------------
       
  1516 //
       
  1517 CMmPacketContextGsmWcdmaExt* CMmPacketContextTsy::PacketContextGsmWcdmaExt() const 
       
  1518     {
       
  1519     return iMmPacketContextGsmWcdmaExt;
       
  1520     }
       
  1521 
       
  1522 // ---------------------------------------------------------------------------
       
  1523 // CMmPacketContextTsy::PacketQoSTsy
       
  1524 // Return a pointer to the PacketQoSTsy.
       
  1525 // (other items were commented in a header).
       
  1526 // ---------------------------------------------------------------------------
       
  1527 //
       
  1528 CMmPacketQoSTsy* CMmPacketContextTsy::PacketQoSTsy() const 
       
  1529     {
       
  1530     return iQoSProfile;
       
  1531     }
       
  1532 
       
  1533 // ---------------------------------------------------------------------------
       
  1534 // CMmPacketContextTsy::RemoveQoS
       
  1535 // Remove the pointer to PacketQoSTsy.
       
  1536 // (other items were commented in a header).
       
  1537 // ---------------------------------------------------------------------------
       
  1538 //
       
  1539 void CMmPacketContextTsy::RemoveQoS()
       
  1540     {
       
  1541 TFLOGSTRING( "TSY: CMmPacketContextTsy::RemoveQoS." );
       
  1542 
       
  1543     iQoSProfile = NULL;
       
  1544     iQoSProfileName.Zero();
       
  1545     }
       
  1546 
       
  1547 // ---------------------------------------------------------------------------
       
  1548 // CMmPacketContextTsy::ReqCompleted
       
  1549 // Overloads CTelObject::ReqCompleted.
       
  1550 // (other items were commented in a header).
       
  1551 // ---------------------------------------------------------------------------
       
  1552 //
       
  1553 void CMmPacketContextTsy::ReqCompleted(
       
  1554         const TTsyReqHandle aTsyReqHandle, 
       
  1555         const TInt aError )   
       
  1556     {
       
  1557 TFLOGSTRING3( "TSY: CMmPacketContextTsy::ReqCompleted. Handle:%d Error:%d", 
       
  1558              aTsyReqHandle, aError );
       
  1559 
       
  1560     // Set last error cause
       
  1561     if ( KErrNone != aError )
       
  1562         {
       
  1563         iLastErrorCause = aError;
       
  1564         }
       
  1565 
       
  1566     CTelObject::ReqCompleted( aTsyReqHandle, aError );
       
  1567 
       
  1568     }
       
  1569 
       
  1570 #ifdef REQHANDLE_TIMER
       
  1571 
       
  1572     
       
  1573 // ---------------------------------------------------------------------------
       
  1574 // CMmPacketContextTsy::SetTypeOfResponse
       
  1575 // Sets the type of response for a given request handle. Automatic mode 
       
  1576 // includes an automatic response in case of non response from the DOS in a
       
  1577 // specified time. This method is used only if REQHANDLE_TIMER is in use.
       
  1578 // ---------------------------------------------------------------------------
       
  1579 //
       
  1580 void CMmPacketContextTsy::SetTypeOfResponse(
       
  1581         const TInt aReqHandleType,               
       
  1582         const TTsyReqHandle aTsyReqHandle )       
       
  1583     {
       
  1584     TInt timeOut( 0 );
       
  1585 
       
  1586     // Set timeout by req handle type
       
  1587     switch ( aReqHandleType )
       
  1588         {
       
  1589         case EMultimodePacketContextInitialiseContext:
       
  1590             timeOut = KMmPacketContextInitialiseContextTimeOut;
       
  1591             break;
       
  1592         case EMultimodePacketContextSetConfig:
       
  1593             timeOut = KMmPacketContextSetConfigTimeOut;
       
  1594             break;
       
  1595         case EMultimodePacketContextActivate:
       
  1596             timeOut = KMmPacketContextActivateTimeOut;
       
  1597             break;
       
  1598         case EMultimodePacketContextDeactivate:
       
  1599             timeOut = KMmPacketContextDeactivateTimeOut;
       
  1600             break;
       
  1601         case EMultimodePacketContextDelete:
       
  1602             timeOut = KMmPacketContextDeleteTimeOut;
       
  1603             break;
       
  1604         case EMultimodePacketContextGetDataVolumeTransferred:
       
  1605             timeOut = KMmPacketContextGetDataVolumeTransferredTimeOut;
       
  1606             break;
       
  1607         case EMultimodePacketContextModifyActiveContext:
       
  1608             timeOut = KMmPacketContextModifyActiveContext;
       
  1609             break;
       
  1610         case EMultimodePacketContextAddMediaAuthorization:
       
  1611             timeOut = KMmPacketContextAddMediaAuthorization;
       
  1612             break;
       
  1613 
       
  1614         // Can't use timer:
       
  1615         // - all notifications
       
  1616         //case EMultimodePacketContextNotifyConfigChanged:
       
  1617         //case EMultimodePacketContextNotifyConnectionSpeedChange:
       
  1618         //case EMultimodePacketContextNotifyStatusChange:
       
  1619         default:
       
  1620             // Do not use timer
       
  1621             iTsyReqHandleStore->SetTsyReqHandle( aReqHandleType, 
       
  1622                 aTsyReqHandle );
       
  1623             break;
       
  1624         }
       
  1625 
       
  1626     if ( 0 < timeOut )
       
  1627         {
       
  1628         // The timeout parameter is given in seconds.
       
  1629         iTsyReqHandleStore->SetTsyReqHandle( aReqHandleType, aTsyReqHandle, 
       
  1630             timeOut );
       
  1631         }
       
  1632 
       
  1633     }
       
  1634 
       
  1635 // ---------------------------------------------------------------------------
       
  1636 // CMmPacketContextTsy::Complete
       
  1637 // Completes the request due the timer expiration. This method is used only if
       
  1638 // REQHANDLE_TIMER is in use. 
       
  1639 // ---------------------------------------------------------------------------
       
  1640 // 
       
  1641 void CMmPacketContextTsy::Complete(
       
  1642         const TInt aReqHandleType,    
       
  1643         const TInt aError )        
       
  1644     {
       
  1645     // All possible TSY req handle types are listed in the
       
  1646     // switch case below.
       
  1647     switch ( aReqHandleType )
       
  1648         {
       
  1649         case EMultimodePacketContextInitialiseContext:
       
  1650             CMmPacketContextTsy::CompleteInitialiseContext( aError );
       
  1651             break;
       
  1652         case EMultimodePacketContextSetConfig:
       
  1653             CMmPacketContextTsy::CompleteSetConfig( aError );
       
  1654             break;
       
  1655         case EMultimodePacketContextActivate:
       
  1656             CMmPacketContextTsy::CompleteActivate( aError );
       
  1657             break;
       
  1658         case EMultimodePacketContextDeactivate:
       
  1659             CMmPacketContextTsy::CompleteDeactivate( aError );
       
  1660             break;
       
  1661         case EMultimodePacketContextDelete:
       
  1662             CMmPacketContextTsy::CompleteDelete( aError );
       
  1663             break;
       
  1664         case EMultimodePacketContextGetDataVolumeTransferred:
       
  1665             CMmPacketContextTsy::CompleteGetDataVolumeTransferred( aError );
       
  1666             break;
       
  1667         case EMultimodePacketContextModifyActiveContext:
       
  1668             CMmPacketContextTsy::CompleteModifyActiveContext( aError );
       
  1669             break;
       
  1670        	case EMultimodePacketContextAddMediaAuthorization:
       
  1671             CMmPacketContextTsy::CompleteSetConfig( aError, ETrue );
       
  1672             break;
       
  1673 
       
  1674         // Can't use timer:
       
  1675         // - all notifications
       
  1676         //case EMultimodePacketContextNotifyConfigChanged:
       
  1677         //case EMultimodePacketContextNotifyConnectionSpeedChange:
       
  1678         //case EMultimodePacketContextNotifyStatusChange:
       
  1679         default:
       
  1680             CMmPacketContextTsy::ReqCompleted( iTsyReqHandleStore->
       
  1681 				ResetTsyReqHandle( aReqHandleType ), aError );
       
  1682             break;
       
  1683         }
       
  1684 
       
  1685     }
       
  1686 
       
  1687 #endif // REQHANDLE_TIMER
       
  1688 
       
  1689 // ---------------------------------------------------------------------------
       
  1690 // CMmPacketContextTsy::IsDialUpContext
       
  1691 // Return ETrue if this is dial-up context, otherwise EFalse.
       
  1692 // (other items were commented in a header).
       
  1693 // ---------------------------------------------------------------------------
       
  1694 //  
       
  1695 TBool CMmPacketContextTsy::IsDialUpContext(  
       
  1696         const TInfoName* const aContextName ) const
       
  1697     {
       
  1698 
       
  1699     TBool ret( EFalse );
       
  1700 
       
  1701     if ( NULL != aContextName )
       
  1702         {
       
  1703         if ( *aContextName == iContextName )
       
  1704             {
       
  1705             ret = ETrue;
       
  1706             }
       
  1707         }
       
  1708     else
       
  1709         {
       
  1710         ret = iIsDialUpContext;
       
  1711         }
       
  1712 
       
  1713     return ret;
       
  1714     }
       
  1715 
       
  1716 // ---------------------------------------------------------------------------
       
  1717 // CMmPacketContextTsy::ResetDialUpContext
       
  1718 // Reset the externally created dial-up context's data.
       
  1719 // ---------------------------------------------------------------------------
       
  1720 //
       
  1721 void CMmPacketContextTsy::ResetDialUpContext()
       
  1722     {
       
  1723 
       
  1724 TFLOGSTRING( "TSY: CMmPacketContextTsy::ResetDialUpContext." );
       
  1725 
       
  1726     iDataVolume.iOverflowCounterSent = 0;
       
  1727     iDataVolume.iBytesSent = 0;
       
  1728     iDataVolume.iOverflowCounterReceived = 0;
       
  1729     iDataVolume.iBytesReceived = 0;
       
  1730 
       
  1731     iContextStatus = RPacketContext::EStatusInactive;
       
  1732 
       
  1733     }
       
  1734 
       
  1735 // ---------------------------------------------------------------------------
       
  1736 // CMmPacketContextTsy::HostCID
       
  1737 // Return the host context name
       
  1738 // (other items were commented in a header).
       
  1739 // ---------------------------------------------------------------------------
       
  1740 //
       
  1741 TInfoName CMmPacketContextTsy::HostCID() const
       
  1742     {
       
  1743 
       
  1744     return iHostCID;
       
  1745     }
       
  1746 
       
  1747 // ---------------------------------------------------------------------------
       
  1748 // CMmPacketContextTsy::AddPacketFilterL
       
  1749 // This method sets up a packet filter in the TFT belonging to this context, 
       
  1750 // with the Id specified in the packet filter information. New packet filter
       
  1751 // info is stored in CMmPacketContextGsmWcdmaExt. This method takes care of 
       
  1752 // adding packet filter info and storing this information.
       
  1753 // (other items were commented in a header).
       
  1754 // ---------------------------------------------------------------------------
       
  1755 //
       
  1756 TInt CMmPacketContextTsy::AddPacketFilterL(
       
  1757         const TTsyReqHandle aTsyReqHandle,  
       
  1758         TDes8* const aPacketFilter )  
       
  1759     {
       
  1760 TFLOGSTRING2( "TSY: CMmPacketContextTsy::AddPacketFilterL. Context name:%S", &iContextName );
       
  1761 
       
  1762     TInt ret( KErrGeneral );
       
  1763 
       
  1764     if ( (0 < iHostCID.Length()) && (aPacketFilter->Length() > 0) )
       
  1765         {
       
  1766         ret = iMmPacketContextGsmWcdmaExt->AddPacketFilterL( aPacketFilter );
       
  1767 
       
  1768         if ( KErrNone == ret )
       
  1769             {
       
  1770             // if operation is meant for already configurated context
       
  1771             if ( RPacketContext::EStatusUnknown != ContextStatus() &&
       
  1772                 RPacketContext::EStatusInactive != ContextStatus() ) 
       
  1773                 {
       
  1774                 // request must complete to client
       
  1775                 CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, KErrNone );
       
  1776                 }
       
  1777 
       
  1778             // else operation is context configuration and complete method
       
  1779             // handles request complete
       
  1780             else
       
  1781                 {
       
  1782                 // Store the request handle type
       
  1783                 iReqHandleType = EMultimodePacketContextAddPacketFilter;
       
  1784                 }
       
  1785             }
       
  1786         }
       
  1787 
       
  1788     return ret;
       
  1789     }
       
  1790 
       
  1791 // ---------------------------------------------------------------------------
       
  1792 // CMmPacketContextTsy::RemovePacketFilter
       
  1793 // This method removes a packet filter from the TFT belonging to this context.
       
  1794 // (other items were commented in a header).
       
  1795 // ---------------------------------------------------------------------------
       
  1796 //
       
  1797 #ifndef USING_CTSY_DISPATCHER 
       
  1798 TInt CMmPacketContextTsy::RemovePacketFilter(
       
  1799         const TTsyReqHandle aTsyReqHandle,  
       
  1800         TInt *aID ) 
       
  1801     {
       
  1802 TFLOGSTRING2( "TSY: CMmPacketContextTsy::RemovePacketFilter. RemovedFilter:%d", *aID );
       
  1803 
       
  1804     TInt ret( KErrArgument );
       
  1805 
       
  1806     // id must be value from 1 to 8
       
  1807     if ( 0 < *aID && 8 >= *aID )
       
  1808         {
       
  1809         ret = iMmPacketContextGsmWcdmaExt->RemovePacketFilter( *aID );
       
  1810         }
       
  1811 
       
  1812     CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, ret );
       
  1813 
       
  1814     return KErrNone;
       
  1815     }
       
  1816 #endif // #ifndef USING_CTSY_DISPATCHER
       
  1817 
       
  1818 // ---------------------------------------------------------------------------
       
  1819 // CMmPacketContextTsy::ModifyActiveContextL
       
  1820 // Invokes context modification.  This method invokes MS-initiated 
       
  1821 // modification of an active context in the network.
       
  1822 // (other items were commented in a header).
       
  1823 // ---------------------------------------------------------------------------
       
  1824 //
       
  1825 TInt CMmPacketContextTsy::ModifyActiveContextL()
       
  1826     {
       
  1827 TFLOGSTRING2( "TSY: CMmPacketContextTsy::ModifyActiveContextL. Context name:%S", &iContextName );
       
  1828     
       
  1829     TInt ret( KErrNotReady );
       
  1830 
       
  1831     if ( RPacketContext::EStatusUnknown != ContextStatus() &&
       
  1832         RPacketContext::EStatusInactive != ContextStatus() &&
       
  1833         RPacketContext::EStatusDeleted != ContextStatus() )
       
  1834         {
       
  1835         ret = iMmPacketContextGsmWcdmaExt->ModifyActiveContextL();
       
  1836         }
       
  1837 
       
  1838     if ( KErrNone == ret )
       
  1839         {
       
  1840         // Store the request handle type
       
  1841         iReqHandleType = EMultimodePacketContextModifyActiveContext;
       
  1842         }
       
  1843 
       
  1844     return ret;
       
  1845     }
       
  1846 
       
  1847 // ---------------------------------------------------------------------------
       
  1848 // CMmPacketContextTsy::CompleteModifyActiveContext
       
  1849 // When all Tft operations are done method completes to client 
       
  1850 // (other items were commented in a header).
       
  1851 // ---------------------------------------------------------------------------
       
  1852 //
       
  1853 void CMmPacketContextTsy::CompleteModifyActiveContext(
       
  1854         const TInt aResult )
       
  1855     {
       
  1856 TFLOGSTRING2( "TSY: CMmPacketContextTsy::CompleteModifyActiveContext. Context name:%S", &iContextName );
       
  1857 
       
  1858     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
       
  1859            EMultimodePacketContextModifyActiveContext );
       
  1860 
       
  1861     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
  1862         {
       
  1863 
       
  1864         CMmPacketContextTsy::ReqCompleted( reqHandle, aResult );
       
  1865 
       
  1866         }
       
  1867     }
       
  1868 
       
  1869 // ---------------------------------------------------------------------------
       
  1870 // CMmPacketContextTsy::EnumeratePacketFilters
       
  1871 // Returns number of defined packet filters to client
       
  1872 // (other items were commented in a header).
       
  1873 // ---------------------------------------------------------------------------
       
  1874 //
       
  1875 TInt CMmPacketContextTsy::EnumeratePacketFilters(
       
  1876         const TTsyReqHandle aTsyReqHandle,
       
  1877         TInt *aCount )  
       
  1878     {
       
  1879     TInt ret = iMmPacketContextGsmWcdmaExt->EnumeratePacketFilters ( aCount );
       
  1880 
       
  1881     CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, ret );
       
  1882 
       
  1883     return KErrNone;
       
  1884     }
       
  1885 
       
  1886 // ---------------------------------------------------------------------------
       
  1887 // CMmPacketContextTsy::GetPacketFilterInfo
       
  1888 // Gives information about the packet filter specified by aIndex
       
  1889 // ---------------------------------------------------------------------------
       
  1890 //
       
  1891 TInt CMmPacketContextTsy::GetPacketFilterInfo(
       
  1892         const TTsyReqHandle aTsyReqHandle,   
       
  1893         TInt* aIndex,               
       
  1894         TPacketBase* aPacketFilterInfo )   
       
  1895     {
       
  1896     TInt ret = iMmPacketContextGsmWcdmaExt->GetPacketFilterInfo ( *aIndex, 
       
  1897         aPacketFilterInfo);
       
  1898 
       
  1899     CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, ret );
       
  1900 
       
  1901     return KErrNone;
       
  1902     }
       
  1903 
       
  1904 // ---------------------------------------------------------------------------
       
  1905 // CMmPacketContextTsy::GetDnsInfo
       
  1906 // This method gets the DNS info for Etel side request.
       
  1907 // (other items were commented in a header).
       
  1908 // ---------------------------------------------------------------------------
       
  1909 //
       
  1910 TInt CMmPacketContextTsy::GetDnsInfo(
       
  1911         const TTsyReqHandle aTsyReqHandle,
       
  1912         TDes8* const aDnsInfo )
       
  1913     {
       
  1914     ASSERT(aDnsInfo);
       
  1915     
       
  1916     RPacketContext::TDnsInfoV2 temp;
       
  1917     RPacketContext::TTDnsInfoV2Pckg tempPckg(temp);
       
  1918 
       
  1919 	TInt ret = KErrArgument;
       
  1920 	if (tempPckg.MaxLength() == aDnsInfo->MaxLength() )
       
  1921 		{
       
  1922 	    ret = iMmPacketContextGsmWcdmaExt->GetDnsInfoEtel( aDnsInfo );
       
  1923 		}
       
  1924 
       
  1925     CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, ret ); 
       
  1926 
       
  1927     return KErrNone;
       
  1928     }
       
  1929 
       
  1930 
       
  1931 // ---------------------------------------------------------------------------
       
  1932 // CMmPacketContextTsy::ContextName
       
  1933 // This method returns name of this context
       
  1934 // (other items were commented in a header).
       
  1935 // ---------------------------------------------------------------------------
       
  1936 //
       
  1937 TInfoName CMmPacketContextTsy::ContextName() const
       
  1938     {
       
  1939     return iContextName;
       
  1940     }
       
  1941 
       
  1942 
       
  1943 // ---------------------------------------------------------------------------
       
  1944 // CMmPacketContextTsy::AddMediaAuthorizationL
       
  1945 // Makes request for adding authorization params to licensee tsy
       
  1946 // (other items were commented in a header).
       
  1947 // ---------------------------------------------------------------------------
       
  1948 //
       
  1949 TInt CMmPacketContextTsy::AddMediaAuthorizationL(
       
  1950         const TTsyReqHandle aTsyReqHandle,  
       
  1951         TDes8* aMediaAuthorization )
       
  1952 	{
       
  1953 	
       
  1954 	TInt ret( KErrArgument );
       
  1955 	TBool hasMediaAuthorizationBeenCached=EFalse;
       
  1956 	
       
  1957 	
       
  1958 	//Can be done only for secondary context
       
  1959 	if ( 0 < iHostCID.Length() )
       
  1960 		{
       
  1961 				
       
  1962 	    //Create buffers
       
  1963 	    RPacketContext::CTFTMediaAuthorizationV3* mediaAuthorization = 
       
  1964             RPacketContext::CTFTMediaAuthorizationV3::NewL();
       
  1965 	    CleanupStack::PushL( mediaAuthorization );
       
  1966 	    mediaAuthorization->InternalizeL( *aMediaAuthorization );
       
  1967 	 	
       
  1968 	 	ret = iMmPacketContextGsmWcdmaExt->AddMediaAuthorizationL( 
       
  1969             mediaAuthorization, hasMediaAuthorizationBeenCached);
       
  1970 	 	
       
  1971 	 	//Cleanup created object.  If it has been cached we do not delete it, because
       
  1972 	 	// the array (cache) will be cleaned in the destructor
       
  1973 	 	// If we were unable to cache it, we need to destroy it, otherwise we will leak 
       
  1974 	 	// memory.
       
  1975 	 	if(hasMediaAuthorizationBeenCached)
       
  1976 	 		{
       
  1977 	 		CleanupStack::Pop(mediaAuthorization);
       
  1978 	 		}
       
  1979 	 	else
       
  1980 	 		{
       
  1981 	 		CleanupStack::PopAndDestroy(mediaAuthorization);
       
  1982 	 		}
       
  1983 	 	
       
  1984 	 	if ( KErrNone == ret )
       
  1985 	    	{
       
  1986 	        //
       
  1987 	        if ( RPacketContext::EStatusUnknown != ContextStatus() &&
       
  1988 	            RPacketContext::EStatusInactive != ContextStatus() ) 
       
  1989 	            {
       
  1990 	            // request must complete to client
       
  1991 	            CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, KErrNone );
       
  1992 	            }
       
  1993 
       
  1994 	        // else operation is context configuration and complete method
       
  1995 	        // handles request complete
       
  1996 	        else
       
  1997 	            {
       
  1998 	            // Store the request handle type
       
  1999 	            iReqHandleType = EMultimodePacketContextAddMediaAuthorization;
       
  2000 	            }
       
  2001 	        }
       
  2002 		}
       
  2003 	return ret;
       
  2004 	 	        
       
  2005  	}
       
  2006         
       
  2007 // ---------------------------------------------------------------------------
       
  2008 // CMmPacketContextTsy::RemoveMediaAuthorization
       
  2009 // Makes request for removing authorization params to licensee tsy
       
  2010 // (other items were commented in a header).
       
  2011 // ---------------------------------------------------------------------------
       
  2012 //
       
  2013 TInt CMmPacketContextTsy::RemoveMediaAuthorization(
       
  2014         const TTsyReqHandle aTsyReqHandle,  
       
  2015         RPacketContext::TAuthorizationToken* const aAuthorizationToken )
       
  2016 	{
       
  2017 	TInt ret( KErrGeneral );
       
  2018 	
       
  2019 	//Can be done only for secondary context
       
  2020 	if ( 0 < iHostCID.Length() )
       
  2021 		{
       
  2022 	 	
       
  2023 	 	ret = iMmPacketContextGsmWcdmaExt->RemoveMediaAuthorization( 
       
  2024             aAuthorizationToken );
       
  2025             
       
  2026 		}
       
  2027 		
       
  2028 	CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, ret );
       
  2029 	
       
  2030 	return KErrNone;
       
  2031 	}
       
  2032 
       
  2033 // ---------------------------------------------------------------------------
       
  2034 // CMmPacketContextTsy::ContextType
       
  2035 // return the context type
       
  2036 // (other items were commented in a header).
       
  2037 // ---------------------------------------------------------------------------
       
  2038 //
       
  2039 CMmPacketContextTsy::TPacketContextType CMmPacketContextTsy::ContextType() const
       
  2040 {
       
  2041 	return EContextTypePacketContext;
       
  2042 }
       
  2043 
       
  2044 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
  2045 // ---------------------------------------------------------------------------
       
  2046 // CMmPacketContextTsy::GetConnectionInfo
       
  2047 // Gets the current connection information. 
       
  2048 // (other items were commented in a header).
       
  2049 // ---------------------------------------------------------------------------
       
  2050 //
       
  2051 TInt CMmPacketContextTsy::GetConnectionInfo(
       
  2052         const TTsyReqHandle aTsyReqHandle,    
       
  2053         TConnectionInfoBase* const aInfo )  
       
  2054     {
       
  2055 TFLOGSTRING2( "TSY: CMmPacketContextTsy::GetConnectionInfo. Context name:%S", &iContextName );
       
  2056 
       
  2057     // Get config
       
  2058     TInt ret = FillConnectionInfo( aInfo );
       
  2059 
       
  2060     // Complete Request
       
  2061     CMmPacketContextTsy::ReqCompleted( aTsyReqHandle, ret );
       
  2062 
       
  2063     return KErrNone;
       
  2064     }
       
  2065    
       
  2066 // ---------------------------------------------------------------------------
       
  2067 // CMmPacketContextTsy::NotifyConnectionInfoChange
       
  2068 // Requests notification when connection information changes.
       
  2069 // (other items were commented in a header).
       
  2070 // ---------------------------------------------------------------------------
       
  2071 //
       
  2072 TInt CMmPacketContextTsy::NotifyConnectionInfoChange(
       
  2073         TConnectionInfoBase* const aInfo )    
       
  2074     {
       
  2075 TFLOGSTRING( "TSY: CMmPacketContextTsy::NotifyConnectionInfoChange." );
       
  2076 
       
  2077     // Store pointer
       
  2078     iRetNotifyConnectionInfo = aInfo;
       
  2079     // Store req handle type
       
  2080     iReqHandleType = EMultimodePacketContextNotifyConnectionInfoChange;
       
  2081 
       
  2082     return KErrNone;
       
  2083     }   
       
  2084     
       
  2085 // ---------------------------------------------------------------------------
       
  2086 // CMmPacketContextTsy::CompleteNotifyConnectionInfoChange
       
  2087 // Complete notification when the connection information changes.
       
  2088 // (other items were commented in a header).
       
  2089 // ---------------------------------------------------------------------------
       
  2090 //
       
  2091 void CMmPacketContextTsy::CompleteNotifyConnectionInfoChange(
       
  2092         TConnectionInfoBase* const aInfo )    
       
  2093     {
       
  2094 TFLOGSTRING( "TSY: CMmPacketContextTsy::CompleteNotifyConnectionInfoChange." );
       
  2095 
       
  2096     if ( NULL != aInfo &&
       
  2097         TConnectionInfoBase::KConnectionInfoV1 == aInfo->ExtensionId() )
       
  2098         {
       
  2099     	RPacketContext::TConnectionInfoV1 connectionInfoV1;
       
  2100         connectionInfoV1 = *( static_cast<RPacketContext::TConnectionInfoV1*>( aInfo ) );
       
  2101 
       
  2102 		//Check if connection info has changed
       
  2103 		if ( iConnectionInfo.iHSDPACategory != connectionInfoV1.iHSDPACategory ||
       
  2104 	         iConnectionInfo.iHSUPACategory != connectionInfoV1.iHSUPACategory ||
       
  2105 	         iConnectionInfo.iValid != connectionInfoV1.iValid )
       
  2106 			{
       
  2107 			//Set new connection info
       
  2108 			iConnectionInfo = connectionInfoV1;
       
  2109 			
       
  2110 			//Get req handle
       
  2111 			TTsyReqHandle reqHandle = iTsyReqHandleStore->GetTsyReqHandle(
       
  2112         		EMultimodePacketContextNotifyConnectionInfoChange );
       
  2113         		
       
  2114 			if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
       
  2115         		{	
       
  2116         		// Fill current connection information
       
  2117         		TInt ret = FillConnectionInfo( iRetNotifyConnectionInfo );
       
  2118 			
       
  2119 				if ( KErrNone == ret )
       
  2120 					{
       
  2121 					//reset req handle
       
  2122 					iTsyReqHandleStore->ResetTsyReqHandle(
       
  2123         				EMultimodePacketContextNotifyConnectionInfoChange );
       
  2124         			// Null ret pointer
       
  2125         			iRetNotifyConnectionInfo = NULL;
       
  2126         			// Complete the client request
       
  2127         			CMmPacketContextTsy::ReqCompleted( reqHandle, KErrNone );
       
  2128 					}
       
  2129         		}
       
  2130 			}
       
  2131         }
       
  2132     }    
       
  2133     
       
  2134 // ---------------------------------------------------------------------------
       
  2135 // CMmPacketContextTsy::FillConnectionInfo
       
  2136 // Fills the current connection information to TConnectionInfoXXX structure. 
       
  2137 // (other items were commented in a header).
       
  2138 // ---------------------------------------------------------------------------
       
  2139 //
       
  2140 TInt CMmPacketContextTsy::FillConnectionInfo(   
       
  2141         TConnectionInfoBase* const aInfo )  
       
  2142     {
       
  2143 TFLOGSTRING( "TSY: CMmPacketContextTsy::FillConnectionInfo" );
       
  2144 
       
  2145     TInt ret = KErrNone;
       
  2146 
       
  2147     if ( NULL != aInfo &&
       
  2148         TConnectionInfoBase::KConnectionInfoV1 == aInfo->ExtensionId() )
       
  2149         {
       
  2150         //Set connection info to ETel side memory
       
  2151         *( static_cast<RPacketContext::TConnectionInfoV1*>( aInfo ) ) = iConnectionInfo;        
       
  2152         }
       
  2153     else
       
  2154         {
       
  2155         ret = KErrArgument;    
       
  2156         }
       
  2157 
       
  2158     return ret;
       
  2159     }        
       
  2160 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
  2161 //  End of File