pub mod constants {
pub const RTNLGRP_LINK: u32 = 1;
pub const RTNLGRP_NEIGH: u32 = 3;
pub const RTNLGRP_IPV4_IFADDR: u32 = 5;
pub const RTNLGRP_IPV4_MROUTE: u32 = 6;
pub const RTNLGRP_IPV4_ROUTE: u32 = 7;
pub const RTNLGRP_IPV4_RULE: u32 = 8;
pub const RTNLGRP_IPV6_IFADDR: u32 = 9;
pub const RTNLGRP_IPV6_MROUTE: u32 = 10;
pub const RTNLGRP_IPV6_ROUTE: u32 = 11;
pub const RTNLGRP_IPV6_RULE: u32 = 19;
pub const RTNLGRP_IPV4_NETCONF: u32 = 24;
pub const RTNLGRP_IPV6_NETCONF: u32 = 25;
}
pub const fn multicast_group(group: u32) -> u32 {
if group > 31 {
panic!("use netlink_sys::Socket::add_membership() for this group");
}
if group == 0 {0}
else {1 << (group - 1)}
}
pub const fn multicast_groups(groups: &[u32]) -> u32 {
if let Some((&first, rest)) = groups.split_first() {
multicast_group(first) | multicast_groups(rest)
}
else {0}
}