Expand description
Typed repr(C) payload structs for fixed-size IPC messages.
Each struct derives zerocopy’s FromBytes + IntoBytes + Immutable,
enabling safe zero-cost cast to/from [IpcMessage] payloads via
[encode_fixed] / [decode_fixed].
§Conventions
- All sizes are ≤ 48 bytes (the payload capacity).
- Variable-length path/data fields use an
InlineBlobHeaderprefix. status == 0means success; non-zero is an errno-compatible error code.- Padding fields are named
_pador_reservedand must be zero.
§Wire format
Messages are sent through IPC ports or channels as raw bytes.
The msg_type field in the IpcMessage header identifies the operation.
The payload field contains the struct-specific data.
§Example
ⓘ
use strat9_abi::ipc_codec::{encode_fixed, decode_fixed, put_str, InlineBlobHeader};
use strat9_abi::ipc_payload::{OpenRequest, OpenReply};
// Encode an open request with path "/tmp/test"
let mut msg = encode_fixed(0x01, &OpenRequest {
flags: 0x02, // WRITE
path_hdr: InlineBlobHeader { len: 10, kind: 0 },
});
put_str(&mut msg.payload, 8, "/tmp/test").unwrap();
// Decode the reply
let reply: &OpenReply = decode_fixed(&reply_msg).unwrap();
assert_eq!(reply.status, 0); // successMacros§
Structs§
- Close
Request - Close request.
- Create
Reply - Create reply.
- Create
Request - Create request (file or directory).
- Lseek
Reply - Lseek reply.
- Lseek
Request - Lseek request.
- Open
Reply - Open reply.
- Open
Request - Open request.
- Read
Reply - Read reply prefix (variable-length data follows at offset 8).
- Read
Request - Read request.
- Stat
Request - Stat request.
- Status
Reply - Minimal reply carrying only a status code.
- TcpConnect
Reply - TCP connect reply.
- TcpConnect
Request - TCP connect request.
- Write
Reply - Write reply.
- Write
Request - Write request with variable-length inline data.