Commit Graph

32 Commits

Author SHA1 Message Date
Jörg Mayer 7c4176d868 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=6117
2002-08-28 21:04:11 +00:00
Jörg Mayer 173fe5aef4 Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the toplevel directory. The removal of winsock2.h will
hopefully not cause any problems under MSVC++, as those files using
struct timeval still include wtap.h, which still includes winsock2.h.

svn path=/trunk/; revision=5932
2002-08-02 23:36:07 +00:00
Guy Harris 47b147ffd1 Add an extra argument to "tvb_find_line_end()", which specifies what it
should do if it doesn't find an EOL; if FALSE, it behaves as before,
returning values that treat the line as ending at the end of the tvbuff,
and if TRUE, it returns -1, so its caller can do segment reassembly
until it gets the EOL.

Add an option to the SMTP dissector to do segment reassembly, and do
segment reassembly of the first line.

svn path=/trunk/; revision=5891
2002-07-17 06:55:29 +00:00
Guy Harris 5b3660e693 SMTP and FTP response codes need more than 1 byte, as they can go up to
999; give them 4.

svn path=/trunk/; revision=5874
2002-07-15 09:40:20 +00:00
Guy Harris 9d1fdfedb7 Only put "smtp.req" into the tree for packets that contain request
lines, and only put "smtp.rsp" into the tree for packets that contain
reply lines; don't put either into the tree for packets that contain
only message body text or an EOM.

svn path=/trunk/; revision=5866
2002-07-14 08:27:34 +00:00
Guy Harris c5a0e76a76 In FTP, a normal reply line has a 3-digit number at the beginning - a
line that doesn't is a middle line of a multi-line reply.  Treat only
lines with a 3-digit number at the beginning as reply lines with a
response code and response argument.

Provide filterable fields for the SMTP command and parameters, and the
SMTP reply code and parameters, along the lines of what's done for FTP.

svn path=/trunk/; revision=5865
2002-07-14 00:40:07 +00:00
Guy Harris db31932941 From Joerg Mayer:
Declares some variables static.

	Creates a new include file packet-rsvp.h, and make use of it
	(change some extern decls to #inlcude).

	Move the file packet-pgm.h into packet-pgm.c as it is not used
	by anything outside packet-pgm.c.

svn path=/trunk/; revision=5162
2002-04-14 23:04:04 +00:00
Guy Harris eb2d6593dc Replace a bunch of "tvb_length()" and "tvb_length_remaining()" calls in
arguments to "proto_tree_add_text()", and to "proto_tree_add_XXX()" calls
that add FT_NONE or FT_PROTO items to the protocol tree, with -1.

Replace some calls to "tvb_length()" or "tvb_length_remaining()" with
calls to "tvb_reported_length()" and "tvb_reported_length_remaining()",
as those give the actual length of the data in the packet, not just the
data that happened to be captured.

svn path=/trunk/; revision=4605
2002-01-24 09:20:54 +00:00
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 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 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 99d3b13be9 The hash table merely associates data structures with conversations,
but you can do that directly, so eliminate the hash table and just
attach the data structures to the conversation directly.

svn path=/trunk/; revision=4197
2001-11-13 04:34:38 +00:00
Guy Harris 3388bde488 Instead of having a single datum attached to a conversation, have a list
of protocol-id-plus-datum pairs, so that multiple protocols can attach
information to the same conversation.

Dissectors that attach information to a conversation should not assume
that if they find a conversation it has one of its data attached to it;
the conversation might've been created by another dissector.

svn path=/trunk/; revision=3901
2001-09-03 10:33:12 +00:00
Guy Harris 541af0c740 Use the "pinfo" argument, rather than the global "pi", to refer to the
packet information in tvbuffified dissectors.

svn path=/trunk/; revision=3645
2001-07-03 04:56:46 +00:00
Guy Harris 8412393197 From Joerg Mayer: explicitly fill in all members of a
"header_field_info" structure, including the ones that are later set by
the routines to register fields.

svn path=/trunk/; revision=3561
2001-06-18 02:18:27 +00:00
Guy Harris 32c0848007 Get rid of END_OF_FRAME references in tvbuffified dissectors.
svn path=/trunk/; revision=3364
2001-04-23 04:29:54 +00:00
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