From e95095457c4d83c02850b811fb28711c0b3d1c23 Mon Sep 17 00:00:00 2001
From: xsipewe The ASN.1 compiler takes an ASN.1 module as input and generates a
- corresponding Erlang module which can encode and decode the data-types
- specified. Alternatively the compiler takes a specification module
- (se below) specifying all input modules and generates one module with
- encode/decode functions. There are also some generic functions which
- can be used in during development of applications which handles ASN.1
- data (encoded as BER or PER).
By default in OTP 17, the representation of the BIT STRING
- and OCTET STRING types as Erlang terms have changed. BIT
- STRING values are now Erlang bitstrings and OCTET STRING values
- are binaries. Also, an undecoded open type will now be wrapped in
- a
To revert to the old representation of the types, use the
-
By default in OTP 17, the representation of the
To revert to the old representation of the types, use option
+
In R16, the options have been simplified. The back-end is chosen +
In OTP R16, the options were simplified. The back end is chosen
using one of the options
Another change in R16 is that the generated
Another change in OTP R16 is that the generated function
+
Compiles the ASN.1 module
Compiles the
If
If
If one wishes to compile a set of Asn1 modules into one - Erlang file with encode/decode functions one has to list all +
If it is needed to compile a set of
File1.asn File2.asn -File3.asn-
The output files will in this case get their names from the
- configuration file. If the configuration file has the name
-
Sometimes in a system of ASN.1 modules there are different - default tag modes, e.g. AUTOMATIC, IMPLICIT or EXPLICIT. The - multi file compilation resolves the default tagging as if +File3.asn +
The output files in this case get their names from the
+ configuration file. If the configuration file is named
+
Sometimes in a system of
Another unwanted effect that may occur in multi file compilation - is name collisions. The compiler solves this problem in two - ways: If the definitions are identical then the output module - keeps only one definition with the original name. But if - definitions only have same name and differs in the definition, - then they will be renamed. The new names will be the definition - name and the original module name concatenated.
-If any name collision have occurred the compiler reports a - "NOTICE: ..." message that tells if a definition was renamed, +
Name collisions is another unwanted effect that can occur in + multi file-compilation. The compiler solves this problem in one + of two ways:
+If a name collision occurs, the compiler reports a
+
-
The encoding rule to be used. The supported encoding rules
- are BER (Basic Encoding Rules),
- PER aligned (Packed Encoding Rules) and PER unaligned.
- If the encoding rule option is omitted
The generated Erlang module always gets the same name
- as the ASN.1 module and as a consequence of this only one
- encoding rule per ASN.1 module can be used at runtime.
+ as the
- By this option the Distinguished Encoding Rules (DER) is chosen.
+ With this option the Distinguished Encoding Rules (DER) is chosen.
DER is regarded as a specialized variant of the BER encoding
- rule, therefore the
- The BIT STRING type will be decoded to the "compact notation".
+ The For details see
- For details, see Section
+ This option implies the This option implies option
- The BIT STRING type will be decoded to the legacy
- format, i.e. a list of zeroes and ones.
+ The For details see
- This option implies the
For details, see Section
+
This option implies option
Use the same Erlang types to represent BIT STRING and
- OCTET STRING as in R16. For details see
This option is not recommended for - new code.
+Use the same Erlang types to represent
For details, see Section
This option is not recommended for new code.
- Tells the compiler to generate functions for conversion between
- names (as atoms) and numbers and vice versa for the EnumTypeName specified. There can be multiple occurrences of this option in order to specify several type names. The type names must be declared as ENUMERATIONS in the ASN.1 spec.
- If the EnumTypeName does not exist in the ASN.1 spec the
- compilation will stop with an error code.
- The generated conversion functions are named
+ Tells the compiler to generate functions for conversion
+ between names (as atoms) and numbers and conversely for
+ the specified
+ If
+ The generated conversion functions are named
Do not compile (i.e do not produce object code) the generated
-
Do not compile (that is, do not produce object code) the
+ generated
Adds
Specifies the directory
Specifies directory
When one of the specialized decodes, exclusive or
- selective decode, is wanted one has to give instructions in
- a configuration file. The option
When using one of the specialized decodes, exclusive or
+ selective decode, instructions must be given in
+ a configuration file. Option
The instructions for exclusive decode must follow the
-
For instructions for exclusive decode, see Section
+
You can also find the instructions for selective decode
- in the
-
For instructions for selective decode, see Section
+
A buffer that holds a message, being decoded may
- also have some following bytes. Now it is possible to get
- those following bytes returned together with the decoded
- value. If an asn1 spec is compiled with this option a tuple
-
A buffer that holds a message, being decoded it can also
+ have some following bytes. Those following bytes can now
+ be returned together with the decoded value. If an
+ ASN.1 specification is compiled with this option, a tuple
+
If this option is given, the generated
With this option, the generated
All macro names generated by the compiler are prefixed with
-
All record names generated by the compiler are prefixed with
-
Causes warnings to be treated as errors.
Any additional option that is applied will be passed to - the final step when the generated .erl file is compiled. +
Any more option that is applied is passed to
+ the final step when the generated
The compiler generates the following files:
Encodes
Encodes
Returns an Erlang term which is an example of a valid Erlang
- representation of a value of the ASN.1 type
Returns an Erlang term that is an example of a valid Erlang
+ representation of a value of the
Performs a test of encode and decode of types in
Schematically the following happens for each type in the module:
+Schematically, the following occurs for each type in the module:
{ok, Value} = asn1ct:value(Module, Type),
{ok, Bytes} = asn1ct:encode(Module, Type, Value),
{ok, Value} = asn1ct:decode(Module, Type, Bytes).
-
- The
The