From 9b6f806089352b60a724767a47391d6854f99c6a Mon Sep 17 00:00:00 2001 From: Sake Blok Date: Sat, 24 Nov 2007 11:38:16 +0000 Subject: This patch adds (ten) temporary coloring rules which will only live until Wireshark is quit. Temporary coloring filters can be set by: - pressing - will create a conversation coloring filter based on the addresses of the currently selected packet (order TCP/UDP/IP/Ethernet) This can also be achieved from the "View|Colorize Conversation" menu. - Rightclicking on a packet in the packet-list will give the option to "Colorize Conversation" just as "Conversation Filter" does. - Rightclicking on an item in the packet-detail-list will give the option to "Colorize with filter" which works similar to "Apply as filter" Temporary filters can be cleared from the same menus or by pressing -. This patch also adds an item to the above mentioned menu's to add a permanent color filter in the same way. The colors for the temporary coloring rules are now hardcoded as I do not know how to change the color of menu-items and therefore I chose to use icons to show the actual color of each of the ten temporary coloring rules. Is it at all possible to have different menu items in different colors? One other way of solving this is to recreate the icons on the fly after changing the colors. I will have a look into that once it is clear whether I can use different colors within the menu structure. svn path=/trunk/; revision=23560 --- AUTHORS | 11 +- color_filters.c | 104 +++++- color_filters.h | 9 +- doc/wireshark.pod | 8 + docbook/wsug_src/WSUG_chapter_customize.xml | 21 +- docbook/wsug_src/WSUG_chapter_use.xml | 36 ++ docbook/wsug_src/WSUG_chapter_work.xml | 20 + epan/prefs.c | 24 ++ epan/prefs.h | 2 + gtk/color_dlg.c | 101 ++--- gtk/compat_macros.h | 30 ++ gtk/main.c | 109 ++++-- gtk/main.h | 11 + gtk/menu.c | 558 +++++++++++++++++++--------- gtk/toolbar.c | 32 +- help/getting_started.txt | 7 +- 16 files changed, 818 insertions(+), 265 deletions(-) diff --git a/AUTHORS b/AUTHORS index 0131bfa11c..5d5892f305 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2672,6 +2672,16 @@ Jens Bräuer { Wifi Simple Config aka Wifi Protected Setup } +Sake Blok { + Cisco proprietary MST format support + "Copy as Filter" functionality + Split time_delta in time delta captured and time delta displayed + NetScreen snoop output (ascii) support + TCP Conversation timestamps + enable/disable indiviual coloring rules + temporary coloring rules with hotkeys +} + and by: Pavel Roskin @@ -2803,7 +2813,6 @@ Taner Kurtulus Joe Breher Patrick vd Lageweg Thomas Sillaber -Sake Blok Mike Davies Boris Misenov Joe McEachern diff --git a/color_filters.c b/color_filters.c index 2abadc9191..18a02422c3 100644 --- a/color_filters.c +++ b/color_filters.c @@ -43,6 +43,11 @@ #include #include "simple_dialog.h" #include "ui_util.h" +#include + +#define RED_COMPONENT(x) (guint16) (((((x) >> 16) & 0xff) * 65535 / 255)) +#define GREEN_COMPONENT(x) (guint16) (((((x) >> 8) & 0xff) * 65535 / 255)) +#define BLUE_COMPONENT(x) (guint16) ( (((x) & 0xff) * 65535 / 255)) static gboolean read_users_filters(GSList **cfl); @@ -80,6 +85,92 @@ color_filter_new(const gchar *name, /* The name of the filter to create */ return colorf; } +/* Add ten empty (temporary) colorfilters for easy coloring */ +void +color_filters_add_tmp(GSList **cfl) +{ + gchar *name = NULL; + gchar *stockstr = NULL; + guint32 i; + gchar** bg_colors; + gchar** fg_colors; + unsigned long int cval; + color_t bg_color, fg_color; + color_filter_t *colorf; + + g_assert(strlen(prefs.gui_colorized_fg)==69); + g_assert(strlen(prefs.gui_colorized_bg)==69); + fg_colors = g_strsplit(prefs.gui_colorized_fg, ",", -1); + bg_colors = g_strsplit(prefs.gui_colorized_bg, ",", -1); + + for ( i=1 ; i<=10 ; i++ ) { + name = g_strdup_printf("%s%02d",TEMP_COLOR_PREFIX,i); + + /* retrieve background and foreground colors */ + cval = strtoul(fg_colors[i-1], NULL, 16); + initialize_color(&fg_color, RED_COMPONENT(cval), + GREEN_COMPONENT(cval), + BLUE_COMPONENT(cval) ); + cval = strtoul(bg_colors[i-1], NULL, 16); + initialize_color(&bg_color, RED_COMPONENT(cval), + GREEN_COMPONENT(cval), + BLUE_COMPONENT(cval) ); + colorf = color_filter_new(name, NULL, &bg_color, &fg_color, TRUE); + colorf->filter_text = g_strdup("frame"); + colorf->c_colorfilter = NULL; + *cfl = g_slist_append(*cfl, colorf); + + g_free(name); + } + + g_strfreev(fg_colors); + g_strfreev(bg_colors); + + return; +} + +static gint +color_filters_find_by_name_cb(gconstpointer arg1, gconstpointer arg2) +{ + color_filter_t *colorf = (color_filter_t *)arg1; + gchar *name = (gchar *)arg2; + + return (strstr(colorf->filter_name, name)==NULL) ? -1 : 0 ; +} + + +/* Set the filter off a temporary colorfilters and enable it */ +void +color_filters_set_tmp(guint8 filt_nr, gchar *filter) +{ + gchar *name = NULL; + GSList *cfl; + color_filter_t *colorf; + dfilter_t *compiled_filter; + + name = g_strdup_printf("%s%02d",TEMP_COLOR_PREFIX,filt_nr); + cfl = g_slist_find_custom(color_filter_list, (gpointer *) name, color_filters_find_by_name_cb); + colorf = cfl->data; + + if(colorf) { + if (!dfilter_compile(filter, &compiled_filter)) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, + "Could not compile color filter name: \"%s\" text: \"%s\".\n%s", + name, filter, dfilter_error_msg); + } else { + if (colorf->filter_text != NULL) + g_free(colorf->filter_text); + if (colorf->c_colorfilter != NULL) + dfilter_free(colorf->c_colorfilter); + colorf->filter_text = g_strdup(filter); + colorf->c_colorfilter = compiled_filter; + colorf->disabled = FALSE; + } + } + g_free(name); + return; +} + /* delete the specified filter */ void color_filter_delete(color_filter_t *colorf) @@ -158,6 +249,9 @@ color_filters_init(void) /* delete all currently existing filters */ color_filter_list_delete(&color_filter_list); + /* start the list with the temporary colorizing rules */ + color_filters_add_tmp(&color_filter_list); + /* try to read the users filters */ if (!read_users_filters(&color_filter_list)) /* if that failed, try to read the global filters */ @@ -175,8 +269,7 @@ static void color_filters_clone_cb(gpointer filter_arg, gpointer user_data) { color_filter_t * new_colorf = color_filter_clone(filter_arg); - - color_filter_add_cb (new_colorf, user_data); + color_filter_add_cb (new_colorf, user_data); } void @@ -286,8 +379,8 @@ color_filters_colorize_packet(gint row, epan_dissect_t *edt) while(curr != NULL) { colorf = curr->data; - if ((colorf->c_colorfilter != NULL) && - (!colorf->disabled) && + if ( (!colorf->disabled) && + (colorf->c_colorfilter != NULL) && dfilter_apply_edt(colorf->c_colorfilter, edt)) { /* this is the filter to use, apply it to the packet list */ packet_list_set_colors(row, &(colorf->fg_color), &(colorf->bg_color)); @@ -549,7 +642,8 @@ write_filter(gpointer filter_arg, gpointer data_arg) color_filter_t *colorf = filter_arg; FILE *f = data->f; - if (colorf->selected || !data->only_selected) { + if ( (colorf->selected || !data->only_selected) && + (strstr(colorf->filter_name,TEMP_COLOR_PREFIX)==NULL) ) { fprintf(f,"%s@%s@%s@[%d,%d,%d][%d,%d,%d]\n", colorf->disabled ? "!" : "", colorf->filter_name, diff --git a/color_filters.h b/color_filters.h index 056115df17..e0851ac531 100644 --- a/color_filters.h +++ b/color_filters.h @@ -24,6 +24,7 @@ #ifndef __COLOR_FILTERS_H__ #define __COLOR_FILTERS_H__ +#define TEMP_COLOR_PREFIX "___tmp_color_filter___" /** @file * Color filters. */ @@ -65,7 +66,13 @@ gboolean color_filters_used(void); void color_filters_enable(gboolean enable); - +/** Set the filter string of a temporary color filter + * + * @param filt_nr a number 1-10 pointing to a temporary color + * @param filter the new filter-string + */ +void +color_filters_set_tmp(guint8 filt_nr, gchar *filter); /* Prime the epan_dissect_t with all the compiler * color filters of the current filter list. diff --git a/doc/wireshark.pod b/doc/wireshark.pod index a3ea5528af..ab254b76c0 100644 --- a/doc/wireshark.pod +++ b/doc/wireshark.pod @@ -1811,6 +1811,14 @@ Opens the Edit Color Filter dialog box for the selected filter. (If this button is disabled you may have more than one filter selected, making it ambiguous which is to be edited.) +=item ENABLE + +Enables the selected color filter(s). + +=item DISABLE + +Disables the selected color filter(s). + =item DELETE Deletes the selected color filter(s). diff --git a/docbook/wsug_src/WSUG_chapter_customize.xml b/docbook/wsug_src/WSUG_chapter_customize.xml index 4d9d65e8a6..813b329009 100644 --- a/docbook/wsug_src/WSUG_chapter_customize.xml +++ b/docbook/wsug_src/WSUG_chapter_customize.xml @@ -566,8 +566,8 @@ standard libpcap format. A very useful mechanism available in Wireshark is packet colorization. You can set-up Wireshark so that it will colorize packets according to a - filter. This allows you to emphasize the packets you are usually - interested in. + filter. This allows you to emphasize the packets you are (usually) + interested in. Tip! @@ -578,7 +578,22 @@ standard libpcap format. - To colorize packets, select the Coloring Rules... menu item from + There are two types of coloring rules in Wireshark. Temporary ones that are + only used until you quit the program. And permanent ones that will be saved to + a preference file so that they are available on a next session. + + + Temporary coloring rules can be added by selecting a packet and pressing + the <ctrl> key together with one of the number keys. This will + create a coloring rule based on the currently selected conversation. It will + try to create a conversation filter based on TCP first, then UDP, then IP + and at last Ethernet. Temporary filters can also be created by selecting + the "Colorize with Filter > Color X" menu items when rightclicking in the + packet-detail pane. + + + + To permanently colorize packets, select the Coloring Rules... menu item from the View menu; Wireshark will pop up the "Coloring Rules" dialog box as shown in . diff --git a/docbook/wsug_src/WSUG_chapter_use.xml b/docbook/wsug_src/WSUG_chapter_use.xml index fb287f0e8a..35462821f7 100644 --- a/docbook/wsug_src/WSUG_chapter_use.xml +++ b/docbook/wsug_src/WSUG_chapter_use.xml @@ -1022,6 +1022,42 @@ + + Coloring Converation + + + This menu item brings up a submenu that allows you + to color packets in the packet list pane based + on the addresses of the currently selected packet. + This makes it easy to distinguish packets + belonging to different conversations. + . + + + + Coloring Converation > Color 1-10 + + + These menu items enable one of the ten temporary color + filters based on the currently selected conversation. + + + + Coloring Converation > Reset coloring + + + This menu item clears all temporary coloring rules. + + + + Coloring Converation > New Coloring Rule... + + + This menu item opens a dialog window in which a new + permanent coloring rule can be created based on the + currently selected conversation. + + Coloring Rules... diff --git a/docbook/wsug_src/WSUG_chapter_work.xml b/docbook/wsug_src/WSUG_chapter_work.xml index e52073e0a9..e78ac4fb7b 100644 --- a/docbook/wsug_src/WSUG_chapter_work.xml +++ b/docbook/wsug_src/WSUG_chapter_work.xml @@ -129,6 +129,16 @@ to show the traffic between the two IP addresses of the current packet. XXX - add a new section describing this better. + + + + + Colorize Conversation + - + + + This menu item uses a display filter with the address information + from the selected packet to build a new colorizing rule. @@ -455,6 +465,16 @@ Prepare a display filter based on the currently selected item. + + + + + Colorize with Filter + - + + + Prepare a display filter based on the currently selected item + and use it to prepare a new colorize rule. diff --git a/epan/prefs.c b/epan/prefs.c index 00a499664b..e447aed95c 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -1187,6 +1187,8 @@ init_prefs(void) { prefs.gui_marked_bg.red = 0; prefs.gui_marked_bg.green = 0; prefs.gui_marked_bg.blue = 0; + prefs.gui_colorized_fg = g_strdup("000000,000000,000000,000000,000000,000000,000000,000000,000000,000000"); + prefs.gui_colorized_bg = g_strdup("ffc0c0,ffc0ff,e0c0e0,c0c0ff,c0e0e0,c0ffff,c0ffc0,ffffc0,e0e0c0,e0e0e0"); prefs.gui_geometry_save_position = 0; prefs.gui_geometry_save_size = 1; prefs.gui_geometry_save_maximized= 1; @@ -1537,6 +1539,8 @@ prefs_set_pref(char *prefarg) #define PRS_GUI_FONT_NAME_2 "gui.gtk2.font_name" #define PRS_GUI_MARKED_FG "gui.marked_frame.fg" #define PRS_GUI_MARKED_BG "gui.marked_frame.bg" +#define PRS_GUI_COLORIZED_FG "gui.colorized_frame.fg" +#define PRS_GUI_COLORIZED_BG "gui.colorized_frame.bg" #define PRS_GUI_CONSOLE_OPEN "gui.console_open" #define PRS_GUI_FILEOPEN_STYLE "gui.fileopen.style" #define PRS_GUI_RECENT_COUNT_MAX "gui.recent_files_count.max" @@ -1830,6 +1834,14 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_) prefs.gui_marked_bg.red = RED_COMPONENT(cval); prefs.gui_marked_bg.green = GREEN_COMPONENT(cval); prefs.gui_marked_bg.blue = BLUE_COMPONENT(cval); + } else if (strcmp(pref_name, PRS_GUI_COLORIZED_FG) == 0) { + if (prefs.gui_colorized_fg != NULL) + g_free(prefs.gui_colorized_fg); + prefs.gui_colorized_fg = g_strdup(value); + } else if (strcmp(pref_name, PRS_GUI_COLORIZED_BG) == 0) { + if (prefs.gui_colorized_bg != NULL) + g_free(prefs.gui_colorized_bg); + prefs.gui_colorized_bg = g_strdup(value); } else if (strcmp(pref_name, PRS_GUI_GEOMETRY_SAVE_POSITION) == 0) { if (strcasecmp(value, "true") == 0) { prefs.gui_geometry_save_position = TRUE; @@ -2608,6 +2620,18 @@ write_prefs(char **pf_path_return) (prefs.gui_marked_bg.green * 255 / 65535), (prefs.gui_marked_bg.blue * 255 / 65535)); + /* Don't write the colors of the 10 easy-access-colorfilters to the preferences + * file until the colors can be changed in the GUI. Currently this is not really + * possible since the STOCK-icons for these colors are hardcoded. + * + * XXX Find a way to change the colors of the STOCK-icons on the fly and then + * add these 10 colors to the list of colors that can be changed through + * the preferences. + * + fprintf (pf, "%s: %s\n", PRS_GUI_COLORIZED_FG, prefs.gui_colorized_fg); + fprintf (pf, "%s: %s\n", PRS_GUI_COLORIZED_BG, prefs.gui_colorized_bg); + */ + fprintf (pf, "\n# TCP stream window color preferences.\n"); fprintf (pf, "# Each value is a six digit hexadecimal color value in the form rrggbb.\n"); fprintf (pf, "%s: %02x%02x%02x\n", PRS_STREAM_CL_FG, diff --git a/epan/prefs.h b/epan/prefs.h index 230361eea1..fe3f2e1a35 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -124,6 +124,8 @@ typedef struct _e_prefs { gchar *gui_font_name2; color_t gui_marked_fg; color_t gui_marked_bg; + gchar *gui_colorized_fg; + gchar *gui_colorized_bg; gboolean gui_geometry_save_position; gboolean gui_geometry_save_size; gboolean gui_geometry_save_maximized; diff --git a/gtk/color_dlg.c b/gtk/color_dlg.c index 7c0459d28e..eb6a42a936 100644 --- a/gtk/color_dlg.c +++ b/gtk/color_dlg.c @@ -101,11 +101,15 @@ gboolean row_is_moving = FALSE; * The color filter items are not identical to the ones used for the * packet list display, so they can be safely edited. * + * Keep the temporary filters in a seperate list so that they are + * not showed in the edit-dialog + * * XXX - use the existing GTK list for this purpose and build temporary copies * e.g. for the save/export functions. * Problem: Don't know when able to safely throw away, e.g. while exporting. */ static GSList *color_filter_edit_list = NULL; +static GSList *color_filter_tmp_list = NULL; #define COLOR_UP_LB "color_up_lb" @@ -880,6 +884,7 @@ color_destroy_cb (GtkButton *button _U_, /* destroy the filter list itself */ color_filter_list_delete(&color_filter_edit_list); + color_filter_list_delete(&color_filter_tmp_list); colorize_win = NULL; } @@ -922,42 +927,49 @@ add_filter_to_list(gpointer filter_arg, gpointer list_arg) gint row; GdkColor bg, fg; - data[0] = colorf->filter_name; - data[1] = colorf->filter_text; - row = gtk_clist_append(GTK_CLIST(color_filters), data); - - color_t_to_gdkcolor(&fg, &colorf->fg_color); - color_t_to_gdkcolor(&bg, &colorf->bg_color); - - gtk_clist_set_row_data(GTK_CLIST(color_filters), row, colorf); + /* Only add permanent coloring rules to the edit-list */ + if( strstr(colorf->filter_name,TEMP_COLOR_PREFIX)==NULL) { + data[0] = colorf->filter_name; + data[1] = colorf->filter_text; + row = gtk_clist_append(GTK_CLIST(color_filters), data); - /* XXX Using light-gray on white for disabled coloring-rules is a - * workaround to using strikethrough as I don't know how to set - * text to strikethrough in GTK1. This needs to be changed to - * keep the GTK1 and GTK2 version simular - */ - gtk_clist_set_foreground(GTK_CLIST(color_filters), row, - colorf->disabled ? <GREY : &fg); - gtk_clist_set_background(GTK_CLIST(color_filters), row, - colorf->disabled ? &WHITE : &bg); -#else - gchar fg_str[14], bg_str[14]; - GtkListStore *store; - GtkTreeIter iter; + color_t_to_gdkcolor(&fg, &colorf->fg_color); + color_t_to_gdkcolor(&bg, &colorf->bg_color); - store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list_arg))); - gtk_list_store_append(store, &iter); - g_snprintf(fg_str, 14, "#%04X%04X%04X", - colorf->fg_color.red, colorf->fg_color.green, colorf->fg_color.blue); - g_snprintf(bg_str, 14, "#%04X%04X%04X", - colorf->bg_color.red, colorf->bg_color.green, colorf->bg_color.blue); - gtk_list_store_set(store, &iter, 0, colorf->filter_name, - 1, colorf->filter_text, 2, fg_str, 3, bg_str, - 4, colorf->disabled, 5, colorf, -1); -#endif - color_filter_edit_list = g_slist_append(color_filter_edit_list, colorf); + gtk_clist_set_row_data(GTK_CLIST(color_filters), row, colorf); - num_of_filters++; + /* XXX Using light-gray on white for disabled coloring-rules is a + * workaround to using strikethrough as I don't know how to set + * text to strikethrough in GTK1. This needs to be changed to + * keep the GTK1 and GTK2 version simular + */ + gtk_clist_set_foreground(GTK_CLIST(color_filters), row, + colorf->disabled ? <GREY : &fg); + gtk_clist_set_background(GTK_CLIST(color_filters), row, + colorf->disabled ? &WHITE : &bg); + #else + gchar fg_str[14], bg_str[14]; + GtkListStore *store; + GtkTreeIter iter; + + if( strstr(colorf->filter_name,TEMP_COLOR_PREFIX)==NULL) { + store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list_arg))); + gtk_list_store_append(store, &iter); + g_snprintf(fg_str, 14, "#%04X%04X%04X", + colorf->fg_color.red, colorf->fg_color.green, colorf->fg_color.blue); + g_snprintf(bg_str, 14, "#%04X%04X%04X", + colorf->bg_color.red, colorf->bg_color.green, colorf->bg_color.blue); + gtk_list_store_set(store, &iter, 0, colorf->filter_name, + 1, colorf->filter_text, 2, fg_str, 3, bg_str, + 4, colorf->disabled, 5, colorf, -1); + #endif + color_filter_edit_list = g_slist_append(color_filter_edit_list, colorf); + num_of_filters++; + } else { + /* But keep the temporary ones too, so they can be added again + * when the user is done editing */ + color_filter_tmp_list = g_slist_append(color_filter_tmp_list, colorf); + } } @@ -1279,19 +1291,10 @@ color_clear_cb(GtkWidget *widget, gpointer data _U_) { static void color_ok_cb(GtkButton *button _U_, gpointer user_data _U_) { - color_filters_apply(color_filter_edit_list); + /* Apply the new coloring rules... */ + color_apply_cb(button,user_data); - /* if we don't have a Save button, just save the settings now */ - if (!prefs.gui_use_pref_save) { - if (!color_filters_write(color_filter_edit_list)) - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Could not open filter file: %s", strerror(errno)); - } - - /* colorize list */ - cf_colorize_packets(&cfile); - - /* Destroy the dialog box. */ + /* ... and destroy the dialog box. */ window_destroy(colorize_win); } @@ -1300,7 +1303,7 @@ color_ok_cb(GtkButton *button _U_, gpointer user_data _U_) static void color_apply_cb(GtkButton *button _U_, gpointer user_data _U_) { - color_filters_apply(color_filter_edit_list); + GSList *cfl; /* if we don't have a Save button, just save the settings now */ if (!prefs.gui_use_pref_save) { @@ -1309,6 +1312,12 @@ color_apply_cb(GtkButton *button _U_, gpointer user_data _U_) "Could not open filter file: %s", strerror(errno)); } + /* merge the temporary coloring filters with the ones that just + * have been edited and apply them both */ + cfl = g_slist_concat(color_filter_tmp_list, color_filter_edit_list); + color_filters_apply(cfl); + + /* colorize list */ cf_colorize_packets(&cfile); } diff --git a/gtk/compat_macros.h b/gtk/compat_macros.h index 32dc95b24c..d33a199c1a 100644 --- a/gtk/compat_macros.h +++ b/gtk/compat_macros.h @@ -222,6 +222,16 @@ gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), name) #define WIRESHARK_STOCK_FILTER_OUT_STREAM "Filter Out This Stream" #define WIRESHARK_STOCK_ENABLE "Enable" #define WIRESHARK_STOCK_DISABLE "Disable" +#define WIRESHARK_STOCK_COLOR1 "Color 1" +#define WIRESHARK_STOCK_COLOR2 "Color 2" +#define WIRESHARK_STOCK_COLOR3 "Color 3" +#define WIRESHARK_STOCK_COLOR4 "Color 4" +#define WIRESHARK_STOCK_COLOR5 "Color 5" +#define WIRESHARK_STOCK_COLOR6 "Color 6" +#define WIRESHARK_STOCK_COLOR7 "Color 7" +#define WIRESHARK_STOCK_COLOR8 "Color 8" +#define WIRESHARK_STOCK_COLOR9 "Color 9" +#define WIRESHARK_STOCK_COLOR0 "Color 10" /** Create a stock button. Will create a "normal" button for GTK1. * @@ -359,6 +369,16 @@ g_signal_stop_emission_by_name(G_OBJECT(widget), name) #define WIRESHARK_STOCK_LABEL_FILTER_OUT_STREAM "Filter Out This Stream" #define WIRESHARK_STOCK_LABEL_ENABLE "Enable" #define WIRESHARK_STOCK_LABEL_DISABLE "Disable" +#define WIRESHARK_STOCK_LABEL_COLOR1 "Color 1" +#define WIRESHARK_STOCK_LABEL_COLOR2 "Color 2" +#define WIRESHARK_STOCK_LABEL_COLOR3 "Color 3" +#define WIRESHARK_STOCK_LABEL_COLOR4 "Color 4" +#define WIRESHARK_STOCK_LABEL_COLOR5 "Color 5" +#define WIRESHARK_STOCK_LABEL_COLOR6 "Color 6" +#define WIRESHARK_STOCK_LABEL_COLOR7 "Color 7" +#define WIRESHARK_STOCK_LABEL_COLOR8 "Color 8" +#define WIRESHARK_STOCK_LABEL_COLOR9 "Color 9" +#define WIRESHARK_STOCK_LABEL_COLOR0 "Color 10" #ifdef HAVE_LIBPCAP #define WIRESHARK_STOCK_CAPTURE_INTERFACES "Wireshark_Stock_CaptureInterfaces" @@ -401,6 +421,16 @@ g_signal_stop_emission_by_name(G_OBJECT(widget), name) #define WIRESHARK_STOCK_FILTER_OUT_STREAM "Wireshark_Stock_Filter_Out_This_Stream" #define WIRESHARK_STOCK_ENABLE "Wireshark_Stock_Enable" #define WIRESHARK_STOCK_DISABLE "Wireshark_Stock_Disable" +#define WIRESHARK_STOCK_COLOR1 "Wireshark_Stock_Color_1" +#define WIRESHARK_STOCK_COLOR2 "Wireshark_Stock_Color_2" +#define WIRESHARK_STOCK_COLOR3 "Wireshark_Stock_Color_3" +#define WIRESHARK_STOCK_COLOR4 "Wireshark_Stock_Color_4" +#define WIRESHARK_STOCK_COLOR5 "Wireshark_Stock_Color_5" +#define WIRESHARK_STOCK_COLOR6 "Wireshark_Stock_Color_6" +#define WIRESHARK_STOCK_COLOR7 "Wireshark_Stock_Color_7" +#define WIRESHARK_STOCK_COLOR8 "Wireshark_Stock_Color_8" +#define WIRESHARK_STOCK_COLOR9 "Wireshark_Stock_Color_9" +#define WIRESHARK_STOCK_COLOR0 "Wireshark_Stock_Color_10" #define BUTTON_NEW_FROM_STOCK(stock_id) \ gtk_button_new_from_stock(stock_id); diff --git a/gtk/main.c b/gtk/main.c index d542a5cabd..222f9b901f 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -130,6 +130,7 @@ #include "colors.h" #include "gui_utils.h" #include "compat_macros.h" +#include "color_dlg.h" #include "main.h" #include "menu.h" @@ -251,12 +252,12 @@ static void main_save_window_geometry(GtkWidget *widget); static void match_selected_cb_do(gpointer data, int action, gchar *text) { - GtkWidget *filter_te; - char *cur_filter, *new_filter; + GtkWidget *filter_te; + char *cur_filter, *new_filter; if ((!text) || (0 == strlen(text))) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not acquire information to build a filter!\nTry expanding or choosing another item."); - return; + return; } g_assert(data); @@ -268,45 +269,45 @@ match_selected_cb_do(gpointer data, int action, gchar *text) switch (action&MATCH_SELECTED_MASK) { case MATCH_SELECTED_REPLACE: - new_filter = g_strdup(text); - break; + new_filter = g_strdup(text); + break; case MATCH_SELECTED_AND: - if ((!cur_filter) || (0 == strlen(cur_filter))) - new_filter = g_strdup(text); - else - new_filter = g_strconcat("(", cur_filter, ") && (", text, ")", NULL); - break; + if ((!cur_filter) || (0 == strlen(cur_filter))) + new_filter = g_strdup(text); + else + new_filter = g_strconcat("(", cur_filter, ") && (", text, ")", NULL); + break; case MATCH_SELECTED_OR: - if ((!cur_filter) || (0 == strlen(cur_filter))) - new_filter = g_strdup(text); - else - new_filter = g_strconcat("(", cur_filter, ") || (", text, ")", NULL); - break; + if ((!cur_filter) || (0 == strlen(cur_filter))) + new_filter = g_strdup(text); + else + new_filter = g_strconcat("(", cur_filter, ") || (", text, ")", NULL); + break; case MATCH_SELECTED_NOT: - new_filter = g_strconcat("!(", text, ")", NULL); - break; + new_filter = g_strconcat("!(", text, ")", NULL); + break; case MATCH_SELECTED_AND_NOT: - if ((!cur_filter) || (0 == strlen(cur_filter))) - new_filter = g_strconcat("!(", text, ")", NULL); - else - new_filter = g_strconcat("(", cur_filter, ") && !(", text, ")", NULL); - break; + if ((!cur_filter) || (0 == strlen(cur_filter))) + new_filter = g_strconcat("!(", text, ")", NULL); + else + new_filter = g_strconcat("(", cur_filter, ") && !(", text, ")", NULL); + break; case MATCH_SELECTED_OR_NOT: - if ((!cur_filter) || (0 == strlen(cur_filter))) - new_filter = g_strconcat("!(", text, ")", NULL); - else - new_filter = g_strconcat("(", cur_filter, ") || !(", text, ")", NULL); - break; + if ((!cur_filter) || (0 == strlen(cur_filter))) + new_filter = g_strconcat("!(", text, ")", NULL); + else + new_filter = g_strconcat("(", cur_filter, ") || !(", text, ")", NULL); + break; default: - g_assert_not_reached(); - new_filter = NULL; - break; + g_assert_not_reached(); + new_filter = NULL; + break; } /* Free up the copy we got of the old filter text. */ @@ -314,17 +315,17 @@ match_selected_cb_do(gpointer data, int action, gchar *text) /* Don't change the current display filter if we only want to copy the filter */ if (action&MATCH_SELECTED_COPY_ONLY) { - GString *gtk_text_str = g_string_new(""); - g_string_sprintfa(gtk_text_str, "%s", new_filter); - copy_to_clipboard(gtk_text_str); - g_string_free(gtk_text_str, TRUE); + GString *gtk_text_str = g_string_new(""); + g_string_sprintfa(gtk_text_str, "%s", new_filter); + copy_to_clipboard(gtk_text_str); + g_string_free(gtk_text_str, TRUE); } else { - /* create a new one and set the display filter entry accordingly */ - gtk_entry_set_text(GTK_ENTRY(filter_te), new_filter); + /* create a new one and set the display filter entry accordingly */ + gtk_entry_set_text(GTK_ENTRY(filter_te), new_filter); - /* Run the display filter so it goes in effect. */ - if (action&MATCH_SELECTED_APPLY_NOW) - main_filter_packets(&cfile, new_filter, FALSE); + /* Run the display filter so it goes in effect. */ + if (action&MATCH_SELECTED_APPLY_NOW) + main_filter_packets(&cfile, new_filter, FALSE); } /* Free up the new filter text. */ @@ -334,7 +335,7 @@ match_selected_cb_do(gpointer data, int action, gchar *text) void match_selected_ptree_cb(GtkWidget *w, gpointer data, MATCH_SELECTED_E action) { - char *filter; + char *filter = NULL; if (cfile.finfo_selected) { filter = proto_construct_match_selected_string(cfile.finfo_selected, @@ -343,6 +344,34 @@ match_selected_ptree_cb(GtkWidget *w, gpointer data, MATCH_SELECTED_E action) } } +void +colorize_selected_ptree_cb(GtkWidget *w _U_, gpointer data _U_, guint8 filt_nr) +{ + char *filter = NULL; + + if (cfile.finfo_selected) { + filter = proto_construct_match_selected_string(cfile.finfo_selected, + cfile.edt); + if ((!filter) || (0 == strlen(filter))) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, + "Could not acquire information to build a filter!\n" + "Try expanding or choosing another item."); + return; + } + + if (filt_nr==0) { + color_display_with_filter(filter); + } else { + if (filt_nr==255) { + color_filters_init(); + } else { + color_filters_set_tmp(filt_nr,filter); + } + cf_colorize_packets(&cfile); + } + } +} + static void selected_ptree_info_answered_cb(gpointer dialog _U_, gint btn, gpointer data) { diff --git a/gtk/main.h b/gtk/main.h index 76694bdf8f..fdb9b8540f 100644 --- a/gtk/main.h +++ b/gtk/main.h @@ -145,6 +145,17 @@ extern void copy_selected_plist_cb(GtkWidget *w _U_, gpointer data); */ extern void match_selected_ptree_cb(GtkWidget *widget, gpointer data, MATCH_SELECTED_E action); +/** User requested the colorize function + * by menu or context menu of protocol tree. + * + * @param widget parent widget + * @param data parent widget + * @param filt_nr 1-10: use filter for color 1-10 + * 0: open new colorization rule dialog + * 255: clear filters for color 1-10 + */ +extern void colorize_selected_ptree_cb(GtkWidget *w, gpointer data, guint8 filt_nr); + /** User requested one of "Apply as Filter" or "Prepare a Filter" functions * by context menu of packet list. * diff --git a/gtk/menu.c b/gtk/menu.c index 816926859c..93a67e1956 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -194,190 +194,233 @@ File/Close: the Gnome HIG suggests putting this item just above the Quit #define CONV_UDP 4 #define CONV_CBA 5 -void -conversation_cb(GtkWidget * w, gpointer data _U_, int action) +char * +build_conversation_filter(int action, gboolean show_dialog) { packet_info *pi = &cfile.edt->pi; - char* buf; - GtkWidget *filter_te; + char *buf; switch(action) { case(CONV_CBA): - if (pi->profinet_type == 0) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Error filtering conversation. Please make\n" - "sure you have a PROFINET CBA packet selected."); - return; - } + if (pi->profinet_type == 0) { + if (show_dialog) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, + "Error filtering conversation. Please make\n" + "sure you have a PROFINET CBA packet selected."); + } + return NULL; + } - if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 - && pi->ipproto == 6 ) { - /* IPv4 */ - switch(pi->profinet_type) { - case(1): - buf = g_strdup_printf( - "(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)", - ip_to_str( pi->net_dst.data), - ip_to_str( pi->net_src.data), - ip_to_str( pi->net_src.data), - ip_to_str( pi->net_dst.data)); - break; - case(2): - buf = g_strdup_printf( - "(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)", - ip_to_str( pi->net_src.data), - ip_to_str( pi->net_dst.data), - ip_to_str( pi->net_dst.data), - ip_to_str( pi->net_src.data)); - break; - case(3): - buf = g_strdup_printf( - "(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)", - ip_to_str( pi->net_dst.data), - ip_to_str( pi->net_src.data), - ip_to_str( pi->net_src.data), - ip_to_str( pi->net_dst.data)); - break; - case(4): - buf = g_strdup_printf( - "(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)", - ip_to_str( pi->net_src.data), - ip_to_str( pi->net_dst.data), - ip_to_str( pi->net_dst.data), - ip_to_str( pi->net_src.data)); - break; - default: - return; - } - } else { - return; - } - break; + if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 + && pi->ipproto == 6 ) { + /* IPv4 */ + switch(pi->profinet_type) { + case(1): + buf = g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)", + ip_to_str( pi->net_dst.data), + ip_to_str( pi->net_src.data), + ip_to_str( pi->net_src.data), + ip_to_str( pi->net_dst.data)); + break; + case(2): + buf = g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)", + ip_to_str( pi->net_src.data), + ip_to_str( pi->net_dst.data), + ip_to_str( pi->net_dst.data), + ip_to_str( pi->net_src.data)); + break; + case(3): + buf = g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)", + ip_to_str( pi->net_dst.data), + ip_to_str( pi->net_src.data), + ip_to_str( pi->net_src.data), + ip_to_str( pi->net_dst.data)); + break; + case(4): + buf = g_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)", + ip_to_str( pi->net_src.data), + ip_to_str( pi->net_dst.data), + ip_to_str( pi->net_dst.data), + ip_to_str( pi->net_src.data)); + break; + default: + return NULL; + } + } else { + return NULL; + } + break; case(CONV_TCP): - if (cfile.edt->pi.ipproto != IP_PROTO_TCP) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Error filtering conversation. Please make\n" - "sure you have a TCP packet selected."); - return; - } + if (cfile.edt->pi.ipproto != IP_PROTO_TCP) { + if (show_dialog) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, + "Error filtering conversation. Please make\n" + "sure you have a TCP packet selected."); + } + return NULL; + } - if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 - && pi->ipproto == 6 ) { - /* TCP over IPv4 */ - buf = g_strdup_printf( - "(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", - ip_to_str( pi->net_src.data), - ip_to_str( pi->net_dst.data), - pi->srcport, pi->destport ); - } - else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 - && pi->ipproto == 6 ) { - /* TCP over IPv6 */ - buf = g_strdup_printf( - "(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", - ip6_to_str((const struct e_in6_addr *)pi->net_src.data), - ip6_to_str((const struct e_in6_addr *)pi->net_dst.data), - pi->srcport, pi->destport ); - } - else { - return; - } - break; + if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 + && pi->ipproto == 6 ) { + /* TCP over IPv4 */ + buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", + ip_to_str( pi->net_src.data), + ip_to_str( pi->net_dst.data), + pi->srcport, pi->destport ); + } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 + && pi->ipproto == 6 ) { + /* TCP over IPv6 */ + buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", + ip6_to_str((const struct e_in6_addr *)pi->net_src.data), + ip6_to_str((const struct e_in6_addr *)pi->net_dst.data), + pi->srcport, pi->destport ); + } else { + return NULL; + } + break; case(CONV_UDP): - if (cfile.edt->pi.ipproto != IP_PROTO_UDP) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Error filtering conversation. Please make\n" - "sure you have a UDP packet selected."); - return; - } + if (cfile.edt->pi.ipproto != IP_PROTO_UDP) { + if (show_dialog) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, + "Error filtering conversation. Please make\n" + "sure you have a UDP packet selected."); + } + return NULL; + } - if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 - && pi->ipproto == IP_PROTO_UDP /*6*/ ) { - /* UDP over IPv4 */ - buf = g_strdup_printf( - "(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)", - ip_to_str( pi->net_src.data), - ip_to_str( pi->net_dst.data), - pi->srcport, pi->destport ); - } - else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 - && pi->ipproto == IP_PROTO_UDP /*6*/ ) { - /* UDP over IPv6 */ - buf = g_strdup_printf( - "(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)", - ip6_to_str((const struct e_in6_addr *)pi->net_src.data), - ip6_to_str((const struct e_in6_addr *)pi->net_dst.data), - pi->srcport, pi->destport ); - } - else { - return; - } - break; + if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 + && pi->ipproto == IP_PROTO_UDP /*6*/ ) { + /* UDP over IPv4 */ + buf = g_strdup_printf("(ip.addr eq %s and ip.addr eq %s) and (udp.port eq %d and udp.port eq %d)", + ip_to_str( pi->net_src.data), + ip_to_str( pi->net_dst.data), + pi->srcport, pi->destport ); + } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 + && pi->ipproto == IP_PROTO_UDP /*6*/ ) { + /* UDP over IPv6 */ + buf = g_strdup_printf("(ipv6.addr eq %s and ipv6.addr eq %s) and (udp.port eq %d and udp.port eq %d)", + ip6_to_str((const struct e_in6_addr *)pi->net_src.data), + ip6_to_str((const struct e_in6_addr *)pi->net_dst.data), + pi->srcport, pi->destport ); + } else { + return NULL; + } + break; case(CONV_IP): - if (cfile.edt->pi.ethertype != 0x800) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Error filtering conversation. Please make\n" - "sure you have a IP packet selected."); - return; - } + if (cfile.edt->pi.ethertype != 0x800) { + if (show_dialog) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, + "Error filtering conversation. Please make\n" + "sure you have a IP packet selected."); + } + return NULL; + } - if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 - && pi->ipproto == 6 ) { - /* IPv4 */ - buf = g_strdup_printf( - "ip.addr eq %s and ip.addr eq %s", - ip_to_str( pi->net_src.data), - ip_to_str( pi->net_dst.data)); - } - else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 - && pi->ipproto == 6 ) { - /* IPv6 */ - buf = g_strdup_printf( - "ipv6.addr eq %s and ipv6.addr eq %s", - ip6_to_str((const struct e_in6_addr *)pi->net_src.data), - ip6_to_str((const struct e_in6_addr *)pi->net_dst.data)); - } - else { - return; - } - break; + if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 + && pi->ipproto == 6 ) { + /* IPv4 */ + buf = g_strdup_printf("ip.addr eq %s and ip.addr eq %s", + ip_to_str( pi->net_src.data), + ip_to_str( pi->net_dst.data)); + } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 + && pi->ipproto == 6 ) { + /* IPv6 */ + buf = g_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s", + ip6_to_str((const struct e_in6_addr *)pi->net_src.data), + ip6_to_str((const struct e_in6_addr *)pi->net_dst.data)); + } else { + return NULL; + } + break; case(CONV_ETHER): /* XXX - is this the right way to check for Ethernet? */ /* check for the data link address type */ /* (ethertype will be 0 when used as length field) */ if (cfile.edt->pi.dl_src.type != 1) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Error filtering conversation. Please make\n" - "sure you have a Ethernet packet selected."); - return; - } + if (show_dialog) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, + "Error filtering conversation. Please make\n" + "sure you have a Ethernet packet selected."); + } + return NULL; + } - if( pi->dl_src.type == 1 /*AT_IPv4*/ && pi->dl_dst.type == 1 /*AT_IPv4*/) { - /* Ethernet */ - buf = g_strdup_printf( - "eth.addr eq %s and eth.addr eq %s", - ether_to_str( pi->dl_src.data), - ether_to_str( pi->dl_dst.data)); - } - else { - return; - } - break; + if( pi->dl_src.type == 1 /*AT_IPv4*/ && pi->dl_dst.type == 1 /*AT_IPv4*/) { + /* Ethernet */ + buf = g_strdup_printf("eth.addr eq %s and eth.addr eq %s", + ether_to_str( pi->dl_src.data), + ether_to_str( pi->dl_dst.data)); + } else { + return NULL; + } + break; default: - return; + return NULL; } - filter_te = OBJECT_GET_DATA(w, E_DFILTER_TE_KEY); + return buf; +} - gtk_entry_set_text(GTK_ENTRY(filter_te), buf); +void +conversation_cb(GtkWidget * w, gpointer data _U_, int action) +{ + gchar *filter; + GtkWidget *filter_te; - /* Run the display filter so it goes in effect - even if it's the - same as the previous display filter. */ - main_filter_packets(&cfile, buf, TRUE); + /* create a filter-string based on the selected packet and action */ + filter = build_conversation_filter(action, TRUE); - g_free(buf); + /* Run the display filter so it goes in effect - even if it's the + same as the previous display filter. */ + filter_te = OBJECT_GET_DATA(w, E_DFILTER_TE_KEY); + gtk_entry_set_text(GTK_ENTRY(filter_te), filter); + main_filter_packets(&cfile, filter, TRUE); + g_free(filter); +} + +void +colorize_conversation_cb(GtkWidget * w _U_, gpointer data _U_, int action) +{ + gchar *filter = NULL; + + if( (action>>8) == 255 ) { + color_filters_init(); + cf_colorize_packets(&cfile); + } else { + if( (action&0xff) == 0 ) { + /* colorize_conversation_cb was called from the window-menu + * or through an accelerator key. Try to build a conversation + * filter in the order TCP, UDP, IP, Ethernet and apply the + * coloring */ + filter = build_conversation_filter(CONV_TCP,FALSE); + if( filter == NULL ) + filter = build_conversation_filter(CONV_UDP,FALSE); + if( filter == NULL ) + filter = build_conversation_filter(CONV_IP,FALSE); + if( filter == NULL ) + filter = build_conversation_filter(CONV_ETHER,FALSE); + if( filter == NULL ) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Unable to build conversation filter."); + return; + } + } else { + /* create a filter-string based on the selected packet and action */ + filter = build_conversation_filter(action&0xff, TRUE); + } + + if( (action>>8) == 0) { + /* Open the "new coloring filter" dialog with the filter */ + color_display_with_filter(filter); + } else { + /* Set one of the temporary coloring filters */ + color_filters_set_tmp(action>>8,filter); + cf_colorize_packets(&cfile); + } + + g_free(filter); + } } #ifdef HAVE_LUA_5_1 @@ -539,6 +582,33 @@ static GtkItemFactoryEntry menu_items[] = ITEM_FACTORY_ENTRY("/View/Collapse _All", "Left", collapse_all_cb, 0, NULL, NULL), ITEM_FACTORY_ENTRY("/View/", NULL, NULL, 0, "", NULL), + ITEM_FACTORY_ENTRY("/View/Colorize Conversation", NULL, NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/Color 1", "1", + colorize_conversation_cb, 1*256, WIRESHARK_STOCK_COLOR1), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/Color 2", "2", + colorize_conversation_cb, 2*256, WIRESHARK_STOCK_COLOR2), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/Color 3", "3", + colorize_conversation_cb, 3*256, WIRESHARK_STOCK_COLOR3), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/Color 4", "4", + colorize_conversation_cb, 4*256, WIRESHARK_STOCK_COLOR4), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/Color 5", "5", + colorize_conversation_cb, 5*256, WIRESHARK_STOCK_COLOR5), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/Color 6", "6", + colorize_conversation_cb, 6*256, WIRESHARK_STOCK_COLOR6), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/Color 7", "7", + colorize_conversation_cb, 7*256, WIRESHARK_STOCK_COLOR7), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/Color 8", "8", + colorize_conversation_cb, 8*256, WIRESHARK_STOCK_COLOR8), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/Color 9", "9", + colorize_conversation_cb, 9*256, WIRESHARK_STOCK_COLOR9), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/Color 10", "0", + colorize_conversation_cb, 10*256, WIRESHARK_STOCK_COLOR0), + ITEM_FACTORY_ENTRY("/View/Colorize Conversation/", NULL, + NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/View/Colorize Conversation/New Coloring Rule...", NULL, + colorize_conversation_cb, 0, GTK_STOCK_SELECT_COLOR), + ITEM_FACTORY_ENTRY("/View/Reset Coloring", "space", + colorize_conversation_cb, 255*256, NULL, NULL), ITEM_FACTORY_STOCK_ENTRY("/View/_Coloring Rules...", NULL, color_display_cb, 0, GTK_STOCK_SELECT_COLOR), ITEM_FACTORY_ENTRY("/View/", NULL, NULL, 0, "", NULL), @@ -716,6 +786,137 @@ static GtkItemFactoryEntry packet_list_menu_items[] = ITEM_FACTORY_ENTRY("/Conversation Filter/PN-CBA Server", NULL, conversation_cb, CONV_CBA, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation", NULL, NULL, 0, "",NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/Ethernet", NULL, NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/Color 1", NULL, + colorize_conversation_cb, CONV_ETHER+1*256, WIRESHARK_STOCK_COLOR1), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/Color 2", NULL, + colorize_conversation_cb, CONV_ETHER+2*256, WIRESHARK_STOCK_COLOR2), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/Color 3", NULL, + colorize_conversation_cb, CONV_ETHER+3*256, WIRESHARK_STOCK_COLOR3), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/Color 4", NULL, + colorize_conversation_cb, CONV_ETHER+4*256, WIRESHARK_STOCK_COLOR4), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/Color 5", NULL, + colorize_conversation_cb, CONV_ETHER+5*256, WIRESHARK_STOCK_COLOR5), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/Color 6", NULL, + colorize_conversation_cb, CONV_ETHER+6*256, WIRESHARK_STOCK_COLOR6), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/Color 7", NULL, + colorize_conversation_cb, CONV_ETHER+7*256, WIRESHARK_STOCK_COLOR7), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/Color 8", NULL, + colorize_conversation_cb, CONV_ETHER+8*256, WIRESHARK_STOCK_COLOR8), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/Color 9", NULL, + colorize_conversation_cb, CONV_ETHER+9*256, WIRESHARK_STOCK_COLOR9), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/Color 10", NULL, + colorize_conversation_cb, CONV_ETHER+10*256, WIRESHARK_STOCK_COLOR0), + ITEM_FACTORY_ENTRY("/Colorize Conversation/Ethernet/", NULL, + NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/Ethernet/New Coloring Rule...", NULL, + colorize_conversation_cb, CONV_ETHER, GTK_STOCK_SELECT_COLOR), + ITEM_FACTORY_ENTRY("/Colorize Conversation/IP", NULL, NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/Color 1", NULL, + colorize_conversation_cb, CONV_IP+1*256, WIRESHARK_STOCK_COLOR1), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/Color 2", NULL, + colorize_conversation_cb, CONV_IP+2*256, WIRESHARK_STOCK_COLOR2), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/Color 3", NULL, + colorize_conversation_cb, CONV_IP+3*256, WIRESHARK_STOCK_COLOR3), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/Color 4", NULL, + colorize_conversation_cb, CONV_IP+4*256, WIRESHARK_STOCK_COLOR4), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/Color 5", NULL, + colorize_conversation_cb, CONV_IP+5*256, WIRESHARK_STOCK_COLOR5), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/Color 6", NULL, + colorize_conversation_cb, CONV_IP+6*256, WIRESHARK_STOCK_COLOR6), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/Color 7", NULL, + colorize_conversation_cb, CONV_IP+7*256, WIRESHARK_STOCK_COLOR7), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/Color 8", NULL, + colorize_conversation_cb, CONV_IP+8*256, WIRESHARK_STOCK_COLOR8), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/Color 9", NULL, + colorize_conversation_cb, CONV_IP+9*256, WIRESHARK_STOCK_COLOR9), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/Color 10", NULL, + colorize_conversation_cb, CONV_IP+10*256, WIRESHARK_STOCK_COLOR0), + ITEM_FACTORY_ENTRY("/Colorize Conversation/IP/", NULL, + NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/IP/New Coloring Rule...", NULL, + colorize_conversation_cb, CONV_IP, GTK_STOCK_SELECT_COLOR), + ITEM_FACTORY_ENTRY("/Colorize Conversation/TCP", NULL, NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/Color 1", NULL, + colorize_conversation_cb, CONV_TCP+1*256, WIRESHARK_STOCK_COLOR1), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/Color 2", NULL, + colorize_conversation_cb, CONV_TCP+2*256, WIRESHARK_STOCK_COLOR2), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/Color 3", NULL, + colorize_conversation_cb, CONV_TCP+3*256, WIRESHARK_STOCK_COLOR3), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/Color 4", NULL, + colorize_conversation_cb, CONV_TCP+4*256, WIRESHARK_STOCK_COLOR4), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/Color 5", NULL, + colorize_conversation_cb, CONV_TCP+5*256, WIRESHARK_STOCK_COLOR5), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/Color 6", NULL, + colorize_conversation_cb, CONV_TCP+6*256, WIRESHARK_STOCK_COLOR6), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/Color 7", NULL, + colorize_conversation_cb, CONV_TCP+7*256, WIRESHARK_STOCK_COLOR7), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/Color 8", NULL, + colorize_conversation_cb, CONV_TCP+8*256, WIRESHARK_STOCK_COLOR8), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/Color 9", NULL, + colorize_conversation_cb, CONV_TCP+9*256, WIRESHARK_STOCK_COLOR9), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/Color 10", NULL, + colorize_conversation_cb, CONV_TCP+10*256, WIRESHARK_STOCK_COLOR0), + ITEM_FACTORY_ENTRY("/Colorize Conversation/TCP/", NULL, + NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/TCP/New Coloring Rule...", NULL, + colorize_conversation_cb, CONV_TCP, GTK_STOCK_SELECT_COLOR), + ITEM_FACTORY_ENTRY("/Colorize Conversation/UDP", NULL, NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/Color 1", NULL, + colorize_conversation_cb, CONV_UDP+1*256, WIRESHARK_STOCK_COLOR1), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/Color 2", NULL, + colorize_conversation_cb, CONV_UDP+2*256, WIRESHARK_STOCK_COLOR2), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/Color 3", NULL, + colorize_conversation_cb, CONV_UDP+3*256, WIRESHARK_STOCK_COLOR3), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/Color 4", NULL, + colorize_conversation_cb, CONV_UDP+4*256, WIRESHARK_STOCK_COLOR4), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/Color 5", NULL, + colorize_conversation_cb, CONV_UDP+5*256, WIRESHARK_STOCK_COLOR5), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/Color 6", NULL, + colorize_conversation_cb, CONV_UDP+6*256, WIRESHARK_STOCK_COLOR6), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/Color 7", NULL, + colorize_conversation_cb, CONV_UDP+7*256, WIRESHARK_STOCK_COLOR7), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/Color 8", NULL, + colorize_conversation_cb, CONV_UDP+8*256, WIRESHARK_STOCK_COLOR8), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/Color 9", NULL, + colorize_conversation_cb, CONV_UDP+9*256, WIRESHARK_STOCK_COLOR9), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/Color 10", NULL, + colorize_conversation_cb, CONV_UDP+10*256, WIRESHARK_STOCK_COLOR0), + ITEM_FACTORY_ENTRY("/Colorize Conversation/UDP/", NULL, + NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/UDP/New Coloring Rule...", NULL, + colorize_conversation_cb, CONV_UDP, GTK_STOCK_SELECT_COLOR), + ITEM_FACTORY_ENTRY("/Colorize Conversation/PN-CBA Server", NULL, NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/Color 1", NULL, + colorize_conversation_cb, CONV_CBA+1*256, WIRESHARK_STOCK_COLOR1), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/Color 2", NULL, + colorize_conversation_cb, CONV_CBA+2*256, WIRESHARK_STOCK_COLOR2), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/Color 3", NULL, + colorize_conversation_cb, CONV_CBA+3*256, WIRESHARK_STOCK_COLOR3), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/Color 4", NULL, + colorize_conversation_cb, CONV_CBA+4*256, WIRESHARK_STOCK_COLOR4), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/Color 5", NULL, + colorize_conversation_cb, CONV_CBA+5*256, WIRESHARK_STOCK_COLOR5), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/Color 6", NULL, + colorize_conversation_cb, CONV_CBA+6*256, WIRESHARK_STOCK_COLOR6), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/Color 7", NULL, + colorize_conversation_cb, CONV_CBA+7*256, WIRESHARK_STOCK_COLOR7), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/Color 8", NULL, + colorize_conversation_cb, CONV_CBA+8*256, WIRESHARK_STOCK_COLOR8), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/Color 9", NULL, + colorize_conversation_cb, CONV_CBA+9*256, WIRESHARK_STOCK_COLOR9), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/Color 10", NULL, + colorize_conversation_cb, CONV_CBA+10*256, WIRESHARK_STOCK_COLOR0), + ITEM_FACTORY_ENTRY("/Colorize Conversation/PN-CBA Server/", NULL, + NULL, 0, "",NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize Conversation/PN-CBA Server/New Coloring Rule...", NULL, + colorize_conversation_cb, CONV_CBA, GTK_STOCK_SELECT_COLOR), + ITEM_FACTORY_ENTRY("/Colorize Conversation/", NULL, + NULL, 0, "",NULL), + ITEM_FACTORY_ENTRY("/Colorize Conversation/Reset Coloring", NULL, + colorize_conversation_cb, 255*256, NULL, NULL), + ITEM_FACTORY_ENTRY("/SCTP", NULL, NULL, 0, "",NULL), ITEM_FACTORY_ENTRY("/SCTP/Analyse this Association", NULL, sctp_analyse_start, 0, NULL,NULL), @@ -795,6 +996,21 @@ static GtkItemFactoryEntry tree_view_menu_items[] = ITEM_FACTORY_ENTRY("/Prepare a Filter/... o_r not Selected", NULL, match_selected_ptree_cb, MATCH_SELECTED_OR_NOT, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize with Filter", NULL, NULL, 0, "", NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/Color 1", NULL, colorize_selected_ptree_cb, 1, WIRESHARK_STOCK_COLOR1), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/Color 2", NULL, colorize_selected_ptree_cb, 2, WIRESHARK_STOCK_COLOR2), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/Color 3", NULL, colorize_selected_ptree_cb, 3, WIRESHARK_STOCK_COLOR3), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/Color 4", NULL, colorize_selected_ptree_cb, 4, WIRESHARK_STOCK_COLOR4), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/Color 5", NULL, colorize_selected_ptree_cb, 5, WIRESHARK_STOCK_COLOR5), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/Color 6", NULL, colorize_selected_ptree_cb, 6, WIRESHARK_STOCK_COLOR6), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/Color 7", NULL, colorize_selected_ptree_cb, 7, WIRESHARK_STOCK_COLOR7), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/Color 8", NULL, colorize_selected_ptree_cb, 8, WIRESHARK_STOCK_COLOR8), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/Color 9", NULL, colorize_selected_ptree_cb, 9, WIRESHARK_STOCK_COLOR9), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/Color 10", NULL, colorize_selected_ptree_cb, 10, WIRESHARK_STOCK_COLOR0), + ITEM_FACTORY_ENTRY("/Colorize with Filter/Reset Coloring", NULL, colorize_selected_ptree_cb, 255, NULL, NULL), + ITEM_FACTORY_ENTRY("/Colorize with Filter/", NULL, NULL, 0, "", NULL), + ITEM_FACTORY_STOCK_ENTRY("/Colorize with Filter/New Coloring Rule...", NULL, colorize_selected_ptree_cb, 0, GTK_STOCK_SELECT_COLOR), + ITEM_FACTORY_ENTRY("/Follow TCP Stream", NULL, follow_tcp_stream_cb, 0, NULL, NULL), ITEM_FACTORY_ENTRY("/Follow UDP Stream", NULL, follow_udp_stream_cb, @@ -848,19 +1064,19 @@ static GtkAccelGroup *grp; GtkWidget * main_menu_new(GtkAccelGroup ** table) { - GtkWidget *menubar; + GtkWidget *menubar; - grp = gtk_accel_group_new(); + grp = gtk_accel_group_new(); - if (initialize) - menus_init(); + if (initialize) + menus_init(); - menubar = main_menu_factory->widget; + menubar = main_menu_factory->widget; - if (table) - *table = grp; + if (table) + *table = grp; - return menubar; + return menubar; } @@ -2495,6 +2711,16 @@ set_menus_for_selected_packet(capture_file *cf) cf->current_frame != NULL ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE); set_menu_sensitivity(packet_list_menu_factory, "/Conversation Filter/PN-CBA Server", cf->current_frame != NULL ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE); + set_menu_sensitivity(packet_list_menu_factory, "/Colorize Conversation/Ethernet", + cf->current_frame != NULL ? (cf->edt->pi.dl_src.type == 1) : FALSE); + set_menu_sensitivity(packet_list_menu_factory, "/Colorize Conversation/IP", + cf->current_frame != NULL ? (cf->edt->pi.ethertype == 0x800) : FALSE); + set_menu_sensitivity(packet_list_menu_factory, "/Colorize Conversation/TCP", + cf->current_frame != NULL ? (cf->edt->pi.ipproto == IP_PROTO_TCP) : FALSE); + set_menu_sensitivity(packet_list_menu_factory, "/Colorize Conversation/UDP", + cf->current_frame != NULL ? (cf->edt->pi.ipproto == IP_PROTO_UDP) : FALSE); + set_menu_sensitivity(packet_list_menu_factory, "/Colorize Conversation/PN-CBA Server", + cf->current_frame != NULL ? (cf->edt->pi.profinet_type != 0 && cf->edt->pi.profinet_type < 10) : FALSE); set_menu_sensitivity(main_menu_factory, "/Analyze/Decode As...", cf->current_frame != NULL && decode_as_ok()); set_menu_sensitivity(packet_list_menu_factory, "/Decode As...", diff --git a/gtk/toolbar.c b/gtk/toolbar.c index 91c533b189..57a1a0bde4 100644 --- a/gtk/toolbar.c +++ b/gtk/toolbar.c @@ -144,6 +144,16 @@ #include "../image/toolbar/file_set_previous_16.xpm" #include "../image/toolbar/stock_close_24.xpm" #endif +#include "../image/toolbar/icon_color_1.xpm" +#include "../image/toolbar/icon_color_2.xpm" +#include "../image/toolbar/icon_color_3.xpm" +#include "../image/toolbar/icon_color_4.xpm" +#include "../image/toolbar/icon_color_5.xpm" +#include "../image/toolbar/icon_color_6.xpm" +#include "../image/toolbar/icon_color_7.xpm" +#include "../image/toolbar/icon_color_8.xpm" +#include "../image/toolbar/icon_color_9.xpm" +#include "../image/toolbar/icon_color_0.xpm" /* XXX: add this key to some .h file, as it adds a key to the top level Widget? */ @@ -228,7 +238,17 @@ static void wireshark_stock_icons(void) { { WIRESHARK_STOCK_FILE_SET_PREVIOUS, WIRESHARK_STOCK_LABEL_FILE_SET_PREVIOUS, 0, 0, NULL }, { WIRESHARK_STOCK_FILTER_OUT_STREAM, WIRESHARK_STOCK_LABEL_FILTER_OUT_STREAM, 0, 0, NULL }, { WIRESHARK_STOCK_ENABLE, WIRESHARK_STOCK_LABEL_ENABLE, 0, 0, NULL }, - { WIRESHARK_STOCK_DISABLE, WIRESHARK_STOCK_LABEL_DISABLE, 0, 0, NULL } + { WIRESHARK_STOCK_DISABLE, WIRESHARK_STOCK_LABEL_DISABLE, 0, 0, NULL }, + { WIRESHARK_STOCK_COLOR1, WIRESHARK_STOCK_LABEL_COLOR1, 0, 0, NULL }, + { WIRESHARK_STOCK_COLOR2, WIRESHARK_STOCK_LABEL_COLOR2, 0, 0, NULL }, + { WIRESHARK_STOCK_COLOR3, WIRESHARK_STOCK_LABEL_COLOR3, 0, 0, NULL }, + { WIRESHARK_STOCK_COLOR4, WIRESHARK_STOCK_LABEL_COLOR4, 0, 0, NULL }, + { WIRESHARK_STOCK_COLOR5, WIRESHARK_STOCK_LABEL_COLOR5, 0, 0, NULL }, + { WIRESHARK_STOCK_COLOR6, WIRESHARK_STOCK_LABEL_COLOR6, 0, 0, NULL }, + { WIRESHARK_STOCK_COLOR7, WIRESHARK_STOCK_LABEL_COLOR7, 0, 0, NULL }, + { WIRESHARK_STOCK_COLOR8, WIRESHARK_STOCK_LABEL_COLOR8, 0, 0, NULL }, + { WIRESHARK_STOCK_COLOR9, WIRESHARK_STOCK_LABEL_COLOR9, 0, 0, NULL }, + { WIRESHARK_STOCK_COLOR0, WIRESHARK_STOCK_LABEL_COLOR0, 0, 0, NULL } }; static const stock_pixmap_t pixmaps[] = { @@ -271,6 +291,16 @@ static void wireshark_stock_icons(void) { { WIRESHARK_STOCK_FILTER_OUT_STREAM, display_filter_24_xpm}, { WIRESHARK_STOCK_ENABLE, checkbox_16_xpm}, { WIRESHARK_STOCK_DISABLE, stock_close_24_xpm}, + { WIRESHARK_STOCK_COLOR1, icon_color_1_xpm}, + { WIRESHARK_STOCK_COLOR2, icon_color_2_xpm}, + { WIRESHARK_STOCK_COLOR3, icon_color_3_xpm}, + { WIRESHARK_STOCK_COLOR4, icon_color_4_xpm}, + { WIRESHARK_STOCK_COLOR5, icon_color_5_xpm}, + { WIRESHARK_STOCK_COLOR6, icon_color_6_xpm}, + { WIRESHARK_STOCK_COLOR7, icon_color_7_xpm}, + { WIRESHARK_STOCK_COLOR8, icon_color_8_xpm}, + { WIRESHARK_STOCK_COLOR9, icon_color_9_xpm}, + { WIRESHARK_STOCK_COLOR0, icon_color_0_xpm}, { NULL, NULL } }; diff --git a/help/getting_started.txt b/help/getting_started.txt index 43cc631301..8e69889e95 100644 --- a/help/getting_started.txt +++ b/help/getting_started.txt @@ -54,9 +54,12 @@ You can reduce the number of packets shown (to filter out the uninteresting ones Coloring Rules -------------- -The packet list can be colored; this means applying different colors for different packets. For example you could choose to have all HTTP packets shown in red and all other TCP traffic shown in yellow. +The packet list can be colored; this means applying different colors for different packets. For example you could choose to have all HTTP packets shown in red and all other TCP traffic shown in yellow. There are two types of color rules, temporary (only used in this session) and permanent (save between sessions). + +Temporary coloring rules can be created by either pressing and one of the number keys (0-9). This will create a conversation color rule based on the currently selected packet. Temporary color rules can also be added by choosing "color X" from different menus. + +Under "View->Coloring Rules..." you will see a list of permanentcolor rules. This list is processed for each packet from top to bottom, until one of the rules matches (in which case the color settings of that rule are used for that packet). If no rule matches, the packet will not be colored at all. -Under "View->Coloring Rules..." you will see a list of color rules. This list is processed for each packet from top to bottom, until one of the rules matches (in which case the color settings of that rule are used for that packet). If no rule matches, the packet will not be colored at all. Please note: setting lots of color rules can slow down processing time a bit when showing huge capture files. Other display things -- cgit v1.2.3