Safe Rust bindings to the NORM (NACK-Oriented Reliable Multicast) C library.
- Safe, idiomatic Rust API
- Automatic C library compilation via
build.rs - Cross-platform support (Linux, macOS, Windows)
- Type-safe enums for NORM events and configuration
- Zero-copy data access
git submodule update --init --recursive
cargo build
cargo run --example hellouse norm::{NormInstance, NormEventType, Result, object_get_data};
fn main() -> Result<()> {
let instance = NormInstance::new()?;
// Create sender
let sender = instance.create_session("224.1.2.3", 6003, 1)?;
sender.set_multicast_loopback(true)?;
sender.start_sender(1, 1024 * 1024, 1400, 64, 16, 2)?;
sender.data_enqueue(b"Hello, World!", b"")?;
// Create receiver
let receiver = instance.create_session("224.1.2.3", 6003, 2)?;
receiver.start_receiver(1024 * 1024)?;
// Process events
while let Some(event) = instance.get_next_event(false) {
if let Some(event_type) = NormEventType::from_raw(event.type_) {
if event_type == NormEventType::RxObjectCompleted {
if let Some(data) = unsafe { object_get_data(event.object) } {
println!("Received: {:?}", data);
}
}
}
}
Ok(())
}- hello - Basic send/receive example
- async - Descriptor-based I/O with
select()
Run with: cargo run --example <name>
- Rust 1.70+
- C++ compiler (g++, clang++, or MSVC)
- libclang (for bindgen)
- Linux: Full support (epoll-based I/O)
- macOS: Full support (kqueue-based I/O)
- Windows: Partial support (requires Windows-specific NORM sources)
make all # Format, lint, test, and build
make test # Run tests
make lint # Run linternorm/ # High-level safe Rust API
norm-sys/ # Low-level FFI bindings
examples/ # Example applications
MIT License for Rust bindings. The bundled NORM C library is licensed under the NRL (Naval Research Laboratory) license. See LICENSE for details.