Home / Class/ Http3CodecUtils Class — netty Architecture

Http3CodecUtils Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  2d36ae1b_0899_d9aa_9040_95c1421cfa14["Http3CodecUtils"]
  f21bfc17_5367_cfd8_5bb1_b4d20e72634c["Http3CodecUtils.java"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|defined in| f21bfc17_5367_cfd8_5bb1_b4d20e72634c
  6dd8f3b8_ca03_18c2_0894_5c81c24adcf3["Http3CodecUtils()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 6dd8f3b8_ca03_18c2_0894_5c81c24adcf3
  ec4146be_4e83_f8d5_638a_b5591522f84f["checkIsReservedFrameType()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| ec4146be_4e83_f8d5_638a_b5591522f84f
  55e3af5c_f426_e333_9892_91c67aca4f0f["isReservedFrameType()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 55e3af5c_f426_e333_9892_91c67aca4f0f
  165e36ed_e7aa_7070_538d_5da300cc9451["isServerInitiatedQuicStream()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 165e36ed_e7aa_7070_538d_5da300cc9451
  67991726_8712_7d19_6681_177b4069228b["isReservedHttp2FrameType()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 67991726_8712_7d19_6681_177b4069228b
  e25946df_7289_7c6d_6ef3_734f0510b83e["isReservedHttp2Setting()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| e25946df_7289_7c6d_6ef3_734f0510b83e
  94a67ebd_2b78_3b76_f061_1f528f5902be["numBytesForVariableLengthInteger()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 94a67ebd_2b78_3b76_f061_1f528f5902be
  3a9e2974_48e7_ecdd_a4da_fc9a981d13dd["writeVariableLengthInteger()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 3a9e2974_48e7_ecdd_a4da_fc9a981d13dd
  9db4098b_e129_9a7d_b453_62b201fbb00a["encodeLengthIntoBuffer()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 9db4098b_e129_9a7d_b453_62b201fbb00a
  253fd570_9b76_c6bb_6cd5_3681f8ea127e["readVariableLengthInteger()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 253fd570_9b76_c6bb_6cd5_3681f8ea127e
  8dff0eed_dbab_de6c_266d_5cdffb7e0593["criticalStreamClosed()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 8dff0eed_dbab_de6c_266d_5cdffb7e0593
  8d1cb03b_de14_d2f0_ab35_48ea3942bd41["connectionError()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 8d1cb03b_de14_d2f0_ab35_48ea3942bd41
  592bc48f_b1d5_9600_0f99_f0f246571ec7["closeOnFailure()"]
  2d36ae1b_0899_d9aa_9040_95c1421cfa14 -->|method| 592bc48f_b1d5_9600_0f99_f0f246571ec7

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/Http3CodecUtils.java lines 35–325

final class Http3CodecUtils {

    // See https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2.8
    static final long MIN_RESERVED_FRAME_TYPE = 0x1f * 1 + 0x21;
    static final long MAX_RESERVED_FRAME_TYPE = 0x1f * (long) Integer.MAX_VALUE + 0x21;

    // See https://tools.ietf.org/html/draft-ietf-quic-http-32#section-7.2
    static final int HTTP3_DATA_FRAME_TYPE = 0x0;
    static final int HTTP3_HEADERS_FRAME_TYPE = 0x1;
    static final int HTTP3_CANCEL_PUSH_FRAME_TYPE = 0x3;
    static final int HTTP3_SETTINGS_FRAME_TYPE = 0x4;
    static final int HTTP3_PUSH_PROMISE_FRAME_TYPE = 0x5;
    static final int HTTP3_GO_AWAY_FRAME_TYPE = 0x7;
    static final int HTTP3_MAX_PUSH_ID_FRAME_TYPE = 0xd;

    static final int HTTP3_CANCEL_PUSH_FRAME_MAX_LEN = 8;
    static final int HTTP3_SETTINGS_FRAME_MAX_LEN = 256;
    static final int HTTP3_GO_AWAY_FRAME_MAX_LEN = 8;
    static final int HTTP3_MAX_PUSH_ID_FRAME_MAX_LEN = 8;

    static final int HTTP3_CONTROL_STREAM_TYPE = 0x00;
    static final int HTTP3_PUSH_STREAM_TYPE = 0x01;
    static final int HTTP3_QPACK_ENCODER_STREAM_TYPE = 0x02;
    static final int HTTP3_QPACK_DECODER_STREAM_TYPE = 0x03;

    private Http3CodecUtils() { }

    static long checkIsReservedFrameType(long type) {
        return ObjectUtil.checkInRange(type, MIN_RESERVED_FRAME_TYPE, MAX_RESERVED_FRAME_TYPE, "type");
    }

    static boolean isReservedFrameType(long type) {
        return type >= MIN_RESERVED_FRAME_TYPE && type <= MAX_RESERVED_FRAME_TYPE;
    }

    /**
     * Checks if the passed {@link QuicStreamChannel} is a server initiated stream.
     *
     * @param channel to check.
     * @return {@code true} if the passed {@link QuicStreamChannel} is a server initiated stream.
     */
    static boolean isServerInitiatedQuicStream(QuicStreamChannel channel) {
        // Server streams have odd stream id
        // https://www.rfc-editor.org/rfc/rfc9000.html#name-stream-types-and-identifier
        return channel.streamId() % 2 != 0;
    }

    static boolean isReservedHttp2FrameType(long type) {
        switch ((int) type) {
            // Reserved types that were used in HTTP/2
            // https://tools.ietf.org/html/draft-ietf-quic-http-32#section-11.2.1
            case 0x2:
            case 0x6:
            case 0x8:
            case 0x9:
                return true;
            default:
                return false;
        }
    }

    static boolean isReservedHttp2Setting(long key) {
        // Reserved types that were used in HTTP/2
        // https://tools.ietf.org/html/draft-ietf-quic-http-32#section-11.2.2
        return 0x2L <= key && key <= 0x5L;
    }

    /**
     * Returns the number of bytes needed to encode the variable length integer.
     *
     * See <a href="https://tools.ietf.org/html/draft-ietf-quic-transport-32#section-16">
     *     Variable-Length Integer Encoding</a>.
     */
    static int numBytesForVariableLengthInteger(long value) {
        if (value <= 63) {
            return 1;
        }
        if (value <= 16383) {
            return 2;
        }
        if (value <= 1073741823) {

Frequently Asked Questions

What is the Http3CodecUtils class?
Http3CodecUtils is a class in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3CodecUtils.java.
Where is Http3CodecUtils defined?
Http3CodecUtils is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3CodecUtils.java at line 35.

Analyze Your Own Codebase

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

Try Supermodel Free