I could not get this to work as you suggested. It seems to work with the following:
#define proto_registrar_get_id(x) \
(dfilter_lookup_token(x))
The parameter seems to be the protocol abbreviation plus the field abbreviation:
(eg: pep.t0462_status) an it seems to return the ID (int).
As far as your question about not needing integer IDs.......
I am still a newcomer to Ethereal and do not feel qualified answering that.
Thanks
-----------------------------------------------------------------------------------------------
John S. Nicholas The Boeing Company
Stable: john.s.nicholas@xxxxxxxxxx Phone: 206-662-0298
-----------------------------------------------------------------------------------------------
> ----------
> From: Gilbert Ramirez[SMTP:gram@xxxxxxxxxx]
> Sent: Friday, February 16, 2001 11:40 AM
> To: Nicholas, John S
> Cc: ethereal-dev@xxxxxxxxxxxx
> Subject: [Ethereal-dev] Re: [Ethereal-users] Can I get the field ID?
>
> On Fri, Feb 16, 2001 at 11:32:21AM -0800, Nicholas, John S wrote:
> >
> > I plan to have our database/tool generate this for all fields. So I guess the IDs
> > should all be generated OK. I guess I just need to lookup the IDs given the
> > fieldname. I do not see any other dissectors using any dfilter calls, I suppose
> > that is frowned upon. Is it possible to call dfilter_lookup_token in my
> > dissector?
>
> No other dissector has needed to convert strings to IDs. Yes,
> go ahead and call dfilter_lookup_token() for now. I'll move the
> table of names-to-IDs into proto.c, where it belongs.
>
> In fact, go ahead and use:
>
> #define proto_registrar_get_id(x) \
> (dfilter_lookup_token((x))->id)
>
> for now, and the next release of Ethereal will have a
> proto_registrar_get_id() function that will do what you want.
>
>
> >
> > Is there another, better way to do this?
>
> Don't use field names, but use field IDs. :)
>
>
> Side though... I doubt that integer IDs are needed at all.
> What if we used hfinfo*'s as unique IDs?
>
> --gilbert
>
> _______________________________________________
> Ethereal-dev mailing list
> Ethereal-dev@xxxxxxxxxxxx
> http://www.ethereal.com/mailman/listinfo/ethereal-dev
>