Hi,
For automatically generating dissectors for protocols that are verbose with
lots of strings and embedded spaces, I propose adding the following routine.
int
tvb_skip_bytes(tvb, offset, string, strlen, min, max);
Return count of character positions consumed. A return of -1 means none found.
strlen is the length of the bytes to match. Min us the min number of
strings to match. If that many not found, return an error. if min=0, none
is acceptible. Max is the max number of matching strings to skip. Max of 0
means keep going until no more (chars ...).
Eg:
tvb_skip_bytes(tvb, offset, " ", 1, 0, 0)
means skip spaces for as many as you find, but no spaces are acceptible.
Ambiguities exist, if for example you call:
tvb_skip_bytes(tvb, offset, "abc", 3, 1, 0)
and the buffer contains, from offset:
abcabcabEOF
How does the ab count? As a match or not? Conservatively, probably not.
Regards
-------
Richard Sharpe, sharpe@xxxxxxxxxx
Samba (Team member, www.samba.org), Ethereal (Team member, www.zing.org)
Contributing author, SAMS Teach Yourself Samba in 24 Hours
Author, Special Edition, Using Samba