Skip to main content

Module io

Module io 

Source
Expand description

Async real-socket IO adapter over the sans-IO engine — RFC 2326 transport.

The sans-IO ClientSession / ServerSession engines never touch a socket: they turn method calls into request/response bytes and consume inbound bytes into typed events. This module is the thin layer that actually moves those bytes over a tokio socket — it owns the stream, writes what the session produces, reads the peer’s reply (buffering partial reads until a full RTSP message or interleaved $-frame parses, per §10.12), feeds it back through ClientSession::handle_data / ServerSession::handle_request, and returns the resulting events. The engine stays pure; the adapter is pure plumbing.

Both the client and server are generic over the stream type (S: AsyncRead + AsyncWrite + Unpin), so the identical driver logic runs over a plain tokio::net::TcpStream and over a TLS stream.

§rtsp:// vs rtsps://

Plain RTSP (rtsp://) is carried over TCP on default port 554 (RTSP_DEFAULT_PORT). RTSP-over-TLS (rtsps://) wraps the TCP stream in a TLS session before any RTSP is exchanged and uses default port 322 (RTSPS_DEFAULT_PORT, per the IANA rtsps assignment). The TLS entry points (AsyncRtspClient::connect_tls, AsyncRtspServer::accept_tls) are gated behind the tls feature; everything else is behind tokio.

Structs§

AsyncRtspClient
An async RTSP client that owns a socket and drives a ClientSession.
AsyncRtspServer
An async RTSP server connection that owns a socket and drives a ServerSession.

Constants§

RTSPS_DEFAULT_PORT
Default TCP port for rtsps:// (RTSP over TLS; IANA rtsps).
RTSP_DEFAULT_PORT
Default TCP port for rtsp:// (RFC 2326 §1 / IANA rtsp).

Functions§

default_tls_client_config
Builds a rustls::ClientConfig trusting the webpki-roots public-CA bundle (the default trust store for rtsps:// to a well-known server).