realtimenetprots/rtp/cfrtp/test/te_cfrtp/src/cfrtp_basictests.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 // Basic Test cases for RTP Flows and SCPR
       
    15 // @file
       
    16 // @internalAll
       
    17 // 
       
    18 //
       
    19 
       
    20 #include "cfrtp_basictests.h"
       
    21 #include "te_cfrtpsuitedefs.h"
       
    22 #include <rtp_proto_id.h>
       
    23 
       
    24 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    25 #include <in_sock_internal.h>
       
    26 #endif
       
    27 
       
    28 CSubConStep::~CSubConStep()
       
    29 /**
       
    30  * Destructor
       
    31  */
       
    32 	{
       
    33 	}
       
    34 
       
    35 CSubConStep::CSubConStep()
       
    36 /**
       
    37  * Constructor
       
    38  */
       
    39 	{
       
    40 	SetTestStepName(KSubConTestStep);
       
    41 	}
       
    42 
       
    43 TVerdict CSubConStep::doTestStepPreambleL()
       
    44 /**
       
    45  * @return - TVerdict code
       
    46  * Override of base class virtual
       
    47  */
       
    48 	{
       
    49 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
    50 	return TestStepResult();
       
    51 	}
       
    52 
       
    53 
       
    54 TVerdict CSubConStep::doTestStepL()
       
    55 /**
       
    56  * Try opening a SubConnection and Set RTP Params on it.
       
    57  * @return - TVerdict code
       
    58  *
       
    59  */
       
    60 	{
       
    61     SetTestStepResult(EFail);
       
    62     
       
    63     /* Open a RSubCon and Set rtp params on it */
       
    64     RSubConnection subConnection;
       
    65 
       
    66 
       
    67 	// Create the container for all sub connection parameters
       
    68 	RSubConParameterBundle subconParams;
       
    69 	CleanupClosePushL(subconParams);
       
    70  
       
    71  	// Create a container for RTP sub connection parameters (Param bundle takes ownership)
       
    72 	CSubConParameterFamily* subConFamily = CSubConParameterFamily::NewL(subconParams, KProtocolExtensionFamily);
       
    73 
       
    74  	// Create the requested generic parameter set for RTP (RTP family takes ownership)
       
    75 	CSubConRTPGenericParamSet* reqGenericParams = CSubConRTPGenericParamSet::NewL(*subConFamily, CSubConParameterFamily::ERequested);
       
    76 	
       
    77 	
       
    78 	TUid idRTP = TUid::Uid(KRtpFlowImplementationUid);
       
    79 	// Set the requested Generic Parameters
       
    80 	reqGenericParams->SetProtocolUIDRtp(idRTP);
       
    81 	reqGenericParams->SetBandWidth(iBandWidth);
       
    82 	reqGenericParams->SetRtptimeConversion(iRtpTimeConv);
       
    83 	reqGenericParams->SetRtpAutoSend(iAutoSend);
       
    84 	reqGenericParams->SetRtpTimeNow(iRtpTimeNow);
       
    85 	
       
    86 	reqGenericParams->SetServiceProtocolID(KProtocolInetUdp);
       
    87 	reqGenericParams->SetLowerSubConnType(RSubConnection::EAttachToDefault);
       
    88 	reqGenericParams->SetCNAMEL(iCName);
       
    89 	
       
    90 	iIpAddrDest1.SetPort(iDestPort1); //For RTCP ?
       
    91 	reqGenericParams->SetDefDestinationAddr(iIpAddrDest1);
       
    92 	
       
    93 	TUid idTier = TUid::Uid(iTierId);
       
    94 	reqGenericParams->SetTierID(idTier);
       
    95 	
       
    96 	TInt err;
       
    97 	err = subConnection.Open(iSocketServ,RSubConnection::ECreateNew,iCon);
       
    98 	if(KErrNone != err)
       
    99 		{
       
   100 		SetTestStepResult(EFail);
       
   101 		}
       
   102 	else
       
   103 		{
       
   104 		// Set Properties of the sub-connection
       
   105 		TInt res = subConnection.SetParameters(subconParams);
       
   106 		if(res == KErrNone)
       
   107 			{
       
   108 			SetTestStepResult(EPass);
       
   109 			}
       
   110 		}
       
   111 	// Destroy parameters
       
   112 	CleanupStack::PopAndDestroy();         // subconParams
       
   113 	subConnection.Close();
       
   114 	
       
   115 	return TestStepResult();
       
   116 	}
       
   117 
       
   118 
       
   119 
       
   120 TVerdict CSubConStep::doTestStepPostambleL()
       
   121 /**
       
   122  * @return - TVerdict code
       
   123  * Override of base class virtual
       
   124  */
       
   125 	{
       
   126 	return TestStepResult();
       
   127 	}
       
   128 
       
   129 //
       
   130 
       
   131 CRtpSockTest::~CRtpSockTest()
       
   132 /**
       
   133  * Destructor
       
   134  */
       
   135 	{
       
   136 	}
       
   137 
       
   138 CRtpSockTest::CRtpSockTest()
       
   139 /**
       
   140  * Constructor
       
   141  */
       
   142 	{
       
   143 	SetTestStepName(KRtpSockTestStep);
       
   144 	}
       
   145 
       
   146 TVerdict CRtpSockTest::doTestStepPreambleL()
       
   147 /**
       
   148  * @return - TVerdict code
       
   149  * Override of base class virtual
       
   150  */
       
   151 	{
       
   152 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   153 	return TestStepResult();
       
   154 	}
       
   155 
       
   156 
       
   157 TVerdict CRtpSockTest::doTestStepL()
       
   158 /**
       
   159  * @return - TVerdict code
       
   160  * Try opening a Socket on an RTP SCPR.
       
   161  */
       
   162 	{
       
   163     SetTestStepResult(EFail);
       
   164     TInt err;
       
   165     if(KErrNone == CTe_CfrtpSuiteStepBase::InitSubConL())
       
   166     	{	
       
   167     	err = iRtpSocket.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolRtp, iSubCon);
       
   168     	if(KErrNone == err)
       
   169     		{
       
   170     		SetTestStepResult(EPass);
       
   171     		}
       
   172     	}
       
   173     return TestStepResult();
       
   174 	}
       
   175 
       
   176 
       
   177 TVerdict CRtpSockTest::doTestStepPostambleL()
       
   178 /**
       
   179  * @return - TVerdict code
       
   180  * Override of base class virtual
       
   181  */
       
   182 	{
       
   183 	return TestStepResult();
       
   184 	}
       
   185 
       
   186 //
       
   187 
       
   188 CRtcpSockTest::~CRtcpSockTest()
       
   189 /**
       
   190  * Destructor
       
   191  */
       
   192 	{
       
   193 	}
       
   194 
       
   195 CRtcpSockTest::CRtcpSockTest()
       
   196 /**
       
   197  * Constructor
       
   198  */
       
   199 	{
       
   200 	SetTestStepName(KRtcpSockTestStep);
       
   201 	}
       
   202 
       
   203 TVerdict CRtcpSockTest::doTestStepPreambleL()
       
   204 /**
       
   205  * @return - TVerdict code
       
   206  * Override of base class virtual
       
   207  */
       
   208 	{
       
   209 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   210 	return TestStepResult();
       
   211 	}
       
   212 
       
   213 
       
   214 TVerdict CRtcpSockTest::doTestStepL()
       
   215 /**
       
   216  * @return - TVerdict code
       
   217  * Try opening both RTP and RTCP Sockets.
       
   218  */
       
   219 	{
       
   220     SetTestStepResult(EFail);
       
   221     TInt err;
       
   222     if(KErrNone == CTe_CfrtpSuiteStepBase::InitSubConL())
       
   223     	{	
       
   224     	err = iRtpSocket.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolRtp, iSubCon);
       
   225     	if(KErrNone == err)
       
   226     		{
       
   227     		err = iRtcpSocket.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolRtcp, iSubCon);
       
   228     		if(KErrNone == err)
       
   229     			{
       
   230     			SetTestStepResult(EPass);
       
   231     			}
       
   232     		}
       
   233     	}
       
   234     return TestStepResult();
       
   235 	}
       
   236 
       
   237 
       
   238 TVerdict CRtcpSockTest::doTestStepPostambleL()
       
   239 /**
       
   240  * @return - TVerdict code
       
   241  * Override of base class virtual
       
   242  */
       
   243 	{
       
   244 	return TestStepResult();
       
   245 	}
       
   246 
       
   247 //
       
   248 
       
   249 CRtpSendRecv::~CRtpSendRecv()
       
   250 /**
       
   251  * Destructor
       
   252  */
       
   253 	{
       
   254 	}
       
   255 
       
   256 CRtpSendRecv::CRtpSendRecv()
       
   257 /**
       
   258  * Constructor
       
   259  */
       
   260 	{
       
   261 	SetTestStepName(KRtpSendRecvStep);
       
   262 	}
       
   263 
       
   264 TVerdict CRtpSendRecv::doTestStepPreambleL()
       
   265 /**
       
   266  * @return - TVerdict code
       
   267  * Override of base class virtual
       
   268  */
       
   269 	{
       
   270 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   271 	return TestStepResult();
       
   272 	}
       
   273 
       
   274 
       
   275 TVerdict CRtpSendRecv::doTestStepL()
       
   276 /**
       
   277  * @return - TVerdict code
       
   278  */
       
   279 	{
       
   280     SetTestStepResult(EFail);
       
   281     if(KErrNone == InitSocketsL())
       
   282     	{
       
   283 		iIpAddrDest1.SetPort(iDestPort1);
       
   284 		TBuf8<3000> sendBuf((TUint8*)"Hello World");
       
   285 		
       
   286 		TRequestStatus status;
       
   287 		iRtpSocket.SendTo(sendBuf, iIpAddrDest1, NULL, status);
       
   288 		User::WaitForRequest(status);
       
   289 		if(status.Int() == KErrNone)
       
   290 			{
       
   291 			/* Now do a Receive */
       
   292 			sendBuf.FillZ();
       
   293 			iRtpSocket.RecvFrom(sendBuf,iIpAddrDest1,NULL,status);
       
   294 			User::WaitForRequest(status);
       
   295 			if(status.Int() == KErrNone)
       
   296 				{
       
   297 				sendBuf.SetLength(2500);
       
   298 				TRequestStatus status;
       
   299 				iRtpSocket.SendTo(sendBuf, iIpAddrDest1, NULL, status);
       
   300 				User::WaitForRequest(status);
       
   301 				if(status.Int() == KErrNone)
       
   302 					{
       
   303 					SetTestStepResult(EPass);	
       
   304 					}
       
   305 				}
       
   306 			}
       
   307 		
       
   308     	}
       
   309     return TestStepResult();
       
   310 	}
       
   311 
       
   312 
       
   313 TVerdict CRtpSendRecv::doTestStepPostambleL()
       
   314 /**
       
   315  * @return - TVerdict code
       
   316  * Override of base class virtual
       
   317  */
       
   318 	{
       
   319 	return TestStepResult();
       
   320 	}
       
   321 
       
   322 //
       
   323 
       
   324 CRtcpSendRecv::~CRtcpSendRecv()
       
   325 /**
       
   326  * Destructor
       
   327  */
       
   328 	{
       
   329 	}
       
   330 
       
   331 CRtcpSendRecv::CRtcpSendRecv()
       
   332 /**
       
   333  * Constructor
       
   334  */
       
   335 	{
       
   336 	SetTestStepName(KRtcpSendRecvTestStep);
       
   337 	}
       
   338  
       
   339 TVerdict CRtcpSendRecv::doTestStepPreambleL()
       
   340 /**
       
   341  * @return - TVerdict code
       
   342  * Override of base class virtual
       
   343  */
       
   344 	{
       
   345 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   346 	return TestStepResult();
       
   347 	}
       
   348 
       
   349 
       
   350 TVerdict CRtcpSendRecv::doTestStepL()
       
   351 /**
       
   352  * @return - TVerdict code
       
   353  */
       
   354 	{
       
   355     SetTestStepResult(EFail);
       
   356     if(KErrNone == InitSocketsL())
       
   357     	{
       
   358 		iIpAddrDest1.SetPort(iDestPort1+1);
       
   359 		TBuf8<3000> sendBuf((TUint8*)"Hello World");
       
   360 		
       
   361 		TRequestStatus status;
       
   362 		iRtcpSocket.SendTo(sendBuf, iIpAddrDest1, NULL, status);
       
   363 		User::WaitForRequest(status);
       
   364 		if(status.Int() == KErrNone)
       
   365 			{
       
   366 			/* Now do a Receive */
       
   367 			sendBuf.FillZ();
       
   368 			iRtcpSocket.RecvFrom(sendBuf,iIpAddrDest1,NULL,status);
       
   369 			User::WaitForRequest(status);
       
   370 			if(status.Int() == KErrNone)
       
   371 				{
       
   372 				sendBuf.SetLength(2500);
       
   373 				TRequestStatus status;
       
   374 				iRtcpSocket.SendTo(sendBuf, iIpAddrDest1, NULL, status);
       
   375 				User::WaitForRequest(status);
       
   376 				if(status.Int() == KErrNone)
       
   377 					{
       
   378 					SetTestStepResult(EPass);	
       
   379 					}
       
   380 				}
       
   381 			}
       
   382     	}
       
   383     return TestStepResult();
       
   384 	}
       
   385 
       
   386 
       
   387 TVerdict CRtcpSendRecv::doTestStepPostambleL()
       
   388 /**
       
   389  * @return - TVerdict code
       
   390  * Override of base class virtual
       
   391  */
       
   392 	{
       
   393 	//SetTestStepResult(EFail);  
       
   394 	return TestStepResult();
       
   395 	}
       
   396 
       
   397 //
       
   398 
       
   399 CRtpConnect::~CRtpConnect()
       
   400 /**
       
   401  * Destructor
       
   402  */
       
   403 	{
       
   404 	}
       
   405 
       
   406 CRtpConnect::CRtpConnect()
       
   407 /**
       
   408  * Constructor
       
   409  */
       
   410 	{
       
   411 	SetTestStepName(KRtpConnectTestStep);
       
   412 	}
       
   413  
       
   414 TVerdict CRtpConnect::doTestStepPreambleL()
       
   415 /**
       
   416  * @return - TVerdict code
       
   417  * Override of base class virtual
       
   418  */
       
   419 	{
       
   420 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   421 	return TestStepResult();
       
   422 	}
       
   423 
       
   424 
       
   425 TVerdict CRtpConnect::doTestStepL()
       
   426 /**
       
   427  * @return - TVerdict code
       
   428  */
       
   429 	{
       
   430     SetTestStepResult(EFail);
       
   431     if(KErrNone == InitSocketsL())
       
   432     	{
       
   433 		iIpAddrDest1.SetPort(iDestPort1);
       
   434 		TRequestStatus status;
       
   435 		iRtpSocket.Connect(iIpAddrDest1,status);
       
   436 		User::WaitForRequest(status);
       
   437 		if(status.Int() == KErrNone)
       
   438 			{
       
   439 			TInetAddr rem;
       
   440 			iRtpSocket.RemoteName(rem);
       
   441 			if(rem == iIpAddrDest1)
       
   442 				{
       
   443 				TBuf8<1024> sendBuf((TUint8*)"Hello World");
       
   444 		
       
   445 				iRtpSocket.Send(sendBuf, NULL, status);
       
   446 				User::WaitForRequest(status);
       
   447 				if(status.Int() == KErrNone)
       
   448 					{
       
   449 					/* Now do a Receive */
       
   450 					sendBuf.FillZ();
       
   451 					iRtpSocket.Recv(sendBuf,NULL,status);
       
   452 					User::WaitForRequest(status);
       
   453 					if(status.Int() == KErrNone)
       
   454 						{
       
   455 						/* Next time Connect shud fail */
       
   456 						iIpAddrDest1.SetPort(iDestPort1+2);
       
   457 						iRtpSocket.Connect(iIpAddrDest1,status);
       
   458 						User::WaitForRequest(status);
       
   459 						if(status.Int() != KErrNone)
       
   460 							{
       
   461 							SetTestStepResult(EPass);
       
   462 							}
       
   463 						}
       
   464 					}	
       
   465 				}
       
   466 			}
       
   467     	}
       
   468     return TestStepResult();
       
   469 	}
       
   470 
       
   471 
       
   472 TVerdict CRtpConnect::doTestStepPostambleL()
       
   473 /**
       
   474  * @return - TVerdict code
       
   475  * Override of base class virtual
       
   476  */
       
   477 	{
       
   478 	return TestStepResult();
       
   479 	}
       
   480 
       
   481 //
       
   482 
       
   483 CRtcpConnect::~CRtcpConnect()
       
   484 /**
       
   485  * Destructor
       
   486  */
       
   487 	{
       
   488 	}
       
   489 
       
   490 CRtcpConnect::CRtcpConnect()
       
   491 /**
       
   492  * Constructor
       
   493  */
       
   494 	{
       
   495 	SetTestStepName(KRtpConnectTestStep);
       
   496 	}
       
   497  
       
   498 TVerdict CRtcpConnect::doTestStepPreambleL()
       
   499 /**
       
   500  * @return - TVerdict code
       
   501  * Override of base class virtual
       
   502  */
       
   503 	{
       
   504 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   505 	return TestStepResult();
       
   506 	}
       
   507 
       
   508 
       
   509 TVerdict CRtcpConnect::doTestStepL()
       
   510 /**
       
   511  * @return - TVerdict code
       
   512  */
       
   513 	{
       
   514     SetTestStepResult(EFail);
       
   515     if(KErrNone == InitSocketsL())
       
   516     	{
       
   517 		iIpAddrDest1.SetPort(iDestPort1+1);
       
   518 		TRequestStatus status;
       
   519 		iRtcpSocket.Connect(iIpAddrDest1,status);
       
   520 		User::WaitForRequest(status);
       
   521 		if(status.Int() == KErrNone)
       
   522 			{
       
   523 			TInetAddr rem;
       
   524 			iRtcpSocket.RemoteName(rem);
       
   525 			if(rem == iIpAddrDest1)
       
   526 				{
       
   527 				TBuf8<1024> sendBuf((TUint8*)"Hello World");
       
   528 		
       
   529 				iRtcpSocket.Send(sendBuf, NULL, status);
       
   530 				User::WaitForRequest(status);
       
   531 				if(status.Int() == KErrNone)
       
   532 					{
       
   533 					/* Now do a Receive */
       
   534 					sendBuf.FillZ();
       
   535 					iRtcpSocket.Recv(sendBuf,NULL,status);
       
   536 					User::WaitForRequest(status);
       
   537 					if(status.Int() == KErrNone)
       
   538 						{
       
   539 						/* Next time Connect shud fail */
       
   540 						iIpAddrDest1.SetPort(iDestPort1+2);
       
   541 						iRtcpSocket.Connect(iIpAddrDest1,status);
       
   542 						User::WaitForRequest(status);
       
   543 						if(status.Int() != KErrNone)
       
   544 							{
       
   545 							SetTestStepResult(EPass);
       
   546 							}
       
   547 						}
       
   548 					}	
       
   549 				}	
       
   550 			}
       
   551     	}
       
   552     return TestStepResult();
       
   553 	}
       
   554 
       
   555 
       
   556 TVerdict CRtcpConnect::doTestStepPostambleL()
       
   557 /**
       
   558  * @return - TVerdict code
       
   559  * Override of base class virtual
       
   560  */
       
   561 	{
       
   562 	//SetTestStepResult(EFail);  
       
   563 	return TestStepResult();
       
   564 	}
       
   565 
       
   566 //
       
   567 
       
   568 CRtpNoBind::~CRtpNoBind()
       
   569 /**
       
   570  * Destructor
       
   571  */
       
   572 	{
       
   573 	}
       
   574 
       
   575 CRtpNoBind::CRtpNoBind()
       
   576 /**
       
   577  * Constructor
       
   578  */
       
   579 	{
       
   580 	SetTestStepName(KRtpNoBindTestStep);
       
   581 	}
       
   582  
       
   583 TVerdict CRtpNoBind::doTestStepPreambleL()
       
   584 /**
       
   585  * @return - TVerdict code
       
   586  * Override of base class virtual
       
   587  */
       
   588 	{
       
   589 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   590 	return TestStepResult();
       
   591 	}
       
   592 
       
   593 
       
   594 TVerdict CRtpNoBind::doTestStepL()
       
   595 /**
       
   596  * @return - TVerdict code
       
   597  */
       
   598 	{
       
   599     SetTestStepResult(EFail);
       
   600     TInt err;
       
   601     if(KErrNone == InitSubConL())
       
   602     	{
       
   603     	err = iRtpSocket.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolRtp, iSubCon);
       
   604     	if(err == KErrNone)
       
   605 			{
       
   606 			iIpAddrDest1.SetPort(iDestPort1);
       
   607 			TBuf8<1024> sendBuf((TUint8*)"Hello World");
       
   608 		
       
   609 			TRequestStatus status;
       
   610 			iRtpSocket.SendTo(sendBuf, iIpAddrDest1, NULL, status);
       
   611 			User::WaitForRequest(status);
       
   612 			if(status.Int() == KErrNone)
       
   613 				{
       
   614 				SetTestStepResult(EPass);
       
   615 				}
       
   616 			}
       
   617     	}
       
   618     return TestStepResult();
       
   619 	}
       
   620 
       
   621 
       
   622 TVerdict CRtpNoBind::doTestStepPostambleL()
       
   623 /**
       
   624  * @return - TVerdict code
       
   625  * Override of base class virtual
       
   626  */
       
   627 	{
       
   628 	return TestStepResult();
       
   629 	}
       
   630 
       
   631 //
       
   632 
       
   633 CRtpBind::~CRtpBind()
       
   634 /**
       
   635  * Destructor
       
   636  */
       
   637 	{
       
   638 	}
       
   639 
       
   640 CRtpBind::CRtpBind()
       
   641 /**
       
   642  * Constructor
       
   643  */
       
   644 	{
       
   645 	SetTestStepName(KRtpBindTestStep);
       
   646 	}
       
   647  
       
   648 TVerdict CRtpBind::doTestStepPreambleL()
       
   649 /**
       
   650  * @return - TVerdict code
       
   651  * Override of base class virtual
       
   652  */
       
   653 	{
       
   654 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   655 	return TestStepResult();
       
   656 	}
       
   657 
       
   658 
       
   659 TVerdict CRtpBind::doTestStepL()
       
   660 /**
       
   661  * @return - TVerdict code
       
   662  */
       
   663 	{
       
   664     SetTestStepResult(EFail);
       
   665     if(KErrNone == InitSocketsL())
       
   666     	{
       
   667     	TInetAddr loc;
       
   668     	iRtpSocket.LocalName(loc);
       
   669     	iIpAddrLocal.SetPort(iLocalPort1);
       
   670     	if(loc == iIpAddrLocal)
       
   671 			{
       
   672 			SetTestStepResult(EPass);
       
   673 			}
       
   674     	}
       
   675     return TestStepResult();
       
   676 	}
       
   677 
       
   678 
       
   679 TVerdict CRtpBind::doTestStepPostambleL()
       
   680 /**
       
   681  * @return - TVerdict code
       
   682  * Override of base class virtual
       
   683  */
       
   684 	{
       
   685 	return TestStepResult();
       
   686 	}
       
   687 
       
   688 //
       
   689 
       
   690 CRtpSockOpt::~CRtpSockOpt()
       
   691 /**
       
   692  * Destructor
       
   693  */
       
   694 	{
       
   695 	}
       
   696 
       
   697 CRtpSockOpt::CRtpSockOpt()
       
   698 /**
       
   699  * Constructor
       
   700  */
       
   701 	{
       
   702 	SetTestStepName(KRtpSockOptTestStep);
       
   703 	}
       
   704  
       
   705 TVerdict CRtpSockOpt::doTestStepPreambleL()
       
   706 /**
       
   707  * @return - TVerdict code
       
   708  * Override of base class virtual
       
   709  */
       
   710 	{
       
   711 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   712 	return TestStepResult();
       
   713 	}
       
   714 
       
   715 
       
   716 TVerdict CRtpSockOpt::doTestStepL()
       
   717 /**
       
   718  * @return - TVerdict code
       
   719  */
       
   720 	{
       
   721     SetTestStepResult(EPass);
       
   722     if(KErrNone == InitSocketsL())
       
   723     	{
       
   724     	TInt err;
       
   725     	TInt rcvBufSz;
       
   726     	TInt bandwidth;
       
   727     	TInt ssrc;
       
   728 		
       
   729     	err = iRtpSocket.SetOpt(KSoUdpRecvBuf,KSolInetUdp,5000);
       
   730     	User::LeaveIfError(err);
       
   731     	
       
   732     	err = iRtpSocket.GetOpt(KSoUdpRecvBuf,KSolInetUdp,rcvBufSz);
       
   733     	User::LeaveIfError(err);
       
   734     	
       
   735     	if(rcvBufSz != 5000)
       
   736     		{
       
   737     		SetTestStepResult(EFail);
       
   738     		}
       
   739     	
       
   740     	err = iRtpSocket.SetOpt(KSoRtpBandwidth,KSolRtp,5000);
       
   741     	User::LeaveIfError(err);
       
   742     	
       
   743     	err = iRtpSocket.GetOpt(KSoRtpBandwidth,KSolRtp,bandwidth);
       
   744     	if(KErrNotSupported != err)
       
   745     		{
       
   746     		SetTestStepResult(EFail);
       
   747     		}
       
   748     	    	
       
   749     	TRtpStreamParams streamParams;
       
   750     	streamParams.iMinSequential = iMinSeq;
       
   751     	streamParams.iMaxMisorder   = iMaxMisOrder;
       
   752     	streamParams.iMaxDropout    = iMaxDropOut;
       
   753     	TPckgBuf<TRtpStreamParams> streamParamsBuf(streamParams);
       
   754     	err = iRtpSocket.SetOpt(KSoStreamParams,KSolRtp,streamParamsBuf);
       
   755     	User::LeaveIfError(err);
       
   756     	
       
   757     	TRtpTimeConversion rtpTimeConv;
       
   758     	rtpTimeConv.iRtpTimeNow = iRtpTimeNow;
       
   759     	rtpTimeConv.iConversion = iRtpTimeConv;
       
   760     	TPckgBuf<TRtpTimeConversion> rtpTimeConvBuf(rtpTimeConv);
       
   761     	err = iRtpSocket.SetOpt(KSoRtpTimeConvertion,KSolRtp,rtpTimeConvBuf);
       
   762     	User::LeaveIfError(err);
       
   763     	
       
   764     	err = iRtpSocket.SetOpt(KSoLocalSSRC,KSolRtp,0xFACE);
       
   765     	if(KErrNotSupported != err)
       
   766     		{
       
   767     		SetTestStepResult(EFail);
       
   768     		}
       
   769     	
       
   770     	err = iRtpSocket.GetOpt(KSoLocalSSRC,KSolRtp,ssrc);
       
   771     	User::LeaveIfError(err);
       
   772     	    		
       
   773     	}
       
   774     
       
   775     return TestStepResult();
       
   776 	}
       
   777 
       
   778 
       
   779 TVerdict CRtpSockOpt::doTestStepPostambleL()
       
   780 /**
       
   781  * @return - TVerdict code
       
   782  * Override of base class virtual
       
   783  */
       
   784 	{
       
   785 	return TestStepResult();
       
   786 	}
       
   787 
       
   788 //
       
   789 
       
   790 CRtcpSockOpt::~CRtcpSockOpt()
       
   791 /**
       
   792  * Destructor
       
   793  */
       
   794 	{
       
   795 	}
       
   796 
       
   797 CRtcpSockOpt::CRtcpSockOpt()
       
   798 /**
       
   799  * Constructor
       
   800  */
       
   801 	{
       
   802 	SetTestStepName(KRtcpSockOptTestStep);
       
   803 	}
       
   804  
       
   805 TVerdict CRtcpSockOpt::doTestStepPreambleL()
       
   806 /**
       
   807  * @return - TVerdict code
       
   808  * Override of base class virtual
       
   809  */
       
   810 	{
       
   811 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   812 	return TestStepResult();
       
   813 	}
       
   814 
       
   815 
       
   816 TVerdict CRtcpSockOpt::doTestStepL()
       
   817 /**
       
   818  * @return - TVerdict code
       
   819  */
       
   820 	{
       
   821     SetTestStepResult(EPass);
       
   822     if(KErrNone == InitSocketsL())
       
   823     	{
       
   824     	TInt err;
       
   825     	TInt rcvBufSz;
       
   826     	TInt timeInt;
       
   827     	TBool autosend;
       
   828     			
       
   829 		err = iRtcpSocket.SetOpt(KSoUdpRecvBuf,KSolInetUdp,5000);
       
   830 		User::LeaveIfError(err);
       
   831 		
       
   832 		err = iRtcpSocket.GetOpt(KSoUdpRecvBuf,KSolInetUdp,rcvBufSz);
       
   833 		User::LeaveIfError(err);
       
   834 		        	
       
   835 		if(rcvBufSz != 5000)
       
   836 			{
       
   837 		 	SetTestStepResult(EFail);
       
   838 		 	}
       
   839 		
       
   840 		err = iRtcpSocket.SetOpt(KSoRtcpAutoSend,KSolRtcp,iAutoSend);
       
   841 		User::LeaveIfError(err);
       
   842 		
       
   843 		err = iRtcpSocket.GetOpt(KSoRtcpAutoSend,KSolRtcp,autosend);
       
   844 		User::LeaveIfError(err);
       
   845 		    		
       
   846 		if(autosend != iAutoSend)
       
   847 			{
       
   848 			SetTestStepResult(EFail);
       
   849 			}
       
   850 		
       
   851 		err = iRtcpSocket.SetOpt(KSoRtcpTimeInterval,KSolRtcp,0);
       
   852 		User::LeaveIfError(err);
       
   853 		
       
   854 		err = iRtcpSocket.SetOpt(KSoRtcpCNAME,KSolRtcp,iCName);
       
   855 		if(KErrNone == err)
       
   856 			{
       
   857 			SetTestStepResult(EFail);
       
   858 			}
       
   859 		
       
   860 		iIpAddrDest1.SetPort(iDestPort1); 
       
   861 		TPckgBuf<TInetAddr> defDestBuf(iIpAddrDest1);
       
   862 		err = iRtcpSocket.SetOpt(KSoDefaultDestAddr,KSolRtcp,defDestBuf);
       
   863 		User::LeaveIfError(err);
       
   864 		
       
   865 		err = iRtcpSocket.SetOpt(KSoLocalSSRC,KSolRtcp,0xFACE);
       
   866 		if(KErrNotSupported != err)
       
   867 			{
       
   868 			SetTestStepResult(EFail);
       
   869 			}
       
   870 		
       
   871 		err = iRtcpSocket.GetOpt(KSoRtcpTimeInterval,KSolRtcp,timeInt);
       
   872 		if(KErrNotSupported != err)
       
   873 			{
       
   874 			SetTestStepResult(EFail);
       
   875 			}
       
   876 		}
       
   877     
       
   878     return TestStepResult();
       
   879 	}
       
   880 
       
   881 
       
   882 TVerdict CRtcpSockOpt::doTestStepPostambleL()
       
   883 /**
       
   884  * @return - TVerdict code
       
   885  * Override of base class virtual
       
   886  */
       
   887 	{
       
   888 	return TestStepResult();
       
   889 	}
       
   890 
       
   891 //
       
   892 
       
   893 CRtpIoctl::~CRtpIoctl()
       
   894 /**
       
   895  * Destructor
       
   896  */
       
   897 	{
       
   898 	}
       
   899 
       
   900 CRtpIoctl::CRtpIoctl()
       
   901 /**
       
   902  * Constructor
       
   903  */
       
   904 	{
       
   905 	SetTestStepName(KRtpIoctlTestStep);
       
   906 	}
       
   907  
       
   908 TVerdict CRtpIoctl::doTestStepPreambleL()
       
   909 /**
       
   910  * @return - TVerdict code
       
   911  * Override of base class virtual
       
   912  */
       
   913 	{
       
   914 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   915 	return TestStepResult();
       
   916 	}
       
   917 
       
   918 
       
   919 TVerdict CRtpIoctl::doTestStepL()
       
   920 /**
       
   921  * @return - TVerdict code
       
   922  */
       
   923 	{
       
   924     SetTestStepResult(EFail);
       
   925     if(KErrNone == InitSocketsL())
       
   926     	{
       
   927 		TRequestStatus stat;
       
   928 		TSoInetLastErr lastError;
       
   929 		TPckg<TSoInetLastErr> packError(lastError);
       
   930     	iRtpSocket.Ioctl(KIoctlInetLastError,stat,&packError,KSolInetIp);
       
   931     	User::WaitForRequest(stat);
       
   932     	if(KErrNone == stat.Int())
       
   933 			{
       
   934 			SetTestStepResult(EPass);
       
   935 			iRtpSocket.Ioctl(KIoctlInetLastError,stat,&packError,KSolInetIp);
       
   936 			iRtpSocket.CancelIoctl();
       
   937 			}
       
   938     	}
       
   939     return TestStepResult();
       
   940 	}
       
   941 
       
   942 
       
   943 TVerdict CRtpIoctl::doTestStepPostambleL()
       
   944 /**
       
   945  * @return - TVerdict code
       
   946  * Override of base class virtual
       
   947  */
       
   948 	{
       
   949 	return TestStepResult();
       
   950 	}
       
   951 
       
   952 //
       
   953 
       
   954 CBigSendRecvRtp::~CBigSendRecvRtp()
       
   955 /**
       
   956  * Destructor
       
   957  */
       
   958 	{
       
   959 	}
       
   960 
       
   961 CBigSendRecvRtp::CBigSendRecvRtp()
       
   962 /**
       
   963  * Constructor
       
   964  */
       
   965 	{
       
   966 	SetTestStepName(KBigSendRecvRtp);
       
   967 	}
       
   968  
       
   969 TVerdict CBigSendRecvRtp::doTestStepPreambleL()
       
   970 /**
       
   971  * @return - TVerdict code
       
   972  * Override of base class virtual
       
   973  */
       
   974 	{	
       
   975 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
   976 	return TestStepResult();
       
   977 	}
       
   978 
       
   979 
       
   980 TVerdict CBigSendRecvRtp::doTestStepL()
       
   981 /**
       
   982  * @return - TVerdict code
       
   983  */
       
   984 	{
       
   985 	SetTestStepResult(EFail);
       
   986 	if(KErrNone == InitSocketsL())
       
   987 		{
       
   988 		iIpAddrDest1.SetPort(9000);
       
   989 		RBuf8 sendBuf;
       
   990 		sendBuf.CreateMax(KBufferSize1);
       
   991 		sendBuf.CleanupClosePushL();
       
   992 		RBuf8 recvBuf;
       
   993 		recvBuf.CreateMax(KBufferSize1);
       
   994 		recvBuf.CleanupClosePushL();
       
   995 		
       
   996 		/* Fill the buffer with given character upto its length */
       
   997 		sendBuf.Fill('Q');
       
   998 		TRequestStatus status;
       
   999 		/* do a Send of the data */
       
  1000 		iRtpSocket.SendTo(sendBuf, iIpAddrDest1, NULL, status);
       
  1001 		User::WaitForRequest(status);
       
  1002 		User::LeaveIfError(status.Int());
       
  1003 		/* Now do a Receive */
       
  1004 		recvBuf.FillZ();
       
  1005 		iRtpSocket.RecvFrom(recvBuf,iIpAddrDest1,NULL,status);
       
  1006 		User::WaitForRequest(status);
       
  1007 		User::LeaveIfError(status.Int());
       
  1008 		
       
  1009 		/* Obtain a TPtr of the data excluding the RTP header */
       
  1010 		TPtr8 sendBufPtr = sendBuf.MidTPtr(KRtpHeaderSize);
       
  1011 		TPtr8 recvBufPtr = recvBuf.MidTPtr(KRtpHeaderSize);
       
  1012 		/* Check if the data received is the same as the data sent */
       
  1013 		TInt ret = sendBufPtr.Compare(recvBufPtr);
       
  1014 		if(ret == 0)
       
  1015 			{
       
  1016 			/* Increase the buffer size and fill it up with given data */
       
  1017 			sendBuf.ReAlloc(KBufferSize2);
       
  1018 			recvBuf.ReAlloc(KBufferSize2);
       
  1019 			sendBuf.Fill('Q', KBufferSize2);
       
  1020 			
       
  1021 			/* Send the larger data */
       
  1022 			iRtpSocket.SendTo(sendBuf, iIpAddrDest1, NULL, status);
       
  1023 			User::WaitForRequest(status);
       
  1024 			User::LeaveIfError(status.Int());
       
  1025 			/* Now do a Receive */
       
  1026 			recvBuf.FillZ(KBufferSize2);
       
  1027 			iRtpSocket.RecvFrom(recvBuf,iIpAddrDest1,NULL,status);
       
  1028 			User::WaitForRequest(status);
       
  1029 			User::LeaveIfError(status.Int());
       
  1030 			/* Get pointer to data and compare both of them */
       
  1031 			TPtr8 sendBufPtr = sendBuf.MidTPtr(KRtpHeaderSize);
       
  1032 			TPtr8 recvBufPtr = recvBuf.MidTPtr(KRtpHeaderSize);
       
  1033 			TInt ret = sendBufPtr.Compare(recvBufPtr);
       
  1034 			if(ret == 0)
       
  1035 				{
       
  1036 				SetTestStepResult(EPass);
       
  1037 				}
       
  1038 			}
       
  1039 		CleanupStack::PopAndDestroy(2);
       
  1040 		}
       
  1041 	return TestStepResult();
       
  1042 	}
       
  1043 
       
  1044 TVerdict CBigSendRecvRtp::doTestStepPostambleL()
       
  1045 /**
       
  1046  * @return - TVerdict code
       
  1047  * Override of base class virtual
       
  1048  */
       
  1049 	{
       
  1050 	return TestStepResult();
       
  1051 	}
       
  1052 
       
  1053 //
       
  1054 
       
  1055 CRtpNegTests_01::~CRtpNegTests_01()
       
  1056 /**
       
  1057  * Destructor
       
  1058  */
       
  1059 	{
       
  1060 	}
       
  1061 
       
  1062 CRtpNegTests_01::CRtpNegTests_01()
       
  1063 /**
       
  1064  * Constructor
       
  1065  */
       
  1066 	{
       
  1067 	SetTestStepName(KRtpNegTests_01TestStep);
       
  1068 	}
       
  1069  
       
  1070 TVerdict CRtpNegTests_01::doTestStepPreambleL()
       
  1071 /**
       
  1072  * @return - TVerdict code
       
  1073  * Override of base class virtual
       
  1074  */
       
  1075 	{
       
  1076 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
  1077 	return TestStepResult();
       
  1078 	}
       
  1079 
       
  1080 
       
  1081 TVerdict CRtpNegTests_01::doTestStepL()
       
  1082 /**
       
  1083  * @return - TVerdict code
       
  1084  */
       
  1085 	{
       
  1086     SetTestStepResult(EFail);
       
  1087 	
       
  1088 	TInt ret = KErrNone;
       
  1089 	// Create the container for all sub connection parameters
       
  1090 	RSubConParameterBundle subconParams;
       
  1091 	CleanupClosePushL(subconParams);
       
  1092  
       
  1093  	// Create a container for RTP sub connection parameters (Param bundle takes ownership)
       
  1094 	CSubConParameterFamily* subConFamily = CSubConParameterFamily::NewL(subconParams, KProtocolExtensionFamily);
       
  1095 
       
  1096  	// Create the requested generic parameter set for RTP (RTP family takes ownership)
       
  1097 	CSubConRTPGenericParamSet* reqGenericParams = CSubConRTPGenericParamSet::NewL(*subConFamily, CSubConParameterFamily::ERequested);
       
  1098 	
       
  1099 	
       
  1100 	TUid idRTP = TUid::Uid(KRtpFlowImplementationUid);
       
  1101 	// Set the requested Generic Parameters
       
  1102 	reqGenericParams->SetProtocolUIDRtp(idRTP);
       
  1103 	
       
  1104 	reqGenericParams->SetBandWidth(iBandWidth);
       
  1105 	reqGenericParams->SetRtptimeConversion(iRtpTimeConv);
       
  1106 	reqGenericParams->SetRtpTimeNow(iRtpTimeNow);
       
  1107 	reqGenericParams->SetRtpAutoSend(iAutoSend);
       
  1108 	
       
  1109 	
       
  1110 	reqGenericParams->SetMaxDropOut(iMaxDropOut);
       
  1111 	reqGenericParams->SetMaxMisorder(iMaxMisOrder);
       
  1112 	reqGenericParams->SetMinSequencial(iMinSeq);
       
  1113 	
       
  1114 	//Give an unsupported protocol
       
  1115 	reqGenericParams->SetServiceProtocolID(KSolInetIcmp);
       
  1116 	reqGenericParams->SetLowerSubConnType(RSubConnection::EAttachToDefault);
       
  1117 	reqGenericParams->SetCNAMEL(iCName);
       
  1118 	
       
  1119 	
       
  1120 	iIpAddrDest1.SetPort(iDestPort1); //For RTCP ?
       
  1121 	reqGenericParams->SetDefDestinationAddr(iIpAddrDest1);
       
  1122 	
       
  1123 	TUid idTier = TUid::Uid(iTierId);
       
  1124 	reqGenericParams->SetTierID(idTier);
       
  1125 	
       
  1126 	TInt err;
       
  1127 	err = iSubCon.Open(iSocketServ,RSubConnection::ECreateNew,iCon);
       
  1128 	if(KErrNone != err)
       
  1129 		{
       
  1130 		ret = KErrGeneral;
       
  1131 		}
       
  1132 	else
       
  1133 		{
       
  1134 		// Set Properties of the sub-connection
       
  1135 		TInt res = iSubCon.SetParameters(subconParams);
       
  1136 		if(res != KErrNone)
       
  1137 			{
       
  1138 			ret = KErrGeneral;
       
  1139 			}
       
  1140 		}
       
  1141 	if(KErrNone == ret)
       
  1142 		{
       
  1143 		ret = iRtpSocket.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolRtp, iSubCon);
       
  1144     	if(ret != KErrNone)
       
  1145     		{
       
  1146     		SetTestStepResult(EPass);
       
  1147     		}
       
  1148 		}
       
  1149 	// Destroy parameters
       
  1150 	CleanupStack::PopAndDestroy();         // subconParams
       
  1151     return TestStepResult();
       
  1152 	}
       
  1153 
       
  1154 
       
  1155 TVerdict CRtpNegTests_01::doTestStepPostambleL()
       
  1156 /**
       
  1157  * @return - TVerdict code
       
  1158  * Override of base class virtual
       
  1159  */
       
  1160 	{
       
  1161 	return TestStepResult();
       
  1162 	}
       
  1163 
       
  1164 //
       
  1165 
       
  1166 CRtpNegTests_02::~CRtpNegTests_02()
       
  1167 /**
       
  1168  * Destructor
       
  1169  */
       
  1170 	{
       
  1171 	}
       
  1172 
       
  1173 CRtpNegTests_02::CRtpNegTests_02()
       
  1174 /**
       
  1175  * Constructor
       
  1176  */
       
  1177 	{
       
  1178 	SetTestStepName(KRtpNegTests_02TestStep);
       
  1179 	}
       
  1180  
       
  1181 TVerdict CRtpNegTests_02::doTestStepPreambleL()
       
  1182 /**
       
  1183  * @return - TVerdict code
       
  1184  * Override of base class virtual
       
  1185  */
       
  1186 	{
       
  1187 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
  1188 	return TestStepResult();
       
  1189 	}
       
  1190 
       
  1191 
       
  1192 TVerdict CRtpNegTests_02::doTestStepL()
       
  1193 /**
       
  1194  * @return - TVerdict code
       
  1195  */
       
  1196 	{
       
  1197     SetTestStepResult(EFail);
       
  1198     TInt err;
       
  1199     TRequestStatus stat;
       
  1200     if(KErrNone == InitSubConL())
       
  1201     	{
       
  1202     	RSocket sock;
       
  1203     	err = sock.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp, iSubCon);
       
  1204     	if(KErrNone == err)
       
  1205     		{
       
  1206     		iIpAddrLocal.SetPort(iLocalPort1);
       
  1207     		sock.Bind(iIpAddrLocal);
       
  1208     		iIpAddrDest1.SetPort(iDestPort1);
       
  1209     		sock.Connect(iIpAddrDest1,stat);
       
  1210     		User::WaitForRequest(stat);
       
  1211     		if(KErrNone != stat.Int())
       
  1212     			{
       
  1213     			SetTestStepResult(EPass);
       
  1214     			}
       
  1215 			sock.Close();
       
  1216     		}
       
  1217     	
       
  1218 	 	}    
       
  1219     return TestStepResult();
       
  1220 	}
       
  1221 
       
  1222 
       
  1223 TVerdict CRtpNegTests_02::doTestStepPostambleL()
       
  1224 /**
       
  1225  * @return - TVerdict code
       
  1226  * Override of base class virtual
       
  1227  */
       
  1228 	{
       
  1229 	return TestStepResult();
       
  1230 	}
       
  1231 
       
  1232 //
       
  1233 
       
  1234 CRtpNegTests_03::~CRtpNegTests_03()
       
  1235 /**
       
  1236  * Destructor
       
  1237  */
       
  1238 	{
       
  1239 	}
       
  1240 
       
  1241 CRtpNegTests_03::CRtpNegTests_03()
       
  1242 /**
       
  1243  * Constructor
       
  1244  */
       
  1245 	{
       
  1246 	SetTestStepName(KRtpNegTests_03TestStep);
       
  1247 	}
       
  1248  
       
  1249 TVerdict CRtpNegTests_03::doTestStepPreambleL()
       
  1250 /**
       
  1251  * @return - TVerdict code
       
  1252  * Override of base class virtual
       
  1253  */
       
  1254 	{
       
  1255 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
  1256 	return TestStepResult();
       
  1257 	}
       
  1258 
       
  1259 
       
  1260 TVerdict CRtpNegTests_03::doTestStepL()
       
  1261 /**
       
  1262  * @return - TVerdict code
       
  1263  */
       
  1264 	{
       
  1265     SetTestStepResult(EFail);
       
  1266     TInt err;
       
  1267     TRequestStatus stat;
       
  1268     if(KErrNone == InitSocketsL())
       
  1269     	{
       
  1270     	/* try to Open one more Socket on Subconnection. This should fail */
       
  1271     	RSocket sock;
       
  1272     	err = sock.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolInetUdp, iSubCon);
       
  1273     	if(KErrNone != err)
       
  1274     		{
       
  1275     		SetTestStepResult(EPass);
       
  1276     		}
       
  1277 		sock.Close();
       
  1278 	 	}    
       
  1279     return TestStepResult();
       
  1280 	}
       
  1281 
       
  1282 
       
  1283 TVerdict CRtpNegTests_03::doTestStepPostambleL()
       
  1284 /**
       
  1285  * @return - TVerdict code
       
  1286  * Override of base class virtual
       
  1287  */
       
  1288 	{
       
  1289 	return TestStepResult();
       
  1290 	}
       
  1291 
       
  1292 //
       
  1293 
       
  1294 CRtpNegTests_04::~CRtpNegTests_04()
       
  1295 /**
       
  1296  * Destructor
       
  1297  */
       
  1298 	{
       
  1299 	}
       
  1300 
       
  1301 CRtpNegTests_04::CRtpNegTests_04()
       
  1302 /**
       
  1303  * Constructor
       
  1304  */
       
  1305 	{
       
  1306 	SetTestStepName(KRtpNegTests_04TestStep);
       
  1307 	}
       
  1308  
       
  1309 TVerdict CRtpNegTests_04::doTestStepPreambleL()
       
  1310 /**
       
  1311  * @return - TVerdict code
       
  1312  * Override of base class virtual
       
  1313  */
       
  1314 	{
       
  1315 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
  1316 	return TestStepResult();
       
  1317 	}
       
  1318 
       
  1319 
       
  1320 TVerdict CRtpNegTests_04::doTestStepL()
       
  1321 /**
       
  1322  * @return - TVerdict code
       
  1323  */
       
  1324 	{
       
  1325     SetTestStepResult(EFail);
       
  1326 	
       
  1327 	TInt ret = KErrNone;
       
  1328 	// Create the container for all sub connection parameters
       
  1329 	RSubConParameterBundle subconParams;
       
  1330 	CleanupClosePushL(subconParams);
       
  1331  
       
  1332  	// Create a container for RTP sub connection parameters (Param bundle takes ownership)
       
  1333 	CSubConParameterFamily* subConFamily = CSubConParameterFamily::NewL(subconParams, KProtocolExtensionFamily);
       
  1334 
       
  1335  	// Create the requested generic parameter set for RTP (RTP family takes ownership)
       
  1336 	CSubConRTPGenericParamSet* reqGenericParams = CSubConRTPGenericParamSet::NewL(*subConFamily, CSubConParameterFamily::ERequested);
       
  1337 	
       
  1338 	
       
  1339 	TUid idRTP = TUid::Uid(KRtpFlowImplementationUid);
       
  1340 	// Set the requested Generic Parameters
       
  1341 	reqGenericParams->SetProtocolUIDRtp(idRTP);
       
  1342 	
       
  1343 	reqGenericParams->SetBandWidth(iBandWidth);
       
  1344 	reqGenericParams->SetRtptimeConversion(iRtpTimeConv);
       
  1345 	reqGenericParams->SetRtpTimeNow(iRtpTimeNow);
       
  1346 	reqGenericParams->SetRtpAutoSend(iAutoSend);
       
  1347 	
       
  1348 	
       
  1349 	reqGenericParams->SetMaxDropOut(iMaxDropOut);
       
  1350 	reqGenericParams->SetMaxMisorder(iMaxMisOrder);
       
  1351 	reqGenericParams->SetMinSequencial(iMinSeq);
       
  1352 	
       
  1353 	reqGenericParams->SetServiceProtocolID(KProtocolInetUdp);
       
  1354 	reqGenericParams->SetLowerSubConnType(RSubConnection::ECreateNew);
       
  1355 	reqGenericParams->SetCNAMEL(iCName);
       
  1356 	
       
  1357 	
       
  1358 	iIpAddrDest1.SetPort(iDestPort1); //For RTCP ?
       
  1359 	reqGenericParams->SetDefDestinationAddr(iIpAddrDest1);
       
  1360 	
       
  1361 	TUid idTier = TUid::Uid(iTierId);
       
  1362 	reqGenericParams->SetTierID(idTier);
       
  1363 	
       
  1364 	TInt err;
       
  1365 	//Giving ECreateNew .. Socket open should fail
       
  1366 	err = iSubCon.Open(iSocketServ,RSubConnection::ECreateNew,iCon);
       
  1367 	if(KErrNone != err)
       
  1368 		{
       
  1369 		ret = KErrGeneral;
       
  1370 		}
       
  1371 	else
       
  1372 		{
       
  1373 		// Set Properties of the sub-connection
       
  1374 		TInt res = iSubCon.SetParameters(subconParams);
       
  1375 		if(res != KErrNone)
       
  1376 			{
       
  1377 			ret = KErrGeneral;
       
  1378 			}
       
  1379 		}
       
  1380 	if(KErrNone == ret)
       
  1381 		{
       
  1382 		ret = iRtpSocket.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolRtp, iSubCon);
       
  1383     	if(ret != KErrNone)
       
  1384     		{
       
  1385     		SetTestStepResult(EPass);
       
  1386     		}
       
  1387 		}
       
  1388 	// Destroy parameters
       
  1389 	CleanupStack::PopAndDestroy();         // subconParams
       
  1390     return TestStepResult();
       
  1391 	}
       
  1392 
       
  1393 
       
  1394 TVerdict CRtpNegTests_04::doTestStepPostambleL()
       
  1395 /**
       
  1396  * @return - TVerdict code
       
  1397  * Override of base class virtual
       
  1398  */
       
  1399 	{
       
  1400 	return TestStepResult();
       
  1401 	}
       
  1402 
       
  1403 //
       
  1404 
       
  1405 CRtpNegTests_05::~CRtpNegTests_05()
       
  1406 /**
       
  1407  * Destructor
       
  1408  */
       
  1409 	{
       
  1410 	}
       
  1411 
       
  1412 CRtpNegTests_05::CRtpNegTests_05()
       
  1413 /**
       
  1414  * Constructor
       
  1415  */
       
  1416 	{
       
  1417 	SetTestStepName(KRtpNegTests_05TestStep);
       
  1418 	}
       
  1419  
       
  1420 TVerdict CRtpNegTests_05::doTestStepPreambleL()
       
  1421 /**
       
  1422  * @return - TVerdict code
       
  1423  * Override of base class virtual
       
  1424  */
       
  1425 	{
       
  1426 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
  1427 	return TestStepResult();
       
  1428 	}
       
  1429 
       
  1430 
       
  1431 TVerdict CRtpNegTests_05::doTestStepL()
       
  1432 /**
       
  1433  * @return - TVerdict code
       
  1434  */
       
  1435 	{
       
  1436     SetTestStepResult(EFail);
       
  1437 	
       
  1438 	TInt ret = KErrNone;
       
  1439 	// Create the container for all sub connection parameters
       
  1440 	RSubConParameterBundle subconParams;
       
  1441 	CleanupClosePushL(subconParams);
       
  1442  
       
  1443  	// Create a container for RTP sub connection parameters (Param bundle takes ownership)
       
  1444 	CSubConParameterFamily* subConFamily = CSubConParameterFamily::NewL(subconParams, KProtocolExtensionFamily);
       
  1445 
       
  1446  	// Create the requested generic parameter set for RTP (RTP family takes ownership)
       
  1447 	CSubConRTPGenericParamSet* reqGenericParams = CSubConRTPGenericParamSet::NewL(*subConFamily, CSubConParameterFamily::ERequested);
       
  1448 	
       
  1449 	
       
  1450 	//Wrong UID
       
  1451 	TUid idRTP = TUid::Uid(0xBABE);
       
  1452 	// Set the requested Generic Parameters
       
  1453 	reqGenericParams->SetProtocolUIDRtp(idRTP);
       
  1454 	
       
  1455 	reqGenericParams->SetBandWidth(iBandWidth);
       
  1456 	reqGenericParams->SetRtptimeConversion(iRtpTimeConv);
       
  1457 	reqGenericParams->SetRtpTimeNow(iRtpTimeNow);
       
  1458 	reqGenericParams->SetRtpAutoSend(iAutoSend);
       
  1459 	
       
  1460 	
       
  1461 	reqGenericParams->SetMaxDropOut(iMaxDropOut);
       
  1462 	reqGenericParams->SetMaxMisorder(iMaxMisOrder);
       
  1463 	reqGenericParams->SetMinSequencial(iMinSeq);
       
  1464 	
       
  1465 	reqGenericParams->SetServiceProtocolID(KProtocolInetUdp);
       
  1466 	reqGenericParams->SetLowerSubConnType(RSubConnection::EAttachToDefault);
       
  1467 	reqGenericParams->SetCNAMEL(iCName);
       
  1468 	
       
  1469 	
       
  1470 	iIpAddrDest1.SetPort(iDestPort1); //For RTCP ?
       
  1471 	reqGenericParams->SetDefDestinationAddr(iIpAddrDest1);
       
  1472 	
       
  1473 	TUid idTier = TUid::Uid(iTierId);
       
  1474 	reqGenericParams->SetTierID(idTier);
       
  1475 	
       
  1476 	TInt err;
       
  1477 	err = iSubCon.Open(iSocketServ,RSubConnection::ECreateNew,iCon);
       
  1478 	if(KErrNone != err)
       
  1479 		{
       
  1480 		ret = KErrGeneral;
       
  1481 		}
       
  1482 	else
       
  1483 		{
       
  1484 		// Set Properties of the sub-connection
       
  1485 		TInt res = iSubCon.SetParameters(subconParams);
       
  1486 		if(res != KErrNone)
       
  1487 			{
       
  1488 			ret = KErrGeneral;
       
  1489 			}
       
  1490 		}
       
  1491 	if(KErrNone == ret)
       
  1492 		{
       
  1493 		ret = iRtpSocket.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolRtp, iSubCon);
       
  1494     	if(ret != KErrNone)
       
  1495     		{
       
  1496     		SetTestStepResult(EPass);
       
  1497     		}
       
  1498 		}
       
  1499 	// Destroy parameters
       
  1500 	CleanupStack::PopAndDestroy();         // subconParams
       
  1501     return TestStepResult();
       
  1502 	}
       
  1503 
       
  1504 
       
  1505 TVerdict CRtpNegTests_05::doTestStepPostambleL()
       
  1506 /**
       
  1507  * @return - TVerdict code
       
  1508  * Override of base class virtual
       
  1509  */
       
  1510 	{
       
  1511 	return TestStepResult();
       
  1512 	}
       
  1513 
       
  1514 //
       
  1515 
       
  1516 CRtpNegTestsFailNoBearer::~CRtpNegTestsFailNoBearer()
       
  1517 /**
       
  1518  * Destructor
       
  1519  */
       
  1520 	{
       
  1521 	}
       
  1522 
       
  1523 CRtpNegTestsFailNoBearer::CRtpNegTestsFailNoBearer()
       
  1524 /**
       
  1525  * Constructor
       
  1526  */
       
  1527 	{
       
  1528 	SetTestStepName(KRtpNegTests_FailNoBearer);
       
  1529 	}
       
  1530  
       
  1531 TVerdict CRtpNegTestsFailNoBearer::doTestStepPreambleL()
       
  1532 /**
       
  1533  * @return - TVerdict code
       
  1534  * Override of base class virtual
       
  1535  */
       
  1536 	{
       
  1537 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
  1538 	return TestStepResult();
       
  1539 	}
       
  1540 
       
  1541 
       
  1542 TVerdict CRtpNegTestsFailNoBearer::doTestStepL()
       
  1543 /**
       
  1544  * @return - TVerdict code
       
  1545  */
       
  1546 	{
       
  1547     SetTestStepResult(EFail);
       
  1548     TInt err;
       
  1549     TRequestStatus stat;
       
  1550     if(KErrNone == InitDummySubConL(CSubConRTPGenericParamSetDummy::KFailNoBearer))
       
  1551     	{
       
  1552     	/* try to Open one more Socket on Subconnection. This should fail */
       
  1553     	RSocket sock;
       
  1554     	err = sock.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolInetUdp, iSubCon);
       
  1555     	if(KErrNone != err)
       
  1556     		{
       
  1557     		SetTestStepResult(EPass);
       
  1558     		}
       
  1559 		sock.Close();
       
  1560 	 	}    
       
  1561     return TestStepResult();
       
  1562 	}
       
  1563 
       
  1564 
       
  1565 TVerdict CRtpNegTestsFailNoBearer::doTestStepPostambleL()
       
  1566 /**
       
  1567  * @return - TVerdict code
       
  1568  * Override of base class virtual
       
  1569  */
       
  1570 	{
       
  1571 	return TestStepResult();
       
  1572 	}
       
  1573 
       
  1574 //
       
  1575 
       
  1576 CRtpShutDownImmediate::~CRtpShutDownImmediate()
       
  1577 /**
       
  1578  * Destructor
       
  1579  */
       
  1580 	{
       
  1581 	}
       
  1582 
       
  1583 CRtpShutDownImmediate::CRtpShutDownImmediate()
       
  1584 /**
       
  1585  * Constructor
       
  1586  */
       
  1587 	{
       
  1588 	SetTestStepName(KRtpShutDownImmediate);
       
  1589 	}
       
  1590  
       
  1591 TVerdict CRtpShutDownImmediate::doTestStepPreambleL()
       
  1592 /**
       
  1593  * @return - TVerdict code
       
  1594  * Override of base class virtual
       
  1595  */
       
  1596 	{
       
  1597 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
  1598 	return TestStepResult();
       
  1599 	}
       
  1600 
       
  1601 
       
  1602 TVerdict CRtpShutDownImmediate::doTestStepL()
       
  1603 /**
       
  1604  * @return - TVerdict code
       
  1605  */
       
  1606 	{
       
  1607 	SetTestStepResult(EFail);
       
  1608 	TRequestStatus stat;
       
  1609 	TInt err;
       
  1610     if(KErrNone == InitSubConL())
       
  1611     	{
       
  1612     	err = iRtpSocket.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolRtp, iSubCon);
       
  1613     	if(KErrNone == err)
       
  1614 			{
       
  1615 			iRtpSocket.Shutdown(RSocket::EImmediate,stat);
       
  1616 			User::WaitForRequest(stat);
       
  1617 			if(KErrNone == stat.Int())
       
  1618 				{
       
  1619 				SetTestStepResult(EPass);
       
  1620 				}
       
  1621 			}
       
  1622 		}
       
  1623 	return TestStepResult();
       
  1624 	}
       
  1625 
       
  1626 TVerdict CRtpShutDownImmediate::doTestStepPostambleL()
       
  1627 /**
       
  1628  * @return - TVerdict code
       
  1629  * Override of base class virtual
       
  1630  */
       
  1631 	{
       
  1632 	return TestStepResult();
       
  1633 	}
       
  1634 
       
  1635 
       
  1636 //
       
  1637 
       
  1638 CRtcpShutDownImmediate::~CRtcpShutDownImmediate()
       
  1639 /**
       
  1640  * Destructor
       
  1641  */
       
  1642 	{
       
  1643 	}
       
  1644 
       
  1645 CRtcpShutDownImmediate::CRtcpShutDownImmediate()
       
  1646 /**
       
  1647  * Constructor
       
  1648  */
       
  1649 	{
       
  1650 	SetTestStepName(KRtcpShutDownImmediate);
       
  1651 	}
       
  1652  
       
  1653 TVerdict CRtcpShutDownImmediate::doTestStepPreambleL()
       
  1654 /**
       
  1655  * @return - TVerdict code
       
  1656  * Override of base class virtual
       
  1657  */
       
  1658 	{
       
  1659 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
  1660 	return TestStepResult();
       
  1661 	}
       
  1662 
       
  1663 
       
  1664 TVerdict CRtcpShutDownImmediate::doTestStepL()
       
  1665 /**
       
  1666  * @return - TVerdict code
       
  1667  */
       
  1668 	{
       
  1669 	SetTestStepResult(EFail);
       
  1670 	TRequestStatus stat;
       
  1671     if(KErrNone == InitSocketsL())
       
  1672     	{
       
  1673 		iRtcpSocket.Shutdown(RSocket::EImmediate,stat);
       
  1674 		User::WaitForRequest(stat);
       
  1675 		if(KErrNone == stat.Int())
       
  1676 			{
       
  1677 			SetTestStepResult(EPass);
       
  1678 			}
       
  1679 		}
       
  1680 	return TestStepResult();
       
  1681 	}
       
  1682 
       
  1683 TVerdict CRtcpShutDownImmediate::doTestStepPostambleL()
       
  1684 /**
       
  1685  * @return - TVerdict code
       
  1686  * Override of base class virtual
       
  1687  */
       
  1688 	{
       
  1689 	return TestStepResult();
       
  1690 	}
       
  1691 
       
  1692 //
       
  1693 
       
  1694 CShutDownImmediate::~CShutDownImmediate()
       
  1695 /**
       
  1696  * Destructor
       
  1697  */
       
  1698 	{
       
  1699 	}
       
  1700 
       
  1701 CShutDownImmediate::CShutDownImmediate()
       
  1702 /**
       
  1703  * Constructor
       
  1704  */
       
  1705 	{
       
  1706 	SetTestStepName(KShutDownImmediate);
       
  1707 	}
       
  1708  
       
  1709 TVerdict CShutDownImmediate::doTestStepPreambleL()
       
  1710 /**
       
  1711  * @return - TVerdict code
       
  1712  * Override of base class virtual
       
  1713  */
       
  1714 	{
       
  1715 	SetTestStepResult(CTe_CfrtpSuiteStepBase::doTestStepPreambleL());
       
  1716 	return TestStepResult();
       
  1717 	}
       
  1718 
       
  1719 
       
  1720 TVerdict CShutDownImmediate::doTestStepL()
       
  1721 /**
       
  1722  * @return - TVerdict code
       
  1723  */
       
  1724 	{
       
  1725 	INFO_PRINTF1(_L("IMPORTANT A Panic in this Place means a Destroy was Posted(and handled) by IpDefScpr before RTPScpr :("));
       
  1726 	SetTestStepResult(EFail);
       
  1727 	TRequestStatus stat;
       
  1728     if(KErrNone == InitSocketsL())
       
  1729     	{
       
  1730 		iRtpSocket.Shutdown(RSocket::EImmediate,stat);
       
  1731 		User::WaitForRequest(stat);
       
  1732 		if(KErrNone == stat.Int())
       
  1733 			{
       
  1734 			iRtcpSocket.Shutdown(RSocket::EImmediate,stat);
       
  1735 			User::WaitForRequest(stat);
       
  1736 			if(KErrNone == stat.Int())
       
  1737 				{
       
  1738 				SetTestStepResult(EPass);
       
  1739 				}
       
  1740 			}
       
  1741 		}
       
  1742 	return TestStepResult();
       
  1743 	}
       
  1744 
       
  1745 TVerdict CShutDownImmediate::doTestStepPostambleL()
       
  1746 /**
       
  1747  * @return - TVerdict code
       
  1748  * Override of base class virtual
       
  1749  */
       
  1750 	{
       
  1751 	return TestStepResult();
       
  1752 	}
       
  1753