public class DHCP extends BasePacket
Modifier and Type | Class and Description |
---|---|
static class |
DHCP.DHCPOptionCode |
static class |
DHCP.MsgType |
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
bootFileName |
protected byte[] |
clientHardwareAddress |
protected int |
clientIPAddress |
protected short |
flags |
protected int |
gatewayIPAddress |
protected byte |
hardwareAddressLength |
protected byte |
hardwareType |
protected byte |
hops |
static byte |
HWTYPE_ETHERNET |
static int |
MIN_HEADER_LENGTH
Dynamic Host Configuration Protocol packet.
|
protected byte |
opCode |
static byte |
OPCODE_REPLY |
static byte |
OPCODE_REQUEST |
protected java.util.List<DhcpOption> |
options |
protected short |
seconds |
protected int |
serverIPAddress |
protected java.lang.String |
serverName |
protected int |
transactionId |
protected int |
yourIPAddress |
parent, payload
Constructor and Description |
---|
DHCP() |
Modifier and Type | Method and Description |
---|---|
static Deserializer<DHCP> |
deserializer()
Deserializer function for DHCP packets.
|
java.lang.String |
getBootFileName() |
byte[] |
getClientHardwareAddress() |
int |
getClientIPAddress() |
short |
getFlags() |
int |
getGatewayIPAddress() |
byte |
getHardwareAddressLength() |
byte |
getHardwareType() |
byte |
getHops() |
byte |
getOpCode() |
DhcpOption |
getOption(DHCP.DHCPOptionCode optionCode)
Gets a specific DHCP option parameter.
|
java.util.List<DhcpOption> |
getOptions() |
DHCP.MsgType |
getPacketType() |
short |
getSeconds() |
int |
getServerIPAddress() |
java.lang.String |
getServerName() |
int |
getTransactionId() |
int |
getYourIPAddress() |
byte[] |
serialize()
Sets all payloads parent packet if applicable, then serializes this
packet and all payloads.
|
DHCP |
setBootFileName(java.lang.String bootFile) |
DHCP |
setClientHardwareAddress(byte[] clientHardwareAddress) |
DHCP |
setClientIPAddress(int clientIPAddress) |
DHCP |
setFlags(short flags) |
DHCP |
setGatewayIPAddress(int gatewayIPAddress) |
DHCP |
setHardwareAddressLength(byte hardwareAddressLength) |
DHCP |
setHardwareType(byte hardwareType) |
DHCP |
setHops(byte hops) |
DHCP |
setOpCode(byte opCode) |
DHCP |
setOptions(java.util.List<DhcpOption> options) |
DHCP |
setSeconds(short seconds) |
DHCP |
setServerIPAddress(int serverIPAddress) |
DHCP |
setServerName(java.lang.String server) |
DHCP |
setTransactionId(int transactionId) |
DHCP |
setYourIPAddress(int yourIPAddress) |
java.lang.String |
toString() |
protected void |
writeString(java.lang.String string,
java.nio.ByteBuffer bb,
int maxLength) |
clone, equals, getParent, getPayload, hashCode, resetChecksum, setParent, setPayload
public static final int MIN_HEADER_LENGTH
public static final byte OPCODE_REQUEST
public static final byte OPCODE_REPLY
public static final byte HWTYPE_ETHERNET
protected byte opCode
protected byte hardwareType
protected byte hardwareAddressLength
protected byte hops
protected int transactionId
protected short seconds
protected short flags
protected int clientIPAddress
protected int yourIPAddress
protected int serverIPAddress
protected int gatewayIPAddress
protected byte[] clientHardwareAddress
protected java.lang.String serverName
protected java.lang.String bootFileName
protected java.util.List<DhcpOption> options
public byte getOpCode()
public DHCP setOpCode(byte opCode)
opCode
- the opCode to setpublic byte getHardwareType()
public DHCP setHardwareType(byte hardwareType)
hardwareType
- the hardwareType to setpublic byte getHardwareAddressLength()
public DHCP setHardwareAddressLength(byte hardwareAddressLength)
hardwareAddressLength
- the hardwareAddressLength to setpublic byte getHops()
public DHCP setHops(byte hops)
hops
- the hops to setpublic int getTransactionId()
public DHCP setTransactionId(int transactionId)
transactionId
- the transactionId to setpublic short getSeconds()
public DHCP setSeconds(short seconds)
seconds
- the seconds to setpublic short getFlags()
public DHCP setFlags(short flags)
flags
- the flags to setpublic int getClientIPAddress()
public DHCP setClientIPAddress(int clientIPAddress)
clientIPAddress
- the clientIPAddress to setpublic int getYourIPAddress()
public DHCP setYourIPAddress(int yourIPAddress)
yourIPAddress
- the yourIPAddress to setpublic int getServerIPAddress()
public DHCP setServerIPAddress(int serverIPAddress)
serverIPAddress
- the serverIPAddress to setpublic int getGatewayIPAddress()
public DHCP setGatewayIPAddress(int gatewayIPAddress)
gatewayIPAddress
- the gatewayIPAddress to setpublic byte[] getClientHardwareAddress()
public DHCP setClientHardwareAddress(byte[] clientHardwareAddress)
clientHardwareAddress
- the clientHardwareAddress to setpublic DhcpOption getOption(DHCP.DHCPOptionCode optionCode)
optionCode
- The option code to getpublic java.util.List<DhcpOption> getOptions()
public DHCP setOptions(java.util.List<DhcpOption> options)
options
- the options to setpublic DHCP.MsgType getPacketType()
public java.lang.String getServerName()
public DHCP setServerName(java.lang.String server)
server
- the serverName to setpublic java.lang.String getBootFileName()
public DHCP setBootFileName(java.lang.String bootFile)
bootFile
- the bootFileName to setpublic byte[] serialize()
IPacket
protected void writeString(java.lang.String string, java.nio.ByteBuffer bb, int maxLength)
public static Deserializer<DHCP> deserializer()
public java.lang.String toString()
toString
in class java.lang.Object