FileDocCategorySizeDatePackage
DhcpNakPacket.javaAPI DocAndroid 5.1 API2332Thu Mar 12 22:22:10 GMT 2015android.net.dhcp

DhcpNakPacket

public class DhcpNakPacket extends DhcpPacket
This class implements the DHCP-NAK packet.

Fields Summary
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.ByteBufferbuildPacket(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 voiddoNextOp(DhcpStateMachine machine)
Notifies the specified state machine of the newly-arrived NAK packet.

        machine.onNakReceived();
    
voidfinishPacket(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.StringtoString()

        String s = super.toString();
        return s + " NAK, reason " + (mMessage == null ? "(none)" : mMessage);