Home / Class/ QuicheSendInfo Class — netty Architecture

QuicheSendInfo Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  a86a4a82_8e10_67db_34b9_5c0d08a69c0c["QuicheSendInfo"]
  13a585da_feef_69cf_9164_6cde9f7e3456["QuicheSendInfo.java"]
  a86a4a82_8e10_67db_34b9_5c0d08a69c0c -->|defined in| 13a585da_feef_69cf_9164_6cde9f7e3456
  d4ebd105_9adf_179e_6289_d943854e18d9["QuicheSendInfo()"]
  a86a4a82_8e10_67db_34b9_5c0d08a69c0c -->|method| d4ebd105_9adf_179e_6289_d943854e18d9
  a6856a01_12cb_e3d7_64bc_9a5d3b9eb798["InetSocketAddress()"]
  a86a4a82_8e10_67db_34b9_5c0d08a69c0c -->|method| a6856a01_12cb_e3d7_64bc_9a5d3b9eb798
  9ddf3122_b4e8_16fd_f17c_bf5cfad3995e["getLen()"]
  a86a4a82_8e10_67db_34b9_5c0d08a69c0c -->|method| 9ddf3122_b4e8_16fd_f17c_bf5cfad3995e
  be4c0699_ef98_8432_ada6_61df49dfd801["setSendInfo()"]
  a86a4a82_8e10_67db_34b9_5c0d08a69c0c -->|method| be4c0699_ef98_8432_ada6_61df49dfd801
  27bb59f0_8eef_add2_9594_e588ea7845e7["setAddress()"]
  a86a4a82_8e10_67db_34b9_5c0d08a69c0c -->|method| 27bb59f0_8eef_add2_9594_e588ea7845e7
  3b677579_95d6_2f0b_a341_afb5efd20f55["getAtNanos()"]
  a86a4a82_8e10_67db_34b9_5c0d08a69c0c -->|method| 3b677579_95d6_2f0b_a341_afb5efd20f55
  99f3ac6a_58ec_0929_f566_58a69394a0da["isSameAddress()"]
  a86a4a82_8e10_67db_34b9_5c0d08a69c0c -->|method| 99f3ac6a_58ec_0929_f566_58a69394a0da

Relationship Graph

Source Code

codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheSendInfo.java lines 28–171

final class QuicheSendInfo {

    private static final FastThreadLocal<byte[]> IPV4_ARRAYS = new FastThreadLocal<byte[]>() {
        @Override
        protected byte[] initialValue() {
            return new byte[SockaddrIn.IPV4_ADDRESS_LENGTH];
        }
    };

    private static final FastThreadLocal<byte[]> IPV6_ARRAYS = new FastThreadLocal<byte[]>() {
        @Override
        protected byte[] initialValue() {
            return new byte[SockaddrIn.IPV6_ADDRESS_LENGTH];
        }
    };

    private static final byte[] TIMESPEC_ZEROOUT = new byte[Quiche.SIZEOF_TIMESPEC];

    private QuicheSendInfo() { }

    /**
     * Get the {@link InetSocketAddress} out of the {@code quiche_send_info} struct.
     *
     * @param memory the memory of {@code quiche_send_info}.
     * @return the address that was read.
     */
    @Nullable
    static InetSocketAddress getToAddress(ByteBuffer memory) {
        return getAddress(memory, Quiche.QUICHE_SEND_INFO_OFFSETOF_TO_LEN, Quiche.QUICHE_SEND_INFO_OFFSETOF_TO);
    }

    @Nullable
    static InetSocketAddress getFromAddress(ByteBuffer memory) {
       return getAddress(memory, Quiche.QUICHE_SEND_INFO_OFFSETOF_FROM_LEN, Quiche.QUICHE_SEND_INFO_OFFSETOF_FROM);
    }

    @Nullable
    private static InetSocketAddress getAddress(ByteBuffer memory, int lenOffset, int addressOffset) {
        int position = memory.position();
        try {
            long len = getLen(memory, position + lenOffset);

            memory.position(position + addressOffset);

            if (len == Quiche.SIZEOF_SOCKADDR_IN) {
                return SockaddrIn.getIPv4(memory, IPV4_ARRAYS.get());
            }
            assert len == Quiche.SIZEOF_SOCKADDR_IN6;
            return SockaddrIn.getIPv6(memory, IPV6_ARRAYS.get(), IPV4_ARRAYS.get());
        } finally {
            memory.position(position);
        }
    }

    private static long getLen(ByteBuffer memory, int index) {
        return Quiche.getPrimitiveValue(memory, index, Quiche.SIZEOF_SOCKLEN_T);
    }

    /**
     * Set the {@link InetSocketAddress} into the {@code quiche_send_info} struct.
     * <pre>
     *
     * typedef struct {
     *     // The local address the packet should be sent from.
     *     struct sockaddr_storage from;
     *     socklen_t from_len;
     *
     *     // The address the packet should be sent to.
     *     struct sockaddr_storage to;
     *     socklen_t to_len;
     *
     *     // The time to send the packet out.
     *     struct timespec at;
     * } quiche_send_info;
     * </pre>
     *
     * @param memory the memory of {@code quiche_send_info}.
     * @param from the {@link InetSocketAddress} to write into {@code quiche_send_info}.
     * @param to the {@link InetSocketAddress} to write into {@code quiche_send_info}.
     */
    static void setSendInfo(ByteBuffer memory, InetSocketAddress from, InetSocketAddress to) {

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free