Signed-off-by: FUJITA Tomonori <[email protected]>
---
ryu/lib/packet/packet.py | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py
index c7963af..9355340 100644
--- a/ryu/lib/packet/packet.py
+++ b/ryu/lib/packet/packet.py
@@ -22,6 +22,7 @@ class Packet(object):
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?
@@ -55,3 +56,16 @@ class Packet(object):
for p in self.protocols:
if p.__class__.__name__ == name:
return p
+
+ def next(self):
+ try:
+ p = self.protocols[self.protocol_idx]
+ except:
+ self.protocol_idx = 0
+ raise StopIteration
+
+ self.protocol_idx += 1
+ return p
+
+ def __iter__(self):
+ return self
--
1.7.4.4
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel