Home / Function/ setIPv6() — netty Function Reference

setIPv6() — netty Function Reference

Architecture documentation for the setIPv6() function in SockaddrIn.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ebc3d1cf_f4f9_d2a3_70a0_2464309e683e["setIPv6()"]
  25164b27_46c0_d628_1986_f46b53ee8d7c["SockaddrIn"]
  ebc3d1cf_f4f9_d2a3_70a0_2464309e683e -->|defined in| 25164b27_46c0_d628_1986_f46b53ee8d7c
  2004ada0_a0c9_e64f_394d_cfe69d9ed1e3["setAddress()"]
  2004ada0_a0c9_e64f_394d_cfe69d9ed1e3 -->|calls| ebc3d1cf_f4f9_d2a3_70a0_2464309e683e
  style ebc3d1cf_f4f9_d2a3_70a0_2464309e683e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-classes-quic/src/main/java/io/netty/handler/codec/quic/SockaddrIn.java lines 106–138

    static int setIPv6(ByteBuffer memory, InetAddress address, int port) {
        int position = memory.position();
        try {
            // memset
            memory.put(SOCKADDR_IN6_EMPTY_ARRAY);

            memory.putShort(position + Quiche.SOCKADDR_IN6_OFFSETOF_SIN6_FAMILY, Quiche.AF_INET6);
            memory.putShort(position + Quiche.SOCKADDR_IN6_OFFSETOF_SIN6_PORT, (short) port);

            // Skip sin6_flowinfo as we did memset before
            byte[] bytes = address.getAddress();
            int offset = Quiche.SOCKADDR_IN6_OFFSETOF_SIN6_ADDR + Quiche.IN6_ADDRESS_OFFSETOF_S6_ADDR;

            if (bytes.length == IPV4_ADDRESS_LENGTH) {
                memory.position(position + offset);
                memory.put(IPV4_MAPPED_IPV6_PREFIX);

                memory.position(position + offset + IPV4_MAPPED_IPV6_PREFIX.length);
                memory.put(bytes, 0, IPV4_ADDRESS_LENGTH);

                // Skip sin6_scope_id as we did memset before
            } else {
                memory.position(position + offset);
                memory.put(bytes, 0, IPV6_ADDRESS_LENGTH);

                memory.putInt(position + Quiche.SOCKADDR_IN6_OFFSETOF_SIN6_SCOPE_ID,
                        ((Inet6Address) address).getScopeId());
            }
            return Quiche.SIZEOF_SOCKADDR_IN6;
        } finally {
            memory.position(position);
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does setIPv6() do?
setIPv6() is a function in the netty codebase, defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/SockaddrIn.java.
Where is setIPv6() defined?
setIPv6() is defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/SockaddrIn.java at line 106.
What calls setIPv6()?
setIPv6() is called by 1 function(s): setAddress.

Analyze Your Own Codebase

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

Try Supermodel Free