realtimenetprots/sipfw/SIP/ConnectionMgr/src/CTransportTcp.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name          : CTransportTcp.cpp
       
    15 // Part of       : ConnectionMgr
       
    16 // Version       : SIP/6.0 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #include "CTransportTcp.h"
       
    23 #include "CSipConnection.h"
       
    24 #include "CErrorHandler.h"
       
    25 #include "MTransactionFinder.h"
       
    26 #include "MTransportOwner.h"
       
    27 #include "MServerTaFactory.h"
       
    28 #include "CSender.h"
       
    29 #include "CSenderTcp.h"
       
    30 #include "CReceiverTcp.h"
       
    31 #include "CListener.h"
       
    32 #include "CTcpTransState.h"
       
    33 #include "CTcpTransConnected.h"
       
    34 #include "CTcpTransConnecting.h"
       
    35 #include "CommonConsts.h"
       
    36 #include "siperr.h"
       
    37 #include "NetworkInfo.h"
       
    38 #include "COwnerSettingsList.h"
       
    39 #include "CSocketContainer.h"
       
    40 #include "MSIPTransportRemovalObserver.h"
       
    41 #include <sipnattraversalcontroller.h>
       
    42 
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CTransportTcp::NewL
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CTransportTcp* CTransportTcp::NewL(RSocketServ& aServer,
       
    49 				MTransactionFinder& aFinder, 
       
    50 				MServerTaFactory& aTaFactory,
       
    51 				MTransportOwner& aTransportOwner,
       
    52 				MTimerManager& aTimer,
       
    53 				const TSIPTransportParams& aTransportParams,
       
    54 				const TInetAddr& aRemoteAddr,
       
    55 				TUint aTOne,
       
    56 				CSIPServerResolver& aServerResolver,
       
    57 				RConnection& aConnection,
       
    58 				MSigCompController& aSigCompHandler,
       
    59 				TUint aLocalSendPort,
       
    60 				CNetworkInfo& aNetworkInfo,
       
    61 				COwnerSettingsList& aSettingsList,
       
    62 				CSIPNATTraversalController& aNATTraversal)
       
    63 	{
       
    64 	CTransportTcp* self = NewLC(aServer, aFinder, aTaFactory, 
       
    65 								aTransportOwner, aTimer, aTransportParams,
       
    66 								aRemoteAddr, aTOne, aServerResolver, 
       
    67 								aConnection, aSigCompHandler, aLocalSendPort,
       
    68 								aNetworkInfo, aSettingsList, aNATTraversal);
       
    69 	CleanupStack::Pop(self);
       
    70 	return self;
       
    71 	}
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CTransportTcp::NewLC
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CTransportTcp* CTransportTcp::NewLC(RSocketServ& aServer,
       
    78 				MTransactionFinder& aFinder, 
       
    79 				MServerTaFactory& aTaFactory,
       
    80 				MTransportOwner& aTransportOwner,
       
    81 				MTimerManager& aTimer,
       
    82 				const TSIPTransportParams& aTransportParams,
       
    83 				const TInetAddr& aRemoteAddr,
       
    84 				TUint aTOne,
       
    85 				CSIPServerResolver& aServerResolver,
       
    86 				RConnection& aConnection,
       
    87 				MSigCompController& aSigCompHandler,
       
    88 				TUint aLocalSendPort,
       
    89 				CNetworkInfo& aNetworkInfo,
       
    90 				COwnerSettingsList& aSettingsList,
       
    91 				CSIPNATTraversalController& aNATTraversal)
       
    92 	{
       
    93 	CTransportTcp* self = new (ELeave) CTransportTcp(aFinder, aTaFactory, 
       
    94 										aTransportOwner, aTransportParams,
       
    95 										aServerResolver, aSigCompHandler,
       
    96 										aNetworkInfo, aSettingsList, 
       
    97 										aNATTraversal);
       
    98 	CleanupStack::PushL(self);
       
    99 	self->ConstructL(aServer, 
       
   100 	                 aTimer, 
       
   101 	                 aRemoteAddr, 
       
   102 	                 aTOne, 
       
   103 	                 aConnection, 
       
   104 	                 aLocalSendPort);
       
   105 	return self;
       
   106 	}
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CTransportTcp::CTransportTcp
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 CTransportTcp::CTransportTcp(MTransactionFinder& aFinder, 
       
   113 							 MServerTaFactory& aTaFactory,
       
   114 							 MTransportOwner& aTransportOwner,
       
   115 							 const TSIPTransportParams& aTransportParams,
       
   116 							 CSIPServerResolver& aServerResolver,
       
   117 							 MSigCompController& aSigCompHandler,							 
       
   118 							 CNetworkInfo& aNetworkInfo,
       
   119 							 COwnerSettingsList& aSettingsList,
       
   120 							 CSIPNATTraversalController& aNATTraversal) : 
       
   121 	CTransport(aFinder, aTaFactory, aTransportOwner,
       
   122 			   aServerResolver, aSigCompHandler,
       
   123 			   aTransportParams, aNetworkInfo, 
       
   124 			   aSettingsList, aNATTraversal),
       
   125 	iIsSending( EFalse )
       
   126 	{
       
   127 	}
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CTransportTcp::ConstructL
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 void CTransportTcp::ConstructL( RSocketServ& aServer,
       
   134 							    MTimerManager& aTimer,
       
   135     							const TInetAddr& aRemoteAddr,
       
   136     							TUint aTOne,
       
   137     							RConnection& aConnection,
       
   138     							TUint aLocalSendPort )
       
   139 	{
       
   140 	iTimerValue = (64 * aTOne);
       
   141 	iSocketServ = &aServer;
       
   142 	iConnection = &aConnection;
       
   143 	iTimer = &aTimer;
       
   144 	iRemoteAddr = aRemoteAddr;
       
   145 	iConnectedState = CTcpTransportConnected::NewL( iTransportParams );
       
   146 	iConnectingState = CTcpTransportConnecting::NewL( iTransportParams );
       
   147 	iConnectingState->SetNeighborState( iConnectedState );
       
   148 	SetCurrentState( iConnectingState );
       
   149 	iErrorHandler =	CTransportErrorHandler::NewL( *this );
       
   150 	User::LeaveIfError( iSocket.Open( *iSocketServ, KAfInet, KSockStream,
       
   151 									  KProtocolInetTcp, *iConnection ) );
       
   152 
       
   153     iSocketContainer = CSocketContainer::NewL( iSocket );
       
   154     
       
   155     // If local send port is defined, socket is binded to it								
       
   156 	if ( aLocalSendPort > 0 && aLocalSendPort != KDefaultSipPort )
       
   157 	    {	       
       
   158 	    iSocket.SetOpt( KSoReuseAddr, KSolInetIp, 1 );
       
   159 	                                                                                  
       
   160 	    TInetAddr address;
       
   161     	iTransportOwner->GetLocalAddrL( address, &aRemoteAddr );
       
   162     	address.SetPort( aLocalSendPort );
       
   163     	TInt err = iSocket.Bind( address );
       
   164     	if ( err == KErrInUse )
       
   165     		{
       
   166     		User::Leave( KErrSIPTransportFailure );
       
   167     		}
       
   168     	else
       
   169     		{
       
   170     		User::LeaveIfError( err );
       
   171     		}
       
   172 	    }
       
   173 	    
       
   174 	iReceiver = CReceiverTcp::NewL( *this );
       
   175 	
       
   176 	iSender = CSenderTcp::NewL( *this, iSettingsList );
       
   177 	}
       
   178 
       
   179 
       
   180 // -----------------------------------------------------------------------------
       
   181 // CTransportTcp::~CTransportTcp
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 CTransportTcp::~CTransportTcp()
       
   185 	{
       
   186 	HandleShutdownCompletion();
       
   187 	StopTimer();
       
   188 	delete iErrorHandler;
       
   189 	delete iConnectedState;
       
   190 	delete iConnectingState;
       
   191 	delete iReceiver;
       
   192 	delete iSender;
       
   193 	delete iSocketContainer;
       
   194 	iNATTraversal.SocketIdle( EFalse, iSocket );
       
   195 	iSocket.Close();
       
   196 	}
       
   197 	
       
   198 // -----------------------------------------------------------------------------
       
   199 // CTransportTcp::HandleMessage
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 TBool CTransportTcp::HandleMessage(const TSIPTransportParams& aParams,
       
   203                                    RStringF aProtocol,
       
   204 								   const TInetAddr& aRemoteAddr,
       
   205 								   TUint /*aLocalPort*/,
       
   206 								   TBool /*aIsStrict*/)
       
   207 	{ 
       
   208 	return ( iCurrentState->HandleMessage(aProtocol, aRemoteAddr, this) &&
       
   209 	         Match( aParams ) );
       
   210 	}
       
   211 
       
   212 // -----------------------------------------------------------------------------
       
   213 // CTransportTcp::SourcePort
       
   214 // -----------------------------------------------------------------------------
       
   215 //
       
   216 TUint CTransportTcp::SourcePort()
       
   217 	{
       
   218 	return iSocket.LocalPort();
       
   219 	}
       
   220 
       
   221 // -----------------------------------------------------------------------------
       
   222 // CTransportTcp::SendToNetL
       
   223 // -----------------------------------------------------------------------------
       
   224 //
       
   225 void CTransportTcp::SendToNetL(const TSIPTransportParams& aParams,
       
   226                                const TInetAddr& aAddress, 
       
   227 							   CSIPMessage& aMessage, 
       
   228 							   TBool /*aForceUDP*/,
       
   229 							   TUint aOrigTransport,
       
   230 							   TRequestStatus &aStatus)
       
   231 	{
       
   232 	HandleMixedAddressFamilysL( aMessage, aAddress );
       
   233 	
       
   234 	iCurrentState->SendToNetL(aParams,
       
   235 	                          aMessage,
       
   236 							  aAddress,
       
   237 							  aStatus,
       
   238 							  aOrigTransport,
       
   239 							  this);
       
   240 	}
       
   241 
       
   242 // -----------------------------------------------------------------------------
       
   243 // CTransportTcp::CancelSend
       
   244 // -----------------------------------------------------------------------------
       
   245 //
       
   246 TBool CTransportTcp::CancelSend(TRequestStatus& aStatus)
       
   247 	{
       
   248 	return iCurrentState->CancelSend(aStatus, this);
       
   249 	}
       
   250 
       
   251 // -----------------------------------------------------------------------------
       
   252 // CTransportTcp::WaitL
       
   253 // -----------------------------------------------------------------------------
       
   254 //
       
   255 void CTransportTcp::WaitL()
       
   256 	{
       
   257 	iCurrentState->Wait(this);
       
   258 	}
       
   259 
       
   260 // -----------------------------------------------------------------------------
       
   261 // CTransportTcp::IsWaiting
       
   262 // -----------------------------------------------------------------------------
       
   263 //
       
   264 TBool CTransportTcp::IsWaiting(TUint /*aProtocol*/, TUint /*aPort*/)
       
   265 	{
       
   266 	return EFalse;	
       
   267 	}
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // CTransportTcp::Disconnect
       
   271 // -----------------------------------------------------------------------------
       
   272 //
       
   273 void CTransportTcp::Disconnect(const TInetAddr& /*aRemoteHost*/)
       
   274 	{
       
   275 	// If this is reserved or persistent transport, 
       
   276 	// only all send operations are cleared
       
   277 	if ( IsReservedTransport() || IsPersistent() )
       
   278 	    {
       
   279 	    iSender->CancelAllRequests( KErrSIPTransportFailure );
       
   280 	    }
       
   281 	else
       
   282 	    {
       
   283 	    Remove();
       
   284 	    }
       
   285 	}
       
   286 
       
   287 // -----------------------------------------------------------------------------
       
   288 // CTransportTcp::Shutdown
       
   289 // -----------------------------------------------------------------------------
       
   290 //	     
       
   291 TBool CTransportTcp::Shutdown( 
       
   292     TUint32 /*aTransportId*/,
       
   293     MSIPTransportRemovalObserver* aRemovalObserver )
       
   294     {
       
   295     if ( aRemovalObserver )
       
   296         {
       
   297         SetShutdownObserver( aRemovalObserver );
       
   298         iReceiver->Cancel();
       
   299 	    iSender->Cancel();
       
   300         iReceiver->Shutdown();
       
   301         return ETrue;
       
   302         }
       
   303     return EFalse;
       
   304     }
       
   305     
       
   306 // -----------------------------------------------------------------------------
       
   307 // CTransportTcp::PersistentRemoteAddr
       
   308 // -----------------------------------------------------------------------------
       
   309 // 
       
   310 TInetAddr* CTransportTcp::PersistentRemoteAddr( 
       
   311     MSIPNATBindingObserver* aBindingObserver )
       
   312     {
       
   313     TInt index = iBindingObservers.FindInAddressOrder( aBindingObserver );
       
   314     if ( index >= 0 && index < iBindingObservers.Count() )
       
   315         {
       
   316         return &iRemoteAddr;
       
   317         }
       
   318     return 0;
       
   319     }
       
   320     
       
   321 // -----------------------------------------------------------------------------
       
   322 // CTransportTcp::TimerExpiredL
       
   323 // -----------------------------------------------------------------------------
       
   324 //
       
   325 void CTransportTcp::TimerExpiredL(TTimerId /*aTimerId*/, TAny* /*aTimerParam*/)
       
   326 	{
       
   327 	// Reserved transport uses persistent tcp connection and therefore
       
   328 	// only send operations are cleared when timer expires
       
   329 	if ( IsReservedTransport() || IsPersistent() )
       
   330 	    {
       
   331 	    iSender->CancelAllRequests( KErrSIPTransportFailure );
       
   332 	    }
       
   333 	else
       
   334 	    {
       
   335     	iCurrentState->TimerExpiredL( this );
       
   336 	    }
       
   337 	}
       
   338 
       
   339 // -----------------------------------------------------------------------------
       
   340 // CTransportTcp::StartTimerL
       
   341 // -----------------------------------------------------------------------------
       
   342 //
       
   343 void CTransportTcp::StartTimerL()
       
   344 	{
       
   345 	iTimer->Stop(iMyTimerId);
       
   346 	iMyTimerId = iTimer->StartL(this, iTimerValue);
       
   347 	}
       
   348 
       
   349 // -----------------------------------------------------------------------------
       
   350 // CTransportTcp::StopTimer
       
   351 // -----------------------------------------------------------------------------
       
   352 //
       
   353 void CTransportTcp::StopTimer()
       
   354     {
       
   355     iTimer->Stop(iMyTimerId);
       
   356     }
       
   357     
       
   358 // -----------------------------------------------------------------------------
       
   359 // CTransportTcp::CancelAllRequests
       
   360 // -----------------------------------------------------------------------------
       
   361 //
       
   362 void CTransportTcp::CancelAllRequests(CSIPConnection::TState aReason)
       
   363 	{
       
   364 	iCurrentState->CancelAllRequests(aReason, this);
       
   365 	}
       
   366 
       
   367 // -----------------------------------------------------------------------------
       
   368 // CTransportTcp::SocketContainer
       
   369 // -----------------------------------------------------------------------------
       
   370 //
       
   371 CSocketContainer& CTransportTcp::SocketContainer() 
       
   372     {
       
   373     return *iSocketContainer;
       
   374     }
       
   375     
       
   376 // -----------------------------------------------------------------------------
       
   377 // CTransportTcp::SocketContainer
       
   378 // -----------------------------------------------------------------------------
       
   379 //
       
   380 CSocketContainer* CTransportTcp::SocketContainer( 
       
   381     TUint /*aIPAddrFamily*/ )
       
   382     {
       
   383     return iSocketContainer;
       
   384     }     
       
   385     
       
   386 // -----------------------------------------------------------------------------
       
   387 // CTransportTcp::ReceivedDataL
       
   388 // -----------------------------------------------------------------------------
       
   389 //
       
   390 void CTransportTcp::ReceivedDataL(CSIPMessage* aMessage,
       
   391 								  const TInetAddr& aRemoteAddr,
       
   392 								  TInt aError,
       
   393 								  TBool aCompressed)
       
   394 	{
       
   395 	// As starting timer can leave, do it before passing ownership of aMessage
       
   396 	StartTimerL();
       
   397 	RecvL(aMessage, aRemoteAddr, aError, aCompressed);
       
   398 	}
       
   399 
       
   400 // -----------------------------------------------------------------------------
       
   401 // CTransportTcp::ResetSocketL
       
   402 // -----------------------------------------------------------------------------
       
   403 //
       
   404 void CTransportTcp::ResetSocketL()
       
   405 	{
       
   406 	}
       
   407 
       
   408 // -----------------------------------------------------------------------------
       
   409 // CTransportTcp::ContinueL
       
   410 // -----------------------------------------------------------------------------
       
   411 //
       
   412 void CTransportTcp::ContinueL()
       
   413 	{
       
   414 	}
       
   415 
       
   416 // -----------------------------------------------------------------------------
       
   417 // CTransportTcp::StopL
       
   418 // -----------------------------------------------------------------------------
       
   419 //
       
   420 TBool CTransportTcp::StopL()
       
   421 	{
       
   422 	TBool removed( EFalse );
       
   423 	
       
   424 	if (iCurrentState == iConnectingState)
       
   425 		{
       
   426 		iTransportOwner->RemoveTransport(this);
       
   427 		removed = ETrue;
       
   428 		}
       
   429 		
       
   430     return removed;
       
   431 	}
       
   432 
       
   433 // -----------------------------------------------------------------------------
       
   434 // CTransportTcp::ConnectionOpenL
       
   435 // -----------------------------------------------------------------------------
       
   436 //
       
   437 TBool CTransportTcp::ConnectionOpenL()
       
   438 	{
       
   439 	iTransportOwner->TcpConnected(iRemoteAddr);
       
   440 	iCurrentState->ConnectionOpenL(this);
       
   441 	return ETrue;
       
   442 	}
       
   443 
       
   444 // -----------------------------------------------------------------------------
       
   445 // CTransportTcp::SetCurrentState
       
   446 // -----------------------------------------------------------------------------
       
   447 //
       
   448 void CTransportTcp::SetCurrentState(CTcpTransportState* aState)
       
   449 	{
       
   450 	iCurrentState = aState;
       
   451 	}
       
   452 
       
   453 // -----------------------------------------------------------------------------
       
   454 // CTransportTcp::ConnectSocket
       
   455 // -----------------------------------------------------------------------------
       
   456 //
       
   457 void CTransportTcp::ConnectSocket()
       
   458     {
       
   459     iReceiver->Connect( iRemoteAddr );
       
   460     }
       
   461     
       
   462 // -----------------------------------------------------------------------------
       
   463 // CTransportTcp::TransportOwner
       
   464 // -----------------------------------------------------------------------------
       
   465 //
       
   466 MTransportOwner* CTransportTcp::TransportOwner()
       
   467 	{
       
   468 	return iTransportOwner;
       
   469 	}
       
   470 	
       
   471 // -----------------------------------------------------------------------------
       
   472 // CTransportTcp::GetSocketContainerL
       
   473 // -----------------------------------------------------------------------------
       
   474 //	
       
   475 CSocketContainer& CTransportTcp::GetSocketContainerL( 
       
   476     const TInetAddr& /*aRemoteAddr*/ )
       
   477     {
       
   478     return *iSocketContainer;
       
   479     }
       
   480     
       
   481 // -----------------------------------------------------------------------------
       
   482 // CTransportTcp::InformSendingStatus
       
   483 // -----------------------------------------------------------------------------
       
   484 //    
       
   485 void CTransportTcp::InformSendingStatus( const TInetAddr& /*aRemoteAddr*/ )
       
   486     {
       
   487     iNATTraversal.SocketIdle( !iIsSending, iSocket );
       
   488     }
       
   489 
       
   490 // -----------------------------------------------------------------------------
       
   491 // CTransportTcp::Sender
       
   492 // -----------------------------------------------------------------------------
       
   493 //
       
   494 CSender* CTransportTcp::Sender(const TSIPTransportParams& aParams,
       
   495                                TUint aProtocol, 
       
   496                                const TInetAddr& aRemoteAddr)
       
   497 	{
       
   498 	if ( Protocol() == aProtocol && 
       
   499 	     aRemoteAddr.CmpAddr( iRemoteAddr ) && 
       
   500 	     Match( aParams ) )
       
   501 		{
       
   502 		return iSender;
       
   503 		}
       
   504 	return 0;
       
   505 	}
       
   506 
       
   507 // -----------------------------------------------------------------------------
       
   508 // CTransportTcp::Remove
       
   509 // -----------------------------------------------------------------------------
       
   510 //
       
   511 TInt CTransportTcp::Remove()
       
   512 	{
       
   513 	return iTransportOwner->RemoveTransport( this );
       
   514 	}
       
   515 
       
   516 // -----------------------------------------------------------------------------
       
   517 // CTransportTcp::IapId
       
   518 // -----------------------------------------------------------------------------
       
   519 //
       
   520 TUint32 CTransportTcp::IapId()
       
   521 	{
       
   522 	return iTransportOwner->IapId();
       
   523 	}
       
   524 	
       
   525 // -----------------------------------------------------------------------------
       
   526 // CTransportTcp::Sending
       
   527 // -----------------------------------------------------------------------------
       
   528 //
       
   529 void CTransportTcp::Sending( TBool aIsSending )
       
   530     {
       
   531     iIsSending = aIsSending;
       
   532     iNATTraversal.SocketIdle( !iIsSending, iSocket );
       
   533     }
       
   534 	
       
   535 // -----------------------------------------------------------------------------
       
   536 // CTransportTcp::ReRouteL
       
   537 // -----------------------------------------------------------------------------
       
   538 //
       
   539 void CTransportTcp::ReRouteL(TUint aProtocol, 
       
   540                              COutgoingData* aData)
       
   541 	{
       
   542 	iTransportOwner->ReRouteL(aProtocol, aData);
       
   543 	}
       
   544 
       
   545 // -----------------------------------------------------------------------------
       
   546 // CTransportTcp::DisconnectedL
       
   547 // -----------------------------------------------------------------------------
       
   548 //
       
   549 TBool CTransportTcp::DisconnectedL()
       
   550 	{
       
   551 	HandleShutdownCompletion();	
       
   552 	
       
   553 	// Flow failure notification may lead to immediate self deletion
       
   554 	if ( !NotifyFlowFailure() )
       
   555 	    {
       
   556 	    iCurrentState->DisconnectedL( this );
       
   557 	    }
       
   558 	
       
   559 	return ETrue;
       
   560 	}
       
   561 
       
   562 // -----------------------------------------------------------------------------
       
   563 // CTransportTcp::GetRemoteAddr
       
   564 // -----------------------------------------------------------------------------
       
   565 //
       
   566 void CTransportTcp::GetRemoteAddr(TInetAddr& aAddr)
       
   567 	{
       
   568 	aAddr = iRemoteAddr;
       
   569 	}
       
   570 
       
   571 // -----------------------------------------------------------------------------
       
   572 // CTransportTcp::SigCompHandler
       
   573 // -----------------------------------------------------------------------------
       
   574 //
       
   575 MSigCompController* CTransportTcp::SigCompHandler()
       
   576 	{
       
   577 	return SigCompressionHandler();
       
   578 	}
       
   579     
       
   580 // -----------------------------------------------------------------------------
       
   581 // CTransportTcp::GetSender
       
   582 // -----------------------------------------------------------------------------
       
   583 //   
       
   584 CSender* CTransportTcp::GetSender()
       
   585     {
       
   586     return iSender;
       
   587     }
       
   588 
       
   589 // -----------------------------------------------------------------------------
       
   590 // CTransportTcp::SetShutdownObserver
       
   591 // -----------------------------------------------------------------------------
       
   592 //
       
   593 void CTransportTcp::SetShutdownObserver( 
       
   594     MSIPTransportRemovalObserver* aRemovalObserver )
       
   595     {
       
   596     iShutdownObserver = aRemovalObserver;
       
   597     }
       
   598     
       
   599 // -----------------------------------------------------------------------------
       
   600 // CTransportTcp::HandleShutdownCompletion
       
   601 // -----------------------------------------------------------------------------
       
   602 //     
       
   603 void CTransportTcp::HandleShutdownCompletion()
       
   604     {
       
   605     if ( iShutdownObserver )
       
   606         {
       
   607         iShutdownObserver->RemovalCompleted( iTransportParams.TransportId() );
       
   608         iShutdownObserver = 0;
       
   609         }
       
   610     }