1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Raw FFI bindings to the RayforceDB v2 core (`librayforce`).
//!
//! Generated by `bindgen` from the core's own headers: the public
//! `rayforce.h`, plus the private ones declaring the handful of internal
//! symbols the safe crate needs (`INTERNAL_FNS` in `build.rs` is the full
//! list). This crate is `unsafe` and 1:1 with the C ABI; use the safe
//! `rayforce` crate instead.
//!
//! The header's function-like macros (`ray_type`, `ray_len`, `ray_data`,
//! `RAY_IS_ERR`, `RAY_IS_NULL`, …) are not emitted by bindgen — the safe crate
//! reimplements them in Rust against the generated [`ray_t`] layout.
include!;
// Q IPC wire-format client from the shared `rayforce-q` repo (q.c/q.h). Not
// part of the engine bindings; hand-declared here to match `q.h`.
extern "C"
/// `q_connect` failure codes (mirrors `q.h`).
pub const Q_ERR_SOCKET: c_int = -1;
pub const Q_ERR_HANDSHAKE: c_int = -2;
pub const Q_ERR_TIMEOUT: c_int = -3;
/// `ray_ipc_connect` failure codes.
///
/// The public header declares the function with no contract at all
/// (`include/rayforce.h`); this mirrors the comment on the private
/// `src/core/ipc.h` declaration and, for [`RAY_IPC_ERR_OS`], the
/// `connect_fail_code()` classifier in `src/core/ipc.c` that the header's
/// comment predates. Hand-maintained against a core bump, like `Q_ERR_*`.
///
/// [`RAY_IPC_ERR_REFUSED`] is the documented name for -1, but the core also
/// returns it for a missing poll, a credential buffer overflow and a failed
/// poll registration — treat it as the catch-all it is.
pub const RAY_IPC_ERR_REFUSED: i64 = -1;
/// The server demands credentials and the caller supplied no password.
pub const RAY_IPC_ERR_AUTH_REQUIRED: i64 = -2;
/// The server rejected the credentials.
pub const RAY_IPC_ERR_AUTH_FAILED: i64 = -3;
/// The peer speaks a different serialization wire version.
pub const RAY_IPC_ERR_WIRE_VERSION: i64 = -4;
/// No answer within the connect/handshake budget. The core folds `EAGAIN` and
/// `EWOULDBLOCK` in here too, so this also covers a live server that is busy
/// inside a long evaluation.
pub const RAY_IPC_ERR_TIMEOUT: i64 = -5;
/// Some other OS error; the core leaves `errno` holding it.
pub const RAY_IPC_ERR_OS: i64 = -6;