void UT_CIceConnectionHandler::UT_CNATFWConnectionHandler_IncomingMessageLL( ) { TInetAddr localAddr( KLocalAddr ); TInetAddr fromAddr( KRemoteAddr ); TInetAddr peerAddr( KRemoteAddr ); _LIT8( KDummyContent, "dummycontent" ); TBool consumed( EFalse ); // no connection EUNIT_ASSERT_LEAVE( iConnectionHandler->IncomingMessageL( iStreamId, KDummyContent, localAddr, fromAddr, peerAddr, consumed ) ); TUint stunConnection = iConnectionHandler->CreateConnectionL( *iPairs[0] ); // unknown sream EUNIT_ASSERT_NO_LEAVE( iConnectionHandler->IncomingMessageL( iStreamId + 1, KDummyContent, localAddr, fromAddr, peerAddr, consumed ) ); EUNIT_ASSERT( !consumed ); // known stream TUint stunConnection2 = iConnectionHandler->CreateConnectionL( *iPairs[0] ); EUNIT_ASSERT_NO_LEAVE( iConnectionHandler->IncomingMessageL( iStreamId, KDummyContent, localAddr, fromAddr, peerAddr, consumed ) ); iConnectionHandler->RemoveConnection( iStreamId, stunConnection ); iConnectionHandler->RemoveConnection( iStreamId, stunConnection2 ); }
MojErr MojSockAddr::fromPath(const MojChar* path) { MojAssert(path); MojSockAddrUnT addr; MojZero(&addr, sizeof(addr)); if (MojStrLen(path) > (sizeof(addr.sun_path) - 1)) MojErrThrow(MojErrPathTooLong); MojStrCpy(addr.sun_path, path); addr.sun_family = MOJ_PF_LOCAL; fromAddr((MojSockAddrT*) &addr, sizeof(addr)); return MojErrNone; }
int UDPSocket::reply(const string& msg){ string destIp; return sendTo(msg, fromAddr(), ntohs(m_from.sin_port)); }