Commit Graph

724 Commits

Author SHA1 Message Date
Guy Harris 4423330034 If we specify a save file name with "-w", mark it as "user saved", so
that we don't delete it if we later start a new capture.

svn path=/trunk/; revision=742
1999-09-30 07:19:35 +00:00
Guy Harris 58609193d0 When we get an EOF on the sync pipe in sync mode, wait for the child to
exit, so that it doesn't hang around as an unreaped zombie until the
parent exits, and, if it stopped or terminated due to a signal, report
that in a message box.

svn path=/trunk/; revision=741
1999-09-30 07:15:19 +00:00
Guy Harris bab015f5e5 Add a new global flag "capture_child", which is TRUE if we're a child
process for a sync mode or fork mode capture.

Have that flag control whether we do things that *only* the parent or
*only* the child should do, rather than basing it solely on the setting
of "sync_mode" or "fork_mode" (or, in the case of stuff done in the
child process either in sync mode or fork mode, rather than basing it on
the setting of those flags at all).

Split "do_capture()" into a "run_capture()" routine that starts a
capture (possibly by forking off and execing a child process, if we're
supposed to do sync mode or fork mode captures), and that assumes the
file to which the capture is to write has already been opened and that
"cf.save_file_fd" is the file descriptor for that file, and a
"do_capture()" routine that creates a temporary file, getting an FD for
it, and calls "run_capture()".

Use "run_capture()", rather than "capture()", for "-k" captures, so that
it'll do the capture in a child process if "-S" or "-F" was specified
("do_capture()" won't do because "-k" captures should write to the file
specified by the "-w" flag, not some random temporary file).

For child process captures, however, just use "capture()" - the child
process shouldn't itself fork off a child if we're in sync or fork mode,
and should just write to the file whose file descriptor was specified by
the "-W" flag on the command line.

All this allows you to do "ethereal -S -w <file> -i <interface> -k" to
start a sync mode capture from the command line.

svn path=/trunk/; revision=740
1999-09-30 06:50:01 +00:00
Guy Harris 062cb007f1 If we're given the "-k" flag, don't start the capture until after we've:
popped up the top-level window (so that it looks like a capture
	started from "Capture/Start");

	initialized the colors (so that we don't dump core when reading
	in the capture file);

	popped up any message box for failure to read the preferences
	file.

This means we start the capture in "main()", rather than in the realize
callback for the main window, so get rid of that callback.

If we're a child process that's just capturing to a file for our parent
to read, however, we shouldn't pop up the top-level window, because
that's our parent's job; when running that child, set its "argv[0]" to a
special name, so that

	1) it shows up in a "ps" with a special name;

	2) we don't have to invent Yet Another Flag to say "you're the
	   child".

(We may want to use the name to turn on *all* behaviors that the capture
child, and only the capture child, should exhibit.)

If "-w" and "-k" were both specified, attempt to open the file specified
by "-w" and, if that succeeds, set "cf.save_file_fd" to refer to it, so
that "-w" plus "-k" works again, rather than popping up a "The file to
which the capture would be saved ... could not be opened: Bad file
descriptor." message box.

svn path=/trunk/; revision=739
1999-09-30 06:11:51 +00:00
Guy Harris 7caca1db1d GTK 1.2.5 version (not that it matters, given that GLib declares
"gboolean" to be a typedef of "gint").

svn path=/trunk/; revision=738
1999-09-30 02:57:26 +00:00
Guy Harris 080ddfb691 Enable "Print hex" only if "Print detail" is on.
svn path=/trunk/; revision=737
1999-09-29 22:25:41 +00:00
Guy Harris e4f7809763 Add an item to the "File/Print" dialog box to ask that the full hex data
of the packet be printed (this is only done if "Print detail" is
selected; it should be grayed out of "Print summary" is selected).

If that item is selected, suppress the hex printing of uninterpreted
data items in the protocol tree.

Move some GTK+ keys not used outside of "gtk/print_dlg.c" from
"gtk/keys.h" into "gtk/print_dlg.c".

svn path=/trunk/; revision=736
1999-09-29 22:19:24 +00:00
Gilbert Ramirez 7b732a9f80 Fixed assert error reported by Dewi Morgan <dewim@sco.com>.
After some bad dfilter parses, the top-level dfilter tree (global_df->dftree)
would erroneously be set to the last good dfilter_node that was parsed.
Later, the non-NULLness of the dftree made us clear it.. really confusing
GTK internals. After _that_, new GNodes created via g_node_new() would
all have the same address!

svn path=/trunk/; revision=735
1999-09-29 22:11:51 +00:00
Gilbert Ramirez 901754eb9b Added and extended Santeri Paavolainen's <santtu@ssh.fi> patch
to avoid applying NULL dfilters while setting colorization dfilters
during an ongoing, screen-updating, capture.

svn path=/trunk/; revision=734
1999-09-29 14:41:34 +00:00
Guy Harris 2ba5608a0b "snoop" seems to treat "IEEE 802.3" and "Ethernet" datalink types the
same (which raises the question "so why the heck are there two types?" -
note that the way you're supposed to tell Ethernet from 802.3 packets is
by looking at the value of the type/length field; both of them can be
transmitted on the same wire), so we'll treat them the same.

svn path=/trunk/; revision=733
1999-09-28 01:19:01 +00:00
Gilbert Ramirez a1f28feb1b Replace the parens around 'control' in the two macros that I modified. I
accidentally removed them.

svn path=/trunk/; revision=732
1999-09-27 13:51:54 +00:00
Guy Harris 073aced0b8 Don't bother setting the length of the LLC header when we create the LLC
tree to anything other than 0, as we're going to change it to the right
value once the control field has been parsed and we know the right value.

svn path=/trunk/; revision=731
1999-09-27 08:39:10 +00:00
Guy Harris 0247d914ef When checking whether a control field is for a UI frame, you have to
check all the bits of the control field (otherwise, you're just checking
whether it's a U frame).

svn path=/trunk/; revision=730
1999-09-27 08:33:26 +00:00
Gilbert Ramirez a5558d09fe Mask out unnecessary bits in control guint16 in order to properly
compare against XDLC_I, XDLC_UI, and XDLC_U in XDLC_HAS_PAYLOAD() and
XDLC_CONTROL_LEN() macros.

svn path=/trunk/; revision=729
1999-09-27 03:12:55 +00:00
Guy Harris f76a67e084 Handle the length of the LLC(+SNAP) header correctly for SNAP frames.
svn path=/trunk/; revision=728
1999-09-26 20:40:00 +00:00
Guy Harris 63edea877f Have "get_xdlc_control()" and "dissect_xdlc_control()" return the
xDLC control field, so that its caller can not only determine from it
whether the frame has a payload, but can also determine how long the
control field is.  Put macros in "xdlc.h" to determine both of those.

Have "capture_llc()" and "dissect_llc()" use that information
appropriately.

svn path=/trunk/; revision=727
1999-09-26 20:31:51 +00:00
Laurent Deniel a673e8bb2c Added name resolution in GUI part:
- Capture->Start->"Active name resolution"

Allows the user to turn on/off name resolution
during a live capture.

- Display->Options->"Name resolution"

Turn on/off name resolution for the displayed
data (or during the -S mode).
E.g. clicking on a packet captured with
resolution disabled will resolve names in
the detailed list if this option is set.
And applying or resetting a display filter
allows the update of the packet list as well.

svn path=/trunk/; revision=726
1999-09-26 14:40:01 +00:00
Gilbert Ramirez 4536f01901 Make Information Frame honor is_extended variable when reading Control.
svn path=/trunk/; revision=725
1999-09-26 13:34:10 +00:00
Guy Harris a4ff298308 Squelch a (justified, although the child process *shouldn't* ever send
us, at that point, a character with the 8th bit set) complaint about a
"char" array subscript in an "isdigit()" call by making the character
unsigned.

svn path=/trunk/; revision=724
1999-09-25 02:02:11 +00:00
Gilbert Ramirez 096d72a6f5 Changed version to 0.7.5
svn path=/trunk/; revision=722
1999-09-24 14:59:32 +00:00
Guy Harris b34c49fa86 DO NOT check for "unistd.h"; due to an unfortunate botch in the way
"zlib" was built in FreeBSD 3.2 (and possibly other 4.4-Lite-derived
BSDs), if HAVE_UNISTD_H is defined before "zlib.h" is included, the
declaration of "gzseek()" in "zlib.h" expands to something that doesn't
match what's in the OS's "zlib".

svn path=/trunk/; revision=721
1999-09-24 06:38:22 +00:00
Guy Harris a9c36a4b69 Fix it so that it builds with "--disable-zlib".
The "fh" member of a "wtap" structure points to something constructed
from the "fd" member of that structure, so that closing the stream
referred to by "fh" also closes the underlying file descriptor; get rid
of an unnecessary close of "wth->fd".

svn path=/trunk/; revision=720
1999-09-24 05:49:53 +00:00
Gilbert Ramirez 702b8f7aed Re-enable progress bar movement during display filter processing.
svn path=/trunk/; revision=718
1999-09-24 05:22:28 +00:00
Gilbert Ramirez c2e3c9efb4 Many more packaging changes. Lets compilation with new gtk subdirectory
work if build tree is different than source tree. Some wiretap files
had to be added to the list of deliverables.

svn path=/trunk/; revision=717
1999-09-24 04:59:52 +00:00
Guy Harris 70cd911f61 In "try_tempfile()", if the buffer is too short for the temporary file
name, stuff as much of the name as will fit into the buffer before
returning an error, so the error message that gets displayed isn't
completely mangled.

svn path=/trunk/; revision=716
1999-09-24 04:14:43 +00:00
Gilbert Ramirez 4740872e1f Packaging changes
svn path=/trunk/; revision=715
1999-09-24 03:43:09 +00:00
Gilbert Ramirez e6015fbeb8 Moved version to 0.7.4; updated documentation.
svn path=/trunk/; revision=714
1999-09-24 03:28:59 +00:00
Guy Harris e22e07c397 Dirk Bonne's fix to ICMP timestamp dissection.
svn path=/trunk/; revision=713
1999-09-23 19:05:28 +00:00
Guy Harris f0e861465c Close the capture file in "do_capture()", right before unlinking the
current capture file if it's a temporary file, out of paranoia (so that
we don't get into a state where we have a capture file open but unlinked
- it's probably harmless to be in that state, as the file will remain
around until close, modulo NFS fun, and we may never be in that state
for very long, but I'd rather have it obviously stated in the code).

Remove the close in "capture()", and put one before the other call to
"capture()", in "main_realize_cb()" (is that call necessary, e.g. if you
pass "-r <filename>" *and* "-k", for some perverse reason, as
command-line arguments?).

If "cf.save_file" is non-null, free it before setting it, regardless of
whether it refers to a temporary file name or not.

svn path=/trunk/; revision=712
1999-09-23 07:57:23 +00:00
Guy Harris b2b8994f15 If we forcibly turn off "fork_mode" if the user doesn't enable "Update
list of packets in real time" in the "Capture/Start" dialog box,
"ethereal -F" won't work - you get your choice of non-forked capture or
"-S".

Don't have "fork_mode" track "sync_mode"; instead, in those places where
we check for "fork_mode", check for "sync_mode" as well.

svn path=/trunk/; revision=711
1999-09-23 07:20:20 +00:00
Guy Harris 3aa6164cba In fork mode, close the capture file in "do_capture()", because the
child will nuke that file before we get to open the capture in
"tail_cap_file()" - assuming we do, because the capture may not start.

If we fail while writing to, or closing, a capture file we've opened for
writing, don't treat that as a capture error, as we may have saved at
least some packets to the capture file (that's the way it worked before
my recent checkins).

svn path=/trunk/; revision=710
1999-09-23 07:04:23 +00:00
Guy Harris 5b83e8d86c Update to reflect changes to the "Capture/Start" and "Display/Options"
dialog boxes.

svn path=/trunk/; revision=709
1999-09-23 06:34:18 +00:00
Guy Harris 12d3278d0b Move the toolkit-independent code to create a temporary capture file,
and to fork off and run a separate copy of "ethereal" for "-S" and "-F"
captures or just call "capture()" otherwise, out of "gtk/capture_dlg.c"
and into a routine in "capture.c".

If the attempt to create said temporary capture file fails, pop up a
dialog box and don't do the capture.

Have the child capture process send a message upstream after it either
successfully starts the capture and syncs out the header of the capture
file, or fails to start the capture; the message indicates whether it
succeeded or failed, and, if it failed, includes a failure message.
This:

	avoids the use of a signal, and thus means we don't have to
	worry about whether to capture the signal, or whether to start
	or stop capturing depending on whether this particular capture
	is in sync mode or not;

	lets us pop up the message box for the error in the parent
	process if we're in sync mode, rather than doing it in the
	child, which didn't work well.


Add a check button to the Capture/Start dialog box, so that we can
control, for each capture, whether it's to be done in sync mode or not.

svn path=/trunk/; revision=708
1999-09-23 06:27:27 +00:00
Guy Harris 560e64cb73 Make the buffer into which we read from the sync pipe one byte bigger
than the size of the reads we do, so that we have an extra byte at the
end into which we can stick a '\0' to guarantee null-termination of the
buffer.

When reading the capture file in "tail_cap_file()", use "file_open()"
rather than "fopen()", so that we work correctly if we're using "zlib"
to read capture files.

svn path=/trunk/; revision=707
1999-09-23 05:55:56 +00:00
Guy Harris 522b27e290 Give it an RCS ID.
svn path=/trunk/; revision=706
1999-09-23 05:26:18 +00:00
Guy Harris bae65b863a Fix the calculation of the temporary file name length in
"try_tempfile()" - the first component of the name comes from the "dir"
argument, so use its length, not the length of the string in the buffer
it should fill in (said buffer may contain garbage, which may not *be* a
C string).

svn path=/trunk/; revision=705
1999-09-23 05:20:18 +00:00
Guy Harris ca7bc3fba9 Give it an RCS ID.
svn path=/trunk/; revision=704
1999-09-23 05:03:32 +00:00
Guy Harris 5e0274153e When reading a capture file, we can detect whether it's compressed or
not, so it's OK to use "zlib" to read capture files, as it handles
uncompressed files correctly.

When *writing* capture files, however, we can't detect automatically
whether the user wanted to write the file out as a compressed file or
not, so we should *NOT* use "zlib" until we add a flag to the API
specifying whether to write the file out as a compressed file or not.

Furthermore, the code in Ethereal that implements the "-S" flag depends
on being able to get the "FILE *" for a capture file being written, so
that it can "fflush()" it.

svn path=/trunk/; revision=703
1999-09-23 05:00:59 +00:00
Guy Harris 39ba76783b Get rid of unused variable.
svn path=/trunk/; revision=702
1999-09-23 04:56:52 +00:00
Ashok Narayanan 501b9b05e1 Adds progress bar functionality back for loading files (it was changed to
bounce bar for compressed file support). Note that the progress bar may
not grow smoothly for compressed files, but it should be reasonably accurate
for files which are large enough to matter.

svn path=/trunk/; revision=701
1999-09-23 04:39:01 +00:00
Guy Harris 5953b86866 "sync_mode" isn't used in "file.c", so there's no need to declare it
there (it's declared in "globals.h" in any case).

svn path=/trunk/; revision=700
1999-09-23 03:24:01 +00:00
Ashok Narayanan 911336a0e1 Fix to allow compressed file handling of Ascend captures
svn path=/trunk/; revision=699
1999-09-22 07:37:46 +00:00
Gilbert Ramirez 7bc6591130 Another change to make packet-tr more intelligent with regard to
short packets. Also increased RIF processing from 18 to 30 bytes of RIF, as
I learned that the token-ring spec changed. Don't call next dissector
if there are no more bytes in packet.

svn path=/trunk/; revision=698
1999-09-22 05:40:12 +00:00
Ashok Narayanan ac6ad294fb Documentation for compressed file support
svn path=/trunk/; revision=697
1999-09-22 01:38:00 +00:00
Ashok Narayanan 818783636d Oops - new file for zLib commit which I missed out.
svn path=/trunk/; revision=696
1999-09-22 01:28:04 +00:00
Ashok Narayanan 3dfa56c498 This commit contains support for reading capture files compressed using
gzip. The zLib library is used for this purpose. If zLib is not available
(or it's use is disabled by the --disable-zlib option to configure), you
can still compile Ethereal but it will be unable to read compressed capture
files.

IMPORTANT:

Now all file accesses to capture files should be done through special macros.
Specifically, for any use of the following functions on capture files, replace them.
The arguments for the right-side functions are exactly the same as for the
original stdio functions.

	fopen			file_open
	fdopen			filed_open
	fread			file_read
	fwrite			file_write
	fseek			file_seek
	fclose			file_close
	ferror			file_error

svn path=/trunk/; revision=695
1999-09-22 01:26:50 +00:00
Guy Harris 453a4e95fb Add code to dissect MX and LOC records ("sparc.com" has both).
svn path=/trunk/; revision=694
1999-09-21 07:15:38 +00:00
Guy Harris f37741ebde Line up the "configure --help" message for "--with-ucdsnmp", and explain
what the argument to that flag does.

svn path=/trunk/; revision=693
1999-09-20 21:11:06 +00:00
Laurent Deniel 6bb5358e85 Added "Automatic scrolling in live capture".
This display option is disabled by default.

svn path=/trunk/; revision=692
1999-09-19 16:03:46 +00:00
Laurent Deniel 3bd68e680b Added "Automatic scrolling in live capture".
This display option is disabled by default.

svn path=/trunk/; revision=691
1999-09-19 15:54:54 +00:00