View Source ExSTUN.Message.Attribute behaviour (ex_stun v0.1.0)
Behaviour defining a STUN attribute.
Each module implementing this behaviour is
expected to define its own struct that will be
passed to to_raw/2
.
Link to this section Summary
Link to this section Callbacks
@callback from_raw( raw_attribute :: ExSTUN.Message.RawAttribute.t(), message :: ExSTUN.Message.t() ) :: {:ok, struct()} | {:error, atom()}
Deserializes a raw attribute.
Message is passed as some of attributes may require transaction id for deserialization.
@callback to_raw(attribute :: struct(), message :: ExSTUN.Message.t()) :: ExSTUN.Message.RawAttribute.t()
Serializes an attribute.
Message is passed as some of attributes may require transaction id for serialization.
@callback type() :: integer()
Returns attribute integer type.