Commit Graph

68 Commits

Author SHA1 Message Date
Guy Harris ea6a522b28 Split "load_cap_file()" into "open_cap_file()" and "read_cap_file()".
The former, which used to be called by "load_cap_file()", now just opens
the file and, if the open succeeds, closes any capture file we
previously had open, reinitializes any protocols that need
reinitialization, and saves information about the new capture file in
the "capture_file" structure to which it was passed a pointer.  The
latter reads the file already opened by "read_cap_file()".

For "File/Open", call "open_cap_file()" before dismissing the file
selection box; if it fails, "open_cap_file()" will have popped up a
message box complaining about it - just return, leaving the file
selection box open so the user can, after dismissing the message box,
either try again with a different file name, or dismiss the file
selection box.  (Other file selection boxes should be made to work the
same way.)  If "open_cap_file()" succeeds, dismiss the file selection
box, and read the capture file in.

svn path=/trunk/; revision=492
1999-08-15 00:26:11 +00:00
Gilbert Ramirez cb61bf1ede Fixed segfault with combination of new dfilter struct usage, rfcode,
and File | Open option.

svn path=/trunk/; revision=489
1999-08-14 18:51:26 +00:00
Guy Harris 6572382f9a Have the "delta" format for time stamps show the time delta between a
packet and the previous *displayed* packet, rather than the previous
packet in a capture.

svn path=/trunk/; revision=486
1999-08-14 04:23:22 +00:00
Guy Harris c7a00d29f8 Fix up the code that changes the "command-line-specified" time format to
handle a display with a display filter.

(Also, don't have it recompute the time stamps - they were computed when
the packet was added to the packet list in the first place.)

svn path=/trunk/; revision=485
1999-08-14 03:36:30 +00:00
Guy Harris edb0a778ed Enable the "Display/Options" menu item when we're capturing with "-S",
so you can change the time stamp column while you're capturing.

svn path=/trunk/; revision=484
1999-08-14 01:33:29 +00:00
Guy Harris fa50f8aa46 In "change_time_formats()", you have to set "fd->cinfo" before you can
use "check_col()", otherwise "check_col()" always fails, and the time
column never gets changed.  (How did I manage to break that?)

svn path=/trunk/; revision=483
1999-08-14 01:27:29 +00:00
Gilbert Ramirez ab6490398c Moved global memory alloction used in display filters (which was stored
in dfilter-grammar.y) to a new struct dfilter. Display filters now have
their own struct, rather than simply being GNode's. This allows multiple
display filters to exist at once, aiding John McDermott in his
work on colorization.

svn path=/trunk/; revision=480
1999-08-13 23:47:43 +00:00
Guy Harris 8eb998e360 Add the ability to specify a filter to be used when reading the file to
the "Open File" dialog box (the "Open File" dialog box equivalent of the
"-R" flag).  Have "load_cap_file()" take the filter expression as an
argument, and make the global "rfilter" into a member of a
"capture_file" structure.

When reading a temporary capture file after a live capture, don't apply
any filter.

Move the code that pops up error boxes on file opens when reading a
capture file back to "load_cap_file()"; it also pops up error boxes if
the filter expression can't be parsed.

Don't enable "File/Save" or "File/Save As..." if an attempt to read a
capture file fails - if there was already an open capture file, it was
closed by "load_cap_file()", so we no longer have an open file to save.

svn path=/trunk/; revision=460
1999-08-10 07:16:47 +00:00
Guy Harris 7ec128ccb2 Initialize the "next" pointer of a "frame_data" structure to NULL before
putting it on the list of frames.

svn path=/trunk/; revision=459
1999-08-10 06:54:12 +00:00
Guy Harris 86a8ad1dcd Building a GList by adding elements to the end with "g_list_append()" is
N^2 in the ultimate size of the list (as "g_list_append()" is linear in
the size of the list, at least when used in the way the GLib
documentation says to use it); instead, maintain our own linked list of
"frame_data" structures for all packets read, including a pointer to the
last element.

"gtk_clist_set_row_data()" is linear in the row number, so if it's used
to attach a pointer to the "frame_data" structure for a packet to the
packet list GtkClist row for each packet, that's also N^2 in the number
of packets in that packet list; instead, store the row number in the
"frame_data" structure, and find the packet for a given row by scanning
the list for it (we were already scanning the list linearly to find that
packet's index in the list of all packets; that's only done when a
packet's selected, so it's not *too* bad, but it might be nice to avoid
having to do that scan).

svn path=/trunk/; revision=457
1999-08-10 04:13:37 +00:00
Guy Harris 059d89e65b Jochen Friedrich's patch to add a "-R" flag, which takes a
display-filter syntax expression as an argument, and causes that filter
to be applied to all packets when a capture file is read in; packets
that don't match the filter are discarded.

svn path=/trunk/; revision=454
1999-08-08 01:29:24 +00:00
Guy Harris a7061b9abd Move a comment, to correctly reflect which code in
"clear_tree_and_hex_views()" clears the hext dump window and which code
clears the protocol tree window.

svn path=/trunk/; revision=451
1999-08-07 01:25:04 +00:00
Gilbert Ramirez ecff53a0de Added a progress bar to the display filter computation. Unfortunately,
try as I might, I couldn't get gtk_timeout_add to work. I read all the docs,
but no luck. So for now I call dfilter_progress_cb for every 20 packets
that are filtered. I'd rather have *something* for the next Ethereal
release than nothing.

I also modified file_progress_cb to use it's local copy of cf rather
than the global copy.

svn path=/trunk/; revision=447
1999-08-05 16:46:04 +00:00
Guy Harris 96c27fcae5 Before displaying a packet, clear the tree and hex views; if you
double-click on a packet, it'll select that packet without necessarily
first un-selecting it (this may be a GTK+ 1.0[.x] vs. GTK+ 1.2[.x]
difference; Jeff Jahr said he first saw it when going from Ethereal
0.6.3 to 0.7.0 and going from GTK+ 1.0[.x] to GTK+ 1.2.3, but I saw it
on 0.6.3 with GTK+ 1.2.3 as well).

svn path=/trunk/; revision=441
1999-08-05 00:23:07 +00:00
Guy Harris 41a8a32b7b Fix a couple of memory leaks.
svn path=/trunk/; revision=438
1999-08-04 23:43:42 +00:00
Guy Harris 79c2223425 Check in Olivier Abad's patch to add dissectors for LAP-B and X.25, and
wiretap support for RADCOM Ltd.'s WAN/LAN analyzers (see

	http://www.radcom-inc.com/

).  Note: as I remember, IEEE 802.2/ISO 8022 LLC has somewhat of an SDLC
flavor to it, just as I think LAP, LAPB, LAPD, and so on do, so we may
be able to combine some of the LLC dissection and the LAPB dissection
into common code that could, conceivably be used for other SDLC-flavored
protocols.

Make "S" a mnemonic for "Summary" in the "Tools" menu.

Move the routine, used for the "Tools/Summary" display, that turns a
wiretap file type into a descriptive string for it into the wiretap
library itself, expand on some of its descriptions, and add an entry for
files from a RADCOM analyzer.

Have "Tools/Summary" display the snapshot length for the capture.

svn path=/trunk/; revision=416
1999-08-02 02:04:38 +00:00
Laurent Deniel c4717a95d9 Code cleaning:
- remove the tail_timeout_cb feature
- remove unneeded fseek.

svn path=/trunk/; revision=400
1999-07-28 20:53:40 +00:00
Guy Harris 5eac77ec4c Include <stdlib.h> to get "atoi()" declared, to squelch a "gcc -Wall"
complaint.

svn path=/trunk/; revision=399
1999-07-28 20:39:42 +00:00
Laurent Deniel c42634dd82 Fix the -S option :
- read only the real number of packets that have been written
  by the child process. That's avoid incomplete packet read.
- special timeout handling no more necessary and the whole
  real time capture and display behavior is much more
  satisfying with this patch.
- wiretap modified to allow the reading of 'count' packets
  with wtap_loop.

svn path=/trunk/; revision=398
1999-07-28 20:17:24 +00:00
Guy Harris 075ba742f7 If a column doesn't automatically resize, we have to set its size to the
appropriate value when we thaw the packet list, so that its size isn't
set to the size of the column title.

svn path=/trunk/; revision=396
1999-07-28 03:38:42 +00:00
Guy Harris cc0f9562c9 Get rid of the "Tools/Capture" menu item, in favor of "Capture/Start".
svn path=/trunk/; revision=395
1999-07-28 03:33:34 +00:00
Guy Harris b70d733f50 Have:
COL_INFO columns resize automatically even during a live
	capture;

	columns showing network addresses never resize automatically;

	other columns resize only when a capture is done;

and make all columns resizeable by hand (once they've resized, for
auto-resizeable columns).

svn path=/trunk/; revision=394
1999-07-28 03:29:02 +00:00
Guy Harris eea3b55cab Actually, I think File/Reload is still used if you do a capture with
"-F" - you do a File/Reload to see any new packets that showed up since
the last time the file was loaded.

svn path=/trunk/; revision=387
1999-07-27 02:04:38 +00:00
Guy Harris 7051efd336 File/Reload isn't necessary any more - to run a display filter, just
fill in the display filter text entry box and hit <Enter> - so remove
it.

svn path=/trunk/; revision=386
1999-07-27 01:58:43 +00:00
Guy Harris c6ccba12d1 Turn "protocol_tree" and "fd" from global variables into members of a
"capture_file" structure, make a "select_packet()" routine to parallel
"unselect_packet()", and have "unselect_packet()" free the protocol tree
that the "protocol_tree" member of the "capture_file" passed to it
points to.

It should now be impossible to do a "Print Packet" operation if no
packet has been selected, so remove the check for that (we'll probably
just blow up if it happens; if it does, that means we probably forgot to
gray out "/File/Print Packet" somewhere, so we should fix that).

svn path=/trunk/; revision=385
1999-07-24 03:22:50 +00:00
Guy Harris 520e977a5b Have "close_cap_file()" disable all menu items that make sense only if
you have a capture.

Leave the job of enabling and disabling menu items that make sense only
if you have a capture (except for "File/Save" and "File/Save As...", for
now) up to "load_cap_file()", "close_cap_file()", and the like - don't
scatter that stuff throughout the code.

Disable "File/Print Packet" if no packet is selected; enable it only if
a packet is selected.

If there's a selected packet, and a display filter is run:

	if the selected packet passed the filter, re-select it;

	if the selected packet didn't pass the filter, un-select it.

If we've opened a live "pcap" capture, but can't do the capture because
we can't get the netmask info, or can't parse the capture filter string,
or can't install the filter, close the live capture and the dump and
delete the dump file.

If we failed to open a live "pcap" capture, don't try to read the
capture file - it doesn't exist.

svn path=/trunk/; revision=384
1999-07-24 02:42:52 +00:00
Guy Harris 22c9ec90c8 Printing multiple frames in PostScript is a bit tricky, I think - I
think I may have to worry about page boundaries and the like - so, for
now, we make the "File/Print..." stuff print only as text.  ("Print
Packet" can still print PostScript, as always.)

We clean up a few text vs. PostScript things for printing multiple
frames, but it's still not ready for prime time.

svn path=/trunk/; revision=383
1999-07-23 21:09:25 +00:00
Guy Harris 356a07b384 Add a "File/Print" menu item, which prints *all* the packets in the
capture to a file or printer.  This should eventually get the ability to
print either all the packets or only the packets selected by the display
filter, and possibly also the ability to print only packets M through N.

Get rid of "cur" member of "capture_file" structure; nobody used it.

There's no need to pass a pointer to a "dialog_button" variable to
"simple_dialog()" for the error boxes displayed if a file copy or move
fails; that dialog box is just a message box and has only an "OK"
button.

Put the declaration of "prefs" into "prefs.h".

svn path=/trunk/; revision=378
1999-07-23 08:29:24 +00:00
Guy Harris de459d1426 Revert to static sizing of columns.
svn path=/trunk/; revision=377
1999-07-22 21:14:13 +00:00
Guy Harris c2107fa600 In the BSD standard I/O library, there's a flag in a FILE structure
that's set whenever we encounter an EOF; if that flag is set, all
subsequent reads return an EOF indication.  I.e., end-of-file is sticky.

This means that the stuff to continue reading a capture file, if we're
updating the display as the capture progresses, doesn't work - it gets
stuck at the point where the first read finished.

To clear that flag, we must do an "fseek()"; we do one that doesn't move
the seek pointer.

When updating the display as a capture progresses, do
"init_col_widths()" only when we first open the capture file; there's no
need to do it every time we read from the file - the column widths never
get smaller, they can only get bigger or stay the same.

svn path=/trunk/; revision=370
1999-07-20 05:13:24 +00:00
Gilbert Ramirez 57e49071ef Since ethereal is now dependent on GTK+-1.2.x (because of proto_tree and
display filter code, which uses features in GLIB-1.2.x), I removed
the vestigial code supporting old 1.0.x and 1.1.x GTK+ versions.

svn path=/trunk/; revision=360
1999-07-13 03:08:06 +00:00
Gilbert Ramirez 601c52f0fb Added support for compiling on win32 with Visual C and 'nmake'. It compiles,
but does not link. Perhaps someone who understands the MS tools can help
out. I made it link a few months ago, but with different version of glib/gtk+.
I can't remember how I made it link.

Most of the compatibility issues were resolved with adding
#ifdef HAVE_UNISTD_H the the source code. Please be sure to add this to all
future code.

svn path=/trunk/; revision=359
1999-07-13 02:53:26 +00:00
Guy Harris bb0eaf66b7 When you hit <Return> in the text entry box for the display filter,
apply the filter (if it isn't invalid).

Apply the filter by clearing the Clist that shows packet summary lines
and scanning through the list of all packets and adding to the Clist
those that match the filter.

Get rid of "if (dfilter_proto_tree)" test in "load_cap_file()";
"dfilter_proto_tree" is always FALSE, and all the test does is keep us
from doing a "gtk_clist_freeze()" of the packet list, and we don't want
to do that (we don't want the packet to be updated until we're done
reading in the file).

Get rid of "dfilter_proto_tree", as it's no longer used.

Move the test that checks whether the display filter matches the current
packet to "add_packet_to_packet_list()"; this allows us to run
"dissect_packet()" only once - if we have a display filter, we generate
the summary info *and* the protocol tree in the same call, using the
summary info to make the packet list item and the protocol tree when
checking the display filter.

In "dfilter_compile()", destroy "*p_dfcode" if it's not NULL, so we
don't leak memory.

svn path=/trunk/; revision=355
1999-07-11 08:40:52 +00:00
Gilbert Ramirez 5a7e28ca46 Added the ability to create a read-only ethereal, i.e., one that
doesn't link with libpcap, so no packet captures can be made. The
"--disable-pcap" option has been added to the configure script. Docs
have been updated. And the string buffer size in the simple_dialog()
has been doubled so that Johan's e-mail address in the "About" dialogue
window doesn't get chopped off.

svn path=/trunk/; revision=351
1999-07-09 04:18:36 +00:00
Gilbert Ramirez 07f42b5b31 Created a new protocol tree implementation and a new display filter
mechanism that is built into ethereal. Wiretap is now used to read all
file formats. Libpcap is used only for capturing.

svn path=/trunk/; revision=342
1999-07-07 22:52:57 +00:00
Gilbert Ramirez 7ea29fb80d Added Aaron Hillegass' summary dialogue. We're ignoring the problem with
NetMon statistic packets for now. We might fix that problem with wiretap,
either filtering out those packets, and/or providing the summary
information through a new wiretap API.

svn path=/trunk/; revision=326
1999-06-22 22:02:39 +00:00
Guy Harris 919fe8f24c Update the display if the "command-line-specified" time format is
changed by updating those columns showing the time in the
"command-line-specified" format, not by redoing the entire packet list
display; that way, the display continues to show the same packets and
any packet the user selected remains selected.  (It's also less work to
do that - you don't have to re-dissect the packet.)

Turn "redisplay_packets()" into "filter_packets()", and do some other
cleanups.

svn path=/trunk/; revision=325
1999-06-22 03:39:07 +00:00
Guy Harris 5d565b7fee Update a comment.
svn path=/trunk/; revision=320
1999-06-19 03:22:46 +00:00
Guy Harris becbefffcb Use "gtk_toggle_button_set_state()" rather than
"gtk_toggle_button_set_active()" to set the state of radio buttions;
"gtk_toggle_button_set_active()" doesn't exist in GTK+ 1.0[.x], and
"gtk_toggle_button_set_state()" is an alias for it in GTK+ 1.2[.x].

Compute the column widths in the summary display based on the longest
string in the column; recompute it whenever we update the columns.

svn path=/trunk/; revision=319
1999-06-19 03:14:32 +00:00
Guy Harris 88e94a0186 Added "Capture" and "Display" menus; "Capture" has a "Start" item, which
is the same as "Tools/Capture", and "Display" has an "Options" item,
which pops up a dialog box to let you change the "default" time-stamp
column display format on the fly (the "default" is what the "-t"
command-line option sets), and have the display change when you do that.

Made infrastructure changes to make the immediate display update work.

Removed some unused functions, declared some functions used only in the
file in which they're defined "static", and removed some unnecessary
#includes.

svn path=/trunk/; revision=317
1999-06-19 01:14:51 +00:00
Guy Harris b39ceabd92 Put "..." after menu items that will cause a dialog box to be popped up
(standard convention in many GUIs).

Make "Save as" be "Save As", and make "A" be the menu mnemonic for it in
the "File" menu, with GTK 1.2.

svn path=/trunk/; revision=315
1999-06-15 04:48:57 +00:00
Guy Harris a865469064 Add our own "strerror()", which we use on platforms that don't have it
in the standard libraries (such as SunOS 4.x).

svn path=/trunk/; revision=312
1999-06-14 21:46:36 +00:00
Guy Harris 18f922b46e Improve the alert boxes put up for file open/read/write errors. (Some
influence came from

http://developer.apple.com/techpubs/mac/HIGuidelines/HIGuidelines-232.html

which has a section on dialog box and alert box messages.  However,
we're largely dealing with technoids, not with The Rest Of Us, so I
didn't go as far as one perhaps should.)

Unfortunately, it looks like it's a bit more work to arrange that, if
you give a bad file name to the "-r" flag, the dialog box pop up only
*after* the main window pops up - it has the annoying habit of popping
up *before* the main window pops up, and sometimes getting *obscured* by
it, when I do that.  The removal of the dialog box stuff from
"load_cap_file()" was intended to facilitate that work.  (It might also
be nice if, when an open from the "File/Open" menu item fails, we keep
the file selection box open, and give the user a chance to correct
typos, choose another file name, etc.)

svn path=/trunk/; revision=310
1999-06-12 09:10:20 +00:00
Gilbert Ramirez 4c19edd782 Fixed problem where filename of capture file would not be displayed in
status bar if invoked by "ethereal -r filename".

svn path=/trunk/; revision=278
1999-05-11 20:07:47 +00:00
Laurent Deniel 4664b86ccd Live data capture and display enhancement that allows network capture and
display of fully decoded packets at the same time.
Options added:
-F : fork capture process
-S : sync mode ala tail -f (implies -F)
-f : filter expression
-Q : exit after capture (implies -k)

svn path=/trunk/; revision=276
1999-05-11 18:51:10 +00:00
Gilbert Ramirez 2870ce29ce Capturing packets from ethereal now saves the capture in an "anonymous" buffer. That is, it's
a random name chosen by tempnam(), unknown to the user. If the user decides to save that
trace, he then uses File | Save to save it to a file. File | Save As lets him make a copy
of his named trace file as well. I also updated my e-mail address in the various credit
locations.

svn path=/trunk/; revision=242
1999-04-06 16:24:50 +00:00
Gilbert Ramirez ef3dfe2077 Removed all references to gtk objects from packet*.[ch] files. They now
reference the protocol tree with struct proto_tree and struct proto_item
objects. That way, the packet decoding source code file can be used with
non-gtk packet decoders, like a curses-based ethereal, e.g. I also re-arranged
some of the information in packet.h to more appropriate places (like other
packet-*.[ch] files).

svn path=/trunk/; revision=223
1999-03-23 03:14:46 +00:00
Gilbert Ramirez ca662881cb Re-wrote the NCP module in accordance with how NCP is really organized.
NCP is still not decoded much, but the infrastructure for doing so is now in
place, including a hashtable to record the NCP type of each request so that we
now how to parse the response.

svn path=/trunk/; revision=215
1999-03-20 04:38:57 +00:00
Gilbert Ramirez 2dbd008ea5 Added display filters to wiretap.
svn path=/trunk/; revision=198
1999-03-01 18:57:07 +00:00
Gilbert Ramirez 10c23c3cd2 I changed the wtap_open_offline() function so that it takes only the
filename as the parameter. So far all the filetypes that wiretap can read
can be inferred from the first few bytes of the file, so we never
have to give wiretap a hint as to the file type.

svn path=/trunk/; revision=173
1999-01-21 05:03:56 +00:00