running_process/broker/capabilities.rs
1//! Shared capability bitmap constants for the v1 Hello/Negotiated exchange.
2//!
3//! `Hello.client_capabilities` and `Negotiated.server_capabilities` carry a
4//! `u64` bitmap. A capability is in effect only when both sides advertise it.
5//! Bit assignments are FROZEN once a release ships them — never reuse or
6//! renumber a bit (#228 frozen-forever commitments, #354 handoff tracker).
7
8/// Capability bit: the peer can participate in broker-to-backend connection
9/// handoff via platform handle passing (`DuplicateHandle` on Windows,
10/// `SCM_RIGHTS` on Unix).
11///
12/// When negotiated, the broker issues a one-time pending handoff token in
13/// `Negotiated.handle_passed_token`. Actual handle adoption is a later slice;
14/// reconnecting to `Negotiated.backend_pipe` remains the correctness path.
15pub const CAP_HANDLE_PASSING: u64 = 1 << 0;
16
17/// Whether this build carries a platform handle-passing transport at all.
18///
19/// Currently `true` on both Windows (`DuplicateHandle`) and Unix
20/// (`SCM_RIGHTS`), so this is effectively always `true`, but the check is
21/// kept explicit so a future target without a transport degrades to the
22/// reconnect path instead of advertising a capability it cannot honor.
23pub const fn handoff_transport_available() -> bool {
24 cfg!(any(windows, unix))
25}