Xirsys.XTurn.Plugin.Frame (xturn_plugin_api v0.1.1)

Copy Markdown View Source

Per-frame metadata passed to plugin handle_frame/3 callbacks.

What problem this solves

A TURN relay may carry many datagrams for one allocation. Plugins need to know whether traffic is client-to-peer or peer-to-client, how it was framed on the TURN wire, and which peer it concerns -- without parsing STUN again.

RFCs

  • RFC 5766 (Send/Data Indication, ChannelData)

Examples

iex> f = %Xirsys.XTurn.Plugin.Frame{direction: :egress, framing: :channel_data, size: 12}
iex> f.direction
:egress
iex> f.framing
:channel_data

Summary

Types

t()

Metadata for one relayed payload.

Types

t()

@type t() :: %Xirsys.XTurn.Plugin.Frame{
  at: integer(),
  channel_number: non_neg_integer() | nil,
  direction: Xirsys.XTurn.Plugin.direction() | nil,
  framing: Xirsys.XTurn.Plugin.framing() | nil,
  peer_ip: :inet.ip_address() | nil,
  peer_port: :inet.port_number() | nil,
  size: non_neg_integer()
}

Metadata for one relayed payload.

Fields

  • :direction - :egress (client to peer) or :ingress (peer to client)
  • :framing - :send_indication, :channel_data, or :data_indication
  • :peer_ip - peer IP tuple, or nil when unknown
  • :peer_port - peer UDP/TCP port, or nil
  • :channel_number - TURN channel number when framing is ChannelData, else nil
  • :size - byte size of the payload
  • :at - monotonic timestamp (microseconds) when the frame was observed