This is the initializer for an iterator. Set selected to TRUE
when you want to iterate over the selected packets only, otherwise all
packets in the trace are iterated. Also initializes the
progress bar accordingly. By keeping iterators on the local
stack and not dynamically allocating/freeing each one, we
can simplify the usage a good deal. See nd_filer_activate() as
an example.
pit :
iterator to initialize.
trace :
trace whose packets are to be iterated.
selected :
iterate all packets or only selected?
nd_pit_get ()
ND_Packet* nd_pit_get (ND_PacketIterator *pit);
Accessor function, returns the packet the iterator currently
points to.
pit :
iterator to retrieve current packet from.
Returns :
currently iterated packet.
nd_pit_next ()
ND_Packet* nd_pit_next (ND_PacketIterator *pit);
This function advances the iterator, and returns that packet. If there are
no more packets, NULL is returned. Upon advancing the iterator,
the progressbar and the packet's tcpdump line automatically
get updated.
pit :
iterator to advance
Returns :
next packet.
nd_pit_get_index ()
int nd_pit_get_index (ND_PacketIterator *pit);
Assuming pit is an iterator over all packets (i.e. either
we're in apply-to-all mode or selected was not set when the
iterater was initialized), it is possible to get the index
of the currently iterated packet using this function. Otherwise,
-1 is returned.