diff options
author | Evan Huus <eapache@gmail.com> | 2012-09-15 13:58:57 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2012-09-15 13:58:57 +0000 |
commit | dd01cc049038b934c19a33c4d2d01082ee58ca67 (patch) | |
tree | 7107823e4712007d0b58a472742471c52940d6e3 | |
parent | 5a7af5d6d96c647d75be8fb0f57e9bbe3e530fb2 (diff) |
From Niels Widger via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7725
Add get_filter method to Wireshark's Lua interface (to correspond with the
already-exposed set_filter method).
svn path=/trunk/; revision=44916
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | epan/funnel.h | 1 | ||||
-rw-r--r-- | epan/wslua/wslua_gui.c | 13 | ||||
-rw-r--r-- | ui/cli/tap-funnel.c | 6 | ||||
-rw-r--r-- | ui/gtk/funnel_stat.c | 5 |
5 files changed, 26 insertions, 0 deletions
@@ -3673,6 +3673,7 @@ Ben Bowen <bbowen[AT]godaddy.com> Bodo Petermann <bp245[AT]hotmail.com> Martin Kupec <martin.kupec[AT]kupson.cz> Litao Gao <ltgao[AT]juniper.net> +Niels Widger <niels[AT]qacafe.com> Dan Lasley <dlasley[AT]promus.com> gave permission for his dumpit() hex-dump routine to be used. diff --git a/epan/funnel.h b/epan/funnel.h index 53b7220b47..5208d88685 100644 --- a/epan/funnel.h +++ b/epan/funnel.h @@ -77,6 +77,7 @@ typedef struct _funnel_ops_t { void (*retap_packets)(void); void (*copy_to_clipboard)(GString *str); + gchar * (*get_filter)(void); void (*set_filter)(const char*); void (*set_color_filter_slot)(guint8 flit_nr, const gchar* filter); gboolean (*open_file)(const char* fname, const char* filter, const char** error); diff --git a/epan/wslua/wslua_gui.c b/epan/wslua/wslua_gui.c index 7ba46eb1ca..0c6888f5a1 100644 --- a/epan/wslua/wslua_gui.c +++ b/epan/wslua/wslua_gui.c @@ -792,6 +792,19 @@ WSLUA_FUNCTION wslua_open_capture_file(lua_State* L) { /* Open and display a cap } } +WSLUA_FUNCTION wslua_get_filter(lua_State* L) { /* Get the main filter text */ + const char *filter_str = NULL; + + if (!ops->get_filter) { + WSLUA_ERROR(get_filter, "GUI not available"); + } + + filter_str = ops->get_filter(); + lua_pushstring(L,filter_str); + + return 1; +} + WSLUA_FUNCTION wslua_set_filter(lua_State* L) { /* Set the main filter text */ #define WSLUA_ARG_set_filter_TEXT 1 /* The filter's text. */ const char* filter_str = luaL_checkstring(L,WSLUA_ARG_set_filter_TEXT); diff --git a/ui/cli/tap-funnel.c b/ui/cli/tap-funnel.c index 79d6ef33c8..0326ca874d 100644 --- a/ui/cli/tap-funnel.c +++ b/ui/cli/tap-funnel.c @@ -30,6 +30,11 @@ #include "config.h" #endif +#include <glib.h> +#include <wiretap/wtap.h> +#include <epan/nstime.h> +#include <epan/proto.h> + #include <epan/funnel.h> #include <stdio.h> #include <epan/stat_cmd_args.h> @@ -112,6 +117,7 @@ static const funnel_ops_t funnel_ops = { NULL, NULL, NULL, + NULL, NULL }; diff --git a/ui/gtk/funnel_stat.c b/ui/gtk/funnel_stat.c index 083899390d..03795efbec 100644 --- a/ui/gtk/funnel_stat.c +++ b/ui/gtk/funnel_stat.c @@ -468,6 +468,10 @@ static void funnel_new_dialog(const gchar* title, gtk_widget_show(win); } +static gchar * funnel_get_filter(void) { + return (gchar *)gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget)); +} + static void funnel_set_filter(const char* filter_string) { gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), filter_string); } @@ -571,6 +575,7 @@ static const funnel_ops_t funnel_ops = { funnel_logger, funnel_retap_packets, copy_to_clipboard, + funnel_get_filter, funnel_set_filter, funnel_set_color_filter_slot, funnel_open_file, |