----- Original Message -----
From: andreas.sikkema
Sent: Friday, July 04, 2003 8:50 PM
Subject: Re: [Ethereal-dev] H.245 requesting help
> > asn.1 compilers are for wimps.
>
> I prefer to be a wimp.
>
> My own goal is to create a real Ethereal ASN compiler, but that might
> take some while.
That would be very useful.
Maybe the H245 part (but not the dissect_per... part of the dissector) can
be regenerated by that
compiler.
It would also make it easy to add suport for all other ASN1 based protocols.
I think an asn dissector tould generate calls similar to the helper routines
in the current example I wrote and then one would just do
sed -e "s/dissect_XXX/dissect_per/g"
to convert it into a per protocol.
Then providing a set of dissect_per_... dissect_ber... etc helpers that
all would take the same parameter list.
Please study the patterns for the dissect_per... calls.
Example:
static per_sequence_t DataMode_sequence[] = {
{ "application", EXTENSION_ROOT, NOT_OPTIONAL,
dissect_h245_DataMode_application },
{ "bitRate", EXTENSION_ROOT, NOT_OPTIONAL,
dissect_h245_dataModeBitRate },
{ NULL, 0, 0, NULL }
};
static int
dissect_h245_DataMode(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree)
{
offset=dissect_per_sequence(tvb, offset, pinfo, tree,
hf_h245_DataMode, ett_h245_DataMode,
DataMode_sequence);
return offset;
}
Table driven and a transform from the IDL file to a dissector should be
reasonably straightforward.
If the dissect_per... interface works well it may be easier to produce a
asn1 compiler.
If there would be an identical routine called dissect_ber_sequence() that
had the same interface
such a compiler together with a sed script could generate dissectors for any
type of asn1 encoding.
>
> Ronnie sent me a text file recently with some results from the dissector.
> It is slightly
> different from my plugin, because it show the ASN.1 structures more
> clearly. I'm
> thinking about making this behaviour optional, it distracts from the
> protocol itself,
> but could be useful when looking for encoding / decoding errors. But who
> is
> encoding / decoding by hand these days? Everyone uses one of the standard
> stacks nowadays.
I am.
Well not for PER, but for NDR(DCERPC) and other encodings I do this very
regularly :-)
>
> --
> Andreas Sikkema
> andreas.sikkema@xxxxxxxxxxx
> "While you're waiting, read the free novel we sent you.
> It's a Spanish story about a guy named `Manual'" - Dilbert
>
>
>