netlink_packet_route/address/
addr_flags.rs

1// SPDX-License-Identifier: MIT
2
3const IFA_F_SECONDARY: u32 = 0x01;
4const IFA_F_NODAD: u32 = 0x02;
5const IFA_F_OPTIMISTIC: u32 = 0x04;
6const IFA_F_DADFAILED: u32 = 0x08;
7const IFA_F_HOMEADDRESS: u32 = 0x10;
8const IFA_F_DEPRECATED: u32 = 0x20;
9const IFA_F_TENTATIVE: u32 = 0x40;
10const IFA_F_PERMANENT: u32 = 0x80;
11const IFA_F_MANAGETEMPADDR: u32 = 0x100;
12const IFA_F_NOPREFIXROUTE: u32 = 0x200;
13const IFA_F_MCAUTOJOIN: u32 = 0x400;
14const IFA_F_STABLE_PRIVACY: u32 = 0x800;
15
16bitflags! {
17    #[non_exhaustive]
18    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
19    pub struct AddressFlags : u32 {
20        const Secondary = IFA_F_SECONDARY;
21        const Nodad = IFA_F_NODAD;
22        const Optimistic = IFA_F_OPTIMISTIC;
23        const Dadfailed = IFA_F_DADFAILED;
24        const Homeaddress = IFA_F_HOMEADDRESS;
25        const Deprecated = IFA_F_DEPRECATED;
26        const Tentative = IFA_F_TENTATIVE;
27        const Permanent = IFA_F_PERMANENT;
28        const Managetempaddr = IFA_F_MANAGETEMPADDR;
29        const Noprefixroute = IFA_F_NOPREFIXROUTE;
30        const Mcautojoin = IFA_F_MCAUTOJOIN;
31        const StablePrivacy = IFA_F_STABLE_PRIVACY;
32        const _ = !0;
33    }
34}
35
36bitflags! {
37    #[non_exhaustive]
38    #[derive(Debug, Clone, Copy, Eq, PartialEq)]
39    /// [`AddressHeaderFlags`] is only used for [`super::AddressHeader`] and holding
40    /// subset(first byte) of [`AddressFlags`].
41    pub struct AddressHeaderFlags : u8 {
42        const Secondary = IFA_F_SECONDARY as u8;
43        const Nodad = IFA_F_NODAD as u8;
44        const Optimistic = IFA_F_OPTIMISTIC as u8;
45        const Dadfailed = IFA_F_DADFAILED as u8;
46        const Homeaddress = IFA_F_HOMEADDRESS as u8;
47        const Deprecated = IFA_F_DEPRECATED as u8;
48        const Tentative = IFA_F_TENTATIVE as u8;
49        const Permanent = IFA_F_PERMANENT as u8;
50        const _ = !0;
51    }
52}
53
54impl Default for AddressHeaderFlags {
55    fn default() -> Self {
56        Self::empty()
57    }
58}