FrameHandler
Per-type callback contract :func:parse_frame_into fires.
The dispatcher reads one wire frame at the start of the input buffer and invokes the matching callback. Implementors carry out the per-frame state-machine work (or stash the dispatched payload for later use) without an intermediate carrier allocation: each callback receives the already-typed payload by value.
The 20 callbacks below cover every RFC 9000 §19 frame type.
The ACK / ACK-ECN split is collapsed into :meth:on_ack (the
handler reads len(ack.ecn) to discriminate); the
MAX_STREAMS / STREAMS_BLOCKED bidi/uni splits are collapsed
via the unidirectional flag on the typed payload; the
CONNECTION_CLOSE transport/application split is collapsed via
the application flag.
A frame type outside the v1 master table never reaches a
callback: :func:parse_frame_into raises a
FRAME_ENCODING_ERROR for it (RFC 9000 §12.4).
Implements Movable
on_padding
def on_padding(mut self, count: Int) PADDING run consumed (§19.1).
count is the number of consecutive 0x00 bytes the
parser collapsed into one callback (≥ 1).
on_ping
def on_ping(mut self) PING frame (§19.2).
on_ack
def on_ack(mut self, ack: AckFrame) ACK / ACK-ECN frame (§19.3). When len(ack.ecn) == 1 the wire type was 0x03 (ACK with ECN counts); otherwise 0x02.
on_reset_stream
def on_reset_stream(mut self, rs: ResetStreamFrame) RESET_STREAM (§19.4).
on_stop_sending
def on_stop_sending(mut self, ss: StopSendingFrame) STOP_SENDING (§19.5).
on_crypto
def on_crypto(mut self, c: CryptoFrame) CRYPTO (§19.6).
on_new_token
def on_new_token(mut self, t: NewTokenFrame) NEW_TOKEN (§19.7).
on_stream
def on_stream(mut self, sf: StreamFrame) STREAM (§19.8). The wire-type flag bits are surfaced via sf.offset (set / zero), the explicit data length (read when LEN was set) and sf.fin.
on_max_data
def on_max_data(mut self, m: MaxDataFrame) MAX_DATA (§19.9).
on_max_stream_data
def on_max_stream_data(mut self, m: MaxStreamDataFrame) MAX_STREAM_DATA (§19.10).
on_max_streams
def on_max_streams(mut self, m: MaxStreamsFrame) MAX_STREAMS (§19.11). The bidi (0x12) vs uni (0x13) wire split is surfaced via m.unidirectional.
on_data_blocked
def on_data_blocked(mut self, db: DataBlockedFrame) DATA_BLOCKED (§19.12).
on_stream_data_blocked
def on_stream_data_blocked(mut self, sdb: StreamDataBlockedFrame) STREAM_DATA_BLOCKED (§19.13).
on_streams_blocked
def on_streams_blocked(mut self, sb: StreamsBlockedFrame) STREAMS_BLOCKED (§19.14). The bidi (0x16) vs uni (0x17) wire split is surfaced via sb.unidirectional.
on_new_connection_id
def on_new_connection_id(mut self, ncid: NewConnectionIdFrame) NEW_CONNECTION_ID (§19.15).
on_retire_connection_id
def on_retire_connection_id(mut self, rcid: RetireConnectionIdFrame) RETIRE_CONNECTION_ID (§19.16).
on_path_challenge
def on_path_challenge(mut self, pc: PathChallengeFrame) PATH_CHALLENGE (§19.17).
on_path_response
def on_path_response(mut self, pr: PathResponseFrame) PATH_RESPONSE (§19.18).
on_connection_close
def on_connection_close(mut self, cc: ConnectionCloseFrame) CONNECTION_CLOSE (§19.19). The transport (0x1c) vs application (0x1d) wire split is surfaced via cc.application.
on_handshake_done
def on_handshake_done(mut self) HANDSHAKE_DONE (§19.20).
on_datagram
def on_datagram(mut self, dg: DatagramFrame) DATAGRAM (RFC 9221 §4) -- an unreliable application datagram. dg.has_length records whether the wire type carried an explicit length (0x31) or ran to the end of the packet (0x30).
on_ack_frequency
def on_ack_frequency(mut self, f: AckFrequencyFrame) ACK_FREQUENCY (draft-ietf-quic-ack-frequency).
on_immediate_ack
def on_immediate_ack(mut self) IMMEDIATE_ACK (draft-ietf-quic-ack-frequency): acknowledge now.