Commit Graph

310 Commits

Author SHA1 Message Date
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 92915713d3 Allow a length of -1 to be specified when adding FT_NONE and FT_PROTOCOL
items to the protocol tree; it's interpreted as "the rest of the data in
the tvbuff".  This can be used if

	1) the item covers the entire packet or the remaining payload in
	   the packet

or

	2) the item's length won't be known until it's dissected, and
	   will be then set with "proto_item_set_len()" - if an
	   exception is thrown in the dissection, it means the item ran
	   *past* the end of the tvbuff, so saying it runs to the end of
	   the tvbuff is reasonable.

Convert a number of "proto_tree_add_XXX()" calls using
"tvb_length_remaining()", values derived from the result of
"tvb_length()", or 0 (in the case of items whose length is unknown) to
use -1 instead (using 0 means that if an exception is thrown, selecting
the item highlights nothing; using -1 means it highlights all the data
for that item that's available).

In some places where "tvb_length()" or "tvb_length_remaining()" was used
to determine how large a packet is, use "tvb_reported_length()" or
"tvb_reported_length_remaining()", instead - the first two calls
indicate how much captured data was in the packet, the latter two calls
indicate how large the packet actually was (and the fact that using the
latter could cause BoundsError exceptions to be thrown is a feature - if
such an exception is thrown, the frame really *was* short, and it should
be tagged as such).

Replace some "proto_tree_add_XXX()" calls with equivalent
"proto_tree_add_item()" calls.

Fix some indentation.

svn path=/trunk/; revision=4578
2002-01-20 22:12:39 +00:00
Guy Harris fb1e26fe6a Use the "fragmented" field of the "packet_info" structure in
"dissect_frame()" to indicate whether a ReportedBoundsError was due to
the packet being malformed (i.e., the packet was shorter than it's
supposed to be, so the dissector went past the end trying to extract
fields that were supposed to be there) or due to it not being
reassembled (i.e., the packet was fragmented, and we didn't reassemble
it, but just treated the first fragment as the entire packet, so the
dissector went past the end trying to extract fields that were partially
or completely in fragments after that).  Mark the latter as being
unreasembled rather than malformed.

Properly initialize, save, and restore that field, and properly set it,
so that works.

svn path=/trunk/; revision=4555
2002-01-17 06:29:20 +00:00
Guy Harris 0a03b0f73e Add a preferences page for the name resolution flags.
Separate the preferences value for those flags and the name resolution
code's value into separate variables; this means that the resolution
code no longer depends on the preferences code, and may let us
eventually have the current setting and the preference setting differ
(so that a user can temporarily override the preference setting without
causing subsequent saves of the preferences to save the temporary
value).

Add routines to create various types of widgets for preferences, and to
fetch the values for "enumerated" preferences, and use them both in the
code to handle hardwired preference pages and table-driven preference
pages.

svn path=/trunk/; revision=4536
2002-01-13 20:35:12 +00:00
Guy Harris 30a043931e From Jirka Novak:
Support for generating filter expressions based on packet list
	    column values
	Support for adding filter expressions generated from column or
	    protocol tree field values to the current expression rather
	    than replacing the current expression

svn path=/trunk/; revision=4522
2002-01-11 08:21:02 +00:00
Guy Harris e35851244c Clean up white space.
svn path=/trunk/; revision=4492
2002-01-07 01:05:33 +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 e0593df4a7 If the "parent directory" of what would be the personal configuration
file directory is just a drive letter (e.g., if the directory is
"c:\Ethereal"), don't "stat()" it to see if it exists (as that'll fail,
falsely leading us to believe it needs to be created; the attempt to do
so will fail), just assume it exists.

svn path=/trunk/; revision=4482
2002-01-04 21:50:26 +00:00
Guy Harris cb489a92bb From Hamish Moffatt:
Additional Windows Makefile dependencies, so more stuff gets
	built as needed.

	Additional stuff cleaned up by "make clean" (well, "nmake -f
	makefile.nmake clean", anyway)

	Make PDB_FILE be "vc*.pdb", so it referes to the PDB files
	either for VC++ 5.0 or VC++ 6.0.

svn path=/trunk/; revision=4481
2002-01-04 21:20:20 +00:00
Guy Harris a94eccb20c Fix up white space.
svn path=/trunk/; revision=4478
2002-01-04 08:57:09 +00:00
Guy Harris 7494218b47 "proto_tree_is_visible" no longer exists as a global variable, so remove
its declaration.

svn path=/trunk/; revision=4477
2002-01-04 08:56:11 +00:00
Gilbert Ramirez a2251afaff Throw a BoundsError if a length parameter in a tvbuff-accessor is < -1.
svn path=/trunk/; revision=4474
2002-01-04 06:45:14 +00:00
Guy Harris 378bcd4198 Correctly handle the nanoseconds fields in strings representing absolute
and relative times - "0.4" is 400,000,000 nanoseconds, not 4
nanoseconds.

svn path=/trunk/; revision=4458
2001-12-28 21:30:34 +00:00
Gerald Combs 2701bbc077 Bump the version up to 0.9.0. Update the NEWS file.
svn path=/trunk/; revision=4440
2001-12-23 21:11:24 +00:00
Guy Harris ec46daf88b Work around Windows' annoying decision to map 0.0.0.0 to the local host
name in "gethostbyaddr()".

svn path=/trunk/; revision=4433
2001-12-20 19:19:41 +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
Gilbert Ramirez f7b8847a38 Plug a really bad memory leak. The GPtrArrays of field_info's that
are created for every tested field for every tested packet during
a dfilter run were not being destroyed.

svn path=/trunk/; revision=4393
2001-12-13 05:55:23 +00:00
Guy Harris 8bae6e2e3d From Motonori Shindo: add "*.pdb" to the ".cvsignore" files in
directories in which PDB files are generated and in which it wasn't
already present.

svn path=/trunk/; revision=4386
2001-12-12 01:39:44 +00:00
Guy Harris 39362af814 From Motonori Shindo:
fix a bogus batch mode inference rule of make, so that
	"vc60.pdb" files are created in the proper directory;

	delete ".pdb" files in a "nmake -f Makefile.nmake clean";

	include the text2pcap and mergecap ".pdb" files in the Windows
	binary distribution.

svn path=/trunk/; revision=4385
2001-12-12 01:29:13 +00:00
Guy Harris 0fab2ae6d5 Remove some extra blank lines.
svn path=/trunk/; revision=4374
2001-12-10 02:16:59 +00:00
Guy Harris 0823c63775 The packet length is an unsigned quantity; print it with "%u".
If we get an illegal column type in "fill_in_columns()", crash.

svn path=/trunk/; revision=4373
2001-12-10 02:15:54 +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
Guy Harris c6ac943216 Clean up indentation.
svn path=/trunk/; revision=4362
2001-12-08 21:03:41 +00:00
Guy Harris 75cc056222 Attach a descriptive name field type and base to dissector tables; that
specifies how the selector values used as keys in those tables are to be
displayed, and the title to use when displaying the table.

Use that information in the code to display the initial and current
entries of various dissector tables.

Have the dissector for BACnet APDUs register itself by name, and have
the BACnet NPDU dissector call it iff the BAC_CONTROL_NET bit isn't set,
rather than doing it with a dissector table.

svn path=/trunk/; revision=4358
2001-12-08 06:41:48 +00:00
Guy Harris f85f8bf466 Use "-no-cpp-precomp" rather than "-traditional-cpp" on MacOS X, as per
the "The Compiler and Tools" section on

	http://fink.sourceforge.net/doc/porting/basics.php

Do so on MacOS X regardless of whether the compiler is called "gcc" or
not, as that page also indicates that the compiler is installed as "cc".

svn path=/trunk/; revision=4354
2001-12-07 22:56:58 +00:00
Gilbert Ramirez f1b64de80e Dfilter code finds field under *any* parent's subtree, not just
the parent under which the field was registered.

This is the *unoptimized* version, to give developers something
to use while the optimized version is being created.

svn path=/trunk/; revision=4351
2001-12-07 03:39:26 +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 7c0dc64096 Remove the no-longer-extant "conv_dissector_add()" from the list of
plugin APIs, and add the new "dissector_add_handle()".

Add an entry in the dissector table structure for
"create_dissector_handle".

svn path=/trunk/; revision=4314
2001-12-03 10:00:23 +00:00
Guy Harris 57d6683446 A "dissector_table_t" is no longer a pointer to a hash table, it's a
pointer to a "struct dissector_table", containing a pointer to a hash
table and a pointer to a list of handles.  Fix
"dissector_all_tables_foreach_func()" to understand that.

svn path=/trunk/; revision=4312
2001-12-03 09:00:25 +00:00
Guy Harris c22d3fdc96 Get rid of the lists of conversation dissectors; instead, have a
dissector table contain both a hash table, to use to look up port
numbers to find a dissector, and a list of all dissectors that *could*
be assigned to ports in that hash table, to be used by user interface
code.

Make the "Decode As" dialog box code use that.

Also make it *not* let you choose whether to set the dissector for both
the UDP and TCP versions of a port; some protocols run only atop TCP,
some run only atop UDP, and even those that can run atop both may have
different dissector handles to use over TCP and UDP, so handling a
single merged list would be a mess.  (If the user is setting the
dissector for a TCP port, only those protocols that Ethereal can handle
over TCP should be listed; if the user is setting the dissector for a
UDP port, only those protocols that Ethereal can handle over TCP should
be listed; if the user is setting a dissector for both, only those
protocols that Ethereal can handle over *both* TCP *and* UDP should be
listed, *and* there needs to be a way to let the "Decode As" code get
both the TCP handle *and* the UDP handle and use the right ones.  If
somebody really wants that, they need to implement all of the above if
they want the code to be correct.)

Fix the code that handles setting the dissection for the IP protocol
number to correctly update the lists of protocols being dissected as TCP
and as UDP; the code before this change wasn't updating the single such
list to add new protocols.

svn path=/trunk/; revision=4311
2001-12-03 08:47:31 +00:00
Guy Harris 21b9a88b29 Add a routine tro look for a given port in a given dissector table and,
if found, return the dissector handle for that port.

Use that routine in the X.25 dissector; revert to attaching a dissector
handle to an X.25 virtual circuit.

svn path=/trunk/; revision=4310
2001-12-03 05:07:18 +00:00
Guy Harris bced8711f6 Make "dissector_add()", "dissector_delete()", and "dissector_change()"
take a dissector handle as an argument, rather than a pointer to a
dissector function and a protocol ID.  Associate dissector handles with
dissector table entries.

svn path=/trunk/; revision=4308
2001-12-03 04:00:26 +00:00
Guy Harris 44a02e37c6 Rename another routine to get rid of an unnecessary "1" in its name.
svn path=/trunk/; revision=4305
2001-12-03 01:35:22 +00:00
Guy Harris bf827fb28b Don't bother saving or restoring "can_desegment" until you actually call
a subdissector.

svn path=/trunk/; revision=4304
2001-12-03 01:26:30 +00:00
Guy Harris 95490bb044 Rename and re-comment some routines to make it clearer what they do.
svn path=/trunk/; revision=4303
2001-12-03 01:20:51 +00:00
Guy Harris 3396fb2777 Update from Ronnie Sahlberg:
1.  Changes how can_desegment works so that can_desegment is
	    only != 0 for whichever dissector is running immediately on
	    top of whoever offers the can_desegment service.

	    Thus DCERPC needs no special handling to see if it can trust
	    can_desegment (which is currently only available ontop of TCP
	    and not ontop of tcp->nbss->smb).

	2.  Changes fragment reassembly of transaction smb to only show
	    the defragmented packet for the transaction smb holding the
	    first fragment.

	    To see why, test it with a transaction SMB containing a ~60kb
	    PDU or larger.  The old behaviour had approximately quadratic
	    behaviour regarding runtime for dissecting such PDUs.

	    (example: NetShareEnum is a command which can grow really really
	    large if the number of shares and comments are large)

svn path=/trunk/; revision=4296
2001-11-29 09:05:25 +00:00
Guy Harris 07b2709f8a Change "conversation_set_dissector()" to take a dissector handle, rather
than a pointer to a dissector function, as an argument.

This means that the conversation dissector is called through
"call_dissector()", so the dissector itself doesn't have to worry about
checking whether the protocol is enabled or setting
"pinfo->current_proto", so get rid of the code that does that in
conversation dissectors.  Also, make the conversation dissectors static.

Get rid of some direct calls to dissectors; replace them with calls
through handles, and, again, get rid of code to check whether a protocol
is enabled and set "pinfo->current_proto" where that code isn't needed.
Make those dissectors static if they aren't already static.

Add a routine "create_dissector_handle()" to create a dissector handle
without registering it by name, if the dissector isn't used outside the
module in which it's defined.

svn path=/trunk/; revision=4281
2001-11-27 07:13:32 +00:00
Ed Warnicke 89babba223 This should be the final bit of removing the dissect_data symbol
from being required by anyone other than packet-data.c.
It can now be accessed with call_dissector() with the name "data".
dissect_data is now also of dissect_t.

svn path=/trunk/; revision=4271
2001-11-26 05:41:15 +00:00
Ed Warnicke 4877553530 Switched from using CHECK_DISPLAY_AS_DATA to using CHECK_DISPLAY_AS_X
which also takes a handle as an argument and thus doesn't call
dissect_data directly.

svn path=/trunk/; revision=4270
2001-11-26 05:13:14 +00:00
Guy Harris e6f82792a9 Update the Makefile.nmake files to reflect the move of "int-64bit.c" to
the "epan" subdirectory.

Include "strptime.obj" in the list of object files used to build
"text2pcap.exe".

svn path=/trunk/; revision=4258
2001-11-24 21:51:40 +00:00
Ed Warnicke b7420272e7 Moved int-64bit.{c,h} into epan/
svn path=/trunk/; revision=4248
2001-11-22 03:07:07 +00:00
Gilbert Ramirez a07ec65cce Remove the pointer to the global packet_info from the table of
pointers used for plugins on win32.

svn path=/trunk/; revision=4247
2001-11-21 23:34:09 +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 6f776aa40d Get rid of some unused variables.
svn path=/trunk/; revision=4239
2001-11-21 01:02:03 +00:00
Guy Harris ecaca4b768 Fix an earlier typo of mine.
svn path=/trunk/; revision=4238
2001-11-21 01:01:17 +00:00
Guy Harris 0d7f3e614f Get rid of "tvb_compat()"; it's no longer needed (the one remaining call
to it returns data that's no longer used).

svn path=/trunk/; revision=4237
2001-11-20 22:46:12 +00:00
Guy Harris 2f10c7f630 Get rid of the "len" and "captured_len" members of the "packet_info"
structure; they're no longer used.

svn path=/trunk/; revision=4236
2001-11-20 22:29:07 +00:00
Guy Harris e8d4f4f0ac Make the capture routines take an additional argument giving the amount
of packet data captured.

Make the "BYTES_ARE_IN_FRAME()" macro take a "captured length of the
packet" argument.

Add some length checks to capture routines.

svn path=/trunk/; revision=4235
2001-11-20 21:59:18 +00:00
Guy Harris 62490b8fdb "END_OF_FRAME" and "IS_DATA_IN_FRAME()" are no longer used; get rid of
them.

svn path=/trunk/; revision=4234
2001-11-20 20:57:10 +00:00