nquic_protocol_send_queues (nquic v1.0.0)

View Source

Per-encryption-level pending-frame queues and their flush drains.

Pure functions over #conn_state{} that buffer outbound frames into three per-space queues (Initial / Handshake / 1-RTT), coalesce them, and drain each queue into one or more encrypted packets via the packet builders in nquic_protocol_send. The dependency is one-way: this module calls down into nquic_protocol_send (builders, MTU batching, send context) module-qualified, and into nquic_protocol_ack to piggyback a pending ACK before an application flush. nquic_protocol drives the flush; the queue functions are called from across the protocol family whenever a control or stream frame is produced.

Summary

Functions

Queue a frame for a Handshake-space packet. Drained by flush/1 into a Handshake-coalesced packet at the next flush. Used for retransmits of Handshake CRYPTO and PTO probes between Initial and Established.

Queue a frame for an Initial-space packet. Drained by flush/1 into an Initial-coalesced packet at the next flush. Used for retransmits of client/server Initial CRYPTO and PTO probes during the handshake.

Functions

build_app_or_zero_rtt(PreEncoded, Time, State)

-spec build_app_or_zero_rtt([nquic_protocol_send:pre_encoded()], integer(), nquic_protocol:state()) ->
                               {ok, iodata(), nquic_protocol:state()} |
                               {error, term(), nquic_protocol:state()}.

flush_app(State0)

-spec flush_app(nquic_protocol:state()) ->
                   {ok, [iodata()], nquic_protocol:state()} | {ok, nquic_protocol:state()}.

flush_handshake/1

-spec flush_handshake(nquic_protocol:state()) -> {[iodata()], nquic_protocol:state()}.

flush_initial/1

-spec flush_initial(nquic_protocol:state()) -> {[iodata()], nquic_protocol:state()}.

maybe_piggyback_ack/1

-spec maybe_piggyback_ack(nquic_protocol:state()) -> nquic_protocol:state().

queue_app_frame(Frame, State)

-spec queue_app_frame(nquic_frame:t(), nquic_protocol:state()) -> {ok, nquic_protocol:state()}.

queue_app_frame(Frame, Bytes, State)

-spec queue_app_frame(nquic_frame:t(), non_neg_integer(), nquic_protocol:state()) ->
                         {ok, nquic_protocol:state()}.

queue_app_frames/3

-spec queue_app_frames([nquic_frame:t()], non_neg_integer(), nquic_protocol:state()) ->
                          {ok, nquic_protocol:state()}.

queue_app_pre_encoded/3

queue_handshake_frame(Frame, State)

-spec queue_handshake_frame(nquic_frame:t(), nquic_protocol:state()) -> {ok, nquic_protocol:state()}.

Queue a frame for a Handshake-space packet. Drained by flush/1 into a Handshake-coalesced packet at the next flush. Used for retransmits of Handshake CRYPTO and PTO probes between Initial and Established.

queue_initial_frame(Frame, State)

-spec queue_initial_frame(nquic_frame:t(), nquic_protocol:state()) -> {ok, nquic_protocol:state()}.

Queue a frame for an Initial-space packet. Drained by flush/1 into an Initial-coalesced packet at the next flush. Used for retransmits of client/server Initial CRYPTO and PTO probes during the handshake.

sort_frames(Frames)

-spec sort_frames([nquic_frame:t()]) -> [nquic_frame:t()].