diff options
-rw-r--r-- | file.c | 178 | ||||
-rw-r--r-- | file.h | 13 | ||||
-rw-r--r-- | gtk/Makefile.am | 4 | ||||
-rw-r--r-- | gtk/find_dlg.c | 199 | ||||
-rw-r--r-- | gtk/find_dlg.h | 31 | ||||
-rw-r--r-- | gtk/main.c | 4 | ||||
-rw-r--r-- | gtk/menu.c | 8 | ||||
-rw-r--r-- | gtk/print_dlg.c | 4 | ||||
-rw-r--r-- | packet.h | 3 |
9 files changed, 413 insertions, 31 deletions
@@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.116 1999/10/31 17:45:46 gram Exp $ + * $Id: file.c,v 1.117 1999/11/06 06:26:55 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -218,6 +218,13 @@ close_cap_file(capture_file *cf, void *w, guint context) { set_menu_sensitivity("/File/Reload", FALSE); set_menu_sensitivity("/File/Print...", FALSE); set_menu_sensitivity("/Display/Options...", FALSE); + set_menu_sensitivity("/Display/Match Selected", FALSE); + set_menu_sensitivity("/Display/Colorize Display...", FALSE); + set_menu_sensitivity("/Display/Find Frame...", FALSE); + set_menu_sensitivity("/Display/Collapse All", FALSE); + set_menu_sensitivity("/Display/Expand All", FALSE); + set_menu_sensitivity("/Tools/Follow TCP Stream", FALSE); + set_menu_sensitivity("/Tools/Graph", FALSE); set_menu_sensitivity("/Tools/Summary", FALSE); } @@ -256,6 +263,9 @@ read_cap_file(capture_file *cf) { cf->filed = open(cf->filename, O_RDONLY); cf->fh = filed_open(cf->filed, "r"); cf->unfiltered_count = cf->count; + cf->current_frame = cf->first_displayed; + /* Make the first row the selected row. */ + gtk_clist_select_row(GTK_CLIST(packet_list), 0, -1); thaw_clist(cf); gtk_progress_set_activity_mode(GTK_PROGRESS(prog_bar), FALSE); @@ -279,6 +289,11 @@ read_cap_file(capture_file *cf) { set_menu_sensitivity("/File/Reload", TRUE); set_menu_sensitivity("/File/Print...", TRUE); set_menu_sensitivity("/Display/Options...", TRUE); + set_menu_sensitivity("/Display/Match Selected", TRUE); + set_menu_sensitivity("/Display/Colorize Display...", TRUE); + set_menu_sensitivity("/Display/Find Frame...", TRUE); + set_menu_sensitivity("/Tools/Follow TCP Stream", TRUE); + set_menu_sensitivity("/Tools/Graph", TRUE); set_menu_sensitivity("/Tools/Summary", TRUE); if (!success) { @@ -508,6 +523,12 @@ tail_cap_file(char *fname, capture_file *cf) { set_menu_sensitivity("/File/Open...", FALSE); set_menu_sensitivity("/Display/Options...", TRUE); + set_menu_sensitivity("/Display/Match Selected", TRUE); + set_menu_sensitivity("/Display/Colorize Display...", TRUE); + set_menu_sensitivity("/Display/Find Frame...", TRUE); + set_menu_sensitivity("/Tools/Follow TCP Stream", TRUE); + set_menu_sensitivity("/Tools/Graph", TRUE); + set_menu_sensitivity("/Tools/Summary", TRUE); set_menu_sensitivity("/Capture/Start...", FALSE); for (i = 0; i < cf->cinfo.num_cols; i++) { @@ -908,11 +929,17 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, const u_char *buf gtk_clist_set_foreground(GTK_CLIST(packet_list), row, &BLACK); } - /* If this was the selected packet, remember the row it's in, so - we can re-select it. ("selected_packet" is 0-origin, as it's - a GList index; "num", however, is 1-origin.) */ - if (cf->selected_packet == fdata->num - 1) - cf->selected_row = row; + /* If we haven't yet seen the first frame, this is it. */ + if (cf->first_displayed == NULL) + cf->first_displayed = fdata; + + /* This is the last frame we've seen so far. */ + cf->last_displayed = fdata; + + /* If this was the current frame, remember the row it's in, so + we can arrange that it's on the screen when we're done. */ + if (cf->current_frame == fdata) + cf->current_row = row; } else fdata->row = -1; /* not in the display */ fdata->cinfo = NULL; @@ -953,6 +980,7 @@ wtap_dispatch_cb(u_char *user, const struct wtap_pkthdr *phdr, int offset, fdata = (frame_data *) g_malloc(sizeof(frame_data)); fdata->next = NULL; + fdata->prev = NULL; fdata->pkt_len = phdr->len; fdata->cap_len = phdr->caplen; fdata->file_off = offset; @@ -971,6 +999,7 @@ wtap_dispatch_cb(u_char *user, const struct wtap_pkthdr *phdr, int offset, } if (passed) { plist_end = cf->plist_end; + fdata->prev = plist_end; if (plist_end != NULL) plist_end->next = fdata; else @@ -1041,9 +1070,13 @@ colorize_packets(capture_file *cf) /* Clear it out. */ gtk_clist_clear(GTK_CLIST(packet_list)); + /* We don't yet know which will be the first and last frames displayed. */ + cf->first_displayed = NULL; + cf->last_displayed = NULL; + /* If a packet was selected, we don't know yet what row, if any, it'll get. */ - cf->selected_row = -1; + cf->current_row = -1; /* Iterate through the list of packets, calling a routine to run the filter on the packet, see if it matches, and @@ -1093,12 +1126,19 @@ colorize_packets(capture_file *cf) gtk_progress_bar_update(GTK_PROGRESS_BAR(prog_bar), 0); - if (cf->selected_row != -1) { - /* We had a selected packet and it passed the filter. */ - gtk_clist_select_row(GTK_CLIST(packet_list), cf->selected_row, -1); + if (cf->current_row != -1) { + /* The current frame passed the filter; make sure it's visible. */ + if (!gtk_clist_row_is_visible(GTK_CLIST(packet_list), cf->current_row)) + gtk_clist_moveto(GTK_CLIST(packet_list), cf->current_row, -1, 0.0, 0.0); + if (cf->current_frame_is_selected) { + /* It was selected, so re-select it. */ + gtk_clist_select_row(GTK_CLIST(packet_list), cf->current_row, -1); + } } else { - /* If we had one, it didn't pass the filter. */ + /* The current frame didn't pass the filter; make the first frame + the current frame, and leave it unselected. */ unselect_packet(cf); + cf->current_frame = cf->first_displayed; } /* Unfreeze the packet list. */ @@ -1348,6 +1388,105 @@ clear_tree_and_hex_views(void) gtk_tree_clear_items(GTK_TREE(tree_view), 0, -1); } +void +find_packet(capture_file *cf, dfilter *sfcode) +{ + frame_data *start_fd; + frame_data *fd; + frame_data *new_fd = NULL; + guint32 progbar_quantum; + guint32 progbar_nextstep; + int count; + proto_tree *protocol_tree; + + start_fd = cf->current_frame; + if (start_fd != NULL) { + gtk_progress_set_activity_mode(GTK_PROGRESS(prog_bar), FALSE); + + /* Iterate through the list of packets, starting at the packet we've + picked, calling a routine to run the filter on the packet, see if + it matches, and stop if so. */ + count = 0; + fd = start_fd; + + proto_tree_is_visible = FALSE; + + /* Update the progress bar when it gets to this value. */ + progbar_nextstep = 0; + /* When we reach the value that triggers a progress bar update, + bump that value by this amount. + + We base the progress bar on the extent to which we've gone through + the displayed packets, as those are the only ones for which we + have to do a significant amount of work. */ + progbar_quantum = cf->count/N_PROGBAR_UPDATES; + gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(prog_bar), GTK_PROGRESS_LEFT_TO_RIGHT); + + fd = start_fd; + for (;;) { + /* Update the progress bar, but do it only N_PROGBAR_UPDATES times; + when we update it, we have to run the GTK+ main loop to get it + to repaint what's pending, and doing so may involve an "ioctl()" + to see if there's any pending input from an X server, and doing + that for every packet can be costly, especially on a big file. */ + if (count >= progbar_nextstep) { + /* let's not divide by zero. I should never be started + * with count == 0, so let's assert that + */ + g_assert(cf->count > 0); + + gtk_progress_bar_update(GTK_PROGRESS_BAR(prog_bar), + (gfloat) count / cf->count); + + progbar_nextstep += progbar_quantum; + while (gtk_events_pending()) + gtk_main_iteration(); + } + + /* Go past the current frame. */ + if (cf->sbackward) { + /* Go on to the previous frame. */ + fd = fd->prev; + if (fd == NULL) + fd = cf->plist_end; /* wrap around */ + } else { + /* Go on to the next frame. */ + fd = fd->next; + if (fd == NULL) + fd = cf->plist; /* wrap around */ + } + + if (fd == start_fd) { + /* We're back to the frame we were on originally. The search + failed. */ + break; + } + + /* Is this packet in the display? */ + if (fd->passed_dfilter) { + count++; + + /* Yes. Does it match the search filter? */ + protocol_tree = proto_tree_create_root(); + wtap_seek_read(cf->cd_t, cf->fh, fd->file_off, cf->pd, fd->cap_len); + dissect_packet(cf->pd, fd, protocol_tree); + if (dfilter_apply(sfcode, protocol_tree, cf->pd)) { + new_fd = fd; + break; /* found it! */ + } + } + } + + gtk_progress_bar_update(GTK_PROGRESS_BAR(prog_bar), 0); + } + + if (new_fd != NULL) { + /* We found a frame. Make it visible, and select it. */ + if (!gtk_clist_row_is_visible(GTK_CLIST(packet_list), new_fd->row)) + gtk_clist_moveto(GTK_CLIST(packet_list), new_fd->row, -1, 0.0, 0.0); + gtk_clist_select_row(GTK_CLIST(packet_list), new_fd->row, -1); + } +} /* Select the packet on a given row. */ void @@ -1371,25 +1510,25 @@ select_packet(capture_file *cf, int row) g_assert(fd != NULL); - cf->fd = fd; - - /* Remember the ordinal number of that frame. */ - cf->selected_packet = i; + /* Record that this frame is the current frame, and that it's selected. */ + cf->current_frame = fd; + cf->current_frame_is_selected = TRUE; /* Get the data in that frame. */ - wtap_seek_read (cf-> cd_t, cf->fh, fd->file_off, cf->pd, fd->cap_len); + wtap_seek_read (cf->cd_t, cf->fh, fd->file_off, cf->pd, fd->cap_len); /* Create the logical protocol tree. */ if (cf->protocol_tree) proto_tree_free(cf->protocol_tree); cf->protocol_tree = proto_tree_create_root(); proto_tree_is_visible = TRUE; - dissect_packet(cf->pd, cf->fd, cf->protocol_tree); + dissect_packet(cf->pd, cf->current_frame, cf->protocol_tree); /* Display the GUI protocol tree and hex dump. */ clear_tree_and_hex_views(); proto_tree_draw(cf->protocol_tree, tree_view); - packet_hex_print(GTK_TEXT(byte_view), cf->pd, cf->fd->cap_len, -1, -1); + packet_hex_print(GTK_TEXT(byte_view), cf->pd, cf->current_frame->cap_len, + -1, -1); gtk_text_thaw(GTK_TEXT(byte_view)); /* A packet is selected, so "File/Print Packet" has something to print. */ @@ -1402,8 +1541,7 @@ select_packet(capture_file *cf, int row) void unselect_packet(capture_file *cf) { - cf->selected_packet = -1; /* nothing there to be selected */ - cf->selected_row = -1; + cf->current_frame_is_selected = FALSE; /* Destroy the protocol tree for that packet. */ if (cf->protocol_tree != NULL) { @@ -1,7 +1,7 @@ /* file.h * Definitions for file structures and routines * - * $Id: file.h,v 1.49 1999/10/11 06:39:03 guy Exp $ + * $Id: file.h,v 1.50 1999/11/06 06:26:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -110,13 +110,17 @@ typedef struct _capture_file { gchar *cfilter; /* Capture filter string */ bpf_prog fcode; /* Compiled capture filter program */ #endif + gchar *sfilter; /* Search filter string */ + gboolean sbackward; /* TRUE if search is backward, FALSE if forward */ guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */ frame_data *plist; /* Packet list */ frame_data *plist_end; /* Last packet in list */ + frame_data *first_displayed; /* First frame displayed */ + frame_data *last_displayed; /* Last frame displayed */ column_info cinfo; /* Column formatting information */ - int selected_packet; /* Index in packet list of currently selected packet, if any */ - int selected_row; /* Row in packet display of currently selected packet, if any */ - frame_data *fd; /* Frame data for currently selected packet */ + frame_data *current_frame; /* Frame data for current frame */ + int current_row; /* Row in packet display of current frame */ + gboolean current_frame_is_selected; /* TRUE if that frame is selected */ proto_tree *protocol_tree; /* Protocol tree for currently selected packet */ FILE *print_fh; /* File we're printing to */ } capture_file; @@ -131,6 +135,7 @@ void filter_packets(capture_file *cf, gchar *dfilter); void colorize_packets(capture_file *); int print_packets(capture_file *cf, print_args_t *print_args); void change_time_formats(capture_file *); +void find_packet(capture_file *cf, dfilter *sfcode); void select_packet(capture_file *, int); void unselect_packet(capture_file *); diff --git a/gtk/Makefile.am b/gtk/Makefile.am index c3f7c87d29..5744404934 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for the GTK interface routines for Ethereal # -# $Id: Makefile.am,v 1.8 1999/10/20 22:53:43 gram Exp $ +# $Id: Makefile.am,v 1.9 1999/11/06 06:28:07 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@zing.org> @@ -36,6 +36,8 @@ libui_a_SOURCES = \ file_dlg.c \ filter_prefs.c \ filter_prefs.h \ + find_dlg.c \ + find_dlg.h \ gtkbindings.h \ gtkclist.c \ gtkclist.h \ diff --git a/gtk/find_dlg.c b/gtk/find_dlg.c new file mode 100644 index 0000000000..4bd77fa433 --- /dev/null +++ b/gtk/find_dlg.c @@ -0,0 +1,199 @@ +/* find_dlg.c + * Routines for "find frame" window + * + * $Id: find_dlg.c,v 1.1 1999/11/06 06:27:09 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@zing.org> + * Copyright 1998 Gerald Combs + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if 0 +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#endif +#include <gtk/gtk.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifndef __G_LIB_H__ +#include <glib.h> +#endif + +#include "proto.h" +#include "dfilter.h" +#include "globals.h" + +#if 0 +#include <time.h> + +#include <signal.h> +#include <errno.h> + +#include <wiretap/wtap.h> +#include "main.h" +#endif +#include "find_dlg.h" +#include "prefs_dlg.h" +#include "util.h" + +/* Capture callback data keys */ +#define E_FIND_FILT_KEY "find_filter_te" +#define E_FIND_BACKWARD_KEY "find_backward" + +static void +find_frame_ok_cb(GtkWidget *ok_bt, gpointer parent_w); + +static void +find_frame_close_cb(GtkWidget *close_bt, gpointer parent_w); + +void +find_frame_cb(GtkWidget *w, gpointer d) +{ + GtkWidget *find_frame_w, *main_vb, *filter_hb, *filter_bt, *filter_te, + *direction_hb, *forward_rb, *backward_rb, + *bbox, *ok_bt, *cancel_bt; + + find_frame_w = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(find_frame_w), "Ethereal: Find Frame"); + + /* Container for each row of widgets */ + main_vb = gtk_vbox_new(FALSE, 3); + gtk_container_border_width(GTK_CONTAINER(main_vb), 5); + gtk_container_add(GTK_CONTAINER(find_frame_w), main_vb); + gtk_widget_show(main_vb); + + /* Filter row */ + filter_hb = gtk_hbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(main_vb), filter_hb); + gtk_widget_show(filter_hb); + + filter_bt = gtk_button_new_with_label("Filter:"); + gtk_signal_connect(GTK_OBJECT(filter_bt), "clicked", + GTK_SIGNAL_FUNC(prefs_cb), (gpointer) E_PR_PG_FILTER); + gtk_box_pack_start(GTK_BOX(filter_hb), filter_bt, FALSE, TRUE, 0); + gtk_widget_show(filter_bt); + + filter_te = gtk_entry_new(); + if (cf.sfilter) gtk_entry_set_text(GTK_ENTRY(filter_te), cf.sfilter); + gtk_object_set_data(GTK_OBJECT(filter_bt), E_FILT_TE_PTR_KEY, filter_te); + gtk_box_pack_start(GTK_BOX(filter_hb), filter_te, TRUE, TRUE, 0); + gtk_widget_show(filter_te); + + /* Misc row: Forward and reverse radio buttons */ + direction_hb = gtk_hbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(main_vb), direction_hb); + gtk_widget_show(direction_hb); + + forward_rb = gtk_radio_button_new_with_label(NULL, "Forward"); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(forward_rb), !cf.sbackward); + gtk_box_pack_start(GTK_BOX(direction_hb), forward_rb, TRUE, TRUE, 0); + gtk_widget_show(forward_rb); + + backward_rb = gtk_radio_button_new_with_label( + gtk_radio_button_group(GTK_RADIO_BUTTON(forward_rb)), + "Backward"); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(backward_rb), cf.sbackward); + gtk_box_pack_start(GTK_BOX(direction_hb), backward_rb, TRUE, TRUE, 0); + gtk_widget_show(backward_rb); + + /* Button row: OK and cancel buttons */ + bbox = gtk_hbutton_box_new(); + gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END); + gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); + gtk_container_add(GTK_CONTAINER(main_vb), bbox); + gtk_widget_show(bbox); + + ok_bt = gtk_button_new_with_label ("OK"); + gtk_signal_connect(GTK_OBJECT(ok_bt), "clicked", + GTK_SIGNAL_FUNC(find_frame_ok_cb), GTK_OBJECT(find_frame_w)); + GTK_WIDGET_SET_FLAGS(ok_bt, GTK_CAN_DEFAULT); + gtk_box_pack_start (GTK_BOX (bbox), ok_bt, TRUE, TRUE, 0); + gtk_widget_grab_default(ok_bt); + gtk_widget_show(ok_bt); + + cancel_bt = gtk_button_new_with_label ("Cancel"); + gtk_signal_connect(GTK_OBJECT(cancel_bt), "clicked", + GTK_SIGNAL_FUNC(find_frame_close_cb), GTK_OBJECT(find_frame_w)); + GTK_WIDGET_SET_FLAGS(cancel_bt, GTK_CAN_DEFAULT); + gtk_box_pack_start (GTK_BOX (bbox), cancel_bt, TRUE, TRUE, 0); + gtk_widget_show(cancel_bt); + + /* Attach pointers to needed widgets to the capture prefs window/object */ + gtk_object_set_data(GTK_OBJECT(find_frame_w), E_FIND_FILT_KEY, filter_te); + gtk_object_set_data(GTK_OBJECT(find_frame_w), E_FIND_BACKWARD_KEY, backward_rb); + + gtk_widget_show(find_frame_w); +} + +static void +find_frame_ok_cb(GtkWidget *ok_bt, gpointer parent_w) +{ + GtkWidget *filter_te, *backward_rb; + gchar *filter_text; + dfilter *sfcode; + + filter_te = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_FIND_FILT_KEY); + backward_rb = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_FIND_BACKWARD_KEY); + + filter_text = gtk_entry_get_text(GTK_ENTRY(filter_te)); + + /* + * Try to compile the filter. + */ + if (dfilter_compile(filter_text, &sfcode) != 0) { + /* The attempt failed; report an error. */ + simple_dialog(ESD_TYPE_WARN, NULL, dfilter_error_msg); + return; + } + + /* Was it empty? */ + if (sfcode == NULL) { + /* Yes - complain. */ + simple_dialog(ESD_TYPE_WARN, NULL, "Blah blah blah"); + return; + } + + /* + * Remember the filter. + */ + if (cf.sfilter) + g_free(cf.sfilter); + cf.sfilter = g_strdup(filter_text); + + cf.sbackward = GTK_TOGGLE_BUTTON (backward_rb)->active; + + gtk_widget_destroy(GTK_WIDGET(parent_w)); + + find_packet(&cf, sfcode); +} + +static void +find_frame_close_cb(GtkWidget *close_bt, gpointer parent_w) +{ + gtk_grab_remove(GTK_WIDGET(parent_w)); + gtk_widget_destroy(GTK_WIDGET(parent_w)); +} diff --git a/gtk/find_dlg.h b/gtk/find_dlg.h new file mode 100644 index 0000000000..dd7518b018 --- /dev/null +++ b/gtk/find_dlg.h @@ -0,0 +1,31 @@ +/* find_dlg.h + * Definitions for "find frame" window + * + * $Id: find_dlg.h,v 1.1 1999/11/06 06:27:09 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@zing.org> + * Copyright 1998 Gerald Combs + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __FIND_DLG_H__ +#define __FIND_DLG_H__ + +void find_frame_cb(GtkWidget *, gpointer); + +#endif /* find_dlg.h */ diff --git a/gtk/main.c b/gtk/main.c index 655c89e5df..c940e80933 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.31 1999/11/04 21:04:35 guy Exp $ + * $Id: main.c,v 1.32 1999/11/06 06:27:07 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -564,7 +564,7 @@ tree_view_cb(GtkWidget *w, gpointer data) { gtk_text_set_point(GTK_TEXT(byte_view), 0); gtk_text_forward_delete(GTK_TEXT(byte_view), gtk_text_get_length(GTK_TEXT(byte_view))); - packet_hex_print(GTK_TEXT(byte_view), cf.pd, cf.fd->cap_len, + packet_hex_print(GTK_TEXT(byte_view), cf.pd, cf.current_frame->cap_len, tree_selected_start, tree_selected_len); diff --git a/gtk/menu.c b/gtk/menu.c index e3302ff7c7..a1a54145b0 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -1,7 +1,7 @@ /* menu.c * Menu routines * - * $Id: menu.c,v 1.5 1999/10/18 12:48:14 gram Exp $ + * $Id: menu.c,v 1.6 1999/11/06 06:27:08 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -40,6 +40,7 @@ #include "menu.h" #include "packet.h" #include "capture_dlg.h" +#include "find_dlg.h" #include "summary.h" #include "display_opts.h" #include "prefs_dlg.h" @@ -101,6 +102,7 @@ static GtkItemFactoryEntry menu_items[] = {"/Display/_Options...", NULL, GTK_MENU_FUNC(display_opt_cb), 0, NULL}, {"/Display/_Match Selected", NULL, GTK_MENU_FUNC(match_selected_cb), 0, NULL}, {"/Display/_Colorize Display...", NULL, GTK_MENU_FUNC(color_display_cb), 0, NULL}, + {"/Display/_Find Frame...", "<control>F", GTK_MENU_FUNC(find_frame_cb), 0, NULL}, {"/Display/Collapse _All", NULL, GTK_MENU_FUNC(collapse_all_cb), 0, NULL}, {"/Display/_Expand All", NULL, GTK_MENU_FUNC(expand_all_cb), 0, NULL}, {"/_Tools", NULL, NULL, 0, "<Branch>" }, @@ -150,8 +152,12 @@ menus_init(void) { set_menu_sensitivity("/Edit/Copy", FALSE); set_menu_sensitivity("/Edit/Paste", FALSE); set_menu_sensitivity("/Edit/Find", FALSE); + set_menu_sensitivity("/Display/Match Selected", FALSE); + set_menu_sensitivity("/Display/Colorize Display...", FALSE); + set_menu_sensitivity("/Display/Find Frame...", FALSE); set_menu_sensitivity("/Display/Collapse All", FALSE); set_menu_sensitivity("/Display/Expand All", FALSE); + set_menu_sensitivity("/Tools/Follow TCP Stream", FALSE); set_menu_sensitivity("/Tools/Graph", FALSE); set_menu_sensitivity("/Tools/Summary", FALSE); } diff --git a/gtk/print_dlg.c b/gtk/print_dlg.c index 618f2c5079..079792573c 100644 --- a/gtk/print_dlg.c +++ b/gtk/print_dlg.c @@ -1,7 +1,7 @@ /* print_dlg.c * Dialog boxes for printing * - * $Id: print_dlg.c,v 1.8 1999/09/29 22:25:41 guy Exp $ + * $Id: print_dlg.c,v 1.9 1999/11/06 06:27:07 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -480,7 +480,7 @@ file_print_packet_cmd_cb(GtkWidget *widget, gpointer data) { print_args.print_hex = FALSE; print_args.expand_all = TRUE; proto_tree_print(TRUE, &print_args, (GNode*) cf.protocol_tree, cf.pd, - cf.fd, fh); + cf.current_frame, fh); print_finale(fh); close_print_dest(print_args.to_file, fh); } @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.127 1999/11/06 03:08:34 guy Exp $ + * $Id: packet.h,v 1.128 1999/11/06 06:26:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -114,6 +114,7 @@ typedef struct _packet_counts { seek-and-read, so that we don't have to save it for all frames? */ typedef struct _frame_data { struct _frame_data *next; /* Next element in list */ + struct _frame_data *prev; /* Previous element in list */ guint32 num; /* Frame number */ guint32 pkt_len; /* Packet length */ guint32 cap_len; /* Amount actually captured */ |