forked from osmocom/wireshark
* Pod page update
* Minor tweaks to the filter prefs svn path=/trunk/; revision=40daniel/osmux
parent
36607dd2d3
commit
554e5d3f46
2
NEWS
2
NEWS
|
@ -2,7 +2,7 @@ Overview of changes in Ethereal 0.4.0:
|
|||
|
||||
* Lots of fixes from Guy Harris
|
||||
* Preferences dialog (Gerald)
|
||||
* OSPF alignment fixes (Gerald)
|
||||
* OSPF updates (Hannes, Gerald)
|
||||
* FDDI support (Laurent, Guy)
|
||||
* Separate display and capture filters (Gerald)
|
||||
|
||||
|
|
|
@ -694,7 +694,7 @@ fi
|
|||
|
||||
PACKAGE=ethereal
|
||||
|
||||
VERSION=0.4.0
|
||||
VERSION=0.4.1
|
||||
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# $Id: configure.in,v 1.7 1998/10/12 01:40:46 gerald Exp $
|
||||
# $Id: configure.in,v 1.8 1998/10/13 02:10:52 gerald Exp $
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(etypes.h)
|
||||
|
||||
AM_INIT_AUTOMAKE(ethereal, 0.4.0)
|
||||
AM_INIT_AUTOMAKE(ethereal, 0.4.1)
|
||||
|
||||
dnl Check for CPU / vendor / OS
|
||||
AC_CANONICAL_HOST
|
||||
|
|
106
doc/ethereal.pod
106
doc/ethereal.pod
|
@ -101,31 +101,32 @@ Sets the default capture file name.
|
|||
|
||||
=over 4
|
||||
|
||||
=item File:Open, File:Close
|
||||
=item File:Open, File:Close, File:Reload
|
||||
|
||||
Open or close a capture file.
|
||||
Open, close, or reload a capture file.
|
||||
|
||||
=item File:Print Packet
|
||||
|
||||
Print a description of each protocol header found in the packet, followed
|
||||
by the packet data itself. Printing options can be set with the
|
||||
I<Edit:Menu Options> menu item.
|
||||
I<Edit:Preferences> menu item.
|
||||
|
||||
=item File:Quit
|
||||
|
||||
Exits the application.
|
||||
|
||||
=item Edit:Printer Options
|
||||
=item Edit:Preferences
|
||||
|
||||
Sets the packet printing options (see L<"Printer Options"> below).
|
||||
Sets the packet printing and filter options (see L<"Preferences"> below).
|
||||
|
||||
=item Tools:Capture
|
||||
|
||||
Initiates a live packet capture (see L<"Capture Preferences"> below).
|
||||
|
||||
=item Tools:Filter
|
||||
=item Tools:Follow TCP Stream
|
||||
|
||||
Sets the filter preferences (see L<"Filters"> below).
|
||||
If you have a TCP packet selected, it will display the contents of the TCP
|
||||
data stream in a separate window.
|
||||
|
||||
=back
|
||||
|
||||
|
@ -135,66 +136,63 @@ Sets the filter preferences (see L<"Filters"> below).
|
|||
|
||||
=item Main Window
|
||||
|
||||
The main window is split into three sections. You can resize each section
|
||||
using a "thumb" at the right end of each divider line. An informational
|
||||
message is also displayed at the bottom of the main window.
|
||||
The main window is split into three panes. You can resize each pane using
|
||||
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.
|
||||
|
||||
The top section contains the list of network packets that you can scroll
|
||||
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 middle section contains a I<protocol tree> for the currently-selected
|
||||
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 bottom section contains a hex dump of the actual packet data.
|
||||
Selecting a field in the I<protocol tree> highlights the appropriate bytes
|
||||
in this section.
|
||||
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 Printer Options
|
||||
A display filter can be entered into the strip at the bottom. It must
|
||||
have the same format as B<tcpdump> filter strings, since both programs use
|
||||
the same underlying library. A filter for HTTP, HTTPS, and DNS traffic
|
||||
might look like this:
|
||||
|
||||
The I<Printer Options> dialog lets you select the output format of packets
|
||||
printed using the I<File:Print Packet> menu item.
|
||||
tcp port 80 or tcp port 443 or port 53
|
||||
|
||||
The radio buttons at the top of the dialog allow you choose between
|
||||
printing the packets as text or PostScript, and sending the output
|
||||
directly to a command or saving it to a file. The I<Command:> text entry
|
||||
box is the command to send files to (usually B<lpr>), and the I<File:>
|
||||
entry box lets you enter the name of the file you wish to save to.
|
||||
Additinally, you can select the I<File:> button to browse the file system
|
||||
for a particular save file.
|
||||
Selecting the I<Filter:> button lets you choose from a list of named
|
||||
filters that you can optionally save.
|
||||
|
||||
=item Capture Preferences
|
||||
=item Preferences
|
||||
|
||||
The I<Capture Preferences> dialog lets you specify various parameters for
|
||||
capturing live packet data.
|
||||
The I<Preferences> dialog lets you select the output format of packets
|
||||
printed using the I<File:Print Packet> menu item and configure
|
||||
commonly-used filters.
|
||||
|
||||
The I<Interface:> entry box lets you specify the interface from which to
|
||||
capture packet data. The I<Count:> entry specifies the number of packets
|
||||
to capture. Entering 0 will capture packets indefinitely. The I<File:>
|
||||
entry specifies the file to save to, as in the I<Printer Options> dialog
|
||||
above. You can choose to open the file after capture, and you can also
|
||||
specify the maximum number of bytes to capture per packet with the
|
||||
I<Capture length> entry.
|
||||
=over 6
|
||||
|
||||
=item Printing Preferences
|
||||
|
||||
The radio buttons at the top of the I<Printing> page allow you choose
|
||||
between printing the packets as text or PostScript, and sending the
|
||||
output directly to a command or saving it to a file. The I<Command:> text
|
||||
entry box is the command to send files to (usually B<lpr>), and the
|
||||
I<File:> entry box lets you enter the name of the file you wish to save
|
||||
to. Additinally, you can select the I<File:> button to browse the file
|
||||
system for a particular save file.
|
||||
|
||||
=item Filters
|
||||
|
||||
The I<Filters> dialog lets you create and modify filters, and set the
|
||||
The I<Filters> page lets you create and modify filters, and set the
|
||||
default filter to use when capturing data or opening a capture file.
|
||||
|
||||
The I<Filter name> entry specifies a descriptive name for a filter, e.g.
|
||||
B<Web and DNS traffic>. The I<Filter string> entry is the text that
|
||||
actually describes the filtering action to take. It must have the same
|
||||
format as B<tcpdump> filter strings, since both programs use the same
|
||||
underlying library. A filter for HTTP, HTTPS, and DNS traffic might look
|
||||
like this:
|
||||
|
||||
tcp port 80 or tcp port 443 or port 53
|
||||
|
||||
The dialog buttons perform the following actions:
|
||||
actually describes the filtering action to take, as described above.The
|
||||
dialog buttons perform the following actions:
|
||||
|
||||
=over 8
|
||||
|
||||
|
@ -229,6 +227,26 @@ Saves the current filter list in F<$HOME/.ethereal/filters>.
|
|||
|
||||
Closes the dialog without making any changes.
|
||||
|
||||
=back
|
||||
|
||||
=back
|
||||
|
||||
=item Capture Preferences
|
||||
|
||||
The I<Capture Preferences> dialog lets you specify various parameters for
|
||||
capturing live packet data.
|
||||
|
||||
The I<Interface:> entry box lets you specify the interface from which to
|
||||
capture packet data. The I<Count:> entry specifies the number of packets
|
||||
to capture. Entering 0 will capture packets indefinitely. The I<Filter:>
|
||||
entry lets you specify the capture filter using a tcpdump-style filter
|
||||
string as described above. The I<File:> entry specifies the file to save
|
||||
to, as in the I<Printer Options> dialog above. You can choose to open the
|
||||
file after capture, and you can also specify the maximum number of bytes
|
||||
to capture per packet with the I<Capture length> entry.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<tcpdump(1)>, L<pcap(3)>
|
||||
|
|
157
ethereal.1
157
ethereal.1
|
@ -1,11 +1,10 @@
|
|||
.rn '' }`
|
||||
''' $RCSfile: ethereal.1,v $$Revision: 1.3 $$Date: 1998/09/27 22:12:21 $
|
||||
''' $RCSfile: ethereal.1,v $$Revision: 1.4 $$Date: 1998/10/13 02:10:53 $
|
||||
'''
|
||||
''' $Log: ethereal.1,v $
|
||||
''' Revision 1.3 1998/09/27 22:12:21 gerald
|
||||
''' Merged in a _huge_ patch from Guy Harris. It adds a time stap column,
|
||||
''' generalizes the column printing code, adds a "frame" tree item to
|
||||
''' the tree view, and fixes a bunch of miscellaneous coding bugs.
|
||||
''' Revision 1.4 1998/10/13 02:10:53 gerald
|
||||
''' * Pod page update
|
||||
''' * Minor tweaks to the filter prefs
|
||||
'''
|
||||
'''
|
||||
.de Sh
|
||||
|
@ -98,7 +97,7 @@
|
|||
.nr % 0
|
||||
.rr F
|
||||
.\}
|
||||
.TH ETHEREAL 1 "0.3.17" "27/Sep/98" "The Ethereal Network Analyzer"
|
||||
.TH ETHEREAL 1 "0.4.0" "12/Oct/98" "The Ethereal Network Analyzer"
|
||||
.UC
|
||||
.if n .hy 0
|
||||
.if n .na
|
||||
|
@ -251,101 +250,109 @@ Prints the version and exits.
|
|||
Sets the default capture file name.
|
||||
.SH "INTERFACE"
|
||||
.Sh "\s-1MENU\s0 \s-1ITEMS\s0"
|
||||
.Ip "File:Open, File:Close" 4
|
||||
Open or close a capture file.
|
||||
.Ip "File:Open, File:Close, File:Reload" 4
|
||||
Open, close, or reload a capture file.
|
||||
.Ip "File:Print Packet" 4
|
||||
Print a description of each protocol header found in the packet, followed
|
||||
by the packet data itself. Printing options can be set with the
|
||||
\fIEdit:Menu Options\fR menu item.
|
||||
.Ip "File:Quit" 4
|
||||
Exits the application.
|
||||
.Ip "Edit:Printer Options" 4
|
||||
Sets the packet printing options (see the section on \fIPrinter Options\fR below).
|
||||
.Ip "Edit:Preferences" 4
|
||||
Sets the packet printing and filter options (see the section on \fIPreferences\fR below).
|
||||
.Ip "Tools:Capture" 4
|
||||
Initiates a live packet capture (see the section on \fICapture Preferences\fR below).
|
||||
.Ip "Tools:Filter" 4
|
||||
Sets the filter preferences (see the section on \fIFilters\fR below).
|
||||
.Ip "Tools:Follow \s-1TCP\s0 Stream" 4
|
||||
If you have a \s-1TCP\s0 packet selected, it will display the contents of the \s-1TCP\s0
|
||||
data stream in a separate window.
|
||||
.Sh "\s-1WINDOWS\s0"
|
||||
.Ip "Main Window" 4
|
||||
The main window is split into three sections. You can resize each section
|
||||
using a \*(L"thumb\*(R" at the right end of each divider line. An informational
|
||||
message is also displayed at the bottom of the main window.
|
||||
The main window is split into three panes. You can resize each pane using
|
||||
a \*(L"thumb\*(R" 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.
|
||||
.Sp
|
||||
The top section contains the list of network packets that you can scroll
|
||||
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. \s-1IP\s0 addresses are displayed for \s-1IP\s0 packets, but the
|
||||
\s-1MAC\s0 layer address is displayed for unknown packet types.
|
||||
.Sp
|
||||
The middle section contains a \fIprotocol tree\fR for the currently-selected
|
||||
The middle pane contains a \fIprotocol tree\fR for the currently-selected
|
||||
packet. The tree displays each field and its value in each protocol header
|
||||
in the stack.
|
||||
.Sp
|
||||
The bottom section contains a hex dump of the actual packet data.
|
||||
Selecting a field in the \fIprotocol tree\fR highlights the appropriate bytes
|
||||
in this section.
|
||||
.Ip "Printer Options" 4
|
||||
The \fIPrinter Options\fR dialog lets you select the output format of packets
|
||||
printed using the \fIFile:Print Packet\fR menu item.
|
||||
The lowest pane contains a hex dump of the actual packet data.
|
||||
Selecting a field in the \fIprotocol tree\fR highlights the corresponding
|
||||
bytes in this section.
|
||||
.Sp
|
||||
The radio buttons at the top of the dialog allow you choose between
|
||||
printing the packets as text or PostScript, and sending the output
|
||||
directly to a command or saving it to a file. The \fICommand:\fR text entry
|
||||
box is the command to send files to (usually \fBlpr\fR), and the \fIFile:\fR
|
||||
entry box lets you enter the name of the file you wish to save to.
|
||||
Additinally, you can select the \fIFile:\fR button to browse the file system
|
||||
for a particular save file.
|
||||
A display filter can be entered into the strip at the bottom. It must
|
||||
have the same format as \fBtcpdump\fR filter strings, since both programs use
|
||||
the same underlying library. A filter for \s-1HTTP\s0, \s-1HTTPS\s0, and \s-1DNS\s0 traffic
|
||||
might look like this:
|
||||
.Sp
|
||||
.Vb 1
|
||||
\& tcp port 80 or tcp port 443 or port 53
|
||||
.Ve
|
||||
Selecting the \fIFilter:\fR button lets you choose from a list of named
|
||||
filters that you can optionally save.
|
||||
.Ip "Preferences" 4
|
||||
The \fIPreferences\fR dialog lets you select the output format of packets
|
||||
printed using the \fIFile:Print Packet\fR menu item and configure
|
||||
commonly-used filters.
|
||||
.Ip "Printing Preferences" 10
|
||||
The radio buttons at the top of the \fIPrinting\fR page allow you choose
|
||||
between printing the packets as text or PostScript, and sending the
|
||||
output directly to a command or saving it to a file. The \fICommand:\fR text
|
||||
entry box is the command to send files to (usually \fBlpr\fR), and the
|
||||
\fIFile:\fR entry box lets you enter the name of the file you wish to save
|
||||
to. Additinally, you can select the \fIFile:\fR button to browse the file
|
||||
system for a particular save file.
|
||||
.Ip "Filters" 10
|
||||
The \fIFilters\fR page lets you create and modify filters, and set the
|
||||
default filter to use when capturing data or opening a capture file.
|
||||
.Sp
|
||||
The \fIFilter name\fR entry specifies a descriptive name for a filter, e.g.
|
||||
\fBWeb and \s-1DNS\s0 traffic\fR. The \fIFilter string\fR entry is the text that
|
||||
actually describes the filtering action to take, as described above.The
|
||||
dialog buttons perform the following actions:
|
||||
.Ip "New" 18
|
||||
If there is text in the two entry boxes, it creates a new associated list
|
||||
item.
|
||||
.Ip "Change" 18
|
||||
Modifies the currently selected list item to match what's in the entry
|
||||
boxes.
|
||||
.Ip "Copy" 18
|
||||
Makes a copy of the currently selected list item.
|
||||
.Ip "Delete" 18
|
||||
Deletes the currently selected list item.
|
||||
.Ip "\s-1OK\s0" 18
|
||||
Sets the currently selected list item as the active filter. If nothing
|
||||
is selected, turns filtering off.
|
||||
.Ip "Save" 18
|
||||
Saves the current filter list in \fI$\s-1HOME\s0/.ethereal/filters\fR.
|
||||
.Ip "Cancel" 18
|
||||
Closes the dialog without making any changes.
|
||||
.Ip "Capture Preferences" 4
|
||||
The \fICapture Preferences\fR dialog lets you specify various parameters for
|
||||
capturing live packet data.
|
||||
.Sp
|
||||
The \fIInterface:\fR entry box lets you specify the interface from which to
|
||||
capture packet data. The \fICount:\fR entry specifies the number of packets
|
||||
to capture. Entering 0 will capture packets indefinitely. The \fIFile:\fR
|
||||
entry specifies the file to save to, as in the \fIPrinter Options\fR dialog
|
||||
above. You can choose to open the file after capture, and you can also
|
||||
specify the maximum number of bytes to capture per packet with the
|
||||
\fICapture length\fR entry.
|
||||
.Ip "Filters" 4
|
||||
The \fIFilters\fR dialog lets you create and modify filters, and set the
|
||||
default filter to use when capturing data or opening a capture file.
|
||||
.Sp
|
||||
The \fIFilter name\fR entry specifies a descriptive name for a filter, e.g.
|
||||
\fBWeb and \s-1DNS\s0 traffic\fR. The \fIFilter string\fR entry is the text that
|
||||
actually describes the filtering action to take. It must have the same
|
||||
format as \fBtcpdump\fR filter strings, since both programs use the same
|
||||
underlying library. A filter for \s-1HTTP\s0, \s-1HTTPS\s0, and \s-1DNS\s0 traffic might look
|
||||
like this:
|
||||
.Sp
|
||||
.Vb 1
|
||||
\& tcp port 80 or tcp port 443 or port 53
|
||||
.Ve
|
||||
The dialog buttons perform the following actions:
|
||||
.Ip "New" 12
|
||||
If there is text in the two entry boxes, it creates a new associated list
|
||||
item.
|
||||
.Ip "Change" 12
|
||||
Modifies the currently selected list item to match what's in the entry
|
||||
boxes.
|
||||
.Ip "Copy" 12
|
||||
Makes a copy of the currently selected list item.
|
||||
.Ip "Delete" 12
|
||||
Deletes the currently selected list item.
|
||||
.Ip "\s-1OK\s0" 12
|
||||
Sets the currently selected list item as the active filter. If nothing
|
||||
is selected, turns filtering off.
|
||||
.Ip "Save" 12
|
||||
Saves the current filter list in \fI$\s-1HOME\s0/.ethereal/filters\fR.
|
||||
.Ip "Cancel" 12
|
||||
Closes the dialog without making any changes.
|
||||
to capture. Entering 0 will capture packets indefinitely. The \fIFilter:\fR
|
||||
entry lets you specify the capture filter using a tcpdump-style filter
|
||||
string as described above. The \fIFile:\fR entry specifies the file to save
|
||||
to, as in the \fIPrinter Options\fR dialog above. You can choose to open the
|
||||
file after capture, and you can also specify the maximum number of bytes
|
||||
to capture per packet with the \fICapture length\fR entry.
|
||||
.SH "SEE ALSO"
|
||||
the \fItcpdump(1)\fR manpage, the \fIpcap(3)\fR manpage
|
||||
.SH "NOTES"
|
||||
The latest version of \fBethereal\fR can be found at
|
||||
\fBhttp://ethereal.zing.org\fR.
|
||||
.SH "AUTHORS"
|
||||
.Sp
|
||||
.PP
|
||||
.Vb 3
|
||||
\& Original Author
|
||||
\& -------- ------
|
||||
|
@ -363,7 +370,7 @@ The latest version of \fBethereal\fR can be found at
|
|||
.Ve
|
||||
Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to give his
|
||||
permission to use his version of snprintf.c.
|
||||
.Sp
|
||||
.PP
|
||||
Dan Lasley <dlasley@promus.com> gave permission for his \fIdumpit()\fR hex-dump
|
||||
routine to be used.
|
||||
|
||||
|
@ -411,25 +418,25 @@ routine to be used.
|
|||
|
||||
.IX Subsection "\s-1MENU\s0 \s-1ITEMS\s0"
|
||||
|
||||
.IX Item "File:Open, File:Close"
|
||||
.IX Item "File:Open, File:Close, File:Reload"
|
||||
|
||||
.IX Item "File:Print Packet"
|
||||
|
||||
.IX Item "File:Quit"
|
||||
|
||||
.IX Item "Edit:Printer Options"
|
||||
.IX Item "Edit:Preferences"
|
||||
|
||||
.IX Item "Tools:Capture"
|
||||
|
||||
.IX Item "Tools:Filter"
|
||||
.IX Item "Tools:Follow \s-1TCP\s0 Stream"
|
||||
|
||||
.IX Subsection "\s-1WINDOWS\s0"
|
||||
|
||||
.IX Item "Main Window"
|
||||
|
||||
.IX Item "Printer Options"
|
||||
.IX Item "Preferences"
|
||||
|
||||
.IX Item "Capture Preferences"
|
||||
.IX Item "Printing Preferences"
|
||||
|
||||
.IX Item "Filters"
|
||||
|
||||
|
@ -447,6 +454,8 @@ routine to be used.
|
|||
|
||||
.IX Item "Cancel"
|
||||
|
||||
.IX Item "Capture Preferences"
|
||||
|
||||
.IX Header "SEE ALSO"
|
||||
|
||||
.IX Header "NOTES"
|
||||
|
|
4
file.c
4
file.c
|
@ -1,7 +1,7 @@
|
|||
/* file.c
|
||||
* File I/O routines
|
||||
*
|
||||
* $Id: file.c,v 1.8 1998/10/12 01:45:17 gerald Exp $
|
||||
* $Id: file.c,v 1.9 1998/10/13 02:10:54 gerald Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -122,7 +122,7 @@ open_cap_file(char *fname, capture_file *cf) {
|
|||
|
||||
if (cf->dfilter) {
|
||||
if (pcap_compile(cf->pfh, &cf->fcode, cf->dfilter, 1, 0) < 0) {
|
||||
simple_dialog(ESD_TYPE_WARN, NULL, "Unable to parse filter string"
|
||||
simple_dialog(ESD_TYPE_WARN, NULL, "Unable to parse filter string "
|
||||
"\"%s\".", cf->dfilter);
|
||||
} else if (pcap_setfilter(cf->pfh, &cf->fcode) < 0) {
|
||||
simple_dialog(ESD_TYPE_WARN, NULL, "Can't install filter.");
|
||||
|
|
80
filter.c
80
filter.c
|
@ -1,7 +1,7 @@
|
|||
/* filter.c
|
||||
* Routines for managing filter sets
|
||||
*
|
||||
* $Id: filter.c,v 1.5 1998/10/12 01:40:50 gerald Exp $
|
||||
* $Id: filter.c,v 1.6 1998/10/13 02:10:55 gerald Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -41,19 +41,24 @@
|
|||
#include "menu.h"
|
||||
#include "prefs.h"
|
||||
|
||||
const gchar *fn_key = "filter_name";
|
||||
const gchar *fl_key = "filter_label";
|
||||
const gchar *cancel_key = "in_cancel_mode";
|
||||
#define E_FILT_NAME_KEY "filter_name"
|
||||
#define E_FILT_LBL_KEY "filter_label"
|
||||
#define E_FILT_CM_KEY "in_cancel_mode"
|
||||
|
||||
GtkWidget *filter_l, *chg_bt, *copy_bt, *del_bt, *name_te, *filter_te;
|
||||
GList *fl = NULL;
|
||||
|
||||
GList *
|
||||
read_filter_list() {
|
||||
void get_filter_list();
|
||||
|
||||
void
|
||||
get_filter_list() {
|
||||
filter_def *filt;
|
||||
FILE *ff;
|
||||
gchar *ff_path, *ff_name = ".ethereal/filters", f_buf[256];
|
||||
gchar *name_begin, *name_end, *filt_begin;
|
||||
int len, line = 0;
|
||||
|
||||
if (fl) return;
|
||||
|
||||
/* To do: generalize this */
|
||||
ff_path = (gchar *) g_malloc(strlen(getenv("HOME")) + strlen(ff_name) + 4);
|
||||
|
@ -61,7 +66,7 @@ read_filter_list() {
|
|||
|
||||
if ((ff = fopen(ff_path, "r")) == NULL) {
|
||||
g_free(ff_path);
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
while (fgets(f_buf, 256, ff)) {
|
||||
|
@ -97,27 +102,30 @@ read_filter_list() {
|
|||
}
|
||||
fclose(ff);
|
||||
g_free(ff_path);
|
||||
return fl;
|
||||
}
|
||||
|
||||
/* filter_sel_pg - Create and display the filter selection widgets. */
|
||||
/* Called when the 'Filter' preference notebook page is selected. */
|
||||
GtkWidget *
|
||||
filter_prefs_show() {
|
||||
filter_prefs_show(GtkWidget *w) {
|
||||
GtkWidget *main_vb, *top_hb, *list_bb, *new_bt, *filter_sc,
|
||||
*nl_item, *nl_lb, *middle_hb, *name_lb, *bottom_hb,
|
||||
*filter_lb;
|
||||
GtkWidget *l_select = NULL;
|
||||
GList *flp = NULL;
|
||||
filter_def *filt;
|
||||
|
||||
fl = read_filter_list();
|
||||
gchar *filter_te_str = NULL;
|
||||
|
||||
/* Make sure everything is set up */
|
||||
get_filter_list();
|
||||
if (w)
|
||||
filter_te_str = gtk_entry_get_text(GTK_ENTRY(w));
|
||||
|
||||
/* Container for each row of widgets */
|
||||
main_vb = gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
|
||||
gtk_widget_show(main_vb);
|
||||
gtk_object_set_data(GTK_OBJECT(main_vb), cancel_key, (gpointer)FALSE);
|
||||
gtk_object_set_data(GTK_OBJECT(main_vb), E_FILT_CM_KEY, (gpointer)FALSE);
|
||||
|
||||
/* Top row: Filter list and buttons */
|
||||
top_hb = gtk_hbox_new(FALSE, 5);
|
||||
|
@ -179,13 +187,13 @@ filter_prefs_show() {
|
|||
gtk_widget_show(nl_lb);
|
||||
gtk_container_add(GTK_CONTAINER(filter_l), nl_item);
|
||||
gtk_widget_show(nl_item);
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), fl_key, nl_lb);
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), fn_key, flp);
|
||||
/*
|
||||
if (cf.dfilter && filt->strval)
|
||||
if (strcmp(cf.dfilter, filt->strval) == 0)
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), E_FILT_LBL_KEY, nl_lb);
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), E_FILT_NAME_KEY, flp);
|
||||
|
||||
if (filter_te_str && filt->strval)
|
||||
if (strcmp(filter_te_str, filt->strval) == 0)
|
||||
l_select = nl_item;
|
||||
*/
|
||||
|
||||
flp = flp->next;
|
||||
}
|
||||
|
||||
|
@ -233,7 +241,7 @@ filter_sel_list_cb(GtkWidget *l, gpointer data) {
|
|||
|
||||
if (sl) { /* Something was selected */
|
||||
l_item = GTK_OBJECT(sl->data);
|
||||
flp = (GList *) gtk_object_get_data(l_item, fn_key);
|
||||
flp = (GList *) gtk_object_get_data(l_item, E_FILT_NAME_KEY);
|
||||
if (flp) {
|
||||
filt = (filter_def *) flp->data;
|
||||
name = filt->name;
|
||||
|
@ -244,7 +252,7 @@ filter_sel_list_cb(GtkWidget *l, gpointer data) {
|
|||
|
||||
/* Did you know that this function is called when the window is destroyed? */
|
||||
/* Funny, that. */
|
||||
if (!gtk_object_get_data(GTK_OBJECT(data), cancel_key)) {
|
||||
if (!gtk_object_get_data(GTK_OBJECT(data), E_FILT_CM_KEY)) {
|
||||
gtk_entry_set_text(GTK_ENTRY(name_te), name);
|
||||
gtk_entry_set_text(GTK_ENTRY(filter_te), strval);
|
||||
gtk_widget_set_sensitive(chg_bt, sensitivity);
|
||||
|
@ -276,8 +284,9 @@ filter_sel_new_cb(GtkWidget *w, gpointer data) {
|
|||
gtk_widget_show(nl_lb);
|
||||
gtk_container_add(GTK_CONTAINER(filter_l), nl_item);
|
||||
gtk_widget_show(nl_item);
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), fl_key, nl_lb);
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), fn_key, g_list_last(fl));
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), E_FILT_LBL_KEY, nl_lb);
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), E_FILT_NAME_KEY, g_list_last(fl));
|
||||
gtk_list_select_child(GTK_LIST(filter_l), nl_item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,8 +304,8 @@ filter_sel_chg_cb(GtkWidget *w, gpointer data) {
|
|||
|
||||
if (sl) { /* Something was selected */
|
||||
l_item = GTK_OBJECT(sl->data);
|
||||
flp = (GList *) gtk_object_get_data(l_item, fn_key);
|
||||
nl_lb = (GtkLabel *) gtk_object_get_data(l_item, fl_key);
|
||||
flp = (GList *) gtk_object_get_data(l_item, E_FILT_NAME_KEY);
|
||||
nl_lb = (GtkLabel *) gtk_object_get_data(l_item, E_FILT_LBL_KEY);
|
||||
if (flp && nl_lb) {
|
||||
filt = (filter_def *) flp->data;
|
||||
|
||||
|
@ -322,7 +331,7 @@ filter_sel_copy_cb(GtkWidget *w, gpointer data) {
|
|||
sl = GTK_LIST(filter_l)->selection;
|
||||
if (sl) { /* Something was selected */
|
||||
l_item = GTK_OBJECT(sl->data);
|
||||
flp = (GList *) gtk_object_get_data(l_item, fn_key);
|
||||
flp = (GList *) gtk_object_get_data(l_item, E_FILT_NAME_KEY);
|
||||
if (flp) {
|
||||
filt = (filter_def *) flp->data;
|
||||
nfilt = (filter_def *) g_malloc(sizeof(filter_def));
|
||||
|
@ -337,8 +346,9 @@ filter_sel_copy_cb(GtkWidget *w, gpointer data) {
|
|||
gtk_widget_show(nl_lb);
|
||||
gtk_container_add(GTK_CONTAINER(filter_l), nl_item);
|
||||
gtk_widget_show(nl_item);
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), fl_key, nl_lb);
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), fn_key, g_list_last(fl));
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), E_FILT_LBL_KEY, nl_lb);
|
||||
gtk_object_set_data(GTK_OBJECT(nl_item), E_FILT_NAME_KEY, g_list_last(fl));
|
||||
gtk_list_select_child(GTK_LIST(filter_l), nl_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +365,7 @@ filter_sel_del_cb(GtkWidget *w, gpointer data) {
|
|||
l_item = GTK_OBJECT(sl->data);
|
||||
pos = gtk_list_child_position(GTK_LIST(filter_l),
|
||||
GTK_WIDGET(l_item));
|
||||
flp = (GList *) gtk_object_get_data(l_item, fn_key);
|
||||
flp = (GList *) gtk_object_get_data(l_item, E_FILT_NAME_KEY);
|
||||
if (flp) {
|
||||
filt = (filter_def *) flp->data;
|
||||
g_free(filt->name);
|
||||
|
@ -377,7 +387,7 @@ filter_prefs_ok(GtkWidget *w) {
|
|||
sl = GTK_LIST(filter_l)->selection;
|
||||
if (sl && mw_filt) { /* Place something in the filter box. */
|
||||
l_item = GTK_OBJECT(sl->data);
|
||||
flp = (GList *) gtk_object_get_data(l_item, fn_key);
|
||||
flp = (GList *) gtk_object_get_data(l_item, E_FILT_NAME_KEY);
|
||||
if (flp) {
|
||||
filt = (filter_def *) flp->data;
|
||||
gtk_entry_set_text(GTK_ENTRY(mw_filt), filt->strval);
|
||||
|
@ -421,18 +431,8 @@ void
|
|||
filter_prefs_cancel(GtkWidget *w) {
|
||||
filter_def *filt;
|
||||
|
||||
while (fl) {
|
||||
if (fl->data) {
|
||||
filt = (filter_def *) fl->data;
|
||||
g_free(filt->name);
|
||||
g_free(filt->strval);
|
||||
g_free(filt);
|
||||
}
|
||||
fl = g_list_remove_link(fl, fl);
|
||||
}
|
||||
|
||||
/* Let the list cb know we're about to destroy the widget tree, so it */
|
||||
/* doesn't operate on widgets that don't exist. */
|
||||
gtk_object_set_data(GTK_OBJECT(w), cancel_key, (gpointer)TRUE);
|
||||
gtk_object_set_data(GTK_OBJECT(w), E_FILT_CM_KEY, (gpointer)TRUE);
|
||||
gtk_widget_destroy(GTK_WIDGET(w));
|
||||
}
|
||||
|
|
5
filter.h
5
filter.h
|
@ -1,7 +1,7 @@
|
|||
/* filter.h
|
||||
* Definitions for packet filter window
|
||||
*
|
||||
* $Id: filter.h,v 1.3 1998/10/10 03:32:08 gerald Exp $
|
||||
* $Id: filter.h,v 1.4 1998/10/13 02:10:55 gerald Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -36,8 +36,7 @@ typedef struct _filter_cb_data {
|
|||
GtkWidget *win;
|
||||
} filter_cb_data;
|
||||
|
||||
GList *read_filter_list();
|
||||
GtkWidget *filter_prefs_show();
|
||||
GtkWidget *filter_prefs_show(GtkWidget *);
|
||||
void filter_sel_list_cb(GtkWidget *, gpointer);
|
||||
void filter_sel_new_cb(GtkWidget *, gpointer);
|
||||
void filter_sel_chg_cb(GtkWidget *, gpointer);
|
||||
|
|
11
prefs.c
11
prefs.c
|
@ -1,7 +1,7 @@
|
|||
/* prefs.c
|
||||
* Routines for handling preferences
|
||||
*
|
||||
* $Id: prefs.c,v 1.5 1998/10/12 01:40:55 gerald Exp $
|
||||
* $Id: prefs.c,v 1.6 1998/10/13 02:10:56 gerald Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -46,7 +46,7 @@ void
|
|||
prefs_cb(GtkWidget *w, gpointer sp) {
|
||||
GtkWidget *prefs_w, *main_vb, *top_hb, *bbox, *prefs_nb,
|
||||
*ok_bt, *save_bt, *cancel_bt;
|
||||
GtkWidget *print_pg, *filter_pg;
|
||||
GtkWidget *print_pg, *filter_pg, *filter_te;
|
||||
GtkWidget *nlabel, *label;
|
||||
gint start_page = (gint) sp;
|
||||
|
||||
|
@ -82,10 +82,11 @@ prefs_cb(GtkWidget *w, gpointer sp) {
|
|||
gtk_notebook_append_page (GTK_NOTEBOOK(prefs_nb), print_pg, label);
|
||||
|
||||
/* Filter prefs */
|
||||
filter_pg = filter_prefs_show();
|
||||
filter_te = gtk_object_get_data(GTK_OBJECT(w), E_FILT_TE_PTR_KEY);
|
||||
filter_pg = filter_prefs_show(filter_te);
|
||||
|
||||
/* Pass along the entry widget pointer from the calling widget */
|
||||
gtk_object_set_data(GTK_OBJECT(filter_pg), E_FILT_TE_PTR_KEY,
|
||||
gtk_object_get_data(GTK_OBJECT(w), E_FILT_TE_PTR_KEY));
|
||||
gtk_object_set_data(GTK_OBJECT(filter_pg), E_FILT_TE_PTR_KEY, filter_te);
|
||||
gtk_object_set_data(GTK_OBJECT(prefs_w), E_FILTER_PAGE_KEY, filter_pg);
|
||||
label = gtk_label_new ("Filters");
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK(prefs_nb), filter_pg, label);
|
||||
|
|
Loading…
Reference in New Issue