Version 5.0 enhancements
This section presents the new services and the improvements added to the TCE-C++ v4.4 release.
The TCE-C++ Compiler and runtimes are now compliant with the 2002 release of the ASN.1 standards.
It supports the following new features:
The new RELATIVE-OID type and the new floating-point syntax, MINUS-ZERO value and NOT-A-NUMBER value for REAL values were already supported by the TCE-C++ v4.4 version.
- New SEQUENCE OF NamedType and SET OF NamedType syntax,
- New CONTAINING and ENCODED BY constraints on OCTET STRING and BIT STRING types,
- New PATTERN constraint for restricted character string types,
- New exception marker for ENUMERATED types,
- New version number for extensions,
- New possibilities for the @ notation in ComponentRelationConstraint,
- New hexadecimal encoding possibility for open types in XER,
- New block comment,
- Come-back of the object identifier predefined arc "iso(1) registration-authority(1)",
The ASN.1:2002 XML value notation is not supported.
DEFAULT values management
Up to the previous release, the encoders handle the fields of SEQUENCE and SET types with a default value the same way as optional fields. The encoder puts the value in the encoded message if and only if the value is present on the API.
The new release provides a new feature for ASN.1 default values processing. In order to give the user the maximum flexibility in the design of his application, our ASN.1 runtime offers the ability to select the behavior of the encoding:
The encoding can be changed with a new method on the asnContext object:
- The most compact encodings that is the systematic deletion of ASN.1 default values.
- Minimum processing on default value to be compliant with the ASN.1 standard (default behaviour).
If enabled, all values given on the API equal to their ASN.1 default values are absent in the encoded message.
Note that this flag does not change the behaviour of the encoder when CXER and DER canonical encoding rules are used (the encoder has not the freedom to follow the user preferences).
When undefining the asnDefaultPER macro in asc_lib/incl/ascupdef.h, encoding for default value processing can be completely disabled in the runtime. This could increase the runtime performance and will decrease runtime code size.
Concerning decoding, up to the previous release, the decoders handle the fields of SEQUENCE and SET types with a default value the same way as optional fields. The decoder puts the value on the API if and only if the value is present in the decoded message.
The new release provides a new feature where the decoder puts the default value on the API if the value is absent from the decoded message. It can be enabled with a new method on the asnContext object:
New error trace
Errors during encoding, decoding and constraint check can now be traced in the trace stream.
This new debug feature is enabled by default when a trace stream is defined. It can be disabled by calling the setErrorTrace(false) method on the asnContext object.
The error trace gives in XML format several useful debug data:
- The description of the error,
- The nature of the error (the class name of the exception),
- When decoding, the offset where the decoder stopped in the decoded message,
- The full path of the field containing the error in the decoded value.
Example of error trace:
<description>4018 Bad boolean encoding</description>
<nature>30004 Bad input</nature>
New graphical user interface
The graphical user interface of the compiler has been totally redesigned:
A project file created by a previous version of the GUI can be used with the new version of the GUI.
- The new GUI is user-friendly and easy-to-use.
- A file navigator is now included in the interface.
- The text editor supports now several file encodings (US-ASCII, ISO-LATIN-1, UTF-8,...).
- A project is mandatory to perform the compilation.
The new GUI of the compiler requires Java 1.4 at least.
With Java 1.2 or Java 1.3, the compiler can only be used in command-line mode.
Copy constructor and COMPARE operator
The runtime now provides dedicated deep copy constructors and compare operators for each type class. The copy constructor and the compare operator need respectively the asnCopCopytor and asnCopOpCmp macros.
Notes that the compare operator uses dynamic_cast that requires the Run-Time Type Information (RTTI).
Boolean True value in BER
The asnTRUE value for BER encoding is now customizable with the constant asnBERTRUE. It is defined in the asc_lib/incl/ascupdef.h file. By default it is set to 0xFF.
New features removable from the runtime
The ascupdef.h file contains the definition of preprocessor flags governing the features of the runtime.
The default customization allows the use of any ASN.1 type. However, when an ASN.1 type is not used, space can be saved by removing its support from the runtime.
The table below lists the flags to uncomment in the ascupdef.h file to remove the support of the corresponding ASN.1 types.
|flag||ASN.1 types governed by the flag|
||Open type (ANY and CLASS.&Type)
OCTET STRING with content constraint
BIT STRING with content constraint
Compatibility with ASNSDK TCE-C v3.0
The runtime of the ASNSDK TCE-C++ v5.0 release and the runtime of the ASNSDK TCE-C v3.0 release can be linked in the same executable program.
Compilation warning suppression
The asnOFFSETOF macro of the TCE-C++ ASN.1 runtime v4.4 uses the offsetoff macro to access to attributes of the generated classes. According to the C++ standard, this use of the offsetoff macro is not allowed on non-POD (Plain Old Data) C++-classes. It can be supported by a C++ compiler but can lead to compilation warnings.
This use of the offsetoff macro has been replaced in the TCE-C++ Runtime v5.0 by a generated method that initializes the offsets once at startup of your application. It is fully compliant with the C++ standard, but it increases slightly the size of the generated code and slows down slightly the startup of your application. It does not change the user code.
On some platforms with certain C++ compiler versions, a portability issue can appear.