diff --git a/doc/source/library_packet.rst b/doc/source/library_packet.rst index 8ca0e299..86bdbd4c 100644 --- a/doc/source/library_packet.rst +++ b/doc/source/library_packet.rst @@ -55,19 +55,18 @@ is used: @handler.set_ev_cls(ofp_event.EventOFPPacketIn, handler.MAIN_DISPATCHER) def packet_in_handler(self, ev): pkt = packet.Packet(array.array('B', ev.msg.data)) - for p in pkt.protocols: - print p - vp = pkt.find_protocol('vlan') - if vp: - print "vlan found:", vp.vid + for p in pkt: + print p.protocol_name, p + if p.protocol_name == 'vlan': + print 'vid = ', p.vid You see something like:: - - - - - vlan found: 10 + ethernet + vlan + vid = 10 + ipv4 + tcp