RNS::Channel(TPacket)
Provides ordered, reliable, bidirectional message delivery over a
ChannelOutletBase transport (typically a Link).
Messages are assigned monotonically increasing 16-bit sequence numbers, transmitted with automatic retry on timeout, and delivered to registered callbacks in sequence order. A sliding window controls how many unacknowledged messages may be in flight; the window size adapts dynamically based on measured RTT.
Constants
─── Window constants ───────────────────────────────────────
Constructors
Instance methods
Compute packet timeout based on tries, RTT, and tx_ring size.
Adds a callback invoked for each incoming message, in registration
order. Return true from the callback to consume the message and
stop further handler dispatch; return false to pass it along.
Returns true when the channel can accept another outbound message.
This requires the underlying outlet to be usable and the number of
outstanding (undelivered) messages to be below the current window size.
Returns the Maximum Data Unit available for message payloads,
which is the outlet's MDU minus the 6-byte envelope header
(2 bytes each for msgtype, sequence, and length). Capped at 0xFFFF.
Registers a MessageBase subclass so the channel can instantiate
it when a matching msgtype is received. The class must have a
msgtype value below 0xf000; system-reserved types are rejected.
Removes a previously registered message handler. No-op if the callback is not currently registered.
Packs and transmits a message over the channel. The message is
assigned the next sequence number, serialized via Envelope#pack,
and handed to the outlet. Delivery and timeout callbacks are
installed for automatic retry.
Raises ChannelException (ME_LINK_NOT_READY) if the channel
is not ready, or (ME_TOO_BIG) if the packed message exceeds
the outlet's MDU.