Commit Graph

248 Commits

Author SHA1 Message Date
Stig Bjørlykke 6f1b59c130 Fix a prototype to avoid a warning.
svn path=/trunk/; revision=26659
2008-10-31 18:44:46 +00:00
Anders Broman 3eadb385c3 From Alexey Neyman:
Implement dissector for IPMB (DLT_IPMB_LINUX, 209).

svn path=/trunk/; revision=25986
2008-08-12 04:44:35 +00:00
Bill Meier 59d2c9eb92 boolean -> gboolean
svn path=/trunk/; revision=25344
2008-05-21 16:56:50 +00:00
Bill Meier ad761ed3fd Add missing have_postdissector(); (Hopefully what was intended).
svn path=/trunk/; revision=25342
2008-05-21 16:40:15 +00:00
Guy Harris 31cae6e4ef Require GLib 2.4 or later.
That means that G_GINT64_MODIFIER will be defined, so don't check
whether it's defined.

We don't use the PRI[douxX]64 macros, as we use the GLib print routines
and thus use G_GINT64_MODIFIER instead.  Get rid of the checks for
whether inttypes.h defines PRI[douxX]64; just check whether it exists at
all.

That means we don't set INTTYPES_H_DEFINES_FORMATS, so don't check for
it.

svn path=/trunk/; revision=25243
2008-05-05 22:47:32 +00:00
Luis Ontanon 7475efa0f6 from: Mike Duigou
Adds a heur_dissector_delete() function to allow heuristic dissectors to be
dynamically disabled based upon, for example, preference settings.

http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1697


svn path=/trunk/; revision=22463
2007-08-07 21:26:07 +00:00
Guy Harris 1bc049906a Add some GCC warnings to the standard set, and add some others to the
--enable-extra-gcc-checks set.

If we turn on -pedantic, try turning on -Wno-long-long as well, so that
it's not *so* pedantic that it rejects the 64-bit integral data types
that we explicitly require.

Constify a bunch of stuff, and make some other changes, to get rid of
warnings.

Clean up some indentation.

svn path=/trunk/; revision=21526
2007-04-23 10:59:26 +00:00
Guy Harris 0fb0fa8794 Put
#ifdef __cplusplus
	extern "C" {
	#endif /* __cplusplus */

		...

	#ifdef __cplusplus
	}
	#endif /* __cplusplus */

wrappers into some header files, for the benefit of C++ plugins.  Also,
add multiple-include protections.

svn path=/trunk/; revision=20485
2007-01-18 18:43:30 +00:00
Jaap Keuter f8422ab7db Extending true_false_string support
- Separate tfs.[ch]
- Add larger sample collection
- Properly export DATA

svn path=/trunk/; revision=20373
2007-01-10 07:47:00 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Luis Ontanon 1ff8c4272f Add register_postdissector() to the API.
Dissectors registered with register_postdissector() will be called after all other dissectors have been called.

Use it to register mate.


svn path=/trunk/; revision=17089
2006-01-24 00:26:57 +00:00
Guy Harris b8bb6b495c Squelch more const pointer warnings.
svn path=/trunk/; revision=15242
2005-08-06 10:31:27 +00:00
Jörg Mayer 4e1f4b18ab More char -> const char warning fixes.
Removed (very few) casts that only change the warning message
  but don't remove it (with gcc-4).

svn path=/trunk/; revision=15227
2005-08-05 20:59:08 +00:00
Guy Harris 554f620001 Constify to remove a bunch of warnings. Add some casts to squelch
(presumably-)harmless-but-otherwise-unremovable const-to-nonconst
warnings.

In the TACACS dissector, clean up the variables used in option parsing
to avoid some const-to-nonconst warnings.

Clean up some white space.

svn path=/trunk/; revision=15043
2005-07-24 19:01:28 +00:00
Jörg Mayer 30a8557868 More 'char*' -> 'const char*' changes to fix warnings.
svn path=/trunk/; revision=15015
2005-07-23 11:41:25 +00:00
Jörg Mayer 39fe3f0ba3 Warning fix: Declare some more strings const
svn path=/trunk/; revision=14700
2005-06-19 15:16:30 +00:00
Anders Broman f01b2b6197 From Mike Duigou:
A few doxygen updates and an improved section on 
writing dissectors that don't use tcp_dissect_pdus().

svn path=/trunk/; revision=14537
2005-06-03 06:35:44 +00:00
Ronnie Sahlberg fcab322ada Some applications do very naughty things like reusing a port for a different protocol during different stages of an application cycle.
This is very naughty and will cause problems when we have assigned a dissector to a dynamic port using conversation_set_dissector().


To make ethereal handle this case I have changed the try_conversation_dissector() to allow it to fail and return 0,   meaning   yes there is indeed a protocol registered for this conversation but that protocol rejected this packet.
(which only happens for "new" style dissectors, "old" style dissectors will never reject a packet that way)

When this happens  the decode_udp_port() helper will still allow other dissectors to be tried, in the hope that the conversation is now used for some other protocol and thus someone else might be able to decode the packet.


Update SNMP and TFTP dissectors to  check that even if there already is a conversation but that conversation does NOT have snmp/tftp registered as the dissector for it, then create a new conversation anyway and attach the proper dissector.

Since ethereal keeps track of which frame number a conversation started in, this actually works really well.



svn path=/trunk/; revision=14345
2005-05-11 10:40:53 +00:00
Guy Harris d53df176c1 Add a "cleanup_dissection()" routine, intended to free up data
structures allocated by a dissection.  Currently, it's the same as
"init_dissection()", but they should be split with "init_dissection()"
allocating the initial data structures and "cleanup_dissection()"
freeing them and *not* reallocating the initial data structures.

Use "cleanup_dissection()" in "cf_close()" to make it easier to find leaks.

svn path=/trunk/; revision=13881
2005-03-23 12:58:59 +00:00
Jörg Mayer bbba7523e7 warning: function declaration isn't a prototype
svn path=/trunk/; revision=13728
2005-03-12 07:37:14 +00:00
Ulf Lamping e378098855 from Micheal Duigou: add some doxygen tags and some changes to README.developer
svn path=/trunk/; revision=13725
2005-03-11 21:14:38 +00:00
Gerald Combs 76ba06d767 Add a "-G decodes" option to ethereal and tethereal which shows the
filter/selector/protocol associations for each dissector.  This will be
used to improve our automated tests, but someone with time on their 
hands could probably use it to generate a protocol poster using Graphviz.

svn path=/trunk/; revision=13721
2005-03-11 16:17:41 +00:00
Ulf Lamping 7445ecfd05 split capture_loop from capture.c, some more code cleanup
svn path=/trunk/; revision=12451
2004-10-30 17:50:51 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Guy Harris 7002776572 Pick up the stuff I did for tcpdump to figure out the right strings to
use to format 64-bit integers.

Fix the RSVP dissector to use that rather than hardcoding "%ll" in.

Remove the "only if G_HAVE_GINT64 is defined" bit from the discussion of
64-bit integers - we're too dependent on having them to support
compilers that don't have a 64-bit integral data type.  Do, however,
note that neither "long" nor "long long" are acceptable, and also note
that you shouldn't assume "%ll" does the trick for printing them.

svn path=/trunk/; revision=11182
2004-06-19 00:07:23 +00:00
Ulf Lamping 6aba0658ee add details for doxygen
svn path=/trunk/; revision=11127
2004-06-08 05:42:57 +00:00
Guy Harris be2736adcf Have a pseudo-header for Ethernet packets, giving the size of the FCS -
0 means "there is no FCS in the packet data", 4 means "there is an FCS
in the packet data", -1 means "I don't know whether there's an FCS in
the packet data, guess based on the packet size".

Assume that Ethernet encapsulated inside other protocols has no FCS, by
having the "eth" dissector assume that (and not check for an Ethernet
pseudo-header).

Have "ethertype()" take an argument giving the FCS size; pass 0 when
appropriate.

Fix up Wiretap routines to set the pseudo-header.  This means we no
longer use the "generic" seek-and-read routine, so get rid of it.

svn path=/trunk/; revision=8574
2003-10-01 07:11:49 +00:00
Guy Harris 92fbca527d Add "dissector_get_string_handle()" for string dissector tables, similar
to "dissector_get_port_handle()" for uint dissector tables.

svn path=/trunk/; revision=8434
2003-09-09 18:09:42 +00:00
Guy Harris f6c0519c0a Support string dissector tables in the Tethereal "decode as" stuff.
Make the Ethereal "decode as" stuff not blow up with string dissector
tables.

Selectors for uint dissector tables are unsigned, not signed.

svn path=/trunk/; revision=8408
2003-09-07 00:47:57 +00:00
Guy Harris c26004150b When registering a dissector table, choose what type of hash and
comparison function to use based on the type value passed in.  For the
traditional unsigned integer table, require FT_UINT{8,16,24,32}; if the
type is FT_STRING or FT_STRINGZ, use the string hashing functions
instead.

Add routines for manipulating entries and looking up dissectors in
string dissector tables.

svn path=/trunk/; revision=8407
2003-09-06 23:37:02 +00:00
Guy Harris c9abf6ddec From Tomas Kukosa: add "find_dissector_table()",
"dissector_get_port_handle()", "dissector_handle_get_short_name()",
"dissector_handle_get_protocol_index()", "new_register_dissector()", and
"new_create_dissector_handle()" to the list of APIs available to
plugins on platforms where plugins have to call core Ethereal routines
through pointers.

"extern"alize the remaining routines in "epan/packet.h".

svn path=/trunk/; revision=8116
2003-07-31 18:34:52 +00:00
Guy Harris f2233623ea From Lionel Ains: "-d" flag for decode-as support in Tethereal.
Add a new routine to iterate through all dissector tables, calling a
routine for each table, to support having the "-d" code list all
dissector tables.

Get rid of "dissector_handle_get_dissector_name()"; it was put in there
for "-d", but turns out not to be necessary for that.

Clean up the usage message a bit (using the convention, adhered to by at
least some UNIX utilities, of listing all the flags with no arguments in
a single lump, and then listing the ones with arguments individually,
and also putting "-v" and "-h" in a separate lump, as Ethereal does).

svn path=/trunk/; revision=7788
2003-06-05 04:47:58 +00:00
Guy Harris f94c7971a5 Add an API to get the dissector name from a dissector handle.
svn path=/trunk/; revision=7726
2003-05-23 22:09:36 +00:00
Guy Harris 1c81a6168b From Chris Waters: export "find_dissector_table()" and add
"dissector_handle_get_protocol_index()".

svn path=/trunk/; revision=6633
2002-11-15 03:10:36 +00:00
Guy Harris 8ee4a65f76 From Solomon Peachy: support for new "wlancap" 802.11 extra-information
header.

Add overflow checks to "BYTES_ARE_IN_FRAME()", and cast all arguments to
unsigned values (negative values should never be passed) to squelch
compiler warnings.

svn path=/trunk/; revision=6567
2002-11-06 21:49:34 +00:00
Guy Harris daa0dd9f1a Count ICMPv6 packets as ICMP when capturing.
Check the next header type - properly handling extension headers - in
"capture_ipv6()".

Get rid of the count of IPv6 packets - we break that down in
"capture_ipv6()" now.

Fix a typo.

svn path=/trunk/; revision=6510
2002-10-25 23:23:28 +00:00
Jörg Mayer 40e1ec7fad Minimalistic support for counting IPv6 packets during capture
svn path=/trunk/; revision=6476
2002-10-22 22:04:23 +00:00
Guy Harris 63d65a3f69 From Ulf Lamping: count ARP packets in capture progress dialog box.
svn path=/trunk/; revision=6416
2002-10-14 17:33:50 +00:00
Jörg Mayer 48be4e530d 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=6116
2002-08-28 20:41:00 +00:00
Tim Potter 60e4ca9c4f Moved the generic true_false_string saying "Set", "Not set" into
epan/packet.c

It was cut and pasted into seven other dissectors!

svn path=/trunk/; revision=6052
2002-08-21 21:25:23 +00:00
Jörg Mayer 3105ee542f Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the epan/ directory but leave winsock2.h in inet_pton.c
and inet_ntop.c for now (can't estimate the consequences).

svn path=/trunk/; revision=5928
2002-08-02 21:29:45 +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
Gilbert Ramirez 41cc7f0707 Merge the work in Novell_NCP_branch into the mainline code.
A little work still needs to be done on the new NCP dissector -- make
some of the COL_INFO texts more useful, handle a Unicode issue, and
modify some of the cases that use "request conditions".
But the NCP dissector as it stands is very usable now.

Note: I didn't merge in the PROTO_LENGTH_UNTIL_END macro... I wanted
to think about the various possible macros and review an email conversation
I had with Guy on the subject.

svn path=/trunk/; revision=5432
2002-05-09 23:50:34 +00:00
Guy Harris db119f15d4 Add routines to create anonymous handles for new-style dissectors (ones
that return an "int", giving either an indication of how much data was
dissected, an indication of how much more data is needed from TCP to
dissect, or 0, meaning "this isn't one of my packets").

svn path=/trunk/; revision=5260
2002-04-28 00:13:05 +00:00
Guy Harris 193b8c9bfb Allow dissectors to be registered as "old-style" or "new-style"
dissectors.  "Old-style" dissectors return nothing.  "New-style"
dissectors return one of:

	a positive integer, giving the number of bytes worth of data in
	the tvbuff that it considered to be part of the PDU in the
	tvbuff;

	zero, if it didn't consider the data in the tvbuff to be a PDU
	for its protocol;

	a negative integer, giving the number of additional bytes worth
	of data in needs to get the complete PDU (for use with
	fragmentation/segmentation when the length of the PDU isn't
	known to the protocol atop the one the dissector is dissecting).

Have "call_dissector()" return the return value of new-style dissectors,
and the length of the tvbuff handed to it for old-style dissectors.

Have "dissector_try_port()" return FALSE if the subdissector is a
new-style dissector and returned 0.

Make the EAP dissector a new-style dissector, and have a "EAP fragment"
dissector that is also a new-style dissector and handles fragmentation
of EAP messages (as happens above, for example, RADIUS).  Also, clean up
some signed vs. unsigned comparison problems.

Reassemble EAP-Message AVPs in RADIUS.

svn path=/trunk/; revision=4811
2002-02-26 11:55:39 +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 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 d92a1cd8e1 With the tvbuffication of all dissectors, the "packet_info" structure no
longer contains length fields, so there's no need to pass a "packet_info
*" argument to "set_actual_length()".

svn path=/trunk/; revision=4748
2002-02-17 00:51:21 +00:00
Guy Harris dbf2eebd5c Old-style (non-tvbuffified) dissectors haven't been supported since
0.9.0 was released; get rid of the typedef for "old_dissector_t".

svn path=/trunk/; revision=4703
2002-02-06 22:19:04 +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
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 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 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 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 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
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 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
Guy Harris 4b0bce7f97 Put "extern" in front of a pile of function declarations.
It makes no difference if they really are function declarations;
however, in plugins, when building on OSes that don't let
dynamically-loaded modules access functions in the main program (e.g.,
Windows), when compiling a plugin, <plugin_api.h> defines the names of
those functions as (*pointer_name), so they turn into declarations of
pointer variables pointing to the functions in question, and, on
platforms with a def/ref model in the linker, if a plugin has more than
one source file that gets linked into the plugin, the linker may get
upset at two definitions of the same variable.

svn path=/trunk/; revision=4114
2001-10-31 07:47:27 +00:00
Guy Harris dffa2a989a Get rid of a bunch of stuff that was there to support non-tvbuffified
dissectors and that's no longer needed.

svn path=/trunk/; revision=4112
2001-10-31 05:59:20 +00:00
Guy Harris 556a11ad45 Create a routine to do the tvbuff-length-adjusting and
"pinfo->{len,captured_len}"-adjusting currently done by the IP
dissector, make the IP dissector call that rather than doing the work
itself, make the IPv6 dissector call that rather than just adjusting the
tvbuff length itself, and make the IPX dissector call that rather than
just adjusting "pi.{len,captured_len}" itself.

This cleans things up a bit, and causes trailers to be properly reported
in IPX-over-Ethernet frames.

svn path=/trunk/; revision=3621
2001-06-29 09:46:54 +00:00
Guy Harris 048625f419 "old_dissector_delete()" is no longer used; remove it.
Update Gerald's e-mail address.

svn path=/trunk/; revision=3506
2001-06-02 08:23:10 +00:00
Guy Harris cc6b18e6ab No old-style dissectors call "old_dissector_try_port()", so get rid of
"old_dissector_try_port()".

There are no longer any old-style heuristic or conversation dissectors,
so get rid of "old_heur_dissector_add()" and "old_conv_dissector_add()"
and the data-structure members that support old-style heuristic and
conversation dissectors.

svn path=/trunk/; revision=3478
2001-05-30 06:41:08 +00:00
Guy Harris 2aa31bea47 Move the declaration of "etype_vals[]" from "epan/packet.h" to
"etypes.h".

svn path=/trunk/; revision=3314
2001-04-17 06:43:21 +00:00
Guy Harris c5aaac7823 Move the declaration of "ipprotostr()" out of "epan/packet.h" into a new
"ipproto.h" header file.

svn path=/trunk/; revision=3313
2001-04-17 06:29:14 +00:00
Ed Warnicke cd6ad9d4c0 Moved the the remaining column related routines out of packet.{c,h}
and into column-utils{c,h}.

svn path=/trunk/; revision=3231
2001-04-01 07:32:35 +00:00
Ed Warnicke dd54ba9396 Moved the packet_info structure and supporting functions out of
packet.{h,c} and into a separate packet_info{h,c}.

svn path=/trunk/; revision=3225
2001-04-01 04:50:42 +00:00
Ed Warnicke 20eee44b70 Moved the frame_data structures and functions from packet.{h,c} to
frame_data{h,c}.  Added a frame_data_init to be called by epan_init.

svn path=/trunk/; revision=3223
2001-04-01 04:11:51 +00:00
Ed Warnicke 5d0c213448 Moved the column_info structure and related enum from packet.{c,h} to
column_info.h.

svn path=/trunk/; revision=3222
2001-04-01 03:42:00 +00:00
Ed Warnicke c832ac2c35 Moved the value_string structures and function from packet.{c,h} into
a separate value_string.{c,h}.

svn path=/trunk/; revision=3221
2001-04-01 03:18:41 +00:00
Ed Warnicke c17e3b00c6 Moved various to_str files from packet.{c,h} to a separate
to_str.{c,h}.  Resolved strange situation where ipx_addr_to_str was
declared in packet.h but defined in packet-ipx.c by moving
ipx_addr_to_str, ipxnet_to_str_punct, and ipxnet_to_str from packet-ipx.{c,h}   to to_str.{c,h}

svn path=/trunk/; revision=3219
2001-04-01 02:47:56 +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 a9659200c1 Add a new AT_OSI address type.
In the CLNP dissector, set the source and destination network-layer and
"top-level" addresses; this will cause them to show up in the source and
destination columns of the summary display if you're showing the
network-layer or top-level address (although you'll probably have to
widen those columns significantly to see the entire address), and also
makes them available to subdissectors.

svn path=/trunk/; revision=3131
2001-03-15 06:41:13 +00:00
Guy Harris a954a9d276 Fix up the handling of NBIPX packets, and of Microsoft "direct hosting"
name-server-over-IPX and mailslot-datagram-over-IPX packets, based on
stuff dredged out of a pile of documents on the Web.

svn path=/trunk/; revision=3079
2001-02-27 07:28:48 +00:00
Guy Harris 8b51643203 "Decode As" dialog, from David Hampton.
svn path=/trunk/; revision=2965
2001-02-01 07:34:33 +00:00
Guy Harris 18bfc670ec Pull the handling of trailers in Ethernet (as opposed to 802.3) frames
into "ethertype()".

svn path=/trunk/; revision=2915
2001-01-18 07:44:41 +00:00
Guy Harris 2072d03e78 Tvbuffify the PIM dissector.
It was the last dissector that used "old_call_dissector()", and
tvbuffifying it got rid of that, so get rid of "old_call_dissector()".

svn path=/trunk/; revision=2892
2001-01-13 06:34:35 +00:00
Guy Harris 0ae122c3a9 Add a new "ip_to_str_buf()" routine that takes a pointer to an IP
address and a pointer to a character buffer as arguments, and puts a
printable form of the IP address into the buffer.  Make "ip_to_str()"
use it.

Make "host_name_lookup()" use "ip_to_str_buf()", not "ip_to_str()", so
that it doesn't trash any strings that a dissector has gotten with
"ip_to_str()" (for example, the ARP dissector gets strings for the
source and target protocol addresses, and then may attempt to register
names for the source and target hardware addresses with
"add_ether_byip()"; if "host_name_lookup()" fails to find a host name
for the IP address, it shouldn't use "ip_to_str()" to generate an IP
address string to associate with the IP address, as if that's done twice
it'll run out of "ip_to_str()" buffers - there're only 3 of them - and
trash one of the IP address strings the ARP dissector got).

svn path=/trunk/; revision=2850
2001-01-09 09:57:06 +00:00
Guy Harris 43ccfd8054 Add an additional "protocol index" argument to "{old_}dissector_add()",
"{old_}heur_dissector_add()", "{old_}conv_dissector_add()", and
"register_dissector()", so that an entry in those tables has associated
with it the protocol index of the protocol the dissector handles (or -1,
if there is no protocol index for it).

This is for future use in a number of places.

(Arguably, "proto_register_protocol()" should take a dissector pointer
as an argument, but

	1) it'd have to handle both regular and heuristic dissectors;

	2) making it take either a "dissector_t" or a union of that and
	   a "heur_dissector_t" introduces some painful header-file
	   interdependencies

so I'm punting on that for now.  As with other Ethereal internal APIs,
these APIs are subject to change in the future, at least until Ethereal
1.0 comes out....)

svn path=/trunk/; revision=2849
2001-01-09 06:32:10 +00:00
Guy Harris 925ce16014 Add tables of "conversation" dissectors, which are associated with
particular protocols, and which keep track of all dissectors that could
be associated with conversations using those particular protocols - for
example, the RTP and RTCP dissectors could be assigned to UDP
conversations.

This is for future use with UI features allowing the dissector for a
given conversation to be set from the UI, to allow

	1) conversations between two ports, both of which have
	   dissectors associated with them, that have been given to the
	   wrong dissector to be given to the right dissector;

	2) conversations between two ports, neither of which have
	   dissectors associated with them, to be given to a dissector
	   (RTP and RTCP, for example, typically run on random ports,
	   and if you don't have, in a capture, traffic that would say
	   "OK, traffic between these two hosts and ports will be RTP
	   traffic", you may have to tell Ethereal explicitly what
	   protocol the conversation is).

svn path=/trunk/; revision=2848
2001-01-09 05:53:21 +00:00
Guy Harris 677a1c6dc2 Add code to check the checksums of TCP segments and UDP datagrams;
replace the existing checksummer with a modified version of the BSD
checksumming code.  Add a flag to the "packet_info" structure to
indicate that a packet is the first fragment of a fragmented datagram,
so that the checksummers won't try to checksum those.

(It doesn't seem to add a lot of CPU overhead, so we don't introduce a
flag to disable it, yet.  Further checks may be necessary to see whether
the overhead is just swamped by other overheads when scanning through a
capture dissecting all frames, or if it truly is negligible.)

Make the Boolean preference option controlling whether to make the
top-level protocol tree item for TCP display a packet summary static to
the TCP dissector (it doesn't need to be accessible outside the TCP
dissector).

svn path=/trunk/; revision=2751
2000-12-13 02:24:23 +00:00
Guy Harris a3fa5541a8 Add a "col_clear()" routine, to clear a column; it appears (and it
doesn't just seem to be a profiling artifact) that, at least on FreeBSD
3.4, it's significantly more efficient to clear out a column by stuffing
a '\0' into the first byte of the column data than to do so by copying a
null string (I guess when copying one byte, the fixed overhead of the
procedure call and of "strcpy()" is significant).

Have the TCP dissector set the Protocol column, and clear the Info
column, before doing anything that might cause an exception to be
thrown, so that if we *do* get an exception thrown, the frame at least
shows up as TCP.

Instead of, in the TCP dissector, constructing a string and then
stuffing it into the Info column, just append to the Info column, which
avoids one string copy.

Pass a "frame_data" pointer to dissectors for TCP and IP (and PPP)
options, so they can use it to append to the Info column.

svn path=/trunk/; revision=2744
2000-12-04 06:37:46 +00:00
Guy Harris e152085fa8 Update a comment.
svn path=/trunk/; revision=2742
2000-12-03 22:53:09 +00:00
Guy Harris 35b1907af8 Pull the code to set the fields in the "cfile.cinfo" structure into a
common routine to initialize a "column_info()" structure, shared by
Ethereal and Tethereal.

svn path=/trunk/; revision=2739
2000-12-03 22:12:21 +00:00
Uwe Girlich 65d9f034eb Senseless old prototype for rpc init removed.
svn path=/trunk/; revision=2686
2000-11-21 14:15:21 +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
Guy Harris ea00ad9f58 Nobody calls "old_try_conversation_dissector()" or
"old_dissector_try_heuristic()" any more, as their users have all been
tvbuffified - get rid of them.

svn path=/trunk/; revision=2660
2000-11-18 11:47:21 +00:00
Guy Harris 6bab5c02f0 Put in an empty declaration of "struct dissector_handle" before
typedeffing "dissector_handle_t" to be a pointer to it.

svn path=/trunk/; revision=2659
2000-11-18 10:51:07 +00:00
Guy Harris c8196a1d1c Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.

Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.

Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate).  Then use it in IP.

Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.

svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
Guy Harris ee1b884ee9 Tvbuffify the STP dissector, have it register itself and have the LLC
dissector call it through a handle, and make it static.

Give "dissect_data()" an "offset" argument, so dissectors can use it to
dissect part of the packet without having to cook up a new tvbuff.

Go back to using "dissect_data()" to dissect the data in an IPP request.

svn path=/trunk/; revision=2651
2000-11-16 07:35:43 +00:00
Guy Harris 77ad89b12d Add a mechanism by which a dissector can be registered by name, another
dissector can get a "handle" for that dissector by name and then call
that dissector through the handle.

This allows dissectors that can't be called through a port table or a
heuristic table to be called from other dissectors without directly
referring to the dissector function - dynamically-loaded modules, under
Windows, cannot directly call functions in the main program, and
non-plugin dissectors are in the main program and thus cannot be called
from plugin dissectors unless either

	1) a pointer to the dissector is put in the Big Transfer Vector

or

	2) some other mechanism for getting a pointer to the dissector
	   is provided.

This mechanism could also support registering old-style dissectors and
calling them from new-style dissectors without the new-style dissector
having to do the argument translation itself (I didn't add support for
registering old-style dissectors because I'd prefer to have people
tvbuffify their code if they have to register a dissector...).

It could also, in the future, perhaps support

	disabling of protocols;

	setting "pinfo->current_proto";

inside "call_dissector()" - and inside "{old_}dissector_try_port()" and
"{old_"dissector_try_heuristic()" - allowing a pile of stuff that
currently has to be done in every dissector be done by common code.
(I have some ideas about how to do this, by

	having "proto_register_protocol()" take an abbreviation - of the
	sort that would be put in, for example, "pinfo->current_proto" -
	as an argument;

	having the calls to register dissectors take an index returned
	by "proto_register_protocol()" as an argument.

The abbreviation could be used elsewhere as well, e.g. in the "Decoding"
tab of the "Edit->Protocols" dialog box, and in a GUI for constructing
protocol filters.  Watch this space.)

Make "dissect_sdp()" the first client of this mechanism; it's now static
to "packet-sdp.c", and all dissectors that call it - including the MGCP
plugin - now call it through a dissector handle fetched by
"find_dissector()".  (Next step - see if Ethereal can now compile on
Windows as a result of this.)

svn path=/trunk/; revision=2647
2000-11-15 07:07:52 +00:00
Guy Harris 99c98f9e74 Move "bytes_to_str()" to "strutil.c" from "packet.c" - it's just a
string formatter, like "format_text()", and, as "tvbuff.c" now calls it
(*vide infra*), we don't want to have to make "tvbuff.c" drag "packet.h"
in just to declare "bytes_to_str()".  It's now declared in "strutil.h",
so include it in modules that use "bytes_to_str()" and weren't already
including it.

Add a "tvb_bytes_to_str()" wrapper that calls "tvb_get_ptr()" to get a
pointer to a chunk of N bytes at a given offset in a tvbuff and then
hands that chunk to "bytes_to_str()".  Convert the code that was doing
that to use "tvb_bytes_to_str()" instead (which caught what I suspect is
a bug in the Q.2931 dissector, where it was handing an offset of 0 to
"tvb_get_ptr()" - a cut-and-pasteo, I think).

Tvbuffify the ARP dissector.

svn path=/trunk/; revision=2634
2000-11-13 07:19:37 +00:00
Guy Harris 7d663fe7b0 Add a fourth choice of time format in the packet list display, which
shows the date (in YYYY-MM-DD format) as well as the time of day when
the packet arrived.

svn path=/trunk/; revision=2547
2000-11-01 08:31:36 +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 cba2930d6b Move packet.[ch] to epan
svn path=/trunk/; revision=2460
2000-09-27 05:18:06 +00:00