On Fri, Feb 16, 2001 at 10:15:15AM -0800, Nicholas, John S wrote:
> Hi,
>
> I am trying to implement a dissector with out knowing the details of the structure being decoded.
> I fact I do know the structure, but it would be much easier to code if I can fill a structure (actually
> more than one) with the field names and type, length, etc. We have a tool/database that has the
> format information and I want to be able to have that tool fill in the structure for me. Anyway, I think
> I can do it if I can get the ID (used by proto_tree_add_item) given a string containing a fieldname.
>
> In other words, how do I do this?
> proto_tree_add_item(pep_tree_sub, stringtmp, tvb, offset, 4, value32);
>
> where stringtmp is a variable containing "hf_pep_t0462_status"
This is a question better-suited for ethereal-dev; I'm moving
the discussion there.
How do you plan on handling the field registration? Ethereal needs
to know the names of all your fields so that it can do display
filtering for you. When you register your fields, you get the ID.
Name->ID translation is done via dfilter_lookup_token(),
in the dfilter code. Arguably, the name->id translation should
be handled in proto.c. It just so happened that the dfilter
code was the first thing that needed it, so I put it there.
--gilbert