aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-05-10 06:00:22 +0000
committerGuy Harris <guy@alum.mit.edu>2000-05-10 06:00:22 +0000
commit33f9afee3085cbf8a2f3ed17070507573afb5520 (patch)
treee4ff4663e05d773ee53b9e5a96f288d1bfc95a50
parent914f14223b4c8ef1b58d4783b670d6358aab5801 (diff)
Graham Bloice's changes to make clicking on a column header cause the
display to be sorted by the value in that column (and to reverse the sort order the next time you click on that column). Use "F<>" rather than "B<>" for file names in the Ethereal man page. svn path=/trunk/; revision=1931
-rw-r--r--AUTHORS1
-rw-r--r--doc/ethereal.pod.template54
-rw-r--r--gtk/main.c70
3 files changed, 107 insertions, 18 deletions
diff --git a/AUTHORS b/AUTHORS
index bc1d11a6fc..044688c3ba 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -293,6 +293,7 @@ Mark Muhlestein <mmm@netapp.com> {
Graham Bloice <graham.bloice@trihedral.com> {
Win32 icon for Ethereal, and Win32 resource-compiler files to
add version/copyright/etc. information to Win32 executables
+ Support for sorting columns in the summary by clicking on them
}
Ralf Schneider <ralf.schneider@alcatel.se> {
diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template
index 0d4615666d..e8138685e6 100644
--- a/doc/ethereal.pod.template
+++ b/doc/ethereal.pod.template
@@ -247,7 +247,7 @@ Initiates a live packet capture (see L<"Capture Preferences"> below). A
temporary file will be created to hold the capture. The location of the
file can be chosen by setting your TMPDIR environment variable before
starting B<Ethereal>. Otherwise, the default TMPDIR location is
-system-dependent, but is likely either /var/tmp or /tmp.
+system-dependent, but is likely either F</var/tmp> or F</tmp>.
=item Display:Options
@@ -330,23 +330,43 @@ a "thumb" at the right end of each divider line. Below the panes is a
strip that shows the file load progress, current filter, and informational
text.
+=over 6
+
+=item Top Pane
+
The top pane contains the list of network packets that you can scroll
-through and select. The packet number, packet timestamp, source and
-destination addresses, protocol, and description are printed for each
-packet. An effort is made to display information as high up the protocol
-stack as possible, e.g. IP addresses are displayed for IP packets, but the
-MAC layer address is displayed for unknown packet types. The right
-mouse button can be used to pop up a menu of operations.
+through and select. By default, the packet number, packet timestamp,
+source and destination addresses, protocol, and description are
+displayed for each packet; the I<Columns> page in the dialog box popped
+up by I<Edit:Preferences> lets you change this (although, unfortunately,
+you currently have to save the preferences, and exit and restart
+Ethereal, for those changes to take effect).
+
+If you click on the heading for a column, the display will be sorted by
+that column; clicking on the heading again will reverse the sort order
+for that column.
+
+An effort is made to display information as high up the protocol stack
+as possible, e.g. IP addresses are displayed for IP packets, but the
+MAC layer address is displayed for unknown packet types.
+
+The right mouse button can be used to pop up a menu of operations.
+
+=item Middle Pane
The middle pane contains a I<protocol tree> for the currently-selected
packet. The tree displays each field and its value in each protocol
header in the stack. The right mouse button can be used to pop up a
menu of operations.
+=item Bottom Pane
+
The lowest pane contains a hex dump of the actual packet data.
Selecting a field in the I<protocol tree> highlights the corresponding
bytes in this section.
+=item Current Filter
+
A display filter can be entered into the strip at the bottom.
A filter for HTTP, HTTPS, and DNS traffic might look like this:
@@ -358,6 +378,8 @@ keys will cause the filter to be applied to the current list of packets.
Selecting the I<Reset> button clears the display filter so that all
packets are displayed.
+=back
+
=item Preferences
The I<Preferences> dialog lets you control various personal preferences
@@ -530,8 +552,8 @@ on your system.
The I<Plugins List> shows the name, description, version and state
(enabled or not) of each plugin found on your system. The plugins are
-searched in the following directories: B</usr/share/ethereal/plugins>,
-B</usr/local/share/ethereal/plugins> and B<~/.ethereal/plugins>
+searched in the following directories: F</usr/share/ethereal/plugins>,
+F</usr/local/share/ethereal/plugins> and F<~/.ethereal/plugins>
A plugin must be activated using the I<Enable> button in order to use it
to dissect packets. It can also be deactivated with the I<Disable> button.
@@ -741,9 +763,9 @@ type of the field is also given.
=head1 FILES
-B</etc/ethers> is consulted to correlate 6-byte hardware addresses to
-names. If an address is not found in B</etc/ethers>, the
-B<$HOME/.ethereal/ethers> file is consulted next. Each line contains
+F</etc/ethers> is consulted to correlate 6-byte hardware addresses to
+names. If an address is not found in F</etc/ethers>, the
+F<$HOME/.ethereal/ethers> file is consulted next. Each line contains
one hardware address and name, separated by whitespace. The digits of
the hardware address are separated by either a colon (:), a dash (-), or
a period (.). The following three lines are valid lines of an ethers
@@ -753,13 +775,13 @@ file:
c0-00-ff-ff-ff-ff TR_broadcast
00.00.00.00.00.00 Zero_broadcast
-B</usr/local/etc/manuf> matches the 3-byte vendor portion of a 6-byte
+F</usr/local/etc/manuf> matches the 3-byte vendor portion of a 6-byte
hardware address with the manufacturer's name. The format of the file
-is the same as the B</etc/ethers> file, except that each address is
+is the same as the F</etc/ethers> file, except that each address is
three bytes instead of six.
-B</etc/ipxnets> and B<$HOME/.ethereal/ipxnets> correlate 4-byte IPX
-network numbers to names. The format is the same as the B</etc/ethers>
+F</etc/ipxnets> and F<$HOME/.ethereal/ipxnets> correlate 4-byte IPX
+network numbers to names. The format is the same as the F</etc/ethers>
file, except that each address if four bytes instead of six.
Additionally, the address can be represented a single hexadecimal
number, as is more common in the IPX world, rather than four hex octets.
diff --git a/gtk/main.c b/gtk/main.c
index fe71a13ff0..b51a436b44 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.117 2000/04/14 09:00:25 guy Exp $
+ * $Id: main.c,v 1.118 2000/05/10 06:00:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -830,6 +830,69 @@ filter_reset_cb(GtkWidget *w, gpointer data)
filter_packets(&cf, NULL);
}
+/* GTKClist compare routine, overrides default to allow numeric comparison */
+static gint
+packet_list_compare(GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
+{
+ /* Get row text strings */
+ char *text1 = GTK_CELL_TEXT (((GtkCListRow *)ptr1)->cell[clist->sort_column])->text;
+ char *text2 = GTK_CELL_TEXT (((GtkCListRow *)ptr2)->cell[clist->sort_column])->text;
+
+ /* Attempt to convert to numbers */
+ double num1 = atof(text1);
+ double num2 = atof(text2);
+
+ gint col_fmt = cf.cinfo.col_fmt[clist->sort_column];
+
+ if ((col_fmt == COL_NUMBER) || (col_fmt == COL_REL_TIME) || (col_fmt == COL_DELTA_TIME) ||
+ ((col_fmt == COL_CLS_TIME) && (timestamp_type == RELATIVE)) ||
+ ((col_fmt == COL_CLS_TIME) && (timestamp_type == DELTA)) ||
+ (col_fmt == COL_UNRES_SRC_PORT) || (col_fmt == COL_UNRES_DST_PORT) ||
+ ((num1 != 0) && (num2 != 0) && ((col_fmt == COL_DEF_SRC_PORT) || (col_fmt == COL_RES_SRC_PORT) ||
+ (col_fmt == COL_DEF_DST_PORT) || (col_fmt == COL_RES_DST_PORT))) ||
+ (col_fmt == COL_PACKET_LENGTH)) {
+
+ /* Compare numeric column */
+
+ if (num1 < num2)
+ return -1;
+ else if (num1 > num2)
+ return 1;
+ else
+ return 0;
+ }
+
+ else {
+
+ /* Compare text column */
+ if (!text2)
+ return (text1 != NULL);
+
+ if (!text1)
+ return -1;
+
+ return strcmp(text1, text2);
+ }
+}
+
+/* What to do when a column is clicked */
+static void
+packet_list_click_column_cb(GtkCList *clist, gint column, gpointer data)
+{
+ if (column == clist->sort_column) {
+ if (clist->sort_type == GTK_SORT_ASCENDING)
+ clist->sort_type = GTK_SORT_DESCENDING;
+ else
+ clist->sort_type = GTK_SORT_ASCENDING;
+ }
+ else {
+ clist->sort_type = GTK_SORT_ASCENDING;
+ gtk_clist_set_sort_column(clist, column);
+ }
+
+ gtk_clist_sort(clist);
+}
+
/* What to do when a list item is selected/unselected */
static void
packet_list_select_cb(GtkWidget *w, gint row, gint col, gpointer evt) {
@@ -1632,13 +1695,15 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
packet_list = gtk_clist_new_with_titles(cf.cinfo.num_cols, cf.cinfo.col_title);
gtk_container_add(GTK_CONTAINER(pkt_scrollw), packet_list);
- gtk_clist_column_titles_passive(GTK_CLIST(packet_list));
+
set_plist_sel_browse(prefs->gui_plist_sel_browse);
pl_style = gtk_style_new();
gdk_font_unref(pl_style->font);
pl_style->font = m_r_font;
gtk_widget_set_style(packet_list, pl_style);
gtk_widget_set_name(packet_list, "packet list");
+ gtk_signal_connect (GTK_OBJECT (packet_list), "click_column",
+ GTK_SIGNAL_FUNC(packet_list_click_column_cb), NULL);
gtk_signal_connect(GTK_OBJECT(packet_list), "select_row",
GTK_SIGNAL_FUNC(packet_list_select_cb), NULL);
gtk_signal_connect(GTK_OBJECT(packet_list), "unselect_row",
@@ -1660,6 +1725,7 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
gtk_widget_set_usize(packet_list, -1, pl_size);
gtk_signal_connect_object(GTK_OBJECT(packet_list), "button_press_event",
GTK_SIGNAL_FUNC(popup_menu_handler), gtk_object_get_data(GTK_OBJECT(popup_menu_object), PM_PACKET_LIST_KEY));
+ gtk_clist_set_compare_func(GTK_CLIST(packet_list), packet_list_compare);
gtk_widget_show(packet_list);
/* Tree view */