com.h3c.util.pkt

## Class DhcpOption

- java.lang.Object
- - com.h3c.util.pkt.DhcpOption

-     public class DhcpOption
      extends Object

  DHCP option data store (immutable).

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DhcpOption.Code` Option codes (used in messages types, request params, ...).
    `static class` | `DhcpOption.MessageType` Message types.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static DhcpOption` | `END_OPTION` Singleton of the `DhcpOption.Code.END`.
    `static DhcpOption` | `PAD_OPTION` Singleton of the `DhcpOption.Code.PAD`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DhcpOption(DhcpOption.Code code)` Constructor for a no-payload option.
    `DhcpOption(DhcpOption.Code code, byte[] bytes)` Constructor for a byte array (opaque) option.
    `DhcpOption(DhcpOption.Code code, DhcpOption.Code[] codes)` Constructor for an option holding a list of `DhcpOption.Code` values.
    `DhcpOption(DhcpOption.Code code, IpAddress ipAddr)` Constructor for a IP address option.
    `DhcpOption(DhcpOption.Code code, IpAddress[] ipAddrs)` Constructor for an option holding a list of IP addresses.
    `DhcpOption(DhcpOption.Code code, long number)` Constructor for a scalar (number) option.
    `DhcpOption(DhcpOption.Code code, MacAddress macAddr)` Constructor for an option holding a MAC address.
    `DhcpOption(DhcpOption.Code code, String name)` Constructor for a string option.
    `DhcpOption(DhcpOption.MessageType msgType)` Constructor for the message type option.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `bytes()` Returns a copy of the byte array or null.
    `DhcpOption.Code` | `code()` Returns the option code.
    `DhcpOption.Code[]` | `codes()` Returns a copy of the list of codes or null.
    `IpAddress` | `ipAddr()` Returns the IP address for this option or null.
    `IpAddress[]` | `ipAddrs()` Returns a copy of the list of IP addresses or null.
    `MacAddress` | `macAddr()` Returns the MAC address or null.
    `String` | `name()` Returns the string value or null.
    `long` | `number()` Returns the number (scalar) value.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### END_OPTION

          public static final DhcpOption END_OPTION

      Singleton of the `DhcpOption.Code.END`.

    - #### PAD_OPTION

          public static final DhcpOption PAD_OPTION

      Singleton of the `DhcpOption.Code.PAD`.

  - ### Constructor Detail

    - #### DhcpOption

          public DhcpOption(DhcpOption.Code code)

      Constructor for a no-payload option.
      Parameters:
        `code` - option code

    - #### DhcpOption

          public DhcpOption(DhcpOption.MessageType msgType)

      Constructor for the message type option.
      Parameters:
        `msgType` - message type

    - #### DhcpOption

          public DhcpOption(DhcpOption.Code code,
                    byte[] bytes)

      Constructor for a byte array (opaque) option.
      Parameters:
        `code` - option code
        `bytes` - payload byte array

    - #### DhcpOption

          public DhcpOption(DhcpOption.Code code,
                    String name)

      Constructor for a string option.
      Parameters:
        `code` - option code
        `name` - string value

    - #### DhcpOption

          public DhcpOption(DhcpOption.Code code,
                    IpAddress ipAddr)

      Constructor for a IP address option.
      Parameters:
        `code` - option code
        `ipAddr` - IP address

    - #### DhcpOption

          public DhcpOption(DhcpOption.Code code,
                    IpAddress[] ipAddrs)

      Constructor for an option holding a list of IP addresses.
      Parameters:
        `code` - option code
        `ipAddrs` - array of IP addresses

    - #### DhcpOption

          public DhcpOption(DhcpOption.Code code,
                    MacAddress macAddr)

      Constructor for an option holding a MAC address.
      Parameters:
        `code` - option code
        `macAddr` - MAC address

    - #### DhcpOption

          public DhcpOption(DhcpOption.Code code,
                    DhcpOption.Code[] codes)

      Constructor for an option holding a list of `DhcpOption.Code` values.
      Parameters:
        `code` - option code
        `codes` - array of codes

    - #### DhcpOption

          public DhcpOption(DhcpOption.Code code,
                    long number)

      Constructor for a scalar (number) option.
      Parameters:
        `code` - option code
        `number` - scalar value

  - ### Method Detail

    - #### code

          public DhcpOption.Code code()

      Returns the option code.
      Returns:
        the code

    - #### bytes

          public byte[] bytes()

      Returns a copy of the byte array or null.
      Returns:
        the byte array or null

    - #### macAddr

          public MacAddress macAddr()

      Returns the MAC address or null.
      Returns:
        the MAC address or null

    - #### number

          public long number()

      Returns the number (scalar) value.
      Returns:
        the number value

    - #### name

          public String name()

      Returns the string value or null.
      Returns:
        the string value

    - #### codes

          public DhcpOption.Code[] codes()

      Returns a copy of the list of codes or null.
      Returns:
        array of codes or null

    - #### ipAddrs

          public IpAddress[] ipAddrs()

      Returns a copy of the list of IP addresses or null.
      Returns:
        array of IP addresses or null

    - #### ipAddr

          public IpAddress ipAddr()

      Returns the IP address for this option or null.
      Returns:
        the IP address or null

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2014. All Rights Reserved.