![]() |
![]() |
![]() |
![]() |
![]() |
Using the ASN.1 Utilities
The ASN.1 Utilities are implemented in the executable asn1util. asn1util can be used in two ways:
Command-Line Interface
Usage: asn1util [options] { <file> [options] }*
generate encode/decode type information for the SDL Suite and asn1_cfg.h configuration file
append the output to an existing file instead of creating a new file
generate SDL body only, i.e. do not generate package headings (makes it possible to import generated SDL with #INCLUDE)
generate all operators for the SDL enumerated type as listed in Z.105. Default is to emit some of the operators in Z.105
generate values for SDL Make operator with optional and default support
Join all ASN.1 modules from <files> into one SDL package <name> (see Example 32)
Perform substitution for keywords listed in <file> (see Keywords substitution)
wait for commands via the PostMaster (see PostMaster Interface)
add <prefix> to the names of generated encode/decode functions.
In the generated ASN.1 coder structures specified prefix is added after the standard yASN1_ prefix, for example:
CHOICE_TYPE_DECL(EXTERN_INFO, yASN1_<prefix>_NetworkAddress);
CHOICE_TYPE_DEF(GLOBAL_INFO, yASN1_<prefix>_NetworkAddress, EXTMARKER_ABSENT, NONE_EXTMARKER, ... );
asn1util -r -s myfile.pr -c myfile.asn(myfile.asn contains ASN.1 module MyModule)The command in the example translates the module MyModule in file myfile.asn to an SDL package MyModule in file 'myfile.pr'. The generated package will contain backward references to the source file 'myfile.asn'. Encode/decode type nodes are generated in C-source file 'MyModule_asn1coder.c' and C-header file 'MyModule_asn1coder.h'. A configuration file "asn1_cfg."' with compile switches for coder related files is generated.
asn1util AsnModule1.asn AsnModule2.asnIf no options are specified, then asn1util only performs syntactic and global semantic analysis for AsnModule1.asn and AsnModule2.asn, no output is generated.
If no input file is specified, then asn1util does nothing except showing help or version number if correspondent options are specified.
asn1util -J Join-Module -s my.pr my1.asn my2.asnThe ASN.1 modules from the files my1.asn and my2.asn will be joined together in the SDL package Join_Module. Name clashes may occur if the same name is available in different ASN.1 modules the filed are joined. These problems are resolved according to a set of name clash resolving rules, see Joining modules.
Configuration file generation
For the -c option encode and decode type information is generated to C-files. Also asn1util performs the analysis of ASN.1 types and some features used in the specification and generates file asn1_cfg.h.
This file contains compile switches that are referenced from inside the coders code. When asn1_cfg.h is used by the build process the preprocessor automatically throws away useless parts of the code from encoding and decoding related files. This helps to reduce the code size and improve the performance of encoding and decoding procedures.
For example, if the ASN.1 file does not contain OCTET STRING and SET OF types in the module, the following definitions
#ifdef CODER_AUTOMATIC_CONFIG#define CODER_NOUSE_OCTET_STRING#define CODER_NOUSE_SET_OF#endifwill be included in the configuration file.
This feature can be turned on by the CODER_AUTOMATIC_CONFIG compile switch. For more information about available compile switches for the configuration see Encoding configuration.
PostMaster Interface
The ASN.1 Utilities can also be invoked via the PostMaster. An example of this is when an SDL system that uses ASN.1 modules is analyzed. The Analyzer will then order the ASN.1 Utilities, via the PostMaster, to perform a translation of the ASN.1 modules to SDL packages. For a complete description of the PostMaster, see The PostMaster.
On UNIX, the PostMaster communication may also be invoked by starting asn1util with the -post command-line option. asn1util will then wait for commands sent to it from the PostMaster.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |