Ethereal-dev: Re: [Ethereal-dev] "Problems" with current PER dissection

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

From: Tomas Kukosa <tomas.kukosa@xxxxxxxxxxx>
Date: Thu, 18 Sep 2003 15:10:13 +0200
Andreas Sikkema wrote:
> The current PER dissection has two UI issues:
> - Too many subtrees (especially with choices) and
> - Subtree names (in sequences mainly) are called after their type,
>   not their name from the ASN source, which has confused me already.
> 
> I am not sure what to do. I have already tried to rewrite parts of the
> PER and H.225 dissectors, but this is a long road. So I quit ;-)..
> 
> Does anyone have a better idea?

Hi,
  I was thinking about it and it seems not to be easy. 
I write small PER based dissector. So my experince is not large but my
plan is following:

1) Decide how the protocol tree should look in "user" and "expert"
modes. I would prefer in "user" mode output like an "old" H.323 plugin
(maybe, with some small changes).

2) Make coding rules for PER dissector usage so as to fit item 1)
   a) Discriminate between ASN.1 types and variables!!! (maybe,
"variable" is not the right ASN.1 term)
   ... (for some other proposed rules (mainly sequent upon rule a) see
below)

3) Change PER dissector functions parameters or structures ONLY if it is
REALLY NECESSARY!

4) Change PER dissector to fit item 1). Especially tree depth
decreasing.

5) Change H.225/H.245 dissectors to use coding rules 2). It will be a
hard work  :-(.

6) Look if we get what we expected.

(optional) 7) Make Perl or Python script for creation of source code
basis from ASN.1 source.


Comments are welcome.

 Regards,
   Tom

-----------------------------------------------------------------------------
Other recomedations for possible coding rules:
b) Registered fields corresponds with ASN.1 variables.
    static int hf_proto_variable1 = -1;
    static int hf_proto_variable1 = -1;

c) Registered subtrees corresponds with ASN.1 types (only for structured
type).
     static gint ett_proto_Type1 = -1;
     static gint ett_proto_Tvariable2 = -1;  /* variable1 has
"anonymous" type */

d) Variable dissect functions have following form.
     static int dissect_proto_variable1(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree)

e) Type dissect functions have following form.
     static int dissect_proto_Type1(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree, int hf_index, proto_item
**item/*???*/, ...) /* other parameters if necessary */

f) Sequence tables corresponds with sequence types (may be anonymous
type "Tvariable1").
   Variable dissect functions are called from this table.
     static per_sequence_t Type1_sequence[] = {
       { "variable11", ..., dissect_proto_variable11},
       { "variable12", ..., dissect_proto_variable12},
       { NULL, 0, 0, NULL }
     };

g) Sequence PER decoding calling has following form.
     dissect_per_sequence(tvb, offset, pinfo, tree, 
                          hf_proto_variable10, 
                          ett_proto_Type1, 
                          Type1_sequence);

...