nhttp_qpack_decoder_instruction (nhttp_lib v1.0.0)

View Source

Decoder instructions wire format (RFC 9204 Section 4.4).

Decoder instructions are sent from decoder to encoder on the decoder unidirectional stream. They provide acknowledgments and state updates.

Three instruction types:

  • Section Acknowledgment (1xxxxxxx) - 7-bit stream ID
  • Stream Cancellation (01xxxxxx) - 6-bit stream ID
  • Insert Count Increment (00xxxxxx) - 6-bit increment

Summary

Functions

Decode a single decoder instruction from binary data. Returns the decoded instruction and any unconsumed bytes.

Encode an Insert Count Increment instruction (RFC 9204 Section 4.4.3).

Encode a Section Acknowledgment instruction (RFC 9204 Section 4.4.1).

Encode a Stream Cancellation instruction (RFC 9204 Section 4.4.2).

Types

decode_error()

-type decode_error() :: incomplete | zero_increment.

t()

-type t() ::
          {section_ack, nhttp_lib:stream_id()} |
          {stream_cancellation, nhttp_lib:stream_id()} |
          {insert_count_increment, pos_integer()}.

Functions

decode/1

-spec decode(bitstring()) -> {ok, t(), bitstring()} | {error, decode_error()}.

Decode a single decoder instruction from binary data. Returns the decoded instruction and any unconsumed bytes.

encode_insert_count_increment(Increment)

-spec encode_insert_count_increment(pos_integer()) -> iolist().

Encode an Insert Count Increment instruction (RFC 9204 Section 4.4.3).

encode_section_ack(StreamId)

-spec encode_section_ack(nhttp_lib:stream_id()) -> iolist().

Encode a Section Acknowledgment instruction (RFC 9204 Section 4.4.1).

encode_stream_cancellation(StreamId)

-spec encode_stream_cancellation(nhttp_lib:stream_id()) -> iolist().

Encode a Stream Cancellation instruction (RFC 9204 Section 4.4.2).