Auf dieser Website werden Cookies verwendet, um das Nutzererlebnis zu verbessern. Mit Ihrem Besuch erklären Sie sich hiermit einverstanden. Weitere Informationen hierzu finden Sie in der Datenschutzerklärung.

Ich akzeptiere

Objective Systems

ASN1C ASN.1 Compiler

ASN1C ASN.1 Compiler Objective Systems' ASN1C compiler translates ASN.1 and/or XML schema (XSD) source specifications into C, C++, C#, or Java source code. Developers can use this code to translate structures/objects to and from finished ASN.1 messages using any of the ITU-T/ISO encoding rules (BER, CER, DER, PER or XER) as well as the ISO/IEEE Medical Device Encoding Rules (MDER) and NTCIP Octet Encoding Rules (OER). ASN1C also includes tools for converting XSD specifications to ASN.1 specifications and vice versa.

ASN1C generated code consists of type definitions and encode/decode functions (or methods) that provide a complete Application Programming Interface (API) for working with the message definitions contained within an ASN.1 specification.

In addition to the compiler, a run-time library of common encode/decode functions is also part of the package. This library contains routines to encode and decode ASN.1 primitives (BOOLEAN, INTEGER, etc.). The ASN1C compiler assembles a series of calls to these functions to accomplish the encoding or decoding of more complex message types.

All that a programmer needs to do to get an encoder/decoder up and running is to:

  1. Run ASN1C to generate code for a given ASN.1 or XSD specification,
  2. Develop an application to call functions/methods within the generated code,
  3. Compile/link the application, generated code, and run-time libraries.

To assist with items 2 and 3, the compiler also has the capability to generate sample reader and writer programs as well as a makefile to build all of the generated code.


ASN.1 to C/C++

Both the C and C++ version use a common base run-time library consisting of a set of low-level primitive C functions for encoding and decoding the base types. The code generation is done predominantly in C and provides a complete set of C API functions for all defined ASN.1 types.

The C++ code generation capability adds a set of class "wrappers" that hide most of the details in invoking the encode/decode functions. These wrappers provide additional services specific to C++. These include automatic initialization of variables of generated types through constructors, easier assignment and testing of data through operator overloading, and virtual callback interfaces through the event handling mechanism.