Commit Graph

236 Commits

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