Expand description
IPC handshake protocol for connection negotiation.
When a client connects to a server via IPC, it first sends an
IpcHandshake message. The server validates the magic number and
protocol version, then replies with an IpcHandshakeReply.
§Handshake flow
Client Server
│ │
│── IpcHandshake ──────────────▶│
│ (magic, version, nonce) │
│ │
│◀── IpcHandshakeReply ─────────│
│ (magic, version, status) │
│ │
│── normal IPC messages ───────▶│§Example
ⓘ
use strat9_abi::ipc::{IpcHandshake, IpcHandshakeReply};
// Client builds a handshake
let handshake = IpcHandshake::new_with_nonce(0xDEAD_BEEF);
assert!(handshake.is_valid());
assert!(handshake.is_compatible());
// Server validates and replies
let reply = if handshake.is_compatible() {
IpcHandshakeReply::ok()
} else {
IpcHandshakeReply::reject(1) // VERSION_MISMATCH
};Structs§
- IpcHandshake
- First message a client sends after
ipc_connectto negotiate protocol. - IpcHandshake
Reply - Server reply to a handshake.
Constants§
- IPC_
HANDSHAKE_ MAGIC - Magic number for IPC handshake (
"IPC9"in ASCII). - IPC_
HANDSHAKE_ OK - Handshake succeeded.
- IPC_
HANDSHAKE_ REJECTED - Connection rejected by the server (permissions, capacity, etc.).
- IPC_
HANDSHAKE_ VERSION_ MISMATCH - Protocol version mismatch between client and server.
- IPC_
PROTOCOL_ VERSION - Current IPC protocol version.