mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-08 22:38:01 -06:00
Rebuild protocol runtime from scratch
Implement an aligned two-section frame format, a compiled prefix router, a minimal pending and active hook engine, and a header-first receive path that only decodes payloads on local delivery. Recreate the protocol-focused test suite and document the explicit framing deviation in src/protocol/PROTOCOL_CHANGES.md.
This commit is contained in:
+6
-26
@@ -1,6 +1,4 @@
|
||||
//! Canonical UnShell protocol modules.
|
||||
//!
|
||||
//! The wire model matches `PROTOCOL.md` directly.
|
||||
|
||||
pub mod codec;
|
||||
pub mod introspection;
|
||||
@@ -12,32 +10,14 @@ pub mod validation;
|
||||
mod tests;
|
||||
|
||||
pub use codec::{
|
||||
FrameBytes, FrameCodec, FrameError, ParsedFrame, RkyvCodec, deserialize_archived_bytes,
|
||||
FrameBytes, FrameError, ParsedFrame, SECTION_ALIGN, decode_frame, deserialize_archived_bytes,
|
||||
encode_packet,
|
||||
};
|
||||
pub use introspection::{
|
||||
EndpointIntrospection, INTROSPECTION_PROCEDURE_ID, LeafIntrospection,
|
||||
LeafIntrospectionSummary,
|
||||
};
|
||||
pub use introspection::{EndpointIntrospection, LeafIntrospection, LeafIntrospectionSummary};
|
||||
pub use types::{
|
||||
CallMessage, DataMessage, FaultMessage, HookTarget, PacketHeader, PacketType, ProtocolFault,
|
||||
};
|
||||
pub use validation::{ValidationError, validate_call, validate_header, validate_procedure_id};
|
||||
|
||||
/// Encodes a header and payload with the crate's default frame codec.
|
||||
///
|
||||
/// This is a convenience wrapper around [`RkyvCodec`] for callers that do not
|
||||
/// need to choose a codec explicitly.
|
||||
pub fn encode_packet<P>(header: &PacketHeader, payload: &P) -> Result<FrameBytes, FrameError>
|
||||
where
|
||||
P: for<'a> rkyv::Serialize<
|
||||
rkyv::api::high::HighSerializer<
|
||||
rkyv::util::AlignedVec,
|
||||
rkyv::ser::allocator::ArenaHandle<'a>,
|
||||
rkyv::rancor::Error,
|
||||
>,
|
||||
>,
|
||||
{
|
||||
codec::encode_packet(header, payload)
|
||||
}
|
||||
|
||||
/// Decodes a framed packet with the crate's default frame codec.
|
||||
pub fn decode_frame(bytes: &[u8]) -> Result<ParsedFrame<'_>, FrameError> {
|
||||
codec::decode_frame(bytes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user