Class DHCPOptions
- java.lang.Object
-
- com.github.markusbernhardt.proxy.search.wpad.dhcp.DHCPOptions
-
public class DHCPOptions extends java.lang.Object
This class represents a linked list of options for a DHCP message. Its purpose is to ease option handling such as add, remove or change.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
DHCPOptions.DHCPOptionsEntry
This inner class represent an entry in the Option Table
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DHCPOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(byte entryCode)
Returns true if option code is set in list; false otherwisebyte[]
externalize()
Converts a linked options list to a byte arrayprivate byte[]
getArrayOption(int length, int position, byte[] options)
Returns the option value of a specified option code in a byte arraybyte[]
getOption(byte entryCode)
Fetches value of option by its option codevoid
internalize(byte[] optionsArray)
Converts an options byte array to a linked listboolean
isEmpty()
Determines if list is emptyvoid
printList()
Prints the options linked list: For testing only.void
removeOption(byte entryCode)
Removes option with specified bytecodevoid
setOption(byte entryCode, byte[] value)
Changes an existing option to new value
-
-
-
Field Detail
-
OPTION_PAD
public static final int OPTION_PAD
- See Also:
- Constant Field Values
-
OPTION_NETMASK
public static final int OPTION_NETMASK
- See Also:
- Constant Field Values
-
OPTION_TIME_OFFSET
public static final int OPTION_TIME_OFFSET
- See Also:
- Constant Field Values
-
OPTION_ROUTERS
public static final int OPTION_ROUTERS
- See Also:
- Constant Field Values
-
OPTION_TIME_SERVERS
public static final int OPTION_TIME_SERVERS
- See Also:
- Constant Field Values
-
OPTION_NAME_SERVERS
public static final int OPTION_NAME_SERVERS
- See Also:
- Constant Field Values
-
OPTION_DNS_SERVERS
public static final int OPTION_DNS_SERVERS
- See Also:
- Constant Field Values
-
OPTION_LOG_SERVERS
public static final int OPTION_LOG_SERVERS
- See Also:
- Constant Field Values
-
OPTION_COOKIE_SERVERS
public static final int OPTION_COOKIE_SERVERS
- See Also:
- Constant Field Values
-
OPTION_LPR_SERVERS
public static final int OPTION_LPR_SERVERS
- See Also:
- Constant Field Values
-
OPTION_IMPRESS_SERVERS
public static final int OPTION_IMPRESS_SERVERS
- See Also:
- Constant Field Values
-
OPTION_RESSOURCE_LOCATION_SERVERS
public static final int OPTION_RESSOURCE_LOCATION_SERVERS
- See Also:
- Constant Field Values
-
OPTION_HOSTNAME
public static final int OPTION_HOSTNAME
- See Also:
- Constant Field Values
-
OPTION_BOOT_FILESIZE
public static final int OPTION_BOOT_FILESIZE
- See Also:
- Constant Field Values
-
OPTION_MERIT_DUMPFILE
public static final int OPTION_MERIT_DUMPFILE
- See Also:
- Constant Field Values
-
OPTION_DOMAIN_NAME
public static final int OPTION_DOMAIN_NAME
- See Also:
- Constant Field Values
-
OPTION_SWAP_SERVER
public static final int OPTION_SWAP_SERVER
- See Also:
- Constant Field Values
-
OPTION_ROOT_PATH
public static final int OPTION_ROOT_PATH
- See Also:
- Constant Field Values
-
OPTION_EXTENSIONS_PATH
public static final int OPTION_EXTENSIONS_PATH
- See Also:
- Constant Field Values
-
OPTION_END
public static final int OPTION_END
- See Also:
- Constant Field Values
-
OPTION_IP_HOST_FORWARDING_ENABLE
public static final int OPTION_IP_HOST_FORWARDING_ENABLE
- See Also:
- Constant Field Values
-
OPTION_IP_HOST_NON_LOCAL_SOURCE_ROUTING_ENABLE
public static final int OPTION_IP_HOST_NON_LOCAL_SOURCE_ROUTING_ENABLE
- See Also:
- Constant Field Values
-
OPTION_IP_HOST_POLICY_FILTERS
public static final int OPTION_IP_HOST_POLICY_FILTERS
- See Also:
- Constant Field Values
-
OPTION_IP_HOST_MAXIMUM_DATAGRAM_REASSEMBLY_SIZE
public static final int OPTION_IP_HOST_MAXIMUM_DATAGRAM_REASSEMBLY_SIZE
- See Also:
- Constant Field Values
-
OPTION_IP_HOST_DEFAULT_TTL
public static final int OPTION_IP_HOST_DEFAULT_TTL
- See Also:
- Constant Field Values
-
OPTION_IP_HOST_MTU_AGEING_TIMEOUT
public static final int OPTION_IP_HOST_MTU_AGEING_TIMEOUT
- See Also:
- Constant Field Values
-
OPTION_IP_HOST_MTU_PLATEAU_TABLE
public static final int OPTION_IP_HOST_MTU_PLATEAU_TABLE
- See Also:
- Constant Field Values
-
OPTION_IP_INTERFACE_MTU
public static final int OPTION_IP_INTERFACE_MTU
- See Also:
- Constant Field Values
-
OPTION_IP_INTERFACE_ALL_SUBNETS_LOCAL_ENABLE
public static final int OPTION_IP_INTERFACE_ALL_SUBNETS_LOCAL_ENABLE
- See Also:
- Constant Field Values
-
OPTION_IP_INTERFACE_BROADCAST_ADDRESS
public static final int OPTION_IP_INTERFACE_BROADCAST_ADDRESS
- See Also:
- Constant Field Values
-
OPTION_IP_INTERFACE_PERFORM_MASK_DISCOVERY_ENABLE
public static final int OPTION_IP_INTERFACE_PERFORM_MASK_DISCOVERY_ENABLE
- See Also:
- Constant Field Values
-
OPTION_IP_INTERFACE_MASK_SUPPLIER_ENABLE
public static final int OPTION_IP_INTERFACE_MASK_SUPPLIER_ENABLE
- See Also:
- Constant Field Values
-
OPTION_IP_INTERFACE_PERFORM_ROUTER_DISCOVERY_ENABLE
public static final int OPTION_IP_INTERFACE_PERFORM_ROUTER_DISCOVERY_ENABLE
- See Also:
- Constant Field Values
-
OPTION_IP_INTERFACE_ROUTER_SOLICITATION_ADDRESS
public static final int OPTION_IP_INTERFACE_ROUTER_SOLICITATION_ADDRESS
- See Also:
- Constant Field Values
-
OPTION_IP_INTERFACE_STATIC_ROUTES
public static final int OPTION_IP_INTERFACE_STATIC_ROUTES
- See Also:
- Constant Field Values
-
OPTION_LINK_TRAILER_ENCAPSULATION_ENABLE
public static final int OPTION_LINK_TRAILER_ENCAPSULATION_ENABLE
- See Also:
- Constant Field Values
-
OPTION_LINK_ARP_CACHE_TIMEOUT
public static final int OPTION_LINK_ARP_CACHE_TIMEOUT
- See Also:
- Constant Field Values
-
OPTION_LINK_ETHERNET_ENCAPSULATION_ENABLE
public static final int OPTION_LINK_ETHERNET_ENCAPSULATION_ENABLE
- See Also:
- Constant Field Values
-
OPTION_TCP_DEFAULT_TTL
public static final int OPTION_TCP_DEFAULT_TTL
- See Also:
- Constant Field Values
-
OPTION_TCP_KEEP_ALIVE_INTERVAL
public static final int OPTION_TCP_KEEP_ALIVE_INTERVAL
- See Also:
- Constant Field Values
-
OPTION_TCP_KEEP_ALIVE_GERBAGE_ENABLE
public static final int OPTION_TCP_KEEP_ALIVE_GERBAGE_ENABLE
- See Also:
- Constant Field Values
-
OPTION_NIS_DOMAIN
public static final int OPTION_NIS_DOMAIN
- See Also:
- Constant Field Values
-
OPTION_NIS_SERVERS
public static final int OPTION_NIS_SERVERS
- See Also:
- Constant Field Values
-
OPTION_NTP_SERVERS
public static final int OPTION_NTP_SERVERS
- See Also:
- Constant Field Values
-
OPTION_SERVICE_VENDOR_SPECIFIC_INFORMATIONS
public static final int OPTION_SERVICE_VENDOR_SPECIFIC_INFORMATIONS
- See Also:
- Constant Field Values
-
OPTION_SERVICE_NETBOIS_NAME_SERVERS
public static final int OPTION_SERVICE_NETBOIS_NAME_SERVERS
- See Also:
- Constant Field Values
-
OPTION_SERVICE_NETBOIS_DATAGRAM_DISTRIBUTION_SERVERS
public static final int OPTION_SERVICE_NETBOIS_DATAGRAM_DISTRIBUTION_SERVERS
- See Also:
- Constant Field Values
-
OPTION_SERVICE_NETBOIS_NODE_TYPE
public static final int OPTION_SERVICE_NETBOIS_NODE_TYPE
- See Also:
- Constant Field Values
-
OPTION_SERVICE_NETBOIS_SCOPE_TYPE
public static final int OPTION_SERVICE_NETBOIS_SCOPE_TYPE
- See Also:
- Constant Field Values
-
OPTION_SERVICE_X_FONT_SERVERS
public static final int OPTION_SERVICE_X_FONT_SERVERS
- See Also:
- Constant Field Values
-
OPTION_SERVICE_X_DISPLAY_MANAGERS
public static final int OPTION_SERVICE_X_DISPLAY_MANAGERS
- See Also:
- Constant Field Values
-
OPTION_DHCP_IP_ADRESS_REQUESTED
public static final int OPTION_DHCP_IP_ADRESS_REQUESTED
- See Also:
- Constant Field Values
-
OPTION_DHCP_IP_LEASE_TIME
public static final int OPTION_DHCP_IP_LEASE_TIME
- See Also:
- Constant Field Values
-
OPTION_DHCP_OVERLOAD
public static final int OPTION_DHCP_OVERLOAD
- See Also:
- Constant Field Values
-
OPTION_DHCP_MESSAGE_TYPE
public static final int OPTION_DHCP_MESSAGE_TYPE
- See Also:
- Constant Field Values
-
OPTION_DHCP_SERVER_IDENTIFIER
public static final int OPTION_DHCP_SERVER_IDENTIFIER
- See Also:
- Constant Field Values
-
OPTION_DHCP_PARAMETER_REQUEST_LIST
public static final int OPTION_DHCP_PARAMETER_REQUEST_LIST
- See Also:
- Constant Field Values
-
OPTION_DHCP_MESSAGE
public static final int OPTION_DHCP_MESSAGE
- See Also:
- Constant Field Values
-
OPTION_DHCP_MAXIMUM_MESSAGE_SIZE
public static final int OPTION_DHCP_MAXIMUM_MESSAGE_SIZE
- See Also:
- Constant Field Values
-
OPTION_DHCP_RENEWAL_TIME
public static final int OPTION_DHCP_RENEWAL_TIME
- See Also:
- Constant Field Values
-
OPTION_DHCP_REBIND_TIME
public static final int OPTION_DHCP_REBIND_TIME
- See Also:
- Constant Field Values
-
OPTION_DHCP_CLASS_IDENTIFIER
public static final int OPTION_DHCP_CLASS_IDENTIFIER
- See Also:
- Constant Field Values
-
OPTION_DHCP_CLIENT_IDENTIFIER
public static final int OPTION_DHCP_CLIENT_IDENTIFIER
- See Also:
- Constant Field Values
-
OPTION_PROXY_AUTODISCOVERY
public static final int OPTION_PROXY_AUTODISCOVERY
- See Also:
- Constant Field Values
-
optionsTable
private java.util.Map<java.lang.Byte,DHCPOptions.DHCPOptionsEntry> optionsTable
-
-
Method Detail
-
removeOption
public void removeOption(byte entryCode)
Removes option with specified bytecode- Parameters:
entryCode
- The code of option to be removed
-
contains
public boolean contains(byte entryCode)
Returns true if option code is set in list; false otherwise- Parameters:
entryCode
- The node's option code- Returns:
- true if option is set, otherwise false
-
isEmpty
public boolean isEmpty()
Determines if list is empty- Returns:
- true if there are no options set, otherwise false
-
getOption
public byte[] getOption(byte entryCode)
Fetches value of option by its option code- Parameters:
entryCode
- The node's option code- Returns:
- byte array containing the value of option entryCode. null is returned if option is not set.
-
setOption
public void setOption(byte entryCode, byte[] value)
Changes an existing option to new value- Parameters:
entryCode
- The node's option codevalue
- Content of node option
-
getArrayOption
private byte[] getArrayOption(int length, int position, byte[] options)
Returns the option value of a specified option code in a byte array- Parameters:
length
- Length of option contentposition
- Location in array of option nodeoptions
- The byte array of options- Returns:
- byte array containing the value for the option
-
internalize
public void internalize(byte[] optionsArray)
Converts an options byte array to a linked list- Parameters:
optionsArray
- The byte array representation of the options list
-
externalize
public byte[] externalize()
Converts a linked options list to a byte array- Returns:
- array representation of optionsTable
-
printList
public void printList()
Prints the options linked list: For testing only.
-
-