Pure protobuf wire-field primitives, independent of the generated protos.
This module knows wire types, varints, fixed-width numbers, and length-delimited fields. It has no knowledge of WhatsApp message kinds.
Production decoding now goes through the generated WAWebProtobufs* modules;
these primitives remain as the second, independent reader that the wire-format
tests use to pin the exact bytes we put on (and read off) the wire.
Summary
Functions
Returns every length-delimited value for a field in decoded order.
Returns a protobuf boolean field value or nil.
Returns a binary field value or nil.
Collects every length-delimited value in a protobuf payload.
Decodes all supported protobuf fields without raising.
Returns a fixed64 double field value or nil.
Finds a length-delimited field directly in a protobuf payload.
Finds the first length-delimited value in an already-decoded field list.
Finds the first varint value in an already-decoded field list.
Returns a fixed32 float field value or nil.
Returns a varint field value or nil.
Types
@type wire_field() :: {non_neg_integer(), 0 | 1 | 2 | 5, term()}
Functions
@spec all_length_delimited([wire_field()], non_neg_integer()) :: [binary()]
Returns every length-delimited value for a field in decoded order.
@spec bool(binary(), non_neg_integer()) :: boolean() | nil
Returns a protobuf boolean field value or nil.
@spec bytes(binary(), non_neg_integer()) :: binary() | nil
Returns a binary field value or nil.
Collects every length-delimited value in a protobuf payload.
@spec decode_safe(binary()) :: {:ok, [wire_field()]} | {:error, term()}
Decodes all supported protobuf fields without raising.
@spec double(binary(), non_neg_integer()) :: float() | nil
Returns a fixed64 double field value or nil.
@spec find_length_delimited(binary(), non_neg_integer()) :: {:ok, binary()} | {:error, term()}
Finds a length-delimited field directly in a protobuf payload.
@spec first_length_delimited([wire_field()], non_neg_integer()) :: binary() | nil
Finds the first length-delimited value in an already-decoded field list.
@spec first_varint([wire_field()], non_neg_integer()) :: integer() | nil
Finds the first varint value in an already-decoded field list.
@spec float(binary(), non_neg_integer()) :: float() | nil
Returns a fixed32 float field value or nil.
@spec varint(binary(), non_neg_integer()) :: integer() | nil
Returns a varint field value or nil.