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::{RouteNetlinkMessage, RouteNetlinkMessageBuffer};
37
38/// The `netlink-packet-route` crate is designed to abstract Netlink route
39/// protocol(`rtnetlink`) packet into Rust data types. The goal of this crate is
40/// saving netlink user from reading Kernel Netlink codes.
41///
42/// This crate grouped Netlink route protocol into these modules:
43/// * `link`: NIC interface, similar to to `ip link` command.
44/// * `address`: IP address, similar to `ip address` command.
45/// * `route`: Route, similar to `ip route` command.
46/// * `rule`: Route rule, similar to `ip rule` command.
47/// * `tc`: Traffic control, similar to `tc` command.
48/// * `neighbour`: Neighbour, similar to `ip neighbour` command.
49/// * `neighbour_table`: Neighbour table, similar to `ip ntable` command.
50/// * `nsid`: Namespace, similar to `ip netns` command.
51///
52/// At the top level of this crate, we also provide:
53/// * [AddressFamily]
54///
55/// Normally, you should use [`rtnetlink`][rtnetlink_url] instead of using this
56/// crate directly.
57///
58/// [rtnetlink_url]: https://docs.rs/rtnetlink
59
60#[macro_use]
61extern crate netlink_packet_utils;
62
63#[macro_use]
64extern crate bitflags;