netlink_packet_route/
lib.rs

1// SPDX-License-Identifier: MIT
2
3//! The `netlink-packet-route` crate is designed to abstract Netlink route
4//! protocol(`rtnetlink`) packet into Rust data types. The goal of this crate is
5//! saving netlink user from reading Kernel Netlink codes.
6//!
7//! This crate grouped Netlink route protocol into these modules:
8//!  * `link`: NIC interface, similar to to `ip link` command.
9//!  * `address`: IP address, similar to `ip address` command.
10//!  * `route`: Route, similar to `ip route` command.
11//!  * `rule`: Route rule, similar to `ip rule` command.
12//!  * `tc`: Traffic control, similar to `tc` command.
13//!  * `neighbour`: Neighbour, similar to `ip neighbour` command.
14//!  * `neighbour_table`: Neighbour table, similar to `ip ntable` command.
15//!  * `nsid`: Namespace, similar to `ip netns` command.
16//!
17//! At the top level of this crate, we also provide:
18//!  * [AddressFamily]
19//!
20//! Normally, you should use [`rtnetlink`][rtnetlink_url] instead of using this
21//! crate directly.
22//!
23//! [rtnetlink_url]: https://docs.rs/rtnetlink
24
25pub mod address;
26pub mod link;
27pub mod neighbour;
28pub mod neighbour_table;
29pub mod nsid;
30pub mod prefix;
31pub mod route;
32pub mod rule;
33pub mod tc;
34
35mod message;
36#[cfg(test)]
37mod tests;
38
39pub(crate) mod ip;
40
41#[cfg(any(target_os = "linux", target_os = "fuchsia"))]
42mod address_family_linux;
43#[cfg(any(target_os = "linux", target_os = "fuchsia"))]
44pub use self::address_family_linux::AddressFamily;
45
46#[cfg(target_os = "freebsd")]
47mod address_family_freebsd;
48#[cfg(target_os = "freebsd")]
49pub use self::address_family_freebsd::AddressFamily;
50
51#[cfg(not(any(
52    target_os = "linux",
53    target_os = "fuchsia",
54    target_os = "freebsd",
55)))]
56mod address_family_fallback;
57#[cfg(not(any(
58    target_os = "linux",
59    target_os = "fuchsia",
60    target_os = "freebsd",
61)))]
62pub use self::address_family_fallback::AddressFamily;
63
64pub use self::ip::IpProtocol;
65pub use self::message::{RouteNetlinkMessage, RouteNetlinkMessageBuffer};
66
67#[macro_use]
68extern crate netlink_packet_utils;
69
70#[cfg(test)]
71#[macro_use]
72extern crate pretty_assertions;
73
74#[macro_use]
75extern crate bitflags;