Skip to main content

Crate protocol

Crate protocol 

Source
Expand description

Wire protocol between the host daemon and device agents (design D4).

Every message is one CBOR item in a length-prefixed frame. The crate holds the message schema (message, snapshot, event), structured errors (error) and the capability set (capability); it holds no device code. See README.md for the byte-level layout rules the Kotlin agent follows.

Re-exports§

pub use capability::Capabilities;
pub use error::Error;
pub use error::code;
pub use message::Message;

Modules§

capability
The capability set an agent advertises in its hello.
error
Structured errors (spec: Structured errors): a stable snake_case code, a human-readable message, and whether retrying the same request is meaningful.
event
Events: unsolicited messages on per-stream sequences (spec: Event channel with sequence numbers).
frame
Framing (spec: Framed self-describing messages): every message travels as a 32-bit big-endian payload length followed by exactly one CBOR item of that length.
liveness
Application-level liveness (spec: Liveness detection).
message
The message envelope (design D4): hello, welcome, request, response, event, ping and pong.
sequence
Per-stream event sequence tracking (spec: Event channel with sequence numbers).
session
Connection state machines for both ends of the device link, without I/O.
snapshot
The snapshot payload: the result of a snapshot request.

Constants§

PROTOCOL_VERSION
The protocol version this crate speaks by default.
SUPPORTED_VERSIONS
Every protocol version this crate can speak, lowest first.