diff options
author | Guy Harris <guy@alum.mit.edu> | 2009-06-05 22:42:47 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2009-06-05 22:42:47 +0000 |
commit | cf91fdf16b2d961024ea062503ce5fb91af28186 (patch) | |
tree | 2654abe47f378933a5d325856a7b3f877338dd19 /doc | |
parent | f84499059642f102c7272e72f74d7a986f51b520 (diff) | |
download | wireshark-cf91fdf16b2d961024ea062503ce5fb91af28186.tar.gz |
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
Diffstat (limited to 'doc')
-rw-r--r-- | doc/README.tapping | 38 |
1 files changed, 30 insertions, 8 deletions
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 *<pointer>), +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 *<pointer>), 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. |