public class OPTextends Data
DNS OPT record payload for EDNS0 extensions.
Enables extended DNS features and options beyond original DNS protocol. Carries EDNS options and UDP payload size information.
See Also:
  • Field Details

    • variablePart

      public final List<EdnsOption> variablePart
      EDNS options this record carries, stored unmodifiable.
  • Constructor Details

    • OPT

      public OPT()
      Creates an OPT pseudo-record carrying no options.
    • OPT

      public OPT(List<EdnsOption> variablePart)
      Creates an OPT pseudo-record carrying the given EDNS options.
      Parameters:
      variablePart - the EDNS options this record carries, stored unmodifiable
  • Method Details

    • parse

      public static OPT parse(DataInputStream dis, int payloadLength) throws IOException
      Reads the EDNS options from a bounded stretch of the message.
      Parameters:
      dis - the stream to read the option payload from
      payloadLength - the number of option payload bytes the record declares, which bounds the reads
      Returns:
      an OPT record holding the options decoded from the stream
      Throws:
      IOException - if the stream cannot be read, or an option's declared length runs past the payload
    • getType

      public Record.TYPE getType()
      Reports this record as the OPT pseudo-record type.
      Specified by:
      getType in class Data
      Returns:
      The DNS record type of this payload.
    • serialize

      protected void serialize(DataOutputStream dos) throws IOException
      Writes each EDNS option to the wire in order.
      Specified by:
      serialize in class Data
      Parameters:
      dos - the output stream to serialize to.
      Throws:
      IOException - if an I/O error occurs.