aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tap.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-02-17 00:35:55 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-02-17 00:35:55 +0000
commit43272f9435e91f59c66b40de544a772305d761c8 (patch)
treecdbdc56935627dc93a56f6a80aeec25f7a6df8ef /epan/tap.c
parent17504c44ad2f847608cac02a0b63f5f1fced3092 (diff)
Added an option to Conversations and Endpoints to limit the list to match
the current display filter. Some Hosts -> Endpoints cleanup. svn path=/trunk/; revision=24368
Diffstat (limited to 'epan/tap.c')
-rw-r--r--epan/tap.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/epan/tap.c b/epan/tap.c
index c57196b33b..6570eda8ef 100644
--- a/epan/tap.c
+++ b/epan/tap.c
@@ -411,6 +411,53 @@ register_tap_listener(const char *tapname, void *tapdata, const char *fstring, t
return NULL;
}
+/* this function sets a new dfilter to a tap listener
+ */
+GString *
+set_tap_dfilter(void *tapdata, const char *fstring)
+{
+ tap_listener_t *tl=NULL,*tl2;
+ GString *error_string;
+
+ if(!tap_listener_queue){
+ return NULL;
+ }
+
+ if(tap_listener_queue->tapdata==tapdata){
+ tl=(tap_listener_t *)tap_listener_queue;
+ } else {
+ for(tl2=(tap_listener_t *)tap_listener_queue;tl2->next;tl2=tl2->next){
+ if(tl2->next->tapdata==tapdata){
+ tl=tl2->next;
+ break;
+ }
+
+ }
+ }
+
+ if(tl){
+ if(tl->code){
+ dfilter_free(tl->code);
+ num_tap_filters--;
+ tl->code=NULL;
+ }
+ tl->needs_redraw=1;
+ if(fstring){
+ if(!dfilter_compile(fstring, &tl->code)){
+ error_string = g_string_new("");
+ g_string_sprintf(error_string,
+ "Filter \"%s\" is invalid - %s",
+ fstring, dfilter_error_msg);
+ return error_string;
+ } else {
+ num_tap_filters++;
+ }
+ }
+ }
+
+ return NULL;
+}
+
/* this function removes a tap listener
*/
void