|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.dhcp.DHCPMessage
public class DHCPMessage
This class represents a DHCP Message.
Field Summary | |
---|---|
static int |
ACK
Code for DHCPACK Message |
static java.net.InetAddress |
BROADCAST_ADDR
|
static int |
CLIENT_PORT
Default DHCP client port |
static int |
DECLINE
Code for DHCPDECLINE Message |
static int |
DISCOVER
Code for DHCPDISCOVER Message |
static int |
INFORM
Code for DHCPINFORM Message |
static int |
NAK
Code for DHCPNAK Message |
static int |
OFFER
Code for DHCPOFFER Message |
static int |
RELEASE
Code for DHCPRELEASE Message |
static int |
REQUEST
Code for DHCPREQUEST Message |
static int |
SERVER_PORT
Default DHCP server port |
Constructor Summary | |
---|---|
DHCPMessage()
Creates empty DHCPMessage object, initializes the object, sets the host to the broadcast address, the local subnet, binds to the default server port. |
|
DHCPMessage(byte[] ibuf)
Creates empty DHCPMessage object, initializes the object with a specified byte array containing DHCP message information, sets the host to default host name, the local subnet, and bind to the default server port. |
|
DHCPMessage(byte[] ibuf,
java.net.InetAddress inServername)
Creates empty DHCPMessage object, initializes the object with a specified byte array containing DHCP message information, sets the host to specified host name, and binds to the specified port. |
|
DHCPMessage(byte[] ibuf,
java.net.InetAddress inServername,
int inPort)
Creates empty DHCPMessage object, initializes the object with a specified byte array containing DHCP message information, sets the host to specified host name, and binds to the specified port. |
|
DHCPMessage(byte[] ibuf,
int inPort)
Creates empty DHCPMessage object, initializes the object with a specified byte array containing DHCP message information, sets the host to broadcast address, and binds to the specified port. |
|
DHCPMessage(java.io.DataInputStream inStream)
|
|
DHCPMessage(DHCPMessage inMessage)
Copy constructor creates DHCPMessage from inMessage |
|
DHCPMessage(DHCPMessage inMessage,
java.net.InetAddress inServername)
|
|
DHCPMessage(DHCPMessage inMessage,
java.net.InetAddress inServername,
int inPort)
Copy constructor creates DHCPMessage from inMessage and sets server and port |
|
DHCPMessage(java.net.InetAddress inServername)
Creates empty DHCPMessage object, initializes the object, sets the host to a specified host name, and binds to the default port. |
|
DHCPMessage(java.net.InetAddress inServername,
int inPort)
Creates empty DHCPMessage object, initializes the object, sets the host to a specified host name, and binds to a specified port. |
|
DHCPMessage(int inPort)
Creates empty DHCPMessage object, initializes the object, sets the host to the broadcast address, and binds to a specified port. |
Method Summary | |
---|---|
byte[] |
externalize()
Converts a DHCPMessage object to a byte array. |
byte[] |
getChaddr()
Get client harware address. |
byte[] |
getCiaddr()
Get client IP address. |
java.lang.String |
getDestinationAddress()
Get message destination hostname |
byte[] |
getFile()
Get boot file name. |
short |
getFlags()
Get flags field. |
byte[] |
getGiaddr()
Get relay agent IP address. |
byte |
getHlen()
Get hardware address length |
byte |
getHops()
Get hops field. |
byte |
getHtype()
Get hardware address type. |
byte |
getOp()
Get message Op code / message type. |
byte[] |
getOption(int inOptNum)
Returns specified DHCP option that matches the input code. |
byte[] |
getOptions()
Get all options. |
int |
getPort()
Get message destination port |
short |
getSecs()
Get seconds elapsed since client began address acquisition or renewal process. |
byte[] |
getSiaddr()
Get address of next server to use in bootstrap. |
byte[] |
getSname()
Get optional server host name. |
int |
getXid()
Get transaction ID. |
byte[] |
getYiaddr()
Get 'your' (client) IP address. |
DHCPMessage |
internalize(byte[] ibuff)
Convert a specified byte array containing a DHCP message into a DHCPMessage object. |
boolean |
IsOptSet(int inOptNum)
Report whether or not the input option is set |
void |
printMessage()
|
void |
removeOption(int inOptNum)
Removes the specified DHCP option that matches the input code. |
void |
setChaddr(byte[] inChaddr)
Set client harware address. |
void |
setCiaddr(byte[] inCiaddr)
Set client IP address. |
void |
setDestinationHost(java.lang.String inHost)
Set message destination IP |
void |
setFile(byte[] inFile)
Set boot file name. |
void |
setFlags(short inFlags)
Set flags field. |
void |
setGiaddr(byte[] inGiaddr)
Set relay agent IP address. |
void |
setHlen(byte inHlen)
Set hardware address length. |
void |
setHops(byte inHops)
Set hops field. |
void |
setHtype(byte inHtype)
Set hardware address type. |
void |
setOp(byte inOp)
Set message Op code / message type. |
void |
setOption(int inOptNum,
byte[] inOptionData)
Sets DHCP options in DHCPMessage. |
void |
setPort(int inPortNum)
Set message destination port. |
void |
setSecs(short inSecs)
Set seconds elapsed since client began address acquisition or renewal process. |
void |
setSiaddr(byte[] inSiaddr)
Set address of next server to use in bootstrap. |
void |
setSname(byte[] inSname)
Set optional server host name. |
void |
setXid(int inXid)
Set transaction ID. |
void |
setYiaddr(byte[] inYiaddr)
Set 'your' (client) IP address. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CLIENT_PORT
public static final int SERVER_PORT
public static java.net.InetAddress BROADCAST_ADDR
public static final int DISCOVER
public static final int OFFER
public static final int REQUEST
public static final int DECLINE
public static final int ACK
public static final int NAK
public static final int RELEASE
public static final int INFORM
Constructor Detail |
---|
public DHCPMessage()
public DHCPMessage(DHCPMessage inMessage)
public DHCPMessage(DHCPMessage inMessage, java.net.InetAddress inServername, int inPort)
public DHCPMessage(DHCPMessage inMessage, java.net.InetAddress inServername)
public DHCPMessage(java.net.InetAddress inServername, int inPort)
inServername
- the host nameinPort
- the port numberpublic DHCPMessage(java.net.InetAddress inServername)
inServername
- the host namepublic DHCPMessage(int inPort)
inPort
- the port numberpublic DHCPMessage(byte[] ibuf)
ibuf
- the byte array to initialize DHCPMessage objectpublic DHCPMessage(byte[] ibuf, java.net.InetAddress inServername, int inPort)
ibuf
- the byte array to initialize DHCPMessage objectinServername
- the hostnameinPort
- the port numberpublic DHCPMessage(byte[] ibuf, int inPort)
ibuf
- the byte array to initialize DHCPMessage objectinPort
- the port numberpublic DHCPMessage(byte[] ibuf, java.net.InetAddress inServername)
ibuf
- the byte array to initialize DHCPMessage objectinServername
- the hostnamepublic DHCPMessage(java.io.DataInputStream inStream)
Method Detail |
---|
public byte[] externalize()
public DHCPMessage internalize(byte[] ibuff)
ibuff
- byte array to convert to a DHCPMessage object
public void setOp(byte inOp)
inOp
- message Op code / message typepublic void setHtype(byte inHtype)
inHtype
- hardware address typepublic void setHlen(byte inHlen)
inHlen
- hardware address lengthpublic void setHops(byte inHops)
inHops
- hops fieldpublic void setXid(int inXid)
inXid
- transactionIDpublic void setSecs(short inSecs)
inSecs
- seconds elapsed since client began address acquisition
or renewal processpublic void setFlags(short inFlags)
inFlags
- flags fieldpublic void setCiaddr(byte[] inCiaddr)
inCiaddr
- client IP addresspublic void setYiaddr(byte[] inYiaddr)
inYiaddr
- 'your' (client) IP addresspublic void setSiaddr(byte[] inSiaddr)
inSiaddr
- address of next server to use in bootstrappublic void setGiaddr(byte[] inGiaddr)
inGiaddr
- relay agent IP addresspublic void setChaddr(byte[] inChaddr)
inChaddr
- client hardware addresspublic void setSname(byte[] inSname)
inSname
- server host namepublic void setFile(byte[] inFile)
inFile
- boot file namepublic void setPort(int inPortNum)
inPortNum
- port on message destination hostpublic void setDestinationHost(java.lang.String inHost)
inHost
- string representation of message destination IP or
hostnamepublic byte getOp()
public byte getHtype()
public byte getHlen()
public byte getHops()
public int getXid()
public short getSecs()
public short getFlags()
public byte[] getCiaddr()
public byte[] getYiaddr()
public byte[] getSiaddr()
public byte[] getGiaddr()
public byte[] getChaddr()
public byte[] getSname()
public byte[] getFile()
public byte[] getOptions()
public int getPort()
public java.lang.String getDestinationAddress()
public void setOption(int inOptNum, byte[] inOptionData)
inOptNum
- option numberinOptionData
- option datapublic byte[] getOption(int inOptNum)
inOptNum
- option numberpublic void removeOption(int inOptNum)
inOptNum
- option numberpublic boolean IsOptSet(int inOptNum)
inOptNum
- option numberpublic void printMessage()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |