realtimenetprots/rtp/cfrtp/src/rtpbaseflow.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2008-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 // RTP Base Flow Implementation
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include <comms-infras/ss_log.h>
       
    24 #include <comms-infras/ss_logext.h>
       
    25 
       
    26 #include <comms-infras/ss_protflow.h>
       
    27 
       
    28 #include "rtpbaseflow.h"
       
    29 #include "rtp_cfmessages.h"
       
    30 
       
    31 #if defined(ESOCK_LOGGING_ACTIVE)
       
    32 _LIT8(KRtpBaseFlowSubTag, "RtpbaseFlow");
       
    33 #endif
       
    34 
       
    35 ESock::MSessionControl* CRtpBaseFlow::GetControlL(TInt aSessionType,ESock::MSessionControlNotify& 
       
    36 												aSessionControlNotify)
       
    37 	{
       
    38 	if(aSessionType != KSockDatagram)
       
    39 		{
       
    40 		User::Leave(KErrNotSupported);
       
    41 		}
       
    42 	iSessionControlNotify = &aSessionControlNotify;
       
    43 	return this;
       
    44 	}
       
    45 
       
    46 ESock::MSessionData* CRtpBaseFlow::BindL(ESock::MSessionDataNotify& aSessionDataNotify)
       
    47 	{
       
    48 	
       
    49 	ASSERT(!iSessionDataNotify);
       
    50 	iSessionDataNotify = &aSessionDataNotify;
       
    51 	iSubConnectionProvider.PostMessage(Id(),TCFControlProvider::TActive().CRef());
       
    52 	return this;	
       
    53 	}
       
    54 
       
    55 void CRtpBaseFlow::Unbind()
       
    56 	{
       
    57 	iSessionControlNotify =NULL;
       
    58 	iSessionDataNotify = NULL;
       
    59 
       
    60 	LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t Unbind() "), this));
       
    61 
       
    62 	/* The Upper flow has left. ASSERT if we still have a Bearer */
       
    63 	/* By this time we should have called UnBind() on the lower flow.
       
    64 	   so something went wrong(??) */
       
    65 	ASSERT(!iSSP && !iFlowBinder);
       
    66 
       
    67     ProcessDCIdleState();	
       
    68 
       
    69 	if(iRecvdImmediateShutDown)
       
    70 		{
       
    71 		Destroy(); //BANG BANG!!
       
    72 		}
       
    73 	else
       
    74 		{
       
    75 		/* Once Defect with HandleDataClients is fixed uncomment this line! */
       
    76 		//ProcessDCIdleState();
       
    77 		}	
       
    78 	}
       
    79 									
       
    80 CRtpBaseFlow::CRtpBaseFlow(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf)
       
    81 : CSubConnectionFlowBase(aFactory, aSubConnId, aProtocolIntf)
       
    82 	{
       
    83 	}
       
    84 
       
    85  
       
    86 ESock::CSubConnectionFlowBase* CRtpBaseFlow::Flow()
       
    87 /**
       
    88 Return the Flow corresponding to the MFlowBinderControl
       
    89 */
       
    90 	{	
       
    91 	return this;
       
    92 	}
       
    93 	
       
    94 
       
    95 ESock::CSubConnectionFlowBase& CRtpBaseFlow::CloneFlowL()
       
    96 /**
       
    97 Return the Flow corresponding to the MFlowBinderControl
       
    98 */
       
    99 	{
       
   100 	LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t CloneFlowL() "), this));
       
   101 
       
   102    	ASSERT(iProtocolIntf);
       
   103     TDefaultFlowFactoryQuery query (iProtocolIntf->ControlProviderId(), iSubConnectionProvider.RecipientId());
       
   104 	ESock::CSubConnectionFlowBase& flow = static_cast<ESock::CSubConnectionFlowBase&>(*(Factory().CreateObjectL(query)));
       
   105 
       
   106 	return flow;
       
   107 	}	
       
   108 	
       
   109 CRtpBaseFlow::~CRtpBaseFlow()
       
   110 	{
       
   111 	LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t ~CRtpBaseFlow() "), this));
       
   112 	}
       
   113 
       
   114 // CSubConnectionFlowBase
       
   115 // MCFNode 
       
   116     
       
   117 void CRtpBaseFlow::ProcessDCIdleState()
       
   118 	{
       
   119 	iSubConnectionProvider.PostMessage(Id(),TCFControlProvider::TIdle().CRef());
       
   120 	}
       
   121 void CRtpBaseFlow::CompleteStart(TInt aError)
       
   122 	{
       
   123 	if (aError==KErrNone)
       
   124 		{
       
   125 		iStartRequest.ReplyTo(Id(), TCFDataClient::TStarted().CRef());
       
   126 		}
       
   127 	else
       
   128 		{
       
   129 		iStartRequest.ReplyTo(Id(), Messages::TEBase::TError(TCFDataClient::TStart::Id(),aError).CRef());
       
   130 		}
       
   131 	iIsStarting = EFalse;
       
   132 	}
       
   133 		
       
   134 	
       
   135 ESock::MFlowBinderControl* CRtpBaseFlow::DoGetBinderControlL()
       
   136 	{		
       
   137     return this;
       
   138 	}
       
   139 
       
   140 void CRtpBaseFlow::BindToL(TCFDataClient::TBindTo& aBindTo)
       
   141 	{
       
   142 	__ASSERT_DEBUG(!iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath));
       
   143 	
       
   144 	const Messages::TNodeId& commsId = aBindTo.iNodeId;
       
   145 	
       
   146 #if defined(__GCCXML__)
       
   147     CSubConnectionFlowBase* flow = reinterpret_cast<CSubConnectionFlowBase*>(reinterpret_cast<Messages::ANode*>(commsId.Ptr()));
       
   148 #else
       
   149     CSubConnectionFlowBase* flow = mcfnode_cast<CSubConnectionFlowBase>(reinterpret_cast<Messages::ANode*>(commsId.Ptr()));
       
   150 #endif
       
   151    if (!flow)
       
   152         {
       
   153         iSubConnectionProvider.PostMessage(Id(),TCFDataClient::TStopped(KErrDisconnected).CRef());
       
   154         User::Leave(KErrArgument);
       
   155         }
       
   156      
       
   157      if (iFlowBinder && iFlowBinder->Flow() != flow )
       
   158     	{
       
   159     	//already bound -> unbind first.
       
   160     	iFlowBinder->Unbind();
       
   161     	iFlowBinder = NULL;
       
   162     	}
       
   163     	
       
   164     if (!iFlowBinder)
       
   165         {
       
   166         iFlowBinder = flow->GetBinderControlL();
       
   167       	iSSP = iFlowBinder->GetControlL(KSockDatagram, *this);
       
   168      	iSSPData = iFlowBinder->BindL(*this);
       
   169         }
       
   170  	}
       
   171 
       
   172 void CRtpBaseFlow::StopFlow(TCFDataClient::TStop& aMessage)
       
   173 	{
       
   174 
       
   175 	LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t StopFlow() "), this));
       
   176 
       
   177 	/* We shud UnBind from the lower flow ? */
       
   178 	if (iFlowBinder)
       
   179 		{
       
   180 		iFlowBinder->Unbind();
       
   181 		// Flowbinder takes care of itself from now onwards; forget all downwards pointers
       
   182 		iSSP = NULL;
       
   183 		iSSPData = NULL;
       
   184 		iFlowBinder = NULL;
       
   185 		iServiceProvider.Close();
       
   186 		}
       
   187 	/* Notify data Client is Stopped */
       
   188     iSubConnectionProvider.PostMessage(Id(),TCFDataClient::TStopped(aMessage.iValue).CRef());
       
   189 	}
       
   190 	
       
   191 void CRtpBaseFlow::Destroy()
       
   192 	{
       
   193  	DeleteThisFlow();
       
   194 	}
       
   195 	
       
   196 // MSessionControl
       
   197 void CRtpBaseFlow::Shutdown(MSessionControl::TCloseType , const TDesC8& )
       
   198 	{
       
   199 	
       
   200 	LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t Shutdown() Invalid Path PANIC!"), this));	
       
   201 
       
   202 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath));
       
   203 	}
       
   204 
       
   205 void CRtpBaseFlow::Shutdown(MSessionControl::TCloseType aOption)
       
   206 	{
       
   207 	
       
   208 	LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t Shutdown() "), this));
       
   209 
       
   210 	if(iSSP)
       
   211 		{
       
   212 		LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t Calling Shutdown() - On iSSP"), this));
       
   213 		iSSP->Shutdown(aOption);
       
   214 		}
       
   215 	
       
   216 	if(MSessionControl::EImmediate == aOption)
       
   217 		{
       
   218 		/* So the lower layer will not call CanClose(). Handle everything here
       
   219 		 * */
       
   220 		LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t Calling Shutdown() MSessionControl::EImmediate"), this));	
       
   221 		if (iFlowBinder)
       
   222 			{
       
   223 			iFlowBinder->Unbind();
       
   224 			}
       
   225 		
       
   226 		// Flowbinder takes care of itself from now onwards; forget all downwards pointers
       
   227 		iSSP = NULL;
       
   228 		iSSPData = NULL;
       
   229 		iFlowBinder = NULL;
       
   230 		iServiceProvider.Close();
       
   231 		iRecvdImmediateShutDown = ETrue;
       
   232 		}
       
   233 	LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t Shutdown() Done!"), this));
       
   234 	}
       
   235 
       
   236 void CRtpBaseFlow::ActiveOpen()
       
   237 	{
       
   238 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath)); 
       
   239 	}
       
   240 
       
   241 void CRtpBaseFlow::ActiveOpen(const TDesC8& )
       
   242 	{
       
   243 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath)); 
       
   244 	}
       
   245 	
       
   246 TInt CRtpBaseFlow::PassiveOpen(TUint )
       
   247 	{
       
   248 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath)); 
       
   249 	return KErrNotSupported;
       
   250 	}
       
   251 	
       
   252 TInt CRtpBaseFlow::PassiveOpen(TUint ,const TDesC8& )
       
   253 	{
       
   254 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath)); 
       
   255 	return KErrNotSupported;
       
   256 	}
       
   257 
       
   258 void CRtpBaseFlow::AutoBind()
       
   259 	{
       
   260 
       
   261 	LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t AutoBind() "), this));
       
   262 	
       
   263 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider));
       
   264 	iSSP->AutoBind();
       
   265 	
       
   266 	/* Retrive the local address and notify the flows */
       
   267 	TSockAddr addr;
       
   268 	iSSP->LocalName(addr);
       
   269 	DoUpdateLocalAddress(addr);
       
   270 	}
       
   271 	
       
   272 void CRtpBaseFlow::LocalName(TSockAddr& anAddr) const
       
   273 	{
       
   274 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider)); 
       
   275 	iSSP->LocalName(anAddr);
       
   276 	}
       
   277 
       
   278 #ifndef SYMBIAN_STRICT_EXPLICIT_SOCKET_BINDING
       
   279 TInt CRtpBaseFlow::SetLocalName(TSockAddr& anAddr)
       
   280 	{
       
   281 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider));
       
   282 	TInt ret;
       
   283 	ret = iSSP->SetLocalName(anAddr);
       
   284 	if(KErrNone == ret)
       
   285 		{
       
   286 		DoUpdateLocalAddress(anAddr);
       
   287 		}
       
   288 	return ret;
       
   289 	}
       
   290 #else
       
   291 void  CRtpBaseFlow::SetLocalName(TSockAddr& anAddr)
       
   292 	{
       
   293 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider));
       
   294 	
       
   295 	iLocalAddress = anAddr;
       
   296 	(void)iSSP->SetLocalName(anAddr);
       
   297 	
       
   298 	
       
   299 	}
       
   300 #endif //SYMBIAN_STRICT_EXPLICIT_SOCKET_BINDING
       
   301 
       
   302 void CRtpBaseFlow::RemName(TSockAddr& anAddr) const
       
   303 	{
       
   304 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider));
       
   305 	iSSP->RemName(anAddr);
       
   306 	return;
       
   307 	}
       
   308 
       
   309 TInt CRtpBaseFlow::SetRemName(TSockAddr& anAddr)
       
   310 	{
       
   311 	
       
   312 	LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t SetRemName() "), this));	
       
   313 
       
   314 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider));
       
   315 	/* "Normal" UDP Sockets can be connected over and over again. We should disable that because
       
   316 	   this donot have any sense for RTP */
       
   317 	if(iConnected)
       
   318 		{
       
   319 		return KErrNotSupported;
       
   320 		}
       
   321 	
       
   322 	TInt ret = iSSP->SetRemName(anAddr);
       
   323 	if(KErrNone == ret)
       
   324 		{
       
   325 		iDestAddr  =  anAddr;
       
   326 		iConnected = ETrue;
       
   327 		}
       
   328 	return ret;
       
   329 	}
       
   330 	
       
   331 void CRtpBaseFlow::ConnectComplete() 
       
   332 	{
       
   333 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath));
       
   334 	}
       
   335 	
       
   336 void CRtpBaseFlow::ConnectComplete(const TDesC8& ) 
       
   337 	{
       
   338 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath));
       
   339 	}
       
   340 	
       
   341 void CRtpBaseFlow::ConnectComplete(CSubConnectionFlowBase& ) 
       
   342 	{
       
   343 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath));
       
   344 	}
       
   345 	
       
   346 void CRtpBaseFlow::ConnectComplete(CSubConnectionFlowBase& ,const TDesC8& )
       
   347 	{
       
   348 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath));
       
   349 	}
       
   350 
       
   351 TInt CRtpBaseFlow::Error(TInt anError,TUint anOperationMask)
       
   352 	{
       
   353 	TInt ret = KErrNone;
       
   354 
       
   355 	LOG( ESockLogExternal::Printf(KESockFlowTag,KRtpBaseFlowSubTag,_L8("CRtpBaseFlow %08x:\t Error() "), this));	
       
   356 
       
   357 	/* Error message From down or flow error */
       
   358 	if(iSessionControlNotify)
       
   359 		{
       
   360 		ret = iSessionControlNotify->Error(anError,anOperationMask);
       
   361 		if (KErrNone != ret)
       
   362 	    	{
       
   363 	    	if (iFlowBinder)
       
   364 				{
       
   365 				iFlowBinder->Unbind();
       
   366 				}
       
   367 			// Flowbinder takes care of itself from now onwards; forget all downwards pointers
       
   368 			iSSP = NULL;
       
   369 			iSSPData = NULL;
       
   370 			iFlowBinder = NULL;
       
   371 			iServiceProvider.Close();
       
   372 	    	}
       
   373 		}
       
   374 	return ret;
       
   375 	}
       
   376 		
       
   377 void CRtpBaseFlow::Disconnect()
       
   378 	{
       
   379 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath));
       
   380 	}
       
   381 	
       
   382 void CRtpBaseFlow::Disconnect(TDesC8& ) 
       
   383 	{
       
   384 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath));
       
   385 	}
       
   386 	
       
   387 TInt CRtpBaseFlow::SecurityCheck(MProvdSecurityChecker* aSecurityChecker)
       
   388 	{ 
       
   389 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider));
       
   390     /* Pass on the Security check Params to DownStream */
       
   391     return iSSP->SecurityCheck(aSecurityChecker); 
       
   392 	}
       
   393 	 
       
   394 TInt CRtpBaseFlow::GetOption(TUint level, TUint name, TDes8 &anOption) const
       
   395 	{ 
       
   396 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider));
       
   397 	return DoGetOption(level,name,anOption);
       
   398 	}
       
   399 	
       
   400 TInt CRtpBaseFlow::SetOption(TUint level, TUint name, const TDesC8 &anOption)
       
   401 	{
       
   402 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider));
       
   403 	return DoSetOption(level, name, anOption);
       
   404 	}
       
   405 	
       
   406 void CRtpBaseFlow::Ioctl(TUint level, TUint name, TDes8 *anOption)
       
   407 	{
       
   408 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider));
       
   409 	iSSP->Ioctl(level,name,anOption);
       
   410 	return;
       
   411 	}
       
   412 	
       
   413 void CRtpBaseFlow::CanSend()
       
   414 	{
       
   415 	__ASSERT_DEBUG(iSessionDataNotify,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoControlProvider));
       
   416 	iSessionDataNotify->CanSend();
       
   417 	}
       
   418 
       
   419 void CRtpBaseFlow::IoctlComplete(TDesC8* aBuf)
       
   420 	{
       
   421 	__ASSERT_DEBUG(iSessionControlNotify,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoControlProvider));
       
   422 	iSessionControlNotify->IoctlComplete(aBuf);
       
   423 	}
       
   424 	 
       
   425 void CRtpBaseFlow::CancelIoctl(TUint aLevel, TUint aName)
       
   426 	{
       
   427 	__ASSERT_DEBUG(iSSP,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoServiceProvider));
       
   428 	iSSP->CancelIoctl(aLevel,aName);
       
   429 	return;
       
   430 	}
       
   431 
       
   432 void CRtpBaseFlow::Start()
       
   433 	{
       
   434 	return;
       
   435 	}
       
   436 
       
   437 // MSessionData
       
   438 TUint CRtpBaseFlow::Write(const TDesC8& ,TUint ,TSockAddr* )
       
   439 	{
       
   440 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath)); 
       
   441 	return 0;	
       
   442 	}
       
   443 
       
   444 void CRtpBaseFlow::GetData(TDes8& ,TUint ,TSockAddr* )
       
   445 	{
       
   446 	__ASSERT_DEBUG(0,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicUnexpectedExecutionPath));
       
   447 	}
       
   448 
       
   449 void CRtpBaseFlow::NewData(TUint aCount)
       
   450 	{
       
   451 	__ASSERT_DEBUG(iSessionDataNotify,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoControlProvider));
       
   452 	iSessionDataNotify->NewData(aCount);
       
   453 	}
       
   454 	
       
   455 void CRtpBaseFlow::CanClose(MSessionControlNotify::TDelete aDelete)
       
   456 /**
       
   457 Called from protocol to indicate that a graceful close has completed
       
   458 */
       
   459 	{
       
   460 	
       
   461 	DoCanClose(aDelete);
       
   462 
       
   463 	if (iFlowBinder)
       
   464 		{
       
   465 		iFlowBinder->Unbind();
       
   466 		}
       
   467 		
       
   468 	// Flowbinder takes care of itself from now onwards; forget all downwards pointers
       
   469 	iSSP = NULL;
       
   470 	iSSPData = NULL;
       
   471 	iFlowBinder = NULL;
       
   472 	iServiceProvider.Close();
       
   473 	
       
   474 	/* Now pass this up to the ControlProvider */
       
   475 	iSessionControlNotify->CanClose(aDelete);
       
   476 	}
       
   477 
       
   478 void CRtpBaseFlow::CanClose(const TDesC8& , MSessionControlNotify::TDelete aDelete)
       
   479 /**
       
   480 Called from protocol to indicate that a graceful close has completed with disconnect data
       
   481 */
       
   482 	{
       
   483 	/* Will we ever reach here? */
       
   484 	CanClose(aDelete);
       
   485 	}
       
   486 	
       
   487 
       
   488 TInt CRtpBaseFlow::HandleProvisionMessage(Messages::TSignatureBase&)
       
   489 /* Helper funtion that will send a No Bearer and save the Activity ID */
       
   490 	{
       
   491 	/* The custom message TRtpMessageReadyForBind should be send to the SCPR once we get
       
   492     the response for NoNearer. The RtpScprBinderRequest activity will be waiting for this
       
   493     request */
       
   494 	iSubConnectionProvider.PostMessage(Id(),TCFControlProvider::TNoBearer().CRef());
       
   495 		
       
   496 	iWaitingForBindTo = ETrue;
       
   497 	
       
   498 	return KErrNone;
       
   499 	}
       
   500 
       
   501 
       
   502 TInt CRtpBaseFlow::HandleBindToMessage(Messages::TSignatureBase& , TInt aErrCode)
       
   503 /* Creates and Sends a provision Done message with the Error Code */
       
   504 	{
       
   505 	/* Got the Bearer. Finish off the BinderRequest acitivity  */
       
   506 	TRtpMessages::TRtpMessageReadyForBind provDoneMsg(aErrCode);
       
   507 	iSubConnectionProvider.PostMessage(Id(),provDoneMsg);
       
   508 	iWaitingForBindTo = EFalse;
       
   509 	return KErrNone;
       
   510 	}
       
   511 
       
   512 
       
   513 TInt CRtpBaseFlow::HandleError(TInt aErrorCode)
       
   514 /* Handles a TError Message from SubConnection */
       
   515 	{
       
   516 	/* Check if we were waiting for BindToMessage. If we were waiting then
       
   517 	   send a failure to Provision Done Message. This will free up the SCPR
       
   518 	   activity socket open will fail */
       
   519 	if(iWaitingForBindTo)
       
   520 		{
       
   521 		TRtpMessages::TRtpMessageReadyForBind provDoneMsg(KErrCompletion);
       
   522 		iSubConnectionProvider.PostMessage(Id(),provDoneMsg);
       
   523 		iWaitingForBindTo = EFalse;
       
   524 		/* At this point we shud not have a CP shud we be doing this? */
       
   525 		Error(aErrorCode);
       
   526 		/*The bearer has failed. So kill ourselves*/
       
   527 		Destroy();
       
   528 		}
       
   529 	else 
       
   530 		{
       
   531 		Error(aErrorCode);
       
   532 		}
       
   533 	return KErrNone;
       
   534 	}
       
   535 
       
   536 #ifdef SYMBIAN_STRICT_EXPLICIT_SOCKET_BINDING
       
   537 void CRtpBaseFlow::SetLocalNameComplete()
       
   538 {
       
   539   __ASSERT_DEBUG(iSessionControlNotify,User::Panic(KRtpFlowPanic, RtpFlowPanics::KPanicNoControlProvider));
       
   540   DoUpdateLocalAddress(iLocalAddress);
       
   541   iSessionControlNotify->SetLocalNameComplete();
       
   542  }
       
   543 #endif //SYMBIAN_STRICT_EXPLICIT_SOCKET_BINDIN
       
   544