Module datagram
Available on crate features
http and std only.Expand description
HTTP Datagrams and the Capsule Protocol (RFC 9297), shared by every HTTP version.
HttpDatagramSession runs on the upgraded I/O of any successful HTTP/1.x upgrade or
HTTP/2 and HTTP/3 Extended CONNECT. It sends DATAGRAM and control capsules on the
reliable data stream and, when the transport publishes NativeDatagrams (HTTP/3 with
negotiated QUIC DATAGRAM), unreliable native datagrams. handshake maps an upgrade
token onto each HTTP version; nothing above the session needs a version switch.
Modules§
- capsule
- Bounded, incremental Capsule Protocol decoding (RFC 9297 §3).
- handshake
- Upgrade-token handshakes for protocols that use the Capsule Protocol (RFC 9297 §3.2).
Structs§
- Capsule
Observation - An optional upgraded-I/O extension selecting a Capsule metadata observer. Works on reliable streams even when no native HTTP Datagram carrier is available. It is connection scoped, so a session nested inside the tunnel never reports as the tunnel.
- Datagram
Relay Direction - Counts for one completed forwarding direction. Native delivery is unreliable; accepting a send does not prove that the remote application received it.
- Datagram
Relay Outcome - Two independent directional outcomes; a clean half-close does not stop its sibling.
- Datagram
Relay Reader - Ordered input from one relay hop. The reader finishes a streamed capsule value before polling native datagrams again.
- Http
Datagram Relay - Forward a tunnel whose application explicitly selected HTTP Datagram semantics.
- Http
Datagram Session - An HTTP Datagram and Capsule Protocol session on an established request.
- Native
Datagrams - A request’s native datagram carrier, published on the upgraded I/O’s extensions.
- Native
Send Ready - A wait for native send room, from
NativeDatagramChannel::send_ready. - Session
Config - Configuration of an
HttpDatagramSession. - Session
Receiver - The receiving half of an
HttpDatagramSession. - Session
Sender - The sending half of an
HttpDatagramSession.
Enums§
- Datagram
Transport - How an HTTP Datagram travelled.
- Native
Recv Error - The receive side of a native association ended abnormally.
- Native
Send Error - A native datagram could not be handed to the transport.
- Native
Send Policy - How a native send behaves when the transport’s datagram buffer is full.
- Session
Error - A session operation failed.
- Session
Event - An event received on a session.
- Violation
Policy - How peer violations of HTTP Datagram rules that do not affect framing are handled.
Traits§
- Capsule
Observer - A synchronous metadata observer. Methods must finish promptly without I/O, blocking or reentering the session. Header metadata contains no value bytes. Retained data and callback failures belong to the observer; observations must not control protocol behavior.
- Datagram
Relay Source - A source of events for one forwarding direction. Implement this to select
or replace protocol data while the relay owns framing, writes and shutdown.
Return original events to preserve their delivery semantics. For generated
datagrams,
DatagramTransport::Nativeselects native delivery when negotiated, falling back to a DATAGRAM capsule on a capsule-only hop. - Native
Datagram Channel - Unreliable delivery of HTTP Datagrams associated with one request, such as HTTP/3 QUIC DATAGRAM frames (RFC 9297 §2.1).