Dafocus logo a&apm;b logo

The CSN.1 module

Although their acronyms are similar, CSN.1 is substantially different from ASN.1.
ASN.1 defines an abstract data structure: in other words, an ASN.1 specification tells you, for example, that we have a structure with some fields in it, or a union, an array and so on.
In ASN.1 we describe our data structure as we do when we are declaring C structs.
When we need to actually send the data over the network, we follow the encoding rules we have choosen. These encoding rules, like BER o PER, tell us that a structure is always coded in a given way, an integer is always coded in another way and so on.
Therefore any ASN.1 tools can easily generate a C data structure and some C code able to take a BER or PER coded binary stream and decode it into that C structure.
CSN.1, instead, defines at bit-level the encoded stream. A CSN.1 definition says, for example, that we expect a 1 followed by 8 more bits or a 0 followed by 4 bits and another 0:

< my data > ::= 1 <x: bit(8)> | 0 <y: bit(4)> 0;

Most of the CSN.1 tools read the CSN.1 specification file and produce a CSN.1 parser; this parser, once compiled, reads the encoded binary stream and when it recognize some valid elements in it invokes a user defined callback function.
In other words, it generates code that will say to you: hey, I found the 1 followed by the 8 bits you were expecting: the 8 bits are 11001001; do whatever you like.
This is better than decoding manually, but it still means that for every CSN.1 definition, you have to manually:

  • define your data structure
  • define a function that copies the values into the right field of the structure
This means reading and understanding thoroughly each CSN.1 specification and manually updating the data structures and call back functions everytime the CSN.1 source changes.
Encodix has a unique approach on this issue. It contains an A.I. algorithm which is able to create the data structures automatically starting from the CSN.1 definition. It also creates all the related encoding/decoding functions.
Handling CSN.1 with Encodix is now really a matter of copy and pasting the source from the standard.

See also:
Encodix description... >>>
Generated languages... >>>
The Access module... >>>
The generations process and examples... >>>