com.h3c.util.pkt

## Class Dhcp.Builder

- java.lang.Object
- - com.h3c.util.pkt.Dhcp.Builder

- Enclosing class:
    Dhcp

      public static class Dhcp.Builder
      extends Object

  Builder (mutable) used to create new protocol instances.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Dhcp.Builder()` Create a new builder using the defaults:
    `Dhcp.Builder(Dhcp dhcp)` Copy constructor builder initialized from the passed in protocol.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Dhcp.Builder` | `bootFileName(String bootFileName)` Sets the boot file name.
    `Dhcp` | `build()` Creates a new protocol instance from this builder.
    `Dhcp.Builder` | `clientAddr(IpAddress clientAddr)` Sets the client IP address.
    `Dhcp.Builder` | `clientHwAddr(MacAddress clientHwAddr)` Sets the client layer-2 hardware address.
    `Dhcp.Builder` | `flag(Dhcp.Flag flag)` Sets the `Dhcp.Flag.BROADCAST` or `Dhcp.Flag.UNICAST` (default) type.
    `Dhcp.Builder` | `gatewayAddr(IpAddress gatewayAddr)` Sets the gateway IP address.
    `Dhcp.Builder` | `hopCount(int hopCount)` Sets the hop count.
    `Dhcp.Builder` | `hwType(HardwareType hwType)` Sets the hardware type.
    `Dhcp.Builder` | `numSecs(int numSecs)` Sets the number of seconds elapsed since a client began an attempt to acquire or renew a lease.
    `Dhcp.Builder` | `opCode(Dhcp.OpCode opCode)` Sets the operation code.
    `Dhcp.Builder` | `options(DhcpOption[] options)` Sets the options array.
    `Dhcp.Builder` | `serverAddr(IpAddress serverAddr)` Sets the server IP address.
    `Dhcp.Builder` | `serverHostName(String serverHostName)` Sets the server host name (nickname).
    `Dhcp.Builder` | `transId(long transId)` Sets the transaction ID which is a 32-bit identification field generated by the client to allow it to match up requests with replies.
    `Dhcp.Builder` | `yourAddr(IpAddress yourAddr)` Sets the "Your" IP address which is the IP address that the server is assigning to the client.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Dhcp.Builder

          public Dhcp.Builder()

      Create a new builder using the defaults:

           opCode = BOOT_REQ
           hwType = ETHERNET
           flag = UNICAST
           serverHostName = EMPTY
           bootFileName = EMPTY
           options = NO_OPTIONS

    - #### Dhcp.Builder

          public Dhcp.Builder(Dhcp dhcp)

      Copy constructor builder initialized from the passed in protocol.
      Parameters:
        `dhcp` - builder is initialed from this protocol's data

  - ### Method Detail

    - #### build

          public Dhcp build()

      Creates a new protocol instance from this builder.
      Returns:
        the new protocol instance

    - #### opCode

          public Dhcp.Builder opCode(Dhcp.OpCode opCode)

      Sets the operation code.
      Parameters:
        `opCode` - operation code enumeration
      Returns:
        this instance

    - #### hwType

          public Dhcp.Builder hwType(HardwareType hwType)

      Sets the hardware type.
      Parameters:
        `hwType` - hardware type enumeration
      Returns:
        this instance

    - #### hopCount

          public Dhcp.Builder hopCount(int hopCount)

      Sets the hop count.
      Parameters:
        `hopCount` - hop count
      Returns:
        this instance

    - #### transId

          public Dhcp.Builder transId(long transId)

      Sets the transaction ID which is a 32-bit identification field generated by the client to allow it to match up requests with replies.
      Parameters:
        `transId` - transaction ID
      Returns:
        this instance

    - #### numSecs

          public Dhcp.Builder numSecs(int numSecs)

      Sets the number of seconds elapsed since a client began an attempt to acquire or renew a lease.
      Parameters:
        `numSecs` - number of seconds
      Returns:
        this instance

    - #### flag

          public Dhcp.Builder flag(Dhcp.Flag flag)

      Sets the `Dhcp.Flag.BROADCAST` or `Dhcp.Flag.UNICAST` (default) type.
      Parameters:
        `flag` - broadcast or unicast
      Returns:
        this instance

    - #### clientAddr

          public Dhcp.Builder clientAddr(IpAddress clientAddr)

      Sets the client IP address. The client puts its own current IP address in this field if and only if it has a valid IP address.
      Parameters:
        `clientAddr` - client IP address
      Returns:
        this instance

    - #### yourAddr

          public Dhcp.Builder yourAddr(IpAddress yourAddr)

      Sets the "Your" IP address which is the IP address that the server is assigning to the client.
      Parameters:
        `yourAddr` - "Your" IP address
      Returns:
        this instance

    - #### serverAddr

          public Dhcp.Builder serverAddr(IpAddress serverAddr)

      Sets the server IP address. This is the address of the server that the client should use for the next step in the bootstrap process.
      Parameters:
        `serverAddr` - server IP address
      Returns:
        this instance

    - #### gatewayAddr

          public Dhcp.Builder gatewayAddr(IpAddress gatewayAddr)

      Sets the gateway IP address. This address used to route messages when relay agents are involved to facilitate communication between subnets.
      Parameters:
        `gatewayAddr` - gateway IP address
      Returns:
        this instance

    - #### clientHwAddr

          public Dhcp.Builder clientHwAddr(MacAddress clientHwAddr)

      Sets the client layer-2 hardware address.
      Parameters:
        `clientHwAddr` - client hardware address
      Returns:
        this instance

    - #### serverHostName

          public Dhcp.Builder serverHostName(String serverHostName)

      Sets the server host name (nickname).
      Parameters:
        `serverHostName` - server host name
      Returns:
        this instance

    - #### bootFileName

          public Dhcp.Builder bootFileName(String bootFileName)

      Sets the boot file name.
      Parameters:
        `bootFileName` - boot file name
      Returns:
        this instance

    - #### options

          public Dhcp.Builder options(DhcpOption[] options)

      Sets the options array.
      Parameters:
        `options` - array of options
      Returns:
        this instance

Copyright © 2014. All Rights Reserved.