예제 #1
0
TInt CIpcProvdBase::SetLocalName(TSockAddr &anAddr)
//
// Set the local name prior to accepting
//
	{
	TInt ret=iProtocol->CheckAndAllocatePortNumber(anAddr.Port());
	if (ret==KErrNone)
		iLocalAddr=anAddr.Port();
	return ret;
	}
예제 #2
0
파일: netImpl.cpp 프로젝트: Felard/MoSync
static void storeSockAddr(const TSockAddr& sockaddr, MAConnAddr* addr) {
	LOGS("storeSockAddr %i\n", sockaddr.Family());
	if(sockaddr.Family() == KBTAddrFamily) {
		addr->family = CONN_FAMILY_BT;
		addr->bt.port = sockaddr.Port();
		TBTSockAddr& bt((TBTSockAddr&)sockaddr);
		storeBtAddr(bt.BTAddr(), addr);
	} else if(sockaddr.Family() == KAfInet) {
		addr->family = CONN_FAMILY_INET4;
		addr->inet4.port = sockaddr.Port();
		TInetAddr& inet((TInetAddr&)sockaddr);
		addr->inet4.addr = inet.Address();
	} else {
		DEBIG_PHAT_ERROR;
	}
}
예제 #3
0
TInt  CIpcProvdBase::SetRemName(TSockAddr& anAddr)
//
// Set the remote name prior to connecting (or as part of a send to)
//
	{
	iRemoteAddr=anAddr.Port();
	return KErrNone;
	}
예제 #4
0
//
// Copy constructor - takes a previously filled TSockAddr and 
// parses it for result fields.  Useful for client code only.
//
EXPORT_C TIrdaSockAddr::TIrdaSockAddr(const TSockAddr &aAddr)
/** Copy constructor. Assumes that the source address is an IrDA socket address.

@param aAddr A socket address assumed to be valid IrDA socket address. */
	{
	SetFamily(KIrdaAddrFamily);
	SetPort(aAddr.Port());
	SetRemoteDevAddr(TIrdaSockAddr::Cast(aAddr).GetRemoteDevAddr());
	SetHostDevAddr(TIrdaSockAddr::Cast(aAddr).GetHostDevAddr());
	SetSniffStatus(TIrdaSockAddr::Cast(aAddr).GetSniffStatus());
	SetSolicitedStatus(TIrdaSockAddr::Cast(aAddr).GetSolicitedStatus());
	SetIrlapVersion(TIrdaSockAddr::Cast(aAddr).GetIrlapVersion());
	SetCharacterSet(TIrdaSockAddr::Cast(aAddr).GetCharacterSet());
	SetFirstServiceHintByte(TIrdaSockAddr::Cast(aAddr).GetFirstServiceHintByte());
	SetSecondServiceHintByte(TIrdaSockAddr::Cast(aAddr).GetSecondServiceHintByte());
    SetServiceHintByteCount(TIrdaSockAddr::Cast(aAddr).GetServiceHintByteCount());
	SetHomePort(TIrdaSockAddr::Cast(aAddr).GetHomePort());
	SetRemotePort(TIrdaSockAddr::Cast(aAddr).GetRemotePort());
	
	SetUserLen(sizeof(SIrdaAddr));
	}
void ut_cnatfwsockethandler::ut_cnatfwsockethandler_SetAddrL2L(  )
{
    TSockAddr addr;
    RSocket socket;

    User::LeaveIfError( socket.Open( iSocketServer, KAfInet, KSockDatagram, KProtocolInetUdp ) );
    socket.SetLocalPort( KTestPortUdp );

    // RSocket is stubbed and currently the used ports are not stored
    // so we can make the next localportcall fail with this
    TBool shouldItFail = ETrue;
    socket.NextSetLocalPortShouldFail(ETrue, shouldItFail); // fails

    iHandler->SetMediaObserverL( this );
    iHandler->SetLocalAddress( iSocketServer, iAddr );
    // Will try to use same port as KTestPortUdp, but
    // since it's reserved, should switch to KTestPort2
    NATFW_EUNIT_ASSERT_NO_LEAVE( iHandler->SetAddrL( iAddr ) );

    iHandler->LocalAddress( addr );
    EUNIT_ASSERT_EQUALS( KTestPort2, addr.Port() );
}