Module ppspp_handshake

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

handshake()


handshake() = #{channel => ppspp_channel:channel(), options => ppspp_options:options()}

Function Index

handle/2handle a handshake.
pack/1
unpack/1unpack a handshake message Deconstruct PPSPP UDP datagram into multiple erlang terms, including parsing any additional data within the same segment.

Function Details

handle/2


handle(Handshake :: handshake(),Endpoint :: ppspp_datagram:endpoint()) ->ok

handle a handshake

The payload of the HANDSHAKE message is a channel ID (see Section 3.11) and a sequence of protocol options. Example options are the content integrity protection scheme used and an option to specify the swarm identifier. The complete set of protocol options are specified in Section 7.

handshake needs the endpoint info, and will set up a new channel if the requested swarm is available, and the options are compatible. The linking of the swarm and external peer’s address together should be registered with the swarm handler.

pack/1


pack(Message :: ppspp_message:message()) -> binary()

unpack/1


unpack(Message :: binary()) -> {handshake(), binary()}

unpack a handshake message 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.