Wireshark-dev: Re: [Wireshark-dev] why does dissector_try_uint_new() return gboolean?
From: Martin Kaiser <[email protected]>
Date: Thu, 26 Jul 2012 19:21:46 +0200
Thus wrote Guy Harris ([email protected]):

> On Jul 24, 2012, at 5:02 AM, Martin Kaiser wrote:

> > Would it make sense to change dissector_try_uint_new() to return
> > guint?

> Bear in mind that there are some cases where a dissector can
> successfully dissect a packet with zero bytes of data, so overloading
> an "amount dissected" return value to also indicate, with a return
> value of 0, that the packet isn't for the protocol in question,
> doesn't work.

ok, but does dissector_try_uint_new() distinguish between a valid 0
bytes packet and a packet that a certain dissector doesn't handle?

> One possibility might be to:

> 	introduce a new type of dissector, which is handed a ptvcursor
> 	instead of a tvbuff, and which returns a gboolean that's TRUE if the
> 	packet is for the dissector and FALSE if not;

I've had another look and for my specific case, I can avoid
dissector_try_uint...() completely. Only one section type is allowed for
the field I'm looking at, there's no need for choosing the dissector
based on a tag byte etc.

I can get away with find_dissector() and call_dissector(), which gives
me the number of dissected bytes. For now, I'll go for that and don't
break other parts ;-)

Best regards,

   Martin