Added "Ignore Packet" menu items to the main menu.

Show ignored packages in the summary dialog.

svn path=/trunk/; revision=31289
This commit is contained in:
Stig Bjørlykke 2009-12-17 12:05:13 +00:00
parent e1b992ef3b
commit ef92b4ec11
8 changed files with 67 additions and 3 deletions

View 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

View 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);

View 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)",

View 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();
}

View 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) */

View 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);

View File

@ -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) {

View File

@ -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 */