Commit Graph

182 Commits

Author SHA1 Message Date
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