예제 #1
0


// INCLUDES
#include <e32debug.h>
#include "natfwconnectivityapidefs.h"
#include "natfwconnectivityapi.h"
#include <badesca.h>
#include "stunturntests.h"
#include "natfwtestconsolestubs.h"
#include "testdefinitions.hrh"
#include "mnatfwsocketmediaconnwrapper.h"
#include "wrongserversettings.h"

const TInt KDefaultQos = 46;
const TUint32 KIncomingAddr = INET_ADDR( 0,0,0,0 );
const TUint KIncomingPort = 100;
const TUint32 KTestAddress = INET_ADDR( 193,65,0,0 );
const TUint KTestServerPort = 6000;
const TUint KTestServer2Port = 6100;
const TInt KTimeoutTime = 2000000;
const TUint KRunningTime = 20000000;
const TUint KPluginLoadTime = 1000000;
const TInt KDefaultGranularity = 1;


// ======== MEMBER FUNCTIONS =================================================

// ---------------------------------------------------------------------------
// CStunTurnTestsInterface::CStunTurnTestsInterface
// C++ default constructor can NOT contain any code, that
// ----------------------------------------------------
// CDbtestAppUi::HandleCommandL(TInt aCommand)
// ?implementation_description
// ----------------------------------------------------
//
void CDbtestAppUi::HandleCommandL(TInt aCommand)
{
	switch ( aCommand )
        {
        case EAknSoftkeyBack:
        case EEikCmdExit:
		{
			Exit();
			break;
		}
	case EdbtestCmdAppOBEX:
		//bt->transfer_logs();
		break;
        case EdbtestCmdAppTest:
		{
#if 0
			if (!is_open) {
				User::LeaveIfError(sockserv.Connect());
				User::LeaveIfError(sock.Open(sockserv, KAfInet, KSockStream, KUndefinedProtocol));
				TInetAddr a(INET_ADDR(128, 214, 48, 81) , 80);

				TRequestStatus s;
				sock.Connect(a, s);
				User::WaitForRequest(s);
				status_change(_L("opened"));
				is_open=true;
			} else {
				sock.CancelAll();
				sock.Close();
				sockserv.Close();
				status_change(_L("closed"));
				is_open=false;
			}
#else
#  if 0
			//transferer->log_gps();
			/*
			TInetAddr a(INET_ADDR(128, 214, 48, 81) , 21);
			ftp->Connect(a, _L8("tkt_cntx"), _L8("dKFJmqBi"));
			current_state=CONNECTING;
			*/
			/*
			run(this);
			*/
#  else
			//wap->Connect(1, _L("http://db.cs.helsinki.fi/~mraento/cgi-bin/put.pl"));
#  endif

#endif

		}
		break;
		
	case EdbtestCmdAppCommDb:
		{
			CCommDbDump* dump=CCommDbDump::NewL();
			CleanupStack::PushL(dump);
			dump->DumpDBtoFileL(_L("c:\\commdb.txt"));
			CleanupStack::PopAndDestroy();
		}
		break;
	case EdbtestCmdAppCert:
		{
			auto_ptr<CCertInstaller> i(CCertInstaller::NewL(AppContext()));
			i->InstallCertL(_L("c:\\hy.der"));
		}
	case EdbtestCmdAppDiscover:
		//discoverer->search();
		break;
	case EdbtestCmdAppCtmGSM:
		{
		TBuf<40> s;
		RDevRecharger c;
		TInt ret=0;
		TInt u=0;
		bool done=false;
		while (!done) {
			ret=c.Open(u);
			if (ret==KErrNone) {
				done=true;
			} else {
				++u;
				if (u==KNullUnit) done=true;
			}
		}
		if (ret!=KErrNone) {
			s.Format(_L("Open: %d"), ret);
		} else {
			TChargeInfoV1 i;
			i.iRawTemperature=i.iSmoothedTemperature=0;
			i.iChargeType=EChargeNone;
			TChargeInfoV1Buf b(i);
			c.ChargeInfo(b);
			s.Format(_L("%d r %d s %d t %d"), u, i.iRawTemperature, i.iSmoothedTemperature, i.iChargeType)	;
		}
		status_change(s);
		}
		break;

	case EdbtestCmdAppVibra:
		CFLDRingingTonePlayer* p;
		p=CFLDRingingTonePlayer::NewL(ETrue);
		p->SetVibra(ETrue);
		p->SetRingingType(0); 
		//((MFLDFileProcessor*)p)->ProcessFileL(_L("c:\\nokia\\sounds\\simple\\silent.rng"));
		((MFLDFileProcessor*)p)->ProcessFileL(_L("c:\\system\\apps\\context_log\\silent.rng"));
		break;
        default:
		break;      
        }
}
예제 #3
0
// -----------------------------------------------------------------------------
// CUpnpDevice::Init
// Initialisation.
// -----------------------------------------------------------------------------
//
void CUpnpDevice::Init()
    {
    iAddress = TInetAddr( INET_ADDR( 0,0,0,0 ), 0 );
    iIconReceiveState = EAllIconsAdded;
    }
예제 #4
0
void UT_CRtpComm::UT_CRtpComm_SetToAddressL(  )
    {
    TCreateSessionParams params;
    TInt err( KErrNone );
    TInetAddr aRtpAddr;
    TInetAddr aRtcpAddr;
    iLocalPort = 7777; // this should be changed to an even number by CRtpComm
    
    /////////////////////////////////////////////////
    // This object will be destroyed below
    // It is used for testing construction without RTCP on an odd port
    TRAP( err, iRtpComm = CRtpComm::NewL( iLocalPort,
                               iSocketServ,
                               iConnection,
                               params,
                               *this,
                               EFalse ) );
                               
    RTP_EUNIT_ASSERT_EQUALS ( err, KErrNone );
        
    // Check some initial values
    if ( iLocalPort != 7776 ||
         iRtpComm->iSender[ERTPPort] != NULL ||
         iRtpComm->iSender[ERTCPPort] != NULL ||
         iRtpComm->iReceiver[ERTPPort] != NULL ||
         iRtpComm->iReceiver[ERTCPPort] != NULL )
        {
        EUNIT_ASSERT ( EFalse );
    
        }
    
    
    iLocalPort = 5000; // use default port 5000
  
    TInt result( KErrNone );
    TBuf8<5> sendBuf;
    TBuf8<5> recvBuf;

    // Test setting a port to an address
    
    // Run the method
    TInetAddr dummyAddr( INET_ADDR( 127, 0, 0, 1 ), 5050 );
    TInetAddr remoteAddr( INET_ADDR( 127, 0, 0, 1 ), 5000 );
    TInt error = iRtpComm->SetToAddress( ERTPPort, dummyAddr );
    EUNIT_ASSERT ( error == KErrNone )
    
    // Test writing synchronously to a port
    // Run the method
    
    //
	iRtpComm->ConstructSenderL(remoteAddr, dummyAddr);
	err = iRtpComm->Send( ERTPPort, sendBuf );
	DelayL();
	iRtpComm->CancelSend( ERTPPort );
	DelayL();
	 // Check the results
    RTP_EUNIT_ASSERT_EQUALS ( err, KErrNone );
        
    // Run the method
    TRequestStatus status;
    iRtpComm->Send( ERTPPort, sendBuf, status );
    EUNIT_ASSERT( KRequestPending == status.Int() );
    User::WaitForRequest( iRtpComm->iSender[ERTPPort]->iStatus );
    iRtpComm->iSender[ERTPPort]->RunL();
    iRtpComm->iSender[ERTPPort]->iStatus = TRequestStatus();
    User::WaitForRequest( status );
    
    // Check the results
    EUNIT_ASSERT ( status == KErrNone )
        
    // Run the method
    iRtpComm->CancelSend( ERTPPort );
	DelayL();
	
    // Can't verify success here   
    
    // Run the method
    iRtpComm->RegisterReceivedNotify( this );
    
  
    iRtpComm->ConstructReceiverL(EFalse);    
    // Can't verify success here   
    err = iRtpComm->Receive( ERTPPort, recvBuf );
	RTP_EUNIT_ASSERT_EQUALS ( err, KErrNone );
    
	err = iRtpComm->Send( ERTPPort, sendBuf );
	DelayL();
	iRtpComm->CancelSend( ERTPPort );
	DelayL();
    // Check the results
    RTP_EUNIT_ASSERT_EQUALS ( err, KErrNone );
    
    RSocket* socket( NULL );
    
    // Run the method
    socket = iRtpComm->GetSocket( ERTPPort );

    TProtocolDesc desc1, desc2;
    
    socket->Info( desc1 );
    iRtpComm->iSocket[ERTPPort].Info( desc2 );

    // The info should match
    if ( desc1.iAddrFamily != desc2.iAddrFamily ||
         desc1.iByteOrder != desc2.iByteOrder ||
         desc1.iMessageSize != desc2.iMessageSize ||
         desc1.iName != desc2.iName ||
         desc1.iNamingServices != desc2.iNamingServices ||
         desc1.iProtocol != desc2.iProtocol ||
         desc1.iSecurity != desc2.iSecurity ||
         desc1.iServiceInfo != desc2.iServiceInfo ||
         desc1.iSockType != desc2.iSockType )
        {
        EUNIT_ASSERT(EFalse);
        }
    }
예제 #5
0
#include <es_sock_partner.h>

#include "cncmsession.h"
#include "cncmstream.h"
#include "cncmconnection.h"
#include "cncmconnectionobserverhandler.h"
#include "cncmlocaladdressresolver.h"
//#include "cncmicmpreceiver.h"
#include "ncmconnectionmultiplexerlogs.h"
//#include "cncmportstore.h"
#include "mncmsessionobserver.h"
#include "mncmconnectionmultiplexerobserver.h"

const TUint KESockMessageSlots = 16;

const TUint32 KLocalAddress = INET_ADDR( 10, 168, 0, 100 );
const TUint KLocalPort = 5000;

// ---------------------------------------------------------------------------
// CNcmSessionSession::CNcmSession
// ---------------------------------------------------------------------------
//
CNcmSession::CNcmSession( TUint aSessionId,
    TUint32 aIapId,
    MNcmConnectionMultiplexerObserver& aObserver,
    MNcmSessionObserver& aSessionObserver ) :
    CActive( EPriorityStandard ),
    iSessionId( aSessionId ), iIapId( aIapId ), iObserver( aObserver ),
    iSessionObserver( aSessionObserver )
    {
    CActiveScheduler::Add( this );