STUN/TURN framing accumulator for one client connection.
What problem this solves
TURN multiplexes STUN messages (first two bits 00) and ChannelData frames
(first two bits 01) on the same socket. This accumulator buffers incoming
bytes, splits them into complete messages, and strips transport-specific
ChannelData padding before handing frames to the handler.
:framing selects padding rules:
:stream- padding required (TCP/TLS); consumed after each ChannelData:datagram- padding optional (UDP/DTLS); unpadded frames are accepted
Emitted messages never include trailing alignment bytes.
Internal
Used as the :accumulator tier in SocketPipeline; not called by
application code directly.
RFCs
Summary
Functions
Accumulator state: :max_size (default 1 MiB) and :framing (:stream or :datagram).
Extracts the next complete STUN or ChannelData message from the buffer.
Appends chunk to the internal buffer.
Functions
Accumulator state: :max_size (default 1 MiB) and :framing (:stream or :datagram).
See module doc for ChannelData padding rules per transport.
Extracts the next complete STUN or ChannelData message from the buffer.
Returns {:ok, message, meta, acc}, {:more, acc} when incomplete, or
{:error, reason, acc} on overflow or unknown framing.
Appends chunk to the internal buffer.
When the buffer exceeds :max_size, oldest bytes are dropped and :overflow
is set; the next pop/1 returns {:error, :buffer_overflow, acc}.