For your second question:
This is probably what you are looking for:
proto_registrar_get_nth(guint hfindex);
defined in epan/proto.c
/* Finds a record in the hf_info_records array by id. */
header_field_info*
proto_registrar_get_nth(guint hfindex)
{
register header_field_info *hfinfo;
PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo);
return hfinfo;
}
thanks,
Ravi.
On 5/24/06, John R. <
jhoger@xxxxxxxxx> wrote:How do others handle dissection of parameter arrays? Basically, I have
type (indicates basic type like UINT16 or SINT8, etc.) and a length
field (in bytes). Dividing the length field by the basic type size
gives me the number of elements.
For most of my parameters I register a field in the hf table and then
add the tree node in the usual way. However, since this is a
many-to-one relationship, I'm confused. I'm not sure how to do it
since the hf table is "static," i.e. I guess I cannot add
myprot.ufield.0
, myprot.ufield.1, etc.
Should I just provide 0 for the id field when I add to the treeview?
If this is the recommended way, then I guess I wouldn't be able to
filter for values in parameter arrays?
Second question: is there an API to trade an hf record integer handle
for a pointer to the record? I need to get access to type information
encoded in the hf table and I don't want to do a linear search through
hf[] or replicate the information in another data structure.
Finally, on the feature request side (please ignore unless wish lists
interest you), it sure would be nice if there was a way to register
custom FT_xxx types into the format table. I have some custom formats
that appear throughout my protocol but I'm 100% certain no one else
would ever want them (usually the custom code is taking some integer
value, converting it to a floating point, scaling/translating it and
appending a units value, like "MHz"). So it would be wrong to extend
the basic types that Ethereal supports but it would keep my code short
and make my dissector look more like a basic dissector (less custom
code in the dissector itself).
Thanks,
-- John.
P.S. if there is a developer FAQ somewhere that covers any of this
feel free to redirect me. I didn't find anything except the README and
the online developer documentation.
_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev
_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev