pymnl.genl Module¶
-
pymnl.genl.
GENL_NAMSIZ
¶ The length of the family name.
Controller commands:
- CTRL_CMD_UNSPEC
- CTRL_CMD_NEWFAMILY
- CTRL_CMD_DELFAMILY
- CTRL_CMD_GETFAMILY
- CTRL_CMD_NEWOPS
- CTRL_CMD_DELOPS
- CTRL_CMD_GETOPS
- CTRL_CMD_NEWMCAST_GRP
- CTRL_CMD_DELMCAST_GRP
- CTRL_CMD_GETMCAST_GRP
Controller attribute types:
- CTRL_ATTR_UNSPEC
- CTRL_ATTR_FAMILY_ID
- CTRL_ATTR_FAMILY_NAME
- CTRL_ATTR_VERSION
- CTRL_ATTR_HDRSIZE
- CTRL_ATTR_MAXATTR
- CTRL_ATTR_OPS
- CTRL_ATTR_MCAST_GROUPS
Controller attribute operations:
- CTRL_ATTR_OP_UNSPEC
- CTRL_ATTR_OP_ID
- CTRL_ATTR_OP_FLAGS
Controller attribute multicast group flags:
- CTRL_ATTR_MCAST_GRP_UNSPEC
- CTRL_ATTR_MCAST_GRP_NAME
- CTRL_ATTR_MCAST_GRP_ID
-
class
pymnl.genl.
GenlFamilyAttrParser
(data_obj=None, offset=0)¶ Parser for generic netlink family attributes.
These are the attributes returned by CTRL_CMD_GETFAMILY.
-
__init__
(data_obj=None, offset=0)¶ Parse a string for generic netlink family attributes.
- data_obj - An optional object with attributes. The data
- object can be passed here and will be immediately parsed. Or the object can be sent to the parse() method after initialization. See parse() for more details.
-
ctrl_attr_family_id
(attr)¶ Save family id.
attr - Attr object
-
ctrl_attr_family_name
(attr)¶ Save family name.
attr - Attr object
-
ctrl_attr_hdrsize
(attr)¶ Save header size.
attr - Attr object
-
ctrl_attr_maxattr
(attr)¶ Save maximum attribute number.
attr - Attr object
-
ctrl_attr_mcast_groups
(attr)¶ Parse nested attributes with info about genl family multicast groups and save to dictionary.
attr - Attr object
-
ctrl_attr_ops
(attr)¶ Parse nested attributes with info about genl family operations and save to dictionary.
attr - Attr object
-
ctrl_attr_version
(attr)¶ Save version.
attr - Attr object
-
parse
(data_obj, offset=0)¶ Process the attributes.
- data_obj - An object containing attributes and providing the
- get_binary() method. See Message and Payload for examples of get_binary().
offset - offset into data at which to start
-
-
class
pymnl.genl.
GenlMessageHeader
(command=None, version=None)¶ An extra header for the message.
-
__init__
(command=None, version=None)¶ command - genl command to issue
version - genl protocol version
Implements genlmsghdr in a Pythonesque form.
-
__len__
()¶ Calculate and return genlmsghdr length.
-
__weakref__
¶ list of weak references to the object (if defined)
-
get_binary
()¶ Return a packed struct suitable for sending through a netlink socket.
Raises an exception if command and version have not been set before calling get_binary().
-
set_command
(command)¶ Set the header command.
command - genl command to issue
-
set_version
(version)¶ Set the header command.
version - genl protocol version
-