Package org.onlab.packet
Class DHCP
- java.lang.Object
- 
- org.onlab.packet.BasePacket
- 
- org.onlab.packet.DHCP
 
 
- 
- All Implemented Interfaces:
- IPacket
 
 public class DHCP extends BasePacket Representation of an DHCP Packet.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classDHCP.DHCPOptionCodestatic classDHCP.MsgType
 - 
Field SummaryFields Modifier and Type Field Description protected StringbootFileNameprotected byte[]clientHardwareAddressprotected intclientIPAddressprotected shortflagsprotected intgatewayIPAddressprotected bytehardwareAddressLengthprotected bytehardwareTypeprotected bytehopsstatic byteHWTYPE_ETHERNETstatic intMIN_HEADER_LENGTHDynamic Host Configuration Protocol packet.protected byteopCodestatic byteOPCODE_REPLYstatic byteOPCODE_REQUESTprotected List<DhcpOption>optionsprotected shortsecondsprotected intserverIPAddressprotected StringserverNameprotected inttransactionIdprotected intyourIPAddress- 
Fields inherited from class org.onlab.packet.BasePacketparent, payload
 
- 
 - 
Constructor SummaryConstructors Constructor Description DHCP()
 - 
Method Summary- 
Methods inherited from class org.onlab.packet.BasePacketclone, equals, getParent, getPayload, hashCode, resetChecksum, setParent, setPayload
 
- 
 
- 
- 
- 
Field Detail- 
MIN_HEADER_LENGTHpublic static final int MIN_HEADER_LENGTH Dynamic Host Configuration Protocol packet. ------------------------------------------ |op (1) | htype(1) | hlen(1) | hops(1) | ------------------------------------------ | xid (4) | ------------------------------------------ | secs (2) | flags (2) | ------------------------------------------ | ciaddr (4) | ------------------------------------------ | yiaddr (4) | ------------------------------------------ | siaddr (4) | ------------------------------------------ | giaddr (4) | ------------------------------------------ | chaddr (16) | ------------------------------------------ | sname (64) | ------------------------------------------ | file (128) | ------------------------------------------ | options (312) | ------------------------------------------- See Also:
- Constant Field Values
 
 - 
OPCODE_REQUESTpublic static final byte OPCODE_REQUEST - See Also:
- Constant Field Values
 
 - 
OPCODE_REPLYpublic static final byte OPCODE_REPLY - See Also:
- Constant Field Values
 
 - 
HWTYPE_ETHERNETpublic static final byte HWTYPE_ETHERNET - See Also:
- Constant Field Values
 
 - 
opCodeprotected byte opCode 
 - 
hardwareTypeprotected byte hardwareType 
 - 
hardwareAddressLengthprotected byte hardwareAddressLength 
 - 
hopsprotected byte hops 
 - 
transactionIdprotected int transactionId 
 - 
secondsprotected short seconds 
 - 
flagsprotected short flags 
 - 
clientIPAddressprotected int clientIPAddress 
 - 
yourIPAddressprotected int yourIPAddress 
 - 
serverIPAddressprotected int serverIPAddress 
 - 
gatewayIPAddressprotected int gatewayIPAddress 
 - 
clientHardwareAddressprotected byte[] clientHardwareAddress 
 - 
serverNameprotected String serverName 
 - 
bootFileNameprotected String bootFileName 
 - 
optionsprotected List<DhcpOption> options 
 
- 
 - 
Method Detail- 
getOpCodepublic byte getOpCode() - Returns:
- the opCode
 
 - 
setOpCodepublic DHCP setOpCode(byte opCode) - Parameters:
- opCode- the opCode to set
- Returns:
- this
 
 - 
getHardwareTypepublic byte getHardwareType() - Returns:
- the hardwareType
 
 - 
setHardwareTypepublic DHCP setHardwareType(byte hardwareType) - Parameters:
- hardwareType- the hardwareType to set
- Returns:
- this
 
 - 
getHardwareAddressLengthpublic byte getHardwareAddressLength() - Returns:
- the hardwareAddressLength
 
 - 
setHardwareAddressLengthpublic DHCP setHardwareAddressLength(byte hardwareAddressLength) - Parameters:
- hardwareAddressLength- the hardwareAddressLength to set
- Returns:
- this
 
 - 
getHopspublic byte getHops() - Returns:
- the hops
 
 - 
setHopspublic DHCP setHops(byte hops) - Parameters:
- hops- the hops to set
- Returns:
- this
 
 - 
getTransactionIdpublic int getTransactionId() - Returns:
- the transactionId
 
 - 
setTransactionIdpublic DHCP setTransactionId(int transactionId) - Parameters:
- transactionId- the transactionId to set
- Returns:
- this
 
 - 
getSecondspublic short getSeconds() - Returns:
- the seconds
 
 - 
setSecondspublic DHCP setSeconds(short seconds) - Parameters:
- seconds- the seconds to set
- Returns:
- this
 
 - 
getFlagspublic short getFlags() - Returns:
- the flags
 
 - 
setFlagspublic DHCP setFlags(short flags) - Parameters:
- flags- the flags to set
- Returns:
- this
 
 - 
getClientIPAddresspublic int getClientIPAddress() - Returns:
- the clientIPAddress
 
 - 
setClientIPAddresspublic DHCP setClientIPAddress(int clientIPAddress) - Parameters:
- clientIPAddress- the clientIPAddress to set
- Returns:
- this
 
 - 
getYourIPAddresspublic int getYourIPAddress() - Returns:
- the yourIPAddress
 
 - 
setYourIPAddresspublic DHCP setYourIPAddress(int yourIPAddress) - Parameters:
- yourIPAddress- the yourIPAddress to set
- Returns:
- this
 
 - 
getServerIPAddresspublic int getServerIPAddress() - Returns:
- the serverIPAddress
 
 - 
setServerIPAddresspublic DHCP setServerIPAddress(int serverIPAddress) - Parameters:
- serverIPAddress- the serverIPAddress to set
- Returns:
- this
 
 - 
getGatewayIPAddresspublic int getGatewayIPAddress() - Returns:
- the gatewayIPAddress
 
 - 
setGatewayIPAddresspublic DHCP setGatewayIPAddress(int gatewayIPAddress) - Parameters:
- gatewayIPAddress- the gatewayIPAddress to set
- Returns:
- this
 
 - 
getClientHardwareAddresspublic byte[] getClientHardwareAddress() - Returns:
- the clientHardwareAddress
 
 - 
setClientHardwareAddresspublic DHCP setClientHardwareAddress(byte[] clientHardwareAddress) - Parameters:
- clientHardwareAddress- the clientHardwareAddress to set
- Returns:
- this
 
 - 
getOptionpublic DhcpOption getOption(DHCP.DHCPOptionCode optionCode) Gets a specific DHCP option parameter.- Parameters:
- optionCode- The option code to get
- Returns:
- The value of the option if it exists, null otherwise
 
 - 
getOptionspublic List<DhcpOption> getOptions() - Returns:
- the options
 
 - 
setOptionspublic DHCP setOptions(List<DhcpOption> options) - Parameters:
- options- the options to set
- Returns:
- this
 
 - 
getPacketTypepublic DHCP.MsgType getPacketType() - Returns:
- the packetType base on option 53
 
 - 
getServerNamepublic String getServerName() - Returns:
- the serverName
 
 - 
setServerNamepublic DHCP setServerName(String server) - Parameters:
- server- the serverName to set
- Returns:
- this
 
 - 
getBootFileNamepublic String getBootFileName() - Returns:
- the bootFileName
 
 - 
setBootFileNamepublic DHCP setBootFileName(String bootFile) - Parameters:
- bootFile- the bootFileName to set
- Returns:
- this
 
 - 
serializepublic byte[] serialize() Description copied from interface:IPacketSets all payloads parent packet if applicable, then serializes this packet and all payloads.- Returns:
- a byte[] containing this packet and payloads
 
 - 
writeStringprotected void writeString(String string, ByteBuffer bb, int maxLength) 
 - 
deserializerpublic static Deserializer<DHCP> deserializer() Deserializer function for DHCP packets.- Returns:
- deserializer function
 
 
- 
 
-