Commit Graph

59 Commits

Author SHA1 Message Date
Guy Harris f99bb93e55 Cast "char" values to "guchar" before passing them to <ctype.h> macros,
so that characters with the 8th bit set don't get sign-extended and
cause the macros not to return the right answer.

svn path=/trunk/; revision=10036
2004-02-11 09:19:54 +00:00
Guy Harris 53c2c2342f Handle the media type "message/sip".
svn path=/trunk/; revision=9973
2004-02-03 20:39:58 +00:00
Guy Harris fc7bbdd8d5 Free "media_type_str" once we've made the lower-cased copy - and refer
only to the lower-cased copy in subsequent code.

svn path=/trunk/; revision=9744
2004-01-19 23:48:05 +00:00
Olivier Biot 5eb042b862 Fix a double free bug introduced by the previous patch.
svn path=/trunk/; revision=9741
2004-01-19 23:08:02 +00:00
Olivier Biot d2a8b3d2cc From Anders Broman:
Convert content type to lowercase, and save pinfo->prvate_data before
	handing off to a subdissector.

svn path=/trunk/; revision=9725
2004-01-18 23:21:20 +00:00
Olivier Biot 09668847cc Add a preference that controls the way the SIP version is enforced. By default,
strict enforcement of SIP/2.0 will be applied.

Add some comments.

From Anders Broman:

	Fix the length of content_type_parameter_str.

	Fix a typo in a comment.

svn path=/trunk/; revision=9591
2004-01-07 19:49:45 +00:00
Guy Harris 595f0c3aaf From Steven Lass: put the request and status lines into the protocol
tree as filterable fields.

svn path=/trunk/; revision=9518
2004-01-02 02:03:39 +00:00
Guy Harris 9ee50c5660 There's no need for the "content_type_exist" variable - we can just
check whether "media_type_str" is null.

svn path=/trunk/; revision=9322
2003-12-17 20:52:38 +00:00
Guy Harris 92efccb711 From Anders Broman:
check that there *is* a content type string before using it;

	get rid of some incomplete code for multipart/mixed (it set some
	variables but didn't use them);

	add some incomplete code for handling parameters to Content-Type.

svn path=/trunk/; revision=9321
2003-12-17 20:39:31 +00:00
Guy Harris d5ba7b40eb From Anders Broman:
Call subdissectors regardless of whether we're building a
	protocol tree or not.

	Use the "media_type" dissector table to hand off to
	subdissectors, rather than wiring in SDP.

	Put the message body into a subtree of the SIP tree rather than
	at the top level.

svn path=/trunk/; revision=9200
2003-12-08 20:25:31 +00:00
Guy Harris 3dd28656ba From Anders Broman: add more SIP headers, and the PUBLISH method.
svn path=/trunk/; revision=9089
2003-11-25 18:02:57 +00:00
Guy Harris 530d993a6b From Martin Mathieson:
- Add some summary info to REGISTER requests and responses
	- Tidy up whitespace a little

svn path=/trunk/; revision=9048
2003-11-20 22:38:33 +00:00
Guy Harris fdf764fe54 Add support for the compact form of headers.
svn path=/trunk/; revision=8963
2003-11-14 02:07:20 +00:00
Guy Harris 4569c6f11a From Anders Broman: make it possible to filter on only address or tag in
the SIP address fields.

svn path=/trunk/; revision=8770
2003-10-24 00:50:39 +00:00
Jörg Mayer 1d0a7cfdb2 Update list of SIP RFCs
svn path=/trunk/; revision=8697
2003-10-14 21:24:57 +00:00
Guy Harris ae3aa9d05b For (non-heuristic) SIP-over-TCP, dissect stuff that's neither a request
nor a response as continuation data.  For SIP-over-everything-else,
reject it.

Parse the headers regardless of whether we're building a protocol tree
or not; if we're not, we just do it to look for a blank line separating
the headers from the body.  Do that instead of scanning for the message
body separately.

When scanning for a colon, don't scan past the end of the line.

svn path=/trunk/; revision=8549
2003-09-26 21:32:38 +00:00
Guy Harris f3832721d9 Make the non-heuristic SIP dissector reject the packet if it doesn't
look like a SIP packet, so some other dissector gets a chance at it.

When looking for the blank line separating headers from data, use
"tvb_find_line_end()" so we handle CR/LF and LF as end-of-line
indications (RFC 2543 says "senders MUST terminate lines with a CRLF",
but it also says "but receivers MUSTalso interpret CR and LF by
themselves as line terminators"), and return an offset past the end of
the buffer, rather than -1, if we don't find it (not all packets have
one).

When checking whether a header is one we know about, do a
case-insensitive comparison (RFC 2543 says header field names are
case-insensitive).

svn path=/trunk/; revision=8548
2003-09-26 20:00:38 +00:00
Guy Harris 4db8a31785 From Anders Broman: add a preference option to enable the display of the
whole SIP message as text lines, as well as showing the dissected
message.

svn path=/trunk/; revision=8340
2003-09-02 21:23:43 +00:00
Guy Harris 3d16d6a0c0 Register as a heuristic subdissector of SCTP.
Doing so obviates the need to register the dissector by name (that was
done to let the SCTP dissector explicitly call the SIP dissector), so
don't bother doing so.

svn path=/trunk/; revision=8129
2003-08-04 23:13:39 +00:00
Guy Harris 2808683c78 From Ruud Linders:
"UPDATE" is now a valid sip method;

	register the SIP decoder so it can be called from other
	protocols (i.e. SCTP).

svn path=/trunk/; revision=8115
2003-07-31 18:14:02 +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
Guy Harris 03731079ca Put the subfields of the request or response line under the protocol
tree item for that line.

In "dfilter_sip_request_line()", free the string after we're done.

svn path=/trunk/; revision=7848
2003-06-11 21:17:41 +00:00
Guy Harris 4e3002765d Clean up the checks for valid SIP requests and responses; do the tests -
and the finding of tokens in the header - only once.

Don't assume there's either zero or one spaces after the colon in a
Name:Value header, and don't put a tvb_format_text()-formatted version
of the value into the protocol tree.

svn path=/trunk/; revision=7811
2003-06-09 01:50:08 +00:00
Guy Harris eb9ef15711 From Steven Lass: if there is no whitespace after the colon in a header,
don't try to eat the non-existent whitespace.

svn path=/trunk/; revision=7763
2003-05-29 18:29:36 +00:00
Gerald Combs 75b26f8da3 MSVC++ didn't care for having const ints in its hf subarray indices. Use
#defines instead.

svn path=/trunk/; revision=7339
2003-03-11 01:48:55 +00:00
Guy Harris cc77e8abe9 From Stefan Wenk: filterable header fields in SIP dissector.
svn path=/trunk/; revision=7336
2003-03-10 22:33:26 +00:00
Gerald Combs 1062faf830 Update Jean-Francois Mule's email address
svn path=/trunk/; revision=6364
2002-10-02 18:51:10 +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
Guy Harris 6d68a964e5 From Stefan Wenk: remove an unnecessary +1 from some offset
computations.

svn path=/trunk/; revision=5905
2002-07-25 21:43:53 +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 6495ee6eef Fix another place where the heuristic dissector was checking data before
it new it was available.

Fix some comments.

svn path=/trunk/; revision=5425
2002-05-09 08:27:51 +00:00
Guy Harris c9c26fce69 In the heuristic dissector, check to make sure the data being looked at
is available before looking at it, so we don't throw an exception before
we conclude whether the packet is, or isn't, one of ours.

svn path=/trunk/; revision=5424
2002-05-09 07:42:07 +00:00
Guy Harris 9c6a759e7e From Stefan Wenk: SIP heuristic dissector.
svn path=/trunk/; revision=5418
2002-05-08 20:29:47 +00:00
Guy Harris 969e0f7dd4 From Joerg Mayer: get rid of an unused argument.
svn path=/trunk/; revision=5332
2002-05-01 08:11:07 +00:00
Gerald Combs 395cace9a7 From Jakob Schlyter: add "PRACK" and "SPRACK" methods.
Change the behavior of the dissector to treat anything matching
"^.* .+:.+ SIP/2.0$" as a SIP request.  Methods that don't match our list
are labelled "unknown".

Convert some tabs to spaces to match the rest of the code.

svn path=/trunk/; revision=5040
2002-03-29 01:25:57 +00:00
Gerald Combs c3881d8a9d From Jakob Schlyter, add the "MESSAGE" method.
Add the "QAUTH" and "DO" methods as well.

svn path=/trunk/; revision=4997
2002-03-21 03:08:46 +00:00
Guy Harris 70ae5ab15e Use "tvb_offset_exists()" to check whether there's a payload, and use
"msg_offset" rather than "offset" as the offset of the beginning of the
payload ("offset" is only advanced if "tree" is non-null, so it doesn't
necessarily point to the beginning of the payload).

Use -1 rather than "tvb_length_remaining()" as a length argument to
"tvb_find_guint8()" to get it to search to the end of the tvbuff, and,
before checking for the additional "\n\r\n" after a "\r", check whether
those 3 bytes are in the tvbuff.

svn path=/trunk/; revision=4671
2002-02-02 02:56:19 +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
Ed Warnicke a810a01338 Switched from calling dissect_data to using call_dissector
svn path=/trunk/; revision=4263
2001-11-25 22:19:25 +00:00
Gilbert Ramirez 6de396c4a8 Fix the rest of the signed/unsigned comparison warnings.
svn path=/trunk/; revision=4088
2001-10-26 18:28:17 +00:00
Guy Harris ecccb6e061 "sip_is_request()" is intended to indicate whether a given SIP packet is
a request or reply; make its return value "gboolean", and have it just
return TRUE or FALSE.  Also make an array index variable unsigned, to
squelch a GCC warning.

Support for additional SIP methods, from Jean-Francois Mule.

svn path=/trunk/; revision=3865
2001-08-23 00:18:57 +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 64a43e1c0e Fixes to Lemon to get it to compile on platforms (such as some versions
of Tru64 UNIX) that define TRUE and FALSE.

Fixes to some Tru64 compiler warnings.

svn path=/trunk/; revision=3120
2001-03-09 04:35:25 +00:00
Gerald Combs 59dda02da5 Slightly better invalid packet handling.
svn path=/trunk/; revision=2959
2001-01-30 02:38:33 +00:00
Gerald Combs ad07bc1b53 Fix a bounds checking problem when handed an invalid SIP packet, as
discovered by Ruud Linders <ruud@lucent.com>.

svn path=/trunk/; revision=2958
2001-01-30 02:22:23 +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