Version 3.0 enhancements
This chapter presents the new services and the improvements added to the TCE-C v2.1 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 v2.1 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 function 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 function 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 casnSetErrorTrace(&context,false) function.
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 flush function for streams
A casnFlushStream function has been added to the C API.
This function gives the ability to flush a stream.
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.
Boolean True value
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++ v5.0
The runtime of the ASNSDK TCE-C v3.0 release and the runtime of the ASNSDK TCE-C++ v5.0 release can be linked in the same executable program.
ASN.1 syntax compatibility
Some new rules of the 2002 version of the ASN.1 standards could cause compatibility problems on the ASN.1 description:
For the three first points, a simple work-around is the removal of the offending syntax.
- The SIZE and FROM constraints are no longer allowed on UTCTime and GeneralizedTime types,
- A COMPONENTS OF can no longer reference a SEQUENCE or SET type with an empty root part,
- The UNIQUE keyword is now incompatible with the DEFAULT keyword in the definition of a field of an information object class,
- The SIZE or FROM constraints are no longer allowed inside a FROM constraint,
- The definition of an information object class with no finite representation for its objects is now forbidden,
- A recursive information object definition is no longer allowed,
- The syntax object.&variableTypeValueSetField is now forbidden.
For the fourth point, a simple work-around is the removal of the enclosing FROM constraint.
The other points are very improbable cases that need a case per case study. Contact email@example.com if you encounter these cases.
Extensible permitted Alphabet constraint in PER
The PER encoding rules have been clarified for a restricted character string type with a FROM constraint followed by an extensible constraint.
Until the previous version, a FROM constraint followed by an extensible constraint was ignored when computing constraints for PER. This is no longer the case.
- With the v2.1 version, this type was equivalent to:
- With the v3.0 version, this type is now equivalent to:
This change impacts the PER encoding of restricted character string types (IA5String, NumericString, PrintableString, VisibleString, ISO646String, BMPString and UniversalString) with such a combination of constraints.
With this release, the -compat 1927 compiler option can be used to obtain the behaviour of the previous release.
Extensible SET type encoding in DER
The encoding of a SET type in DER is now ordered by tag. The named types are encoded smaller tags first, whether they are in the roots, the known extensions or unknown extensions.
End of line normalization in XER
In the new release of the runtime, the XER (both Basic and Canonical) decoder performs the end of line normalization required by [W3C-XML].
The CR character followed by a LF character, the CR character alone and the LF character alone present in a XER-encoded message are now decoded as a single LF character.
Error trace enabled by default
When a trace stream is defined, the new debug feature is enabled by default. Thus, each error returned by the runtime to the user application appears now in the trace stream.
To obtain the same behaviour as in the previous release, call the casnSetErrorTrace(&context,false) function.
Local time no longer allowed for UTCTime
The runtime does no longer allow an UTCTime value expressed in local time. Only values expressed in coordinated universal time (values ending with the letter Z) or with a time differential (values ending with +hhmm or -hhmm) are allowed.
The previous versions of the runtime did not enforce this rule of [X.680].
The new version of the runtime returns an error code 19 if such a value is used to set an UTCTime value.
Changes in the XML semantic tree
The element RestrictedCharacterStringValue in the XML Semantic Tree (produced with the -tree compiler option) has been modified:
In order to be in compliance with the ASN.1:2002 standard, the elements ContaingBitString and ContaingOctetString have been added in the XML Semantic Tree.
- The representation of values of type BMPString, resp.UniversalString, in the hexBerValue attribute have been changed from the hexadecimal representation of 16 bits, resp. 32 bits, characters to the hexadecimal representation of UTF-8 encoded characters.
- An attribute charCount has been added to give the number of characters contained in the hexBerValue attribute.
The element SequenceOf in the XML Semantic Tree has been modified:
- A subelement SetSeqOfNamedType representing the sequence of named type has been added.
New customization points
To enhance the compatibility of the TCE-C runtime with various platforms, some new customization points have been added :
- The new asnfilelength function is defined in the asc_lib/src/asccstz.c file. This function is used by the file streams to get the length of a file. The default implementation of this function is system dependent because the use of fseek and ftell to get the length of a binary file is no longer portable. The user should check it against its platform.
- The default implementations of the functions (defined in the asc_lib/src/asccstz.c file) converting a floating-point value to and from a string representation are now system dependent because of the limitations of some old platforms on the NaN, -INF and INF special values. The user should check them against its platform.
- The asnOFFSETOF macro defined in the asc_lib/incl/ascupdef.h file uses now the standard offsetof definition provided in the standard stddef.h file instead of defining it. This is because there is no portable way to define this macro.
- The customizable functions casnGStoUTF8 and casnUTF8toGS in the asx_lib/src/asxcstz.c file have been renamed asnGStoUTF8 and asnUTF8toGS in order to follow the usual naming rules.