示例#1
0
TBool DviProtocolUpnpAdapterSpecificData::IsLocationReachable(const Endpoint& aEndpoint)
{
    /* This method has the same purpose as CpiDeviceListUpnp::IsLocationReachable.
        The reachability check is needed to ensure that all M-SEARCH responses contain
        a location Uri that can be accessed by the M-SEARCH sender. */
    return (aEndpoint.Address() & iMask) == (iSubnet & iMask);
}
示例#2
0
void OpenHome::Os::NetworkConnect(THandle aHandle, const Endpoint& aEndpoint, TUint aTimeoutMs)
{
    int32_t err = OsNetworkConnect(aHandle, aEndpoint.Address(), aEndpoint.Port(), aTimeoutMs);
    if (err != 0) {
        LOG2F(kNetwork, kError, "Os::NetworkConnect H = %d, RETURN VALUE = %d\n", aHandle, err);
        THROW(NetworkError);
    }
}
示例#3
0
void OpenHome::Os::NetworkConnect(THandle aHandle, const Endpoint& aEndpoint, TUint aTimeoutMs)
{
    int32_t err = OsNetworkConnect(aHandle, aEndpoint.Address(), aEndpoint.Port(), aTimeoutMs);
    if (err != 0) {
        LOG2F(kNetwork, kError, "Os::NetworkConnect H = %d, RETURN VALUE = %d\n", aHandle, err);
        if (err == -1)  // Timeout
            THROW(NetworkTimeout);
        if (err == -2)  // Connection refused
            THROW(NetworkError);
        ASSERTS(); // invalid error
    }
}
示例#4
0
void MdnsPlatform::Listen()
{
    LOG(kBonjour, "Bonjour             Listen\n");

    mDNSAddr dst;
    mDNSIPPort dstport;
    SetAddress(dst, iMulticast);
    SetPort(dstport, iMulticast);

    mDNSAddr src;
    mDNSIPPort srcport;
    while (!iStop) {
        try {
            LOG(kBonjour, "Bonjour             Listen - Wait For Message\n");
            iReaderController.Read(iMessage);
            LOG(kBonjour, "Bonjour             Listen - Message Received\n");

            TByte* ptr = (TByte*)iMessage.Ptr();
            TUint bytes = iMessage.Bytes();
            Endpoint sender = iReaderController.Sender();
            SetAddress(src, sender);
            SetPort(srcport, sender);
            iInterfacesLock.Wait();
            TIpAddress senderAddr = sender.Address();
            mDNSInterfaceID interfaceId = (mDNSInterfaceID)0;
            for (TUint i=0; i<(TUint)iInterfaces.size(); i++) {
                if (iInterfaces[i]->ContainsAddress(senderAddr)) {
#ifndef DEFINE_WINDOWS_UNIVERSAL
                    interfaceId = (mDNSInterfaceID)iInterfaces[i]->Address();
#endif // DEFINE_WINDOWS_UNIVERSAL
                    break;
                }
            }
            iInterfacesLock.Signal();
            if (interfaceId != (mDNSInterfaceID)0) {
                mDNSCoreReceive(iMdns, ptr, ptr + bytes, &src, srcport, &dst, dstport, interfaceId);
            }
            iReaderController.ReadFlush();
        }
        catch (ReaderError) {
            if (!iStop) {
                LOG(kBonjour, "Bonjour             Listen - Reader Error\n");
            }
        }
    }
}
示例#5
0
void OhmSenderDriverWindows::SetEndpoint(const Endpoint& aEndpoint)
{
	KSPROPERTY prop;
				
	prop.Set = SNEAKY_GUID;
    prop.Id = KSPROPERTY_SNEAKY_ENDPOINT;
    prop.Flags = KSPROPERTY_TYPE_SET;

	TByte buffer[8];

	ULONG* ptr = (ULONG*)buffer;
	
	*ptr++ = Arch::BigEndian4(aEndpoint.Address());
	*ptr++ = aEndpoint.Port();

    DWORD bytes;

    DeviceIoControl(iHandle, IOCTL_KS_PROPERTY, &prop, sizeof(KSPROPERTY), &buffer, sizeof(buffer), &bytes, 0);
}
示例#6
0
TInt Os::NetworkBind(THandle aHandle, const Endpoint& aEndpoint)
{
	TInt ret = OsNetworkBind(aHandle, aEndpoint.Address(), aEndpoint.Port());
	return ret;
}
示例#7
0
TInt Os::NetworkBindMulticast(THandle aHandle, TIpAddress aAdapter, const Endpoint& aMulticast)
{
    TInt ret = OsNetworkBindMulticast(aHandle, aAdapter, aMulticast.Address(), aMulticast.Port());
    return ret;
}
示例#8
0
void DvInvocationStd::GetClientEndpoint(TIpAddress& aClientAddress, uint32_t& aClientPort) const
{
    Endpoint ep = iInvocation.ClientEndpoint();
    aClientAddress = ep.Address();
    aClientPort = ep.Port();
}