clasp_core/lib.rs
1//! CLASP Core
2//!
3//! Core types, encoding, and protocol primitives for CLASP v2.
4//! Creative Low-Latency Application Streaming Protocol.
5//!
6//! This crate provides:
7//! - Protocol message types ([`Message`], [`SignalType`])
8//! - Binary frame encoding/decoding ([`Frame`], [`codec`])
9//! - Address parsing and wildcard matching ([`Address`])
10//! - State management primitives ([`ParamState`])
11//! - Timing utilities ([`Timestamp`])
12
13#![cfg_attr(not(feature = "std"), no_std)]
14
15#[cfg(feature = "alloc")]
16extern crate alloc;
17
18pub mod address;
19pub mod codec;
20pub mod error;
21pub mod frame;
22pub mod state;
23pub mod time;
24pub mod types;
25
26pub use address::Address;
27pub use codec::{decode, encode};
28pub use error::{Error, Result};
29pub use frame::Frame;
30pub use state::ParamState;
31pub use time::Timestamp;
32pub use types::*;
33
34/// Protocol version
35pub const PROTOCOL_VERSION: u8 = 2;
36
37/// Magic byte for frame identification
38pub const MAGIC_BYTE: u8 = 0x53; // 'S' for Streaming
39
40/// Default WebSocket port
41pub const DEFAULT_WS_PORT: u16 = 7330;
42
43/// Default UDP discovery port
44pub const DEFAULT_DISCOVERY_PORT: u16 = 7331;
45
46/// WebSocket subprotocol identifier
47pub const WS_SUBPROTOCOL: &str = "clasp.v2";
48
49/// mDNS service type
50pub const MDNS_SERVICE_TYPE: &str = "_clasp._tcp.local.";