(This is probably more suitable for the pox-dev list.)
On Jun 28, 2013, at 7:05 AM, Silvia Fichera wrote:
> To rebuild controller arp tables I was looking at packet class and, since the
> comments on
> https://github.com/CPqD/RouteFlow/blob/master/pox/pox/lib/packet/packet_base.py
> are outdated, I have no clear idea of what self.next and self.prev are.
>
> Can someone explain what they are and what they are used for?
> Reading the code I guessed that self.prev was pointing the header of lower
> level protocol and self.next of higher level protocol, but I would like
> confirm.
Right. Packets are parsed or constructed more or less as a doubly-linked list
of packet subclasses. .next points to the higher level protocol and .prev
points to the lower level protocol. When you pack() a packet, it traverses the
linked list to pack the types it encapsulates as well. Sometimes a packet
needs to know about something at a lower layer as well (e.g., calculating the
TCP checksum requires knowledge from the IP header).
When referring to the higher level protocol, it's actually preferable to use
the .payload property. When you're reading, it's the same as .next, but when
you set it, it automatically sets the payload's .prev:
a = arp()
e = ethernet()
e.payload = a
#a.prev is now e
I don't know exactly what you're intending to do, but you may be able to reuse
the misc.arp_helper or misc.arp_responder components and not have to muck
around with the packets directly.
-- Murphy
_______________________________________________
openflow-discuss mailing list
openflow-discuss@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/openflow-discuss