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 /tap-camelcounter.c | |
parent | f84499059642f102c7272e72f74d7a986f51b520 (diff) |
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 'tap-camelcounter.c')
-rw-r--r-- | tap-camelcounter.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/tap-camelcounter.c b/tap-camelcounter.c index 1989deeb42..18df797130 100644 --- a/tap-camelcounter.c +++ b/tap-camelcounter.c @@ -95,40 +95,24 @@ static void camelcounter_draw(void *phs) static void camelcounter_init(const char *optarg, void* userdata _U_) { struct camelcounter_t *p_camelcounter; - const char *filter=NULL; - const char *emptyfilter=""; GString *error_string; - if(!strncmp(optarg,"camel,counter,",13)){ - filter=optarg+13; - } else { - filter=NULL; - } - p_camelcounter = g_malloc(sizeof(struct camelcounter_t)); - if(filter){ - p_camelcounter->filter=g_strdup(filter); + if(!strncmp(optarg,"camel,counter,",13)){ + p_camelcounter->filter=g_strdup(optarg+13); } else { p_camelcounter->filter=NULL; } camelcounter_reset(p_camelcounter); - if (filter) { - error_string=register_tap_listener("CAMEL", - p_camelcounter, - filter, - NULL, - camelcounter_packet, - camelcounter_draw); - } else { - error_string=register_tap_listener("CAMEL", - p_camelcounter, - emptyfilter, - NULL, - camelcounter_packet, - camelcounter_draw); - } + error_string=register_tap_listener("CAMEL", + p_camelcounter, + p_camelcounter->filter, + 0, + NULL, + camelcounter_packet, + camelcounter_draw); if(error_string){ /* error, we failed to attach to the tap. clean up */ |