xdp_socket/util/
mod.rs

1//! # Utility Module for Network Operations
2//!
3//! ## Purpose
4//!
5//! This file serves as the entry point for the `util` module. It organizes and
6//! publicly exports various networking utilities required by the `xdp-socket` library
7//! and potentially useful for applications using it.
8//!
9//! ## How it works
10//!
11//! It declares the sub-modules (`netlink`, `packet`, `router`, `xdp`) using `pub mod`
12//! and `mod` statements. It then uses `pub use` to re-export the most important
13//! functions and structs from these sub-modules, creating a consolidated and easy-to-use
14//! public API for the `util` module.
15//!
16//! ## Main components
17//!
18//! - Module declarations: Brings the utility sub-modules into the crate's scope.
19//! - Public re-exports (`pub use`): Exposes functionalities like route lookups,
20//!   packet header creation, and netlink queries to the rest of the crate.
21
22pub mod netlink;
23pub mod packet;
24pub mod router;
25pub mod xdp_prog;
26pub mod mac_by_ifindex;
27
28pub use netlink::{find_default_gateway, get_ipv4_address, get_links, netlink, get_ipv4_routes, get_neighbors};
29pub use packet::write_udp_header_for;
30pub use router::{Ipv4Route, Neighbor, NextHop, Router};
31pub use xdp_prog::{OwnedXdpProg, xdp_features, xdp_attach_program};
32pub use mac_by_ifindex::mac_by_ifindex;