1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Sans-IO RTSP 1.0 session engine — RFC 2326 (Real Time Streaming Protocol).
//!
//! This crate fills the gap the ecosystem leaves: a **driveable** RTSP session
//! engine, a client *and* a server. Message parse/serialize is delegated to the
//! mature [`rtsp_types`] and [`sdp_types`] codecs; authentication (Basic/Digest/
//! Bearer) to the shared [`broadcast_auth`] crate (which itself wraps
//! `http-auth` for Basic/Digest). What lives here is the part nothing else
//! provides — the client and server **session state machines** (RFC 2326
//! Appendix A), `CSeq` correlation, `Transport` negotiation (§12.39),
//! interleaved RTP/RTCP framing (§10.12), and RTSP's auth wiring (§14).
//!
//! # The sans-IO contract
//!
//! No sockets live in the core. You drive the engine with bytes and read back
//! bytes + typed events:
//!
//! - [`ClientSession`] — request-builder methods (`options`/`describe`/`setup`/
//! `play`/`pause`/`teardown`/`get_parameter`) return the outbound request
//! bytes to write; [`ClientSession::handle_data`] consumes inbound bytes
//! (responses and interleaved `$` frames) and returns [`ClientEvent`]s. It
//! correlates `CSeq`, advances the state machine on `2xx`, resets to `Init` on
//! `3xx`, transparently answers `401` challenges, and captures the `Session`
//! id/timeout from the SETUP response.
//! - [`ServerSession`] — [`ServerSession::handle_request`] takes inbound request
//! bytes and returns the response bytes plus [`ServerEvent`]s, validating the
//! method against the server state table (`455` otherwise), allocating a
//! session on SETUP, and negotiating `Transport`.
//!
//! An optional `tokio` socket adapter (feature `tokio`) drives real connections
//! over this same core: the `io::AsyncRtspClient` and `io::AsyncRtspServer`
//! types own a `tokio::net::TcpStream`, move the bytes the session
//! produces/consumes, and surface the same [`ClientEvent`]/[`ServerEvent`]s.
//! With the `tls` feature the adapter also speaks `rtsps://` (RTSP over TLS,
//! default port 322) by wrapping the stream in a `tokio-rustls` session before
//! the RTSP exchange. Both are generic over the stream type, so identical logic
//! runs over TCP and TLS.
//!
//! # Module map
//!
//! - [`state`] — [`SessionState`] and the client/server transition functions
//! (RFC 2326 Appendix A; `docs/state-machines.md`).
//! - [`transport`] — the typed [`Transport`] header (§12.39;
//! `docs/transport-header.md`).
//! - [`interleaved`] — [`InterleavedFrame`] and the streaming demultiplexer
//! (§10.12; `docs/interleaved-framing.md`).
//! - [`auth`] — [`Credentials`] and the [`Authenticator`], re-exported from the
//! shared [`broadcast_auth`] crate (§14; `docs/auth.md`).
//! - [`client`] — [`ClientSession`] and [`ClientEvent`].
//! - [`server`] — [`ServerSession`] and [`ServerEvent`].
//! - `io` (feature `tokio`) — the async socket adapter `AsyncRtspClient` /
//! `AsyncRtspServer`, with `rtsps://` TLS entry points under the `tls`
//! feature.
//! - [`error`] — the [`Error`] enum and [`Result`] alias.
//!
//! Methods, status codes, and their state effects are catalogued in
//! `docs/methods-and-status.md`.
pub use ;
pub use ;
pub use ;
pub use InterleavedFrame;
pub use ;
pub use ;
pub use SessionState;
pub use ;
// Re-export the underlying codec types callers need to inspect events.
pub use ;
/// The RFC this engine implements.
pub const RFC: &str = "RFC 2326";