Google

NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ ">

nd_packet_iterator

Name

nd_packet_iterator -- 

Description

Details

nd_pit_init ()

void        nd_pit_init                     (ND_PacketIterator *pit,
                                             ND_Trace *trace,
                                             gboolean selected);

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.


nd_pit_get ()

ND_Packet*  nd_pit_get                      (ND_PacketIterator *pit);

Accessor function, returns the packet the iterator currently points to.


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.


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.