Commit Graph

16 Commits

Author SHA1 Message Date
Gilbert Ramirez 5664e5887f Make tvb_get_ptr() return 'const guint8*', and clean up all the
usages of tvb_get_ptr(). packet-ieee80211.c still has one bad usage,
in which it *does* modify the tvbuff's data.

svn path=/trunk/; revision=3128
2001-03-13 21:34:28 +00:00
Guy Harris 32d63ecb30 Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="
statements.

Move the setting of the Protocol column in various dissectors before
anything is fetched from the packet, and also clear the Info column at
that point in those and some other dissectors, so that if an exception
is thrown, the columns don't reflect the previous protocol.

"Tvbuffify" the Mobile IP dissector (it took old-style arguments, and
then converted them into tvbuff arguments, so there wasn't much to do,
other than to fix references to "fd" to refer to "pinfo->fd").

In the SCTP dissector, refer to the port type and source and destination
ports through "pinfo" rather than through the global "pi", as it's a
tvbuffified dissector.

In the SMTP and Time Protocol dissectors, use "pinfo->match_port" rather
than "TCP_PORT_SMTP" when checking whether the packet is a request or
reply, just in case somebody makes a non-standard port be dissected as
SMTP or Time.  (Also, remove a bogus comment from the Time dissector; it
was probably cut-and-pasted from the TFTP dissector.)

svn path=/trunk/; revision=2938
2001-01-25 06:14:14 +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 0e7c1de08a Have "proto_register_protocol()" build a list of data structures for
protocols, in addition to adding structures to the list of filterable
fields.  Give it an extra argument that specifies a "short name" for the
protocol, for use in such places as

	pinfo->current_proto;

	the dialog box for constructing filters;

	the preferences tab for the protocol;

and so on (although we're not yet using it in all those places).

Make the preference name that appears in the preferences file and the
command line for the DIAMETER protocol "diameter", not "Diameter"; the
convention is that the name in question be all-lower-case.

Make some routines and variables that aren't exported static.

Update a comment in the ICP dissector to make it clear that the
dissector won't see fragments other than the first fragment of a
fragmented datagram.

svn path=/trunk/; revision=2810
2001-01-03 06:56:03 +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 9985115b8b Use "tvb_offset_exists()" rather than "tvb_length_remaining()" to check
whether there's any data left in the tvbuff starting at a specified
offset.

svn path=/trunk/; revision=2636
2000-11-13 08:58:17 +00:00
Guy Harris bedae04c2e Add only one "proto_smtp" item to the protocol tree for SMTP; add text
subitems with "proto_tree_add_text()".

svn path=/trunk/; revision=2616
2000-11-12 03:13:44 +00:00
Guy Harris 8562f7181c Tvbuffify the SMTP dissector.
Don't assume that we start out getting commands from the client - the
capture may have started in the middle of a transaction, and we may be
getting a message body from the client instead.  Only treat stuff as
commands if it consists of four alphabetic characters followed either by
an end-of-line or a space.

Commands in SMTP are case-insensitive; when looking for "DATA", do a
case-insensitive comparison.

If the packet contains the message body, just put "Message Body" in the
summary, don't put any of the message body itself in there.  If it's a
command, put "Command:" in the summary before the first line of the
command.

When putting the message body into the protocol tree, give each line its
own entry, rather than putting the entire body in as one entry.

Don't put an entry into the protocol tree for a command parameter if
there is no command parameter.

svn path=/trunk/; revision=2614
2000-11-12 02:29:20 +00:00
Guy Harris eaf695bfee Simplify the state machine:
you're either reading commands, or you're reading message data;

	if you're reading commands, and you see a DATA command, you
	start reading data;

	if you're reading data, and you see an EOM, you start reading
	commands.

Also, *always* fill in the per-frame data you allocate for a frame, and
*always* attach it to the packet.

The old state machine assumed it was done with the SMTP conversation
once it saw an EOM, and the dissector wouldn't fill in the per-frame
data it'd allocated and attach it to the packet if it thought it was
done with the SMTP conversation.  This meant that:

	1) the per-frame data allocated for frames following the EOM
	   (e.g., a QUIT command) would contain random junk for data
	   such as the packet type;

	2) that per-frame data would be re-allocated every time the
	   frame was looked at, as it wouldn't be attached to the frame,
	   so you might well get *different* random junk each time the
	   frame was looked at.

This caused Tethereal and Ethereal to sometimes fail to recognize
commands following the EOM - but it wouldn't *always* fail to do so,
sometimes it'd work and sometimes it wouldn't.

Fix a comment; conversations are *not* removed during filter operations,
and the visited flag is *not* cleared during a filter operation - that's
only true on a *redissection* operation.  In any case, given that frames
can, after the initial sequential scan through the capture, be visited
in any order, and visited repeatedly, it's irrelevant whether
conversations are removed or not - we have to associate with each frame
information telling us how to process it.

svn path=/trunk/; revision=2608
2000-11-11 07:48:30 +00:00
Guy Harris 563f86ee5e Support for conversations with "wildcard" destination addresses, from
Jeff Foster.

svn path=/trunk/; revision=2523
2000-10-21 05:52:28 +00:00
Gilbert Ramirez 9941aabd64 Move format_text(), get_token_len(), and fine_line_end(), into strutil.c
This keeps tvbuff.c generic; it doesn't have to pull in packet.h and all
of it's included files.

svn path=/trunk/; revision=2409
2000-09-11 16:16:13 +00:00
Richard Sharpe 1dfb66bc67 Fix a minor spelling mistake ...
svn path=/trunk/; revision=2379
2000-08-26 11:25:28 +00:00
Richard Sharpe 18a3495d64 Fixes to add state keeping and properly decode SMTP.
svn path=/trunk/; revision=2362
2000-08-24 11:32:09 +00:00
Laurent Deniel b634f019f4 SMTP is Simple *Mail* Transfer Protocol not Message.
Add [OLD_]CHECK_DISPLAY_AS_DATA call.

svn path=/trunk/; revision=2308
2000-08-20 15:25:17 +00:00
Guy Harris 2962655ac5 This is an SMTP dissector, not a BXXP dissector; fix the comment at the
beginning.

Pass "pinfo->fd", not "fd", to "p_get_proto_data()", so that it'll
continue to work even when tvbuffified.

Use "strchr()", not "index()" - "strchr()" is in the ANSI C standard,
and may be in some systems that don't have "index()", whereas those
systems that had "index()" but not "strchr()" got with the ANSI C
program a while ago.

Use "old_dissector_add()" and "old_dissector_delete()" to register and
unregister the SMTP dissector, as it's not yet been tvbuffified.

svn path=/trunk/; revision=2303
2000-08-20 02:16:23 +00:00
Richard Sharpe fe7540783e Added packet-smtp.c and modified packet.c to include code that was never
finished ...

The SMTP dissection is a good start, but does not handle the message
body at all ...

On to that next.

svn path=/trunk/; revision=2302
2000-08-19 23:06:51 +00:00