Home / Class/ QuicheRecvInfo Class — netty Architecture

QuicheRecvInfo Class — netty Architecture

Architecture documentation for the QuicheRecvInfo class in QuicheRecvInfo.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3d8d10c9_ceb3_0459_966a_41df78c14ce5["QuicheRecvInfo"]
  47acf906_6371_24a2_586f_cdd9ca087d66["QuicheRecvInfo.java"]
  3d8d10c9_ceb3_0459_966a_41df78c14ce5 -->|defined in| 47acf906_6371_24a2_586f_cdd9ca087d66
  84af8c12_a984_6b80_6e36_67f325a8a536["QuicheRecvInfo()"]
  3d8d10c9_ceb3_0459_966a_41df78c14ce5 -->|method| 84af8c12_a984_6b80_6e36_67f325a8a536
  21558581_a10d_b2d8_3650_2902bc6b4c0e["setRecvInfo()"]
  3d8d10c9_ceb3_0459_966a_41df78c14ce5 -->|method| 21558581_a10d_b2d8_3650_2902bc6b4c0e
  1d46b86e_9139_e570_410a_0b442e7ea503["setAddress()"]
  3d8d10c9_ceb3_0459_966a_41df78c14ce5 -->|method| 1d46b86e_9139_e570_410a_0b442e7ea503

Relationship Graph

Source Code

codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheRecvInfo.java lines 25–75

final class QuicheRecvInfo {

    private QuicheRecvInfo() { }

    /**
     * Set the {@link InetSocketAddress} into the {@code quiche_recv_info} struct.
     *
     * <pre>
     * typedef struct {
     *     struct sockaddr *from;
     *     socklen_t from_len;
     *     struct sockaddr *to;
     *     socklen_t to_len;
     * } quiche_recv_info;
     * </pre>
     *
     * @param memory the memory of {@code quiche_recv_info}.
     * @param from the {@link InetSocketAddress} to write into {@code quiche_recv_info}.
     * @param to the {@link InetSocketAddress} to write into {@code quiche_recv_info}.
     */
    static void setRecvInfo(ByteBuffer memory, InetSocketAddress from, InetSocketAddress to) {
        int position = memory.position();
        try {
            setAddress(memory, Quiche.SIZEOF_QUICHE_RECV_INFO, Quiche.QUICHE_RECV_INFO_OFFSETOF_FROM,
                    Quiche.QUICHE_RECV_INFO_OFFSETOF_FROM_LEN, from);
            setAddress(memory, Quiche.SIZEOF_QUICHE_RECV_INFO + Quiche.SIZEOF_SOCKADDR_STORAGE,
                    Quiche.QUICHE_RECV_INFO_OFFSETOF_TO, Quiche.QUICHE_RECV_INFO_OFFSETOF_TO_LEN, to);
        } finally {
            memory.position(position);
        }
    }

    private static void setAddress(ByteBuffer memory, int socketAddressOffset, int addrOffset, int lenOffset,
                                   InetSocketAddress address) {
        int position = memory.position();
        try {
            int sockaddrPosition = position + socketAddressOffset;
            memory.position(sockaddrPosition);
            long sockaddrMemoryAddress = Quiche.memoryAddressWithPosition(memory);
            int len = SockaddrIn.setAddress(memory, address);
            if (Quiche.SIZEOF_SIZE_T == 4) {
                memory.putInt(position + addrOffset, (int) sockaddrMemoryAddress);
            } else {
                memory.putLong(position + addrOffset, sockaddrMemoryAddress);
            }
            Quiche.setPrimitiveValue(memory, position + lenOffset, Quiche.SIZEOF_SOCKLEN_T, len);
        } finally {
            memory.position(position);
        }
    }
}

Frequently Asked Questions

What is the QuicheRecvInfo class?
QuicheRecvInfo is a class in the netty codebase, defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheRecvInfo.java.
Where is QuicheRecvInfo defined?
QuicheRecvInfo is defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheRecvInfo.java at line 25.

Analyze Your Own Codebase

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

Try Supermodel Free