Wireshark mailing list archives

why does dissector_try_uint_new() return gboolean?


From: Martin Kaiser <lists () kaiser cx>
Date: Tue, 24 Jul 2012 14:02:38 +0200

Dear all,

I have a tvbuff that contains one or more dvb sections. I don't know the
number of sections or their lengths (only the overall length but that
doesn't really matter).

Each table starts with a tag, I can get the dissector table for dvb/mpeg
sections and call dissector_try_uint_new(...) to dissect the first
section based on its leading tag byte.

Unfortunately, dissector_try_uint_new() returns true or false, not the
number of dissected bytes. Therefore, I can't find the start of the 2nd
and any following sections.

This is surprising since dissector_try_uint_new() knows the number of
dissected bytes. The few places where it's used now are converting the
gboolean return value back to an integer

  gboolean ret; 
  ret = dissector_try_uint_new(...);
  return ret ? tvb_length(tvb) : 0; 


Would it make sense to change dissector_try_uint_new() to return guint?
Should I leave dissector_try_uint_new() as it is and introduce a similar
function returning guint?

Or am I misunderstanding something? I suppose it is ok for a new-style
dissector to return something other than 0 or the complete tvb length.

Thanks,

   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: