rayforce-sys 1.0.1

Raw FFI bindings to the RayforceDB v2 core (librayforce)
//! Raw FFI bindings to the RayforceDB v2 core (`librayforce`).
//!
//! Generated by `bindgen` from `wrapper.h` (the public `rayforce.h` plus a few
//! hand-declared internal symbols). 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.
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(clippy::all)]

include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

// 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" {
    /// Open a TCP connection to a Q server and perform the login handshake.
    /// Returns a connection fd (>= 0), or a negative `Q_ERR_*` code.
    pub fn q_connect(
        host: *const ::std::os::raw::c_char,
        port: ::std::os::raw::c_int,
        user: *const ::std::os::raw::c_char,
        password: *const ::std::os::raw::c_char,
        timeout_ms: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
    /// Close a connection fd. Returns 0 on success, -1 on an invalid fd.
    pub fn q_close(fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
    /// Encode + exchange + decode: send `msg` and return the decoded response
    /// (possibly a `RAY_ERROR`), or null on a transport/serialization failure
    /// with a short reason written to `err`.
    pub fn q_send(
        fd: ::std::os::raw::c_int,
        msg: *mut ray_t,
        err: *mut ::std::os::raw::c_char,
        errlen: usize,
    ) -> *mut ray_t;
    /// Decompress (if needed) and deserialize a response *body* (wire header
    /// already stripped) into a freshly-owned object — possibly a `RAY_ERROR`
    /// carrying a Q server-side error. Touches the symbol table: engine thread
    /// only. Returns null on a decode failure with a short reason in `err`.
    pub fn q_decode(
        resp: *mut u8,
        resp_len: i64,
        compressed: ::std::os::raw::c_int,
        err: *mut ::std::os::raw::c_char,
        errlen: usize,
    ) -> *mut ray_t;
}

/// `q_connect` failure codes (mirrors `q.h`).
pub const Q_ERR_SOCKET: ::std::os::raw::c_int = -1;
pub const Q_ERR_HANDSHAKE: ::std::os::raw::c_int = -2;
pub const Q_ERR_TIMEOUT: ::std::os::raw::c_int = -3;