Ethereal-dev: Re: [Ethereal-dev] Some TVB rountines I want to add ...

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

From: Ed Warnicke <hagbard@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Nov 2000 08:17:39 -0500 (EST)
See comments inline...

On Tue, 28 Nov 2000, Richard Sharpe wrote:

> At 12:58 AM 11/28/00 -0800, Guy Harris wrote:
> >On Tue, Nov 28, 2000 at 01:50:28PM +1000, Richard Sharpe wrote:
> >> 1. tvb_skip_bytes
> >>    
> >>    int
> >>    tvb_skip_bytes(tvbuff_t *tvb, guint offset, guint8 bytes[], 
> >>                   guint len, guint min, guint max)
> >> 
> >>    Returns -1 if the specified (len of bytes)*min does not occur at 
> >>    the currentoffset, or there is not enough characters in the buffer.
> >> 
> >>    Returns number of bytes skipped if (len bytes)*min found in buffer,
> up to
> >>    (len bytes)*max.  Only complete occurrences of (len bytes) skipped. Any
> >>    partial initial match does not count!
> >>  
> >>    This does not currently seem to exist as a routine.
> >
> >What does it skip over? Occurrences of the exact "len"-byte array of
> >bytes "bytes"?
> 
> Yes. 
> 
> >Where would that be used?
> 
> In protocols where there are literal text strings, or spaces etc separating
> elements, the call would allow me to skip one or more of them. 
> 
> Ie, with the appropriate calls, it can skip spaces, or tell me if a ':' was
> there and skip it, and so on, and so forth.

But frequently I don't want to skip over a simple space ( ' ' ) but 
rather over a rfc2234 WSP ( WSP = SP | HTAB ) or LWS 
( LWS = WSP | CRLF WSP ).  These are more complicated cases than are
covered by tvb_skip_bytes() (although I am very much in favor of covering
this in a more general way than I did with tvb_skip_wsp() in
plugin/mgcp/packet-mgcp.c ). 

Ed