Ethereal-dev: Re: [Ethereal-dev] Need to be able to highlight multiple regions in the byte vie
On Fri, May 16, 2003 at 11:55:04AM -0700, Richard Sharpe wrote:
> In DCERPC-based protocol dissectors, and perhaps others,
Yes, there are other dissectors for which this would be useful.
> there is really a need to be able to specify at least two highlight
> regions:
>
> 1. The referent, and
> 2. The data referred to
>
> Would it be too hard to include this capability?
Probably not.
One way to do this might be to have a new structure containing the
"start", "length", and "ds_tvb" members from a "field_info", and also
containing a pointer to such a structure. Put one of those structures
inside a "field_info", and initialize the pointer to NULL; add a call to
append additional such structures to a "proto_item", taking tvb, offset,
and length arguments. Have the code that highlights regions iterate
through that list, and, when a field is selected, position the hex dump
pane to show the first of those regions ("first" could be defined either
as "first in the list" or "lowest offset in the underlying data source
tvbuff").
Note that if the item isn't a filterable field, and you try to do a
"match selected" on it, you'd have to generate multiple tests ANDed
together; we might just want to disallow "match selected" on
non-filterable ("proto_tree_add_text()") items with multiple regions.
Note also that if the regions aren't in subsets of the same underlying
data source, it's going to be a little hard to highlight all of them, so
perhaps an alternative would be to leave the "ds_tvb" member out of the
structure and just have the code abort if the data source tvbuff of the
tvbuff passed in the call isn't the same as the ds_tvb of the field.