natfw/tsrc/natfwtestconsoles/natfwtestconsole/src/natfwtestconsole.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Part of TestConsole application.
       
    15 **              Methods for the class CTestAppConsole
       
    16 **
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <e32debug.h>
       
    25 #include <e32cons.h>
       
    26 #include "natfwconnectivityapi.h"
       
    27 #include <badesca.h>
       
    28 #include "natfwtestconsole.h"
       
    29 #include "testdefinitions.hrh"
       
    30 #include "natfwtestconsolestubs.h"
       
    31 #include "mediateststubs.h"
       
    32 #include "iceteststubs.h"
       
    33 #include "stunturntests.h"
       
    34 #include "icetests.h"
       
    35 #include "stunudpmediatest.h"
       
    36 #include "natsettingstest.h"
       
    37 
       
    38 #include "generalsettings.h"
       
    39 #include "stunudpsettings.h"
       
    40 #include "stuntcpsettings.h"
       
    41 #include "turnudpsettings.h"
       
    42 #include "turntcpsettings.h"
       
    43 #include "additionalstunudpsettings.h"
       
    44 #include "additionalstuntcpsettings.h"
       
    45 #include "additionalturnudpsettings.h"
       
    46 #include "additionalturntcpsettings.h"
       
    47 #include "additionalicesettings.h"
       
    48 #include "iceudpsettings.h"
       
    49 #include "icetcpsettings.h"
       
    50 
       
    51 #include "natfwcandidate.h"
       
    52 #include "natfwcandidatepair.h"
       
    53 #include "natcandidatestore.h"
       
    54 #include "iap.h"
       
    55 
       
    56 _LIT8( KIsp1vDomain, "isp1v.wipsl.com" );
       
    57 _LIT8( KIsp1tDomain, "isp1t.wipsl.com" );
       
    58 _LIT8( KIsp1eDomain, "isp1e.wipsl.com" );
       
    59 _LIT8( KIsp1sDomain, "isp1s.wipsl.com" );
       
    60 _LIT8( KDefaultDomain, "isp1v.wipsl.com" );
       
    61 
       
    62 _LIT8( KStun, "nokia.stun" );
       
    63 _LIT8( KTurn, "nokia.turn" );
       
    64 
       
    65 const TInt32 KDefaultDestAddress = INET_ADDR( 0,0,0,0 );
       
    66 const TUint KDefaultDestPort = 0;
       
    67 const TUint KDefaultGranularity = 1;
       
    68 
       
    69 //*******************************************************************************
       
    70 // Method      : CTestAppConsole::NewL()
       
    71 // Purpose     : 
       
    72 // Parameters  : 
       
    73 // Return Value: 
       
    74 //*******************************************************************************
       
    75 CTestAppConsole* CTestAppConsole::NewLC()
       
    76     {
       
    77     CTestAppConsole* self = new ( ELeave ) CTestAppConsole();
       
    78     CleanupStack::PushL( self );
       
    79     self->ConstructL();
       
    80     return self;
       
    81     }
       
    82 
       
    83 
       
    84 //*******************************************************************************
       
    85 // Method      : CTestAppConsole::CTestAppConsole()
       
    86 // Purpose     : Constructor
       
    87 // Parameters  : 
       
    88 // Return Value: 
       
    89 //*******************************************************************************
       
    90 CTestAppConsole::CTestAppConsole()
       
    91     : CActive( EPriorityStandard ),
       
    92     iDestAddress( KDefaultDestAddress), iDestPort( KDefaultDestPort )
       
    93     {
       
    94     CActiveScheduler::Add( this );
       
    95     iPause = EFalse;
       
    96     }
       
    97 
       
    98 
       
    99 //*******************************************************************************
       
   100 // Method      : CTestAppConsole::ConstructL()
       
   101 // Purpose     : 
       
   102 // Parameters  : 
       
   103 // Return Value: 
       
   104 //*******************************************************************************
       
   105 void CTestAppConsole::ConstructL()
       
   106     {
       
   107     iDomainName = KDefaultDomain().AllocL();
       
   108 	iConsole = Console::NewL( KMainTitle, TSize(KConsFullScreen, KConsFullScreen) );
       
   109     }
       
   110 
       
   111 
       
   112 //*******************************************************************************
       
   113 // Method      : CTestAppConsole::~CTestAppConsole()
       
   114 // Purpose     : Destructor
       
   115 // Parameters  : 
       
   116 // Return Value: 
       
   117 //*******************************************************************************
       
   118 CTestAppConsole::~CTestAppConsole()
       
   119     {	
       
   120     Cancel();
       
   121     delete iConsole;
       
   122 	delete iInstruct;
       
   123     delete iNat;
       
   124     delete iNatStub;
       
   125     delete iIceComTest;
       
   126     delete iDomainName;
       
   127     }
       
   128 
       
   129 
       
   130 //*******************************************************************************
       
   131 // Method      : CTestAppConsole::StartTesting()
       
   132 // Purpose     : start this AO 
       
   133 // Parameters  : 
       
   134 // Return Value: 
       
   135 //*******************************************************************************
       
   136 void CTestAppConsole::StartTesting()
       
   137     {
       
   138     IapSelectionL();
       
   139     DoRead();
       
   140     }
       
   141 
       
   142 
       
   143 //*******************************************************************************
       
   144 // Method      : CTestAppConsole::DoRead()
       
   145 // Purpose     : get the user's option and send request to scheduler
       
   146 // Parameters  : 
       
   147 // Return Value: 
       
   148 //*******************************************************************************
       
   149 void CTestAppConsole::DoRead()
       
   150     {
       
   151 	iConsole->Read( iStatus );
       
   152 	SetActive();
       
   153     }
       
   154 
       
   155 
       
   156 //*******************************************************************************
       
   157 // Method      : CTestAppConsole::RunL()
       
   158 // Purpose     : 
       
   159 // Parameters  : 
       
   160 // Return Value: 
       
   161 //*******************************************************************************
       
   162 void CTestAppConsole::RunL()
       
   163     {
       
   164 	// According to current test case and direct the user's command
       
   165 	// to proper command handler.
       
   166 	if ( iPause )
       
   167 	    {
       
   168 	    iPause = EFalse;
       
   169 	    User::RequestComplete( iListenerStatus, KErrNone );
       
   170 	    DoRead();
       
   171 	    }
       
   172     else
       
   173         {
       
   174         switch( iInputProcess )
       
   175             {
       
   176             case KMainInput:
       
   177                 ProcessMainInput();
       
   178                 break;
       
   179             case KDomainNameInput:
       
   180                 ProcessDomainSetupInputL();
       
   181                 break;
       
   182             case KMediaTestInput:
       
   183                 ProcessMediaTestInputL();
       
   184                 break;
       
   185             case KIapInput:
       
   186                 ProcessIapInputL();
       
   187                 break;
       
   188             }
       
   189         }
       
   190     }
       
   191 
       
   192 
       
   193 //*******************************************************************************
       
   194 // Method      : CTestAppConsole::DoCancel()
       
   195 // Purpose     : 
       
   196 // Parameters  : 
       
   197 // Return Value: 
       
   198 //*******************************************************************************
       
   199 void CTestAppConsole::DoCancel()
       
   200     {
       
   201 	iConsole->ReadCancel();
       
   202     }
       
   203 
       
   204 
       
   205 //*******************************************************************************
       
   206 // Method      : CTestAppConsole::DisplayConsoleMenu()
       
   207 // Purpose     : Display main or sub console menus for different test cases
       
   208 // Parameters  : TDesc &aInstructions
       
   209 // Return Value: void
       
   210 //*******************************************************************************
       
   211 void CTestAppConsole::DisplayConsoleMenuL( const TDesC& aInstructions )
       
   212     {
       
   213     if ( iInstruct )
       
   214 	    {
       
   215         delete iInstruct;
       
   216         iInstruct = NULL;
       
   217         }
       
   218     
       
   219     iInstruct = aInstructions.AllocL();
       
   220     iConsole->ClearScreen();
       
   221     _LIT16( KDomainFormat, "Domain: %S\n" );
       
   222     TBuf16<60> buffer;
       
   223     buffer.Copy( iDomainName->Des() );
       
   224     iConsole->Printf( KDomainFormat, &buffer  );
       
   225     iConsole->Write( *iInstruct );
       
   226     }
       
   227 
       
   228 
       
   229 //*******************************************************************************
       
   230 // Method      : CTestAppConsole::ProcessIapInputL()
       
   231 // Purpose     : Obtain user's option is mean to be run.
       
   232 // Parameters  : 
       
   233 // Return Value: void
       
   234 //*******************************************************************************
       
   235 void CTestAppConsole::ProcessIapInputL()
       
   236     {
       
   237     TBuf<80> line;
       
   238     if( !iInstruct )
       
   239         {
       
   240         iInstruct = KTxtMainInstructions().AllocL();
       
   241         }
       
   242     GetStringFromConsole(line);
       
   243     TInt input;
       
   244     TLex lex( line );
       
   245     if ( !lex.Val( input ) )
       
   246         {
       
   247         iIapId = input;
       
   248         iInputProcess = KMainInput;
       
   249         DisplayConsoleMenuL( KTxtMainInstructions );
       
   250         }
       
   251     DoRead();
       
   252     }
       
   253 
       
   254 //*******************************************************************************
       
   255 // Method      : CTestAppConsole::ProcessDomainSetupInputL()
       
   256 // Purpose     : Obtain user's option and decide which media test
       
   257 //             : is mean to be run.
       
   258 // Parameters  : 
       
   259 // Return Value: void
       
   260 //*******************************************************************************
       
   261 void CTestAppConsole::ProcessMediaTestInputL()
       
   262     {
       
   263     TBuf<80> line;
       
   264     GetStringFromConsole(line);
       
   265     TBool wrongOption = EFalse;
       
   266     TInt err = KErrNone;
       
   267     TInt input;
       
   268     TLex lex( line );
       
   269         
       
   270     if ( !lex.Val( input ) )
       
   271         {
       
   272         switch( input )
       
   273             {
       
   274             case 1:
       
   275                 err = FetchCandidates( KProtocolInetUdp );
       
   276                 break;
       
   277             case 2:
       
   278                 err = StartIceComTest( KProtocolInetUdp, EIceRoleControlling );
       
   279                 break;
       
   280             case 3:
       
   281                 err = StartIceComTest( KProtocolInetUdp, EIceRoleControlled );
       
   282                 break;
       
   283             
       
   284             case 4:
       
   285                 err = FetchCandidates( KProtocolInetUdp, ETrue );
       
   286                 break;      
       
   287             case 5:
       
   288                 err = StartIceComTest( KProtocolInetUdp, EIceRoleControlling, ETrue );
       
   289                 break;
       
   290             case 6:
       
   291                 err = StartIceComTest( KProtocolInetUdp, EIceRoleControlled, ETrue );
       
   292                 break;
       
   293             
       
   294             case 7:
       
   295                 err = FetchCandidate( KProtocolInetUdp, EStunComTest );
       
   296                 break;      
       
   297             case 8:
       
   298                 err = StartComTest( KProtocolInetUdp, EStunComTest );
       
   299                 break;
       
   300             
       
   301             case 9:
       
   302                 err = FetchCandidate( KProtocolInetUdp, EStunComTest, ETrue );
       
   303                 break;      
       
   304             case 10:
       
   305                 err = StartComTest( KProtocolInetUdp, EStunComTest, ETrue );
       
   306                 break;
       
   307             
       
   308             case 11: 
       
   309                 err = FetchCandidate( KProtocolInetUdp, ETurnComTest );
       
   310                 break;
       
   311             
       
   312             case 12:
       
   313                 err = StartComTest( KProtocolInetUdp, ETurnComTest );
       
   314                 break;
       
   315             
       
   316             case 13:
       
   317                 err = FetchCandidate( KProtocolInetUdp, ETurnComTest, ETrue );
       
   318                 break;      
       
   319             case 14:
       
   320                 err = StartComTest( KProtocolInetUdp, ETurnComTest, ETrue );
       
   321                 break;
       
   322             
       
   323             case 15:
       
   324                 StopIceComTest();
       
   325                 break; 
       
   326             case 0:
       
   327                 iInputProcess = KMainInput;
       
   328                 DisplayConsoleMenuL( KTxtMainInstructions );
       
   329                 break;
       
   330             default:
       
   331                 wrongOption = ETrue;
       
   332                 DisplayMsg( KTxtWrongOption );
       
   333                 break;
       
   334             }
       
   335         if ( !wrongOption )
       
   336             {
       
   337             if ( iAudioTestICE )
       
   338                 {
       
   339                 iConsole->Printf( _L( "Com test ongoing. enter 15 to stop\n" ) );
       
   340                 }
       
   341             else
       
   342                 {
       
   343                 if ( err )
       
   344                     {
       
   345                     iConsole->Printf( _L("Some tests failed: %d, check logs\n"), err );
       
   346                     RDebug::Print( _L("\nSome tests failed: %d, check logs\n"), err );
       
   347                     }
       
   348                 else if ( input != 0 )
       
   349                     {
       
   350                     iConsole->Printf( _L( "TESTS COMPLETED\n" ) );
       
   351                     RDebug::Print( _L( "\nTESTS COMPLETED\n" ) );
       
   352                     }
       
   353                 else
       
   354                     {
       
   355                     }
       
   356                 }
       
   357             }
       
   358         wrongOption = EFalse;
       
   359         }
       
   360     // Ready to get next input option.
       
   361     DoRead();
       
   362     }
       
   363 
       
   364 
       
   365 //*******************************************************************************
       
   366 // Method      : CTestAppConsole::ProcessDomainSetupInputL()
       
   367 // Purpose     : Obtain user's option and decide which domain name is set.
       
   368 // Parameters  : 
       
   369 // Return Value: void
       
   370 //*******************************************************************************
       
   371 void CTestAppConsole::ProcessDomainSetupInputL()
       
   372     {
       
   373     TBuf<80> line;
       
   374 	GetStringFromConsole(line);
       
   375 
       
   376 	TInt input;
       
   377 	TLex lex( line );
       
   378 	
       
   379 	if ( !lex.Val( input ) )
       
   380 	    {
       
   381 		switch( input )
       
   382 			{
       
   383 			case 1:
       
   384 			    delete iDomainName;
       
   385 			    iDomainName = NULL;
       
   386                 iDomainName = KIsp1vDomain().AllocL();
       
   387                 iInputProcess = KMainInput;
       
   388                 DisplayConsoleMenuL( KTxtMainInstructions );
       
   389 			    break;
       
   390 		    case 2:
       
   391                 delete iDomainName;
       
   392                 iDomainName = NULL;
       
   393                 iDomainName = KIsp1tDomain().AllocL();
       
   394                 iInputProcess = KMainInput;
       
   395                 DisplayConsoleMenuL( KTxtMainInstructions );
       
   396 			    break;
       
   397 			case 3:
       
   398                 delete iDomainName;
       
   399                 iDomainName = NULL;
       
   400                 iDomainName = KIsp1eDomain().AllocL();
       
   401                 iInputProcess = KMainInput;
       
   402                 DisplayConsoleMenuL( KTxtMainInstructions );
       
   403 			    break;
       
   404 			case 4:
       
   405                 delete iDomainName;
       
   406                 iDomainName = NULL;
       
   407                 iDomainName = KIsp1sDomain().AllocL();
       
   408                 iInputProcess = KMainInput;
       
   409                 DisplayConsoleMenuL( KTxtMainInstructions );
       
   410 			    break;
       
   411 			default:
       
   412 				DisplayMsg( KTxtWrongOption );
       
   413 				break;
       
   414 			}
       
   415 	    }
       
   416 	// Ready to get next input option.
       
   417    	DoRead();
       
   418     }
       
   419 
       
   420     
       
   421 //*******************************************************************************
       
   422 // Method      : CTestAppConsole::ProcessMainInput()
       
   423 // Purpose     : Obtain user's option and decide which test case to run next.
       
   424 // Parameters  : 
       
   425 // Return Value: 
       
   426 //*******************************************************************************
       
   427 void CTestAppConsole::ProcessMainInput()
       
   428 	{
       
   429     TBuf<80> line;
       
   430 	GetStringFromConsole(line);
       
   431 	
       
   432 	TInt input;
       
   433 	TLex lex( line );
       
   434 
       
   435 	if ( !lex.Val( input ) )
       
   436 	    {
       
   437 		TInt err( KErrNone );
       
   438 		TBool testsRun( ETrue );
       
   439 		switch( input )
       
   440 			{
       
   441 			case 1:
       
   442                 testsRun = EFalse;
       
   443 			    DisplayConsoleMenuL( KTxtDomainSetupInstructions );
       
   444                 iInputProcess = KDomainNameInput;
       
   445 			    break;
       
   446             case 2:
       
   447                 testsRun = EFalse;
       
   448                 DisplayConsoleMenuL( KTxtMediaTestInstructions );
       
   449                 iInputProcess = KMediaTestInput;
       
   450                 break;
       
   451 			case 3:
       
   452                 err = RunNatSTUNUdpTests();
       
   453 			    break;
       
   454 		    case 4:
       
   455                 err = RunNatSTUNTcpTests();
       
   456 			    break;
       
   457 			case 5:
       
   458                 err = RunTurnUdpTests();
       
   459 			    break;
       
   460             case 6:
       
   461                 err = RunTurnTcpTests();
       
   462 			    break;
       
   463 			case 7:
       
   464 			    err = RunIceUdpTestsL();
       
   465 			    break;
       
   466 			case 8:
       
   467 			    err = RunIceTcpTestsL();
       
   468 			    break;
       
   469 			case 9:
       
   470 			    err = SetLocalToDestinationAddrL();
       
   471 			    if ( KErrNone == err )
       
   472 			        {
       
   473 			        err = RunStunUdpMediaTestL();
       
   474 			        }
       
   475 			    break;
       
   476             case 10:
       
   477 			    StopStunUdpMediaTestL();
       
   478 			    break;
       
   479             case 11:
       
   480                 RunNatSettingsTest();
       
   481                 break;
       
   482         	case 12:
       
   483 				testsRun = EFalse;
       
   484 				err = PrintLocalAddress();
       
   485 				break;
       
   486         	case 13:
       
   487         		err =  PrintStoredCandidates();
       
   488                 break; 
       
   489 			case 0:
       
   490 				testsRun = EFalse;
       
   491 				CActiveScheduler::Stop();
       
   492 				break;
       
   493 			default:
       
   494 			    testsRun = EFalse;
       
   495 				DisplayMsg( KTxtWrongOption );
       
   496 				break;
       
   497 			}
       
   498 			
       
   499 	    if ( iAudioTestStun )
       
   500             {
       
   501             iConsole->Printf( _L( "Audio test ongoing. Press 10 to stop\n" ) );
       
   502             }
       
   503         if ( iAudioTestICE )
       
   504             {
       
   505             iConsole->Printf( _L( "Com test ongoing. enter 15 to stop\n" ) );
       
   506             }
       
   507         else
       
   508             {
       
   509             if ( err )
       
   510                 {
       
   511                 iConsole->Printf( _L("Some tests failed: %d, check logs\n"), err );
       
   512                 RDebug::Print( _L("\nSome tests failed: %d, check logs\n"), err );
       
   513                 }
       
   514             else if ( testsRun )
       
   515                 {
       
   516                 iConsole->Printf( _L( "TESTS COMPLETED\n" ) );
       
   517                 RDebug::Print( _L( "\nTESTS COMPLETED\n" ) );
       
   518                 }
       
   519             else
       
   520                 {
       
   521                 
       
   522                 }
       
   523             }
       
   524 	    }
       
   525 	// Ready to get next input option.
       
   526    	DoRead();
       
   527 	}
       
   528 
       
   529 
       
   530 //*******************************************************************************
       
   531 // Method      : CTestAppConsole::IapSelectionL()
       
   532 // Purpose     : Display list of IAP:s and allow to choose one
       
   533 // Parameters  :
       
   534 // Return Value: 
       
   535 //*******************************************************************************
       
   536 void CTestAppConsole::IapSelectionL()
       
   537     {
       
   538     TInt err;
       
   539     RArray<TIap> iapArray;
       
   540     CleanupClosePushL( iapArray );
       
   541     iInputProcess = KIapInput;
       
   542     iConsole->ClearScreen();
       
   543     iConsole->Printf( KTxtIapList );
       
   544     
       
   545     err = TIap::ResolveIapL( iapArray );
       
   546     
       
   547     if (  err == KErrNone )
       
   548         {
       
   549         for( TUint i( 0 ); i < iapArray.Count(); i++ )
       
   550             {
       
   551             iConsole->Printf( KIapPrintFormat, &iapArray[i].IapName(),
       
   552                     iapArray[i].IapId() );
       
   553             }
       
   554         iConsole->Printf( KTxtTypeIap );
       
   555         }
       
   556     else if ( err == KErrNotFound )
       
   557         {
       
   558         iConsole->Printf( _L( "IAP NOT FOUND\n" ) );
       
   559         }
       
   560     else
       
   561         {
       
   562         iConsole->Printf( _L( "Error Occured\n" ) );
       
   563         }
       
   564     CleanupStack::PopAndDestroy( &iapArray );
       
   565     }
       
   566 
       
   567 
       
   568 //*******************************************************************************
       
   569 // Method      : CTestAppConsole::DisplayMsg()
       
   570 // Purpose     : Display testing message on screen
       
   571 // Parameters  : TDesC &
       
   572 // Return Value: 
       
   573 //*******************************************************************************
       
   574 void CTestAppConsole::DisplayMsg(const TDesC &aMsg)
       
   575 	{
       
   576 	iConsole->ClearScreen();
       
   577 	iConsole->Write( *iInstruct );
       
   578 	iConsole->Printf( KTxtLineBreak );
       
   579 	iConsole->Printf( aMsg );
       
   580 	iConsole->Printf( KTxtLineBreak );
       
   581 	}
       
   582 
       
   583 
       
   584 //*******************************************************************************
       
   585 // Method      : CTestAppConsole::GetStringFromConsole()
       
   586 // Purpose     : 
       
   587 // Parameters  : 
       
   588 // Return Value: 
       
   589 //*******************************************************************************
       
   590 TKeyCode CTestAppConsole::GetStringFromConsole( TDes &aAddr )
       
   591     {
       
   592 	// Get a line from console
       
   593     TKeyCode input = EKeyNull;
       
   594     const TInt start_pos = iConsole->WhereX();
       
   595     aAddr.Zero();
       
   596 
       
   597     // loop until descriptor full or EKeyEnter or EKeyEscape entered
       
   598     do {
       
   599         // get one character1
       
   600         input = iConsole->Getch();
       
   601         // process it
       
   602         if(input == EKeyBackspace || input == EKeyDelete)
       
   603             {
       
   604             // backspace or delete
       
   605             if(iConsole->WhereX() > start_pos)
       
   606                 {
       
   607 				iConsole->SetPos(iConsole->WhereX() - 1);
       
   608 				iConsole->ClearToEndOfLine();
       
   609 				if(aAddr.Length() > 0)
       
   610                     {
       
   611 					aAddr.SetLength(aAddr.Length() - 1);
       
   612                     }
       
   613                 }
       
   614             }
       
   615         else
       
   616             {
       
   617             // other than backspace or delete
       
   618             TChar ch(input);
       
   619             if(ch.IsPrint())
       
   620                 {
       
   621                 aAddr.Append(ch);
       
   622                 iConsole->Printf(_L("%c"), input);
       
   623                 }
       
   624             }
       
   625         }
       
   626     while(aAddr.Length() < aAddr.MaxLength() && input != EKeyEnter && input != EKeyEscape);
       
   627     
       
   628     DisplayMsg( KNullDesC() );
       
   629     
       
   630     return input;
       
   631     }
       
   632 
       
   633 
       
   634 //*******************************************************************************
       
   635 // Method      : CTestAppConsole::RunNatSTUNUdpTests()
       
   636 // Purpose     : Test the NAT Interface functions
       
   637 // Parameters  : 
       
   638 // Return Value: System wide error code
       
   639 //*******************************************************************************
       
   640 //
       
   641 TInt CTestAppConsole::RunNatSTUNUdpTests()
       
   642     {
       
   643     TInt err( KErrNone );
       
   644     
       
   645     iConsole->ClearScreen();
       
   646     iConsole->Printf( _L("\n*** STUN UDP TESTS ***\n") );
       
   647     RDebug::Print( _L( "\n\nSTUN UDP TESTS" ) );
       
   648     
       
   649     __UHEAP_MARK;
       
   650     
       
   651     TRAP( err, SetupSTUNUDPTestL() );
       
   652     if ( KErrNone != err )
       
   653         {
       
   654         iConsole->Printf( _L("STUN UDP TESTSETUP FAILED: %d\n"), err );
       
   655         RDebug::Print( _L("STUN UDP TESTSETUP FAILED: %d\n"), err );
       
   656         return err;
       
   657         }
       
   658     CDesC8Array* array = new ( ELeave ) CDesC8ArrayFlat( KDefaultGranularity );
       
   659     CleanupStack::PushL( array );
       
   660     array->AppendL( KStun );
       
   661     
       
   662     CStunTurnTests* turnUdpTests = CStunTurnTests::NewL( *iConsole,
       
   663         *iNat, *iNatStub, *iDomainName, iIapId, KProtocolInetUdp, *array );
       
   664         
       
   665     CleanupStack::PopAndDestroy( array );    
       
   666     CleanupStack::PushL( turnUdpTests );
       
   667     
       
   668     TRAP( err, turnUdpTests->DoRunStunTurnTestsL() );
       
   669 
       
   670     CleanupStack::PopAndDestroy( turnUdpTests );
       
   671     TeardownSTUNTestL();
       
   672     
       
   673     __UHEAP_MARKEND;
       
   674    
       
   675     return err;
       
   676     }
       
   677 
       
   678 
       
   679 //*******************************************************************************
       
   680 // Method      : CTestAppConsole::RunNatSTUNTcpTests()
       
   681 // Purpose     : Test the NAT Interface functions
       
   682 // Parameters  : 
       
   683 // Return Value: System wide error code
       
   684 //*******************************************************************************
       
   685 //
       
   686 TInt CTestAppConsole::RunNatSTUNTcpTests()
       
   687     {
       
   688     TInt err( KErrNone );
       
   689     
       
   690     iConsole->ClearScreen();
       
   691     iConsole->Printf( _L("\n*** STUN TCP TESTS ***\n") );
       
   692     RDebug::Print( _L("\n\nSTUN TCP TESTS") );
       
   693     
       
   694     __UHEAP_MARK;
       
   695     
       
   696     TRAP( err, SetupSTUNTCPTestL() );
       
   697     if ( KErrNone != err )
       
   698         {
       
   699         iConsole->Printf( _L("STUN TCP TESTSETUP FAILED: %d\n"), err );
       
   700         RDebug::Print( _L("STUN TCP TESTSETUP FAILED: %d\n"), err );
       
   701         return err;
       
   702         }
       
   703     
       
   704     CDesC8Array* array = new ( ELeave ) CDesC8ArrayFlat( KDefaultGranularity );
       
   705     CleanupStack::PushL( array );
       
   706     array->AppendL( KStun );
       
   707     
       
   708     CStunTurnTests* turnTcpTests = CStunTurnTests::NewL( *iConsole,
       
   709         *iNat, *iNatStub, *iDomainName, iIapId, KProtocolInetTcp, *array );
       
   710         
       
   711     CleanupStack::PopAndDestroy( array );
       
   712     CleanupStack::PushL( turnTcpTests );
       
   713     
       
   714     TRAP( err, turnTcpTests->DoRunStunTurnTestsL() );
       
   715 
       
   716     CleanupStack::PopAndDestroy( turnTcpTests );
       
   717     TeardownSTUNTestL();
       
   718     
       
   719     __UHEAP_MARKEND;
       
   720         
       
   721     return err;
       
   722     }
       
   723 
       
   724     
       
   725 //*******************************************************************************
       
   726 // Method      : CTestAppConsole::RunTurnUdpTests()
       
   727 // Purpose     : Test the Mcc Interface functions
       
   728 // Parameters  : 
       
   729 // Return Value: System wide error code
       
   730 //*******************************************************************************
       
   731 //
       
   732 TInt CTestAppConsole::RunTurnUdpTests()
       
   733     {
       
   734     TInt err( KErrNone );
       
   735     
       
   736     iConsole->ClearScreen();
       
   737     iConsole->Printf( _L("\n*** TURN UDP TESTS ***\n") );
       
   738     RDebug::Print( _L("\n\nTURN UDP TESTS") );
       
   739     
       
   740     __UHEAP_MARK;
       
   741     
       
   742     TRAP( err, NATTurnUdpPreambleL() );
       
   743     if ( KErrNone != err )
       
   744         {
       
   745         iConsole->Printf( _L("TESTSETUP FAILED: %d\n"), err );
       
   746         RDebug::Print( _L("TEST PRINT: TEST SETUP FAILED: %d\n"), err );
       
   747         return err;
       
   748         }
       
   749     CDesC8Array* array = new ( ELeave ) CDesC8ArrayFlat( KDefaultGranularity);
       
   750     CleanupStack::PushL( array );
       
   751     array->AppendL( KTurn );
       
   752     
       
   753     CStunTurnTests* turnUdpTests = CStunTurnTests::NewL( *iConsole,
       
   754         *iNat, *iNatStub, *iDomainName, iIapId, KProtocolInetUdp, *array );
       
   755         
       
   756     CleanupStack::PopAndDestroy( array );    
       
   757     CleanupStack::PushL( turnUdpTests );
       
   758     
       
   759     TRAP( err, turnUdpTests->DoRunStunTurnTestsL() );
       
   760 
       
   761     CleanupStack::PopAndDestroy( turnUdpTests );
       
   762     TeardownSTUNTestL();
       
   763     
       
   764     __UHEAP_MARKEND;
       
   765     
       
   766     return err;
       
   767     }
       
   768 
       
   769 
       
   770 //*******************************************************************************
       
   771 // Method      : CTestAppConsole::RunTurnTcpTests()
       
   772 // Purpose     : Test the Mcc Interface functions
       
   773 // Parameters  : 
       
   774 // Return Value: System wide error code
       
   775 //*******************************************************************************
       
   776 //
       
   777 TInt CTestAppConsole::RunTurnTcpTests()
       
   778     {
       
   779     TInt err( KErrNone );
       
   780     
       
   781     iConsole->ClearScreen();
       
   782     iConsole->Printf( _L("\n*** TURN TCP TESTS ***\n") );
       
   783     RDebug::Print( _L("\n\nTURN TCP TESTS") );
       
   784     
       
   785     __UHEAP_MARK;
       
   786     
       
   787     TRAP( err, NATTurnTcpPreambleL() );
       
   788     if ( KErrNone != err )
       
   789         {
       
   790         iConsole->Printf( _L("TESTSETUP FAILED: %d\n"), err );
       
   791         RDebug::Print( _L("TEST PRINT: TEST SETUP FAILED: %d\n"), err );
       
   792         return err;
       
   793         }
       
   794     CDesC8Array* array = new ( ELeave ) CDesC8ArrayFlat( KDefaultGranularity);
       
   795     CleanupStack::PushL( array );
       
   796     array->AppendL( KTurn );
       
   797      
       
   798     CStunTurnTests* turnTcpTests = CStunTurnTests::NewL( *iConsole,
       
   799         *iNat, *iNatStub, *iDomainName, iIapId, KProtocolInetTcp, *array );
       
   800         
       
   801     CleanupStack::PopAndDestroy( array );
       
   802     CleanupStack::PushL( turnTcpTests );
       
   803     
       
   804     TRAP( err, turnTcpTests->DoRunStunTurnTestsL() );
       
   805     CleanupStack::PopAndDestroy( turnTcpTests );
       
   806     TeardownSTUNTestL();
       
   807     
       
   808     __UHEAP_MARKEND;
       
   809     
       
   810     return err;
       
   811     }
       
   812     
       
   813     
       
   814 // ---------------------------------------------------------------------------
       
   815 // CTestAppConsole::RunStunUdpMediaTest
       
   816 // ---------------------------------------------------------------------------
       
   817 //    
       
   818 TInt CTestAppConsole::RunStunUdpMediaTestL()
       
   819     {
       
   820     iAudioTestStun = ETrue;
       
   821     TInt err( KErrNone );
       
   822     RDebug::Print( _L("CTestAppConsole::RunStunUdpMediaTestL -Start\n") );
       
   823     iConsole->ClearScreen();
       
   824     iConsole->Printf( _L("\n*** STUN UDP MEDIA TEST***\n") );
       
   825     RDebug::Print( _L("\n\nSTUN UDP MEDIA TEST") );
       
   826         
       
   827     __UHEAP_MARK;
       
   828     
       
   829     TRAP( err, SetupStunUdpMediaTestL() );
       
   830     if ( KErrNone != err )
       
   831         {
       
   832         iConsole->Printf( _L("TESTSETUP FAILED: %d\n"), err );
       
   833         RDebug::Print( _L("TEST PRINT: TEST SETUP FAILED: %d\n"), err );
       
   834         return err;
       
   835         }
       
   836     iIntTest = CStunUdpMediaTest::NewL( *iConsole,
       
   837         *iNat, *iNatMediaStub, *iDomainName, iIapId, iDestAddress, iDestPort );
       
   838     
       
   839     TRAP( err, iIntTest->TestUdpAudioStreamingL() );
       
   840     RDebug::Print( _L("CTestAppConsole::RunStunUdpMediaTestL -End\n") );
       
   841     return err;
       
   842     }
       
   843 
       
   844     
       
   845 // ---------------------------------------------------------------------------
       
   846 // CTestAppConsole::StopStunUdpMediaTestL
       
   847 // ---------------------------------------------------------------------------
       
   848 //
       
   849 void CTestAppConsole::StopStunUdpMediaTestL()
       
   850     {
       
   851     iAudioTestStun = EFalse;
       
   852     delete iIntTest;
       
   853     TeardownSTUNTestL();
       
   854     __UHEAP_MARKEND;
       
   855     RDebug::Print( _L("TestAppConsole::StopStunUdpMediaTestL\n") );
       
   856     }
       
   857     
       
   858     
       
   859 // ---------------------------------------------------------------------------
       
   860 // CTestAppConsole::RunIceUdpTestsL 
       
   861 // ---------------------------------------------------------------------------
       
   862 //
       
   863 TInt CTestAppConsole::RunIceUdpTestsL()
       
   864     {
       
   865     TInt err( KErrNone );
       
   866     
       
   867     iConsole->ClearScreen();
       
   868     iConsole->Printf( _L("\n*** ICE UPD TESTS ***\n") );
       
   869     RDebug::Print( _L("\n\nICE UPD TESTS") );
       
   870     
       
   871     __UHEAP_MARK;
       
   872     
       
   873     TRAP( err, SetupICEUDPTestL() );
       
   874     if ( KErrNone != err )
       
   875         {
       
   876         iConsole->Printf( _L("TESTSETUP FAILED: %d\n"), err );
       
   877         RDebug::Print( _L("TEST PRINT: TEST SETUP FAILED: %d\n"), err );
       
   878         return err;
       
   879         }
       
   880     CICETests* iceUdpTests = CICETests::NewL( *iConsole,
       
   881         *iNat, *iNatICEStubs, *iDomainName, iIapId, iDestAddress, iDestPort, KProtocolInetUdp );
       
   882     
       
   883     CleanupStack::PushL( iceUdpTests );
       
   884     TRAP( err, iceUdpTests->DoRunIceTestsL() );
       
   885     CleanupStack::PopAndDestroy( iceUdpTests );
       
   886     TeardownICETestL();
       
   887     
       
   888     __UHEAP_MARKEND;
       
   889     
       
   890     return err;
       
   891     }
       
   892 
       
   893 
       
   894 // ---------------------------------------------------------------------------
       
   895 // CTestAppConsole::RunIceTcpTestsL 
       
   896 // ---------------------------------------------------------------------------
       
   897 //
       
   898 TInt CTestAppConsole::RunIceTcpTestsL()
       
   899     {
       
   900     TInt err( KErrNone );
       
   901     
       
   902     iConsole->ClearScreen();
       
   903     iConsole->Printf( _L("\n*** ICE TCP TESTS ***\n") );
       
   904     RDebug::Print( _L("\n\nICE TCP TESTS") );
       
   905     
       
   906     __UHEAP_MARK;
       
   907     
       
   908     TRAP( err, SetupICETCPTestL() );
       
   909     if ( KErrNone != err )
       
   910         {
       
   911         iConsole->Printf( _L("TESTSETUP FAILED: %d\n"), err );
       
   912         RDebug::Print( _L("TEST PRINT: TEST SETUP FAILED: %d\n"), err );
       
   913         return err;
       
   914         }
       
   915     CICETests* iceTcpTests = CICETests::NewL( *iConsole,
       
   916         *iNat, *iNatICEStubs, *iDomainName, iIapId, iDestAddress, iDestPort, KProtocolInetTcp );
       
   917         
       
   918     CleanupStack::PushL( iceTcpTests );
       
   919     TRAP( err, iceTcpTests->DoRunIceTestsL() );
       
   920     CleanupStack::PopAndDestroy( iceTcpTests );
       
   921     TeardownICETestL();
       
   922     
       
   923     __UHEAP_MARKEND;
       
   924     
       
   925     return err;
       
   926     }
       
   927 
       
   928 // ---------------------------------------------------------------------------
       
   929 // CTestAppConsole::FetchLocalCandidates 
       
   930 // ---------------------------------------------------------------------------
       
   931 //   
       
   932 TInt CTestAppConsole::FetchCandidates( TUint aProtocol,
       
   933     TBool aUseRtcp )
       
   934     {
       
   935     iAudioTestICE = ETrue;
       
   936    
       
   937     iConsole->ClearScreen();
       
   938     iConsole->Printf( _L("\n*** FETCH CANDIDATES ICE ***\n") );
       
   939     
       
   940     delete iIceComTest;
       
   941     iIceComTest = NULL;
       
   942     
       
   943     iIceComTest = CNatComTest::NewL(
       
   944         *iDomainName, iIapId, *this );
       
   945 
       
   946     if ( KProtocolInetUdp == aProtocol )
       
   947         {
       
   948         #ifdef __WINSCW__
       
   949         RDebug::Print( _L("TEST PRINT: Create CICEUDPSettings") );
       
   950         iSettings = CICEUDPSettings::NewL( *iDomainName, iIapId);
       
   951         iSettings->EraseL( 0x0, 0x0 );
       
   952         iSettings->CreateSettingsL();
       
   953         #endif
       
   954         }
       
   955     else if ( KProtocolInetTcp == aProtocol )
       
   956         {
       
   957         #ifdef __WINSCW__
       
   958         RDebug::Print( _L("TEST PRINT: Create CICEUDPSettings") );
       
   959         iSettings = CICETCPSettings::NewL( *iDomainName, iIapId);
       
   960         iSettings->EraseL( 0x0, 0x0 );
       
   961         iSettings->CreateSettingsL();
       
   962         #endif
       
   963         }
       
   964     #ifndef __WINSCW__
       
   965     RDebug::Print( _L( "TEST PRINT: Create CAdditionalIceSettings" ) );
       
   966     iSettings = CAdditionalIceSettings::NewL( *iDomainName );
       
   967     iSettings->CreateSettingsL();
       
   968     #endif   
       
   969 
       
   970     return iIceComTest->StoreLocalCondidates( aProtocol, aUseRtcp );
       
   971     }
       
   972 
       
   973 // ---------------------------------------------------------------------------
       
   974 // CTestAppConsole::StartIceComTest 
       
   975 // ---------------------------------------------------------------------------
       
   976 //    
       
   977 TInt CTestAppConsole::StartIceComTest( TUint aProtocol,
       
   978         TNATFWIceRole aRole, TBool aUseRtcp )
       
   979     {
       
   980     iAudioTestICE = ETrue;
       
   981     
       
   982     iConsole->ClearScreen();
       
   983     iConsole->Printf( _L("\n*** NAT COM TEST ICE ***\n") );
       
   984     
       
   985     delete iIceComTest;
       
   986     iIceComTest = NULL;
       
   987     
       
   988     iIceComTest = CNatComTest::NewL(
       
   989             *iDomainName, iIapId, *this );
       
   990     
       
   991     if ( KProtocolInetUdp == aProtocol )
       
   992         {
       
   993         #ifdef __WINSCW__
       
   994         RDebug::Print( _L("TEST PRINT: Create CICEUDPSettings") );
       
   995         iSettings = CICEUDPSettings::NewL( *iDomainName, iIapId);
       
   996         iSettings->EraseL( 0x0, 0x0 );
       
   997         iSettings->CreateSettingsL();
       
   998         #endif
       
   999         }
       
  1000     else if ( KProtocolInetTcp == aProtocol )
       
  1001         {
       
  1002         #ifdef __WINSCW__
       
  1003         RDebug::Print( _L("TEST PRINT: Create CICEUDPSettings") );
       
  1004         iSettings = CICETCPSettings::NewL( *iDomainName, iIapId);
       
  1005         iSettings->EraseL( 0x0, 0x0 );
       
  1006         iSettings->CreateSettingsL();
       
  1007         #endif
       
  1008         }
       
  1009     #ifndef __WINSCW__
       
  1010     RDebug::Print( _L( "TEST PRINT: Create CAdditionalIceSettings" ) );
       
  1011     iSettings = CAdditionalIceSettings::NewL( *iDomainName );
       
  1012     iSettings->CreateSettingsL();
       
  1013     #endif   
       
  1014 
       
  1015     return iIceComTest->StartUsingIce( aProtocol, aRole, aUseRtcp );
       
  1016     }
       
  1017 
       
  1018 // ---------------------------------------------------------------------------
       
  1019 // CTestAppConsole::FetchCandidate 
       
  1020 // ---------------------------------------------------------------------------
       
  1021 //
       
  1022 TInt CTestAppConsole::FetchCandidate( TUint aProtocol, TComTestType aType,
       
  1023     TBool aUseRtcp )
       
  1024     {
       
  1025     iAudioTestICE = ETrue;
       
  1026    
       
  1027     iConsole->ClearScreen();
       
  1028     iConsole->Printf( _L("\n*** FETCH CANDIDATE STUN/TURN***\n") );
       
  1029     
       
  1030     delete iIceComTest;
       
  1031     iIceComTest = NULL;
       
  1032     
       
  1033     iIceComTest = CNatComTest::NewL(
       
  1034             *iDomainName, iIapId, *this );
       
  1035     if ( EStunComTest == aType )
       
  1036         {
       
  1037         RDebug::Print( _L( "TEST PRINT: Create CAdditionalStunSettings" ) );
       
  1038         iSettings = CAdditionalStunUdpSettings::NewL( *iDomainName );
       
  1039         iSettings->CreateSettingsL();
       
  1040         }
       
  1041     if ( ETurnComTest == aType )
       
  1042     {
       
  1043         RDebug::Print( _L( "TEST PRINT: Create CAdditionalTurnSettings" ) );
       
  1044         iSettings = CAdditionalTurnUdpSettings::NewL( *iDomainName );
       
  1045         iSettings->CreateSettingsL();
       
  1046     }
       
  1047     
       
  1048     return iIceComTest->StoreLocalCandidate( aProtocol, aType, aUseRtcp );
       
  1049     }
       
  1050 
       
  1051 // ---------------------------------------------------------------------------
       
  1052 // CTestAppConsole::StartComTest 
       
  1053 // ---------------------------------------------------------------------------
       
  1054 //
       
  1055 TInt CTestAppConsole::StartComTest( TUint aProtocol, TComTestType aType,
       
  1056     TBool aUseRtcp )
       
  1057     {
       
  1058     iAudioTestICE = ETrue;
       
  1059    
       
  1060     iConsole->ClearScreen();
       
  1061     iConsole->Printf( _L("\n*** NAT COM TEST STUN/TURN ***\n") );
       
  1062     
       
  1063     delete iIceComTest;
       
  1064     iIceComTest = NULL;
       
  1065     
       
  1066     iIceComTest = CNatComTest::NewL(
       
  1067             *iDomainName, iIapId, *this );
       
  1068     
       
  1069     if ( EStunComTest == aType )
       
  1070         {
       
  1071         RDebug::Print( _L( "TEST PRINT: Create CAdditionalStunSettings" ) );
       
  1072         iSettings = CAdditionalStunUdpSettings::NewL( *iDomainName );
       
  1073         iSettings->CreateSettingsL();
       
  1074         }
       
  1075     if ( ETurnComTest == aType )
       
  1076         {
       
  1077         RDebug::Print( _L( "TEST PRINT: Create CAdditionalTurnSettings" ) );
       
  1078         iSettings = CAdditionalTurnUdpSettings::NewL( *iDomainName );
       
  1079         iSettings->CreateSettingsL();
       
  1080         }
       
  1081     
       
  1082     return iIceComTest->StartComTest( aProtocol, aType, aUseRtcp );
       
  1083     }
       
  1084 
       
  1085 // ---------------------------------------------------------------------------
       
  1086 // CTestAppConsole::StopIceComTest 
       
  1087 // ---------------------------------------------------------------------------
       
  1088 //
       
  1089 void CTestAppConsole::StopIceComTest()
       
  1090     {
       
  1091     iAudioTestICE = EFalse;
       
  1092     
       
  1093     iIceComTest->StopL();
       
  1094     
       
  1095     delete iSettings;
       
  1096     iSettings = NULL;
       
  1097     }
       
  1098     
       
  1099 // ---------------------------------------------------------------------------
       
  1100 // CTestAppConsole::RunNatSettingsTest 
       
  1101 // ---------------------------------------------------------------------------
       
  1102 //
       
  1103 TInt CTestAppConsole::RunNatSettingsTest()
       
  1104     {
       
  1105     TInt err( KErrNone );
       
  1106     
       
  1107     iConsole->ClearScreen();
       
  1108     iConsole->Printf( _L( "\n*** NAT SETTINGS TEST***\n" ) );
       
  1109     RDebug::Print( _L( "\n\nNAT SETTINGS TESTS") );
       
  1110     
       
  1111     __UHEAP_MARK;
       
  1112     
       
  1113     TRAP( err, SetupSettingsTestL() );
       
  1114     if ( KErrNone != err )
       
  1115         {
       
  1116         iConsole->Printf( _L( "TESTSETUP FAILED: %d\n" ), err );
       
  1117         RDebug::Print( _L( "TEST PRINT: TEST SETUP FAILED: %d\n" ), err );
       
  1118         return err;
       
  1119         }
       
  1120     
       
  1121     iSettingsTest = CNATSettingsTest::NewL( *iDomainName, iIapId );
       
  1122     
       
  1123     TRAP( err, iSettingsTest->PrintSettingsL( *iConsole ) );
       
  1124     TeardownSettingsTestL();
       
  1125     
       
  1126     __UHEAP_MARKEND;
       
  1127     
       
  1128     return err;
       
  1129     }
       
  1130     
       
  1131     
       
  1132 // ---------------------------------------------------------------------------
       
  1133 // CTestAppConsole::SetupSTUNUDPTestL
       
  1134 // ---------------------------------------------------------------------------
       
  1135 //
       
  1136 void CTestAppConsole::SetupSTUNUDPTestL()
       
  1137     {
       
  1138     #ifdef __WINSCW__
       
  1139     RDebug::Print( _L( "TEST PRINT: Load CStunUdpSettings\n" ) );
       
  1140     iSettings = CStunUdpSettings::NewL( *iDomainName, iIapId);
       
  1141     iSettings->EraseL( 0x0, 0x0 );
       
  1142     iSettings->CreateSettingsL();
       
  1143     #endif
       
  1144     
       
  1145     #ifndef __WINSCW__
       
  1146     RDebug::Print( _L( "TEST PRINT: Load CAdditionalStunUdpSettings\n" ) );
       
  1147     iSettings = CAdditionalStunUdpSettings::NewL( *iDomainName );
       
  1148     iSettings->CreateSettingsL();
       
  1149     #endif
       
  1150 
       
  1151     iNatStub = CNATConnFWTestConsoleStubs::NewL( *iConsole );
       
  1152     
       
  1153     // NATFW creation test
       
  1154     RDebug::Print( _L( "TEST PRINT: NATFW Creation test -enter\n" ) );
       
  1155     __UHEAP_MARK;
       
  1156     iNat = CNATFWConnectivityApi::NewL();
       
  1157     iNat->RegisterObserverForEventsL( *iNatStub,
       
  1158         MNATFWConnectivityObserver::EAllEvents );
       
  1159     
       
  1160     iNat->UnregisterObserverForEvents( *iNatStub,
       
  1161         MNATFWConnectivityObserver::EAllEvents );
       
  1162     delete iNat;
       
  1163     iNat = NULL;
       
  1164     RDebug::Print( _L( "TEST PRINT: NATFW Creation test -exit\n" ) );
       
  1165     __UHEAP_MARKEND;
       
  1166     
       
  1167     iNatStub = CNATConnFWTestConsoleStubs::NewL( *iConsole );
       
  1168     iNat = CNATFWConnectivityApi::NewL();
       
  1169     iNat->RegisterObserverForEventsL( *iNatStub,
       
  1170         MNATFWConnectivityObserver::EAllEvents );
       
  1171     }
       
  1172 
       
  1173 
       
  1174 // ---------------------------------------------------------------------------
       
  1175 // CTestAppConsole::SetupSTUNTCPTestL
       
  1176 // ---------------------------------------------------------------------------
       
  1177 //
       
  1178 void CTestAppConsole::SetupSTUNTCPTestL()
       
  1179     {
       
  1180     #ifdef __WINSCW__
       
  1181     RDebug::Print( _L( "TEST PRINT: Load CStunTcpSettings\n" ) );
       
  1182     iSettings = CStunTcpSettings::NewL( *iDomainName, iIapId);
       
  1183     iSettings->EraseL( 0x0, 0x0 );
       
  1184     iSettings->CreateSettingsL();
       
  1185     #endif
       
  1186     
       
  1187     #ifndef __WINSCW__
       
  1188     RDebug::Print( _L( "TEST PRINT: Load CAdditionalStunTcpSettings\n" ) );
       
  1189     iSettings = CAdditionalStunTcpSettings::NewL( *iDomainName );
       
  1190     iSettings->CreateSettingsL();
       
  1191     #endif
       
  1192     
       
  1193     iNatStub = CNATConnFWTestConsoleStubs::NewL( *iConsole );
       
  1194     iNat = CNATFWConnectivityApi::NewL();
       
  1195     iNat->RegisterObserverForEventsL( *iNatStub,
       
  1196         MNATFWConnectivityObserver::EAllEvents );
       
  1197     }
       
  1198     
       
  1199     
       
  1200 // ---------------------------------------------------------------------------
       
  1201 // CTestAppConsole::TeardownSTUNUTestL
       
  1202 // ---------------------------------------------------------------------------
       
  1203 //
       
  1204 void CTestAppConsole::TeardownSTUNTestL()
       
  1205     {
       
  1206     delete iNat;
       
  1207     iNat = NULL;
       
  1208     delete iNatStub;
       
  1209     iNatStub = NULL;
       
  1210     
       
  1211     delete iSettings;
       
  1212     iSettings = NULL;
       
  1213     }
       
  1214     
       
  1215     
       
  1216 // ---------------------------------------------------------------------------
       
  1217 // CTestAppConsole::SetupSettingsTestL
       
  1218 // ---------------------------------------------------------------------------
       
  1219 //
       
  1220 void CTestAppConsole::SetupSettingsTestL()
       
  1221     {
       
  1222     #ifdef __WINSCW__
       
  1223     RDebug::Print( _L( "TEST PRINT: Load CGeneralSettings" ) );
       
  1224     iSettings = CGeneralSettings::NewL( *iDomainName, iIapId);
       
  1225     iSettings->EraseL( 0x0, 0x0 );
       
  1226     iSettings->CreateSettingsL();
       
  1227     #endif
       
  1228     }
       
  1229     
       
  1230 
       
  1231 // ---------------------------------------------------------------------------
       
  1232 // CTestAppConsole::TeardownSettingsTestL
       
  1233 // ---------------------------------------------------------------------------
       
  1234 //
       
  1235 void CTestAppConsole::TeardownSettingsTestL()
       
  1236     {
       
  1237     delete iSettingsTest;
       
  1238     iSettingsTest = NULL;
       
  1239 
       
  1240     delete iSettings;
       
  1241     iSettings = NULL;
       
  1242     }
       
  1243     
       
  1244         
       
  1245 // ---------------------------------------------------------------------------
       
  1246 // CTestAppConsole::SetupStunUdpMediaTestL
       
  1247 // ---------------------------------------------------------------------------
       
  1248 //
       
  1249 void CTestAppConsole::SetupStunUdpMediaTestL()
       
  1250     {
       
  1251     #ifdef __WINSCW__
       
  1252     RDebug::Print( _L( "TEST PRINT: Create CStunUdpSettings" ) );
       
  1253     iSettings = CStunUdpSettings::NewL( *iDomainName, iIapId);
       
  1254     iSettings->EraseL( 0x0, 0x0 );
       
  1255     iSettings->CreateSettingsL();
       
  1256     #endif
       
  1257     
       
  1258     #ifndef __WINSCW__
       
  1259     RDebug::Print( _L( "TEST PRINT: Create CAdditionalStunUdpSettings" ) );
       
  1260     iSettings = CAdditionalStunUdpSettings::NewL( *iDomainName );
       
  1261     iSettings->CreateSettingsL();
       
  1262     #endif
       
  1263     
       
  1264     iNatMediaStub = CMediaTestStubs::NewL( *iConsole );
       
  1265     iNat = CNATFWConnectivityApi::NewL();
       
  1266     iNat->RegisterObserverForEventsL( *iNatMediaStub,
       
  1267         MNATFWConnectivityObserver::EAllEvents );
       
  1268     }
       
  1269 
       
  1270 // ---------------------------------------------------------------------------
       
  1271 // CTestAppConsole::SetupICEUDPTestL 
       
  1272 // ---------------------------------------------------------------------------
       
  1273 //
       
  1274 void CTestAppConsole::SetupICEUDPTestL()
       
  1275     {
       
  1276     #ifdef __WINSCW__
       
  1277     RDebug::Print( _L("TEST PRINT: Create CICEUDPSettings") );
       
  1278     iSettings = CICEUDPSettings::NewL( *iDomainName, iIapId);
       
  1279     iSettings->EraseL( 0x0, 0x0 );
       
  1280     iSettings->CreateSettingsL();
       
  1281     #endif
       
  1282     
       
  1283     #ifndef __WINSCW__
       
  1284     RDebug::Print( _L( "TEST PRINT: Create CAdditionalIceSettings" ) );
       
  1285     iSettings = CAdditionalIceSettings::NewL( *iDomainName );
       
  1286     iSettings->CreateSettingsL();
       
  1287     #endif
       
  1288     
       
  1289     iNatICEStubs = CICETestStubs::NewL( *iConsole );
       
  1290     iNat = CNATFWConnectivityApi::NewL();
       
  1291     iNat->RegisterObserverForEventsL( *iNatICEStubs,
       
  1292         MNATFWConnectivityObserver::EAllEvents );
       
  1293     }
       
  1294 
       
  1295 // ---------------------------------------------------------------------------
       
  1296 // CTestAppConsole::SetupICETCPTestL 
       
  1297 // ---------------------------------------------------------------------------
       
  1298 //
       
  1299 void CTestAppConsole::SetupICETCPTestL()
       
  1300     {
       
  1301     #ifdef __WINSCW__
       
  1302     RDebug::Print( _L("TEST PRINT: Create CICETCPSettings") );
       
  1303     iSettings = CICETCPSettings::NewL( *iDomainName, iIapId);
       
  1304     iSettings->EraseL( 0x0, 0x0 );
       
  1305     iSettings->CreateSettingsL();
       
  1306     #endif
       
  1307     
       
  1308     #ifndef __WINSCW__
       
  1309     RDebug::Print( _L( "TEST PRINT: Create CAdditionalIceSettings" ) );
       
  1310     iSettings = CAdditionalIceSettings::NewL( *iDomainName );
       
  1311     iSettings->CreateSettingsL();
       
  1312     #endif
       
  1313     
       
  1314     iNatICEStubs = CICETestStubs::NewL( *iConsole );
       
  1315     iNat = CNATFWConnectivityApi::NewL();
       
  1316     iNat->RegisterObserverForEventsL( *iNatICEStubs,
       
  1317         MNATFWConnectivityObserver::EAllEvents );
       
  1318     }
       
  1319 
       
  1320   
       
  1321 // ---------------------------------------------------------------------------
       
  1322 // CTestAppConsole::TeardownICETestL
       
  1323 // ---------------------------------------------------------------------------
       
  1324 //
       
  1325 void CTestAppConsole::TeardownICETestL()
       
  1326     {
       
  1327     delete iNat;
       
  1328     iNat = NULL;
       
  1329     delete iNatICEStubs;
       
  1330     iNatICEStubs = NULL;
       
  1331     
       
  1332     delete iSettings;
       
  1333     iSettings = NULL;
       
  1334     }
       
  1335         
       
  1336 
       
  1337 // ---------------------------------------------------------------------------
       
  1338 // CTestAppConsole::NATTurnUdpPreambleL
       
  1339 // ---------------------------------------------------------------------------
       
  1340 //
       
  1341 void CTestAppConsole::NATTurnUdpPreambleL()
       
  1342     {
       
  1343     #ifdef __WINSCW__
       
  1344     RDebug::Print( _L( "TEST PRINT: Create CTurnUdpSettings" ) );
       
  1345     iSettings = CTurnUdpSettings::NewL( *iDomainName, iIapId);
       
  1346     iSettings->EraseL( 0x0, 0x0 );
       
  1347     iSettings->CreateSettingsL();    
       
  1348     
       
  1349     #else
       
  1350     RDebug::Print( _L( "TEST PRINT: Create CAdditionalTurnUdpSettings" ) );
       
  1351     iSettings = CAdditionalTurnUdpSettings::NewL( *iDomainName );
       
  1352     iSettings->CreateSettingsL();
       
  1353     #endif
       
  1354     
       
  1355     iNatStub = CNATConnFWTestConsoleStubs::NewL( *iConsole );
       
  1356     iNat = CNATFWConnectivityApi::NewL();
       
  1357     iNat->RegisterObserverForEventsL( *iNatStub,
       
  1358         MNATFWConnectivityObserver::EAllEvents );
       
  1359     }
       
  1360 
       
  1361 
       
  1362 // ---------------------------------------------------------------------------
       
  1363 // CTestAppConsole::NATTurnTcpPreambleL
       
  1364 // ---------------------------------------------------------------------------
       
  1365 //
       
  1366 void CTestAppConsole::NATTurnTcpPreambleL()
       
  1367     {
       
  1368     #ifdef __WINSCW__
       
  1369     RDebug::Print( _L( "TEST PRINT: Create CTurnTcpSettings" ) );
       
  1370     iSettings = CTurnTcpSettings::NewL( *iDomainName, iIapId);
       
  1371     iSettings->EraseL( 0x0, 0x0 );
       
  1372     iSettings->CreateSettingsL();    
       
  1373     
       
  1374     #else
       
  1375     RDebug::Print( _L( "TEST PRINT: Create CAdditionalTurnTcpSettings" ) );
       
  1376     iSettings = CAdditionalTurnTcpSettings::NewL( *iDomainName );
       
  1377     iSettings->CreateSettingsL();
       
  1378     #endif
       
  1379     
       
  1380     iNatStub = CNATConnFWTestConsoleStubs::NewL( *iConsole );
       
  1381     iNat = CNATFWConnectivityApi::NewL();
       
  1382     iNat->RegisterObserverForEventsL( *iNatStub,
       
  1383         MNATFWConnectivityObserver::EAllEvents );
       
  1384     }
       
  1385 
       
  1386 
       
  1387 // ---------------------------------------------------------------------------
       
  1388 // CTestAppConsole::PrintLocalAddress
       
  1389 // ---------------------------------------------------------------------------
       
  1390 //
       
  1391 TInt CTestAppConsole::PrintLocalAddress()
       
  1392     {
       
  1393     TInt err( KErrNone );
       
  1394     __UHEAP_MARK;
       
  1395     TRAP( err, SetupStunUdpMediaTestL() );
       
  1396     if ( KErrNone != err )
       
  1397         {
       
  1398         iConsole->Printf( _L( "TESTSETUP FAILED: %d\n" ), err );
       
  1399         RDebug::Print( _L( "TEST PRINT: TEST SETUP FAILED: %d" ), err );
       
  1400         return err;
       
  1401         }
       
  1402     iIntTest = CStunUdpMediaTest::NewL( *iConsole,
       
  1403         *iNat, *iNatMediaStub, *iDomainName, iIapId, iDestAddress, iDestPort );
       
  1404     
       
  1405     TRAP( err, iIntTest->PrintLocalAddressL() );
       
  1406     
       
  1407     delete iIntTest;
       
  1408     TeardownSTUNTestL();
       
  1409     __UHEAP_MARKEND;
       
  1410     return err;
       
  1411     }
       
  1412 
       
  1413 
       
  1414 // ---------------------------------------------------------------------------
       
  1415 // CTestAppConsole::SetLocalToDestinationAddrL
       
  1416 // ---------------------------------------------------------------------------
       
  1417 //    
       
  1418 TInt CTestAppConsole::SetLocalToDestinationAddrL()
       
  1419     {
       
  1420      TInt err( KErrNone );
       
  1421      RDebug::Print( _L("TEST PRINT: CTestAppConsole::SetLocalToDestinationAddrL -Start\n") );
       
  1422      
       
  1423     __UHEAP_MARK;
       
  1424     
       
  1425     TRAP( err, SetupStunUdpMediaTestL() );
       
  1426     if ( KErrNone != err )
       
  1427         {
       
  1428         iConsole->Printf( _L( "TESTSETUP FAILED: %d\n" ), err );
       
  1429         RDebug::Print( _L( "TEST PRINT: TEST SETUP FAILED: %d" ), err );
       
  1430         return err;
       
  1431         }
       
  1432     iIntTest = CStunUdpMediaTest::NewL( *iConsole,
       
  1433         *iNat, *iNatMediaStub, *iDomainName, iIapId, iDestAddress, iDestPort );
       
  1434     
       
  1435     TRAP( err, iIntTest->PrintLocalAddressL() );
       
  1436     if ( err )
       
  1437         {
       
  1438         return err;
       
  1439         }
       
  1440     
       
  1441     TInetAddr localAddr;
       
  1442     err = iIntTest->GetLocalAddress( localAddr );
       
  1443     if( !err )
       
  1444         {
       
  1445         iDestAddress = localAddr.Address();
       
  1446         iDestPort = localAddr.Port();
       
  1447         }
       
  1448     
       
  1449     delete iIntTest;
       
  1450     TeardownSTUNTestL();
       
  1451     
       
  1452     __UHEAP_MARKEND;
       
  1453     
       
  1454     RDebug::Print( _L("TEST PRINT: CTestAppConsole::SetLocalToDestinationAddrL -End\n") );
       
  1455     return err;
       
  1456     }
       
  1457 
       
  1458 
       
  1459 // ---------------------------------------------------------------------------
       
  1460 // CTestAppConsole::CloseMediaStreamL
       
  1461 // ---------------------------------------------------------------------------
       
  1462 // 	
       
  1463 void CTestAppConsole::CloseMediaStreamL()
       
  1464     {
       
  1465     iAudioTestStun = EFalse;
       
  1466     delete iIntTest;
       
  1467     TeardownSTUNTestL();
       
  1468     __UHEAP_MARKEND;
       
  1469     }
       
  1470 
       
  1471 
       
  1472 // ---------------------------------------------------------------------------
       
  1473 // CICETests::NewCandidatePairFound
       
  1474 // From MNatComTestObserver
       
  1475 // ---------------------------------------------------------------------------
       
  1476 //
       
  1477 void CTestAppConsole::Notify( TNatComTestEvent aEvent, TInt aError )
       
  1478     {
       
  1479     TBuf16<25> notifyDesc;
       
  1480     
       
  1481     switch( aEvent )
       
  1482         {
       
  1483         case ESessionCreated:
       
  1484             iConsole->Printf( _L("SessionCreated err: %d\n"), aError );
       
  1485             notifyDesc.Copy( _L16( "ESessionCreated" ) ); 
       
  1486             break;
       
  1487         case EStreamCreated:
       
  1488             iConsole->Printf( _L("StreamCreated err: %d\n"), aError );
       
  1489             notifyDesc.Copy( _L16( "EStreamCreated" ) );
       
  1490             break;
       
  1491         case ESetIdentification:
       
  1492             iConsole->Printf( _L("SetIdentification err: %d\n"), aError );
       
  1493             notifyDesc.Copy( _L16( "ESetIdentification" ) );
       
  1494             break;
       
  1495         case ELocalCandidateFound:
       
  1496             iConsole->Printf( _L("LocalCandidateFound err: %d\n"), aError );
       
  1497             notifyDesc.Copy( _L16( "ELocalCandidateFound" ) );
       
  1498             break;
       
  1499         case ESetOperationMode:
       
  1500             iConsole->Printf( _L("SetOperationMode err: %d\n"), aError );
       
  1501             notifyDesc.Copy( _L16( "ESetOperationMode" ) );
       
  1502             break;
       
  1503         case ENewCandPairFound:
       
  1504             iConsole->Printf( _L("NewCandPairFound err: %d\n"), aError );
       
  1505             notifyDesc.Copy( _L16( "ENewCandPairFound" ) );
       
  1506             break;
       
  1507         case EConnChecksCompleted:
       
  1508             iConsole->Printf( _L("EConnChecksCompleted err: %d\n"), aError );
       
  1509             notifyDesc.Copy( _L16( "EConnChecksCompleted" ) );
       
  1510             break;
       
  1511         case ERunning:
       
  1512             iConsole->Printf( _L("ERunning err: %d\n"), aError );
       
  1513             notifyDesc.Copy( _L16( "ERunning" ) );
       
  1514             break;
       
  1515         case ETestError:
       
  1516             iConsole->Printf( _L("Error err: %d\n"), aError );
       
  1517             notifyDesc.Copy( _L16( "EError" ) );
       
  1518             break;
       
  1519         case ETestEnd:
       
  1520             iConsole->Printf( _L("TestEnd err: %d\n"), aError );
       
  1521             notifyDesc.Copy( _L16( "ETestEnd" ) );
       
  1522             StopIceComTest();
       
  1523             break;
       
  1524         default:
       
  1525             break;     
       
  1526         }
       
  1527         RDebug::Print( _L( "CTestAppConsole::Notify: Event: %S Error: %d\n" ),
       
  1528             &notifyDesc, aError );
       
  1529     }
       
  1530 
       
  1531 
       
  1532 // ---------------------------------------------------------------------------
       
  1533 // CICETests::LocalCandidates
       
  1534 // From MNatComTestObserver
       
  1535 // ---------------------------------------------------------------------------
       
  1536 //    
       
  1537 TInt CTestAppConsole::LocalCandidates(
       
  1538     const RPointerArray<CNATFWCandidate>& aLocalCandidates )
       
  1539     {
       
  1540     //write to memorycard
       
  1541     RDebug::Print(
       
  1542         _L( "CTestAppConsole::LocalCandidates - write %d local candidates" ),
       
  1543         aLocalCandidates.Count() );
       
  1544         
       
  1545     CNATCandidateStore* store = CNATCandidateStore::NewLC();
       
  1546      
       
  1547     TRAPD( err, store->WriteL( aLocalCandidates ) );
       
  1548     CleanupStack::PopAndDestroy( store );
       
  1549     return err;
       
  1550     }
       
  1551 
       
  1552 
       
  1553 // ---------------------------------------------------------------------------
       
  1554 // CICETests::RemoteCandidates
       
  1555 // From MNatComTestObserver
       
  1556 // ---------------------------------------------------------------------------
       
  1557 //    
       
  1558 TInt CTestAppConsole::RemoteCandidates(
       
  1559     RPointerArray<CNATFWCandidate>& aRemoteCandidates )
       
  1560     {
       
  1561     //Read from memorycard
       
  1562     RDebug::Print(
       
  1563         _L( "CTestAppConsole::RemoteCandidates -read remote candidates" ) );
       
  1564         
       
  1565     CNATCandidateStore* store = CNATCandidateStore::NewLC();
       
  1566 
       
  1567     TRAPD( err, store->ReadL( aRemoteCandidates ) );
       
  1568     CleanupStack::PopAndDestroy( store );
       
  1569     
       
  1570     RDebug::Print(
       
  1571         _L( "CTestAppConsole::RemoteCandidates: %d remote candidates readed\n" ),
       
  1572         aRemoteCandidates.Count() );
       
  1573         
       
  1574     return err;
       
  1575     }
       
  1576 
       
  1577 
       
  1578 // ---------------------------------------------------------------------------
       
  1579 // CICETests::DoPause
       
  1580 // From MNatComTestObserver
       
  1581 // ---------------------------------------------------------------------------
       
  1582 // 
       
  1583 void CTestAppConsole::DoPause( TRequestStatus& aStatus )
       
  1584     { 
       
  1585     RDebug::Print( _L( "CTestAppConsole::DoPause" ) );
       
  1586     
       
  1587     aStatus = KRequestPending;    
       
  1588 
       
  1589     iConsole->Printf( _L( "Press any key to continue...\n" ) );
       
  1590     
       
  1591     iListenerStatus = &aStatus;
       
  1592     iPause = ETrue;
       
  1593     }
       
  1594     
       
  1595 
       
  1596 
       
  1597 // ---------------------------------------------------------------------------
       
  1598 // CTestAppConsole::PrintStoredCandidates
       
  1599 // ---------------------------------------------------------------------------
       
  1600 //  
       
  1601 TInt CTestAppConsole::PrintStoredCandidates()
       
  1602     {
       
  1603     RDebug::Print(
       
  1604             _L( "CTestAppConsole::PrintStoredCandidates" ) );
       
  1605     //Read from memorycard
       
  1606     iConsole->ClearScreen();
       
  1607     iConsole->Printf( _L( "\n*** STORED CANDIDATES ***\n" ) );
       
  1608 
       
  1609     RPointerArray<CNATFWCandidate> candidates;
       
  1610     
       
  1611     CNATCandidateStore* store = CNATCandidateStore::NewLC();
       
  1612     TRAPD( err, store->ReadL( candidates ) );
       
  1613     CleanupStack::PopAndDestroy( store );
       
  1614     
       
  1615     TInt count =  candidates.Count();
       
  1616     RDebug::Print(
       
  1617         _L( "CTestAppConsole::RemoteCandidates: %d remote candidates readed\n" ),
       
  1618         count );
       
  1619     iConsole->Printf(_L( "\n%d remote candidates readed\n" ), count );
       
  1620     for ( TInt i( 0 ); i < count ;i++  )
       
  1621         {
       
  1622         TBuf<40> buffer;
       
  1623         TInetAddr inetAddr;
       
  1624         
       
  1625         RDebug::Print( _L( "Candidate %d\n" ), i + 1 );
       
  1626         iConsole->Printf( _L( "\nCandidate %d\n" ), i + 1 );
       
  1627         // Base address
       
  1628         inetAddr = candidates[i]->Base();
       
  1629         inetAddr.Output( buffer );
       
  1630         iConsole->Printf( _L( "Base = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1631         RDebug::Print( _L( "Base = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1632         // Transport address
       
  1633         inetAddr = candidates[i]->TransportAddr();
       
  1634         inetAddr.Output( buffer );
       
  1635         iConsole->Printf( _L( "Transport addr = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1636         RDebug::Print( _L( "Transport addr = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1637         }
       
  1638     candidates.ResetAndDestroy();
       
  1639     return err;
       
  1640     }
       
  1641 
       
  1642 
       
  1643 // ---------------------------------------------------------------------------
       
  1644 // CICETests::CandidatePairs
       
  1645 // From MNatComTestObserver
       
  1646 // ---------------------------------------------------------------------------
       
  1647 //      
       
  1648 TInt CTestAppConsole::CandidatePairs(
       
  1649     const RPointerArray<CNATFWCandidatePair>& aCandidatePairs )
       
  1650     {
       
  1651     RDebug::Print( _L( "CTestAppConsole::CandidatePairs" ) );
       
  1652     TInt count = aCandidatePairs.Count();
       
  1653     
       
  1654     for ( TInt i = 0; i < count; i++ )
       
  1655         {
       
  1656         TBuf<40> buffer;
       
  1657         TInetAddr inetAddr;
       
  1658         iConsole->Printf( _L( "\nCandidate pair %d\n" ), i + 1 );
       
  1659         RDebug::Print( _L( "\nCandidate pair %d\n" ), i + 1 );
       
  1660         // Local candidate
       
  1661         iConsole->Printf( _L( "Local candidate:\n" ) );
       
  1662         RDebug::Print( _L( "Local candidate:\n" ) );
       
  1663         inetAddr = aCandidatePairs[i]->LocalCandidate().Base();
       
  1664         inetAddr.Output( buffer );
       
  1665         iConsole->Printf( _L( "Base = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1666         RDebug::Print( _L( "Base = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1667         inetAddr = aCandidatePairs[i]->LocalCandidate().TransportAddr();
       
  1668         inetAddr.Output( buffer );
       
  1669         iConsole->Printf( _L( "Transport addr = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1670         RDebug::Print( _L( "Transport addr = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1671         // Remote candidate
       
  1672         iConsole->Printf( _L( "Remote candidate:\n" ) );
       
  1673         RDebug::Print( _L( "Remote candidate:\n" ) );
       
  1674         inetAddr = aCandidatePairs[i]->RemoteCandidate().Base();
       
  1675         inetAddr.Output( buffer );
       
  1676         iConsole->Printf( _L( "Base = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1677         RDebug::Print( _L( "Base = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1678         inetAddr = aCandidatePairs[i]->RemoteCandidate().TransportAddr();
       
  1679         inetAddr.Output( buffer );
       
  1680         iConsole->Printf( _L( "Transport addr = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1681         RDebug::Print( _L( "Transport addr = %S:%d\n" ), &buffer, inetAddr.Port() );
       
  1682         }
       
  1683     return KErrNone;
       
  1684     }