pub struct AsyncRtspServer<S> { /* private fields */ }Expand description
An async RTSP server connection that owns a socket and drives a
ServerSession.
Reads requests off the socket (buffering partial reads until a full RTSP
message parses), calls ServerSession::handle_request, writes the response
bytes back, and returns the ServerEvents.
Implementations§
Source§impl AsyncRtspServer<TcpStream>
impl AsyncRtspServer<TcpStream>
Sourcepub fn accept(stream: TcpStream) -> Self
pub fn accept(stream: TcpStream) -> Self
Wraps an accepted plain-TCP connection with a fresh ServerSession.
Sourcepub fn accept_with(stream: TcpStream, session: ServerSession) -> Self
pub fn accept_with(stream: TcpStream, session: ServerSession) -> Self
Wraps an accepted plain-TCP connection with a pre-configured session.
Source§impl AsyncRtspServer<TlsStream<TcpStream>>
impl AsyncRtspServer<TlsStream<TcpStream>>
Sourcepub async fn accept_tls(stream: TcpStream, config: ServerConfig) -> Result<Self>
pub async fn accept_tls(stream: TcpStream, config: ServerConfig) -> Result<Self>
Performs the TLS handshake over an accepted TCP connection (an
rtsps:// server), then wraps the TLS stream with a fresh session.
Source§impl<S> AsyncRtspServer<S>
impl<S> AsyncRtspServer<S>
Sourcepub fn with_stream(stream: S, session: ServerSession) -> Self
pub fn with_stream(stream: S, session: ServerSession) -> Self
Wraps an already-connected stream (plain or TLS) and a session.
Sourcepub fn state(&self) -> SessionState
pub fn state(&self) -> SessionState
The current session state.
Sourcepub fn session_id(&self) -> Option<&str>
pub fn session_id(&self) -> Option<&str>
The allocated session id, once a SETUP has been handled.
Sourcepub fn stream_mut(&mut self) -> &mut S
pub fn stream_mut(&mut self) -> &mut S
Mutable access to the underlying stream, for writing raw bytes (e.g.
deliberately fragmenting an interleaved frame, or sending several frames
back-to-back) alongside the framed send_interleaved
helper.
Sourcepub async fn next_request(&mut self) -> Result<Option<Vec<ServerEvent>>>
pub async fn next_request(&mut self) -> Result<Option<Vec<ServerEvent>>>
Reads the next complete request, handles it (writing the response back), and returns the produced events.
Returns Ok(None) when the peer closes the connection cleanly before a
full request arrives.