Added "Ignore Packet" menu items to the main menu.
authorStig Bjørlykke <stig@bjorlykke.org>
Thu, 17 Dec 2009 12:05:13 +0000 (12:05 -0000)
committerStig Bjørlykke <stig@bjorlykke.org>
Thu, 17 Dec 2009 12:05:13 +0000 (12:05 -0000)
Show ignored packages in the summary dialog.

svn path=/trunk/; revision=31289

gtk/main_packet_list.c
gtk/main_packet_list.h
gtk/menus.c
gtk/new_packet_list.c
gtk/new_packet_list.h
gtk/summary_dlg.c
summary.c
summary.h

index b4e0ca3707ffe7484049beb206accc9222ff2eaa..cf7ee439ebb9f5afae4ad49c99ead03987f56a1c 100644 (file)
@@ -594,6 +594,19 @@ void packet_list_ignore_frame_cb(GtkWidget *w _U_, gpointer data _U_)
   }
 }
 
+void packet_list_unignore_all_frames_cb(GtkWidget *w _U_, gpointer data _U_)
+{
+  frame_data *fdata;
+
+  /* XXX: we might need a progressbar here */
+  for (fdata = cfile.plist_start; fdata != NULL; fdata = fdata->next) {
+    set_frame_ignore(FALSE,
+                   fdata,
+                   gtk_clist_find_row_from_data(GTK_CLIST(packet_list), fdata));
+  }
+  redissect_packets();
+}
+
 void packet_list_update_ignored_frames(void)
 {
   frame_data *fdata;
@@ -607,7 +620,6 @@ void packet_list_update_ignored_frames(void)
                      gtk_clist_find_row_from_data(GTK_CLIST(packet_list),
                                                   fdata));
   }
-  mark_frames_ready();
 }
 
 gboolean
index 9bb915e06bdeea9420713a11e88817aad6df8c3b..7488b054a75afbbdbd5f0221234333adfb92b7d0 100644 (file)
@@ -103,6 +103,13 @@ extern void packet_list_update_marked_frames(void);
  */
 extern void packet_list_ignore_frame_cb(GtkWidget *w _U_, gpointer data _U_);
 
+/** Un-ignore all packets in the list.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void packet_list_unignore_all_frames_cb(GtkWidget *w _U_, gpointer data _U_);
+
 /** Update ignored packages. */
 extern void packet_list_update_ignored_frames(void);
 
index ac839560ffa855ea440a3269ba1417ad55930a8a..d21cf52292aafa9baf620dd0c07c2d878b25b3cd 100644 (file)
@@ -523,6 +523,18 @@ static GtkItemFactoryEntry menu_items[] =
 #else
     {"/Edit/Mark _All Packets", "<control>A", GTK_MENU_FUNC(packet_list_mark_all_frames_cb), 0, NULL, NULL,},
     {"/Edit/_Unmark All Packets", "<control>D", GTK_MENU_FUNC(packet_list_unmark_all_frames_cb), 0, NULL, NULL,},
+#endif /* NEW_PACKET_LIST */
+    {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
+#ifdef NEW_PACKET_LIST
+    {"/Edit/Ignore Packet (toggle)", "<control>X", GTK_MENU_FUNC(new_packet_list_ignore_frame_cb),
+                       0, NULL, NULL,},
+    {"/Edit/Un-Ignore All Packets", "<shift><control>X", GTK_MENU_FUNC(new_packet_list_unignore_all_frames_cb),
+                       0, NULL, NULL,},
+#else
+    {"/Edit/Ignore Packet (toggle)", "<control>X", GTK_MENU_FUNC(packet_list_ignore_frame_cb),
+                       0, NULL, NULL,},
+    {"/Edit/Un-Ignore All Packets", "<shift><control>X", GTK_MENU_FUNC(packet_list_unignore_all_frames_cb),
+                       0, NULL, NULL,},
 #endif /* NEW_PACKET_LIST */
     {"/Edit/<separator>", NULL, NULL, 0, "<Separator>", NULL,},
     {"/Edit/Set Time Reference (toggle)", "<control>T", GTK_MENU_FUNC(reftime_frame_cb),
@@ -2719,6 +2731,12 @@ set_menus_for_selected_packet(capture_file *cf)
                          cf->current_frame != NULL);
     set_menu_sensitivity(main_menu_factory, "/Edit/Unmark All Packets",
                          cf->current_frame != NULL);
+    set_menu_sensitivity(main_menu_factory, "/Edit/Ignore Packet (toggle)",
+                         cf->current_frame != NULL);
+    set_menu_sensitivity(main_menu_factory, "/Edit/Un-Ignore All Packets",
+                         cf->current_frame != NULL);
+    set_menu_sensitivity(packet_list_menu_factory, "/Ignore Packet (toggle)",
+                         cf->current_frame != NULL);
     set_menu_sensitivity(main_menu_factory, "/Edit/Set Time Reference (toggle)",
                          cf->current_frame != NULL);
     set_menu_sensitivity(packet_list_menu_factory, "/Set Time Reference (toggle)",
index 91674803631e05b25a5728e859a191f20976b555..c25f61fdbddbc1568ce2bb2cb8ac0d228fb6c18e 100644 (file)
@@ -1065,7 +1065,7 @@ set_frame_mark(gboolean set, frame_data *fdata)
 }
 
 static void
-set_frame_ignored(gboolean set, frame_data *fdata)
+set_frame_ignore(gboolean set, frame_data *fdata)
 {
        if (set)
                cf_ignore_frame(&cfile, fdata);
@@ -1169,7 +1169,18 @@ void new_packet_list_ignore_frame_cb(GtkWidget *w _U_, gpointer data _U_)
        gtk_tree_selection_get_selected(selection, &model, &iter);
        record = new_packet_list_get_record(model, &iter);
 
-       set_frame_ignored(!record->fdata->flags.ignored, record->fdata);
+       set_frame_ignore(!record->fdata->flags.ignored, record->fdata);
+       redissect_packets();
+}
+
+void new_packet_list_unignore_all_frames_cb(GtkWidget *w _U_, gpointer data _U_)
+{
+       frame_data *fdata;
+
+       /* XXX: we might need a progressbar here */
+       for (fdata = cfile.plist_start; fdata != NULL; fdata = fdata->next) {
+               set_frame_ignore(FALSE, fdata);
+       }
        redissect_packets();
 }
 
index fec021fa5978531632cb5fdf86bd64e7afd29485..574d401c56aa8d160df49b908b2cd8af7b05ee5d 100644 (file)
@@ -83,6 +83,13 @@ void new_packet_list_unmark_all_frames_cb(GtkWidget *w _U_, gpointer data _U_);
  */
 extern void new_packet_list_ignore_frame_cb(GtkWidget *widget, gpointer data);
 
+/** Un-ignore all packets in the list.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void new_packet_list_unignore_all_frames_cb(GtkWidget *w _U_, gpointer data _U_);
+
 /* Different modes of copying summary data */
 typedef enum {
     CS_TEXT, /* Packet summary data (tab separated) */
index d6df9b6b92ecc1e10daf5e7695acad88a48fea04..192ef3e58a0bb31b05490980085045bfd11f6894 100644 (file)
@@ -282,6 +282,10 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
     add_string_to_table(table, &row, "Display filter:", "none");
   }
 
+  /* Ignored packet count */
+  g_snprintf(string_buff, SUM_STR_MAX, "%i", summary.ignored_count);
+  add_string_to_table(table, &row, "Ignored packets:", string_buff);
+
   /* Traffic */
   list = simple_list_new(4, titles);
   gtk_container_add(GTK_CONTAINER(main_vb), list);
index 2ef533ffb11d95be4cd358895138493ccf23dcde..82831b78d4ac6ac662ab40de187a1b49c12fe579 100644 (file)
--- a/summary.c
+++ b/summary.c
@@ -82,6 +82,9 @@ tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
     sum_tally->marked_count++;
     sum_tally->marked_bytes += cur_frame->pkt_len ;
   }
+  if (cur_frame->flags.ignored){
+    sum_tally->ignored_count++;
+  }
 }
 
 void
@@ -103,6 +106,7 @@ summary_fill_in(capture_file *cf, summary_tally *st)
   st->marked_start = 0;
   st->marked_stop = 0;
   st->marked_bytes = 0;
+  st->ignored_count = 0;
 
   /* initialize the tally */
   if (cf->plist_start != NULL) {
index bb9f98d990343cd926e7e47e6caaf4fcccfd9ca5..ef32e7b64e12907fd9e8c650f2c1289697876f38 100644 (file)
--- a/summary.h
+++ b/summary.h
@@ -40,6 +40,7 @@ typedef struct _summary_tally {
     guint64    marked_bytes;   /* total bytes in the marked packets */
     double     marked_start;   /* time in seconds, with msec resolution */
     double     marked_stop;    /* time in seconds, with msec resolution */
+    int                ignored_count;  /* number of ignored packets */
     int                packet_count;   /* total number of packets in trace */
     int                filtered_count; /* number of filtered packets */
     guint64    filtered_bytes; /* total bytes in the filtered packets */