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", target_os = "android"))]
42mod address_family_linux;
43#[cfg(any(
44    target_os = "linux",
45    target_os = "fuchsia",
46    target_os = "android"
47))]
48pub use self::address_family_linux::AddressFamily;
49
50#[cfg(target_os = "freebsd")]
51mod address_family_freebsd;
52#[cfg(target_os = "freebsd")]
53pub use self::address_family_freebsd::AddressFamily;
54
55#[cfg(not(any(
56    target_os = "linux",
57    target_os = "fuchsia",
58    target_os = "freebsd",
59    target_os = "android",
60)))]
61mod address_family_fallback;
62#[cfg(not(any(
63    target_os = "linux",
64    target_os = "fuchsia",
65    target_os = "freebsd",
66    target_os = "android",
67)))]
68pub use self::address_family_fallback::AddressFamily;
69
70pub use self::ip::IpProtocol;
71pub use self::message::{RouteNetlinkMessage, RouteNetlinkMessageBuffer};
72
73#[macro_use]
74extern crate netlink_packet_utils;
75
76#[cfg(test)]
77#[macro_use]
78extern crate pretty_assertions;
79
80#[macro_use]
81extern crate bitflags;