ASN1C icon ASN.1 to C/C++

ASN.1 to C/C++ diagram

The ASN1C ASN.1 compiler can generate C and/or C++ source code for encoding and decoding ASN.1 messages. The following ASN.1 encoding rules are supported:

  • PER - aligned (APER) and unaligned (UPER)
  • OER (including canonical COER)
  • XER and OSys XML

Generated C/C++ encoders and decoders make use of a custom-built, fast memory management algorithm that provides for optimal speed. In addition, compact code generation is supported through a number of code generation options and configuration file options that make it possible to include or exclude items within a specification. This can be done down to the element level making it possible to exclude optional and extension elements that are known to be not used for particular use cases.


  • Intuitive mapping between ASN.1 type and C/C++ structures and classes.
  • In-memory and stream-based encoding and decoding.
  • Supports generation of utility functions to print, compare, and copy data in generated structures.
  • Supports generation of random test data at both compile and run-time and reader and writer programs
  • Supports generation of makefiles and Visual Studio project files to build generated code.
  • Comprehensive ASN.1 feature coverage including support for table constraints, content constraints, extension element groups, all ASN.1 types, and ASN.1 value notation.
  • Cross-platform - generated code will compile on any platform type with an ANSI-standard C or C++ compiler.
  • SAX-like event handler interface allows for user-defined callbacks
  • NAS extensions make it possible to generate C/C++ code to support 3GPP layer 3 messages using a specially constructed ASN.1 specification.