endurox-sys
Low-level Rust FFI bindings for Enduro/X middleware.
Enduro/X is a high-performance, open-source middleware platform that implements the XATMI API. This crate provides safe and unsafe Rust bindings to the Enduro/X C API, enabling you to build distributed transaction processing applications in Rust.
Features
- XATMI API - Complete bindings for
tpcall(),tpacall(),tpreturn(), etc. - UBF Buffers - Typed buffer manipulation with
Bchg(),Bget(), etc. - Server Development - Build Enduro/X servers with
atmisrvnomain() - Client Development - Create clients with
tpinit(),tpterm() - Derive Macros - Optional
#[derive(UbfStructDerive)]for automatic serialization - Type Safety - Safe wrappers around raw pointers and error handling
Installation
Add this to your Cargo.toml:
[]
= { = "0.1", = ["ubf", "server"] }
Prerequisites
- Enduro/X middleware installed and configured
NDRX_HOMEenvironment variable set- Oracle Instant Client (if using Oracle features)
Usage
Basic Client Example
use *;
Server Example with Derive
use *;
pub extern "C"
Features
ubf
Enables UBF buffer API bindings:
Bchg(),Bget(),Badd(),Bdel()- Field ID and type management
- Buffer allocation and manipulation
server
Enables server-side bindings:
atmisrvnomain()- Main server entry pointtpsvrinit(),tpsvrdone()- Server lifecycle hookstpadvertise(),tpunadvertise()- Service advertisement
client
Enables client-side bindings:
tpinit(),tpterm()- Connection managementtpcall(),tpacall(),tpgetrply()- Service calls
derive
Enables #[derive(UbfStructDerive)] macro for automatic UBF serialization.
Requires the endurox-derive crate.
Safety
Most functions in this crate are marked unsafe as they interact with C FFI and raw pointers. Safe wrappers can be found in higher-level crates built on top of endurox-sys.
Always ensure:
- Buffers are properly allocated before use
tpinit()is called before any XATMI operations- Resources are freed with
tpfree()andtpterm() - Error codes are checked after each operation
Error Handling
Use tperrno() and tpstrerror() to get error information:
use *;
unsafe
Documentation
For complete API documentation, see docs.rs/endurox-sys.
For Enduro/X documentation, visit www.endurox.org/dokuwiki.
License
Licensed under the MIT license. See LICENSE for details.
Related Crates
endurox-derive- Derive macros for UBF serializationendurox- High-level safe API (coming soon)