Commit Graph

44 Commits

Author SHA1 Message Date
Guy Harris 7661a992b6 Move the redefinition of "isprint()" to be used by dissectors when
generating strings to put into the printable representation of protocol
tree items into an "isprint.h" header, and include it in some additional
dissectors.

Add bounds checking to one place in the DICOM dissector.

svn path=/trunk/; revision=11356
2004-07-09 23:17:05 +00:00
Guy Harris 20d6c818e8 Use "format_text()" on strings, so we handle non-printable characters.
Clean up white space a bit.

svn path=/trunk/; revision=11157
2004-06-16 07:51:21 +00:00
Guy Harris d6e2627959 From Devin Heitmueller: improve decoding of outgoing and incoming
message blocks.

svn path=/trunk/; revision=11081
2004-06-03 04:19:38 +00:00
Guy Harris 85fe1e6dee Use "tvb_reported_length_remaining()" in "until the end of the packet"
loops, so we mark frames as short if they've been cut short by a
snapshot length.

The user class in buddy list TLVs appears to be 2 bytes, in at least
some captures; make "dissect_aim_userclass()" take the user class value,
and the length of the user class field, as arguments, and have the
caller fetch the value.  Also, display the numerical value of the user
class in hex, as it's a bitset.

Fix the messaging dissector to put stuff under the top-level item rather
than at the top level.

Fix a typo.

Clean up indentation.

svn path=/trunk/; revision=10802
2004-05-05 09:30:56 +00:00
Olivier Biot a7c049e066 From Jelmer Vernooij:
Add 2 missing header fields.

svn path=/trunk/; revision=10714
2004-04-26 21:11:33 +00:00
Olivier Biot 3226647c01 From Jelmer Vernooij:
Add support form extra SNACs. All TLV's are now recognized.

svn path=/trunk/; revision=10712
2004-04-26 18:21:10 +00:00
Guy Harris 0cef289a3a From Jelmer Vernooij:
Add support for a couple more SNAC's.

	Handle TLV's in a somewhat more extendible manner.

	Fix a bug in the buddylist dissector that caused pango warnings.

svn path=/trunk/; revision=10646
2004-04-20 04:48:32 +00:00
Guy Harris d9cad7236e From Jon Oberheide: add the "Password Hash" label to AIM_TLV_PASSWORD
(0x0025) which was previously "Unknown".

svn path=/trunk/; revision=10582
2004-04-11 20:57:10 +00:00
Guy Harris fd6e42336e Get rid of a no-longer-used argument.
svn path=/trunk/; revision=10453
2004-03-23 07:39:06 +00:00
Guy Harris 5c7cba5d1e The dissectors for particular AIM families aren't for real protocols,
and they don't create their own subtrees; hand them the pointer to the
AIM subtree, rather than the top-level tree, so they'll put the protocol
tree items in the AIM subtree.

svn path=/trunk/; revision=10452
2004-03-23 07:23:43 +00:00
Guy Harris 13bb836ab9 From Jelmer Vernooij: split the AIM dissector into multiple files, and
add a few more SNACs.

svn path=/trunk/; revision=10450
2004-03-23 06:21:18 +00:00
Guy Harris ed5641230d From Jelmer Vernooij: add support for SNAC(x,1), SNAC(1,2-6) and
SNAC(1,0x13).

svn path=/trunk/; revision=10424
2004-03-20 20:06:47 +00:00
Guy Harris 45e7bf5962 From Jelmer Vernooij: add support for some more SNACs.
svn path=/trunk/; revision=10414
2004-03-20 06:14:49 +00:00
Jörg Mayer 3086e0b9e7 warning: ISO C does not allow extra ; outside of a function
svn path=/trunk/; revision=9390
2003-12-21 11:40:45 +00:00
Guy Harris ee97ce3196 Add new routines:
tvb_get_string() - takes a tvbuff, an offset, and a length as
	arguments, allocates a buffer big enough to hold a string with
	the specified number of bytes plus an added null terminator
	(i.e., length+1), copies the specified number of bytes from the
	tvbuff, at the specified offset, to that buffer and puts in a
	null terminator, and returns a pointer to that buffer (or throws
	an exception before allocating the buffer if that many bytes
	aren't available in the tvbuff);

	tvb_get_stringz() - takes a tvbuff, an offset, and a pointer to
	a "gint" as arguments, gets the size of the null-terminated
	string starting at the specified offset in the tvbuff (throwing
	an exception if the null terminator isn't found), allocates a
	buffer big enough to hold that string, copies the string to that
	buffer, and returns a pointer to that buffer and stores the
	length of the string (including the terminating null) in the
	variable pointed to by the "gint" pointer.

Replace many pieces of code allocating a buffer and copying a string
with calls to "tvb_get_string()" (for one thing, "tvb_get_string()"
doesn't require you to remember that the argument to
"tvb_get_nstringz0()" is the size of the buffer into which you're
copying the string, which might be the length of the string to be copied
*plus 1*).

Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string).  Use "tvb_get_stringz()", instead.

In some cases where a value is fetched but is only used to pass an
argument to a "proto_tree_add_XXX" routine, use "proto_tree_add_item()"
instead.

svn path=/trunk/; revision=7859
2003-06-12 08:33:32 +00:00
Gerald Combs 7a132e5b48 More tvb_get_nstringz0() fixes. Timo Sirainen pointed out that Bad
Things can happen if we pass a zero buffer length to tvb_get_nstringz0().
Throw an exception if this happens.

In various dissectors make sure the tvb_get_nstringz0()'s buffer length
is greater than zero.

svn path=/trunk/; revision=7688
2003-05-19 03:23:12 +00:00
Guy Harris d791827a65 "tvb_get_nstringz0()" now expects its third argument to be the maximum
number of bytes to put into the string, including the trailing '\0', not
the maximum number of real characters in the string; fix the call
appropriately (and make the buffer big enough to hold a null-terminated
string with MAX_BUDDYNAME_LENGTH characters).

svn path=/trunk/; revision=7663
2003-05-11 02:40:36 +00:00
Gerald Combs 0b9bbbbdb6 Modify tvb_get_nstringz*() to behave more like snprintf(). Make changes
where necessary to reflect the new behavior.

svn path=/trunk/; revision=7607
2003-04-30 02:35:28 +00:00
Guy Harris e3645e4bd2 From Devin Heitmueller: dissect the "List" subtype in the Server Stored
List (SSI) family.

svn path=/trunk/; revision=7458
2003-04-15 04:45:57 +00:00
Guy Harris a3eec5e9c9 From Devin Heitmueller: for packets with an unknown family ID, display
the family ID in hex in the summary line.

svn path=/trunk/; revision=7353
2003-03-14 21:50:19 +00:00
Guy Harris f7b3583e8a From Devin Heitmueller: dissection for user info requests (away message,
user profile, etc).

svn path=/trunk/; revision=7209
2003-02-27 02:38:19 +00:00
Guy Harris 097f40cae8 From Devin Heitmueller: handle the AIM logon reply.
svn path=/trunk/; revision=7182
2003-02-21 04:38:53 +00:00
Guy Harris 03533b258b Updates from Devin Heitmueller to add a framework to handle TLVs, and to
handle "oncoming buddy" and "signon" TLVs.

svn path=/trunk/; revision=7174
2003-02-20 04:42:08 +00:00
Guy Harris da59e43b6d Do desegmentation and handle multiple AIM messages per TCP segment.
If the packet doesn't look like an AIM packet, tell our caller so they
can try something else.

Don't display an item for undissected data if there isn't any data.

svn path=/trunk/; revision=6945
2003-01-20 07:39:25 +00:00
Guy Harris 4a521a5a9f From Devin Heitmueller: further AIM cleanups, including cleanups of
Family subtype dissection, and addition of subtypes present in GAIM
source but not in Ethereal.

svn path=/trunk/; revision=6932
2003-01-15 06:09:11 +00:00
Guy Harris eb4e35abff From Devin Heitmueller:
* Break up dissection into separate functions
* Added families not already present (based on GAIM source code)
* Added entries from the "generic" family not already present
* Started to break families and subtypes into constants instead of
  having hardcoded values (signon and generic are done, others in
  progress)

svn path=/trunk/; revision=6917
2003-01-12 04:58:32 +00:00
Guy Harris dc3ed93566 From Devin Heitmueller: improve dissection of the AIM signon-reply, the
request-user-info, and the start of the user-info reply.

svn path=/trunk/; revision=6906
2003-01-11 07:17:37 +00:00
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 77fa06b899 From Joerg Mayer:
dftest.c:
	     Remove #if-0-ed includes

	packet-ieee80211.c, packet-wtls.c, packet-afp.c, packet-wsp.c,
        packet-wtp.c, ethereal_gen.py:
	     Remove redundant include varargs (already in snprintf.h,
	     and required only for snprintf.h)

	Remove unused include of snprintf.h from files not using
	"snprintf()".

svn path=/trunk/; revision=5889
2002-07-17 00:43:03 +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 c78ec94c25 The family and subtype fields in AIM messages are 16-bit fields, and
apparently specified in hex; display them as such in the Info column.

svn path=/trunk/; revision=4583
2002-01-20 23:42:51 +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 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 3c1508a6b3 Fix Gerald's e-mail address - and fix it in "README.developer", so
people don't blindly insert the old address into new dissectors, which
is probably how it got into the dissectors being fixed here.

svn path=/trunk/; revision=3348
2001-04-20 20:34:31 +00:00
Guy Harris c57c848dfa 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.

Don't use

	col_add_fstr(..., "%s", string);

Use

	col_add_str(..., string);

as it does the same thing, but doesn't drag all the heavy *printf
machinery in.

Fix the DDTP dissector to set the Info column regardless of whether
we're building a protocol tree or not, and to set it to "Encrypted
payload" if the payload is encrypted.  Also fix a typo in a field name.

Register the FTP data dissector as being associated with the FTP data
protocol, not the FTP protocol (the removed "CHECK_DISPLAY_AS_DATA()"
call checked "proto_ftp_data", and the removed "pinfo->current_proto ="
line set it to "FTP-DATA", so it should be associated with
"proto_ftp_data").

Make the H1 dissector check whether the frame has at least 2 bytes in it
before checking the first two bytes; heuristic dissectors must not throw
exceptions until they've accepted the packet as one of theirs.

Use "tvb_format_text()" rather than "tvb_get_ptr()" and "format_text()"
in some dissectors where the result of "tvb_get_ptr()" is used only in
the "format_text()" call.

In the Quake dissector, don't check whether there are at least 4 bytes
in the packet - if we return, the packet won't be dissected at all (it's
not as if some other dissector will get to handle it), and, if we don't
return, we'll throw an exception if there aren't at least 4 bytes in the
packet, so the packet will be marked as short or malformed, as
appropriate.

In the RIPng dissector, associate the table of strings for the command
field with the command field, so that the dissector doesn't have to
format the string for the protocol tree entry itself, and so that the
filter construction dialog box can let you select "Request" or
"Response" from a list rather than requiring you to know the values for
"Request" and "Response".

Make "dissect_rpc()" static, as it's called only through a heuristic
dissector list.

Use "col_set_str()" to set the COL_PROTOCOL column for RPC protocols;
the string used is from a table provided by the dissector, and is a
string constant.

Don't format the Info column for WSP into a buffer and then format that
buffer into the column with "%s" - "col_add_fstr()" can do the
formatting for you, without having to allocate your own buffer (or run
through the *printf machinery twice).

Don't fetch fields from the WTP packet until you're ready to use them,
so that you don't throw an exception before you even set the Protocol
column or clear the Info column.

Use "pinfo->destport", not "pi.destport", in the Zebra dissector when
checking whether the packet is a request or reply, and do the check by
comparing with "pinfo->match_port" rather than TCP_PORT_ZEBRA (so that
if the dissector is ever registered on another port, it still correctly
determines whether the packet is a request or reply - the Network
Monitor HTTP dissector has port 80 wired into its brain, which is a bit
irritating if you're trying to get it to dissect HTTP proxy traffic on
port 3128 or proxy administration UI traffic on port 3132).

svn path=/trunk/; revision=2931
2001-01-22 08:03:46 +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 63bf78521d Updates from Ralf Holzer.
svn path=/trunk/; revision=2704
2000-11-28 06:38:47 +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 40e9328384 "pinfo->current_proto" is typically set to an acronym or short name for
the protocol, not the filter name for the protocol, so it should be
"AIM", not "aim".

svn path=/trunk/; revision=2621
2000-11-12 09:29:38 +00:00
Guy Harris 7aad3fa543 AIM/OSCAR dissector, from Ralf Holzer.
svn path=/trunk/; revision=2571
2000-11-06 00:07:04 +00:00