neli/socket/mod.rs
1//! This module provides code that glues all of the other modules
2//! together and allows message send and receive operations.
3//!
4//! ## Important methods
5//! * [`NlSocket::send`][crate::socket::NlSocket::send] and
6//! [`NlSocket::recv`][crate::socket::NlSocket::recv] methods are meant to
7//! be the most low level calls. They essentially do what the C
8//! system calls `send` and `recv` do with very little abstraction.
9//! * [`NlSocketHandle::send`][crate::socket::NlSocket::send] and
10//! [`NlSocketHandle::recv`][crate::socket::NlSocket::recv] methods
11//! are meant to provide an interface that is more idiomatic for
12//! the library.
13//!
14//! ## Features
15//! The `async` feature exposed by `cargo` allows the socket to use
16//! Rust's [tokio](https://tokio.rs) for async IO.
17//!
18//! ## Additional methods
19//!
20//! There are methods for blocking and non-blocking, resolving
21//! generic netlink multicast group IDs, and other convenience
22//! functions so see if your use case is supported. If it isn't,
23//! please open a Github issue and submit a feature request.
24//!
25//! ## Design decisions
26//!
27//! The buffer allocated in the [`BufferPool`][crate::utils::synchronous::BufferPool]
28//! structure should be allocated on the heap. This is intentional as a buffer
29//! that large could be a problem on the stack.
30//!
31//! neli now uses [`BufferPool`][crate::utils::synchronous::BufferPool] to manage
32//! parallel message receive operations. Memory usage can be tuned using the following
33//! environment variables at compile time:
34//! * `NELI_AUTO_BUFFER_LEN`: This configures how many bytes are allocated for each
35//! buffer in the buffer pool.
36//! * `NELI_MAX_PARALLEL_READ_OPS`: This configures how many buffers of size
37//! `NELI_AUTO_BUFFER_LEN` are allocated for parallel receive operations.
38
39/// Asynchronous socket operations
40#[cfg(feature = "async")]
41pub mod asynchronous;
42mod shared;
43/// Synchronous socket operations
44#[cfg(feature = "sync")]
45pub mod synchronous;
46
47pub use crate::socket::shared::NlSocket;