Ethereal-dev: Re: [Ethereal-dev] Newbie dissector question

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

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Thu, 20 Apr 2006 08:03:21 +0200 (CEST)
Hi,

On Wed, 19 Apr 2006, Simon Berthiaume wrote:

> Hi, I was planning of building a dissector for a school project, but
> the (crappy) protocol I want to dissect has (at least) a little issue:
> it has not explicit "version" field. To determine the version the
> application has to guess based on the "type" and "length" fields. How
> should that be handled by the dissector if I wanted to display this
> version and/or allow filtering based on version? I quickly read through
> the whole readme.developer file, but found nothing for this specific
> kind of issue. Is there some kind of trick I could do using the
> proto_tree_add_XXX_hidden() functions and some "fake tvb" containing
> only the version number? Any ideas?

Current wisdom it to add your version number using proto_tree_add_uint()
and PROTO_ITEM_SET_GENERATED the proto tree item that was added.

> Another question, is there a way to make a dissector be called only
> when multiple conditions are met? This way I could make separate
> dissectors for each version/type combo of the variable length body part
> of the protocol I want to dissect. It would make each source file much
> less "crowded" and perhaps easier to extend the thing later-on than if I
> had to put everything in the same one (I know this is mostly cosmetic
> concern). Anyone has comments for or against this idea?

Nhaa, not really. Make a 'selector' function which does nothing more that
determining the version and branch out of there.

Thanx,
Jaap