Package org.xbill.DNS

Class OPTRecord

java.lang.Object
org.xbill.DNS.Record
org.xbill.DNS.OPTRecord
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Record>

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:
  • Constructor Details

    • OPTRecord

      public OPTRecord(int payloadSize, int xrcode, int version, int flags, EDNSOption... 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.
      version - The EDNS version that this DNS implementation supports. This should be 0 for dnsjava.
      flags - Additional message flags.
      options - The options that comprise the data field.
      See Also:
    • OPTRecord

      public OPTRecord(int payloadSize, int xrcode, int version, int flags, List<EDNSOption> 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.
      version - The EDNS version that this DNS implementation supports. This should be 0 for dnsjava.
      flags - Additional message flags.
      options - The list of options that comprise the data field.
      See Also:
    • 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.
      version - The EDNS version that this DNS implementation supports. This should be 0 for dnsjava.
      flags - Additional message flags.
      See Also:
    • 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 Details

    • rrFromWire

      protected void rrFromWire(DNSInput in) throws IOException
      Description copied from class: Record
      Converts the type-specific RR to wire format - must be overridden
      Specified by:
      rrFromWire in class Record
      Throws:
      IOException
    • rdataFromString

      protected void rdataFromString(Tokenizer st, Name origin) throws IOException
      Description copied from class: Record
      Converts the text format of an RR to the internal format - must be overriden
      Specified by:
      rdataFromString in class Record
      Throws:
      IOException
    • rrToString

      protected String rrToString()
      Converts rdata to a String
      Specified by:
      rrToString in class Record
    • toString

      public String toString()
      Converts this record to a String representation
      Overrides:
      toString in class Record
    • getPayloadSize

      public int getPayloadSize()
      Returns the maximum allowed payload size.
    • getExtendedRcode

      public int getExtendedRcode()
      Returns the extended Rcode
      See Also:
    • getVersion

      public int getVersion()
      Returns the highest supported EDNS version
    • getFlags

      public int getFlags()
      Returns the EDNS flags
    • rrToWire

      protected void rrToWire(DNSOutput out, Compression c, boolean canonical)
      Description copied from class: Record
      Converts the type-specific RR to wire format - must be overridden.
      Specified by:
      rrToWire in class Record
    • getOptions

      public List<EDNSOption> getOptions()
      Gets all options in the OPTRecord. This returns a list of EDNSOptions.
    • getOptions

      public List<EDNSOption> getOptions(int code)
      Gets all options in the OPTRecord with a specific code. This returns a list of EDNSOptions.
    • equals

      public boolean equals(Object arg)
      Determines if two OPTRecords are identical. This compares the name, type, class, and rdata (with names canonicalized). Additionally, because TTLs are relevant for OPT records, the TTLs are compared.
      Overrides:
      equals in class Record
      Parameters:
      arg - The record to compare to
      Returns:
      true if the records are equal, false otherwise.
    • hashCode

      public int hashCode()
      Description copied from class: Record
      Generates a hash code based on the Record's data.
      Overrides:
      hashCode in class Record