Technical topic: ASN.1 - An introduction to ACN

Jump to: navigation, search


ACN was created as a simple ASN.1-companion language allowing to describe custom binary encodings for complex data structures.

It is useful in the following case:

  • you need to implement a binary packet encoder/decoder for a legacy protocol
  • no standard ASN.1 encoding rules (PER, DER, XER, OER, JER...) fits
  • ECN, the Encoding Control Notation is too complicated or you have no tool available
  • the targeted encoding is not too complex

ACN works in pair with ASN.1 and provides various ways to customize the memory layout of data structures.

Here is a simple example, starting from a basic integer type:

   MyInteger ::= INTEGER (0..7)

If you choose to represent a data of this type using the ASN.1 PER, the encoding will be optimal: 3 bits.

However, your protocol may say that this has to be encoded using 32 bits with a little endian representation. ACN offers the syntax for this:

   MyInteger [size 32, endianness little, encoding pos-int]

ACN aims at being easy to read, powerful enough for real-life cases, and in general very efficient. The following sections detail all the possibilities offered by the language for the various ASN.1 data types. You will see that in several cases, ACN can decribe encodings that are even more compact than uPER.

Note that there are encoding specifications which are not covered by the scope of ACN. For example it is not meant to describe complex textual encodings. Avdanced encoding rules can only be expressed using a notation such as ECN or the non-ASN.1-based DFDL language. Of course with the extra power also comes an extra price - if you target an embedded platform with limited resources, these languages lack tool support.

If you provide to ESA's free ASN1SCC compiler an ASN.1 and ACN grammar, you will obtain:

  • C and SPARK/Ada code for data structures and binary encoders/decoders using no heap and no system calls
  • HTML documentation of the memory layout corresponding to your ACN specification
  • Automatic test cases that do a roundtrip encode-decode with 100% code coverage
  • Bridge to access the ASN.1 data model from various languages (Python, MicroPython, SDL, Simulink, and even VHDL) (via TASTE)