webtransport_h3_router (webtransport v0.3.1)

View Source

Per-H3-connection router for WebTransport extension events.

Owns claimed-stream and HTTP-datagram events emitted by quic_h3 for one H3 connection, and demultiplexes them to the right WebTransport session by the session-id varint that prefixes each stream / quarter-stream-id that prefixes each datagram.

Summary

Functions

Connect to an H3 server. The router becomes the H3 connection owner.

Return the H3 connection pid, or undefined if not yet connected.

Open a client-initiated WT bidi stream, sending the session-id header atomically.

Register a session pid for the given session ID.

Set or clear the passthrough pid for unhandled H3 events.

Start an unlinked router with the given passthrough target.

Start a router with no passthrough target.

Start a linked router, forwarding unhandled H3 events to Passthrough.

Remove the session registration for the given session ID.

Functions

client_connect(Router, Host, Port, H3Opts)

-spec client_connect(pid(), string() | binary() | inet:ip_address(), inet:port_number(), map()) ->
                        {ok, pid()} | {error, term()}.

Connect to an H3 server. The router becomes the H3 connection owner.

get_h3_conn(Router)

-spec get_h3_conn(pid()) -> undefined | pid().

Return the H3 connection pid, or undefined if not yet connected.

handle_call(_, From, State)

handle_cast(Msg, State)

handle_info(Msg, State)

init(_)

open_bidi_stream(Router, SessionId)

-spec open_bidi_stream(pid(), non_neg_integer()) -> {ok, non_neg_integer()} | {error, term()}.

Open a client-initiated WT bidi stream, sending the session-id header atomically.

register_session(Router, SessionId, SessionPid)

-spec register_session(pid(), non_neg_integer(), pid()) -> ok.

Register a session pid for the given session ID.

set_passthrough(Router, Pid)

-spec set_passthrough(pid(), undefined | pid()) -> ok.

Set or clear the passthrough pid for unhandled H3 events.

start(Passthrough)

-spec start(undefined | pid()) -> {ok, pid()}.

Start an unlinked router with the given passthrough target.

start_link()

-spec start_link() -> {ok, pid()}.

Start a router with no passthrough target.

start_link(Passthrough)

-spec start_link(undefined | pid()) -> {ok, pid()}.

Start a linked router, forwarding unhandled H3 events to Passthrough.

terminate(Reason, State)

unregister_session(Router, SessionId)

-spec unregister_session(pid(), non_neg_integer()) -> ok.

Remove the session registration for the given session ID.