Home / Function/ encodeHeader() — netty Function Reference

encodeHeader() — netty Function Reference

Architecture documentation for the encodeHeader() function in DnsMessageUtil.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  817828cc_8174_4b1f_8564_cd7dc7f940cb["encodeHeader()"]
  712b890c_041c_4773_effc_f02cf18d95ab["DnsMessageUtil"]
  817828cc_8174_4b1f_8564_cd7dc7f940cb -->|defined in| 712b890c_041c_4773_effc_f02cf18d95ab
  81c7302a_7757_476b_d624_a430b8ea1329["encodeDnsResponse()"]
  81c7302a_7757_476b_d624_a430b8ea1329 -->|calls| 817828cc_8174_4b1f_8564_cd7dc7f940cb
  style 817828cc_8174_4b1f_8564_cd7dc7f940cb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-dns/src/main/java/io/netty/handler/codec/dns/DnsMessageUtil.java lines 258–281

    private static void encodeHeader(DnsResponse response, ByteBuf buf) {
        buf.writeShort(response.id());
        int flags = 32768;
        flags |= (response.opCode().byteValue() & 0xFF) << 11;
        if (response.isAuthoritativeAnswer()) {
            flags |= 1 << 10;
        }
        if (response.isTruncated()) {
            flags |= 1 << 9;
        }
        if (response.isRecursionDesired()) {
            flags |= 1 << 8;
        }
        if (response.isRecursionAvailable()) {
            flags |= 1 << 7;
        }
        flags |= response.z() << 4;
        flags |= response.code().intValue();
        buf.writeShort(flags);
        buf.writeShort(response.count(DnsSection.QUESTION));
        buf.writeShort(response.count(DnsSection.ANSWER));
        buf.writeShort(response.count(DnsSection.AUTHORITY));
        buf.writeShort(response.count(DnsSection.ADDITIONAL));
    }

Subdomains

Frequently Asked Questions

What does encodeHeader() do?
encodeHeader() is a function in the netty codebase, defined in codec-dns/src/main/java/io/netty/handler/codec/dns/DnsMessageUtil.java.
Where is encodeHeader() defined?
encodeHeader() is defined in codec-dns/src/main/java/io/netty/handler/codec/dns/DnsMessageUtil.java at line 258.
What calls encodeHeader()?
encodeHeader() is called by 1 function(s): encodeDnsResponse.

Analyze Your Own Codebase

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

Try Supermodel Free