returns a list of protocols that matches to the specified protocol. Cc: FUJITA Tomonori <fujita.tomon...@lab.ntt.co.jp> Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp> --- ryu/lib/packet/packet.py | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py index a40202f..09dd86d 100644 --- a/ryu/lib/packet/packet.py +++ b/ryu/lib/packet/packet.py @@ -88,6 +88,14 @@ class Packet(object): self.protocols.append(proto) + def get_protocols(self, protocol): + """Returns a list of protocols that matches to the specified protocol. + """ + if isinstance(protocol, packet_base.PacketBase): + protocol = protocol.__class__ + assert issubclass(protocol, packet_base.PacketBase) + return [p for p in self.protocols if isinstance(p, protocol)] + def next(self): try: p = self.protocols[self.protocol_idx] -- 1.7.10.4 ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel