org.cybergarage.upnp

## Class UPnP

- java.lang.Object
- - org.cybergarage.upnp.UPnP

-     public class UPnP
      extends Object

  Global utility class for UPnP framework configuration and operations.

  This class provides static methods and constants for configuring the UPnP framework, including network settings, XML parser configuration, and utility functions for UUID generation, server identification, and framework initialization.

  The class serves as the main entry point for framework-wide configuration and provides constants used throughout the UPnP implementation.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CONFIGID_UPNP_ORG_MAX` Maximum value for UPnP.org configuration IDs.
    `static int` | `DEFAULT_EXPIRED_DEVICE_EXTRA_TIME` Default extra time in seconds before considering a device expired.
    `static int` | `DEFAULT_TTL` Default time-to-live value for multicast packets.
    `static String` | `INMPR03` INMPR03 protocol identifier.
    `static int` | `INMPR03_DISCOVERY_OVER_WIRELESS_COUNT` Number of discovery attempts over wireless interfaces for INMPR03.
    `static String` | `INMPR03_VERSION` INMPR03 protocol version.
    `static String` | `NAME` Framework name used in server identification.
    `static int` | `SERVER_RETRY_COUNT` Number of retry attempts for server operations.
    `static int` | `USE_IPV6_ADMINISTRATIVE_SCOPE` Enable IPv6 administrative scope addresses.
    `static int` | `USE_IPV6_GLOBAL_SCOPE` Enable IPv6 global scope addresses.
    `static int` | `USE_IPV6_LINK_LOCAL_SCOPE` Enable IPv6 link-local scope addresses.
    `static int` | `USE_IPV6_SITE_LOCAL_SCOPE` Enable IPv6 site-local scope addresses.
    `static int` | `USE_IPV6_SUBNET_SCOPE` Enable IPv6 subnet scope addresses.
    `static int` | `USE_LOOPBACK_ADDR` Enable loopback address usage.
    `static int` | `USE_ONLY_IPV4_ADDR` Enable IPv4-only addressing mode.
    `static int` | `USE_ONLY_IPV6_ADDR` Enable IPv6-only addressing mode.
    `static int` | `USE_SSDP_SEARCHRESPONSE_MULTIPLE_INTERFACES` Enable SSDP search responses on multiple interfaces.
    `static String` | `VERSION` Framework version used in server identification.
    `static String` | `XML_CLASS_PROPERTTY` Name of the system properties used to identifies the default XML Parser. The value of the properties MUST BE the fully qualified class name of XML Parser which CyberLink should use.
    `static String` | `XML_DECLARATION` Standard XML declaration for UPnP documents.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UPnP()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `caluculateConfigId(String configXml)` Calculates a configuration ID from the given XML configuration.
    `static int` | `createBootId()` Creates a boot ID for UPnP device identification.
    `static String` | `createUUID()` Creates a unique UUID for UPnP device identification.
    `static String` | `getServerName()` Generates the server identification string for UPnP operations.
    `static int` | `getTimeToLive()` Gets the current time-to-live value for multicast packets.
    `static Parser` | `getXMLParser()` Gets the XML parser used by the UPnP framework.
    `static void` | `initialize()` Initializes the UPnP framework.
    `static boolean` | `isEnabled(int value)` Checks if a specific UPnP framework feature or configuration option is enabled.
    `static void` | `setDisable(int value)` Disables a specific UPnP framework feature or configuration option.
    `static void` | `setEnable(int value)` Enables a specific UPnP framework feature or configuration option.
    `static void` | `setTimeToLive(int value)` Sets the time-to-live value for multicast packets.
    `static void` | `setXMLParser(Parser parser)` Sets the XML parser to be used by the UPnP framework.

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

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

- - ### Field Detail

    - #### CONFIGID_UPNP_ORG_MAX

          public static final int CONFIGID_UPNP_ORG_MAX

      Maximum value for UPnP.org configuration IDs.
      See Also:
        Constant Field Values

    - #### DEFAULT_EXPIRED_DEVICE_EXTRA_TIME

          public static final int DEFAULT_EXPIRED_DEVICE_EXTRA_TIME

      Default extra time in seconds before considering a device expired.
      See Also:
        Constant Field Values

    - #### DEFAULT_TTL

          public static final int DEFAULT_TTL

      Default time-to-live value for multicast packets.
      See Also:
        Constant Field Values

    - #### INMPR03

          public static final String INMPR03

      INMPR03 protocol identifier.
      See Also:
        Constant Field Values

    - #### INMPR03_DISCOVERY_OVER_WIRELESS_COUNT

          public static final int INMPR03_DISCOVERY_OVER_WIRELESS_COUNT

      Number of discovery attempts over wireless interfaces for INMPR03.
      See Also:
        Constant Field Values

    - #### INMPR03_VERSION

          public static final String INMPR03_VERSION

      INMPR03 protocol version.
      See Also:
        Constant Field Values

    - #### NAME

          public static final String NAME

      Framework name used in server identification.
      See Also:
        Constant Field Values

    - #### SERVER_RETRY_COUNT

          public static final int SERVER_RETRY_COUNT

      Number of retry attempts for server operations.
      See Also:
        Constant Field Values

    - #### USE_IPV6_ADMINISTRATIVE_SCOPE

          public static final int USE_IPV6_ADMINISTRATIVE_SCOPE

      Enable IPv6 administrative scope addresses.
      See Also:
        Constant Field Values

    - #### USE_IPV6_GLOBAL_SCOPE

          public static final int USE_IPV6_GLOBAL_SCOPE

      Enable IPv6 global scope addresses.
      See Also:
        Constant Field Values

    - #### USE_IPV6_LINK_LOCAL_SCOPE

          public static final int USE_IPV6_LINK_LOCAL_SCOPE

      Enable IPv6 link-local scope addresses.
      See Also:
        Constant Field Values

    - #### USE_IPV6_SITE_LOCAL_SCOPE

          public static final int USE_IPV6_SITE_LOCAL_SCOPE

      Enable IPv6 site-local scope addresses.
      See Also:
        Constant Field Values

    - #### USE_IPV6_SUBNET_SCOPE

          public static final int USE_IPV6_SUBNET_SCOPE

      Enable IPv6 subnet scope addresses.
      See Also:
        Constant Field Values

    - #### USE_LOOPBACK_ADDR

          public static final int USE_LOOPBACK_ADDR

      Enable loopback address usage.
      See Also:
        Constant Field Values

    - #### USE_ONLY_IPV4_ADDR

          public static final int USE_ONLY_IPV4_ADDR

      Enable IPv4-only addressing mode.
      See Also:
        Constant Field Values

    - #### USE_ONLY_IPV6_ADDR

          public static final int USE_ONLY_IPV6_ADDR

      Enable IPv6-only addressing mode.
      See Also:
        Constant Field Values

    - #### USE_SSDP_SEARCHRESPONSE_MULTIPLE_INTERFACES

          public static final int USE_SSDP_SEARCHRESPONSE_MULTIPLE_INTERFACES

      Enable SSDP search responses on multiple interfaces.
      See Also:
        Constant Field Values

    - #### VERSION

          public static final String VERSION

      Framework version used in server identification.
      See Also:
        Constant Field Values

    - #### XML_CLASS_PROPERTTY

          public static final String XML_CLASS_PROPERTTY

      Name of the system properties used to identifies the default XML Parser.
      The value of the properties MUST BE the fully qualified class name of
      XML Parser which CyberLink should use.
      See Also:
        Constant Field Values

    - #### XML_DECLARATION

          public static final String XML_DECLARATION

      Standard XML declaration for UPnP documents.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### UPnP

          public UPnP()

  - ### Method Detail

    - #### caluculateConfigId

          public static final int caluculateConfigId(String configXml)

      Calculates a configuration ID from the given XML configuration.
      Parameters:
        `configXml` - the XML configuration string
      Returns:
        the calculated configuration ID

    - #### createBootId

          public static final int createBootId()

      Creates a boot ID for UPnP device identification.
      Returns:
        a boot ID based on the current system time in seconds

    - #### createUUID

          public static final String createUUID()

      Creates a unique UUID for UPnP device identification.
      Returns:
        a UUID string in the standard UPnP format

    - #### getServerName

          public static final String getServerName()

      Generates the server identification string for UPnP operations.
      Returns:
        a server identification string in the format "OS/Version UPnP/1.0 FrameworkName/FrameworkVersion"

    - #### getTimeToLive

          public static final int getTimeToLive()

      Gets the current time-to-live value for multicast packets.
      Returns:
        the current TTL value

    - #### getXMLParser

          public static final Parser getXMLParser()

      Gets the XML parser used by the UPnP framework.
      Returns:
        the XML parser implementation
      Throws:
        `RuntimeException` - if no XML parser is available

    - #### initialize

          public static final void initialize()

      Initializes the UPnP framework. This method ensures the static initialization block is executed.

    - #### isEnabled

          public static final boolean isEnabled(int value)

      Checks if a specific UPnP framework feature or configuration option is enabled.
      Parameters:
        `value` - the feature to check (one of the USE_* constants)
      Returns:
        true if the feature is enabled, false otherwise

    - #### setDisable

          public static final void setDisable(int value)

      Disables a specific UPnP framework feature or configuration option.
      Parameters:
        `value` - the feature to disable (one of the USE_* constants)

    - #### setEnable

          public static final void setEnable(int value)

      Enables a specific UPnP framework feature or configuration option.
      Parameters:
        `value` - the feature to enable (one of the USE_* constants)

    - #### setTimeToLive

          public static final void setTimeToLive(int value)

      Sets the time-to-live value for multicast packets.
      Parameters:
        `value` - the TTL value to set

    - #### setXMLParser

          public static final void setXMLParser(Parser parser)

      Sets the XML parser to be used by the UPnP framework.
      Parameters:
        `parser` - the XML parser implementation