MOQX.Codec (moqx v0.8.1)

Copy Markdown View Source

Shared codec namespace for MOQT-family protocol implementations.

Protocol-specific modules own their wire formats. This namespace holds the generic encoder/decoder contracts and binary helpers shared by protocol variants.

Summary

Types

Unsigned QUIC variable-length integer value.

Functions

Decodes QUIC varint length-prefixed opaque bytes.

Decodes a QUIC varint length-prefixed UTF-8 string.

Decodes one QUIC variable-length integer from the front of a binary.

Encodes opaque bytes as a QUIC varint byte length followed by bytes.

Encodes a UTF-8 string as a QUIC varint byte length followed by bytes.

Encodes a non-negative integer using QUIC variable-length integer encoding.

Types

varint()

@type varint() :: 0..4_611_686_018_427_387_903

Unsigned QUIC variable-length integer value.

Functions

decode_bytes(data)

@spec decode_bytes(binary()) :: {:ok, binary(), binary()} | {:error, :incomplete}

Decodes QUIC varint length-prefixed opaque bytes.

decode_string(data)

@spec decode_string(binary()) ::
  {:ok, String.t(), binary()} | {:error, :incomplete | :invalid_utf8}

Decodes a QUIC varint length-prefixed UTF-8 string.

decode_varint(arg1)

@spec decode_varint(binary()) :: {:ok, varint(), binary()} | {:error, :incomplete}

Decodes one QUIC variable-length integer from the front of a binary.

encode_bytes(value)

@spec encode_bytes(binary()) :: binary()

Encodes opaque bytes as a QUIC varint byte length followed by bytes.

encode_string(value)

@spec encode_string(String.t()) :: binary()

Encodes a UTF-8 string as a QUIC varint byte length followed by bytes.

encode_varint(value)

@spec encode_varint(varint()) :: binary()

Encodes a non-negative integer using QUIC variable-length integer encoding.