Question

I am trying to work with a communication protocol (S1AP to be specific) and I am trying to define messages to test.

The LTE 36.413 specification details this protocol and also give an ASN.1 file definition at the bottom of the pdf. I have seen ASN files being used in the dissector for WireShark, and I am guessing that I might be able to use it to generate messages in accordance with the specification.

I was wondering how you use ASN.1 files. I have been researching and have found information on ASN.1 compilers and other information related to it, but all the information has left me very confused as nobody has explained clearly how to use it. Could someone please help me understand how to use it?

Was it helpful?

Solution

After much hunting I have found out what ASN.1 files are.

These ASN.1 files essentially contains protocol description and packet description. Using these ASN.1 files, you can generate .c and .h files to be used in some application you wish to use these for. This is really handy because you don't have to create your own message database. You just need to compile the ASN.1 files and you C files will be compiled for your use.

Now, you must be wondering, how do I compile this? Well, you generally need some sort of an ASN.1 compiler. You have to pay for some, but I was able to find an open source one that works with Linux and Windows. There is potential that it may work on MAC as well since that is UNIX based as long as you have the necessary dependencies. In any case here is the link to this web page. I will not explain how to use it because I think this web page does a lovely job at documenting usage. Hope this helps someone as much as it helped me.

Check out the compiler here http://lionet.info/asn1c/blog/

If that link does not work for you, you may need to try a commercial one such as OSS Nocklava ASN1.C compiler or if money is of concern, then it might be worth making your own database despite the amount of time this will take.

All the best.

OTHER TIPS

  1. ASN is a data description language. Like you said, the ASN file definition found specifies the representation of your message data to comply with the encoding and decoding under the S1AP protocol.

  2. An ASN file needs to be compiled. The output from the compilation will give you some code specification and body (in most cases a .h and .c code file) to automatically serialize/deserialize any message data to the S1AP data model regardless of the platform encoded from and send to.

  3. To rapidly test and learn how to use your ASN.1 schema you can use this service: http://asn1-playground.oss.com/

  4. Also, For a more in depth and concise explanation of what makes ASN.1 powerful please read this: https://www.thanassis.space/asn1.html. The author also shares an open source ASN.1 compiler developed under the supervision of the European Space Agency.

  5. As a side note, it might worth investigating the use of Protocol Buffers as it represents a very similar technology augmented with, arguably, more modern features such as backward/forward data description compatibility and reflection: https://developers.google.com/protocol-buffers/docs/cpptutorial

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top