diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-10-05 19:01:33 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-10-11 03:34:10 +0900 |
commit | f5d21573a54465599809144c156d60afee4de719 (patch) | |
tree | a9af89e36b93291c41d89c45c83512d866bec828 | |
parent | ef8284dfd16a429962c609a8e423ea746b25c0bc (diff) |
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>
-rw-r--r-- | ryu/lib/packet/packet.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py index 71b1db3c..a461eeea 100644 --- a/ryu/lib/packet/packet.py +++ b/ryu/lib/packet/packet.py @@ -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] |