lib60870
Safe Rust bindings to lib60870-C, an IEC 60870-5-101/104 protocol implementation.
Features
- Safe API - Automatic memory management with owned types
- Client (Master) - Connect to IEC 104 servers and send commands
- Server (Slave) - Accept connections and send spontaneous data
- Callbacks - Rust closures for handling events and data
Platform Support
| Platform | Status |
|---|---|
| Linux | ✅ Fully supported |
| macOS | ✅ Fully supported |
| Windows | ⚠️ Experimental (build works, runtime issues) |
Note: Windows support is experimental. The library compiles successfully but may have runtime issues related to DLL dependencies. Contributions to improve Windows support are welcome!
Usage
[]
= { = "https://github.com/..." }
# With TLS support:
= { = "https://github.com/...", = ["tls"] }
Quick Start - Client
use ConnectionBuilder;
use ;
Quick Start - Server
use ServerBuilder;
use ;
Low-Level Access
For advanced use cases, raw FFI bindings are available via the sys module:
use sys;
let version = unsafe ;
println!;
Cargo Features
| Feature | Description |
|---|---|
tls |
Enable TLS support (downloads mbedtls 2.28) |
debug |
Enable printf debug output |
no-threads |
Disable threading (for embedded systems) |
tcp-keepalive |
Enable TCP keep-alive |
How the Build Works
The build script (build.rs) automatically:
- Downloads lib60870 v2.3.6 from GitHub releases
- Downloads mbedtls v2.28.9 (only if
tlsfeature is enabled) - Compiles with CMake - builds the static library
- Generates Rust bindings with bindgen
All downloads are cached in target/ so subsequent builds are fast.
License
lib60870 is dual-licensed under GPLv3 and a commercial license. See lib60870 repository for details.