Search in sources :

Example 1 with NativeInetAddress

use of io.netty.channel.unix.NativeInetAddress in project netty by netty.

the class Native method setTcpMd5Sig.

public static void setTcpMd5Sig(int fd, InetAddress address, byte[] key) throws IOException {
    final NativeInetAddress a = NativeInetAddress.newInstance(address);
    setTcpMd5Sig0(fd, a.address(), a.scopeId(), key);
}
Also used : NativeInetAddress(io.netty.channel.unix.NativeInetAddress)

Example 2 with NativeInetAddress

use of io.netty.channel.unix.NativeInetAddress in project netty by netty.

the class LinuxSocket method setNetworkInterface.

void setNetworkInterface(NetworkInterface netInterface) throws IOException {
    InetAddress address = deriveInetAddress(netInterface, family() == InternetProtocolFamily.IPv6);
    if (address.equals(family() == InternetProtocolFamily.IPv4 ? INET_ANY : INET6_ANY)) {
        throw new IOException("NetworkInterface does not support " + family());
    }
    final NativeInetAddress nativeAddress = NativeInetAddress.newInstance(address);
    setInterface(intValue(), ipv6, nativeAddress.address(), nativeAddress.scopeId(), interfaceIndex(netInterface));
}
Also used : NativeInetAddress(io.netty.channel.unix.NativeInetAddress) IOException(java.io.IOException) NativeInetAddress(io.netty.channel.unix.NativeInetAddress) InetAddress(java.net.InetAddress)

Example 3 with NativeInetAddress

use of io.netty.channel.unix.NativeInetAddress in project netty by netty.

the class LinuxSocket method setTcpMd5Sig.

void setTcpMd5Sig(InetAddress address, byte[] key) throws IOException {
    final NativeInetAddress a = NativeInetAddress.newInstance(address);
    setTcpMd5Sig(intValue(), ipv6, a.address(), a.scopeId(), key);
}
Also used : NativeInetAddress(io.netty.channel.unix.NativeInetAddress)

Example 4 with NativeInetAddress

use of io.netty.channel.unix.NativeInetAddress in project netty by netty.

the class LinuxSocket method joinGroup.

void joinGroup(InetAddress group, NetworkInterface netInterface, InetAddress source) throws IOException {
    final NativeInetAddress g = NativeInetAddress.newInstance(group);
    final boolean isIpv6 = group instanceof Inet6Address;
    final NativeInetAddress i = NativeInetAddress.newInstance(deriveInetAddress(netInterface, isIpv6));
    if (source != null) {
        if (source.getClass() != group.getClass()) {
            throw new IllegalArgumentException("Source address is different type to group");
        }
        final NativeInetAddress s = NativeInetAddress.newInstance(source);
        joinSsmGroup(intValue(), ipv6 && isIpv6, g.address(), i.address(), g.scopeId(), interfaceIndex(netInterface), s.address());
    } else {
        joinGroup(intValue(), ipv6 && isIpv6, g.address(), i.address(), g.scopeId(), interfaceIndex(netInterface));
    }
}
Also used : NativeInetAddress(io.netty.channel.unix.NativeInetAddress) Inet6Address(java.net.Inet6Address)

Example 5 with NativeInetAddress

use of io.netty.channel.unix.NativeInetAddress in project netty by netty.

the class LinuxSocket method setInterface.

void setInterface(InetAddress address) throws IOException {
    final NativeInetAddress a = NativeInetAddress.newInstance(address);
    setInterface(intValue(), ipv6, a.address(), a.scopeId(), interfaceIndex(address));
}
Also used : NativeInetAddress(io.netty.channel.unix.NativeInetAddress)

Aggregations

NativeInetAddress (io.netty.channel.unix.NativeInetAddress)6 Inet6Address (java.net.Inet6Address)2 IOException (java.io.IOException)1 InetAddress (java.net.InetAddress)1