public final class DhcpPacket extends java.lang.Object implements java.util.Comparator<DhcpOption>
Modifier and Type | Class and Description |
---|---|
static class |
DhcpPacket.DhcpPacketOption<T> |
Modifier and Type | Field and Description |
---|---|
byte[] |
chaddr |
static java.nio.charset.Charset |
CHARSET |
byte[] |
ciaddr |
static int |
DHCP_ACK
Code for DHCPACK Message
|
static int |
DHCP_DECLINE
Code for DHCPDECLINE Message
|
static int |
DHCP_DISCOVER
Code for DHCPDISCOVER Message
|
static int |
DHCP_INFORM
Code for DHCPINFORM Message
|
static int |
DHCP_NAK
Code for DHCPNAK Message
|
static int |
DHCP_OFFER
Code for DHCPOFFER Message
|
static int |
DHCP_RELEASE
Code for DHCPRELEASE Message
|
static int |
DHCP_REQUEST
Code for DHCPREQUEST Message
|
byte[] |
file |
static short |
FLAG_BROADCAST |
short |
flags |
byte[] |
giaddr |
byte |
hlen |
byte |
hops |
byte |
htype |
byte |
messageType |
byte |
op |
static byte |
OP_BOOT_REQUEST |
static byte |
OP_BOOT_RESPONSE |
static byte |
OPTION_AGENT_INFORMATION |
static byte |
OPTION_CLIENT_IDENTIDIER |
static byte |
OPTION_COOKIE_SERVER |
static byte |
OPTION_DOMAIN_NAME |
static byte |
OPTION_DOMAIN_NAME_SERVER |
static byte |
OPTION_HOST_NAME |
static byte |
OPTION_IP_ADDRESS_LEASE_TIME |
static byte |
OPTION_LOG_SERVER |
static byte |
OPTION_LPR_SERVER |
static byte |
OPTION_NAME_SERVER |
static byte |
OPTION_PARAMETER_REQUEST_LIST
опция OPTION_PARAMETER_REQUEST_LIST из реквеста, по ней упорядочиваем
опции при сериализации.
|
static byte |
OPTION_REBINDING_TIME_VALUE |
static byte |
OPTION_RENEWAL_TIME_VALUE |
static byte |
OPTION_REQUESTED_IP_ADDRESS |
static byte |
OPTION_ROUTER |
static byte |
OPTION_SERVER_IDENTIFIER |
static byte |
OPTION_SUBNET_MASK |
static byte |
OPTION_TIME_OFFSET |
static byte |
OPTION_TIME_SERVER |
short |
secs |
byte[] |
siaddr |
byte[] |
sname |
int |
xid |
byte[] |
yiaddr |
static byte |
ZERO |
Constructor and Description |
---|
DhcpPacket()
Конструктор пустого пакета.
|
DhcpPacket(java.nio.ByteBuffer request)
Конструктор пакета - запроса.
|
Modifier and Type | Method and Description |
---|---|
void |
clearSubOptions() |
int |
compare(DhcpOption o1,
DhcpOption o2) |
DhcpPacket |
createResponse() |
DhcpOption |
getOption(byte code) |
<O> O |
getOption(DhcpPacket.DhcpPacketOption<O> option)
Получение опции(атрибута) из пакета.
|
<O> O |
getOption(DhcpPacket.DhcpPacketOption<O> option,
O value)
Получение опции(атрибута) из пакета.
|
DhcpOption |
getSubOption(byte code) |
boolean |
haveSubOptions()
Возвращает наличие Options.82 в запросе.
|
boolean |
isClientAddressSet() |
boolean |
isFromRelayAgent() |
static boolean |
isNil(byte[] b) |
static boolean |
isRenewRequest(DhcpPacket request)
Это RENEW-запрос, если это REQUEST, ciaddr!
|
void |
serialize(java.nio.ByteBuffer bb)
Сериализация пакета.
|
void |
setOption(byte code,
byte[] value) |
void |
setOption(byte code,
java.lang.String stringValue) |
void |
setOption(DhcpOption option) |
<O> void |
setOption(DhcpPacket.DhcpPacketOption<O> option,
O value)
Установка опции в пакет.
|
void |
setSubOption(byte code,
byte[] value) |
void |
setSubOption(byte code,
java.lang.String stringValue) |
void |
setSubOption(DhcpOption option) |
java.lang.String |
toString() |
public static final byte ZERO
public static final java.nio.charset.Charset CHARSET
public static short FLAG_BROADCAST
public static final byte OP_BOOT_REQUEST
public static final byte OP_BOOT_RESPONSE
public static final int DHCP_DISCOVER
public static final int DHCP_OFFER
public static final int DHCP_REQUEST
public static final int DHCP_DECLINE
public static final int DHCP_ACK
public static final int DHCP_NAK
public static final int DHCP_RELEASE
public static final int DHCP_INFORM
public static final byte OPTION_SUBNET_MASK
public static final byte OPTION_TIME_OFFSET
public static final byte OPTION_ROUTER
public static final byte OPTION_TIME_SERVER
public static final byte OPTION_NAME_SERVER
public static final byte OPTION_DOMAIN_NAME_SERVER
public static final byte OPTION_LOG_SERVER
public static final byte OPTION_COOKIE_SERVER
public static final byte OPTION_LPR_SERVER
public static final byte OPTION_HOST_NAME
public static final byte OPTION_DOMAIN_NAME
public static final byte OPTION_REQUESTED_IP_ADDRESS
public static final byte OPTION_IP_ADDRESS_LEASE_TIME
public static final byte OPTION_SERVER_IDENTIFIER
public static final byte OPTION_RENEWAL_TIME_VALUE
public static final byte OPTION_REBINDING_TIME_VALUE
public static final byte OPTION_PARAMETER_REQUEST_LIST
public static final byte OPTION_CLIENT_IDENTIDIER
public static final byte OPTION_AGENT_INFORMATION
public byte op
public byte htype
public byte hlen
public byte hops
public int xid
public short secs
public short flags
public byte[] ciaddr
public byte[] yiaddr
public byte[] siaddr
public byte[] giaddr
public byte[] chaddr
public byte[] sname
public byte[] file
public byte messageType
public DhcpPacket()
public DhcpPacket(java.nio.ByteBuffer request)
request
- public final DhcpPacket createResponse()
public boolean haveSubOptions()
public void clearSubOptions()
public void serialize(java.nio.ByteBuffer bb)
public final boolean isFromRelayAgent()
public final boolean isClientAddressSet()
public final int compare(DhcpOption o1, DhcpOption o2)
compare
in interface java.util.Comparator<DhcpOption>
public final void setOption(DhcpOption option)
public final void setOption(byte code, byte[] value)
public final void setOption(byte code, java.lang.String stringValue)
public final DhcpOption getOption(byte code)
public final void setSubOption(DhcpOption option)
public final void setSubOption(byte code, byte[] value)
public final void setSubOption(byte code, java.lang.String stringValue)
public final DhcpOption getSubOption(byte code)
public java.lang.String toString()
toString
in class java.lang.Object
public <O> O getOption(DhcpPacket.DhcpPacketOption<O> option)
O
- option
- public <O> O getOption(DhcpPacket.DhcpPacketOption<O> option, O value)
O
- option
- value
- - значение по умолчаниюpublic <O> void setOption(DhcpPacket.DhcpPacketOption<O> option, O value)
O
- option
- value
- public static final boolean isNil(byte[] b)
public static boolean isRenewRequest(DhcpPacket request)
request
-