Home / Class/ QpackDecoder Class — netty Architecture

QpackDecoder Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  90fa2d3f_8d04_4c74_e2ce_52229be77194["QpackDecoder"]
  f9e28bde_040a_6a46_fa89_3c920b16f9c2["QpackDecoder.java"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|defined in| f9e28bde_040a_6a46_fa89_3c920b16f9c2
  80cbbe98_51a6_7997_fc44_4dbd5d995c1a["QpackDecoder()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| 80cbbe98_51a6_7997_fc44_4dbd5d995c1a
  678f973e_104e_7340_6c3b_b4ef23003fe0["decode()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| 678f973e_104e_7340_6c3b_b4ef23003fe0
  1e1d0180_b129_c00a_dee3_852313c2036d["setDynamicTableCapacity()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| 1e1d0180_b129_c00a_dee3_852313c2036d
  cf54764f_0f46_324e_a390_7bfbb09c7843["insertWithNameReference()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| cf54764f_0f46_324e_a390_7bfbb09c7843
  8109094a_a1bc_ae66_9de0_d94d09f5b34a["insertLiteral()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| 8109094a_a1bc_ae66_9de0_d94d09f5b34a
  d78249f5_d28a_0d83_3fe2_d14954225d00["duplicate()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| d78249f5_d28a_0d83_3fe2_d14954225d00
  04f9aee1_5490_94cd_ccfb_00da08de6e7a["streamAbandoned()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| 04f9aee1_5490_94cd_ccfb_00da08de6e7a
  4668ff57_4979_5f8d_1ffa_85bfe92168f0["isIndexed()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| 4668ff57_4979_5f8d_1ffa_85bfe92168f0
  029640e9_bd93_8bf3_9c94_6097a4aaf643["isLiteralWithNameRef()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| 029640e9_bd93_8bf3_9c94_6097a4aaf643
  1cfea281_94c3_17d6_c486_4b45ad3a2de9["isLiteral()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| 1cfea281_94c3_17d6_c486_4b45ad3a2de9
  8ddb6d46_a7cb_2028_0f98_07f9e2058996["isIndexedWithPostBase()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| 8ddb6d46_a7cb_2028_0f98_07f9e2058996
  2f6814a7_a9ce_9143_6ad0_94d72c16edab["isLiteralWithPostBaseNameRef()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| 2f6814a7_a9ce_9143_6ad0_94d72c16edab
  e4c523f1_b420_82d8_ae49_39b9bbc2cdce["decodeIndexed()"]
  90fa2d3f_8d04_4c74_e2ce_52229be77194 -->|method| e4c523f1_b420_82d8_ae49_39b9bbc2cdce

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/QpackDecoder.java lines 37–516

final class QpackDecoder {
    private static final InternalLogger logger = InternalLoggerFactory.getInstance(QpackDecoder.class);
    private static final QpackException DYNAMIC_TABLE_CAPACITY_EXCEEDS_MAX =
            QpackException.newStatic(QpackDecoder.class, "setDynamicTableCapacity(...)",
                    "QPACK - decoder dynamic table capacity exceeds max capacity.");
    private static final QpackException HEADER_ILLEGAL_INDEX_VALUE =
            QpackException.newStatic(QpackDecoder.class, "decodeIndexed(...)", "QPACK - illegal index value");
    private static final QpackException NAME_ILLEGAL_INDEX_VALUE =
            QpackException.newStatic(QpackDecoder.class, "decodeLiteralWithNameRef(...)",
                    "QPACK - illegal name index value");
    private static final QpackException INVALID_REQUIRED_INSERT_COUNT =
            QpackException.newStatic(QpackDecoder.class, "decodeRequiredInsertCount(...)",
                    "QPACK - invalid required insert count");
    private static final QpackException MAX_BLOCKED_STREAMS_EXCEEDED =
            QpackException.newStatic(QpackDecoder.class, "shouldWaitForDynamicTableUpdates(...)",
                    "QPACK - exceeded max blocked streams");
    private static final QpackException BLOCKED_STREAM_RESUMPTION_FAILED =
            QpackException.newStatic(QpackDecoder.class, "sendInsertCountIncrementIfRequired(...)",
                    "QPACK - failed to resume a blocked stream");

    private static final QpackException UNKNOWN_TYPE =
            QpackException.newStatic(QpackDecoder.class, "decode(...)", "QPACK - unknown type");

    private final QpackHuffmanDecoder huffmanDecoder;
    private final QpackDecoderDynamicTable dynamicTable;
    private final long maxTableCapacity;
    private final int maxBlockedStreams;
    private final QpackDecoderStateSyncStrategy stateSyncStrategy;
    /**
     * Hashmap with key as the required insert count to unblock the stream and the value a {@link List} of
     * {@link Runnable} to invoke when the stream can be unblocked.
     */
    private final IntObjectHashMap<List<Runnable>> blockedStreams;

    private final long maxEntries;
    private final long fullRange;
    private int blockedStreamsCount;
    private long lastAckInsertCount;

    QpackDecoder(long maxTableCapacity, int maxBlockedStreams) {
        this(maxTableCapacity, maxBlockedStreams, new QpackDecoderDynamicTable(), ackEachInsert());
    }

    QpackDecoder(long maxTableCapacity, int maxBlockedStreams,
                 QpackDecoderDynamicTable dynamicTable, QpackDecoderStateSyncStrategy stateSyncStrategy) {
        huffmanDecoder = new QpackHuffmanDecoder();
        this.maxTableCapacity = maxTableCapacity;
        this.maxBlockedStreams = maxBlockedStreams;
        this.stateSyncStrategy = stateSyncStrategy;
        blockedStreams = new IntObjectHashMap<>(Math.min(16, maxBlockedStreams));
        this.dynamicTable = dynamicTable;
        maxEntries = QpackUtil.maxEntries(maxTableCapacity);
        try {
            fullRange = toIntOrThrow(2 * maxEntries);
        } catch (QpackException e) {
            throw new IllegalArgumentException(e);
        }
    }

    /**
     * Decode the header block and add these to the {@link BiConsumer}. This method assumes the entire header block is
     * contained in {@code in}. However, this method may not be able to decode the header block if the QPACK dynamic
     * table does not contain all entries required to decode the header block.
     * See <a href="https://www.rfc-editor.org/rfc/rfc9204.html#name-blocked-streams">blocked streams</a>.
     * In such a case, this method will return {@code false} and would invoke {@code whenDecoded} when the stream is
     * unblocked and the header block is completely decoded.
     *
     * @param qpackAttributes {@link QpackAttributes} for the channel.
     * @param streamId for the stream on which this header block was received.
     * @param in {@link ByteBuf} containing the header block.
     * @param length Number of bytes to be read from {@code in}
     * @param sink {@link BiConsumer} to
     * @param whenDecoded {@link Runnable} to invoke when a blocked decode finishes decoding.
     * @return {@code true} if the headers were decoded.
     */
    public boolean decode(QpackAttributes qpackAttributes, long streamId, ByteBuf in,
                          int length, BiConsumer<CharSequence, CharSequence> sink, Runnable whenDecoded)
            throws QpackException {
        final int initialReaderIdx = in.readerIndex();
        final int requiredInsertCount = decodeRequiredInsertCount(qpackAttributes, in);
        if (shouldWaitForDynamicTableUpdates(requiredInsertCount)) {

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free