From bug 6057:
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 27 Jun 2011 11:07:31 +0000 (11:07 +0000)
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 27 Jun 2011 11:07:31 +0000 (11:07 +0000)
Lua API: add support to temporary color filters (10 color slots)

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37801 f5534014-38df-0310-8fa8-9805f1628bb7

epan/funnel.h
epan/wslua/wslua_gui.c
gtk/funnel_stat.c
tap-funnel.c

index aa82a3bf35204c2afe2d0a246f61440b4858748e..bcd4e925fd7f6e3858fe12706c81cca38130f21d 100644 (file)
@@ -78,6 +78,7 @@ typedef struct _funnel_ops_t {
        void (*copy_to_clipboard)(GString *str);
     
        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);
        void (*reload)(void);
        void (*apply_filter)(void);
index 530dfba88c1e6cee7f4cca3b71eef49a3142f984..dfd4ace8891b5cd26750d60ad5d1f131f50abc4f 100644 (file)
@@ -801,6 +801,25 @@ WSLUA_FUNCTION wslua_set_filter(lua_State* L) { /* Set the main filter text */
        return 0;
 }
 
+WSLUA_FUNCTION wslua_set_color_filter_slot(lua_State* L) { /* Set color of the current packet */
+#define WSLUA_ARG_set_color_filter_slot_ROW 1 /* The row count in tmp filter list */
+#define WSLUA_ARG_set_color_filter_slot_TEXT  2 /* Filter */
+       guint8 row = luaL_checkint(L,WSLUA_ARG_set_color_filter_slot_ROW);
+       const gchar* filter_str = luaL_checkstring(L,WSLUA_ARG_set_color_filter_slot_TEXT);
+
+       if (!ops->set_color_filter_slot) {
+               WSLUA_ERROR(set_color_filter_slot, "GUI not available");
+       }
+
+       if (!filter_str) {
+               WSLUA_ARG_ERROR(set_color_filter_slot,TEXT,"Must be a string");
+       }
+
+       ops->set_color_filter_slot(row, filter_str);
+
+       return 0;
+}
+
 WSLUA_FUNCTION wslua_apply_filter(lua_State* L) { /* Apply the filter in the main filter box */
        if (!ops->apply_filter) {
                WSLUA_ERROR(apply_filter, "GUI not available");
index e1445262e74fd71c40050cfad79b3a75a9ef1b10..25d3ad5be28e5014c520c9215904e62aa4b4bad5 100644 (file)
@@ -51,8 +51,8 @@
 #include "../simple_dialog.h"
 #include "../file.h"
 #include "../stat_menu.h"
-#include "../file.h"
 #include "../progress_dlg.h"
+#include "../color_filters.h"
 
 #include "gtk/gui_utils.h"
 #include "gtk/dlg_utils.h"
@@ -464,6 +464,10 @@ static void funnel_set_filter(const char* filter_string) {
        gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), filter_string);
 }
 
+static void funnel_set_color_filter_slot(guint8 filt_nr, const gchar* filter_string) {
+    color_filters_set_tmp(filt_nr, (gchar *)filter_string, FALSE);
+}
+
 static void funnel_apply_filter(void) {
        const char* filter_string = gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
        main_filter_packets(&cfile, filter_string, FALSE);
@@ -560,6 +564,7 @@ static const funnel_ops_t funnel_ops = {
        funnel_retap_packets,
        copy_to_clipboard,
        funnel_set_filter,
+       funnel_set_color_filter_slot,
        funnel_open_file,
        funnel_reload,
        funnel_apply_filter,
index 1353e90469d79203caff4f1802784333df30ae39..290459e94beac08b9ab0852881a027dfa3757a55 100644 (file)
@@ -107,8 +107,9 @@ static const funnel_ops_t funnel_ops = {
     NULL,
     NULL,
     NULL,
-       NULL,
-       NULL,
+    NULL,
+    NULL,
+    NULL,
     NULL,
     NULL,
     NULL