Reorganize protocol.

This commit is contained in:
Michael Mikovsky
2026-04-24 13:37:30 -06:00
parent dcf0fe230b
commit 49901b6370
21 changed files with 861 additions and 1438 deletions
+10 -34
View File
@@ -1,44 +1,20 @@
//! UnShell core protocol crate.
//! # UnShell Core
//!
//! The crate now models the draft protocol in `PROTOCOL.md` directly:
//! This crate implements the UnShell protocol as a pure, `no_std` library.
//! It provides a trait-based architecture for routed endpoint communication
//! using an explicit tree topology.
//!
//! - [`protocol`] provides the canonical wire types, framing helpers, validation,
//! and introspection payloads.
//! - [`tree`] provides an explicit enum-based tree declaration, longest-prefix
//! routing helpers, and a small endpoint runtime for tests.
//! - [`transport`] provides framed transport implementations for simulated
//! channel-based links and TCP links.
//! - [`logger`] remains available for lightweight logging.
//! ## Architecture
//!
//! ```rust
//! use unshell::protocol::{CallMessage, HookTarget, PacketHeader, PacketType, encode_packet};
//! - [`protocol`] - Wire types, framing, stateless validation, routing/runtime, and implementation traits.
//!
//! let header = PacketHeader {
//! packet_type: PacketType::Call,
//! src_path: Vec::new(),
//! dst_path: vec!["child".into()],
//! dst_leaf: Some("echo".into()),
//! hook_id: None,
//! };
//! let call = CallMessage {
//! procedure_id: "org.product.v1.echo.roundtrip".into(),
//! data: b"ping".to_vec(),
//! response_hook: Some(HookTarget {
//! hook_id: 1,
//! return_path: Vec::new(),
//! }),
//! };
//!
//! let frame = encode_packet(&header, &call).expect("call should encode");
//! assert!(!frame.is_empty());
//! ```
//! The library requires `alloc` for path and payload management.
#![no_std]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
pub mod logger;
pub mod protocol;
pub mod transport;
pub mod tree;
pub use ush_obfuscate as obfuscate;
// pub use ush_obfuscate as obfuscate;