Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 53090: /trunk/ /trunk/asn1/acse/: ac
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Fri, 10 Jan 2014 12:09:31 -0800
On Jan 10, 2014, at 10:59 AM, Stig Bjørlykke <stig@xxxxxxxxxxxxx> wrote:

> Updating the RTSE dissector to a new-style was done by returning
> tvb_length(tvb), which in this case is always 0.  Returning 0 from a
> new-style dissector means this package was not for us, which is wrong
> in this case.

That's why I never converted all dissectors to new-style dissectors - having the return value both be an "is this a packet for my protocol?" indicator *and* a "length dissected in the tvbuff handed to me" indicator doesn't always work.

Something better is needed.  Perhaps handing a ptvcursor to the dissector, using the ptvcursor to handle the "how much was dissected?" part, and having the dissector return a gboolean indicating whether the packet was accepted or not would be better.  (It would also let heuristic dissectors use the same signature.)