public class NSECextends Data
DNS NSEC (Next Secure) record payload for DNSSEC.
Provides authenticated denial of existence for DNS records and links to the next valid name in the zone.
  • Field Details

    • LOGGER

      private static final Logger LOGGER
      Logger for this class.
    • next

      public final DnsName next
      The next owner name that contains a authoritative data or a delegation point.
    • typeBitmap

      private final byte[] typeBitmap
      the type bitmap
    • types

      public final List<Record.TYPE> types
      The RR types existing at the owner name.
  • Constructor Details

    • NSEC

      public NSEC(String next, List<Record.TYPE> types)
      Builds a record from a textual next owner name and its type list.
      Parameters:
      next - the next owner name, as a textual DNS name
      types - the RR types present at the owner name
    • NSEC

      public NSEC(String next, Record.TYPE... types)
      Builds a record from a textual next owner name and its types.
      Parameters:
      next - the next owner name, as a textual DNS name
      types - the RR types present at the owner name
    • NSEC

      public NSEC(DnsName next, List<Record.TYPE> types)
      Builds a record from a next owner name and its type list.
      Parameters:
      next - the next owner name
      types - the RR types present at the owner name
  • Method Details

    • parse

      public static NSEC parse(DataInputStream dis, byte[] data, int length) throws IOException
      Reads a record from the wire, deriving the type bitmap length from the payload.
      Parameters:
      dis - the stream positioned at the start of the record payload
      data - the buffer backing the whole record, used to parse the next owner name
      length - the payload length in bytes
      Returns:
      the parsed record
      Throws:
      IOException - if length is shorter than the next owner name, or if the type bitmap is truncated
    • getType

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

      public void serialize(DataOutputStream dos) throws IOException
      Writes the next owner name and type bitmap to the stream.
      Specified by:
      serialize in class Data
      Parameters:
      dos - the output stream to serialize to.
      Throws:
      IOException - if an I/O error occurs.
    • toString

      public String toString()
      Renders the next owner name followed by its type list.
      Overrides:
      toString in class Object
    • createTypeBitMap

      static byte[] createTypeBitMap(List<Record.TYPE> types)
      Create type bitmap
      Parameters:
      types - the RR types to encode, sorted into window blocks internally
      Returns:
      the bitmap in RFC 4034 window block form
    • writeOutBlock

      private static void writeOutBlock(byte[] values, DataOutputStream dos) throws IOException
      Writes the block, stopping after its last non-zero byte.
      Parameters:
      values - the block's bytes
      dos - where to write
      Throws:
      IOException - if the write fails
    • readTypeBitMap

      static List<Record.TYPE> readTypeBitMap(byte[] typeBitmap) throws IOException
      Read type bitmap
      Parameters:
      typeBitmap - the bitmap in RFC 4034 window block form
      Returns:
      the RR types it sets, with unknown types logged and skipped
      Throws:
      IOException - if the window blocks end before their declared bitmap bytes