com.h3c.util.pkt

## Class Ip.Builder

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

- Enclosing class:
    Ip

      public static class Ip.Builder
      extends Object

  Builder (mutable) used to create new protocol instances.

- - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Ip` | `build()` Creates a new protocol instance from this builder.
    `Ip.Builder` | `doNotFrag(boolean doNotFrag)` Sets the flag to not fragment this packet.
    `Ip.Builder` | `dstAddr(IpAddress dstAddr)` Sets the destination address.
    `Ip.Builder` | `fragOffset(int fragOffset)` Sets the fragment offset.
    `Ip.Builder` | `ident(int ident)` Sets the identifier value assigned by the sender.
    `Ip.Builder` | `moreFragToCome(boolean moreFragToCome)` Sets the flag to indicate that more fragments are coming.
    `Ip.Builder` | `options(byte[] options)` Sets the options bytes.
    `Ip.Builder` | `srcAddr(IpAddress srcAddr)` Sets the source address.
    `Ip.Builder` | `tosDsfc(IpTosDsfc tosDsfc)` Sets the TOS Differentiated Services Field Codepoints (DSFC) type.
    `Ip.Builder` | `tosEcn(IpTosEcn tosEcn)` Sets the TOS Explicit Congestion Notification (ECN) type.
    `Ip.Builder` | `ttl(int ttl)` Sets the time to live seconds.
    `Ip.Builder` | `type(IpType type)` Sets the protocol type.

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

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

- - ### Constructor Detail

    - #### Ip.Builder

          public Ip.Builder()

      Create a new builder using the defaults:

           tosDsfc = CS0
           tosEcn = NOT_ECT
           ident = 0
           doNotFrag = false
           moreFragToCome = false
           fragOffset = 0
           ttl = 0
           type = null
           options = EMPTY_BYTES

    - #### Ip.Builder

          public Ip.Builder(Ip ip)

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

  - ### Method Detail

    - #### build

          public Ip build()

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

    - #### ident

          public Ip.Builder ident(int ident)

      Sets the identifier value assigned by the sender.
      Parameters:
        `ident` - identifier value
      Returns:
        this instance

    - #### tosDsfc

          public Ip.Builder tosDsfc(IpTosDsfc tosDsfc)

      Sets the TOS Differentiated Services Field Codepoints (DSFC) type.
      Parameters:
        `tosDsfc` - TOS DSFC type
      Returns:
        this instance

    - #### tosEcn

          public Ip.Builder tosEcn(IpTosEcn tosEcn)

      Sets the TOS Explicit Congestion Notification (ECN) type.
      Parameters:
        `tosEcn` - TOS ECN type
      Returns:
        this instance

    - #### fragOffset

          public Ip.Builder fragOffset(int fragOffset)

      Sets the fragment offset.
      Parameters:
        `fragOffset` - fragment offset
      Returns:
        this instance

    - #### doNotFrag

          public Ip.Builder doNotFrag(boolean doNotFrag)

      Sets the flag to not fragment this packet.
      Parameters:
        `doNotFrag` - do not fragment
      Returns:
        this instance

    - #### moreFragToCome

          public Ip.Builder moreFragToCome(boolean moreFragToCome)

      Sets the flag to indicate that more fragments are coming.
      Parameters:
        `moreFragToCome` - if true, more fragments are coming
      Returns:
        this instance

    - #### ttl

          public Ip.Builder ttl(int ttl)

      Sets the time to live seconds.
      Parameters:
        `ttl` - time to live seconds
      Returns:
        this instance

    - #### type

          public Ip.Builder type(IpType type)

      Sets the protocol type.
      Parameters:
        `type` - protocol type
      Returns:
        this instance

    - #### srcAddr

          public Ip.Builder srcAddr(IpAddress srcAddr)

      Sets the source address.
      Parameters:
        `srcAddr` - source address
      Returns:
        this instance

    - #### dstAddr

          public Ip.Builder dstAddr(IpAddress dstAddr)

      Sets the destination address.
      Parameters:
        `dstAddr` - destination address
      Returns:
        this instance

    - #### options

          public Ip.Builder options(byte[] options)

      Sets the options bytes.
      Parameters:
        `options` - encoded option bytes
      Returns:
        this instance

Copyright © 2014. All Rights Reserved.