Wireshark-dev: Re: [Wireshark-dev] Rename TVB captured length vs reported length
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 17 Feb 2014 17:30:22 -0800
On Feb 17, 2014, at 2:48 PM, Jeff Morriss <jeff.morriss.ws@xxxxxxxxx> wrote:

> Yes (so we can check if it's our packet without throwing an exception).

Note that a lot of that can be done with tvb_memeql(), which returns "not equal" if the against which which we're comparing isn't present in the tvbuff.

Not all, however, can; for example, "is the 2-byte big-endian field at an offset of 2 in the range from 17 to 137" can't.  It can, however, be done with a combination of tvb_bytes_exist() (to check whether the field exists; if it doesn't, the heuristic check fails) followed by fetches and checks.