Wireshark mailing list archives

Re: why does dissector_try_uint_new() return gboolean?


From: Martin Kaiser <lists () kaiser cx>
Date: Thu, 26 Jul 2012 19:21:46 +0200

Thus wrote Guy Harris (guy () alum mit edu):

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
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: