org.cybergarage.net

## Class HostInterface

- java.lang.Object
- - org.cybergarage.net.HostInterface

-     public class HostInterface
      extends Object

  Utility class for network host interface management and configuration.

  This class provides static methods for discovering and managing network interfaces and IP addresses on the local system. It supports both IPv4 and IPv6 addresses, with configurable options for address selection and interface binding.

  Key features:

  - Network interface enumeration and discovery
  - IPv4 and IPv6 address management
  - Loopback address inclusion/exclusion
  - Interface-specific binding support
  - Host name and address resolution

  This class is essential for UPnP devices that need to bind to specific network interfaces or discover available network addresses for device advertisement and communication.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `IPV4_BITMASK`
    `static int` | `IPV6_BITMASK`
    `static int` | `LOCAL_BITMASK`
    `static boolean` | `USE_LOOPBACK_ADDR`
    `static boolean` | `USE_ONLY_IPV4_ADDR`
    `static boolean` | `USE_ONLY_IPV6_ADDR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HostInterface()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getHostAddress(int n)`
    `static String` | `getHostURL(String host, int port, String uri)`
    `static InetAddress[]` | `getInetAddress(int ipfilter, String[] interfaces)`
    `static String` | `getInterface()`
    `static String` | `getIPv4Address()`
    `static String` | `getIPv6Address()`
    `static int` | `getNHostAddresses()`
    `static boolean` | `hasIPv4Addresses()`
    `static boolean` | `hasIPv6Addresses()`
    `static boolean` | `isIPv4Address(String host)`
    `static boolean` | `isIPv6Address(String host)`
    `static void` | `setInterface(String ifaddr)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### IPV4_BITMASK

          public static final int IPV4_BITMASK

      See Also:
        Constant Field Values

    - #### IPV6_BITMASK

          public static final int IPV6_BITMASK

      See Also:
        Constant Field Values

    - #### LOCAL_BITMASK

          public static final int LOCAL_BITMASK

      See Also:
        Constant Field Values

    - #### USE_LOOPBACK_ADDR

          public static boolean USE_LOOPBACK_ADDR

    - #### USE_ONLY_IPV4_ADDR

          public static boolean USE_ONLY_IPV4_ADDR

    - #### USE_ONLY_IPV6_ADDR

          public static boolean USE_ONLY_IPV6_ADDR

  - ### Constructor Detail

    - #### HostInterface

          public HostInterface()

  - ### Method Detail

    - #### getHostAddress

          public static final String getHostAddress(int n)

    - #### getHostURL

          public static final String getHostURL(String host,
                                                int port,
                                                String uri)

    - #### getInetAddress

          public static final InetAddress[] getInetAddress(int ipfilter,
                                                           String[] interfaces)

      Parameters:
        `ipfilter` -
        `interfaces` -
      Returns:
        InetAddress[]

    - #### getInterface

          public static final String getInterface()

    - #### getIPv4Address

          public static final String getIPv4Address()

    - #### getIPv6Address

          public static final String getIPv6Address()

    - #### getNHostAddresses

          public static final int getNHostAddresses()

    - #### hasIPv4Addresses

          public static final boolean hasIPv4Addresses()

    - #### hasIPv6Addresses

          public static final boolean hasIPv6Addresses()

    - #### isIPv4Address

          public static final boolean isIPv4Address(String host)

    - #### isIPv6Address

          public static final boolean isIPv6Address(String host)

    - #### setInterface

          public static final void setInterface(String ifaddr)