import { Stream } from "../stream"; import { type IetfVersion } from "./version"; /** * Interface for opening outgoing bidi streams and allocating request IDs. * Implemented by both ControlStreamAdapter (v14-v16) and NativeSession (v17). */ export interface Session { openBi(): Stream | Promise; openNativeBi?(): Promise; acceptBi(): Promise; nextRequestId(): Promise; close?(): void; readonly version: IetfVersion; } /** * v17 native session — thin wrapper around WebTransport. * Each request gets its own real bidi stream; no control stream multiplexing. */ export declare class NativeSession implements Session { #private; readonly version: IetfVersion; constructor(quic: WebTransport, version: IetfVersion); openBi(): Promise; acceptBi(): Promise; nextRequestId(): Promise; } /** * Converts v14-v16 control stream multiplexing into virtual bidi streams. * * Reads control messages, classifies them, and routes to virtual Stream objects. * Each request/response pair gets its own virtual Stream, making all versions * look like v17's stream-per-request model. */ export declare class ControlStreamAdapter implements Session { #private; readonly version: IetfVersion; constructor(quic: WebTransport, controlStream: Stream, version: IetfVersion, maxRequestId: bigint); /** * Accept the next incoming virtual bidi stream. * Blocks until a new request arrives on the control stream. */ acceptBi(): Promise; /** * Open an outgoing virtual bidi stream. * Buffers writes until the first full message is available, parses the * requestId (and namespace for PublishNamespace), self-registers, then * flushes. Subsequent writes go directly to the control stream. */ openBi(): Stream; /** * Open a real WebTransport bidi stream (for v16 SubscribeNamespace). */ openNativeBi(): Promise; /** * Allocate the next request ID, blocking if flow control limit reached. */ nextRequestId(): Promise; /** * Main run loop — reads control stream messages and routes to virtual streams. * Must be called after construction. Runs until the control stream closes. */ run(): Promise; close(): void; } //# sourceMappingURL=adapter.d.ts.map