Skip to main content

Module ipc

Module ipc 

Source
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_connect to negotiate protocol.
IpcHandshakeReply
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.