nhttp_qpack_decoder (nhttp_lib v1.0.0)
View SourceQPACK decoder state machine (RFC 9204 Section 2.2).
Processes encoded field sections and encoder stream instructions. Maintains the dynamic table, handles blocked streams, and emits decoder instructions (section acknowledgments, insert count increments) back to the encoder.
The decoder receives:
- Encoded field sections on request/push streams via
decode_field_section/3 - Encoder stream data via
feed_encoder_stream/2
When a field section references a dynamic table entry that has not yet been inserted, the stream is blocked until the encoder stream delivers the missing entries.
Summary
Functions
Decode an encoded field section from a request or push stream.
Feed encoder stream data into the decoder.
Processes encoder instructions (table insertions, capacity changes,
duplications) and unblocks any streams whose required insert count
is now satisfied.
Returns {ok, NewState, UnblockedResults} where UnblockedResults
is a list of {StreamId, DecoderStreamData, FieldLines} tuples
for streams that became unblocked.
Create a new QPACK decoder with the given configuration.
Types
-type config() :: #{max_table_capacity => non_neg_integer(), max_blocked_streams => non_neg_integer()}.
-opaque state()
-type unblocked_result() :: {nhttp_lib:stream_id(), iodata(), [field_line()]}.
Functions
-spec decode_field_section(state(), nhttp_lib:stream_id(), binary()) -> {ok, state(), iodata(), [field_line()]} | {blocked, state()} | {error, term()}.
Decode an encoded field section from a request or push stream.
Returns {ok, NewState, DecoderStreamData, FieldLines} on success,
{blocked, NewState} when the required insert count exceeds the
current insert count, or {error, Reason} on failure.
-spec feed_encoder_stream(state(), binary()) -> {ok, state(), [unblocked_result()]} | {error, term()}.
Feed encoder stream data into the decoder.
Processes encoder instructions (table insertions, capacity changes,
duplications) and unblocks any streams whose required insert count
is now satisfied.
Returns {ok, NewState, UnblockedResults} where UnblockedResults
is a list of {StreamId, DecoderStreamData, FieldLines} tuples
for streams that became unblocked.
Create a new QPACK decoder with the given configuration.