What's New in the OSS ASN.1 Tools for C++

Applies to: ASN.1/C++ 6.5

What's New in ASN.1/C++ 6.5

New Features

JSON Encoding Rules support in the ASN.1/C++ compiler and the SOED, TOED, and LED runtime libraries now conforms to Draft ITU-T Recommendation X.jsoner. The existing -json command-line option now instructs the compiler to enable support for X.jsoner at runtime.

A new #define macro can be used to remove the error message text from TOED executables. By defining OSS_REDUCED_ERROR_MSGS when compiling the generated .cpp, error messages will consist of just the 5 character message prefix, instead of the full message. Alternatively, if OSSDEBUG=0 is defined, then the error message strings will be removed completely, leaving only the return code to determine which error occurred. These features can be used to reduce the executable size on platforms with limited resources.

New samples

Samples have been created for the following protocols:

  • LTE RRC NB-IoT release 13
  • LTE S1AP NB-IoT release 13
  • LTE X2AP NB-IoT release 13
  • 3GPP XwAP (TS 36.463)
  • J2735 2016-03 version
  • LCS Application Protocol (LCS-AP) TS 29.171 V13.2.0 (2016-03)
  • LTE Positioning Protocol A (LPPa) TS 36.455 V13.1.0 (2016-03)
  • LTE RRC Protocol TS 36.331 V14.2.2 (2017-03)


The Compiler now correctly generates inner constraints data for the SOED runtime when a presence constraint is empty in a component constraint applied to a DEFAULT field. Previously, the SOED runtime mistakenly reported a presence constraint violation when such a field was absent.

The OSS ASN.1/C++ Compiler now generates TOED E-XER decoding functions for SET types so that the SET destructor works correctly with decoded values where an optional SEQUENCE OF field is absent.

The OSS.DataCallback compiler directive will no longer suppress automatic TOED decoding of nested open type fields when the -enablePartialDecode or -partialDecodeOnly option is specified. Previously, such an open type value could be left undecoded in the "encoded" field of the type representation.

The OSS ASN.1 Compiler now correctly generates PER/OER TOED partial decoders when the -enablePartialDecode (-partialDecodeOnly) option is specified.

The SOED constraint checker now correctly handles multiple type constraints when a non optional component is omitted from a full specification. Previously, the constraint checker mistakenly reported a MultipleTypeConstraints violation in this case.

What's New in ASN.1/C++ 6.4

New Features

64-bit precision in TIME type fractions

The ASN.1/C++ Compiler and Runtime now support 64-bit precision (19-20 decimal digits) in TIME type fractions. The only visible change to the C++ API is that the OssTimePoint and OssDuration classes now use 64-bit integers to represent fractional values.


TIME type values with constraints

For ISO 8601 TIME type values with a property settings constraint that specifies "Basic=Date" and "Date=Y", "Date=YM", or "Date=YMD", with no Year settings:

  • The ASN.1/C++ Compiler now correctly generates an SOED control table and TOED functions.
  • The SOED/LEAN Octet Encoding Rules (OER) encoder/decoder now correctly encodes/decodes such values.
  • Previously, the OER encoder produced a verbose encoding instead of an optimized binary encoding.

ASN.1 standards conformance

The ASN.1/C++ SOED/LEAN/TOED PER encoder-decoder implementation now conforms to the recent X.691 corrigendum (2015): an encoding contained in a BIT STRING should be at least one octet for PER ALIGNED and 1 bit for PER UNALIGNED.

OER encoding of untagged CHOICE values is now aligned with Corrigendum 1 of the X.696 standard. Previously, such CHOICE values were encoded BER-style: the outermost tag of the chosen alternative was encoded only once.

The ASN.1/C++ runtime implementations are now aligned to conform to ITU-T X.680 Clause 46.3c. This clause states that the minutes component of a GeneralizedTime type value can be omitted when the difference between local time and UTC is an integral number of hours. Previously, a false error could be issued when the minutes component was absent.

What's New in ASN.1/C++ 6.3

New Features

Support for the JSON Encoding Rules

The ASN.1/C++ Compiler and the Space-Optimized Encoder/Decoder (SOED), Time-Optimized Encoder/Decoder (TOED), and Lean Encoder/Decoder (LED) Runtime libraries all support the JavaScript Object Notation (JSON) Encoding Rules. With JSON encoding rules, you can preserve the power of text (JSON) encodings, yet take advantage of the conversion to or from binary (ASN.1) encodings for fast transmission or compact storage.

New command-line option

The -json command-line option enables code generation for JSON.

New API functions

The PDU::binary2JSON() and PDU::JSON2Binary() methods have been added to convert data encoded in ASN.1 binary form (e.g., BER, PER, DER, OER, etc.) to JSON text encoding form and vice versa.

What's New in ASN.1/C++ 6.2.1


The ASN.1/C++ Tools for Windows packages now include binaries targeted for Microsoft Visual Studio 2015, along with those targeted for MVS2005 through MVS2013. All Microsoft Visual Studio versions (VS2005 through VS2015) are now in a single installer package.

What's New in ASN.1/C++ 6.2

New Features

Partial Decoding

The partial decode feature enables you to

  • Decode preselected fields from incoming messages at a high speed.
  • Directly access the decoded field in the callback method without traversing from the top of the PDU.
  • Get the offset and length of the field encoding in a binary BER/DER/OER/C-OER message. It allows you to replace the value of the field directly in the binary message, if the encoding of the new value is of the same length as of the previous one.

For more information, see Partial Decoding.

New Command-line Options

The -enablePartialDecode and the -partialDecodeOnly options instruct the compiler to generate code that enables the ConcretePDU::partialDecode() TOED Runtime API method. These options are available when the -toed option is specified or implied by default.

New Compiler Directives

The OSS.DataCallback and OSS.InfoCallback compiler directives have been added.

New API Methods

The ConcretePDU::partialDecode() and ossTestCPPPD() API methods have been added.

New Samples

You can find the partial_decode and s1ap_pd_r12 samples that illustrate the partial decoding feature usage in the samples/advanced.

The provided set of samples has been updated:

  • The new standards/cam_denm sample shows you how to handle CAM and DENM messages specified by the ETSI EN 302 637-2, ETSI EN 302 637-3, and ETSI TS 102 894-2 standards.
  • The LTE samples for 3GPP Release 12 (RRC, S1AP, X2AP, M2AP, M3AP, SbcAP) have been added.

What's New in ASN.1/C++ 6.1

New Features

Enhanced OER Support

The ASN.1/C++ Compiler and the TOED, SOED, and LED Runtimes have all been augmented to support OER as defined in "Rec. ITU-T X.696 | ISO/IEC 8825-7", rather than only the subset of ASN.1 types as defined in the "NTCIP 1102:2004 Octet Encoding Rules (OER) Base Protocol" document.

The Canonical Octet Encoding Rules (C-OER) as defined in "Rec. ITU-T X.696 | ISO/IEC 8825-7" are now supported by the ASN.1/C++ Compiler and the TOED, SOED, and LED Runtimes.

Sample Code Generation

The ASN.1 C++ Compiler can now generate sample code for a user-provided asn1 specification. The sample code is an application that uses the C++ interface of the runtime to encode/decode generated values that conform to the specification.

New Samples
  • Samples that illustrate use of the SBc-AP, M2AP, and M3AP LTE protocols based on 3GPP Release 11.
  • A sample that illustrates using the DSRC Message Set Standard, SAE J2735_200911.
Default Error Handling

The default error handling mechanism is now "full-exception mode". Therefore, legacy code written for C++ runtimes v6.0 and older using "no-exception mode" default error handling should be modified to either catch exceptions of the new ASN1RuntimeException class or revert to "no-exception mode". To revert to the legacy "no-exception mode", add the following line before instantiating or calling any OSS ASN1 objects or functions:

Non-breaking Spaces

The ASN.1/C++ Compiler now supports non-breaking spaces in the input ASN.1 syntax as UTF-8 format Unicode characters. Other Unicode characters that are treated as spaces are supported in UTF-8 format as well.


The ASN.1/C++ Compiler now generates huge values of base 2 REAL types without losing precision.

Choice alternatives containing an untagged choice are now canonically ordered correctly by the compiler.

The ASN.1/C++ Compiler now accepts GeneralizedTime values where the minutes and seconds components are omitted and a time difference component is present.

The compiler now accepts comments within compiler command files. The "--" characters specify the beginning of a comment and can be placed anywhere on the line. The comment continues until either a subsequent "--" is reached or the line ends.

What's New in ASN.1/C++ 6.0

New Features

Octet Encoding Rules (OER) Support

Support for the Octet Encoding Rules (OER), as specified by the NTCIP 1102:2004 Octet Encoding Rules (OER) Base Protocol document, has been implemented in the ASN.1/C++ Compiler, the TOED, and ASN.1 Studio.

OER messages can generally be encoded/decoded significantly faster compared to BER and PER messages, while being only slightly less compact than PER messages.

Decode Open Types without AUTOMATIC_ENCDEC

Decode open types with table (component relation) constraints, without setting the AUTOMATIC_ENCDEC runtime flag. The compiler now generates a class derived from the OssConstrainedOpenType class when an open type has a table constraint applied that restricts the set of possible types the open type can contain.

New Methods
  • New methods have been added to support decoding into preallocated memory buffers:

    Generated files now contain the following additional methods:

    void set_const_data(const <Type> & d);
    const <Type> *get_const_data() const;


    void set_const_<Type> (const <Type> &);
    const <Type> *get_const_<Type>() const;

    This method has been added to the PDU class:

    virtual int decode(OssControl &ctl, EncodedData &input, EncodedBuffer &output);

    The following method has been added to the ASN1Handle class:

    int is_constant() const;

    Two methods have been added to the OssOpen class, which replace the previous get_decoded() method:

    int get_decoded_data(PDU &);
    int get_decoded_data(PDU &) const.

  • The reset() method has been added to the EncodedBuffer and the PEREncodedBuffer classes. Use this method to reset the buffer to its initial state when you want to reuse the same buffer for the output of several encoding/decoding operations.

  • Two methods have been added to the ASN1Handle class:

    This method prints the data contained in ASN1Handle to a specified pre- or newly allocated memory buffer in ASN.1 value notation format:

    char *toString(OssControl &ctl, char *buffer = NULL, unsigned long length = 0) const;

    This method returns the size of the memory buffer required by the first function to print the data:

    unsigned long toStringLength(OssControl & ctl) const.

  • Two methods have been added to the EncodedBuffer class:

    The following method pretty-prints the data contained in EncodedBuffer in hexadecimal format

    int print_hex(OssControl & ctl) const;

    The following method prints the data contained in EncodedBuffer in XML format:

    int print_xml(OssControl & ctl, int pretty-print) const.
New Samples

Samples illustrating the use of protocols based on the SAE J2735 Intelligent Transportation standard, as well as the RRC, S1AP, and X2AP LTE protocols based on 3GPP Release 10 have been added.


The SOED decoders will now fill in an open type pduNum field unless the NOCONSTRAIN runtime flag is set. Previously, the decoders did not fill in the pduNum field for new (union based) open types when the AUTOMATIC_ENCDEC flag was not set.

Some methods (decode, encode, pre_decode, etc.) will now return new error codes and messages when memory manager errors occur. Previously, most such errors produced the common FATAL_ERROR (18) error code and an error message such as "x0087S: Undefined memory-management error #N.". To check for a specific error you had to parse the message and extract the #N value.

This documentation applies to release 6.5 and later of the OSS® ASN.1 Tools for C++.

Copyright © 2017 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C++ is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C++ are available to you.