public class DHCP extends BasePacket
Modifier and Type | Class and Description |
---|---|
static class |
DHCP.DHCPOptionCode |
Modifier and Type | Field and Description |
---|---|
protected 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 List<DHCPOption> |
options |
protected short |
seconds |
protected int |
serverIPAddress |
protected String |
serverName |
protected int |
transactionId |
protected int |
yourIPAddress |
parent, payload
Constructor and Description |
---|
DHCP() |
Modifier and Type | Method and Description |
---|---|
IPacket |
deserialize(byte[] data,
int offset,
int length)
Deserializes this packet layer and all possible payloads.
|
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.
|
List<DHCPOption> |
getOptions() |
DHCPPacketType |
getPacketType() |
short |
getSeconds() |
int |
getServerIPAddress() |
String |
getServerName() |
int |
getTransactionId() |
int |
getYourIPAddress() |
protected String |
readString(ByteBuffer bb,
int maxLength) |
byte[] |
serialize()
Sets all payloads parent packet if applicable, then serializes this
packet and all payloads.
|
DHCP |
setBootFileName(String bootFileName) |
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(List<DHCPOption> options) |
DHCP |
setSeconds(short seconds) |
DHCP |
setServerIPAddress(int serverIPAddress) |
DHCP |
setServerName(String serverName) |
DHCP |
setTransactionId(int transactionId) |
DHCP |
setYourIPAddress(int yourIPAddress) |
protected void |
writeString(String string,
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 String serverName
protected String bootFileName
protected 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)
opetionCode
- The option code to getpublic List<DHCPOption> getOptions()
public DHCP setOptions(List<DHCPOption> options)
options
- the options to setpublic DHCPPacketType getPacketType()
public String getServerName()
public DHCP setServerName(String serverName)
serverName
- the serverName to setpublic String getBootFileName()
public DHCP setBootFileName(String bootFileName)
bootFileName
- the bootFileName to setpublic byte[] serialize()
IPacket
protected void writeString(String string, ByteBuffer bb, int maxLength)
public IPacket deserialize(byte[] data, int offset, int length)
IPacket
offset
- offset to start deserializing fromlength
- length of the data to deserializeprotected String readString(ByteBuffer bb, int maxLength)
Copyright © 2015. All rights reserved.