Lines Matching refs:self
65 def _Debug(self, s): argument
66 if self.DEBUG:
69 def _NlAttr(self, nla_type, data): argument
76 def _NlAttrU32(self, nla_type, value): argument
77 return self._NlAttr(nla_type, struct.pack("=I", value))
79 def _GetConstantName(self, module, value, prefix): argument
90 def _Decode(self, command, msg, nla_type, nla_data): argument
94 def _ParseAttributes(self, command, family, msg, data): argument
123 nla_name, nla_data = self._Decode(command, msg, nla.nla_type, nla_data)
131 self._Debug(" %s" % str((nla_name, nla_data)))
135 def __init__(self): argument
137 self.seq = 0
138 self.sock = socket.socket(socket.AF_NETLINK, socket.SOCK_RAW, self.FAMILY)
139 self.sock.connect((0, 0)) # The kernel.
140 self.pid = self.sock.getsockname()[1]
142 def _Send(self, msg): argument
144 self.seq += 1
145 self.sock.send(msg)
147 def _Recv(self): argument
148 data = self.sock.recv(self.BUFSIZE)
152 def _ExpectDone(self): argument
153 response = self._Recv()
158 def _ParseAck(self, response): argument
168 def _ExpectAck(self): argument
169 response = self._Recv()
170 self._ParseAck(response)
172 def _SendNlRequest(self, command, data, flags): argument
175 nlmsg = NLMsgHdr((length, command, flags, self.seq, self.pid)).Pack()
177 self.MaybeDebugCommand(command, nlmsg + data)
180 self._Send(nlmsg + data)
183 self._ExpectAck()
185 def _ParseNLMsg(self, data, msgtype): argument
188 self._Debug(" %s" % nlmsghdr)
195 self._Debug(" %s" % nlmsg)
199 attributes = self._ParseAttributes(nlmsghdr.type, nlmsg.family,
204 def _GetMsg(self, msgtype): argument
205 data = self._Recv()
207 self._ParseAck(data)
208 return self._ParseNLMsg(data, msgtype)[0]
210 def _GetMsgList(self, msgtype, data, expect_done): argument
213 msg, data = self._ParseNLMsg(data, msgtype)
218 self._ExpectDone()
221 def _Dump(self, command, msg, msgtype, attrs): argument
237 nlmsghdr = NLMsgHdr((length, command, flags, self.seq, self.pid))
240 self._Send(nlmsghdr.Pack() + msg.Pack() + attrs)
245 data = self._Recv()
252 self._ParseAck(data)
253 out.extend(self._GetMsgList(msgtype, data, False))