aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cfile.h3
-rw-r--r--file.c16
-rw-r--r--file.h4
-rw-r--r--globals.h3
-rw-r--r--gtk/main.c67
-rw-r--r--gtk/menu.c14
-rw-r--r--gtk/prefs_dlg.c6
-rw-r--r--gtk/proto_draw.c4
8 files changed, 60 insertions, 57 deletions
diff --git a/cfile.h b/cfile.h
index d12a2bd1f4..040b1fda59 100644
--- a/cfile.h
+++ b/cfile.h
@@ -1,7 +1,7 @@
/* cfile.h
* capture_file definition & GUI-independent manipulation
*
- * $Id: cfile.h,v 1.5 2003/09/15 22:16:07 guy Exp $
+ * $Id: cfile.h,v 1.6 2003/09/24 00:47:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -89,6 +89,7 @@ typedef struct _capture_file {
column_info cinfo; /* Column formatting information */
frame_data *current_frame; /* Frame data for current frame */
epan_dissect_t *edt; /* Protocol dissection for currently selected packet */
+ field_info *finfo_selected; /* Field info for currently selected field */
FILE *print_fh; /* File we're printing to */
struct ph_stats_s* pstats; /* accumulated stats (reset on redisplay in GUI)*/
} capture_file;
diff --git a/file.c b/file.c
index cc6813fd56..2b8a6d49cf 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.315 2003/09/19 04:52:15 guy Exp $
+ * $Id: file.c,v 1.316 2003/09/24 00:47:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -262,6 +262,10 @@ cf_close(capture_file *cf)
cf->first_displayed = NULL;
cf->last_displayed = NULL;
+ /* No frame selected, no field in that frame selected. */
+ cf->current_frame = NULL;
+ cf->finfo_selected = NULL;
+
/* Clear the packet list. */
packet_list_freeze();
packet_list_clear();
@@ -1153,7 +1157,9 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
/* The frame that was selected passed the filter; select it, make it
the focus row, and make it visible. */
packet_list_set_selected_row(selected_row);
- finfo_selected = NULL;
+
+ /* New dissection, so no field has been selected yet. */
+ cf->finfo_selected = NULL;
} else {
/* The selected frame didn't pass the filter; make the first frame
the current frame, and leave it unselected. */
@@ -2079,15 +2085,15 @@ unselect_packet(capture_file *cf)
set_menus_for_selected_packet(FALSE);
/* No protocol tree means no selected field. */
- unselect_field();
+ unselect_field(cf);
}
/* Unset the selected protocol tree field, if any. */
void
-unselect_field(void)
+unselect_field(capture_file *cf)
{
statusbar_pop_field_msg();
- finfo_selected = NULL;
+ cf->finfo_selected = NULL;
set_menus_for_selected_tree_row(FALSE);
}
diff --git a/file.h b/file.h
index d5d1448f78..ac60b0d664 100644
--- a/file.h
+++ b/file.h
@@ -1,7 +1,7 @@
/* file.h
* Definitions for file structures and routines
*
- * $Id: file.h,v 1.107 2003/09/15 22:48:41 guy Exp $
+ * $Id: file.h,v 1.108 2003/09/24 00:47:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -72,7 +72,7 @@ gboolean goto_frame(capture_file *cf, guint fnumber);
void select_packet(capture_file *, int);
void unselect_packet(capture_file *);
-void unselect_field(void);
+void unselect_field(capture_file *);
/*
* Mark a particular frame in a particular capture.
diff --git a/globals.h b/globals.h
index e5ba3cd4ff..eba68769aa 100644
--- a/globals.h
+++ b/globals.h
@@ -1,7 +1,7 @@
/* globals.h
* Global defines, etc.
*
- * $Id: globals.h,v 1.30 2002/09/06 18:29:41 jmayer Exp $
+ * $Id: globals.h,v 1.31 2003/09/24 00:47:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -36,7 +36,6 @@ extern gchar *last_open_dir;
#ifdef HAVE_LIBPCAP
extern gboolean auto_scroll_live;
#endif
-extern field_info *finfo_selected;
extern ts_type timestamp_type;
diff --git a/gtk/main.c b/gtk/main.c
index 5ccae5e181..f759ed718c 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.316 2003/09/23 06:25:10 oabad Exp $
+ * $Id: main.c,v 1.317 2003/09/24 00:47:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -152,9 +152,6 @@ ts_type timestamp_type = RELATIVE;
GtkStyle *item_style;
#endif
-/* Specifies the field currently selected in the GUI protocol tree */
-field_info *finfo_selected = NULL;
-
#ifdef WIN32
static gboolean has_no_console; /* TRUE if app has no console */
static gboolean console_was_created; /* TRUE if console was created */
@@ -260,14 +257,14 @@ set_fonts(PangoFontDescription *regular, PangoFontDescription *bold)
void
goto_framenum_cb(GtkWidget *w _U_, gpointer data _U_)
{
- if (finfo_selected) {
+ if (cfile.finfo_selected) {
header_field_info *hfinfo;
guint32 framenum;
- hfinfo = finfo_selected->hfinfo;
+ hfinfo = cfile.finfo_selected->hfinfo;
g_assert(hfinfo);
if (hfinfo->type == FT_FRAMENUM) {
- framenum = fvalue_get_integer(finfo_selected->value);
+ framenum = fvalue_get_integer(cfile.finfo_selected->value);
if (framenum != 0)
goto_frame(&cfile, framenum);
}
@@ -353,109 +350,109 @@ match_selected_cb_do(gpointer data, int action, gchar *text)
void
match_selected_cb_replace_ptree(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_REPLACE|MATCH_SELECTED_APPLY_NOW,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
match_selected_cb_and_ptree(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_AND|MATCH_SELECTED_APPLY_NOW,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
match_selected_cb_or_ptree(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_OR|MATCH_SELECTED_APPLY_NOW,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
match_selected_cb_not_ptree(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_NOT|MATCH_SELECTED_APPLY_NOW,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
match_selected_cb_and_ptree_not(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_AND_NOT|MATCH_SELECTED_APPLY_NOW,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
match_selected_cb_or_ptree_not(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_OR_NOT,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
prepare_selected_cb_replace_ptree(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_REPLACE,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
prepare_selected_cb_and_ptree(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_AND,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
prepare_selected_cb_or_ptree(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_OR,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
prepare_selected_cb_not_ptree(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_NOT,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
prepare_selected_cb_and_ptree_not(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_AND_NOT,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
void
prepare_selected_cb_or_ptree_not(GtkWidget *w, gpointer data)
{
- if (finfo_selected)
+ if (cfile.finfo_selected)
match_selected_cb_do((data ? data : w),
MATCH_SELECTED_OR_NOT,
- proto_construct_dfilter_string(finfo_selected, cfile.edt));
+ proto_construct_dfilter_string(cfile.finfo_selected, cfile.edt));
}
static gchar *
@@ -905,7 +902,7 @@ tree_view_selection_changed_cb(GtkTreeSelection *sel, gpointer user_data _U_)
if (byte_data == NULL)
return; /* none */
- unselect_field();
+ unselect_field(&cfile);
packet_hex_print(GTK_TEXT_VIEW(byte_view), byte_data,
cfile.current_frame, NULL, byte_len);
return;
@@ -923,7 +920,7 @@ tree_view_selection_changed_cb(GtkTreeSelection *sel, gpointer user_data _U_)
byte_data = get_byte_view_data_and_length(byte_view, &byte_len);
g_assert(byte_data != NULL);
- finfo_selected = finfo;
+ cfile.finfo_selected = finfo;
set_menus_for_selected_tree_row(TRUE);
if (finfo->hfinfo) {
@@ -1004,7 +1001,7 @@ tree_view_unselect_row_cb(GtkCTree *ctree _U_, GList *node _U_, gint column _U_,
if (data == NULL)
return; /* none */
- unselect_field();
+ unselect_field(&cfile);
packet_hex_print(GTK_TEXT(byte_view), data, cfile.current_frame,
NULL, len);
}
@@ -1060,7 +1057,7 @@ set_plist_sel_browse(gboolean val)
return;
}
- if (finfo_selected)
+ if (cfile.finfo_selected)
unselect_packet(&cfile);
mode = new_mode;
diff --git a/gtk/menu.c b/gtk/menu.c
index a4639b2e0c..0e5067b5a6 100644
--- a/gtk/menu.c
+++ b/gtk/menu.c
@@ -1,7 +1,7 @@
/* menu.c
* Menu routines
*
- * $Id: menu.c,v 1.98 2003/09/22 09:08:42 sahlberg Exp $
+ * $Id: menu.c,v 1.99 2003/09/24 00:47:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -979,8 +979,8 @@ set_menus_for_selected_tree_row(gboolean have_selected_tree_row)
{
gboolean properties = FALSE;
- if (finfo_selected) {
- header_field_info *hfinfo = finfo_selected->hfinfo;
+ if (cfile.finfo_selected) {
+ header_field_info *hfinfo = cfile.finfo_selected->hfinfo;
if (hfinfo->parent == -1) {
properties = prefs_is_registered_protocol(hfinfo->abbrev);
} else {
@@ -998,13 +998,13 @@ set_menus_for_selected_tree_row(gboolean have_selected_tree_row)
"/Go To Corresponding Frame", FALSE);
}
set_menu_sensitivity(main_menu_factory, "/Display/Match",
- proto_can_match_selected(finfo_selected, cfile.edt));
+ proto_can_match_selected(cfile.finfo_selected, cfile.edt));
set_menu_sensitivity(tree_view_menu_factory, "/Match",
- proto_can_match_selected(finfo_selected, cfile.edt));
+ proto_can_match_selected(cfile.finfo_selected, cfile.edt));
set_menu_sensitivity(main_menu_factory, "/Display/Prepare",
- proto_can_match_selected(finfo_selected, cfile.edt));
+ proto_can_match_selected(cfile.finfo_selected, cfile.edt));
set_menu_sensitivity(tree_view_menu_factory, "/Prepare",
- proto_can_match_selected(finfo_selected, cfile.edt));
+ proto_can_match_selected(cfile.finfo_selected, cfile.edt));
} else {
set_menu_sensitivity(main_menu_factory, "/Display/Match", FALSE);
set_menu_sensitivity(tree_view_menu_factory, "/Match", FALSE);
diff --git a/gtk/prefs_dlg.c b/gtk/prefs_dlg.c
index 07f0f4a4da..e27e30c7c9 100644
--- a/gtk/prefs_dlg.c
+++ b/gtk/prefs_dlg.c
@@ -1,7 +1,7 @@
/* prefs_dlg.c
* Routines for handling preferences
*
- * $Id: prefs_dlg.c,v 1.60 2003/09/01 01:49:20 gerald Exp $
+ * $Id: prefs_dlg.c,v 1.61 2003/09/24 00:47:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1279,8 +1279,8 @@ properties_cb(GtkWidget *w, gpointer dummy)
const gchar *title = NULL;
struct properties_data p;
- if (finfo_selected) {
- header_field_info *hfinfo = finfo_selected->hfinfo;
+ if (cfile.finfo_selected) {
+ header_field_info *hfinfo = cfile.finfo_selected->hfinfo;
if (hfinfo->parent == -1) {
title = prefs_get_title_by_name(hfinfo->abbrev);
} else {
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c
index e94b6719b1..24adcefe1f 100644
--- a/gtk/proto_draw.c
+++ b/gtk/proto_draw.c
@@ -1,7 +1,7 @@
/* proto_draw.c
* Routines for GTK+ packet display
*
- * $Id: proto_draw.c,v 1.61 2002/11/11 15:39:06 oabad Exp $
+ * $Id: proto_draw.c,v 1.62 2003/09/24 00:47:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -151,7 +151,7 @@ void
redraw_hex_dump_all(void)
{
if (cfile.current_frame != NULL)
- redraw_hex_dump( byte_nb_ptr, cfile.current_frame, finfo_selected);
+ redraw_hex_dump( byte_nb_ptr, cfile.current_frame, cfile.finfo_selected);
redraw_hex_dump_packet_wins();
}