OPTRecord (dnsjava documentation)
Date: 2013-04-10

org.xbill.DNS

## Class OPTRecord

- java.lang.Object
- - org.xbill.DNS.Record
  - - org.xbill.DNS.OPTRecord

- All Implemented Interfaces:
    Serializable, Cloneable, Comparable

      public class OPTRecord
      extends Record

  Options - describes Extended DNS (EDNS) properties of a Message. No specific options are defined other than those specified in the header. An OPT should be generated by Resolver. EDNS is a method to extend the DNS protocol while providing backwards compatibility and not significantly changing the protocol. This implementation of EDNS is mostly complete at level 0.
  Author:
    Brian Wellington
  See Also:
    `Message`, `Resolver`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.xbill.DNS.Record

      `dclass, name, ttl, type`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OPTRecord(int payloadSize, int xrcode, int version)` Creates an OPT Record with no data.
    `OPTRecord(int payloadSize, int xrcode, int version, int flags)` Creates an OPT Record with no data.
    `OPTRecord(int payloadSize, int xrcode, int version, int flags, List options)` Creates an OPT Record.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getExtendedRcode()` Returns the extended Rcode
    `int` | `getFlags()` Returns the EDNS flags
    `List` | `getOptions()` Gets all options in the OPTRecord.
    `List` | `getOptions(int code)` Gets all options in the OPTRecord with a specific code.
    `int` | `getPayloadSize()` Returns the maximum allowed payload size.
    `int` | `getVersion()` Returns the highest supported EDNS version

    - ### Methods inherited from class org.xbill.DNS.Record

      `byteArrayFromString, byteArrayToString, compareTo, equals, fromString, fromString, fromWire, getAdditionalName, getDClass, getName, getRRsetType, getTTL, getType, hashCode, newRecord, newRecord, newRecord, newRecord, rdataToString, rdataToWireCanonical, sameRRset, toString, toWire, toWireCanonical, unknownToString, withName`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### OPTRecord

          public OPTRecord(int payloadSize,
                   int xrcode,
                   int version,
                   int flags,
                   List options)

      Creates an OPT Record. This is normally called by SimpleResolver, but can also be called by a server.
      Parameters:
        `payloadSize` - The size of a packet that can be reassembled on the sending host.
        `xrcode` - The value of the extended rcode field. This is the upper 16 bits of the full rcode.
        `flags` - Additional message flags.
        `version` - The EDNS version that this DNS implementation supports. This should be 0 for dnsjava.
        `options` - The list of options that comprise the data field. There are currently no defined options.
      See Also:
        `ExtendedFlags`

    - #### OPTRecord

          public OPTRecord(int payloadSize,
                   int xrcode,
                   int version,
                   int flags)

      Creates an OPT Record with no data. This is normally called by SimpleResolver, but can also be called by a server.
      Parameters:
        `payloadSize` - The size of a packet that can be reassembled on the sending host.
        `xrcode` - The value of the extended rcode field. This is the upper 16 bits of the full rcode.
        `flags` - Additional message flags.
        `version` - The EDNS version that this DNS implementation supports. This should be 0 for dnsjava.
      See Also:
        `ExtendedFlags`

    - #### OPTRecord

          public OPTRecord(int payloadSize,
                   int xrcode,
                   int version)

      Creates an OPT Record with no data. This is normally called by SimpleResolver, but can also be called by a server.

  - ### Method Detail

    - #### getPayloadSize

          public int getPayloadSize()

      Returns the maximum allowed payload size.

    - #### getExtendedRcode

          public int getExtendedRcode()

      Returns the extended Rcode
      See Also:
        `Rcode`

    - #### getVersion

          public int getVersion()

      Returns the highest supported EDNS version

    - #### getFlags

          public int getFlags()

      Returns the EDNS flags

    - #### getOptions

          public List getOptions()

      Gets all options in the OPTRecord. This returns a list of EDNSOptions.

    - #### getOptions

          public List getOptions(int code)

      Gets all options in the OPTRecord with a specific code. This returns a list of EDNSOptions.