Xirsys.Sockets.Transport behaviour (xturn_sockets v2.0.0)
View SourceUniform socket I/O behaviour for all wire protocols.
Summary
Callbacks
ChannelData alignment rule for this transport (RFC 5766, Section 11.5).
Types
@type from() :: {ip_address(), port_number()} | nil
@type ip_address() :: :inet.ip_address()
@type port_number() :: :inet.port_number()
@type socket() :: term()
Callbacks
@callback close(socket()) :: :ok
@callback framing() :: :stream | :datagram
ChannelData alignment rule for this transport (RFC 5766, Section 11.5).
:stream- outgoing ChannelData MUST be padded to a 4-byte boundary:datagram- padding is optional and omitted on send
@callback listen(ip_address(), port_number(), keyword()) :: {:ok, socket()} | {:error, term()}
@callback peername(socket()) :: {:ok, {ip_address(), port_number()}} | {:local, binary()} | {:unspec, <<_::0>>} | {:undefined, any()} | {:error, term()}
@callback sockname(socket()) :: {:ok, {ip_address(), port_number()}} | {:local, binary()} | {:unspec, <<_::0>>} | {:undefined, any()} | {:error, term()}