Skip to main content

ironsbe_transport/
lib.rs

1//! # IronSBE Transport
2//!
3//! Network transport layer for SBE messaging.
4//!
5//! This crate provides:
6//! - [`traits`] - Backend-agnostic [`Transport`], [`Listener`], [`Connection`]
7//!   traits (always available)
8//! - [`tcp`] - Tokio-based TCP backend (feature `tcp-tokio`, enabled by
9//!   default)
10//! - [`udp`] - UDP unicast and multicast with A/B arbitration
11//! - [`ipc`] - Shared memory IPC transport
12//!
13//! # Selecting a backend
14//!
15//! The default feature set enables `tcp-tokio`.  To select it explicitly,
16//! disable default features and enable the backend feature directly:
17//!
18//! ```toml
19//! ironsbe-transport = { version = "...", default-features = false, features = ["tcp-tokio"] }
20//! ```
21//!
22//! [`DefaultTransport`] is a type alias that resolves to the backend selected
23//! by the active feature.  Code that is generic over `T: Transport` can use
24//! `DefaultTransport` as the default type parameter.
25
26pub mod error;
27pub mod ipc;
28pub mod traits;
29pub mod udp;
30
31#[cfg(feature = "tcp-tokio")]
32pub mod tcp;
33
34/// Linux io_uring TCP backend (feature `tcp-uring`).
35///
36/// This module is only compiled on Linux.  On other platforms enabling the
37/// `tcp-uring` feature is a no-op so the workspace can still build with the
38/// flag enabled (the optional `tokio-uring` dependency is target-conditional
39/// in `Cargo.toml`).
40#[cfg(all(feature = "tcp-uring", target_os = "linux"))]
41pub mod tcp_uring;
42
43/// AF_XDP partial kernel-bypass backend.
44///
45/// The pure-Rust pieces (frame parsers, `XdpStack` trait, `UdpStack`,
46/// `SmoltcpStack`) compile everywhere under the `xdp-stacks` feature.  The
47/// AF_XDP datapath itself is only compiled on Linux when both the `xdp`
48/// feature and `target_os = "linux"` are active.
49#[cfg(feature = "xdp-stacks")]
50pub mod xdp;
51
52pub use error::TransportError;
53pub use traits::{Connection, Listener, Transport};
54
55/// The transport backend selected by the active cargo feature.
56///
57/// Currently resolves to [`tcp::TokioTcpTransport`] when the `tcp-tokio`
58/// feature is enabled (the default).
59#[cfg(feature = "tcp-tokio")]
60pub type DefaultTransport = tcp::TokioTcpTransport;