From cf91fdf16b2d961024ea062503ce5fb91af28186 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 5 Jun 2009 22:42:47 +0000 Subject: Have tap listeners specify whether the "packet" routine requires a protocol tree; the column values. This includes stats-tree listeners. Have the routines to build the packet list, and to retap packets, honor those requirements. This means that cf_retap_packets() no longer needs an argument to specify whether to construct the column values or not, so get rid of that argument. This also means that there's no need for a tap to have a fake filter to ensure that the protocol tree will be built, so don't set up a fake "frame" filter. While we're at it, clean up some cases where "no filter" was represented as a null string rather than a null pointer. Have a routine to return an indication of the number of tap listeners with filters; use that rather than the global num_tap_filters. Clean up some indentation and some gboolean vs. gint items. svn path=/trunk/; revision=28645 --- doc/README.tapping | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'doc/README.tapping') diff --git a/doc/README.tapping b/doc/README.tapping index f437ed71e7..1dc4da0785 100644 --- a/doc/README.tapping +++ b/doc/README.tapping @@ -63,9 +63,10 @@ Only 3 callbacks and two functions. The two functions to start or stop tapping are -register_tap_listener(char *tapname, void *tapdata, char *fstring, - void (*reset)(void *tapdata), int (*packet)(void *tapdata, - packet_info *pinfo, epan_dissect_t *edt, const void *), +register_tap_listener(const char *tapname, void *tapdata, const char *fstring, + guint flags, + void (*reset)(void *tapdata), + gboolean (*packet)(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const void *), void (*draw)(void *tapdata)); remove_tap_listener(void *tapdata); @@ -105,20 +106,41 @@ unfiltered data and just filter it yourself in the packet-callback than to specify a filter string. ONLY use a filter string if no other option exist. +flags +is a set of flags for the tap listener. The flags that can be set are: + + TL_REQUIRES_PROTO_TREE + + set if your tap listener "packet" routine requires a protocol + tree to be built. It will require a protocol tree to be + built if either + + 1) it looks at the protocol tree in edt->tree + + or + + 2) the tap-specific data passed to it is constructed only if + the protocol tree is being built. + + TL_REQUIRES_COLUMNS + + set if your tap listener "packet" routine requires the column + strings to be constructed. + void (*reset)(void *tapdata) This callback is called whenever Wireshark wants to inform your listener that it is about to start [re]reading a capture file or a new capture from an interface and that your application should reset any state it has in the *tapdata instance. -int (*packet)(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, void *data) +gboolean (*packet)(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, void *data) This callback is used whenever a new packet has arrived at the tap and that it has passed the filter (if there were a filter). The *data structure type is specific to each tap. -This function returns an int and it should return - 1, if the data in the packet caused state to be updated - (and thus a redraw of the window would later be required) - 0, if we don't need to redraw the window. +This function returns an gboolean and it should return + TRUE, if the data in the packet caused state to be updated + (and thus a redraw of the window would later be required) + FALSE, if we don't need to redraw the window. NOTE: that (*packet) should be as fast and efficient as possible. Use this function ONLY to store data for later and do the CPU-intensive processing or GUI updates down in (*draw) instead. -- cgit v1.2.3