TBool CRtpHandlerBase::CompareAddresses(const TSockAddr& aAddr1,const TSockAddr& aAddr2)
{
	if(aAddr1.Family() != aAddr2.Family())
		{
		return EFalse;
		}
		
	TInetAddr inetAddr1(aAddr1);
	TInetAddr inetAddr2(aAddr2);
	//Tests the protocol family, IP address, and port values
	TBool flag = inetAddr1.CmpAddr(inetAddr2);
	return flag;
}
Esempio n. 2
0
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;
	}
}
CRtpHandlerBase* CRtpHandlerBase::NewBearerL(CRtpControllerBase* aController,
											 RSocket& aSocket, TInt aPriority)
	{	
	__RTP_LOG(_L("CRtpHandlerBase::NewBearerL() ... "));
	__ASSERT_DEBUG(aController, Panic(ERtpControllerIsNotCreated));
	CRtpHandlerBase* handler = NULL;
	TSockAddr localAddr;
	aSocket.LocalName(localAddr);
	switch (localAddr.Family())
		{
		// BT can be made configurable,  see rtpbthandler.h for more details...
		case KBTAddrFamily:
			{
			handler = CRtpBluetoothHandler::NewL(aSocket, aPriority);
			handler->iRtpController = (CRtpControllerBase *)aController;
			break;
			}
		case KAfInet:
		default:
			{
			handler = CRtpUdpHandler::NewL(aSocket, aPriority);		
			handler->iRtpController = (CRtpControllerBase *)aController;
			break;
			}
		
		}
	handler->SetLocalAddress(localAddr);
	return handler;
	}
Esempio n. 4
0
EXPORT_C TEui64Addr::TEui64Addr(const TSockAddr& aAddr) : TSockAddr()
{
	__ASSERT_ALWAYS(aAddr.Family() == KAfEui64 || aAddr.Family() == 0, EuiPanic(EEuiPanicFamilyMismatch));
	Init();
	SetAddress(TEui64Addr::Cast(aAddr).Address());
}