[Previous] [Next] [Contents] [Index]


    The ASN.1 Utilities

The ASN.1 Utilities perform two main functions in Telelogic Tau:

Note:  ASN.1 support in ITEX

The ITEX C Code Generator supports only a limited subset of ASN.1. See C Code Generator for further details on the restrictions that apply.

This chapter is the reference manual for the ASN.1 Utilities.

Table of Contents 

Introduction

This chapter describes the ASN.1 Utilities. It is assumed that the reader is familiar with ASN.1.

Application Areas for the ASN.1 Utilities

The main foreseen applications of the ASN.1 Utilities are the following:

Overview of the ASN.1 Utilities

The ASN.1 Utilities support the following main functions:

  1. Syntactic and semantic correctness checks of ASN.1 modules.
  2. Generate SDL code from ASN.1 modules.
  3. Extract the ASN.1 types and values which are referred in ITEX.

In normal cases, the ASN.1 Utilities are completely hidden for the user by the SDT Analyzer and the ITEX Analyzer.

From the SDT user's point of view, an ASN.1 module is very similar to an SDL package: ASN.1 data types can be defined in a module, and then be used within SDL, using operators that are defined in ITU Recommendation Z.105. When an SDL system containing ASN.1 modules is analyzed, the Analyzer will order the ASN.1 Utilities to translate these modules into corresponding SDL packages.

In ITEX, indirect use of the ASN.1 Utilities is made by the ASN.1-by-reference table. When such a table is analyzed, ITEX orders the ASN.1 Utilities to extract the ASN.1 types and values in a specified ASN.1 module. For more information about this functionality, see ASN.1 External Type/Value References.

Using the ASN.1 Utilities

The ASN.1 Utilities are implemented in the executable asn1util. asn1util can be used in two ways:

  1. Stand-alone from the operating system (command-line interface) (UNIX only)
  2. Via the PostMaster

Command-Line Interface (UNIX only)

Usage: asn1util {options} <file> {options}

Option Meaning

-a

append the output to an existing file instead of creating a new file

-b

generate SDL body only, i.e. do not generate package headings (makes it possible to import generated SDL with #INCLUDE)

-h

display a help message

-I<dir1>[;<dir2>]

search for IMPORT-files in specified directories

-post

wait for commands via the PostMaster (see PostMaster Interface)

-r

generate references (#SDTREF) to source file

-s <file>

generate SDL output in <file>

-t<dir>

put generated code in directory <dir>

-v or -version

display version number


Example 27       

The above command translates myfile.asn to an SDL package myfile.pr, which will be put in directory target. The generated package will contain backward references to the source file myfile.asn.


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.

Translation of ASN.1 to SDL

This section describes the detailed translation rules from ASN.1 to SDL that are implemented in the ASN.1 Utilities. The translation rules all conform to Z.105, except for the cases described in Restrictions to Z.105.

General

Note: 

Since named numbers, named bits, and integer values are all mapped to integer synonyms, the same name should not be used more than once, because this will lead to name conflicts in SDL.

Module

Note: 

On UNIX, the -b option disables generation of package/endpackage, interface and use clauses. Files that have been generated this way can be included in SDL with the #INCLUDE directive, see Including PR Files.


Example 28       

is mapped to


General Type and Value Assignment

A type assignment is mapped to a newtype or a syntype, depending on the type on the right-hand side of the `::='. Tags are ignored. An ASN.1 value assignment is mapped to a synonym.


Example 29       

is mapped to


Boolean, Null, and Real

BOOLEAN, NULL, and REAL are mapped to the corresponding SDL types. Value notations for these types are mapped as follows:

ASN.1 type ASN.1 value Corresponding SDL value
ANY

not supported (conform Z.105)

BOOLEAN
TRUE
FALSE

True

False

NULL
NULL

Null

REAL
0
PLUS-INFINITY
MINUS-INFINITY
{ mantissa 31416, base 10, exponent -4 }

0.0

Plus_infinity

Minus_infinity

3.1416

Bit String

BIT STRING is mapped to the Z.105-specific type Bit_String. Named bits are mapped to integer synonyms. Values for bit strings are mapped to hexstr/bitstr expressions.


Example 30       

is mapped to


Note that Bit_String, as opposed to most other string types in SDL, has indices starting with 0! Type Bit is a Z.105 specific type with literals 0 and 1, and with boolean operators.

Available operators:

Character Strings

PrintableString, NumericString, VisibleString, and IA5String (i.e. all ASN.1 character string types with character sets that are a subset of ASCII) are mapped to syntypes of SDL Charstring. Values for these strings are mapped to corresponding Charstring synonyms in SDL.

The same operators as for Charstring are available for these types, and values of these types can be assigned freely to each other without need for conversion operators.

For example, in SDL an IA5String value can be assigned to a NumericString variable (given that the IA5String only contains numeric characters).

Choice Types

A CHOICE type is mapped to the choice-construct that is described in more detail in Choice.


Example 31        

is mapped to


The operators that are available for a CHOICE type are (assuming that C is defined as in Example 31 above):

Enumerated Types

An ENUMERATED type is mapped to a newtype with a set of literals plus some operators. The list of literals that is generated is reordered in accordance with the associated integer values.


Example 32        

is mapped to (only signature of operators shown)


The operators that are available for an ENUMERATED type are (assuming that N is defined as in Example 32 above):

Integer

INTEGER is mapped to the SDL Integer type, and ASN.1 integer values are mapped to corresponding SDL values.

Named numbers are mapped to synonyms.


Example 33       

is mapped to


Object Identifier

OBJECT IDENTIFIER is mapped to the Z.105-specific type Object_Identifier. The normal String operators are available for Object_Identifier, listed also in Sequence of Types. Indices start as usual with 1.

Octet String

OCTET STRING is mapped to the Z.105-specific type Octet_String. Octet_String is based on type Octet. This type is further described in SDL Predefined Types. The mapping for the octet string value notation to SDL is identical to bit strings, see Bit String.

Note that Octet_String, as opposed to most other string types in SDL, has indices starting with 0!

Operators available:

Sequence/Set Types

SEQUENCE and SET are both mapped to SDL struct. From an SDL point of view there is no difference between SEQUENCE and SET. In order to support optional and default components, SDL has been extended with corresponding concepts.

Note: 

Optional and default fields in struct are both non-standardized extensions to SDL.

Values are mapped to the "(. ... .)" construct (= Make! operator). Values for optional and default components are not supported. Instead, SDL tasks should be used to assign optional and default components.


Example 34        

is mapped to


The operators that are available for a SEQUENCE or SET type are (assuming that S is defined as in Example 34 above):

Sequence of Types

SEQUENCE OF is mapped to the String generator. Values are mapped to corresponding synonyms.


Example 35        

is mapped to


The normal String operators are available for Sequence types. Indices start at 1.

The operators that are available for a SEQUENCE OF type are (assuming that S is defined as in Example 35 above):

Set of Types

SET OF is mapped to the Z.105 specific Bag generator. For a more complete description of the Bag generator, see Bag.


Example 36        

is mapped to


The operators that are available for a SET OF type are (assuming that S is defined as in Example 36 above):

Subtypes

Subtypes are ignored by the ASN.1 Utilities.


Example 37       

is mapped to


Useful Types

The types GeneralizedTime and UTCTime have been defined in terms of ASN.1 as specified in X.680. It follows from their definition in X.680, together with the information about the translation rules given in this chapter, which operators are available in SDL for these types.

Support for External ASN.1 in ITEX

The ASN.1 Utilities are also used by ITEX if a TTCN test suite contains data types and constraints that are defined in the tables "ASN.1 Type Definitions By Reference" and "ASN.1 Constraints By Reference". Form more information, see ASN.1 External Type/Value References.

Since TTCN is based on the older X.228 standard, while the ASN.1 Utilities are based on the new X.680 standard, users should be careful to use the common subset of X.680 and X.228 if an ASN.1 module is to be used in TTCN. In particular there are the following differences:

Error and Warning Messages

This section contains a list of the error and warning messages in the ASN.1 Utilities. Each message has a short explanation and, where applicable, a reference to the appropriate section of the recommendations X.680 or Z.105.

Some messages include a reference to the object that is the source of the diagnostic. These messages adhere to the format adopted in SDT. See SDT References for a reference to this format and for examples.

ERROR 2000 Unknown option `#1' (UNIX only)

This error message indicates that the ASN.1 Utilities were started with an unknown option. See Command-Line Interface (UNIX only) for an overview of the valid options.

ERROR 2001 Option #1 requires #2 (UNIX only)

This error message indicates that the ASN.1 Utilities were started with an illegal combination of options. See Command-Line Interface (UNIX only) for an overview of the valid options.

ERROR 2002 Too many errors

This error message indicates that the maximum number of errors was reached when analyzing an ASN.1 module. The analysis has been aborted by the ASN.1 Utilities.

ERROR 2003 Multiple #1 paths (UNIX only)

This error message indicates an incorrect usage of the options of the ASN.1 Utilities. Probably the same option occurred more than once in the command that started the ASN.1 Utilities.

ERROR 2004 No source file specified

This error message indicates that no ASN.1 source file was specified in the command that started the ASN.1 Utilities.

ERROR 2005 Multiple source files

This error message indicates that an attempt was made to analyze more than one ASN.1 module at the same time. The ASN.1 Utilities can only handle one ASN.1 module at a time.

ERROR 2006 Cannot open #1

This error message indicates that an error occurred when the ASN.1 Utilities attempted to open a file. Modify, if necessary, the file protection and try to run the ASN.1 Utilities again. If the error persists, contact Telelogic Customer Support. Contact information for Telelogic Customer Support can be found in How to Contact Customer Support.

ERROR 2007 File `#1' already opened, cannot open it for write

This error message indicates that an error occurred when the ASN.1 Utilities attempted to open a file that was already open. Close the file and try to run the ASN.1 Utilities again.

ERROR 2008 Too long source line, max is 500

This error message indicates that there was a line in an ASN.1 module that is longer than the ASN.1 Utilities can handle. Try to split the line.

ERROR 2009 Unexpected end-of-file in #1

This error message indicates that the ASN.1 module is not complete.

ERROR 2010 Assignment (::=) expected

This error message indicates that there is a syntax error in the ASN.1 module.

ERROR 2011 Too long cstring, max is 512

This error message indicates that the character string is longer than the ASN.1 Utilities can handle. This could be caused because a `"' at the end of the string is missing.

ERROR 2012 Too long string, max is 512

This error message indicates that the string is longer than the ASN.1 Utilities can handle. This could be caused because a `"' at the end of the string is missing.

ERROR 2013 Too long number, max is 512

This error message indicates that the number is longer than the ASN.1 Utilities can handle.

ERROR 2014 Too long identifier, max is 512

This error message indicates that the identifier is longer than the ASN.1 Utilities can handle. Try to change the identifier to have a shorter name.

ERROR 2015 Illegal characters in bstring

This message indicates that an ASN.1 binary string item (used in BIT STRING and OCTET STRING) contains illegal characters. The only characters allowed are `0', `1' and white space characters.
(X.680: 9.9)

For example: '0110 1111 1 0 0 0 'B is a valid binary string item.

ERROR 2016 Illegal characters in hstring

This message indicates that an ASN.1 hexadecimal string item (used in BIT STRING and OCTET STRING) contains illegal characters. The only characters allowed are `0'-'9', `A'-'F' and white space characters.
(X.680: 9.10)

For example: 'F30C 973D'H is a valid hexadecimal string item.

ERROR 2017 `H' or `B' expected

ASN.1 BIT STRING and OCTET STRING values should be ended with a `B or an `H.
(X.680: 9.9 and 9.10).

For example: '0110'B or '1AFC'H are valid values for BIT STRING and OCTET STRING.

WARNING 2018 Unknown token `#1'

This warning indicates a syntax error in the ASN.1 module. If the token is `@', this could also mean that information object specification construct from X.681 is used in the ASN.1 module. X.681 is not supported by the ASN.1 Utilities.

ERROR 2019 Syntax error

This message indicates a syntax error in the ASN.1 module with regard to Recommendation X.680. This could be caused by a misspelling. It could also be the case that the ASN.1 module contains constructs of X.228 that are not part of X.680, or that constructs of X.681-X.683 have been used. Only X.680 is supported by the ASN.1 Utilities.

ERROR 2020 Out of memory

This message indicates that the ASN.1 Utilities ran out of memory. Try to make the ASN.1 module smaller or supply more memory. If that does not help, contact Telelogic Customer Support. Contact information for Telelogic Customer Support can be found in How to Contact Customer Support.

WARNING 2021 No semantic support for `#1'

This warning indicates that an ASN.1 construct is used that is not supported by the ASN.1 Utilities. The construct will be ignored by the ASN.1 Utilities.

ERROR 2022 Identifier expected

This message indicates a syntax error in the ASN.1 module: an identifier is required at the identified place according to X.680.

ERROR 2023 Export-file `#1' corrupt

This message indicates that the export file format of an ASN.1 module was corrupt or unknown. This error should normally not occur. Contact Telelogic Customer Support. Contact information for Telelogic Customer Support can be found in How to Contact Customer Support.

ERROR 2024 Old ASN1,#1

This message indicates that an ASN.1 construct of the older X.228 recommendation is used that has been superseded in the X.680 Recommendation.

For example:

is old ASN.1. Correct X.680 ASN.1 is:

ERROR 2025 Trying to assign `#1' to value of #2 type

This error message indicates that #2 is not a valid ASN.1 value for type #1. If the #1 value is defined at a place that is located after the indicated error position, then this error message could be caused by a restriction in the ASN.1 Utilities. Try, in that case, to move the definition of the #1 value to a place before the indicated error position.

ERROR 2026 Identifier `#1.#2' is already defined

This error message indicates that the ASN.1 module contains more than one definition of type or value #2 in module #1.

ERROR 2027 Trying to take COMPONENTS OF from type `#1' and insert in type `#2'

This error message indicates that ASN.1 type #2 uses COMPONENTS OF type #1, but type #1 is not compatible with #2. #1 and #2 should both be SEQUENCE types, or both be SET types.

ERROR 2028 Recursive expansion of COMPONENTS OF in type #1

This error message indicates that the ASN.1 type uses directly or indirectly COMPONENTS OF itself. This is not supported by the ASN.1 Utilities.

ERROR 2029 Identifier `#1' not defined

This error message indicates that ASN.1 identifier #1 is not defined.

ERROR 2030 Value `#1' is not possible to represent

This error could be caused by restrictions in the ASN.1 Utilities. Not all possible legal ASN.1 values are supported. It could also be a syntax error in the ASN.1 module.

ERROR 2031 Value `#1' not defined for type #2

This message indicates that ASN.1 type #2 makes use of value #1, but this value has not been defined.

ERROR 2032 Recursive definition for `#1'

This message indicates that the ASN.1 type is recursively defined (for example T1 ::= T2 T2 ::= T1). This is not supported by the ASN.1 Utilities.

ERROR 2033 Construct not yet implemented: `#1'

This error message indicates that an ASN.1 construct has been used that is not implemented in the ASN.1 Utilities.

ERROR 2034 No value given for component `#1' in type `#2'

This error message indicates that a component is missing in an ASN.1 value for a structured type.

WARNING 2035 Value given for #1 component

This warning indicates that a value has been given to an optional or default component of an ASN.1 SEQUENCE or SET type. Values for optional and default components cannot be translated to SDL.

ERROR 2036 Value for `#1' can not be #2

This error message indicates a semantic error in the ASN.1 module.

ERROR 2037 Selection type `#1' must be based on CHOICE, was based on #2

This error message indicates that the ASN.1 selection type construct is used for a component type that is not a CHOICE type.
(X.680: 27.1)

ERROR 2038 Component type `#1' has no component named `#2'

This error message indicates that a non-existing component of a structured ASN.1 type is used. This could be a misspelling of #2.

ERROR 2039 Type `#1' unknown, cannot parse value for it

This error message indicates that a value is given for a type, but the definition of this type is not known by the ASN.1 Utilities. It could be the case that the type is defined in another module. Value notations for types defined in other modules are not supported by the ASN.1 Utilities.

For example:

will generate the above error message if MyType is defined in another module.

As a work-around for this error, try to define the value in the same module where the type also is defined.

ERROR 2040 Multiple tags for TaggedType

This error message indicates an error with tagging the ASN.1 type.

ERROR 2041 No value defined

This error message indicates that an ASN.1 value is missing at the indicated place.

ERROR 2042 Underscores not allowed in identifiers #1

This error message indicates that underscores (`_') have been used in ASN.1 names. This is not allowed; hyphens (`-') should be used instead. The hyphens will be transformed to underscores in the conversion to SDL or TTCN.
(X.680: 9.2.1, 9.3)

WARNING 2043 Construct `#1' has no mapping in SDL

This warning indicates that an ASN.1 construct is used that can not be mapped to SDL.

Examples of ASN.1 constructs that cannot be mapped to SDL:

WARNING 2044 Constraints ignored. This warning suppressed from now on

ASN.1 constraints are parsed, but they are ignored. This warning is only given once per ASN.1 module.

ERROR 2045 Ambiguous reference, symbol `#1' imported more than once

A value is used that is imported more than once. Use an external value reference to specify unambiguously the module of the value that you want to use.

Restrictions

The ASN.1 Utilities handle most constructs of ASN.1 as defined in ITU-T recommendation X.680. The ASN.1 constructs defined in ITU-T Recommendations X.681-683 are not supported. There is no support for features defined in the old ASN.1 version X.208 that have been superseded in X.680.

For a list of restrictions to X.680 and Z.105, see ASN.1 Utilities.


[Previous] [Next] [Contents] [Index]