Home / Function/ DnsResponse() — netty Function Reference

DnsResponse() — netty Function Reference

Architecture documentation for the DnsResponse() function in DnsResponseDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  200ea77b_0329_96bf_cdf6_5b84187a1993["DnsResponse()"]
  b4477e00_485f_d1b0_e814_416dcbb42b0f["DnsResponseDecoder"]
  200ea77b_0329_96bf_cdf6_5b84187a1993 -->|defined in| b4477e00_485f_d1b0_e814_416dcbb42b0f
  8627d2c9_0e00_24db_49db_4ff1527098fa["decodeQuestions()"]
  200ea77b_0329_96bf_cdf6_5b84187a1993 -->|calls| 8627d2c9_0e00_24db_49db_4ff1527098fa
  bdfca86f_0ca1_14e1_12e8_42bfd4ed6746["decodeRecords()"]
  200ea77b_0329_96bf_cdf6_5b84187a1993 -->|calls| bdfca86f_0ca1_14e1_12e8_42bfd4ed6746
  style 200ea77b_0329_96bf_cdf6_5b84187a1993 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-dns/src/main/java/io/netty/handler/codec/dns/DnsResponseDecoder.java lines 36–81

    final DnsResponse decode(A sender, A recipient, ByteBuf buffer) throws Exception {
        final int id = buffer.readUnsignedShort();

        final int flags = buffer.readUnsignedShort();
        if (flags >> 15 == 0) {
            throw new CorruptedFrameException("not a response");
        }

        final DnsResponse response = newResponse(
                sender,
                recipient,
                id,
                DnsOpCode.valueOf((byte) (flags >> 11 & 0xf)), DnsResponseCode.valueOf((byte) (flags & 0xf)));

        response.setRecursionDesired((flags >> 8 & 1) == 1);
        response.setAuthoritativeAnswer((flags >> 10 & 1) == 1);
        response.setTruncated((flags >> 9 & 1) == 1);
        response.setRecursionAvailable((flags >> 7 & 1) == 1);
        response.setZ(flags >> 4 & 0x7);

        boolean success = false;
        try {
            final int questionCount = buffer.readUnsignedShort();
            final int answerCount = buffer.readUnsignedShort();
            final int authorityRecordCount = buffer.readUnsignedShort();
            final int additionalRecordCount = buffer.readUnsignedShort();

            decodeQuestions(response, buffer, questionCount);
            if (!decodeRecords(response, DnsSection.ANSWER, buffer, answerCount)) {
                success = true;
                return response;
            }
            if (!decodeRecords(response, DnsSection.AUTHORITY, buffer, authorityRecordCount)) {
                success = true;
                return response;
            }

            decodeRecords(response, DnsSection.ADDITIONAL, buffer, additionalRecordCount);
            success = true;
            return response;
        } finally {
            if (!success) {
                response.release();
            }
        }
    }

Subdomains

Frequently Asked Questions

What does DnsResponse() do?
DnsResponse() is a function in the netty codebase, defined in codec-dns/src/main/java/io/netty/handler/codec/dns/DnsResponseDecoder.java.
Where is DnsResponse() defined?
DnsResponse() is defined in codec-dns/src/main/java/io/netty/handler/codec/dns/DnsResponseDecoder.java at line 36.
What does DnsResponse() call?
DnsResponse() calls 2 function(s): decodeQuestions, decodeRecords.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free