Class DefaultDnsRecordDecoder

    • Constructor Detail

      • DefaultDnsRecordDecoder

        protected DefaultDnsRecordDecoder()
        Creates a new instance.
    • Method Detail

      • decodeRecord

        public final <T extends DnsRecord> T decodeRecord​(BufferAllocator allocator,
                                                          Buffer in)
                                                   throws Exception
        Description copied from interface: DnsRecordDecoder
        Decodes a DNS record into its object representation.
        Specified by:
        decodeRecord in interface DnsRecordDecoder
        in - the input buffer which contains a DNS record at its reader index
        Returns:
        the decoded record, or null if there are not enough data in the input buffer
        Throws:
        Exception
      • decodeRecord

        protected DnsRecord decodeRecord​(String name,
                                         DnsRecordType type,
                                         int dnsClass,
                                         long timeToLive,
                                         BufferAllocator allocator,
                                         Buffer in,
                                         int offset,
                                         int length)
                                  throws Exception
        Decodes a record from the information decoded so far by DnsRecordDecoder.decodeRecord(BufferAllocator, Buffer).
        Parameters:
        name - the domain name of the record
        type - the type of the record
        dnsClass - the class of the record
        timeToLive - the TTL of the record
        in - the Buffer that contains the RDATA
        offset - the start offset of the RDATA in in
        length - the length of the RDATA
        Returns:
        a DnsRawRecord. Override this method to decode RDATA and return other record implementation.
        Throws:
        Exception
      • decodeName0

        protected String decodeName0​(Buffer in)
        Retrieves a domain name given a buffer containing a DNS packet. If the name contains a pointer, the position of the buffer will be set to directly after the pointer's index after the name has been read.
        Parameters:
        in - the byte buffer containing the DNS packet
        Returns:
        the domain name for an entry
      • decodeName

        public static String decodeName​(Buffer in)
        Retrieves a domain name given a buffer containing a DNS packet. If the name contains a pointer, the position of the buffer will be set to directly after the pointer's index after the name has been read.
        Parameters:
        in - the byte buffer containing the DNS packet
        Returns:
        the domain name for an entry