public class

DhcpOption

extends Object
java.lang.Object
   ↳ com.datalogic.os.network.DhcpOption

Class Overview

Represents a single DHCP option received in a DHCP ACK packet.

A DHCP option consists of a numeric code that identifies the option type, and a value encoded as raw bytes in data. Some options (notably option 43 – vendor specific information) carry a nested TLV-encoded list of sub-options; in that case suboptions is populated with the parsed list.

Summary

Fields
public final int code The DHCP option code as defined in RFC 2132.
public final byte[] data The raw byte value of this option as received in the DHCP packet.
public final List<SubOption> suboptions Parsed sub-options, or null if this option does not carry a TLV-encoded sub-option list.
Public Methods
boolean hasSuboptions()
Returns true if this option contains a parsed sub-option list.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public final int code

Added in revision 51

The DHCP option code as defined in RFC 2132. Common values include:

  • 1 – Subnet Mask
  • 3 – Router
  • 6 – DNS Server
  • 43 – Vendor Specific Information
  • 51 – IP Address Lease Time
  • 54 – DHCP Server Identifier

public final byte[] data

Added in revision 51

The raw byte value of this option as received in the DHCP packet. Always populated, even when suboptions is present.

public final List<SubOption> suboptions

Added in revision 51

Parsed sub-options, or null if this option does not carry a TLV-encoded sub-option list.

When non-null, each entry is a SubOption with its own code and data. Sub-options do not have further nesting.

See Also

Public Methods

public boolean hasSuboptions ()

Added in revision 51

Returns true if this option contains a parsed sub-option list.

When true, iterate over suboptions to access individual sub-options. When false, read the raw value from data.