FileDocCategorySizeDatePackage
DhcpDiscoverPacket.javaAPI DocAndroid 5.1 API2315Thu Mar 12 22:22:10 GMT 2015android.net.dhcp

DhcpDiscoverPacket

public class DhcpDiscoverPacket extends DhcpPacket
This class implements the DHCP-DISCOVER packet.

Fields Summary
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.ByteBufferbuildPacket(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 voiddoNextOp(DhcpStateMachine machine)
Informs the state machine of the arrival of a DISCOVER packet.

        // currently omitted: host name
        machine.onDiscoverReceived(mBroadcast, mTransId, mClientMac,
            mRequestedParams);
    
voidfinishPacket(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.StringtoString()

        String s = super.toString();
        return s + " DISCOVER " +
                (mBroadcast ? "broadcast " : "unicast ");