aboutsummaryrefslogtreecommitdiffstats
path: root/epan
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
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')
-rw-r--r--epan/libwireshark.def1
-rw-r--r--epan/tap.c47
-rw-r--r--epan/tap.h1
3 files changed, 49 insertions, 0 deletions
diff --git a/epan/libwireshark.def b/epan/libwireshark.def
index ce75ab0764..f6b46daa10 100644
--- a/epan/libwireshark.def
+++ b/epan/libwireshark.def
@@ -787,6 +787,7 @@ se_tree_create
se_tree_create_non_persistent
set_actual_length
set_profile_name
+set_tap_dfilter
show_fragment_seq_tree
show_fragment_tree
sid_name_snooping DATA
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
diff --git a/epan/tap.h b/epan/tap.h
index 30dfffb9f9..e9890cd03b 100644
--- a/epan/tap.h
+++ b/epan/tap.h
@@ -52,6 +52,7 @@ extern void draw_tap_listeners(gboolean draw_all);
extern GString *register_tap_listener(const char *tapname, void *tapdata,
const char *fstring, tap_reset_cb tap_reset, tap_packet_cb tap_packet,
tap_draw_cb tap_draw);
+extern GString *set_tap_dfilter(void *tapdata, const char *fstring);
extern void remove_tap_listener(void *tapdata);
extern gboolean have_tap_listeners(void);
extern gboolean have_tap_listener(int tap_id);