From fdaebbf4975f970f7dce82341920c20ad6098e0f Mon Sep 17 00:00:00 2001 From: guy 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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@28645 f5534014-38df-0310-8fa8-9805f1628bb7 --- tap-iostat.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'tap-iostat.c') diff --git a/tap-iostat.c b/tap-iostat.c index df4a1a1490..bb1180479b 100644 --- a/tap-iostat.c +++ b/tap-iostat.c @@ -69,7 +69,7 @@ typedef struct _io_stat_item_t { static int -iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *dummy _U_) +iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *dummy _U_) { io_stat_item_t *mit = arg; io_stat_item_t *it; @@ -488,14 +488,12 @@ register_io_tap(io_stat_t *io, int i, const char *filter) io->filters[i]=filter; flt=filter; - if(!filter){ - filter=""; - } field=NULL; hfi=NULL; for(j=0; calc_type_table[j].func_name; j++){ namelen=strlen(calc_type_table[j].func_name); - if(strncmp(filter, calc_type_table[j].func_name, namelen) == 0 + if(filter + && strncmp(filter, calc_type_table[j].func_name, namelen) == 0 && *(filter+namelen)=='('){ io->items[i].calc_type=calc_type_table[j].calc_type; @@ -600,7 +598,7 @@ CALC_TYPE_MAX 4 CALC_TYPE_AVG 5 */ - error_string=register_tap_listener("frame", &io->items[i], flt, NULL, iostat_packet, i?NULL:iostat_draw); + error_string=register_tap_listener("frame", &io->items[i], flt, TL_REQUIRES_PROTO_TREE, NULL, iostat_packet, i?NULL:iostat_draw); if(error_string){ g_free(io->items); g_free(io); -- cgit v1.2.3