endurox_sys/
lib.rs

1//! Enduro/X FFI биндинги
2//!
3//! Этот crate предоставляет безопасные обертки вокруг Enduro/X C API.
4//!
5//! ## Features
6//! - `server` - Server API (tpsvrinit, tpsvrdone, ndrx_main)
7//! - `client` - Client API (tpinit, tpterm, tpacall, tpgetrply)
8//! - `ubf` - UBF (Unified Buffer Format) API
9//!
10//! ## Modules
11//! - `ffi` - Raw FFI биндинги
12//! - `server` - Server API
13//! - `client` - Client API
14//! - `ubf` - UBF API
15//! - `log` - Logging функции
16
17#![allow(dead_code)]
18#![allow(static_mut_refs)]
19
20pub mod ffi;
21pub mod log;
22
23#[cfg(feature = "server")]
24pub mod server;
25
26#[cfg(feature = "client")]
27pub mod client;
28
29#[cfg(feature = "ubf")]
30pub mod ubf;
31
32#[cfg(feature = "ubf")]
33pub mod ubf_struct;
34
35#[cfg(feature = "ubf")]
36pub mod ubf_fields;
37
38// Re-export derive macro
39#[cfg(feature = "derive")]
40pub use endurox_derive::UbfStruct;
41
42// Re-export common types
43pub use ffi::{TpSvcInfoRaw, TPFAIL, TPSUCCESS};
44pub use log::{tplog_debug, tplog_error, tplog_info, tplog_warn};
45
46#[cfg(feature = "server")]
47pub use server::*;
48
49#[cfg(feature = "client")]
50pub use client::*;
51
52// Stub implementations for client-only builds to satisfy libatmisrvnomain linkage
53#[cfg(all(feature = "client", not(feature = "server")))]
54mod client_stubs {
55    use libc::{c_char, c_int};
56
57    #[no_mangle]
58    pub extern "C" fn tpsvrinit(_argc: c_int, _argv: *mut *mut c_char) -> c_int {
59        -1
60    }
61
62    #[no_mangle]
63    pub extern "C" fn tpsvrdone() {}
64}