Feature notes: Asynchronous QUIC server and HTTP/3 component
Level: tQuicEncryptionLevel;
Version: Cardinal;
DestinationID, SourceID, Token: TBytes;
PacketNumber: UInt64;
PacketNumberLen: Integer;
KeyPhase, Spin: Boolean;
Header, Payload: TBytes;
PacketNumberOffset, WireBytes: Integer;
AckEliciting: Boolean;
Calls require external serialization. The stream manager is borrowed only for the call. Const buffers may be retained read-only: aliases must not mutate their elements. ACK/loss inputs describe validated sent packets. They are delivery information, never packets to replay verbatim.
Peek prepares one bounded frame without removing needed work. Commit validates that frame in the actual transmitted payload before removing work. Fresh ACK/PADDING/PING may accompany it. Failed sends leave work queued but consume allocated packet numbers. Repeating Peek refreshes the selection. ACKs retire CRYPTO and cancel pending work, including prior loss/PTO work. Apply STREAM/RESET ACKs to the stream manager before selecting again.
CRYPTO offsets are contiguous per level. Bytes, retained/pending ranges and controls have explicit budgets. Resource failure raises eQuicError; the host closes rather than losing recovery metadata. STOP_SENDING, RESET_STREAM, HANDSHAKE_DONE, connection ID and current MAX_* controls are retained until acknowledged or superseded. Old ACK, PADDING, PING, CLOSE, NEW_TOKEN and path frames are never replayed. The host builds fresh ACKs and fallback PTO PINGs. CRYPTO precedes other queued work. Pending controls and streams alternate when both fit. Stream selection rotates by stream ID after a committed STREAM frame; all ranges of one stream share that turn. Peek and failed sends do not advance either scheduling cursor. Create a new queue after Retry.
constructor Create(aMaxCryptoBytes: Integer = 1048576; aMaxRanges: Integer = 256; aMaxControls: Integer = 256);
procedure PrepareSendWindow(aStreams: tQuicStreamManager; aMaxBytes, aMaxRanges, aMaxStreams: Integer);
procedure QueueCrypto(aLevel: tQuicEncryptionLevel; aOffset: UInt64; const aData: TBytes);
procedure QueueStream(aStreamID, aOffset, aLength: UInt64; aFin: Boolean);
procedure QueueControl(const aFrame: tQuicFrame);
procedure Lost(aLevel: tQuicEncryptionLevel; const aPayload: TBytes; aStreams: tQuicStreamManager = nil);
procedure Acknowledged(aLevel: tQuicEncryptionLevel; const aPayload: TBytes);
function HasReady(aLevel: tQuicEncryptionLevel; aMaxPayload: Integer; aStreams: tQuicStreamManager): Boolean;
function Peek(aLevel: tQuicEncryptionLevel; aMaxPayload: Integer; aStreams: tQuicStreamManager; out aPayload: TBytes): Boolean;
procedure Commit(aLevel: tQuicEncryptionLevel; const aPayload: TBytes);
procedure DiscardLevel(aLevel: tQuicEncryptionLevel);
procedure RejectEarlyData;
procedure CopyRetainedControls(aDestination: tQuicOutputQueue; aStreams: tQuicStreamManager);
property CryptoBytes: Integer read fCryptoBytes;