pub fn lookup_id(&mut self, id: u32) -> Result<(String, String), NlError> {
        let attrs = GenlBuffer::new();
        let genlhdr = Genlmsghdr::<CtrlCmd, CtrlAttrMcastGrp>::new(CtrlCmd::Getfamily, 2, attrs);
        let nlhdr = Nlmsghdr::new(
            None,
            GenlId::Ctrl,
            NlmFFlags::new(&[NlmF::Ack, NlmF::Request, NlmF::Dump]),
            None,
            None,
            NlPayload::Payload(genlhdr),
        );

        self.send(nlhdr)?;
        for res_msg in self.iter::<Genlmsghdr<u8, CtrlAttr>>(false) {
            let msg = res_msg?;

            let mut attributes = msg
                .nl_payload
                .get_payload()
                .ok_or_else(|| NlError::new("No attributes returned in this message."))?
                .get_attr_handle();
            let name = attributes.get_attr_payload_as::<String>(CtrlAttr::FamilyName)?;
            let groups = match attributes.get_nested_attributes::<Index>(CtrlAttr::McastGroups) {
                Ok(grps) => grps,
                Err(_) => continue,
            };
            for group_by_index in groups.iter() {
                let attributes = group_by_index.get_attr_handle::<CtrlAttrMcastGrp>()?;
                if let Ok(mcid) = attributes.get_attr_payload_as::<u32>(CtrlAttrMcastGrp::Id) {
                    if mcid == id {
                        let mcast_name =
                            attributes.get_attr_payload_as::<String>(CtrlAttrMcastGrp::Name)?;
                        return Ok((name, mcast_name));
                    }
                }
            }
        }

        Err(NlError::new("ID does not correspond to a multicast group"))
    }
/// Look up netlink family and multicast group name by ID.
Look up netlink family and multicast group name by ID.
Look up netlink family and multicast group name by ID .
pub fn lookup_id(&mut self, id: u32) -> Result<(String, String), NlError> {
        let attrs = GenlBuffer::new();
        let genlhdr = Genlmsghdr::<CtrlCmd, CtrlAttrMcastGrp>::new(CtrlCmd::Getfamily, 2, attrs);
        let nlhdr = Nlmsghdr::new(
            None,
            GenlId::Ctrl,
            NlmFFlags::new(&[NlmF::Ack, NlmF::Request, NlmF::Dump]),
            None,
            None,
            NlPayload::Payload(genlhdr),
        );
        self.send(nlhdr)?;
        for res_msg in self.iter::<Genlmsghdr<u8, CtrlAttr>>(false) {
            let msg = res_msg?;
            let mut attributes = msg
                .nl_payload
                .get_payload()
                .ok_or_else(|| NlError::new("No attributes returned in this message."))?
                .get_attr_handle();
            let name = attributes.get_attr_payload_as::<String>(CtrlAttr::FamilyName)?;
            let groups = match attributes.get_nested_attributes::<Index>(CtrlAttr::McastGroups) {
                Ok(grps) => grps,
                Err(_) => continue,
            };
            for group_by_index in groups.iter() {
                let attributes = group_by_index.get_attr_handle::<CtrlAttrMcastGrp>()?;
                if let Ok(mcid) = attributes.get_attr_payload_as::<u32>(CtrlAttrMcastGrp::Id) {
                    if mcid == id {
                        let mcast_name =
                            attributes.get_attr_payload_as::<String>(CtrlAttrMcastGrp::Name)?;
                        return Ok((name, mcast_name));
                    }
                }
            }
        }
        Err(NlError::new("ID does not correspond to a multicast group"))
    }
pub fn lookup_id ( & mut self , id : u32 ) -> Result < ( String , String ) , NlError > { let attrs = GenlBuffer :: new ( ) ; let genlhdr = Genlmsghdr :: < CtrlCmd , CtrlAttrMcastGrp > :: new ( CtrlCmd :: Getfamily , 2 , attrs ) ; let nlhdr = Nlmsghdr :: new ( None , GenlId :: Ctrl , NlmFFlags :: new ( & [ NlmF :: Ack , NlmF :: Request , NlmF :: Dump ] ) , None , None , NlPayload :: Payload ( genlhdr ) , ) ; self . send ( nlhdr ) ? ; for res_msg in self . iter :: < Genlmsghdr < u8 , CtrlAttr > > ( false ) { let msg = res_msg ? ; let mut attributes = msg . nl_payload . get_payload ( ) . ok_or_else ( | | NlError :: new ( " " ) ) ? . get_attr_handle ( ) ; let name = attributes . get_attr_payload_as :: < String > ( CtrlAttr :: FamilyName ) ? ; let groups = match attributes . get_nested_attributes :: < Index > ( CtrlAttr :: McastGroups ) { Ok ( grps ) => grps , Err ( _ ) => continue , } ; for group_by_index in groups . iter ( ) { let attributes = group_by_index . get_attr_handle :: < CtrlAttrMcastGrp > ( ) ? ; if let Ok ( mcid ) = attributes . get_attr_payload_as :: < u32 > ( CtrlAttrMcastGrp :: Id ) { if mcid == id { let mcast_name = attributes . get_attr_payload_as :: < String > ( CtrlAttrMcastGrp :: Name ) ? ; return Ok ( ( name , mcast_name ) ) ; } } } } Err ( NlError :: new ( " " ) ) }
Look up netlink family and multicast group name by ID.
Look up netlink family and multicast group name by ID .
&mut self
id
u32
&mut self
id
u32