Pure QPACK (RFC 9204) wire primitives and decoder-side dynamic table.
decode_header_block/2 is the static/literal profile: dynamic references are
rejected. decode_field_section/3 decodes against a bounded dynamic table,
including Required Insert Count/Base, relative and post-base references, and
reports sections whose Required Insert Count is not yet satisfied as blocked.
apply_encoder_instructions/3 applies peer encoder-stream instructions
incrementally with a bounded partial-instruction buffer. The local encoder
remains static/literal.
Summary
Types
A field section waiting for its Required Insert Count.
Functions
Look up a live dynamic entry by absolute index.
Apply complete encoder-stream instructions and return the unconsumed suffix.
Decode complete decoder-stream instructions and return the partial suffix.
Decode a complete field section against the decoder's dynamic table.
Decode the Required Insert Count and Base prefix (RFC 9204 Section 4.5.1).
Encode a Required Insert Count for a decoder advertising max_capacity.
Insert Count Increment decoder instruction; the increment must be positive.
Insert an entry as instructed by the peer encoder, evicting oldest entries.
Decoder MaxEntries derived from the advertised maximum capacity.
Build a dynamic table.
Retry a blocked section; it stays blocked until enough inserts arrive.
Section Acknowledgment decoder instruction.
Encoded bytes retained by a blocked section.
Required Insert Count of a blocked section.
Set Dynamic Table Capacity; above the advertised maximum is an error.
Stream Cancellation decoder instruction.
Types
@type decode_result() :: {:ok, non_neg_integer(), binary()} | :more | {:error, term()}
@type decoder_instruction() :: {:section_ack, non_neg_integer()} | {:stream_cancel, non_neg_integer()} | {:insert_count_increment, non_neg_integer()}
@type dynamic_entry() :: %{name: binary(), value: binary(), size: pos_integer()}
@opaque section()
A field section waiting for its Required Insert Count.
@type t() :: %QuicHttp3.Qpack{ capacity: non_neg_integer(), entries: [dynamic_entry()], insert_count: non_neg_integer(), max_capacity: non_neg_integer(), size: non_neg_integer() }
Functions
Look up a live dynamic entry by absolute index.
@spec apply_encoder_instructions(t(), binary(), keyword()) :: {:ok, t(), binary()} | {:error, term()}
Apply complete encoder-stream instructions and return the unconsumed suffix.
A trailing partial instruction is returned for buffering; it is bounded by
:max_buffer (default 4 * max_capacity + 64).
@spec decode_decoder_instructions(binary()) :: {:ok, [decoder_instruction()], binary()} | {:error, term()}
Decode complete decoder-stream instructions and return the partial suffix.
@spec decode_field_section(binary(), t(), keyword()) :: {:ok, [field()], non_neg_integer()} | {:blocked, section()} | :more | {:error, term()}
Decode a complete field section against the decoder's dynamic table.
Returns {:ok, fields, required_insert_count}, or {:blocked, section} when
the Required Insert Count exceeds the table's insert count. Resume a blocked
section with resume_field_section/3 after more inserts arrive.
@spec decode_integer(binary(), 1..8) :: decode_result()
@spec decode_section_prefix(binary(), t()) :: {:ok, non_neg_integer(), non_neg_integer(), binary()} | :more | {:error, term()}
Decode the Required Insert Count and Base prefix (RFC 9204 Section 4.5.1).
@spec dynamic(t(), non_neg_integer()) :: {:ok, field()} | {:error, :invalid_dynamic_index}
@spec encode_integer(non_neg_integer(), 1..8, non_neg_integer()) :: {:ok, binary()} | {:error, term()}
@spec encode_required_insert_count(non_neg_integer(), non_neg_integer()) :: non_neg_integer()
Encode a Required Insert Count for a decoder advertising max_capacity.
@spec insert_count_increment(pos_integer()) :: nonempty_binary()
Insert Count Increment decoder instruction; the increment must be positive.
Insert an entry as instructed by the peer encoder, evicting oldest entries.
@spec max_entries(t()) :: non_neg_integer()
Decoder MaxEntries derived from the advertised maximum capacity.
Build a dynamic table.
:capacity is the current capacity. :max_capacity is the locally advertised
SETTINGS_QPACK_MAX_TABLE_CAPACITY; it defaults to :capacity. A decoder
table starts with new(max_capacity: advertised) at capacity zero.
@spec resume_field_section(section(), t(), keyword()) :: {:ok, [field()], non_neg_integer()} | {:blocked, section()} | :more | {:error, term()}
Retry a blocked section; it stays blocked until enough inserts arrive.
@spec section_ack(non_neg_integer()) :: nonempty_binary()
Section Acknowledgment decoder instruction.
@spec section_bytes(section()) :: non_neg_integer()
Encoded bytes retained by a blocked section.
@spec section_required_insert_count(section()) :: pos_integer()
Required Insert Count of a blocked section.
@spec set_capacity(t(), non_neg_integer()) :: {:ok, t()} | {:error, term()}
Set Dynamic Table Capacity; above the advertised maximum is an error.
@spec static(non_neg_integer()) :: {:ok, field()} | {:error, :invalid_static_index}
@spec stream_cancel(non_neg_integer()) :: nonempty_binary()
Stream Cancellation decoder instruction.