Commit Graph

441 Commits

Author SHA1 Message Date
Olivier Abad 1b89d48835 Change to color filters :
- moved color_filter_t in color.h
- change color_filter_t to use color_t instead of GdkColor

This changed allowed to remove the last gtk includes in file.c. It is
now completely free of any gtk related code.

svn path=/trunk/; revision=6324
2002-09-23 19:09:52 +00:00
Olivier Abad d72aca0b7e Removed all gtk calls in file.c :
- created a few packet_list_xxx functions (ui_util.h gtk/packet_list.c
  gtk2/packet_list.c) ;
- removed almost all "gtk/xxx" and "gtk2/xxx" includes in file.c

The only remaining includes are related to color filters. We have to
make color_filter_t GUI independent by replacing GdkColor with color_t.
I'll work on this later.

svn path=/trunk/; revision=6311
2002-09-21 11:36:30 +00:00
Ronnie Sahlberg 756b43584a Enable the tap feature for ethereal as well. (will only update in real time for the gtk2 port though)
svn path=/trunk/; revision=6182
2002-09-04 22:15:39 +00:00
Olivier Abad 6c5954dac7 GTK+ v2 port.
All the deprecated widgets have not been replaced yet :

GtkList and GtkCList ==> GtkTreeView conversion :
- color_dlg.c
- column_prefs.c
- decode_as_dlg.c : done
- dfilter_expr_dialog
- filter_prefs.c
- main.c
- plugins_dlg.c : done

GtkCTree ==> GtkTreeView  conversion : done

GtkText ==> GtkTextView conversion : done

Remaining problems :
- gtk_font_selection_dialog_set_filter doesn't exist anymore (but hasn't
  been removed from the documentation). I don't know how to filter the
  font selection dialog to get only fixed width fonts ;
- we have to remove GUI prefs which are not usefule anymore : tree line
  style and tree expander style.

svn path=/trunk/; revision=6153
2002-08-31 09:55:22 +00:00
Jörg Mayer 7c4176d868 Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6117
2002-08-28 21:04:11 +00:00
Guy Harris abe6b6bcc8 From Ulf Lamping: extend the progress dialog box to give more progress
information.

Fix the types of some variables (make the file position in
"read_cap_file()" a "long", as Wiretap supports "long" offsets, and make
processed-packet counts in packet-processing loops "int"s, as the total
packet count in a "capture_file" structure is an "int").

svn path=/trunk/; revision=6112
2002-08-28 10:07:37 +00:00
Jörg Mayer 173fe5aef4 Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the toplevel directory. The removal of winsock2.h will
hopefully not cause any problems under MSVC++, as those files using
struct timeval still include wtap.h, which still includes winsock2.h.

svn path=/trunk/; revision=5932
2002-08-02 23:36:07 +00:00
Guy Harris e04fc7ebfd From Graeme Hewson:
Ethereal sometimes creates a progress dialog bar and then, if
	the processing is fast, quickly destroys it.  The resulting
	"flash" can be disconcerting.  This set of patches ensures a
	progress bar is either not created or is displayed for a minimum
	time.

svn path=/trunk/; revision=5916
2002-07-30 10:13:16 +00:00
Richard Sharpe b5fa2524e6 Fix the problems WRT overwriting a capture file. From Joerg Mayer.
svn path=/trunk/; revision=5898
2002-07-21 16:54:22 +00:00
Guy Harris 44d19627ef From Graeme Hewson:
Allow "-" as the output file name in Wiretap, referring to the
	standard error.

	Optimize the capture loop.

Fix some of the error-message printing code in Ethereal and Tethereal.

Have Wiretap check whether it can seek on a file descriptor, and pass
the results of that test to the file-type-specific "open for output"
routine.  Have the "open for output" routines for files where we need to
seek when writing the file return an error if seeks don't work.

svn path=/trunk/; revision=5884
2002-07-16 07:15:09 +00:00
Richard Sharpe eac7bf1188 This seems to fix the problem of trying to save over the top of an existing
capture on some occassions.

svn path=/trunk/; revision=5872
2002-07-15 05:14:26 +00:00
Guy Harris 7dc9756921 Have "print_line()" take an indentation argument, and do blank
padding when printing text and use "putline" when printing PostScript.
Eliminate "hexdump", as it's just a special case of "putline".

Have "proto_tree_print_node()" just call "print_line()".

Get rid of "print_ps_hex()" - the font used for the hex dump and the
protocol tree are the same, so there's no need to switch fonts.

svn path=/trunk/; revision=5798
2002-06-29 09:45:06 +00:00
Guy Harris bf2c26e0b9 Get rid of trailing newline in lines passed to "print_line()".
svn path=/trunk/; revision=5732
2002-06-22 01:52:27 +00:00
Guy Harris 567aac9787 Get rid of separate "print_hex_data_text()" and "print_hex_data_ps()"
routines; instead, rename "print_hex_data_common()" to
"print_hex_data_buffer()" as it prints a buffer in hex and ASCII (or
EBCDIC), and have it take the print format as an argument.

Have it use "print_line()" to print lines, and fix "print_line()" so
that it prints a buffer *without* a newline at the end, printing the
newline itself.

svn path=/trunk/; revision=5729
2002-06-22 01:24:23 +00:00
Guy Harris 1b72ef68e6 Add a new error for attempts to open a pipe or FIFO for random access.
Have "wtap_open_offline()", if asked to open a FIFO, return that error
if it was asked to open the file for random access.

svn path=/trunk/; revision=5643
2002-06-07 07:47:58 +00:00
Guy Harris 392a7dfc04 Get rid of the "data_src" member of the "frame_data" structure; put it
in the "packet_info" structure instead, as we don't need a pointer for
every single frame in the capture file, just for each frame for which we
currently have an open "epan_dissect_t".

svn path=/trunk/; revision=5614
2002-06-04 07:03:57 +00:00
Guy Harris a6a5ff53ea Clean up the file saving code a bit.
svn path=/trunk/; revision=5531
2002-05-23 10:27:12 +00:00
Guy Harris 15fe575899 Make "save_cap_file()" return a Boolean (TRUE on success, FALSE on
failure) - and don't use "err" to determine success or failure, as it's
not set in some failure cases.

svn path=/trunk/; revision=5528
2002-05-23 07:46:58 +00:00
Guy Harris a0b8690230 The "fname" argument to "save_cap_file()", and "cf->filename" - and thus
"from_filename" - are both null-terminated strings; compare them with
"strcmp", not "strncmp()".  ("cf->filename" is a "char *", so
"sizeof(cf->filename)" is not the right third argument to "strncmp()" in
any case, as it's the size of a pointer, which is probably either 4 or 8
bytes.)

Make the dialog box for "Can't save over current capture file" an
ESD_TYPE_CRIT dialog box, as it's a fatal error.

svn path=/trunk/; revision=5526
2002-05-23 06:10:56 +00:00
Guy Harris 71f8208bf9 From Didieer Gautheron:
Don't show progress bar for quick "Find Frame" searches
	Add "Find Next" and "Find Previous" to repeat searches

Add documentation for "Find Next" and "Find Previous".

svn path=/trunk/; revision=5378
2002-05-03 21:55:15 +00:00
Guy Harris 433e8801a1 Clean up the handling of filter strings:
have "filter_packets()" make a copy of the filter string handed
	to it, as it may save the filter string in the "capture_file"
	structure, and the caller of "filter_packets()" shouldn't have
	to worry about the string it passed to "filter_packets()" being
	stashed away somewhere so that it can't just free that string or
	change it;

	have callers of "filter_packets()" free up the string they
	handed to it, if the string was allocated and they're done with
	it;

	plug some memory leaks in "match_selected_cb_do()".

Check for an illegal "action" argument being passed to
"match_selected_cb_do()".

Move some keys out of "keys.h" into "gtk/main.c", as they're only used
in "gtk/main.c".

Make the pointer to the filter list a data item for the combo box, as
it's a copy of the list of strings for the combo box, rather than
attaching it to the widgets that activate the filter (a pointer to the
combo box *itself* is a data item for those widgets).

In "filter_activate_cb()", make a copy of the text from the text entry
field as soon as we fetch it, and use that copy.  Free that copy if
we didn't add the filter to the filter list.

Don't make a copy of the entire filter list and use that to set the
combo box's list of items - just use the list itself.  Also, when the
list is changed, make the new value the data for the combo box (the list
pointer will actually not be changed, because we happen to be using
"g_list_append()", but let's not rely on that).

svn path=/trunk/; revision=5368
2002-05-03 03:24:47 +00:00
Guy Harris c2b87a5d1e If the progress fraction when reading in a file becomes > 1, assume that
the file grew while we were reading it, and re-fetch the size and try
again; if it's still > 1, give up and clamp it at 1 so that the GTK+
progress bar code doesn't complain.

svn path=/trunk/; revision=5232
2002-04-24 05:48:43 +00:00
Richard Sharpe 84f440c3c9 Make sure that when we save a file, we don't overwrite our capture file
with an empty file.

svn path=/trunk/; revision=5225
2002-04-22 19:10:33 +00:00
Guy Harris 3cab99ea75 Don't prime the display filter unless we're re-applying it; otherwise,
we aren't building a protocol tree, and we can't prime the filter
against the tree.

svn path=/trunk/; revision=5206
2002-04-20 01:54:27 +00:00
Guy Harris 63e8447614 From Joerg Mayer: get rid of unused arguments, and mark those that can't
be eliminated (because the function is called through a pointer, and
other functions called through the same pointer *do* use the argument)
as unused.

svn path=/trunk/; revision=5050
2002-03-31 20:57:02 +00:00
Guy Harris b5e9cef2bf Make "wtap_seek_read()" return TRUE on success and FALSE on error, like
"wtap_read()".

Add some additional error checks to the Sniffer file reader.

svn path=/trunk/; revision=4875
2002-03-05 08:40:27 +00:00
Guy Harris e300f4db52 Have "wtap_seek_read()" return 0 on success and -1 on failure, and take
an "err" argument that points to an "int" into which to put an error
code if it fails.

Check for errors in one call to it, and note that we should do so in
other places.

In the "wtap_seek_read()" call in the TCP graphing code, don't overwrite
"cfile.pseudo_header", and make the buffer into which we read the data
WTAP_MAX_PACKET_SIZE bytes, as it should be.

In some of the file readers for text files, check for errors from the
"parse the record header" and "parse the hex dump" routines when reading
sequentially.

In "csids_seek_read()", fix some calls to "file_error()" to check the
error on the random stream (that being what we're reading).

svn path=/trunk/; revision=4874
2002-03-05 05:58:41 +00:00
Guy Harris cbf5c537c4 From Joerg Mayer: remove unused variables and declarations of
non-existent functions.

Remove the "filetype" argument from the "can_write_encap" functions for
particular capture file types - the argument value is implicit, in that
the routine being called is the routine for that particular file type.

svn path=/trunk/; revision=4823
2002-02-27 08:57:25 +00:00
Guy Harris ca8f79df3d Get rid of "init_all_protocols()"; instead, have a routine
"init_dissection()" which calls "epan_conversation_init()", does the
work that "init_all_protocols()" did, and then calls
"reassemble_init()", so that the standard sequence of dissection
initialization is done in one place, rather than having multiple places
call the same sequence of routines.

svn path=/trunk/; revision=4797
2002-02-24 06:45:14 +00:00
Guy Harris 642d7239dc Update a comment.
svn path=/trunk/; revision=4757
2002-02-19 03:43:43 +00:00
Guy Harris 6a21dc7e44 Don't give tvbuffs names; instead, give data sources names, where a
"data source" has a name and a top-level tvbuff, and frames can have a
list of data sources associated with them.

Use the tvbuff pointer to determine which data source is the data source
for a given field; this means we don't have to worry about multiple data
sources with the same name - the only thing the name does is label the
notebook tab for the display of the data source, and label the hex dump
of the data source in print/Tethereal output.

Clean up a bunch of things discovered in the process of doing the above.

svn path=/trunk/; revision=4749
2002-02-18 01:08:44 +00:00
Guy Harris 89a4acb438 Have Wiretap set the snapshot length to 0 if it can't be derived from
reading the capture file.  Have callers of "wtap_snapshot_length()"
treat a value of 0 as "unknown", and default to WTAP_MAX_PACKET_SIZE (so
that, when writing a capture file in a format that *does* store the
snapshot length, we can at least put *something* in the file).

If we don't know the snapshot length of the current capture file, don't
display a value in the summary window.

Don't use "cfile.snap" as the snapshot length option when capturing -
doing so causes Ethereal to default, when capturing, to the snapshot
length of the last capture file that you read in, rather than to the
snapshot length of the last capture you did (or the initial default of
"no snapshot length").

Redo the "Capture Options" dialog box to group options into sections
with frames around them, and add units to the snapshot length, maximum
file size, and capture duration options, as per a suggestion by Ulf
Lamping.  Also add units to the capture count option.

Make the snapshot length, capture count, maximum file size, and capture
duration options into a combination of a check box and a spin button.
If the check box is not checked, the limit in question is inactive
(snapshot length of 65535, no max packet count, no max file size, no max
capture duration); if it's checked, the spinbox specifies the limit.
Default all of the check boxes to "not checked" and all of the spin
boxes to small values.

Use "gtk_toggle_button_get_active()" rather than directly fetching the
state of a check box.

svn path=/trunk/; revision=4709
2002-02-08 10:07:41 +00:00
Guy Harris ee5ca25d31 Include files from the "epan" directory and subdirectories thereof with
"epan/..." pathnames, so as to avoid collisions with header files in any
of the directories in which we look (e.g., "proto.h", as some other
package has its own "proto.h" file which it installs in the top-level
include directory).

Don't add "-I" flags to search "epan", as that's no longer necessary
(and we want includes of "epan" headers to fail if the "epan/" is left
out, so that we don't re-introduce includes lacking "epan/").

svn path=/trunk/; revision=4586
2002-01-21 07:37:49 +00:00
Guy Harris b3f81eb30c Separate the promiscuous mode, "Update list of packets in real time",
and "Automatic scrolling in live capture" options from the preference
settings for them, so that the preference settings affect the initial
values of those options, but changing those values in a capture don't
affect the preferences, and don't automatically get saved when you save
the preferences.

If we're building without libpcap, don't have an "Automatic scrolling in
live capture" option anywhere.

svn path=/trunk/; revision=4514
2002-01-10 11:05:50 +00:00
Gilbert Ramirez 0b9b02c6ea Long NCP traces can easily have many packets whose "uniqueness"
variables wrap-around. Since the request/reply packets are related via
a hash based on these uniqueness variables, long NCP traces can
have mis-matches reqeust/reply records.

Thus, only do the hash-lookup for the reply packet during the first
sequential scan of the trace file. Once the pertinent info is found,
store it in the packet's private data area.

Since the memory allocated for the hash and for the structures that make
up the keys are no longer needed after the first sequential run through
the trace file, arrange to free that memory after the first sequential
run. Similar to the register_init_routine() that allows dissectors
to register callbacks for calling *before* a capture file is loaded,
set up a register_postseq_cleanup_routine() function that allows
dissectors to register callbacks for calling *after* the first
sequential run-through of the trace file is made. This is not
a *final* cleanup callback, since Ethereal will still have that trace file
open for random-access reading.

I didn't have tethereal call postseq_cleanup_all_protocols() since
tethereal doesn't keep the trace file open for random-access reading.
I could easily be swayed to make tethereal call that function, however.

svn path=/trunk/; revision=4484
2002-01-05 04:12:17 +00:00
Guy Harris ae760a4caa In "change_time_formats()" we can now check at the beginning whether
there are any columns whose time formats will change, and just return if
there aren't.

We also, however, need to set the "writable" flag on the columns before
doing that check, as "check_col()" checks whether the column in question
is writable; in this context, all columns are writable.

svn path=/trunk/; revision=4472
2002-01-03 22:27:44 +00:00
Gilbert Ramirez 791f5774d0 Provide for per-protocol-tree data in the proto_tree code.
Put a hash-table of "interesting" fields in the per-proto-tree data.
The dfilter code records which fields/protocols are "interesting" (by which
I mean, their value or existence is checked). Thus, the proto_tree routines
can create special arrays of field_info*'s that are ready for the dfilter
engine to use during a filter operation.

Also store the "proto_tree_is_visible" boolean, renamed "visible", in
the per-proto-tree data.

Move epan_dissect_t to its own header file to make #include dependencies
easier to handle.

Provide epan_dissect_fill_in_columns(), which accepts just the epan_dissect_t*
as an argument.

epan_dissect_new() needs to be followed by epan_dissect_run() for the
dissection to actually take place. Between those two calls,
epan_dissect_prime_dfilter() can be run 0, 1, or multiple times in order to
prime the empty proto_tree with the "intersesting" fields from the dfilter_t.

svn path=/trunk/; revision=4422
2001-12-18 19:09:08 +00:00
Guy Harris 794f0c04f4 Add an extra argument to "epan_dissect_new()" that indicates whether the
display representation should be put into protocol tree items if a
protocol tree is to be constructed; have it set "proto_tree_is_visible"
from that argument.

svn path=/trunk/; revision=4408
2001-12-16 22:16:14 +00:00
Guy Harris 3658c6ce7e Add some additional comments.
svn path=/trunk/; revision=4375
2001-12-10 03:25:58 +00:00
Guy Harris 23319ff023 Move the pointer to the "column_info" structure in the "frame_data"
structure to the "packet_info" structure; only stuff that's permanently
stored with each frame should be in the "frame_data" structure, and the
"column_info" structure is not guaranteed to hold the column values for
that frame at all times - it was only in the "frame_data" structure so
that it could be passed to dissectors, and, as all dissectors are now
passed a pointer to a "packet_info" structure, it could just as well be
put in the "packet_info" structure.

That saves memory, by shrinking the "frame_data" structure (there's one
of those per frame), and also lets us clean up the code a bit.

svn path=/trunk/; revision=4370
2001-12-10 00:26:21 +00:00
Gilbert Ramirez 6542c18172 Remove proto_tree from capture_file and PacketWinData, since they
already contain a pointer to an epan_dissect_t, which contains
the proto_tree.

Routines calling epan_dissect_new() do not create their own
proto_tree via proto_tree_create_root(); instead, they pass a boolean
to epan_dissect_new() telling it whether it should create the root
proto_tree.

svn path=/trunk/; revision=4343
2001-12-06 04:25:09 +00:00
Guy Harris a936b559df Make the "Save only marked frames" button in the "Save As..." dialog box
sensitive only if there *are* marked frames.

svn path=/trunk/; revision=4341
2001-12-06 02:21:26 +00:00
Guy Harris 2174f26cdc In the NetMon capture file reading code, if we get a short read when
trying to read the frame table, return -1 with "*err" set to
WTAP_ERR_SHORT_READ, don't return 0 - we've already decided that the
file is a NetMon file, so we shouldn't return a "this isn't a NetMon
file" indication, we should return a "this file is too short" error, as
that's what the problem is.

Fix up the error messages for WTAP_ERR_SHORT_READ to indicate that the
read might have gotten cut short in the middle of data other than a
packet.

svn path=/trunk/; revision=4331
2001-12-04 23:38:55 +00:00
Gilbert Ramirez 8743a4a8a7 Remove the global packet_info called "pi". Dissectors now only
access their own "pinfo". A packet_info is stored in epan_dissect_t,
which is created for the dissection of a single packet.

GUI functions which need to access the packet_info of the currently
selected packet used to use "pi"; now they use cfile.edt->pi. cfile's
"edt" member is the epan_dissect_t of the currently-selected packet.

The functionality of blank_packetinfo() was moved into
dissect_packet(), as that's the only place that called blank_packetinfo(),
after a spurious call to blank_packetinfo() was removed from
packet_list_select_cb().

svn path=/trunk/; revision=4246
2001-11-21 23:16:26 +00:00
Guy Harris 1c3f2e4cd5 Have a routine to add all the hex dump tabs to the hex dump notebook,
and call it both from "select_packet()" and "create_new_window()",
rather than having two similar loops in both places.

svn path=/trunk/; revision=4233
2001-11-20 10:37:16 +00:00
Gilbert Ramirez 6de396c4a8 Fix the rest of the signed/unsigned comparison warnings.
svn path=/trunk/; revision=4088
2001-10-26 18:28:17 +00:00
Guy Harris 3c9efdf478 Use longs as file offsets, so that on platforms with 64-bit "long" we
can handle capture files bigger than 2GB.

svn path=/trunk/; revision=3993
2001-10-04 08:30:36 +00:00
Guy Harris 9d601c6799 On Windows, use the directory in which the binary resides as the
directory in which global data files are stored.  If an installed binary
is being run, that's the correct directory for them; if a build-tree
binary is being run, the "manuf" file will be there, and you can put
other data files there as well, if necessary.

Do the same with plugins, except that, if there's no
"plugins\\{version}" subdirectory of that directory, fall back on the
default installation directory, so you at least have a place where you
can put plugins for use by build-tree binaries.  (Should we, instead,
have the Windows build procedure create a subdirectory of the "plugins"
source directory, with the plugin version number as its name, and copy
the plugins there, so you'd use the build-tree plugin binaries?)

Move "test_for_directory()" out of "util.c" and into
"epan/filesystem.c", with the other file system access portability
wrappers and convenience routines.  Fix "util.h" not to declare it - or
other routines moved to "epan/filesystem.c" a while ago.

svn path=/trunk/; revision=3858
2001-08-21 06:39:18 +00:00
Ed Warnicke add908fabd Added a "Suppress Unmarked" option to the print dialog to
allow you to suppress the printing of unmarked packets.
This allows a user to mark the packets they wish to print and
print ONLY those packets by suppressing all other unmarked packets.

This may seem like a bit of a convoluted way of expressing things,
as usually the desired behavior would be to print the marked packets.
However, we do NOT print marked packets that are not displayed under
the current filter.  To be maximally explicite I've expressed this
as suppressing unmarked frames.

svn path=/trunk/; revision=3736
2001-07-17 05:32:44 +00:00
Guy Harris 537d308abe "open_cap_file()" in Ethereal and Tethereal don't use the FILE_T they
get from calling "wtap_file()", so get rid of the call and the
(otherwise unused) variable to which its result gets assigned.

That lets us get rid of "wtap_file()" in Wiretap.

It also lets us get rid of the include of "zlib.h" in "file.h"; the
#defines of "file_open()", "filed_open()", and "file_close()" are also
unnecessary, so we get rid of those as well.

However, that means we need to include <zlib.h> in "gtk/main.c" and
"tethereal.c", so that the version number of libz is defined and can
show up in the version string.

svn path=/trunk/; revision=3652
2001-07-05 00:34:42 +00:00
Guy Harris 8c52d3db75 More signed vs. unsigned cleanups, and initialization cleanups, from
Joerg Mayer.

svn path=/trunk/; revision=3578
2001-06-19 23:08:57 +00:00
Guy Harris 2da9bb2696 When printing the contents of a raw-data field, don't use the raw data
of the current frame as the source, use the raw data of the tvbuff
that's the data source of that field.

svn path=/trunk/; revision=3531
2001-06-08 08:50:51 +00:00
Guy Harris c9da803a08 Move the fragment reassembly code into "reassemble.c" and
"reassemble.h", and remove IPv4 dependencies from it.

Use it for OSI CLNP segment reassembly as well.

svn path=/trunk/; revision=3525
2001-06-08 06:27:16 +00:00
Guy Harris 2851b7ef76 Enable "Match Selected" only if there's a field selected *and* we can do
a "Match Selected" on it - we can't do a "Match Selected" if the field
has no value (e.g., FT_NULL) and has a length of 0.

If we unselect the current packet, we don't have a protocol tree, so we
don't have a currently selected field - clear the "Match Selected" menu
item and the display in the status line of information about the
currently selected field.

Move the low-level statusbar manipulation into "gtk/main.c", in routines
whose API doesn't expose anything GTK+-ish.

"close_cap_file()" calls one of those routines to clear out the status
bar, so it doesn't need to take a pointer to the statusbar widget as an
argument.

"clear_tree_and_hex_views()" is purely a display-manipulating routine;
move it to "gtk/proto_draw.c".

Extract from "tree_view_unselect_row_cb()" an "unselect_field()" routine
to do all the work that needs to be done if the currently selected
protocol tree row is unselected, and call it if the currently selected
packet list row is unselected (if it's unselected, there *is* no
protocol tree, so no row can be selected), as well as from
"tree_view_unselect_row_cb()".

Before pushing a new field-description message onto the statusbar, pop
the old one off.

Get rid of an unused variable (set, but not used).

svn path=/trunk/; revision=3513
2001-06-05 07:39:31 +00:00
Guy Harris e3a94e0342 Plug a memory leak (we weren't freeing the "epan_dissect_t" pointed to
by the "edt" member of a "capture_file" structure if we were selecting a
new frame, we were just overwriting that pointer).

Update Gerald's e-mail address.

svn path=/trunk/; revision=3470
2001-05-27 21:33:16 +00:00
Guy Harris bdb69627b2 "prefs.capture_real_time", not "prefs.capture_auto_scroll", should
control whether we have a child process do the capturing; a user might
want the packet list to be updated as packets arrive but *not* want it
to scroll so that the most recently arrived packets are shown.

"prefs.capture_auto_scroll", not "auto_scroll_live", should control
whether we scroll a real-time-update capture's packet list;
"auto_scroll_live" isn't set by the capture dialog box,
"prefs_capture_auto_scroll" is.

svn path=/trunk/; revision=3388
2001-05-01 00:18:48 +00:00
Guy Harris 8ac0e6618a The declaration of "destroy_packet_wins()" belongs in
"gtk/packet_win.h", along with the declarations of the other packet
window manipulation routines; put it there.

svn path=/trunk/; revision=3180
2001-03-24 02:14:56 +00:00
Guy Harris 58369df4ef Give the code that computes protocol statistics a progress dialog box,
as, on a large capture, it could take a significant amount of time.

Let the user stop the computation and, if they do, don't pop up the
statistics dialog box.

Create a new header file declaring the routines to create, update, and
destroy progress dialog boxes; those routines' APIs don't depend on
GTK+, but others declared in "ui_util.h" do, and we don't want to oblige
a source file to depend on GTK+ headers unless it uses a GTK+ API or an
API that depends on GTK+.

svn path=/trunk/; revision=3179
2001-03-24 02:07:22 +00:00
Jeff Foster 395b68ea19 Changes required to support multiple named data sources.
Tvbuffers changed to added the data source name,
GUI and printing code changed to support these changes
and display the multiple hex views.

svn path=/trunk/; revision=3165
2001-03-23 14:44:04 +00:00
Guy Harris bf0a3a32d1 In Ethereal, attempt to get the packet statistics from libpcap when
capturing; if we succeed, display the packet drops count as the "Drops"
value in the status line and as the "Dropped packets" statistics in the
summary dialog box, otherwise don't display it at all.

In Tethereal, attempt to get the packet statistics from libpcap when
capturing; if we succeed, and if there were any dropped packets, print
out the count of dropped packets when the capture finishes.

svn path=/trunk/; revision=3016
2001-02-11 09:28:17 +00:00
Guy Harris 261f3f1a6c Check for errors when writing a capture file.
Report errors when writing or closing a capture file.

Clean up some I/O error messages.

svn path=/trunk/; revision=3011
2001-02-10 09:08:14 +00:00
Guy Harris c1e36ebccc Use "dfilter_apply_edt()" rather than "dfilter_apply()".
svn path=/trunk/; revision=2982
2001-02-03 06:25:17 +00:00
Gilbert Ramirez 8f1fff2e6a Create a more modular type system for the FT_* types. Put them
into epan/ftypes.

Re-write display filter routines using Lemon parser instead of yacc.
Besides using a different tool, the new grammar is much simpler, while
the display filter engine itself is more powerful and more easily extended.

Add dftest executable, to test display filter "bytecode" generation.
Add option to "configure" to build dftest or randpkt, both of which are not
built by default.

Implement Ed Warnicke's ideas about dranges in the new display filter and
ftype code.

Remove type FT_TEXT_ONLY in favor of FT_NONE, and have protocols registered
as FT_PROTOCOL. Thus, FT_NONE is used only for simple labels in the proto tree,
while FT_PROTOCOL is used for protocols. This was necessary for being
able to make byte slices (ranges) out of protocols, like "frame[0:3]"

Win32 Makefile.nmake's will be added tonight.

svn path=/trunk/; revision=2967
2001-02-01 20:21:25 +00:00
Guy Harris cc74cc0a5f Get rid of support for old-style plugins (support for old-style plugins
requires that the dfilter code be initialized before the plugins are
added; this required us to *re*-initialize the dfilter code after
reading in all the plugins, as the plugins may themselves have added new
filterable fields - that was a bit of a mess), and make the
"Tools->Plugins" dialog box show the new-style plugins.

svn path=/trunk/; revision=2950
2001-01-28 21:17:29 +00:00
Guy Harris fcd119d834 Add a "color.h" file that declares a nominally-toolkit-independent
"color_t" structure to store color values (although currently it has all
the same fields that a GdkColor has; its currently advantage is that you
don't have to include any GTK/GDK stuff to declare it).

Add routines in the "gtk" directory to convert between "color_t" and
GdkColor values.

Define, in "prefs.h", all colors as "color_t" values rather than
GdkColor values.  "prefs.h" now no longer needs to include <gtk/gtk.h>,
so don't include it.

svn path=/trunk/; revision=2692
2000-11-21 23:54:10 +00:00
Guy Harris 252d55d80f For each column, have both a buffer into which strings for that column
can be put, and a pointer to the string for the column, which might or
might not point to that buffer.

Add a routine "col_set_str()", which sets the string for the column to
the string passed to it as an argument; it should only be handed a
static string (a string constant would be ideal).  It doesn't do any
copying, so it's faster than "col_add_str()".

Make the routines that append to columns check whether the pointer to
the string for the column points to the buffer for the column and, if
not, copy the string for the column to the buffer for the column so that
you can append to it (so you can use "col_set_str()" and then use
"col_append_str()" or "col_append_fstr()").

Convert a bunch of "col_add_str()" calls that take a string constant as
an argument to "col_set_str()" calls.

Convert some "col_add_fstr()" calls that take a string constant as the
only argument - i.e., the format string doesn't have any "%" slots into
which to put strings for subsequent arguments to "col_set_str()" calls
(those calls are just like "col_add_str()" calls).

Replace an END_OF_FRAME reference in a tvbuffified dissector with a
"tvb_length(tvb)" call.

svn path=/trunk/; revision=2670
2000-11-19 08:54:37 +00:00
Gilbert Ramirez 3424ae654e Remove #include "gtk/colors.h" from file.h, which keep the GTK+ header
files from being #included in epan/packet.c.
Fix the other files that need either "gtk/colors.h" or <gtk/gtk.h> #included
as a result of not pulling in gtk/colors.h automatically because of file.h.

svn path=/trunk/; revision=2519
2000-10-20 04:26:40 +00:00
Gilbert Ramirez e69b5278aa Implement epan_dissect_new() and epan_dissect_free(). These are the
"top-level" dissectors that libepan-users call, instead of dissect_packet().
The epan_dissect_t holds the tvbuff after dissection so that the tvbuff's
memory is not cleared until after the proto_tree is freed. (I might stuff
the proto_tree into the epan_dissect_t, too).

What remains of dissect_packet() in packet.c handles the tvbuff initialiation.
The real meat of dissect_packet() is now in dissect_frame(), in packet-frame.c
This means that "packet.c" is no longer a dissector, os it is no longer
passed to make-reg-dotc.

Once dissect_fddi() gets two wrapper functions (dissect_fddi_swapped()
and dissect_fddi_nonswapped()), the a dissector handoff routine could
be used instead of the switch statement in dissect_frame(). I'd register
a field like "wtap.encap"

svn path=/trunk/; revision=2478
2000-10-06 10:11:40 +00:00
Gilbert Ramirez 83ec54675c First step in moving core Ethereal routines to libepan.
svn path=/trunk/; revision=2458
2000-09-27 04:55:05 +00:00
Guy Harris 67983abe66 The correct way to check for an error (rather than an EOF) from a failed
attempt to read from a capture file is to check whether the error
returned was 0 - if it is, it's an EOF.  We no longer guarantee that the
data offset supplied will be negative on an error and 0 on an EOF.

svn path=/trunk/; revision=2445
2000-09-17 07:58:39 +00:00
Guy Harris 2cb0b44e1f It's "GSList", not "GSlist".
svn path=/trunk/; revision=2417
2000-09-12 03:28:34 +00:00
Guy Harris 0ea9639f65 Also free the GSLists for per-frame data on frames we haven't
re-dissected on a rescan.

svn path=/trunk/; revision=2416
2000-09-12 03:27:00 +00:00
Richard Sharpe bf8e6e763f Fix the problem with resetting per-frame state info problems that there
seemed to be ...

svn path=/trunk/; revision=2412
2000-09-11 22:43:02 +00:00
Richard Sharpe bf98417be0 We have to free up the per-frame data when we rescan, because we have
called packet_init_proto, which blows away the items the list points to.

svn path=/trunk/; revision=2408
2000-09-11 07:33:56 +00:00
Guy Harris 332d5715e8 Compute and display negative relative and delta time stamps correctly,
just in case time goes backwards (yes, it sometimes does happen in
captures).

svn path=/trunk/; revision=2407
2000-09-10 06:44:39 +00:00
Guy Harris f0efbd1a02 "redraw_hex_dump()" can't use "cfile.pd" or "cfile.current_frame", as it
may be redrawing a packet window that displays a frame other than the
current frame; give it arguments to specify the raw frame data and
"frame_data" structure for the frame.

This requires that each packet window have, associated with it, a
pointer to the "frame_data" structure; that replaces the "cap_len" and
"encoding" fields in a "PacketWinData" structure, as those are just
copies of fields from the frame's "frame_data" structure.

"packet_hex_print()" needn't be passed both the start and length values
from a "field_info" structure - just pass it a pointer to that
structure, or NULL for "no field is selected in the packet".  It also
needn't, any longer, be passed the "cap_len" and "flags.encoding" fields
of a "frame_data" structure - just pass it a pointer to that structure.

In "redraw_hex_dump_all()", don't redraw the hex dump pane of the main
window if there is no current frame.

svn path=/trunk/; revision=2404
2000-09-09 10:26:58 +00:00
Guy Harris e91341e3c3 Redraw:
the text in all "Follow TCP Stream" windows;

	the text in the help window if we have one up;

	all hex dump windows;

when GUI preference changes are to be applied, so that font changes and
"Follow TCP Stream" color changes show up.

Update both the Roman and bold font when the font is changed.

Don't decrement the reference counts on the old Roman and bold fonts
until that's all done.

svn path=/trunk/; revision=2401
2000-09-08 10:59:21 +00:00
Guy Harris b85ddbe885 Graham Bloice's patch to support inverse video rather than boldface
highlighting of the bytes, in the hex dump window, corresponding to a
selected field.

Also, make "remember_ptree_widget()" static, as it's not used outside
"gtk/proto_draw.c".

svn path=/trunk/; revision=2399
2000-09-08 09:50:08 +00:00
Gilbert Ramirez f52ffba407 Change wtap_read() API so that the data offset is set via a pointer, and
a "keep reading" boolean value is returned from the function.
This avoids having to hack around the fact that some file formats truly
do have records that start at offset 0. (i4btrace and csids have no
file header. Neither does the pppdump-style file that I'm looking at right now).

svn path=/trunk/; revision=2392
2000-09-07 05:34:23 +00:00
Guy Harris 781eb21d46 If we've thrown away saved state before a rescan of the frames in a
capture, clear the per-frame data pointers of all frames in the capture,
as those pointers now refer to data that's been freed.

Do that to all frames even if the user stops the rescan in the middle -
and clear the "visited" flag for all frames as well.

svn path=/trunk/; revision=2361
2000-08-24 09:16:39 +00:00
Guy Harris 8d8d351d02 Actually, we do have to clear all the dissector information if we're
redissecting the packets due to some preference changing, as the
preference may affect what state information gets constructed as a
result of some particular frame being dissected.

We don't have to do it when filtering the packets, or colorizing them,
however.

svn path=/trunk/; revision=2359
2000-08-24 06:45:37 +00:00
Guy Harris 47d5cfab52 Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call.  Use that to
determine whether a request or reply is a duplicate or not.

That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.

As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.

Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.

svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
Laurent Deniel ab47385543 Add prefs.gui_marked_[fb]g color preferences for the
color of marked frames.

They are currently only available from preferences file,
but I will add the color selection in GUI later.

svn path=/trunk/; revision=2327
2000-08-21 21:24:15 +00:00
Laurent Deniel 8fbd65cc7f Frames in the packet list can now be marked by the user using
the middle mouse button. The marked packets are displayed in
reverse video but this should change in the future (the color
should be configurable via the GUI).

Then,  the marked packets can be saved (via the "Save as"
window dialog).

Other features will be added in the future (I am waiting for
your comments and wishes).

svn path=/trunk/; revision=2322
2000-08-21 15:45:33 +00:00
Laurent Deniel 8bc95e98e4 Fix potential buffer overflows.
svn path=/trunk/; revision=2298
2000-08-19 18:20:59 +00:00
Laurent Deniel e559d013fc Oups. Forgot some set_menus_for_selected_tree_row calls.
svn path=/trunk/; revision=2277
2000-08-15 21:03:55 +00:00
Laurent Deniel 6a480953a9 Miscellaneous code cleaning
- add <stdarg.h> or <varargs.h> in snprintf.h
  and remove those inclusions in the other #ifdef NEED_SNPRINTF_H codes

- remove the check of multiple inclusions in source (.c)  code
  (there is a bit loss of _cpp_ performance, but I prefer the gain of
   code reading and maintenance; and nowadays, disk caches and VM are
   correctly optimized ;-).

- protect all (well almost) header files against multiple inclusions

- add header (i.e. GPL license) in some include files

- reorganize a bit the way header files are included:

  First:
  #include <system_include_files>
  #include <external_package_include_files (e.g. gtk, glib etc.)>
  Then
  #include "ethereal_include_files"

  with the correct HAVE_XXX or NEED_XXX protections.

- add some HAVE_XXX checks before including some system header files

- add the same HAVE_XXX in wiretap as in ethereal

Please forgive me, if I break something (I've only compiled and regression
tested on Linux).

svn path=/trunk/; revision=2254
2000-08-11 13:37:21 +00:00
Gilbert Ramirez fac3eec39a Make copy_binary_file() static since follow_dlg.c no longer uses it.
svn path=/trunk/; revision=2237
2000-08-09 06:18:16 +00:00
Gilbert Ramirez a3e7190456 Add a "Save As" feature to the TCP Follow dialogue, to save the stream
file to a user-specified file.

Move the file-copy routine in save_cap_file() to an indepenent
function in file.c  (copy_binary_file()) so that follow_dlg.c can use it.

Remove #include "follow.h" from the C files that don't need it.

svn path=/trunk/; revision=2200
2000-08-03 12:44:40 +00:00
Gilbert Ramirez 15a399d338 Replace calls to sprintf() with snprintf() in file_*_error_message routines,
as a long filename may overflow the buffer.

svn path=/trunk/; revision=2199
2000-08-03 12:02:15 +00:00
Gilbert Ramirez eeade6de43 When rescanning a file, all state information for the frames has
been deleted. So we have to set fdata->flags.visited to 0 for each frame,
denoting a "fresh" scan.

svn path=/trunk/; revision=2161
2000-07-26 03:08:56 +00:00
Guy Harris e068b7dbe7 In Tethereal:
When capturing, report errors trying to create the output file
	with "file_open_error_message()".

	Make the "for_writing" argument to "file_open_error_message()" a
	"gboolean", as it's either TRUE (if the file is being opened for
	writing) or FALSE (if it's being opened for reading).

	Report EISDIR as "XXX is a directory (folder), not a file.".

When checking whether an "open()" of a capture file succeeded, check
whether "open()" returns a negative number, not whether it returns 0.

In "wtap_open_offline()", if the file to be opened is a directory,
return EISDIR, not WTAP_ERR_NOT_REGULAR_FILE, so that the error message
can say "that's a directory, not a file".

If "wtap_open_offline()" returns WTAP_ERR_NOT_REGULAR_FILE, don't just
say the file is "invalid", say it's a "special file" or socket or some
other weird type of file.

svn path=/trunk/; revision=2144
2000-07-20 09:39:43 +00:00
Guy Harris 024c2d72fe Use ESD_TYPE_CRIT for most errors (the model used by various GUIs seems
to use "warning" dialog boxes only to warn the user "if you do that, bad
things may happen" *and* to offer them the option either to drive on or
quit, so perhaps ESD_TYPE_CRIT should be used for all errors).

However, put "Ethereal: Error" rather than "Ethereal: Critical" in the
title bar, in the hopes that it'll make it clearer that Something Bad
Happened.

If the user specifies that captures should be saved to a user-specified
file rather than a temporary file, report errors trying to create that
file with "file_open_error_message()".

Make the "for_writing" argument to "file_open_error_message()" a
"gboolean", as it's either TRUE (if the file is being opened for
writing) or FALSE (if it's being opened for reading).

Report EISDIR as "XXX is a directory (folder), not a file.".

svn path=/trunk/; revision=2143
2000-07-20 05:10:02 +00:00
Guy Harris ebb525fac6 Put up a progress dialog when changing the time display; it can take a
long time on a large capture.

If the user is changing the setting of "Display TOS as DiffServ" *and*
the time stamp format, don't bother doing the time display update -
we'll regenerate the entire display anyway because we changed the
setting of "Display TOS as DiffServ".

svn path=/trunk/; revision=2130
2000-07-09 23:22:33 +00:00
Guy Harris 0a71de8137 Turn the code of "colorize_packet()" into a static routine that is given
a word to use in the progress dialog, and a flag indicating whether the
display filter is to be reevaluated or not, and:

	have "colorize_packet()" call that routine with "Colorizing" and
	FALSE as those arguments;

	have the filtering code call that routine with "Filtering" and
	TRUE as those arguments;

	add an exported routine to call that routine with "Reprocessing"
	and TRUE as those arguments, to use to re-generate the packet
	list and to re-filter the packets if a protocol preference has
	been changed.

Keep track of whether preferences are changed from their initial value
by a preferences file or a command-line option, or from their previous
value by the "Preferences" dialog box; have "prefs_apply_all()" only
call the "apply" callback for a module if they have.

Call "prefs_apply_all()" after the command-line arguments have been
parsed and after "OK" has been clicked in the "Preferences" dialog box,
to notify modules of preference changes if they've registered a callback
for that.

After "OK" has been clicked in the "Preferences" dialog box, if any
preferences have changed, call the reprocessing routine, as the summary
line for some frames and/or the current display filter's value when
applied to some frames may have changed as a result of a preference
change.  Do the same after "OK" or "Apply" has been clicked in the
"Display Options" dialog box (as it controls a protocol preferences
item.

svn path=/trunk/; revision=2126
2000-07-09 03:29:42 +00:00
Guy Harris ae1df37513 If the progress dialog gets a "delete" event, have the handler return
TRUE, meaning "don't delete this", and if its "stop this operation"
button gets clicked, don't have its handler delete the progress dialog;
instead, leave the deletion of the window up to the code using the
dialog, as it'll do so when it stops the operation.

Make the "read file" operation destroy the dialog; all the other
operations already did so (as they just broke out of the loop doing the
operation, rather than returning).

Don't catch the "destroy" operation on the dialog box - its handler
appeared never to get called; we can just free the "progdlg_t" for the
dialog in "destroy_progress_dlg()", right after destroying the dialog
box widget.

svn path=/trunk/; revision=2122
2000-07-07 23:09:15 +00:00
Guy Harris 4e69c6bc87 Use "progdlg_t *" rather than "void *" as the handle for a progress
dialog box; that lets us do some type-checking, but we can still typedef
it to an incompletely-defined structure to hide the implementation
details from the caller.

Make "create_progress_dlg()" take, as an argument, the title to put in
the "stop the operation" button, and use "Stop" rather than "Cancel" if
stopping the operation doesn't undo all the work it's done.

Thaw the clist if we break out of a "read the file" operation, as we
freeze it before the operation.

Have the handler for the "delete" event on the progress dialog box
return FALSE, to let GTK+ know that it should, in fact, delete the
window.  ("delete" event handlers should return TRUE if the window
shouldn't actually be deleted, FALSE if it should; they should not
return "void".)

svn path=/trunk/; revision=2120
2000-07-07 07:01:58 +00:00
Guy Harris e4a9d0f426 If the user clicks the "Cancel" button in a progress-bar dialog box for
reading a capture file, we should just clean up and return so that
Ethereal continues running with no capture file loaded, unless the read
is being done as a result of Ethereal being run with the "-r" flag, in
which case we still exit (although we may eventually choose to continue
running with no capture file loaded even in that case).

svn path=/trunk/; revision=2104
2000-07-03 09:34:27 +00:00
Guy Harris 9e42b3a4ed Remove the progress bar from the status line, and, instead, for any
potentially long-running operation that has a progress indicator, pop up
a modal dialog box with

	an indication of what is being done;

	a progress bar;

	a "Cancel" button to stop the operation.

This:

	leaves more room on the status line for a filter expression;

	provides a mechanism to allow the user to cancel long-running
	operations (although the way we do so may not back out of them
	as nicely as the user might like, if it's not obvious what the
	"right" way is or if the "right" way is difficult to implement
	or involves doing as much work as letting the operation
	continue);

	means that, because the dialog box is modal, we don't have to
	worry about the user performing arbitrary UI operations out from
	under the operation and changing arbitrary bits of state being
	used by that operation.

svn path=/trunk/; revision=2103
2000-07-03 08:36:52 +00:00
Guy Harris 6ea9c6aa9b Don't pass a pointer to the packet data buffer to "read_packet()"; let
it, rather than its callers, get that pointer from "cf->wth".

svn path=/trunk/; revision=2096
2000-06-27 09:26:10 +00:00
Guy Harris 7843ac6d0e Add routines to Wiretap to allow a client of Wiretap to get:
a pointer to the "wtap_pkthdr" structure for an open capture
	file;

	a pointer to the "wtap_pseudo_header" union for an open capture
	file;

	a pointer to the packet buffer for an open capture file;

so that a program using "wtap_read()" in a loop can get at those items.

Keep, in a "capture_file" structure, an indicator of whether:

	no file is open;

	a file is open, and being read;

	a file is open, and is being read, but the user tried to quit
	out of reading the file (e.g., by doing "File/Quit");

	a file is open, and has been completely read.

Abort if we try to close a capture that's being read if the user hasn't
tried to quit out of the read.

Have "File/Quit" check if a file is being read; if so, just set the
state indicator to "user tried to quit out of it", so that the code
reading the file can do what's appropriate to clean up, rather than
closing the file out from under that code and causing crashes.

Have "read_cap_file()" read the capture file with a loop using
"wtap_read()", rather than by using "wtap_loop()"; have it check after
reading each packet whether the user tried to abort the read and, if so,
close the capture and return an indication that the read was aborted by
the user.  Otherwise, return an indication of whether the read
completely succeeded or failed in the middle (and, if it failed, return
the error code through a pointer).

Have "continue_tail_cap_file()" read the capture file with a loop using
"wtap_read()", rather than by using "wtap_loop()"; have it check after
reading each packet whether the user tried to abort the read and, if so,
quit the loop, and after the loop finishes (even if it read no packets),
return an indication that the read was aborted by the user if that
happened.  Otherwise, return an indication of whether the read
completely succeeded or failed in the middle (and, if it failed, return
the error code through a pointer).

Have "finish_tail_cap_file()" read the capture file with a loop using
"wtap_read()", rather than by using "wtap_loop()"; have it check after
reading each packet whether the user tried to abort the read and, if so,
quit the loop, and after the loop finishes (even if it read no packets),
close the capture and return an indication that the read was aborted by
the user if that happened.  Otherwise, return an indication of whether
the read completely succeeded or failed in the middle (and, if it
failed, return the error code through a pointer).

Have their callers check whether the read was aborted or not and, if it
was, bail out in the appropriate fashion (exit if it's reading a file
specified by "-r" on the command line; exit the main loop if it's
reading a file specified with File->Open; kill the capture child if it's
"continue_tail_cap_file()"; exit the main loop if it's
"finish_tail_cap_file()".

svn path=/trunk/; revision=2095
2000-06-27 07:13:42 +00:00
Guy Harris 7fbf320b8a Patch from Ben Fowler to rename the global variable "cf" to "cfile", to
make it easier to use grep to find all references to it without getting
a lot of false hits and to check, after allocating the memory chunk for
"frame_data" structures, that the allocation succeeded.

svn path=/trunk/; revision=2092
2000-06-27 04:36:03 +00:00
Gilbert Ramirez d7e6e0e384 Add wtap-int.h. Move definitions relevant to the internal workins of wiretap
to that file, leave public definitions in wtap.h.

Rename "union pseudo_header" to "union wtap_pseudo_header".
Make the wtap_pseudo_header pointer available in packet_info struct.

svn path=/trunk/; revision=1989
2000-05-19 23:07:04 +00:00
Guy Harris f3d90d30a4 Remove the "union pseudo_header" from the "frame_data" structure;
there's no need to keep it around in memory - when the frame data is
read in when handing a frame, read in the information, if any, necessary
to reconstruct the frame header, and reconstruct it.  This saves some
memory.

This requires that the seek-and-read function be implemented inside
Wiretap, and that the Wiretap handle remain open even after we've
finished reading the file sequentially.

This also points out that we can't really do X.25-over-Ethernet
correctly, as we don't know where the direction (DTE->DCE or DCE->DTE)
flag is stored; it's not clear how the Ethernet type 0x0805 for X.25
Layer 3 is supposed to be handled in any case.  We eliminate
X.25-over-Ethernet support (until we find out what we're supposed to
do).

svn path=/trunk/; revision=1975
2000-05-18 09:09:50 +00:00
Guy Harris 7bf3c7523b Have "proto_tree_is_visible" false except when we're in the middle of
doing something that requires that the text for protocol tree entries be
generated, i.e.

	1) initialize it to FALSE;

	2) have every routine that sets it clear it when it's done;

	3) when printing packets, set it to TRUE only if we're not just
	   printing packet summary lines;

and then get rid of settings to FALSE made unnecessary as a result of
those changes.

This makes sure it's not set when it doesn't have to be (which causes
the protocol tree code to format the text when it doesn't have to,
wasting CPU time).

svn path=/trunk/; revision=1973
2000-05-18 08:35:01 +00:00
Guy Harris 9befd25e50 We can't trust "cf->current_frame" to refer to the frame that was
selected before we started re-colorizing or re-filtering the display, as
when the first row is added to the clist, that may be selected and thus
made the current frame.

This means that we can't find the row corresponding to the
previously-selected frame, if any, by checking as each packet is
colorized/filtered and see whether its "frame_data" structure is equal
to "cf->current_frame", as that'll always say that the first frame in
the display is the selected frame.

Instead, we recored the value of "cf->current_frame" before we do
anything to the clist, have "add_packet_to_packet_list()" return either
the row number of the frame (if it passed the filter and thus was added
to the clist) or -1 (if it didn't pass the filter and thus wasn't added
to the clist), and, after "add_packet_to_packet_list()", if the current
frame is the one that was the selected row, remember its row number (if
any), and, when we're finished colorizing/filtering the display, make
that row the current row if it's not -1 (-1 means that the selected row
didn't pass the filter).

Also, don't do that until after we've thawed the clist, as the vertical
adjustment for the clist doesn't reflect reality until then, and
attempting to go to a given row won't work right until the vertical
adjustment for the clist reflects reality.

Shove all the code to set the selected and focus rows, and to make said
row visible, into a routine, so the "Find Frame" and "Go To Frame" code
can use it as well.

svn path=/trunk/; revision=1959
2000-05-15 01:50:16 +00:00
Gilbert Ramirez 651acccfd9 Ben Fowler <wapdev@leedsnet.com>'s "usage of fd" patch.
svn path=/trunk/; revision=1952
2000-05-12 22:03:59 +00:00
Guy Harris 97420edd50 Fix indentation so that it looks correct if tabs are every 8 spaces,
that being the UNIX default.

svn path=/trunk/; revision=1911
2000-05-06 05:19:42 +00:00
Gilbert Ramirez 61167a3c28 Change dfilter_apply() to 4-argument function. 4th argument is not yet used,
but will be in the future, and it's easier for me to keep my local branch
in sync with the source with the calls to dfilter_apply() already modified
tothe 4-arg format.

Add a CPP macro to ipv4.h to define ipv4_addr_ne(). Use it in dfilter.c

svn path=/trunk/; revision=1854
2000-04-14 05:39:43 +00:00
Gilbert Ramirez b218a8f550 Consolidate flags in struct frame_data, and add "visited" flag. Use
it in SOCKS dissector.

(Okay, how many times am I going to modify packet.h today, forcing you
to re-compile everything? :-)

svn path=/trunk/; revision=1850
2000-04-13 20:39:38 +00:00
Guy Harris 5fe1de894e When searching for a frame that matches a filter expression, we
shouldn't stop the search as soon as we get back to the starting frame,
we should stop the search if the filter expression doesn't match and the
frame we tried it on was the starting frame - it's OK if we find the
starting frame, it's just not OK to continue if we don't find that
frame.

svn path=/trunk/; revision=1815
2000-04-07 08:00:34 +00:00
Guy Harris 76f0935df9 Plug a memory leak in the "Find Frame" code - we weren't freeing the
protocol tree after checking whether it matched the filter we supplied.

svn path=/trunk/; revision=1814
2000-04-07 07:48:15 +00:00
Guy Harris f9acb5fdb7 After destroying the mem chunk for the packet list, null out the pointer
pointing to it, so that if we call "close_cap_file()" again, we don't
try to destroy an already-destroyed mem chunk.

svn path=/trunk/; revision=1806
2000-04-06 06:04:24 +00:00
Guy Harris 05fe159e74 Allocate the new mem chunk for the capture in "open_cap_file()", rather
than duplicating the allocation code in "read_cap_file()" and
"start_tail_cap_file()".

svn path=/trunk/; revision=1784
2000-04-04 05:14:48 +00:00
Gilbert Ramirez b61aeda52d Set cf->plist_chunk in the other place where needed. Guy's experiencing
some network problems today, so I checked this in for him.

svn path=/trunk/; revision=1782
2000-04-03 22:28:51 +00:00
Guy Harris 9653203d24 Note that it didn't seem to save a significant amount of time or space
to use a G_ALLOC_ONLY memory chunk rather than a G_ALLOC_AND_FREE memory
chunk.

svn path=/trunk/; revision=1777
2000-04-03 08:57:17 +00:00
Guy Harris f3c287d201 Use a GMemChunk for allocating and freeing "frame_data" structures; it
reduces the memory required for one big capture file I have by about 10
megabytes, and speeds up the reading in of that file, presumably because
it amortizes the memory-allocator space and CPU time overhead over
a set of several "frame_data" structures.

svn path=/trunk/; revision=1776
2000-04-03 08:42:45 +00:00
Olivier Abad 2673685067 Add a counter : "enabled_plugins_number", to record how many plugins are
enabled. The counter is incremented in enable_plugin() and decremented
in disable_plugin().
In add_packet_to_packet_list(), we check this counter (instead of
plugin_list) to see if there is at least one enabled plugin. If this is
the case, we must build the protocol tree.

svn path=/trunk/; revision=1770
2000-03-31 21:42:24 +00:00
Guy Harris e386451345 Patches from Andreas Sikkema:
On Win32, always save a temporary capture file by copying -
	Win32 systems don't allow you to rename a file that is open, and
	we have the temporary file open.

	When saving by copying the raw bytes of a capture file, create
	the target file with "open()", using the O_BINARY flag, rather
	than with "creat()"; on Win32 systems, "creat()" apparently
	opens the file as a text file rather than a binary file.

svn path=/trunk/; revision=1757
2000-03-28 08:11:52 +00:00
Richard Sharpe e987dcca02 Set the per frame data pointer to NULL when a new frame is read in.
svn path=/trunk/; revision=1749
2000-03-26 07:03:52 +00:00
Guy Harris a62224b08c In "add_packet_to_packet_list()", always use the "buf" argument to refer
to the raw packet data, don't use "cf->pd" - "cf->pd" doesn't contain
the packet data when the file is being read in, it only contains it when
we're re-reading packets.

svn path=/trunk/; revision=1728
2000-03-20 04:55:10 +00:00
Guy Harris da5757e340 Making the "frame_data" structure for a frame the data associated with
the row for that frame, and using that to get the frame for the selected
row in "select_packet()", revives the crash caused by the GtkCList
selecting the first row added to the list as it's added, i.e. before we
get a chance to set the data for that row, in this case.

Introduce a workaround for this instance of that crash.

svn path=/trunk/; revision=1711
2000-03-12 03:13:58 +00:00
Guy Harris 050979d522 We already set the foreground and background color for every frame,
which means we're already doing a "do something to the last row in the
packet list" operation on every frame we add to the list, so adding a
call to "gtk_clist_set_row_data()" won't make matters worse.

In addition, we already set one column in a row on a "change time
format" operation, so finding the row for a frame by calling
"gtk_clist_find_row_from_data()" doesn't turn a constant-time operation
into a linear-time operation, it just cranks the proportionality
constant up - it was quadratic before, alas, and it's still quadratic.

Adding calls to "gtk_clist_find_row_from_data()" to the "Find Frame" and
"Go To Frame" code does add an extra linear operation there, but those
operations shouldn't be common - and "Go To Frame", going to the last
frame on an ~100,000-frame big capture file, was quick, at least on my
450 MHz Pentium II machine, so maybe it won't be too bad.

And "select_packet()" either has to search the frame table for the frame
with the specified row number, or has to call "gtk_clist_get_row_data()"
to do that - the first is linear in the position of the frame in the
frame table, and the latter is linear in its position in the CList, and
the latter is less than or equal to the former, so the only thing making
it worse would be a change in the proportionality constant.

So it probably won't hurt performance by much.

Furthermore, if we add the ability to sort the display on an arbitrary
column, or to delete frames from the display - both of which are in the
wish list - storing the row number of the frame in the "frame_data"
structure won't necessarily work, as the row number can change out from
under us.

Therefore, reinstate the old way of doing things, where we associate
with each row a pointer to the "frame_data" structure for the row, using
"gtk_clist_set_row_data()".

svn path=/trunk/; revision=1703
2000-03-08 06:48:01 +00:00
Guy Harris 7c11334000 Jeff Foster's changes, with my additions, to allow the user to pop up a
window showing the protocol tree and hex/ASCII data for the currently
selected packet.

svn path=/trunk/; revision=1670
2000-02-29 06:24:41 +00:00
Guy Harris 1d5f958c02 Don't use a fixed-size line buffer for summary lines in the print code;
mallocate the buffer and grow it as necessary.

svn path=/trunk/; revision=1659
2000-02-21 08:18:00 +00:00
Olivier Abad 44a7c1ec31 Used register_init_routine() to register "reinit_x25_hashtable()" as a
routine to be called every time a new capture file is opened instead of
calling it in read_cap_file() and do_capture().

svn path=/trunk/; revision=1651
2000-02-19 14:00:35 +00:00
Guy Harris 585268e3e1 Use WTAP_ERR_UNSUPPORTED_ENCAP for all attempts to open or read a
capture file for an unsupported link-layer encapsulation type (as the
nettl reader does), and report it correctly if it occurs on an open or
read attempt rather than a save attempt.

svn path=/trunk/; revision=1647
2000-02-19 08:00:08 +00:00
Olivier Abad bb2454e8bd Renamed init_dissect_x25() to reinit_x25_hashtable() and actually used it !
This function is used to re-initialize the hash table used by the X.25
dissector to record the upper layer protocol used by each VC. The hash
table should be re-initialized each time we read / start a new capture.

I moved the definition of the function from packet.h to packet-x25.h, and
added calls to reinit_x25_hashtable() in read_cap_file (file.c) and
do_capture (capture.c).

svn path=/trunk/; revision=1644
2000-02-18 13:41:26 +00:00
Guy Harris 679a1de7dd Get rid of redundant include of <stdio.h> - one is enough.
svn path=/trunk/; revision=1635
2000-02-14 04:57:30 +00:00
Guy Harris a30c9d9979 Change from Ed Meaney - when doing a "Save" or "Save As" that saves all
packets and doesn't change the capture file format, i.e. that's done by
a raw copy, read the file in binary.  (XXX - does "creat()", on Win32,
open the file in ASCII or binary mode?  If ASCII, we may have to use

	open(fname, O_CREAT|O_TRUNC|O_WRONLY|O_BINARY, 0644)

rather than

	creat(fname, 0644)

so that the output file is written in binary as well.)

svn path=/trunk/; revision=1599
2000-02-03 06:35:27 +00:00
Gilbert Ramirez 15ccb155f8 If a file is opened, and then closed, the File|Open option doesn't
show up any more (nor does the Capture option). Fixed.

svn path=/trunk/; revision=1574
2000-01-27 09:53:50 +00:00
Gilbert Ramirez b8e2c9ece2 Add O_BINARY flag to open() for win32.
svn path=/trunk/; revision=1560
2000-01-25 17:51:11 +00:00
Guy Harris 8e68faf22f Encapsulate the code to take a pointer to a pathname and return a
pointer to the name of the file to which it refers (i.e., to the last
component of the pathname) in a "get_basename()" routine, and have the
code in "file.c" call it.

svn path=/trunk/; revision=1552
2000-01-25 04:31:17 +00:00
Guy Harris 49feff26fb "If there aren't any packets to select" means "if there aren't any
packets displayed", not just "if there aren't any packets" - there may
be packets but no displayed packets if the display filter didn't find
any packets.

NULL out the pointers to the first and last displayed packet when
closing a capture file.

svn path=/trunk/; revision=1548
2000-01-25 01:05:06 +00:00
Guy Harris 4bd85b6d7e If there aren't any packets to select, don't try to select the first
packet; "select_packet()" gets peeved because it can't find the packet,
and panics.

svn path=/trunk/; revision=1547
2000-01-25 00:36:35 +00:00
Guy Harris 59fcaf5c03 On Win32, when splitting file names into directory and last component,
search for '\' rather than '/'.

svn path=/trunk/; revision=1545
2000-01-25 00:17:01 +00:00
Guy Harris def30cb94f Open files with "rb" rather than "r" - this may fix up the problems
Gilbert alluded to with reading capture files on Win32 systems.

svn path=/trunk/; revision=1541
2000-01-24 19:32:13 +00:00
Guy Harris 4603877dc4 Jerry Talkington's changes to support, in the packet list and protocol
tree panes, menus popped up by the right mouse button.

svn path=/trunk/; revision=1504
2000-01-18 08:38:18 +00:00
Gilbert Ramirez 339d67b043 Merge in the final code to make Ethereal run on Win32, compiled
with MSVC 6.0 and 'nmake', the make tool that comes with MSVC.

It compiles, links, and runs. It doesn't run correctly. There's a problem
when reading files. I'm getting short reads.  I'm not linking in zlib or
libsnmp because it first needs to be debugged.

I changed the plugin code to use gmodule instead of libltdl, but the
Unix build still links ethereal against libltdl. I'll fix that tonight; sorry
about leaving it in such a sad state, but I wanted to check in this code
before I left work on a Friday night. Ethereal still works, but the
building is less than optimal.

svn path=/trunk/; revision=1479
2000-01-15 00:23:13 +00:00
Guy Harris bff15bc846 Assign a frame number to a frame only when reading frame data from a
file, not when filtering or colorizing packets - filtering shouldn't
change the frame number of a frame (yes, this means that a filtered
display won't necessarily have packets numbered contiguously 1 through N
- that's a feature).

svn path=/trunk/; revision=1456
2000-01-13 00:53:09 +00:00
Guy Harris 9fe38ca2b5 Move the code in "column.c" that implements the column preferences tab
into "gtk/column_prefs.c".

Get rid of "get_column_width()" - instead, export
"get_column_longest_string()", and have "get_column_width()"'s callers
make the GDK call to get the width of that string, so that "column.c"
contains no GTK+/GDK code.

svn path=/trunk/; revision=1447
2000-01-10 01:44:00 +00:00
Guy Harris 24bf66d16c Don't recompute "cf->count" when filtering packets - the recomputation
will just give it the value it's always had, as packets are counted
regardless of whether they pass the filter or not (which is what we
want).

Given that, so there's no need for a separate "cf->unfiltered_count"
value, so get rid of it and use "cf->count" instead.

svn path=/trunk/; revision=1441
2000-01-08 23:49:33 +00:00
Guy Harris c4a7eb6457 Printing multiple pages of PostScript wasn't as tricky as I thought; add
support for printing in PostScript to the "Print..." dialog box.

svn path=/trunk/; revision=1426
2000-01-06 07:33:35 +00:00
Guy Harris 24fb5d5651 When we select the row for the frame found by "Find Frame..." or "Go To
Frame...", make it the focus row as well.

svn path=/trunk/; revision=1420
2000-01-05 07:22:47 +00:00
Guy Harris ef7014e92b Before adding a frame to the list of displayed frames, set its row
number to 0, so that "select_packet()" will find it if a "select-row"
signal is emitted when it's added.

(The previous workaround for this problem worked when initially
constructing the list of all frames, but not when reconstructing the
list of displayed frames when filtering packets, as, in the latter case,
there could be more than one frame in the list of all frames, so we
couldn't just say "pick the one and only frame in the list".  The row
number is set to the correct value after the frame is added to the list
of displayed frames and we know the row number it was given.)

svn path=/trunk/; revision=1416
2000-01-03 22:53:34 +00:00
Guy Harris 4096029a66 Take the "simple_dialog()" stuff out of "ui_util.h" and "gtk/ui_util.c",
and move it to "simple_dialog.h" and "gtk/simple_dialog.c".

svn path=/trunk/; revision=1414
2000-01-03 06:59:25 +00:00
Guy Harris 2ef301bcf6 Have "gtk/menu.c" (and, in the future, code for other UIs) export a set
of routines to enable and disable various sets of menu items; call only
those routines, not routines to enable or disable particular menu items,
from files in the top-level directory, as other UIs may not refer to
menu items with path strings of the sort used in GTK+, and as this
buries knowledge of the menu items available in "gtk/menu.c" rather than
requiring stuff outside of "gtk/menu.c" to know what menu items exist.

svn path=/trunk/; revision=1410
2000-01-03 03:57:04 +00:00
Guy Harris 04e20bf4cd Fix a nasty side-effect of running the packet list in
GTK_SELECTION_BROWSE mode - that mode apparently always arranges that
there is (in a non-empty GtkCList) one row selected, which means that
when the first row is added, it selects it.

Unfortunately, that causes a "select-row" signal to be emitted, which
causes "select_packet()" to be called - but we haven't yet set "fd->row"
for the frame we're adding, so "select_packet()" can't find the frame
for the row being selected, and it aborts.

This causes a core dump when the first packet arrives during an "Update
list of packets in real time" capture.

For now, we handle this by, if we don't find the frame with the given
row number, checking that there's exactly one frame in our list of
frames and, if so, saying that frame is the frame for which we're
looking.

svn path=/trunk/; revision=1409
2000-01-03 03:46:36 +00:00
Gilbert Ramirez 8162d65615 Changed the protocol tree widget from a GtkTree to a GtkCTree. The two reasons
I did this:

First, Havoc Pennington, in "GTK+/Gnome Application Development", in
Appendix seciton A.3.88, recommends using GtkCTree instead of GtkTree
because GtkCtree is faster, and GtkTree has limitation on its total row
height: since it must fit inside a GdkWindow, it is limited to 32,768
pixels of height. GtkTree is more flexible with regards to the types of
widgets that can be placed in the tree, but since we deal only with text,
that doesn't matter, at least for now.

Secondly, a GtkTree doesn't allow arrow-key navigation (at least as far
as I could tell). It always bothered me that the up and down arrow keys
worked in the packet list and in the hex dump, but no in the protocol tree.
GtkCTree does allow arrow-key navigation. In fact, GtkCTree is a subclass
of GtkCList (the packet list widget), so they behave a lot alike.

I went ahead and fixed the selection bar which has been bothering Richard
for a long time now. :) In the GUI preferences dialogue, you can now set
both the packet list selection bar and the protocol tree selection bar
to either "browse" or "select" mode. "browse" mode is what you're used to:
the arrow keys move an outline of the selection bar, but do not change
the selection. "select" mode does change the selection when the arrow keys
are pressed. The default behavior is set to "select", which seems more
natural for a first-time user.

svn path=/trunk/; revision=1393
1999-12-29 20:10:12 +00:00
Guy Harris de00c78ac8 Move the stuff to fill in those columns not filled in by dissectors from
"file.c" to "packet.c"; it's not really related to file access (or to
manipulating the packet list as a whole, which much of the stuff in
"file.c" is really for), but is more related to analyzing packets, and
moving it to "packet.c" lets me build an experimental "line-mode" flavor
of Ethereal (based on Gilbert's "tethereal" experiment) - "line-mode"
means "like tcpdump or snoop" - without having to drag in "file.c" and a
pile of GUI stuff.

svn path=/trunk/; revision=1388
1999-12-29 07:25:48 +00:00
Guy Harris 467aa54385 Don't keep the CList of color filters around; create it when the
"Colorize Display" dialog box is created, and let it be destoryed when
that dialog box is destroyed.

When moving color filters up or down, update the (order of the elements
in the) list of color filters, as well as the CList that displays them.

If we have a "Colorize Display" dialog box open, and the user selects
"Display:Colorize Display", raise the existing window, rather than
creating a new window.  (Alas, GTK+ doesn't have a call to request that
the window be given the input focus, so we can't do that as well.)

Fix up some names to be more consistent and to better reflect what the
variables/routines are for.

svn path=/trunk/; revision=1361
1999-12-19 09:22:19 +00:00
Guy Harris ef250527f8 Make the color filter list global, and have the code that applies
color filters check whether it's null to decide if there are any color
filters to apply.

Make "color_filter()" act on that list - there really aren't multiple
lists of color filters, there's only one list ("read_filters()" and
"write_filters()" acts only on one global list - and always has, as they
handled only one file).

svn path=/trunk/; revision=1359
1999-12-19 07:28:36 +00:00
Gilbert Ramirez e996e3d661 Oops. My last commit was made form the wrong tree and code that
was under development was accidentally checked in. This reverses the
changes.

svn path=/trunk/; revision=1342
1999-12-15 07:03:11 +00:00
Gilbert Ramirez b906ce0a17 Add Dearborn Group Technology's Gryphon dissector as our first
shipped plugin.

svn path=/trunk/; revision=1341
1999-12-15 06:53:36 +00:00
Olivier Abad 8b339e902c Copy the pseudo_header from frame_data to the wtap_pkthdr structure before
passing it to wtap_dump()
It allows to save correct "from_dce/from_dte" flags in ngsniffer_dump.

svn path=/trunk/; revision=1301
1999-12-12 13:25:54 +00:00
Olivier Abad 564a1c1d62 plugins support (i.e. Dynamically loadable dissectors)
depends on dlopen() being available on the target platform

svn path=/trunk/; revision=1263
1999-12-09 20:43:38 +00:00
Guy Harris 80618858d6 Move the GTK+ implementations of various UI utilities out of "util.c"
into "gtk/ui_util.c", and move the declarations of those UI utilities
out of "util.h" into "ui_util.h".  (The header file is in the top-level
directory, rather than the "gtk" directory, because it declares
window-system-independent interfaces to routines with
window-system-dependent implementations.)

Add to "gtk/ui_util.c" a routine to set the window and icon title.

Use that routine to make the title of an Ethereal top-level window be

	{filename} - Ethereal

if there's a capture open, and have "{filename}" be "<capture>" if it's
a temporary capture file.

svn path=/trunk/; revision=1255
1999-12-09 07:19:20 +00:00
Guy Harris aef39cc00f To find out the file's packet encapsulation type (which could be
WTAP_ENCAP_PER_PACKET, if there's more than one type of packet in the
file, or could be WTAP_ENCAP_UNKNOWN, if the file is of a type that
doesn't put an encapsulation type in the file header, and it has no
packets), we just need to call "wtap_file_encap()" when we're done
reading the file.

svn path=/trunk/; revision=1205
1999-12-04 11:32:25 +00:00
Guy Harris a34c9711f6 Now that "wtap_file_type_string()" takes a file type rather than a "wtap
*" as an argument, there's no need to save the file type string in a
"capture_file" structure - we save the file type, and can use that when
generating the summary display.

svn path=/trunk/; revision=1202
1999-12-04 08:59:13 +00:00
Guy Harris 3af8d95645 More infrastructure changes for Ethereal - make
"wtap_file_type_string()" take, as its argument, a file type, rather
than a "wtap *".

Fix some range checks of file types to check against WTAP_NUM_FILE_TYPES
rather than WTAP_NUM_ENCAP_TYPES.

svn path=/trunk/; revision=1201
1999-12-04 08:51:52 +00:00
Guy Harris c5447af40a When doing a live display of a live capture, don't scroll to the row for
the last packet in the list if there aren't any packets in the list.

svn path=/trunk/; revision=1199
1999-12-04 06:27:03 +00:00
Gilbert Ramirez 8816a59216 Added Florian Lohoff's <flo@rfc822.org> patch to enable Follow TCP
menu item only if a TCP packet is selected.

svn path=/trunk/; revision=1174
1999-12-01 20:12:32 +00:00
Guy Harris 5d25bd8275 There's no need to put a "Could not save to" message in the status bar
if a "File:Save" or "File:Save As" fails - the message box it pops up
when that happens tells you that, it didn't do so before the change to
add the ability to save only the packets currently being displayed, and
putting that message in the status bar hides the normal message telling
you what the current file is (and it's still the current file, if the
save failed).

svn path=/trunk/; revision=1171
1999-11-30 21:30:43 +00:00
Guy Harris dc548e7458 Allow the user to save either all of the current capture, or only the
packets that are currently being displayed from that capture.

Centralize the code to control whether "File:Save" and "File:Save As"
are enabled (and *always* have "File:Save As" enabled if you have a
capture; "File:Save" is enabled only if you have a live capture you've
not yet saved, although it does the same thing as "File:Save As").

Have the "save_file" member of a "capture_file" structure represent
*only* the file currently being *written* to by a capture, and, if there
is no capture currently in progress, have it be NULL; the name of the
file currently being *displayed" is in the "filename" member, and an
"is_tempfile" member indicates whether it's a temporary file for a live
capture or not.

Have "close_cap_file()" delete the current capture file if it's a
temporary capture file that hasn't been saved (in its entirety - saving
selected frames doesn't count).  Do the same (if there *is* a current
capture file) when exiting.

The "Ready to load or capture" message is the only statusbar message in
the "main" context; "close_cap_file()" should never pop it, it should
only pop whatever message exists in the "file" context, and thus has no
need to take, as an argument, the context for the message it should pop.

Update the man page to reflect the new behavior of "File:Save" and
"File:Save As", and to reflect recent changes to "Display:Match Selected".

svn path=/trunk/; revision=1170
1999-11-30 20:50:15 +00:00
Guy Harris 9a3791699c In "Go To Frame", distinguish between "there is no frame with that frame
number" and "there is a frame with that frame number, but it didn't pass
the current display filter".

svn path=/trunk/; revision=1164
1999-11-30 07:27:37 +00:00
Guy Harris e0597caf79 Stuff in "colors.c" largely need work only on a "colfilter", not on a
"capture_file" - when handed a "capture_file *", it only cared about the
"colors" entry.  The only time it cares about a "capture_file" is when
it's actually filtering the packets, as it needs to hand the
"capture_file *" to "colorize_packets()".

Make the stuff exported by "colors.c" in "colors.h" take "colfilter *"
arguments (or return a "colfilter *" to be stuffed into a
"capture_file").

svn path=/trunk/; revision=1162
1999-11-30 05:33:05 +00:00
Guy Harris 150479490c Move the callback for input available on the sync pipe from "file.c" to
"capture.c", along with the other code that deals with the sync pipe.

Close the sync pipe, and get rid of the temporary capture file, on
errors.

Split "tail_cap_file()" into routines to set up to read from the capture
file, to read a specified number of packets from it when told to do so
by the child process, and to read the rest of the capture file and
finish up the capture, to provide the code in "capture.c" the hooks it
needs.

Have a common routine to set the status bar to report the file name and
number of dropped packets, to use both when reading in a capture file in
its entirety all at once and when done with a "read it while the capture
is writing to it" live capture.

svn path=/trunk/; revision=1137
1999-11-29 01:54:01 +00:00
Guy Harris 8bac651320 When a capture completes, the capture file is a temporary file,
regardless of whether we were displaying it in real time or not; if we
were displaying it in real time, activate "File/Save", rather than
"File/Save As", when it finishes.

svn path=/trunk/; revision=1135
1999-11-29 01:40:49 +00:00
Gerald Combs e479d316a7 Change display filter entry widget to a GtkCombo.
Modify filter_packtes to return 1 on success, and 0 on failure.

svn path=/trunk/; revision=1106
1999-11-25 18:02:25 +00:00
Gilbert Ramirez 942b69ce9a A "character encoding" variable is now set per packet. The existence
of SNA in a packet changes the character encoding from the default ASCII
to EBCDIC.

The hex-printing routines in the GUI code and in the printing code convert
to EBCDIC if appropriate.

svn path=/trunk/; revision=1089
1999-11-22 06:24:56 +00:00
Gilbert Ramirez b91d595c77 Change match_selected() to produce a display filter using the selected
field's name, if possible. (If the selected field is not a registered field,
then of course, we still have to use the frame[x:y] syntax).

tree_selected_start and tree_selected_len are on longer globals variables;
finfo_selected has replaced them.

svn path=/trunk/; revision=1070
1999-11-19 22:32:00 +00:00
Guy Harris 4fddc1f328 Provide a general mechanism by which dissectors can register "init"
routines, which are called before a dissection pass is made over all the
packets in a capture - the "init" routine would clear out any state
information that needs to be initialized before such a dissection pass.

Make the NCP, SMB, AFS, and ONC RPC dissectors register their "init"
routines with that mechanism, have the code that reads in a capture file
call the routine that calls all registered "init" routines rather than
calling a wired-in set of "init" routines, and also have the code that
runs a filtering or colorizing pass over all the packets call that
routine, as a filtering or colorizing pass is a dissection pass.

Have the ONC RPC "init" routine zero out the table of RPC calls, so that
it completely erases any state from the previous dissection pass (so
that, for example, if you run a filtering pass, it doesn't mark any
non-duplicate packets as duplicates because it remembers them from the
previous pass).

svn path=/trunk/; revision=1050
1999-11-17 21:58:33 +00:00
Guy Harris 0caff51de0 Add a "Go To Frame" menu item, which lets you go to a frame by frame
number.

svn path=/trunk/; revision=989
1999-11-08 01:03:40 +00:00
Guy Harris f633fe0259 Pop up a message box if a search for a frame fails.
svn path=/trunk/; revision=985
1999-11-06 06:54:24 +00:00
Guy Harris f0889e55c1 Add a "Find Frame" menu item under "Display"; it lets you use a display
filter to search forward or backward in the list of displayed frames for
a matching frame.

When filtering the display, readjust the display to show the "current"
frame if it passed the display filter.  When a file is read in, the
first frame becomes the "current" frame; when a frame is selected, it
becomes the "current" frame, and remains so *even if you unselect it*,
until another frame is selected.

Select the first frame when a file is read in.

Disable most of the "Display" and "Tools" menu items if there's no
current capture file, and enable the relevant ones if there is.

svn path=/trunk/; revision=982
1999-11-06 06:28:07 +00:00
Gilbert Ramirez 558e714449 Add a module to wiretap to be able to read trace files from Toshiba's
line of ISDN routers. Much like the ascend reader, this module reads an
ASCII hex dump of trace data.

Rearranged the order in which wiretap tries trace files, to keep the
ASCII-readers (ascend and toshiba) at the end, and put the binary-readers
(everything else) at the front of the list. If a telnet session of
and ascend trace or toshiba trace were captured near the beginning of
another trace, wiretap might think the trace was ascend or toshiba if it
tried that module first.

Fixed the way wtap_seek_read() selects functions to call. It was using
the encap type instead of the file type. We got lucky because
WTAP_ENCAP_ASCEND == WTAP_FILE_ASCEND

svn path=/trunk/; revision=952
1999-10-31 17:46:11 +00:00
Guy Harris 21c466ed25 Uwe Girlich's ONC RPC and NFS dissectors.
svn path=/trunk/; revision=945
1999-10-29 01:04:44 +00:00
Guy Harris 4df22dcab1 Add in a missing include of "packet-vines.h", to declare
"vines_addr_to_str()".

svn path=/trunk/; revision=916
1999-10-22 08:56:13 +00:00
Guy Harris e30a15f04f Add support for SNA FID type 4 addresses to the code that handles the
"address" type.

Use that in the SNA FID type 4 dissector.

svn path=/trunk/; revision=915
1999-10-22 08:53:41 +00:00
Guy Harris 645acd5c15 Add support for Banyan Vines addresses to the code that handles the
"address" type.

Use that in the Banyan Vines dissector.

svn path=/trunk/; revision=913
1999-10-22 08:30:04 +00:00
Guy Harris 1ff9a0d3e3 Add support for Appletalk DDP addresses to the code that handles the
"address" type.

Use that in the Appletalk DDP dissector.

Show the DDP packet type by name, if it's a known packet type.

svn path=/trunk/; revision=911
1999-10-22 08:11:40 +00:00
Guy Harris 047b8751f3 Generalize the "ip_src" and "ip_dst" members of the "packet_info"
structure to "dl_src"/"dl_dst", "net_src"/"net_dst", and "src"/"dst"
addresses, where an address is an address type, an address length in
bytes, and a pointer to that many bytes.

"dl_{src,dst}" are the link-layer source/destination; "net_{src,dst}"
are the network-layer source/destination; "{src,dst}" are the
source/destination from the highest of those two layers that we have in
the packet.

Add a port type to "packet_info" as well, specifying whether it's a TCP
or UDP port.

Don't set the address and port columns in the dissector functions; just
set the address and port members of the "packet_info" structure.  Set
the columns in "fill_in_columns()"; this means that if we're showing
COL_{DEF,RES,UNRES}_SRC" or "COL_{DEF,RES,UNRES}_DST", we only generate
the string from "src" or "dst", we don't generate a string for the
link-layer address and then overwrite it with a string for the
network-layer address (generating those strings costs CPU).

Add support for "conversations", where a "conversation" is (at present)
a source and destination address and a source and destination port.  (In
the future, we may support "conversations" above the transport layer,
e.g. a TFTP conversation, where the first packet goes from the client to
the TFTP server port, but the reply comes back from a different port,
and all subsequent packets go between the client address/port and the
server address/new port, or an NFS conversation, which might include
lock manager, status monitor, and mount packets, as well as NFS
packets.)

Currently, all we support is a call that takes the source and
destination address/port pairs, looks them up in a hash table, and:

	if nothing is found, creates a new entry in the hash table, and
	assigns it a unique 32-bit conversation ID, and returns that
	conversation ID;

	if an entry is found, returns its conversation ID.

Use that in the SMB and AFS code to keep track of individual SMB or AFS
conversations.  We need to match up requests and replies, as, for
certain replies, the operation code for the request to which it's a
reply doesn't show up in the reply - you have to find the request with a
matching transaction ID.  Transaction IDs are per-conversation, so the
hash table for requests should include a conversation ID and transaction
ID as the key.

This allows SMB and AFS decoders to handle IPv4 or IPv6 addresses
transparently (and should allow the SMB decoder to handle NetBIOS atop
other protocols as well, if the source and destination address and port
values in the "packet_info" structure are set appropriately).

In the "Follow TCP Connection" code, check to make sure that the
addresses are IPv4 addressses; ultimately, that code should be changed
to use the conversation code instead, which will let it handle IPv6
transparently.

svn path=/trunk/; revision=909
1999-10-22 07:18:23 +00:00
Gilbert Ramirez 08292071f4 Added Nathan's patch for AFS and RX dissection.
svn path=/trunk/; revision=894
1999-10-20 16:41:20 +00:00
Guy Harris f3da72ef2f Have "dfilter_compile()" return 0 on success and 1 on failure, and
return the pointer to the compiled filter through a pointer argument.

Have it check whether the filter is a null filter and, if so, free up
the filter and supply a filter pointer, rather than obliging its callers
to check whether the filter actually has any code.  (Well, they may want
to check if the filter is null, so that they don't save a pointer to the
filter text, e.g. so that the display filter displays as "none" rather
than as a blank string in the summary box.)

In the process, fix the check in "gtk/file_dlg.c" that tests whether the
read filter compiled successfully.

svn path=/trunk/; revision=812
1999-10-12 05:01:07 +00:00
Gilbert Ramirez 1efcb7b2cf Re-implemented fix to keep display filter from reading data from outside
the packet boundary. Now the field boundary is honored. The frame boundary
is ignored, but of course we put proper field lengths in the proto_tree,
right? :)

Implemented negative offsets in byte-strings:
	frame[-4:4] will read the last 4 bytes of a frame.

Implemented "offset-only" byte-string comparisons, since the dfilter
compiler knows the length of the byte-string you supplied. These are
now legal:
	frame[-4] == 0.0.0.1
	tr.dst[0] == 00:06:29

Implemented the use of integers if you're comparing one byte. These are
legal:
	llc[0] == 0xaa
	llc[0:1] == 0xaa

All these forms check against the length of the field, so these will be
reported as bad to the user:
	eth.src[5] == 00:06:29      (goes beyond field boundary)
	eth.dst == 1.2.3.4.5.6.7    (too long, goes beyond field boundary)

Thes is also reported as bad:
	eth.dst[0:3] == 1.2          (incorrect number of bytes specified)
	eth.dst[0:1] == eth.src[0:2] (disparate lengths)

I had to add a new function, proto_registrar_get_length() in proto.c, which
reports the length of a field as can be determined at registration time.

There are some shift/reduce errors in the grammar that I need to get rid of.

svn path=/trunk/; revision=811
1999-10-12 04:21:13 +00:00
Gilbert Ramirez c6d6deee3c Fixed bug reported by Laurent regarding byte-string filters not
checking the length of the packet before copying bytes from the packet.

svn path=/trunk/; revision=807
1999-10-11 14:58:04 +00:00
Guy Harris 3b9013d393 When a new display filter is to be applied, don't set "cf.dfilter" or
"cf.dfcode" if the new filter doesn't compile, because the filter
currently in effect will be the one that was last applied - just free up
the text of the new filter, and whatever memory was allocated for the
new filter code.

This means we allocate a new dfilter when a new filter is to be applied,
rather than recycling stuff from the old filter, as we want the old
filter code to remain around if the new filter doesn't compile.

This means that "cf.dfilter" and "cf.dfcode" will be null if there's no
filter in effect.

svn path=/trunk/; revision=803
1999-10-11 06:39:26 +00:00
Richard Sharpe 42b64a7584 Big bunch of fixes to packet-smb.c for things I need.
Also added first pass of state keeping. I am using glib's hash
functions.

Modelled after packet-ncp.c.

We will need to standardize the <proto>_init_protocol functions called in
file.c at some stage ...

I will have a couple of more goes at the state keeping before I am finished.
At the moment, the infrastructure is there but I do nothing with it.

svn path=/trunk/; revision=798
1999-10-10 11:50:45 +00:00
Gilbert Ramirez 03b75d6279 Added Santeri Paavolainen's <santtu@ssh.fi> patch to set default colors
in the color selection wheel.

Added his patch to file.c to look for bogus frame_data pointers, but made
it a g_assert().

Modified my previous patch to colors.c to skip bad color display filters.
I skipped them, but they still appeared in the color dialogue. Now bad
filtes are not put into the color filter list, so they don't appear in
the color dialogue. As a [good] side-effect, the next time you save
your color filter list, the bad filters are removed from the colorfilters
file.

svn path=/trunk/; revision=768
1999-10-05 04:34:00 +00:00
Gilbert Ramirez f93fbc1c89 Added check for <sys/wait.h> #ifdef'ed the SIGSYS block of code, since
some platforms (Linux) don't have SIGSYS. Linux's rationalization is that
SIGSYS is not a POSIX-defined signal.

svn path=/trunk/; revision=743
1999-09-30 16:24:07 +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 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 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
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
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
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 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
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
Guy Harris abd34aca5a Have a progress bar for "File/Print".
svn path=/trunk/; revision=676
1999-09-13 23:45:22 +00:00