dspk-stream 0.0.7

Network sessions for continuous multi-channel signals: QUIC + TLS, protobuf messages
Documentation
//! The wire protocol (no networking): message types generated from `proto/dspk_stream.proto`,
//! length-prefixed framing, and conversions to and from dspk-core / dspk-view types.
//!
//! See the `.proto` file for the session layout (control, signal and view streams).

pub mod codec;
pub mod convert;

/// Messages generated from `proto/dspk_stream.proto` (package `dspk_stream.v1`).
pub mod wire {
    include!(concat!(env!("OUT_DIR"), "/dspk_stream.v1.rs"));
}

/// Protocol version sent in `ClientHello` and `ServerInfo`; peers of another version are refused.
pub const PROTOCOL_VERSION: u32 = 2;

/// TLS application protocol (ALPN): names the protocol and its version, so QUIC refuses peers
/// speaking another one before any message is exchanged.
pub const ALPN: &[u8] = b"dspk-stream/2";

/// Bytes of the big-endian length before every message.
pub const LENGTH_PREFIX_BYTES: usize = 4;

/// Default upper bound on one encoded message (64 MiB); larger lengths are rejected before
/// allocating.
pub const DEFAULT_MAX_MESSAGE_BYTES: usize = 64 << 20;

pub use codec::{read_message, write_message};
pub use convert::{decode_signal, envelope_from_frame, frame_from_envelope, header_from_info, info_from_header, request_from_view, view_from_request};