Amarula.Protocol.Binary.Constants (amarula v0.1.0)

View Source

WhatsApp binary protocol constants. Ported from src/WABinary/constants.ts

Summary

Functions

Check if string is a double byte token

Check if string is a single byte token

Convert string to tag (single or double byte)

Convert string to token index

Get tag value by atom

Convert tag to string

Convert token index to string

Functions

double_byte_token?(string)

@spec double_byte_token?(binary()) :: boolean()

Check if string is a double byte token

single_byte_token?(string)

@spec single_byte_token?(binary()) :: boolean()

Check if string is a single byte token

string_to_tag(string)

@spec string_to_tag(binary()) :: integer() | {integer(), integer()} | nil

Convert string to tag (single or double byte)

string_to_token(string)

@spec string_to_token(binary()) :: integer() | nil

Convert string to token index

tag(tag_atom)

@spec tag(atom()) :: integer()

Get tag value by atom

tag_to_string(tag)

@spec tag_to_string(integer() | {integer(), integer()}) :: binary() | nil

Convert tag to string

token_to_string(index)

@spec token_to_string(integer()) :: binary() | nil

Convert token index to string