netlink_rust/core/
mod.rs

1//! Netlink core parts
2
3#[macro_use]
4mod helpers;
5mod attribute;
6mod hardware_address;
7mod message;
8mod pack;
9mod socket;
10mod system;
11
12extended_enum!(Protocol, i32,
13    Route => 0,
14    Unused => 1,
15    Usersock => 2,
16    Firewall => 3,
17    SockDiag => 4,
18    Nflog => 5,
19    Xfrm => 6,
20    SELinux => 7,
21    ISCSI => 8,
22    Audit => 9,
23    FibLookup => 10,
24    Connector => 11,
25    Netfilter => 12,
26    IP6Fw => 13,
27    DNRtMsg => 14,
28    KObjectUevent => 15,
29    Generic => 16,
30    SCSITransport => 17,
31    ECryptFs => 18,
32    RDMA => 19,
33    Crypto => 20,
34    SMC => 21
35);
36
37pub use self::attribute::{nested_attribute_array, Attribute};
38pub use self::hardware_address::HardwareAddress;
39pub use self::message::{Header, Message, MessageFlags, MessageMode};
40pub use self::pack::{pack_vec, NativePack, NativeUnpack};
41pub use self::socket::{SendMessage, Socket};
42
43/// A trait for converting a value from one type to another.
44/// Any failure in converting will return None.
45pub trait ConvertFrom<T: Sized>
46where
47    Self: Sized,
48{
49    /// Convert value from one type to the other, returning None if conversion failed
50    fn convert_from(value: T) -> Option<Self>;
51}