DhcpNakPacketpublic class DhcpNakPacket extends DhcpPacket This class implements the DHCP-NAK packet. |
Constructors Summary |
---|
DhcpNakPacket(int transId, InetAddress clientIp, InetAddress yourIp, InetAddress nextIp, InetAddress relayIp, byte[] clientMac)Generates a NAK packet with the specified parameters.
super(transId, Inet4Address.ANY, Inet4Address.ANY, nextIp, relayIp,
clientMac, false);
|
Methods Summary |
---|
public java.nio.ByteBuffer | buildPacket(int encap, short destUdp, short srcUdp)Fills in a packet with the requested NAK attributes.
ByteBuffer result = ByteBuffer.allocate(MAX_LENGTH);
InetAddress destIp = mClientIp;
InetAddress srcIp = mYourIp;
fillInPacket(encap, destIp, srcIp, destUdp, srcUdp, result,
DHCP_BOOTREPLY, mBroadcast);
result.flip();
return result;
| public void | doNextOp(DhcpStateMachine machine)Notifies the specified state machine of the newly-arrived NAK packet.
machine.onNakReceived();
| void | finishPacket(java.nio.ByteBuffer buffer)Adds the optional parameters to the client-generated NAK packet.
addTlv(buffer, DHCP_MESSAGE_TYPE, DHCP_MESSAGE_TYPE_NAK);
addTlv(buffer, DHCP_SERVER_IDENTIFIER, mServerIdentifier);
addTlv(buffer, DHCP_MESSAGE, mMessage);
addTlvEnd(buffer);
| public java.lang.String | toString()
String s = super.toString();
return s + " NAK, reason " + (mMessage == null ? "(none)" : mMessage);
|
|