DhcpDiscoverPacketpublic class DhcpDiscoverPacket extends DhcpPacket This class implements the DHCP-DISCOVER packet. |
Constructors Summary |
---|
DhcpDiscoverPacket(int transId, byte[] clientMac, boolean broadcast)Generates a DISCOVER packet with the specified parameters.
super(transId, Inet4Address.ANY, Inet4Address.ANY, Inet4Address.ANY,
Inet4Address.ANY, clientMac, broadcast);
|
Methods Summary |
---|
public java.nio.ByteBuffer | buildPacket(int encap, short destUdp, short srcUdp)Fills in a packet with the requested DISCOVER parameters.
ByteBuffer result = ByteBuffer.allocate(MAX_LENGTH);
InetAddress destIp = Inet4Address.ALL;
fillInPacket(encap, Inet4Address.ALL, Inet4Address.ANY, destUdp, srcUdp,
result, DHCP_BOOTREQUEST, true);
result.flip();
return result;
| public void | doNextOp(DhcpStateMachine machine)Informs the state machine of the arrival of a DISCOVER packet.
// currently omitted: host name
machine.onDiscoverReceived(mBroadcast, mTransId, mClientMac,
mRequestedParams);
| void | finishPacket(java.nio.ByteBuffer buffer)Adds optional parameters to a DISCOVER packet.
addTlv(buffer, DHCP_MESSAGE_TYPE, DHCP_MESSAGE_TYPE_DISCOVER);
addTlv(buffer, DHCP_PARAMETER_LIST, mRequestedParams);
addTlvEnd(buffer);
| public java.lang.String | toString()
String s = super.toString();
return s + " DISCOVER " +
(mBroadcast ? "broadcast " : "unicast ");
|
|