Skip to content
ASN.1 compiler & runtime
C++ Java CMake Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
compiler antlr: resolve some parse errors with semantic predicates May 12, 2016
runtime
.gitignore
.travis.yml
README.md

README.md

Build Status Coverage Status

Description

A compiler from ASN.1 to C++ code and run-time library for encoding/decoding data using BER/DER. Run-time library can be used independently from ASN.1 compiler.

Structure

The top directory consists of these sub-directories:

  • compiler -- A Java ASN.1 to C++ compiler
  • runtime -- C++ runtime library for encoding/decoding of the data

ASN.1 grammars

The Java ASN.1 to C++ compiler depends on JavaCC ASN.1 grammar, this grammar is a bit modified comparing to original one. It is far from complete (e.g. does not parse Information objects). However, ASN.1 compiler generates C++ code using that grammar.

An experimental Antlr4 ASN.1 grammar with partial support of notations from X.680, X.681, X.682 and X.683 is available as an option of ASN.1 compiler. Right now, compiler does not produce any C++ code if you this grammar is selected.

Examples

Several ASN.1 files and generated C++ code is available for protocols:

Compile & Test runtime library

The runtime library uses CMake to build itself. As a result of compilation static and shared libraries will be produced.

  1. Ensure that you are located in the directory with runtime library sources;
  2. Create a temporary build directory (e.g. build) with help of 'mkdir' command: mkdir build;
  3. Change current working to build directory: cd build;
  4. Execute CMake to create Makefile: cmake ..;
  5. Execute GNU make to build static and shared libraries: make;

Unit tests can be built during library compilation, if CMake command line contains option -DBUILD_UNIT_TESTS=1. Unit tests require Boost test framework, on Windows set environment variable BOOST_ROOT equal to your Boost installation path (e.g. BOOST_ROOT="c:\boost_1_55_0").

Coverage data can be calculated, if CMake command line contains option -DDO_COVERAGE=1. There is no need to specify -DBUILD_UNIT_TESTS=1 if you are going to see coverage data, because it will be enabled automatically. For example, to compile unit tests and collect coverage data during their running, execute cmake -DDO_COVERAGE=1 .. instead of command in step 4 above.

To run unit tests execute command: ./tests/TestBER.

Running ASN.1 compiler

  1. Move to compiler directory
  2. Execute mvn package
  3. Move to target directory if no errors
  4. Execute java -jar asn1-compiler-<...>.jar and follow on-screen instructions

Generate Debian/Ubuntu runtime package

The runtime library uses CPack (feature of CMake) to generate an installable Debian package. If compilation of runtime library was successful, execute make package to create package.

Something went wrong with that request. Please try again.