netlink_packet_route/
lib.rs

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