Ethereal-dev: [Ethereal-dev] Re: [Ethereal-users] Can I get the field ID?

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Fri, 16 Feb 2001 14:40:23 -0500
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