// Copyright (C) 2020 - Will Glozer. All rights reserved. use anyhow::Result; use nell::{Family, Socket}; use nell::ffi::*; fn main() -> Result<()> { let sock = Socket::new(Family::ROUTE)?; sock.add_membership(RTNLGRP_LINK)?; sock.add_membership(RTNLGRP_IPV4_IFADDR)?; sock.add_membership(RTNLGRP_IPV6_IFADDR)?; let groups = sock.list_memberships()?; assert!(groups[0] & RTMGRP_LINK == RTMGRP_LINK); assert!(groups[0] & RTMGRP_IPV4_IFADDR == RTMGRP_IPV4_IFADDR); assert!(groups[0] & RTMGRP_IPV6_IFADDR == RTMGRP_IPV6_IFADDR); Ok(()) }