Module ppspp_message

Library for PPSPP over UDP, aka Swift protocol.

Description

This module implements a library of functions necessary to handle the wire-protocol of PPSPP over UDP, including functions for encoding and decoding messages.

Data Types

message()

abstract datatype: message()

message_type()

abstract datatype: message_type()

messages()

abstract datatype: messages()

TODO once all messages are defined then tighten the message() spec

Function Index

get_message_type/1retrieve message type based on IETF spec.
handle/3dispatch messages to correct handler in received order.
pack/1convert a list of messages into binary iolist for transmission.
unpack/2unpack binary into a PPSPP message using erlang term format.

Function Details

get_message_type/1


get_message_type(Maybe_Message_Type :: non_neg_integer()) ->message_type()

retrieve message type based on IETF spec

handle/3


handle(Messages :: messages(),Swarm_Options :: ppspp_options:options(),Endpoint :: ppspp_datagram:endpoint()) ->ok

dispatch messages to correct handler in received order

pack/1


pack(Messages :: messages()) -> iolist()

convert a list of messages into binary iolist for transmission.

unpack/2


unpack(Maybe_Messages :: binary(),Swarm_Options :: ppspp_options:options()) ->message() | messages()

unpack binary into a PPSPP message using erlang term format. Deconstruct PPSPP UDP datagram into multiple erlang terms, including parsing any additional data within the same segment. Any parsing failure is fatal and will propagate back to the attempted datagram unpacking.