Commit Graph

300 Commits

Author SHA1 Message Date
Guy Harris 487d0def6b From Greg Morris: code to support searches for text or raw binary data
in a frame in Find Frame.

svn path=/trunk/; revision=8067
2003-07-22 23:08:48 +00:00
Guy Harris 4906ff281b From Tomas Kukosa: doubling the size of the line buffer when printing
isn't sufficient if the line to be printed is more than twice the
current size of the line buffer.  Make it twice the size of the line to
be printed, instead.

svn path=/trunk/; revision=7921
2003-06-24 06:14:46 +00:00
Guy Harris 55cb7ac8b7 The frame number passed to "goto_frame()" wasn't necessarily explicitly
specified by the user, so if the frame with that frame number isn't
being displayed, just refer to it as "That frame", not "The frame with
that frame number".  (That's even OK if they *did* specify it.)

(If there's no such frame, that "shouldn't happen" in cases where it was
implicitly specified, e.g. by getting it from a list of fragments, or a
"{request,reply} is in frame XXX" field, or clicking on a point in a TCP
graph.)

svn path=/trunk/; revision=7258
2003-03-02 22:37:03 +00:00
Guy Harris 6c9deead35 Have "goto_frame()" put up error dialog boxes itself, rather than having
its callers put up the same error dialog boxes.  Have it just return a
success vs. failure Boolean.

svn path=/trunk/; revision=7254
2003-03-02 22:07:25 +00:00
Guy Harris 25c3ac74fb The previous change caused the delta time to be the delta between a
frame and the previous frame in the capture - a frame that might not be
displayed, so you don't know what it was - rather than the previous
frame in the display, as is intended.  Fix that.

svn path=/trunk/; revision=6708
2002-12-01 20:19:44 +00:00
Ronnie Sahlberg 56e511657d calculate delta and rel time earlier and unconditionally of whether the packet passed the displayfilter or not.
there may be tap listeners that want to examine this field.

svn path=/trunk/; revision=6702
2002-11-29 11:02:13 +00:00
Guy Harris 96ba49f6ce From Tomas Kukosa: adjust the pointer into the line buffer if the line
buffer gets reallocated.

svn path=/trunk/; revision=6665
2002-11-23 03:19:39 +00:00
Guy Harris 79308de612 From Ronnie Sahlberg: don't have the tap code do a dissection, leave
that up to its callers, so only one dissection need be done when reading
a capture file.

svn path=/trunk/; revision=6442
2002-10-17 02:11:20 +00:00
Olivier Abad ec3cb87a27 Another problem found by valgrind :
in continue_tail_cap_file, the following test :
else if (*err != 0)
sometimes reads uninitialized memory (so the test might be incorrect).

We now set *err to 0 at the beginning of the function.

svn path=/trunk/; revision=6418
2002-10-14 19:59:51 +00:00
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