3 BQ@sdZddlZddlmZmZmZmZddlmZmZm Z dZ dZ dZ dZ dZd Zd ZdZdZdZdZdZd Zd ZGd d d Zd dZeZGdddeZGdddZee ZeeZdS)z Netlink message generation/parsing Copyright 2007 Johannes Berg GPLv2+; See copying for details. N) NLM_F_REQUESTNLMSG_MIN_TYPEMessageparse_attributes) NulStrAttr ConnectionNETLINK_GENERICc@seZdZdddZddZdS)GenlHdrrcCs||_||_dS)N)cmdversion)selfrrr/usr/lib/python3.6/genetlink.py__init__szGenlHdr.__init__cCstjd|j|jS)NBBxx)structpackrr)rrrr_dump!sz GenlHdr._dumpN)r)__name__ __module__ __qualname__rrrrrrrs rcCsttjd|S)Nr)rrunpack)datarrr_genl_hdr_parse$src@s&eZdZgdfddZeddZdS) GeNlMessagercCs4||_||_||_tj|||t|jg|ddS)N)flagspayload)rattrsfamilyrrr)rr$rr#r!rrrr*s  zGeNlMessage.__init__cCsP|j}|j}t|dd}t|j|jg|j}t|dd|_|j |_ |S)Nr ) recvr"rr typerr!rr#r)connmsgZpacketZhdrZgenlmsgrrrr%1szGeNlMessage.recvN)rrrr staticmethodr%rrrrr )sr c@seZdZddZddZdS) ControllercCs ||_dS)N)r')rr'rrrr>szController.__init__cCsBtt|}tttt|gd}|j|jtj|j}|j t j S)N)r!r#) rCTRL_ATTR_FAMILY_NAMEr GENL_ID_CTRLCTRL_CMD_GETFAMILYrsendr'r%r#CTRL_ATTR_FAMILY_IDu16)rr$amrrr get_family_id@s     zController.get_family_idN)rrrrr3rrrrr*=sr*)__doc__rZ iotop.netlinkrrrrrrrZCTRL_CMD_UNSPECZCTRL_CMD_NEWFAMILYZCTRL_CMD_DELFAMILYr-ZCTRL_CMD_NEWOPSZCTRL_CMD_DELOPSZCTRL_CMD_GETOPSZCTRL_ATTR_UNSPECr/r+ZCTRL_ATTR_VERSIONZCTRL_ATTR_HDRSIZEZCTRL_ATTR_MAXATTRZ CTRL_ATTR_OPSrrr,r r*Z connectionZ controllerrrrrs0