packet lib: add unparsed data to Packet.protocols

Easy to access to the data that the library can't parse.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
FUJITA Tomonori 2012-10-05 19:01:33 +09:00
parent ef8284dfd1
commit f5d21573a5

View File

@ -35,6 +35,9 @@ class Packet(object):
self.parsed_bytes += proto.length
self.protocols.append(proto)
if len(self.data) > self.parsed_bytes:
self.protocols.append(self.data[self.parsed_bytes:])
def serialize(self):
self.data = bytearray()
r = self.protocols[::-1]