diff options
author | Shaun Crampton <Shaun.Crampton@metaswitch.com> | 2013-05-24 17:05:32 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2013-06-10 07:32:57 +0900 |
commit | f0dbb920116c1ac1375a88ced59cc9dfcdbc4efc (patch) | |
tree | b8ba2efab86017cc61cacffb1a37c18b4e9448cb | |
parent | 95f79d6a512b34b4f53509dbc30b58be29d631a6 (diff) |
packet lib: allow packet type to be specified when parsing packet
Signed-off-by: Shaun Crampton <Shaun.Crampton@metaswitch.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/packet/packet.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py index 2ef08c15..f5fd82df 100644 --- a/ryu/lib/packet/packet.py +++ b/ryu/lib/packet/packet.py @@ -31,15 +31,14 @@ class Packet(object): *data* should be omitted when encoding a packet. """ - def __init__(self, data=None): + def __init__(self, data=None, parse_cls=ethernet.ethernet): super(Packet, self).__init__() self.data = data self.protocols = [] self.protocol_idx = 0 self.parsed_bytes = 0 if self.data: - # Do we need to handle non ethernet? - self._parser(ethernet.ethernet) + self._parser(parse_cls) def _parser(self, cls): while cls: |