// -----------------------------------------------------------------------------
// CUpnpHttpServer::ConnectionAcceptedL
//
// -----------------------------------------------------------------------------
//
CUpnpTcpSession* CUpnpHttpServer::ConnectionAcceptedL( RSocket aSocket )
    {
    LOG_FUNC_NAME;

    #ifdef _DEBUG
    TInetAddr tempAddr;
    aSocket.RemoteName( tempAddr );
    tempAddr.ConvertToV4();

    const TInt KMaxAdressLength = 20;
    TBuf<KMaxAdressLength> addrBuf;
    tempAddr.Output( addrBuf );

    HBufC8* addrBuf8 = UpnpString::FromUnicodeL( addrBuf );
    CleanupStack::PushL( addrBuf8 );

    LOGS( "CUpnpHttpServer::ConnectionAcceptedL - Remote socket connected" );
    LOGT( addrBuf8->Des() );

    LOGS1("CUpnpHttpServer::ConnectionAcceptedL - Creating a new Http session. Session count: %i", iSessionList.Count());

    CleanupStack::PopAndDestroy(addrBuf8);
    #endif //_DEBUG
    CUpnpHttpSession* sess = CUpnpHttpSession::NewL( aSocket, this,
        CUpnpHttpMessage::NewSessionIdL(), EPriorityNormal );

    return sess;
    }
enum TVerdict CEsockTest19_6::easyTestStepL()
	{
	TInetAddr addr;
	TBuf<39> buf;
	
	// convert to V4
	
	// set address to IPv6 unspecified address
	addr.Input(_L("::"));
	
	// convert to IPv4 format
	addr.ConvertToV4();
	addr.OutputWithScope(buf);
	
	// check address has been reformatted correctly
	addr.OutputWithScope(buf);
	TESTL(buf==_L("0.0.0.0"));
	
	// change address to IPv4 compatible address
	addr.Input(_L("::199.12.255.21"));
	
	// convert to IPv4 format
	addr.ConvertToV4();
	
	// check address has been reformatted correctly
	addr.OutputWithScope(buf);
	TESTL(buf==_L("199.12.255.21"));
	
	// change address to IPv4 mapped address
	addr.Input(_L("::FFFF:149.124.223.12"));
	
	// convert to IPv4 format
	addr.ConvertToV4();
	
	// check address has been reformatted correctly
	addr.OutputWithScope(buf);
	TESTL(buf==_L("149.124.223.12"));
	
	return EPass;
	}
// -----------------------------------------------------------------------------
// CLocalAddrResolver::CheckAndSetAddr
// -----------------------------------------------------------------------------
//
void CLocalAddrResolver::CheckAndSetAddr( TInetAddr& aTarget,
                                          TInetAddr& aCandidate,
                                          TUint32 aCandidateIap,
				                          TUint32 aSpecifiedIap )
    {
    if ( !aCandidate.IsUnspecified() && !aCandidate.IsLoopback() )
        {
        if ( aCandidate.IsV4Mapped())
            {
            aCandidate.ConvertToV4();
            }
        if ( aCandidateIap == aSpecifiedIap )
            {
            SetAddr( aTarget, aCandidate );
            }
        }
    }