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;
22#[cfg(feature = "std")]
23pub mod security;
24pub mod state;
25pub mod time;
26pub mod types;
27
28pub use address::Address;
29pub use codec::{decode, encode};
30pub use error::{Error, Result};
31pub use frame::Frame;
32#[cfg(feature = "std")]
33pub use security::{
34    Action, CpskValidator, Scope, SecurityMode, TokenInfo, TokenValidator, ValidatorChain,
35    ValidationResult,
36};
37pub use state::ParamState;
38pub use time::Timestamp;
39pub use types::*;
40
41/// Protocol version
42pub const PROTOCOL_VERSION: u8 = 2;
43
44/// Magic byte for frame identification
45pub const MAGIC_BYTE: u8 = 0x53; // 'S' for Streaming
46
47/// Default WebSocket port
48pub const DEFAULT_WS_PORT: u16 = 7330;
49
50/// Default UDP discovery port
51pub const DEFAULT_DISCOVERY_PORT: u16 = 7331;
52
53/// WebSocket subprotocol identifier
54pub const WS_SUBPROTOCOL: &str = "clasp.v2";
55
56/// mDNS service type
57pub const MDNS_SERVICE_TYPE: &str = "_clasp._tcp.local.";