Class SubnetMatchInterfaceCriteria

    • Constructor Detail

      • SubnetMatchInterfaceCriteria

        public SubnetMatchInterfaceCriteria​(byte[] network,
                                            int mask)
        Creates a new SubnetMatchInterfaceCriteria
        Parameters:
        network - an InetAddress in byte[] form. Cannot be null
        mask - the number of bits in network that represent the network
        Throws:
        IllegalArgumentException - if network is null
    • Method Detail

      • isAcceptable

        protected InetAddress isAcceptable​(NetworkInterface networkInterface,
                                           InetAddress address)
                                    throws SocketException
        Gets whether the given network interface and address are acceptable for use. Acceptance is indicated by returning the address which should be used for binding against the network interface; typically this is the given address parameter. For those criteria which override the configured address, the override address should be returned.
        Specified by:
        isAcceptable in class AbstractInterfaceCriteria
        Parameters:
        networkInterface - the network interface. Cannot be null
        address - an address that is associated with networkInterface. Cannot be null
        Returns:
        address if the address is on the correct subnet.
        Throws:
        SocketException - if evaluating the state of networkInterface results in one
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object