neli/consts/
nl.rs

1use crate as neli;
2
3use neli_proc_macros::neli_enum;
4
5use crate::consts::{netfilter::NetfilterMsg, rtnl::Rtm};
6
7impl_trait!(
8    /// Trait marking constants valid for use in
9    /// [`Nlmsghdr`][crate::nl::Nlmsghdr] field, `nl_type`.
10    pub NlType,
11    u16,
12    /// Wrapper that is usable with all values in
13    /// [`Nlmsghdr`][crate::nl::Nlmsghdr] field,
14    /// `nl_type`.
15    pub NlTypeWrapper,
16    Nlmsg,
17    GenlId,
18    Rtm,
19    NetfilterMsg
20);
21
22/// Values for `nl_type` in [`Nlmsghdr`][crate::nl::Nlmsghdr]
23#[neli_enum(serialized_type = "u16")]
24pub enum Nlmsg {
25    Noop = libc::NLMSG_NOOP as u16,
26    Error = libc::NLMSG_ERROR as u16,
27    Done = libc::NLMSG_DONE as u16,
28    Overrun = libc::NLMSG_OVERRUN as u16,
29}
30
31/// Values for `nl_type` in [`Nlmsghdr`][crate::nl::Nlmsghdr]
32#[neli_enum(serialized_type = "u16")]
33pub enum GenlId {
34    Ctrl = libc::GENL_ID_CTRL as u16,
35    #[cfg(target_env = "gnu")]
36    VfsDquot = libc::GENL_ID_VFS_DQUOT as u16,
37    #[cfg(target_env = "gnu")]
38    Pmcraid = libc::GENL_ID_PMCRAID as u16,
39}
40
41/// Values for `nl_flags` in [`Nlmsghdr`][crate::nl::Nlmsghdr]
42#[neli_enum(serialized_type = "u16")]
43pub enum NlmF {
44    /// This flag is required for all kernel requests
45    Request = libc::NLM_F_REQUEST as u16,
46    Multi = libc::NLM_F_MULTI as u16,
47    Ack = libc::NLM_F_ACK as u16,
48    Echo = libc::NLM_F_ECHO as u16,
49    DumpIntr = libc::NLM_F_DUMP_INTR as u16,
50    DumpFiltered = libc::NLM_F_DUMP_FILTERED as u16,
51    Root = libc::NLM_F_ROOT as u16,
52    Match = libc::NLM_F_MATCH as u16,
53    Atomic = libc::NLM_F_ATOMIC as u16,
54    Dump = libc::NLM_F_DUMP as u16,
55    Replace = libc::NLM_F_REPLACE as u16,
56    Excl = libc::NLM_F_EXCL as u16,
57    Create = libc::NLM_F_CREATE as u16,
58    Append = libc::NLM_F_APPEND as u16,
59}
60
61impl_flags!(
62    #[allow(missing_docs)]
63    pub NlmFFlags, NlmF, u16
64);