![]() |
![]() |
![]() |
![]() |
![]() |
Basic Concept
ASN.1 is suitable for specifying the information in a protocol and SDL is suitable for describing the semantic actions of a protocol. They are often used by standard bodies to specify protocol standards.
One of the main ideas behind ASN.1 is that you should be able to work with information in the protocol in the same way as you work with types and values in your implementation language. It should not be more difficult to create a bit-pattern in a protocol data unit then it is to assign a value to a variable. The encoder and decoder functions will automatically deal with all the details about bit-patterns and bit-layouts.
ASN.1 Utilities
The ASN.1 to SDL translator, ASN.1 Utilities, translates ASN.1 types and constants into SDL types and constants. An ASN.1 module generates an SDL package. This allows you to work with translated types and constants in the same way as any SDL type or constant. For instance, you can use them when you declare variables and when you declare signal parameters.
Information about ASN.1 to SDL translation and C representation of SDL data types is available in:
Encoding and Decoding
Encoding and decoding functionality consists of several parts.
First of all, it is the encoding and decoding algorithms themselves. You encode a variable or signal parameter into a bit-pattern by calling the encoder functions. You decode a bit-pattern into a variable or signal parameter by calling the decoder functions.
Another integral part of the coding functionality is the buffer handling. The decoder function takes the bit-pattern from the buffer and creates values for the application. The encoding function takes the internal value and encodes it into a sequence of bits in the buffer.
Error handling functionality is also present in the coding framework. Several types of errors can occur when encoding and decoding, such as buffer errors, incorrect values, decoding errors. Error handling functions allow to handle all possible erroneous situations.
Coding Access Interfaces
The coding functionality has got several access interfaces that allow you to access it in different ways.
It is possible to access encoding and decoding functions, call buffer functions and check error codes directly from the SDL diagram or from the C code in the environment files. For the C access interface, calls to encoder and decoder functions together with the appropriate buffer access procedures can be generated automatically if a few options in the user interface has been selected.
Basic SDL Interface and Extended SDL Interface
In SDL, you can use the basic interface or the extended interface. The basic interface is easy to use but gives you no possibility to control the buffer management. The extended interface gives you flexibility that the basic interface lacks.
The basic interface contains encode and decode functions which operates at SDL octet strings. The extended interface adds the possibility to access the buffer interface from within SDL and operates at a new type call CoderBuf. Furthermore, the extended interface contains a new type called CustomCoderBuf with which you could implement your own mapping between SDL and the encode and decode functions.
Within an SDL system, it is only possible to use one type of SDL interface. Either the SDL Basic Interface, the SDL Extended Interface with CoderBuf or the SDL Extended Interface with CustomCoderBuf.
C Code Interface
The coder library contains encoding and decoding functions and also several help functions for buffer management, error management and printing information. If you choose to call encoding and decoding from outside the environment files, note that:
- You need a file named <ASN.1 module>.ifc with necessary C declarations of types, literals and operators. The SDL to C Compiler generates this file if you have added the ASN.1 module to your SDL system with a use package clause.
- You need generated C files and static kernel C files. These files will be present if you have generated an SDL system with your ASN.1 module.
General information about using .ifc files and writing C code with SDL is available in:
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |