A3S Docs
A3S Common

Transport

Async transport trait, frame wire format, codecs, mock transport, Unix sockets, vsock ports, and TEE protocol types.

Common Transport

a3s_common::transport provides a small async framed transport abstraction for local IPC, test transports, and TEE-oriented protocol messages.

Frame Format

Frames use a fixed header:

[type:u8][length:u32 big-endian][payload:length bytes]
ItemCurrent value
Header size5 bytes
Max payload16 MiB
Frame typesData, Control, Heartbeat, Error, Close

Frame::decode returns None for incomplete buffers and errors on unknown frame types or payloads above the maximum.

Codec

TypeRole
FrameReader<R>Buffers any AsyncRead stream and yields complete frames.
FrameWriter<W>Writes frames to any AsyncWrite stream.
FrameCodec<R, W>Combines split read/write halves.

FrameWriter includes helpers for data frames, control frames, and JSON-serializable payloads.

Transport Trait

Transport is Send + Sync + Debug and provides async connect, send, recv, close, and connection-state methods. The default frame methods bridge raw byte send/receive with Frame values.

MockTransport is an in-memory implementation with an optional response handler and a sent-message log for tests.

Unix Transport

On Unix platforms, UnixTransport wraps tokio::net::UnixStream and uses the common frame codec. UnixListener binds a socket path, removes a stale socket file if present, and yields accepted UnixTransport connections.

Well-Known Ports

The crate exposes vsock port constants:

ConstantPortPurpose
GRPC_AGENT4088gRPC agent control channel.
EXEC_SERVER4089Guest command execution.
PTY_SERVER4090Interactive terminal.
TEE_CHANNEL4091Secure channel.

TEE Protocol Types

TEE messages include requests, responses, heartbeats, and errors. Request types cover session initialization, message processing, tool execution, protected value storage/retrieval/deletion, session state, and termination.

On this page