コード例 #1
0
enum TVerdict CTestIdna08::doTestStepL()
	{

	INFO_PRINTF1(_L(" Testing the Loading of the new Library "));
	INFO_PRINTF1(_L("****************************************"));
	
	SetTestStepResult(EFail); // By default start the test case with failure.	
	
	RLibrary testLibrary;
	TInt err = testLibrary.Load(_L("punycodeconverter.dll"));
	
	if(err == KErrNone)
		{
		INFO_PRINTF1(_L(" Loading the punycodeconverter library is successful"));
		SetTestStepResult(EPass);
		}
	else 
		{	
		INFO_PRINTF1(_L(" Loading the punycodeconverter library is NOT successful"));
		User::LeaveIfError(KErrNone);  // just to suppress the LeaveScan warning
		}
	
	INFO_PRINTF1(_L("Negative Testing of SetOpt		 "));
	INFO_PRINTF1(_L("****************************************"));		

	RSocketServ pSocketServ;
	User::LeaveIfError(pSocketServ.Connect());
	RConnection myConnection;
	myConnection.Open(pSocketServ, KAfInet);

	TRequestStatus myStatus=KErrNone;
	myConnection.Start(myStatus);
	User::WaitForRequest(myStatus);

	RHostResolver hr;
	hr.Open(pSocketServ,KAfInet,KProtocolInetUdp);
	
	TBool enableIdn = ETrue;//enabling the option of IDN support
	TPckgC<TBool> pckgEnable(enableIdn);
	TInt setOptErr = hr.SetOpt(KSoInetConfigInterface , KSolInetDns , pckgEnable);
	if(setOptErr != KErrNone)
		{
		INFO_PRINTF1(_L(" Negative Testing of the Setopt successful "));
		SetTestStepResult(EPass);
		}
	
	setOptErr = hr.SetOpt(KSoDnsEnableIdn , KSolInetDns , pckgEnable);
	User::LeaveIfError(setOptErr);

	enableIdn = EFalse;
	TPckgC<TBool> pckgDisable(enableIdn);
	setOptErr = hr.SetOpt(KSoDnsEnableIdn , KSolInetDns , pckgDisable);
	User::LeaveIfError(setOptErr);
	
	hr.Close();
	myConnection.Close();
	pSocketServ.Close();
	return TestStepResult();

	}
コード例 #2
0
int ILibSocketWrapper_socket(int socketType)
{
	int RetVal;

  // create a new connection for the socket
  RConnection* pConnection = new RConnection;

  // open a connection
  pConnection->Open(socketServer);

  TCommDbConnPref prefs;
  // set the preference for the requested interface
  prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
  pConnection->Start(prefs);	

	if ( (socketType == SOCK_DGRAM) ||
       (socketType == SOCK_STREAM) )
	{
    RSocket *pSocket = new RSocket();

    if ( socketType == SOCK_DGRAM )
    {
      pSocket->Open(socketServer,
                    KAfInet,
                    KSockDatagram,
                    KProtocolInetUdp,
                    *pConnection);
    }
    else
    {
      pSocket->Open(socketServer,
                    KAfInet,
                    KSockStream,
                    KProtocolInetTcp,
                    *pConnection);
    }

    RetVal = ILibSocketWrapper_GetNextAvailableHandle();

    if( RetVal >= 0 )
    {
      SocketArray[RetVal] = (int)pSocket;
      ConnectionArray[RetVal] = pConnection;
    }
    else
    {
      pSocket->Close();
      delete pSocket;
      pConnection->Close();
      delete pConnection;
      RetVal = -1;
    }
  }

  return RetVal;
}
コード例 #3
0
/*
 * Close a Connection from the array of type RConnection CArrayFixSeg<RConnection *>
 */
void CMultipleArray::CloseConnection(TInt aIndex)
	{
/* Close the Connection
 * Remove entry from list
 */
	RConnection* conn = iConnectionList->At(aIndex - 1);
	conn->Close();
	iConnectionList->Delete(aIndex - 1);
	delete conn;
	}
コード例 #4
0
enum TVerdict CTestIdna04::doTestStepL()
	{

	INFO_PRINTF1(_L(" Testing GetByAddress(for an IDN) 	with IDN Enabled     "));
	INFO_PRINTF1(_L("*********************************************************"));
	
	SetTestStepResult(EFail); // By default start the test case with failure.	
	
	RSocketServ pSocketServ;
	User::LeaveIfError(pSocketServ.Connect());
	RConnection myConnection;
	myConnection.Open(pSocketServ, KAfInet);

	TRequestStatus myStatus=KErrNone;
	myConnection.Start(myStatus);
	User::WaitForRequest(myStatus);
	
	RHostResolver hr;
	hr.Open(pSocketServ,KAfInet,KProtocolInetUdp);

	TBool enableIdn = ETrue;//enabling the option of IDN support
	TPckgC<TBool> pckgEnable(enableIdn);
	TInt setOptErr = hr.SetOpt(KSoDnsEnableIdn , KSolInetDns , pckgEnable);
	User::LeaveIfError(setOptErr);
	
	TInetAddr inetAddr;
	//inetAddr.Input(_L("83.241.177.38")); // this is the IPAddress of the domain räksmörgås.josefsson.org
										 // as of 06 Feb 2009. If this IP changes, this test case might fail
										 // but no harm on this.
		
	//TNameEntry resultEntry;
	
	inetAddr.Input(_L("64.233.169.103")); 
	
	TNameRecord asdf;
	TPckgBuf<TNameRecord> resultEntry(asdf);
	
	hr.GetByAddress(inetAddr,resultEntry,myStatus);
	User::WaitForRequest(myStatus);
	TInt err = myStatus.Int();
					
	if(err == KErrNone)
		{
		INFO_PRINTF2(_L(" GetByAddress 	with IDN disabled returned %d"),err);
		SetTestStepResult(EPass);
		}
	
	hr.Close();
	myConnection.Close();
	pSocketServ.Close();

	return TestStepResult();

	}
コード例 #5
0
enum TVerdict CTestIdna02::doTestStepL()
	{

	INFO_PRINTF1(_L(" Testing GetByName(IDN) 	with IDN Enabled     "));
	INFO_PRINTF1(_L("****************************************************"));
	
	SetTestStepResult(EFail); // By default start the test case with failure.	
	
	RSocketServ pSocketServ;
	User::LeaveIfError(pSocketServ.Connect());
	RConnection myConnection;
	myConnection.Open(pSocketServ, KAfInet);

	TRequestStatus myStatus=KErrNone;
	myConnection.Start(myStatus);
	User::WaitForRequest(myStatus);

	_LIT(KTestName1,"räksmörgås.josefsson.org");
		
	TName myHostName = KTestName1();
	TNameEntry myResolvedName;
	RHostResolver hr;
	hr.Open(pSocketServ,KAfInet,KProtocolInetUdp);
	
	TBool enableIdn = ETrue;//enabling the option of IDN support
	TPckgC<TBool> pckgEnable(enableIdn);
	TInt setOptErr = hr.SetOpt(KSoDnsEnableIdn , KSolInetDns , pckgEnable);
	User::LeaveIfError(setOptErr);
	
	hr.GetByName(myHostName,myResolvedName,myStatus);
		
	User::WaitForRequest(myStatus);
	TInt err = myStatus.Int();
	
	if(err == KErrNone)
		{
		INFO_PRINTF2(_L(" GetByName(%S) with IDN Enabled   returned KErrNone "),&myHostName);
		SetTestStepResult(EPass);
		}
	
	hr.Close();
	myConnection.Close();
	pSocketServ.Close();

	return TestStepResult();

	}
コード例 #6
0
void CTe_rtpSuite::ConfigureReflectorModeL(TBool aMode, TInetAddr& aAddr)
	{
    /* Configures the reflector to change the SSRC or not
     */	
	RSocketServ sockServer;
	//Open a connection
	RConnection conn;
	User::LeaveIfError(sockServer.Connect());
	CleanupClosePushL(sockServer);
	
	User::LeaveIfError(conn.Open(sockServer));
	CleanupClosePushL(conn);
	
	//Start the connection
	User::LeaveIfError(conn.Start());
	
	RSocket ctrlSock;
	User::LeaveIfError(ctrlSock.Open(sockServer,KAfInet, KSockDatagram, KProtocolInetUdp, conn));
	CleanupClosePushL(ctrlSock);
	
    TBuf8<64> lCmdBuff;
    TUint8* lPtr = const_cast<TUint8*>(lCmdBuff.Ptr());
    TUint32* lIntData = (TUint32*)lPtr;
    *lIntData = ByteOrder::Swap32(0xFF00BABE);
    if (aMode)
    	{
    	*(lIntData + 1) = ByteOrder::Swap32(0xCD000100);
    	}
    else
    	{
    	*(lIntData + 1) = ByteOrder::Swap32(0xCD000101);
    	}
    lCmdBuff.SetLength(64);
    
    TRequestStatus lMyReqStat;
    ctrlSock.SendTo(lCmdBuff,aAddr,0,lMyReqStat);
    User::WaitForRequest(lMyReqStat);
    
    ctrlSock.Close();
    conn.Close();
    sockServer.Close();
    
    CleanupStack::Pop(3);
	}
コード例 #7
0
enum TVerdict CTestIdna05::doTestStepL()
	{
	INFO_PRINTF1(_L(" Testing GetByName(IDN in UTF-16) 	without IDN Enabled     "));
	INFO_PRINTF1(_L("***********************************************************"));

	SetTestStepResult(EFail); // By default start the test case with failure.
	
	RSocketServ pSocketServ;
	User::LeaveIfError(pSocketServ.Connect());
	RConnection myConnection;
	myConnection.Open(pSocketServ, KAfInet);

	TRequestStatus myStatus=KErrNone;
	myConnection.Start(myStatus);
	User::WaitForRequest(myStatus);

	RHostResolver hr;
	hr.Open(pSocketServ,KAfInet,KProtocolInetUdp);

	THostName utf16HostName;
	TInt surrogateInt = 55301 ; //0xD805
	utf16HostName.Copy((const unsigned short*)&surrogateInt);
	surrogateInt = 57173; // 0xDF55
	utf16HostName.Append((const unsigned short*)&surrogateInt, sizeof(TInt));
		
	TNameEntry myResolvedName;
	hr.GetByName(utf16HostName,myResolvedName,myStatus);
	User::WaitForRequest(myStatus);
	TInt err = myStatus.Int();

	if(err == KErrDndBadName)
		{
		INFO_PRINTF1(_L(" GetByName (IDN in UTF16) 	without IDN enabled returned KErrDndBadName"));
		SetTestStepResult(EPass);
		}

	hr.Close();
	myConnection.Close();
	pSocketServ.Close();

	return TestStepResult();

	}
コード例 #8
0
enum TVerdict CTestIdna03::doTestStepL()
	{

	INFO_PRINTF1(_L(" Testing GetByAddress(for an IDN) 	without IDN Enabled     "));
	INFO_PRINTF1(_L("*********************************************************"));
	
	SetTestStepResult(EFail); // By default start the test case with failure.	
	
	RSocketServ pSocketServ;
	User::LeaveIfError(pSocketServ.Connect());
	RConnection myConnection;
	myConnection.Open(pSocketServ, KAfInet);

	TRequestStatus myStatus=KErrNone;
	myConnection.Start(myStatus);
	User::WaitForRequest(myStatus);
	
	RHostResolver hr;
	hr.Open(pSocketServ,KAfInet,KProtocolInetUdp);
	
	TInetAddr inetAddr;
	inetAddr.Input(_L("83.241.177.38")); // this is the IPAddress of the domain räksmörgås.josefsson.org
										 // as of 06 Feb 2009. If this IP changes, this test case might fail
										 // but no harm on this.
		
	TNameEntry resultEntry;
	hr.GetByAddress(inetAddr,resultEntry,myStatus);
	User::WaitForRequest(myStatus);
	TInt err = myStatus.Int();
					
	if(err == KErrNone)
		{
		INFO_PRINTF2(_L(" GetByAddress 	with IDN disabled returned %d"),err);
		SetTestStepResult(EPass);
		}
	
	hr.Close();
	myConnection.Close();
	pSocketServ.Close();

	return TestStepResult();

	}
コード例 #9
0
enum TVerdict CTestIdna01::doTestStepL()
	{

	INFO_PRINTF1(_L(" Testing GetByName(IDN) 	without IDN Enabled     "));
	INFO_PRINTF1(_L("****************************************************"));
	
	SetTestStepResult(EFail); // By default start the test case with failure.	
	
	RSocketServ pSocketServ;
	User::LeaveIfError(pSocketServ.Connect());
	RConnection myConnection;
	myConnection.Open(pSocketServ, KAfInet);

	TRequestStatus myStatus=KErrNone;
	myConnection.Start(myStatus);
	User::WaitForRequest(myStatus);

	_LIT(KTestName1,"räksmörgås.josefsson.org");
		
	TName myHostName = KTestName1();
	TNameEntry myResolvedName;
	RHostResolver hr;
	hr.Open(pSocketServ,KAfInet,KProtocolInetUdp);

	hr.GetByName(myHostName,myResolvedName,myStatus);
		
	User::WaitForRequest(myStatus);
	TInt err = myStatus.Int();
	
	if(err == KErrDndNameNotFound)
		{
		INFO_PRINTF2(_L(" GetByName(%S) 	without IDN Enabled   returned KErrDndNameNotFound "),&myHostName);
		SetTestStepResult(EPass);
		}
	
	hr.Close();
	myConnection.Close();
	pSocketServ.Close();

	return TestStepResult();

	}
コード例 #10
0
// ---------------------------------------------------------
// RHssInterface::StopConnectionL
// ---------------------------------------------------------
//
TInt RHssInterface::StopConnectionL( const TUint aIapId, const TUint aNetworkId )
    {
    DEBUG( "RHssInterface::StopConnectionL()" );

    TInt ret( KErrNone );
    RSocketServ socketServ;
    RConnection conn;

    User::LeaveIfError( socketServ.Connect() );
    CleanupClosePushL( socketServ );
    
    // Open connection
    User::LeaveIfError( conn.Open(socketServ) );
    CleanupClosePushL( conn );

    TConnectionInfo info;
    info.iIapId = aIapId;
    info.iNetId = aNetworkId;

    TInt err = conn.Attach(
            TPckg< TConnectionInfo >( info ),
            RConnection::EAttachTypeNormal );
    DEBUG1( "RHssInterface::conn.Attach: %d", err );

    if ( err == KErrNone )
        {
        ret = conn.Stop( RConnection::EStopAuthoritative );
        DEBUG1( "RHssInterface::connection.Stop: %d", ret );
        }

    /* Note: In previous version, tried to PopAndDestroy conn (RConnection)
     * from cleanup stack...
     * => Somehow this broke Sniffer connection opening, no idea why.
     */
    CleanupStack::Pop( &conn );
    conn.Close();
    CleanupStack::PopAndDestroy( &socketServ );
    
    return ret;
    }
コード例 #11
0
int ILibSocketWrapper_close(int socketObject)
{
  // lookup the socket handle and close and delete if exists
	RSocket *s = (RSocket*)SocketArray[socketObject];
  if ( s != NULL )
  {
    s->Close();
    delete s;
    SocketArray[socketObject] = 0;
  }

  // lookup the connection handle and close and delete if exists
  RConnection *c = ConnectionArray[socketObject];
  if ( c != NULL )
  {
    c->Close();
    delete c;
    ConnectionArray[socketObject] = NULL;
  }

	return(0);
}
コード例 #12
0
// ---------------------------------------------------------------------------
// CRoHandlerDMgrWrapper::PostResponseUrlL
// ---------------------------------------------------------------------------
//
void CRoHandlerDMgrWrapper::PostResponseUrlL( const TDesC8& aPostResponseUrl )
    {
    UpdateBufferL< HBufC8, TDesC8 >( iTriggerUrl, aPostResponseUrl );

    if ( !iIapId )
        {
        // Take AP from open conenction
        RSocketServ socketServer;

        TInt err( KErrNone );

        err = socketServer.Connect();

        RConnection myConnection;

        err = myConnection.Open( socketServer );

        TUint connectionCount( 0 );

        err = myConnection.EnumerateConnections( connectionCount );

        if ( err != KErrNone || connectionCount < 1 )
            {
            return;
            }

        TPckgBuf<TConnectionInfoV2> connectionInfo;

        err = myConnection.GetConnectionInfo( connectionCount,
                connectionInfo );

        iIapId = connectionInfo().iIapId;

        myConnection.Close();
        socketServer.Close();
        }
    }