Ethereal-dev: Re: [Ethereal-dev] mgcp plugin patch

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Fri, 10 Nov 2000 01:31:57 -0800
"packet-mgcp.c" has a routine "tvb_crlf_strip()"; you may want to use
the new "tvb_find_line_end()" routine instead - it takes as arguments:

	a tvbuff pointer;

	an offset into that tvbuff;

	a maximum length to search (which can be -1 for "all the way to
	the end of the tvbuff");

	a pointer to a "gint";

and searches for an LF.  If it finds the LF, it checks if it's preceded
by a CR and, if so, treats the CR/LF as the line ending, otherwise it
treats the LF as the line ending (unless the LF is *followed* by a CR,
in which case it treats the LF/CR as a line ending, as I think we had
one capture at NetApp where some HTTP client or server was using LF/CR;
that won't treat CR/LF/CR as a line ending, only <non-CR>/LF/CR).

It returns the number of characters between the given offset and the
line ending, i.e. the length of the line *NOT* including the line
ending; it sets the "gint" pointed to by the last argument to the offset
of the character *past* the line ending.

I tvbuffified a pile of the dissectors that parse ASCII-text-line
protocols (FTP, HTTP, NNTP, POP, etc.), using that routine to find the
lines in the packet.