Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] ans2wrs

From: "Kukosa, Tomas" <tomas.kukosa@xxxxxxxxxxx>
Date: Fri, 22 Jun 2007 12:08:18 +0200
Hi Anders,
 
> that stuff,  X.509 etc looks to be new challanges for asn2wrs :( a problem I have noted is that there
> CLASSES are used before beeing defined which asn2wrs do not like.

It is not supported in asn2wrs to use the class before its definition but there is a solution.
It can be solved with "forward declaration" in the conformance file.
 
If only the class name is used before the definition it is enough to put only class name into conformance file.
E.g.
--- asn.1 file ---
SupportedPolicyQualifiers CERT-POLICY-QUALIFIER ::=  {...}
CERT-POLICY-QUALIFIER ::= CLASS {
  &id         OBJECT IDENTIFIER UNIQUE,
  &Qualifier  OPTIONAL
}
--- cnf file ---
#.CLASS CERT-POLICY-QUALIFIER 
--- ---
 
If class fields are used before class definition too it is necessary to put them into conformance file too.
E.g.
--- asn.1 file ---
PolicyQualifierInfo ::= SEQUENCE {
       policyQualifierId       CERT-POLICY-QUALIFIER.&id ({SupportedPolicyQualifiers}),
        qualifier               CERT-POLICY-QUALIFIER.&Qualifier  ({SupportedPolicyQualifiers}  {@policyQualifierId})OPTIONAL }
CERT-POLICY-QUALIFIER ::= CLASS {
        &id             OBJECT IDENTIFIER UNIQUE,
        &Qualifier      OPTIONAL }
--- cnf file ---
#.CLASS CERT-POLICY-QUALIFIER
&id ObjectIdentifierType
&Qualifier
#.END
--- ---
 
If you are not sure how to define fields you use following way:
Put only class name into cnf file and export it
#.CLASS CERT-POLICY-QUALIFIER
#.EXPORTS
CERT-POLICY-QUALIFIER
#.END
Compile it with -e option. It will export class definition into -exp.cnf file.
Then you can copy exported definition back into cnf file and remove class from exports directive (if you do not want to export it for anothor reason)
 
> we shoul consentrate on fixing up asn2wrs so it can read most asn1 files unchanged before hitting ROS.
 
I will really fix problem with selection type as soon as I have time (hope on Monday)
 
Regards,
  Tomas