full QUIC support

This commit is contained in:
Jorijn van der Graaf 2026-05-07 00:06:44 +02:00
commit 28fab2509b
18 changed files with 1334 additions and 645 deletions

View file

@ -52,10 +52,12 @@ namespace Crafter {
export class ClientQUIC;
// A reliable, ordered, bidirectional stream within a QUIC connection.
// Owned by ClientQUIC; do not destroy directly. Obtain via
// ClientQUIC::OpenStream() or via the on-stream callback for inbound
// streams initiated by the peer.
// A reliable, ordered stream within a QUIC connection. May be
// bidirectional or unidirectional; for unidi streams either canSend or
// canReceive will be false depending on which side initiated. Owned by
// ClientQUIC; do not destroy directly. Obtain via ClientQUIC::OpenStream
// (optionally with unidirectional=true) or via the on-stream callback
// for inbound streams initiated by the peer.
export class QUICStream {
public:
// Underlying msquic HQUIC handle. Treated as opaque by callers.
@ -64,7 +66,12 @@ namespace Crafter {
// The connection that owns this stream (non-owning).
ClientQUIC* connection = nullptr;
QUICStream() = default;
// Direction flags. Bidi streams have both true; outgoing unidi sets
// canReceive=false; incoming unidi (peer-initiated) sets canSend=false.
bool canSend = true;
bool canReceive = true;
QUICStream();
QUICStream(HQUIC handle, ClientQUIC* connection);
~QUICStream();
QUICStream(const QUICStream&) = delete;
@ -135,9 +142,11 @@ namespace Crafter {
ClientQUIC(const ClientQUIC&) = delete;
ClientQUIC(ClientQUIC&&) noexcept;
// Open a new bidirectional stream initiated by this side.
// Open a new stream initiated by this side. Defaults to bidirectional;
// pass unidirectional=true to open a one-way send stream (used for
// HTTP/3's control + QPACK encoder/decoder streams).
// Blocks until the stream is started; throws on failure.
QUICStream OpenStream();
QUICStream OpenStream(bool unidirectional = false);
// Send a datagram. Best-effort: may be silently dropped under loss
// or congestion. Size must fit within the path MTU (msquic surfaces