This repo is for demonstrations regarding ASN.1
We use the asn1c
tool, which is a ASN.1 C compiler.
asn1c
is an open-source asn1 compiler for C/C++. See it in https://github.com/vlm/asn1c
Basically, you provide the asn1 specification, and the asn1c
compiler produces a bunch of .h
and .c
files.
For each type declared in the asn1 specification, a corresponding .h
file is produced, containing a _t
struct
that represents the asn1 type.
The rest of the source files are code for encoding and decoding.
In your program, you need to include these header files, and then you can encode and decode these types.
So first you compile all the sources generated by the asn1c
compiler to a static library, and then you link
your program against this library.
In order to run the examples, you need to build the docker image in the docker
directory.
You can then run a container and use the asn1c
tool to run the examples.
The Rectangle example is the first created, and it is less generic and modular in its structure. The Foo example is a better.