rtmp-runtime 0.10.0

Sans-IO RTMP 1.0 (Adobe Real-Time Messaging Protocol) ingest session engine — a driveable server-side publish state machine over the handshake, chunk stream, AMF0, and message layers; optional tokio socket adapter.
Documentation
//! Error type for the RTMP ingest session engine.
//!
//! Structured [`thiserror`] errors covering the failure surface of the
//! sans-IO engine: handshake framing (§5.2), chunk stream parsing (§5.3),
//! message reassembly (§6), AMF0 decoding (`[AMF0]`), and session state-machine
//! violations (§7.2) — see `private/specs-verified/rtmp/rtmp-runtime/rtmp.md`.

/// Errors produced by the RTMP ingest session engine.
#[non_exhaustive]
#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
pub enum RtmpError {
    /// Not enough input bytes were available to parse a complete structure
    /// (handshake message, chunk header, or reassembled RTMP message).
    #[error(transparent)]
    BufferTooShort(#[from] broadcast_common::error::BufferTooShort),

    /// The input did not conform to the expected wire layout (bad handshake
    /// version, invalid chunk `fmt`/CSID encoding, malformed AMF0 value, or
    /// similar).
    #[error("malformed {what}")]
    Malformed {
        /// What was being parsed when the malformed data was found.
        what: &'static str,
    },

    /// An operation was attempted that is not valid in the session's current
    /// state (e.g. a command received before the handshake completed, or
    /// `publish` before `createStream`).
    #[error("unexpected state: {what}")]
    UnexpectedState {
        /// Description of the state violation.
        what: &'static str,
    },

    /// The input used a feature or value this engine does not (yet) support
    /// (e.g. AMF3, an unrecognised command name).
    #[error("unsupported: {what}")]
    Unsupported {
        /// What is unsupported.
        what: &'static str,
    },

    /// A [`crate::chunk::Message`] was built with a `chunk_stream_id` outside
    /// the basic header's encodable range (2..=65599, RTMP §5.3.1.1), so it
    /// cannot be written.
    #[error("chunk stream id {chunk_stream_id} is outside the encodable range 2..=65599")]
    InvalidChunkStreamId {
        /// The offending chunk stream id.
        chunk_stream_id: u32,
    },

    /// A length or count did not fit the wire field it is written to
    /// (#1129): a serializer that narrowed a `usize` with `as u32` (then
    /// packed it into a 24-bit field) would have silently wrapped and
    /// emitted a misframed chunk stream; this is returned instead.
    #[error(transparent)]
    FieldOverflow(#[from] broadcast_common::error::FieldOverflow),

    /// The output buffer passed to `serialize_into` was smaller than
    /// `serialized_len()`.
    #[error(transparent)]
    OutputBufferTooSmall(#[from] broadcast_common::error::OutputBufferTooSmall),
}