Lines Matching refs:msg
205 msg = SadbMsg(reply)
207 if msg.errno != 0:
208 raise OSError(msg.errno, os.strerror(msg.errno))
211 def SendAndRecv(self, msg, extensions): argument
213 msg.seq = self.seq
214 msg.pid = os.getpid()
215 msg.len = (len(SadbMsg) + len(extensions)) / 8
216 self.sock.send(msg.Pack() + extensions)
242 msg = self.MakeSadbMsg(SADB_ADD, satype)
254 self.SendAndRecv(msg, self.PackPfKeyExtensions(extlist))
258 msg = self.MakeSadbMsg(SADB_DELETE, satype)
265 self.SendAndRecv(msg, self.PackPfKeyExtensions(extlist))
268 def DecodeSadbMsg(msg): argument
269 msgtype = _GetConstantName(msg.type, "SADB_")
270 satype = _GetConstantName(msg.satype, "SADB_TYPE_")
273 msg.version, msgtype, msg.errno, satype, msg.len,
274 msg.reserved, msg.seq, msg.pid))
287 def ExtensionsLength(msg, struct_type): argument
288 return (msg.len * 8) - len(struct_type)
304 msg = self.MakeSadbMsg(SADB_DUMP, SADB_TYPE_UNSPEC)
305 received = self.SendAndRecv(msg, "")
307 msg, data = cstruct.Read(received, SadbMsg)
308 extlen = self.ExtensionsLength(msg, SadbMsg)
310 dump.append((msg, self.ParseExtensions(extensions)))
311 if msg.seq == 0: # End of dump.
317 for msg, extensions in dump:
318 print(self.DecodeSadbMsg(msg))