Basics

The basics are simple. Put your CSN.1 notation into a file using the "csn1" extension. Invoke the asn1c compiler, using the -3gl3 option and passing your .csn1 file as input. (Note: we currently support only a single CSN.1 module per input file.)

Our compiler takes each CSN.1 file, applies the CSN.1-to-ASN.1 mapping rules (see the previous chapter), and internally generates the ASN.1 objects as belonging to the ASN.1 module that you identified in the CSN.1 file. The compiler then generates code just as we would for the corresponding ASN.1, with adjustments in the encoders and decoders to meet the encoding and decoding rules specified as part of the mapping procedure.

Since the CSN.1 is compiled to ASN.1 internally, you can use a config file in the usual way. All you have to do is be careful to use the ASN.1 names in the config file rather than the CSN.1 names. For example, instead of "My Favorite Type", you would use the converted name, "My-Favorite-Type".

You may find it helpful to see the ASN.1 that resulted from the CSN.1-to-ASN.1 mapping; you can this by adding the -asn1 <filename> option to the compiler command line to tell the compiler to output the ASN.1 to a file.