Home
8 Tutorial: Using ASN.1 Data Types
Contents
1. will be lost when leaving xOutEnv This section can be used to encode outgoing data with the selected coder functions Please remove the comments and send the data with your communications interface lt SendViaCommunicationsInterface data datalen gt must be replaced char data int datalen BufInitWriteMode Buf XENV ENC PER ENCODE Buf tASN1TypeInfo amp yASN1 z RFC1157 SNMP O0 Message void amp yPDef snmp request xmk TmpDataPtr Paraml BufCloseWriteMode Buf BufInitReadMode Buf datalen BufGetDataLen Buf data BufGetSeg Buf datalen SendViaCommunicationsInterface data datalen gt BufCloseReadMode Buf Do your environment actions here xmk_result XMK_TRUE to tell the caller that signal is consumed END User Code break case Init BEGIN User Code Do your environment actions here xmk result XMK TRUE to tell the caller that signal is consumed END User Code break case Close BEGIN User Code Do your environment actions here xmk result XMK TRUE to tell the caller that signal is consumed END User Code break 318 Telelogic Tau 4 5 SDL Suite Getting Started July 2003 Creating the Transfer Syntax default xmk result XMK FALSE to tell the caller that signal is NOT consumed and to be handled by t
2. Please follow the instructions below 1 Select the SDL to C Compiler tab 2 Inthe Environment box de select the Environment functions option and the Environment header file option 3 Press the Full Make button 322 Telelogic Tau 4 5 SDL Suite Getting Started July 2003 Appendix A Appendix A Example 10 The RFC1157 ASN 1 Module RFC1157 SNMP DEFINITIONS BEGIN IMPORTS ObjectName ObjectSyntax NetworkAddress IpAddress TimeTicks FROM RFC1155 SMI top level message Message SEQUENCE version version 1 for this RFC INTEGER version 1 0 community community name OCTET STRING data e g PDUs if trivial PDUs ANY authentication is being used protocol data units PDUs CHOICE get request GetRequest PDU get next request GetNextRequest PDU get response GetResponse PDU set request SetRequest PDU trap Trap PDU GetRequest PDU 0 IMPLICIT SEQUENCE request id RequestID error status always 0 ErrorStatus error index always 0 ErrorIndex variable bindings VarBindList GetNextRequest PDU 1 July 2003 Telelogic Tau 4 5 SDL Suite Getting Started 323 Chapter 8 Tutorial Using ASN 1 Data Types Trap PDU 4 IMPLICIT SEQUENCE request id RequestID error status ErrorStatus always 0 error index ErrorIndex always 0 variable bindings VarBindList GetResponse PDU 2 IMPLICIT SEQUENCE request
3. Signal snmp request IF OUT SIGNAL snmp request snmp request OUT SIGNAL1 snmp request snmp request XENV_BUF BufInitWriteMode Buf XENV_ENC BER_ENCODE Buf tASN1TypeInfo amp yASN1 Message void amp yPDef snmp request SignalOut gt Param1 OUT_SIGNAL2 snmp_request snmp_request XENV_BUF BufCloseWriteMode Buf REL EAS E SIGNAL END IF OUT SIGNAL snmp request snmp request Signal Init IF OUT SIGNAL Init Init OUT SIGNAL1 Init Init XENV BUF BufInitWriteMode Buf OUT SIGNAL2 Init Init XENV BUF BufCloseWriteMode Buf REL EAS E SIGNAL END IF OUT SIGNAL Init Init Signal Close IF OUT SIGNAL Close Close OUT SIGNALi1 Close Close XENV BUF BufInitWriteMode Buf OUT SIGNAL2 Close Close XENV BUF BufCloseWriteMode Buf REL EAS E SIGNAL END IF OUT SIGNAL Close Close July 2003 Telelogic Tau 4 5 SDL Suite Getting Started 317 Chapter 8 Tutorial Using ASN 1 Data Types Example 8 Environment functions Cmicro The following code is part of the environment file skeleton and dis plays the function that handles of the out signals Switch xmk TmpSignalID case snmp request BEGIN User Code Use yPDP snmp request xmk_TmpDataPtr to access the signal s parameters ATTENTION the data needs to be copied Otherwise it
4. for instance the Other Documents marker see Figure 191 on page 301 300 Telelogic Tau 4 5 SDL Suite Getting Started July 2003 July 2003 Creating the Abstract Syntax Organizer asn_snmp sdt eT As IRE ara ee Eo eee evel ied SDT mw home develop hev henkes_asn1_project asn_snmp sdt mw home develop hev henkes asni project Analysis Model Used Files SDL System Structure asn_snmp Tw asn snmp ssy SNMP two SNMP sbk snmp process Tw snmp processi spr LP Other Documents Figure 191 Selection of chapter marker 3 From the Edit menu select the Add Existing command The Add Existing window opens Add Existing Figure 192 The Add Existing window 4 Click the folder image button in order to find your ASN 1 module The Select file to add window opens Select the directory you want to search and change the search filter by typing asn in the Filter field Click the Filter button The avail able ASN 1 modules are now displayed in the Files window Select Telelogic Tau 4 5 SDL Suite Getting Started 301 Chapter 8 Tutorial Using ASN 1 Data Types module and click the OK button The Select file to add window clos es 6 The selected module is now displayed in the Add Existing window Just click the OK button to add the module to your system The module should now be visible in the Organizer in your selected chapter The ASN 1 modules are now adde
5. id RequestID error status ErrorStatus error index ErrorIndex variable bindings VarBindList SetRequest PDU 3 IMPLICIT SEQUENCE request id RequestID error status ErrorStatus always 0 error index ErrorIndex always 0 variable bindings VarBindList IMPLICIT SEQUENCE enterprise OBJECT IDENTIFIER agent addr NetworkAddress generic trap INTEGER coldStart 0 warmStart 1 linkDown 2 linkUp 3 type of object generating trap see sysObjectID in 5 address of object generating trap generic trap type 324 authenticationFailure 4 egpNeighborLoss 5 enterpriseSpecific 6 specific trap INTEGER if generic trap is not Telelogic Tau 4 5 SDL Suite Getting Started specific code present even Appendix A enterpriseSpecific time stamp time elapsed between the last TimeTicks re initialization of the network entity and the generation of the trap variable bindings interesting information VarBindList request response information RequestID INTEGER ErrorStatus INTEGER noError 0 tooBig 1 noSuchName 2 badValue 3 readonly 4 genErr 5 ErrorIndex INTEGER variable bindings VarBind SEQUENCE name ObjectName value ObjectSyntax VarBindList SEQUENCE OF VarBind END July 2003 Telelogic Tau 4 5 SDL Suite Getting Started 325 Chapter 8 Tut
6. must be trans lated into a form that the SDL suite understands Within the SDL suite this translation is handled by the ASN 1 Utilities The ASN 1 Utilities tool is invoked automatically when the SDL system is analyzed and it allows you to e perform syntactic and semantic analysis of your ASN 1 modules generate SDL code from the ASN 1 modules generate type information for encoding and decoding using BER or PER This means that when you are using the ASN 1 utilities you create type nodes A type node is a static variable that describes the properties and characteristics of an ASN 1 data type including tag information needed by BER PER encoders and decoders The variable is named yASN1 type name All nodes are generated in files named asnimodule name asnicoder c and declarations to access them in files named asnimodule name asnlcoder h Note The type nodes are auto created by ASN 1 Utilities and must not be edited Make Process Note Make dialog only This section is only valid if you build and analyze your project using the Organizer s make dialog The default makefile in the SDL suite determines the relationship be tween source files header files object files and libraries in your project Telelogic Tau 4 5 SDL Suite Getting Started 309 Chapter 8 Tutorial Using ASN 1 Data Types 310 However the default makefile does not include the generated files in the make process To include the environ
7. Chapter 8 July 2003 Tutorial Using ASN 1 Data Types This tutorial describes how to use ASN 1 types and values in the SDL suite You will learn how to import and use ASN 1 modules in your SDL diagrams how to generate code and how to encode and decode your ASN 1 types using BER or PER encoding The tutorial contains all steps from creating ASN 1 data types to the implementation of the ASN 1 data types in your source code To illustrate the functionality and the work flow small examples are presented throughout the tutorial The SNMP protocol is used as a base to illustrate how ASN 1 could be applied on a typical SNMP stack In order for you to fully take advantage of this tutorial you should be familiar with the SDL suite and the basics of ASN 1 Additional information regarding ASN 1 types and its usage togeth er with the SDL suite can be obtained in chapter 2 Data Types in the SDL Suite Methodology Guidelines chapter 14 The ASN 1 Utilities in the User s Manual chapter 58 Building an Application in the User s Manual chapter 59 ASN 1 Encoding and De coding in the SDL Suite in the User s Manual Telelogic Tau 4 5 SDL Suite Getting Started 297 Chapter 8 Tutorial Using ASN 1 Data Types Introduction 298 The Abstract Syntax Notation One ASN 1 is a notation language that is used for describing structured information that is intended to be trans ferred across some type of interface or communication me
8. In gt Param1 Decoding incoming signals Before the SDL system can use the information that is encapsulated in the incoming signals a number of tasks must be performed Most of them are automatically performed by the SDL suite but some must be handled manually The following list defines the steps involved in the decoding process You must perform steps 1 and 2 manually while steps 3 through 5 are generated by the SDL suite 1 314 In order to auto generate a correct environment file declare incom ing and outgoing signals in the SDL system If signal parameters are declared as ASN 1 types a top level node in the ASN 1 module should be used see Example 4 on page 305 It is recommended that Telelogic Tau 4 5 SDL Suite Getting Started July 2003 July 2003 Creating the Transfer Syntax you use the same top level type when decoding as you do when en coding 2 Extract the encoded information from the protocol specific packet and transfer it to a data buffer This should be implemented in C code in the environment file Instructions and further information is available in chapter 58 Building an Application in the User s Man ual The functions and function calls of the following functionality are auto generated in the environment file 3 Memory for the signal structure is allocated 4 The BER DECODE function is called The function is defined in the decoding library and handles the actual decoding proc
9. d to your project Example 1 Adding ASN 1 modules to SDL project In the SNMP example the three modules RFC1155 SMI RFC1157 SNMP and USE SNMP have been added to the project Organizer asn_snmp sdt nw fhomedevelop hewhenkes_asn1_projectiasn_snmp sdt ne fhomedevelop hewhenkes_asn1_project SDL System Structure asn snmp asn snmp ssy SNMP SNMP sbk snmp process snmp processi spr Other Documents USE SNMP use snrmrp asn sm RFC1155 SMI rici 155 smiasn Est RFC1157 SNMP r cl157 snmp asn Figure 193 View of added ASN 1 modules Importing ASN 1 Modules After the modules have been added to the project they must be made available to the SDL system This is done by importing the modules to 302 Telelogic Tau 4 5 SDL Suite Getting Started July 2003 July 2003 Creating the Abstract Syntax the SDL system file When the modules have been imported the ASN 1 data types can be used as regular SDL types Follow the instructions below to import the modules in the SDL dia grams 1 From the Organizer open the system file lt system_name gt ssy 2 Enter the name of the added modules in the package reference frame which is located outside the system frame See Figure 194 3 Save the diagram Example 2 Importing ASN 1 modules In the SNMP example the three modules RFC1155_SMI RFC1157_SNMP and USE_SNMP are imported Bm Editor System asn snmp 1 home develop hev he 1_proj
10. dium It is es pecially used for defining communication protocols As ASN 1 is widely popular the SDL suite allows you to translate ASN 1 data types to SDL and to encode decode ASN 1 data types By using ASN 1 data types in the implementation of your application you will optimize your development process The following list dis plays some of the advantages of ASN 1 e ASN 1 is a standardized vendor platform and language indepen dent notation Avast number of telecommunication protocols and services are de fined using ASN 1 This means that pre defined ASN 1 packages and modules are available and can be obtained from standardization organizations RFCs etc For instance the ASN 1 data types defin ing SNMP are available in RFC 1157 e When ASN 1 data types are transmitted over computer networks their values must be represented in bit patterns Encoding and de coding rules determining the bit patterns are already defined for ASN 1 The SDL suite supports BER and PER encoding e ASN 1 enables extensibility This means that it simplifies compati bility of systems that have been designed and implemented large time frames apart e The SDL suite and the TTCN suite can share common data types by specifying these in a separate ASN 1 module Implementation of ASN 1 When importing ASN 1 data types to your SDL system you need to translate the ASN 1 definitions to SDL The SDL suite does this for you using a tool called ASN 1 U
11. ect asn_snmp SEGRE heal EN ER e Sere d use RFC1155 SMI use RFC1157 SNMP use LISE SNMP i systemasn_snmp Signal env gt farnmp_request Init Close nmp reo Figure 194 View of the imported ASN 1 modules Telelogic Tau 4 5 SDL Suite Getting Started 303 Chapter 8 Tutorial Using ASN 1 Data Types Assigning Values to the Data Types When the modules are imported to the SDL system you are free to de clare signal parameters and variables of ASN 1 data types The param eters and variables are treated as regular SDL parameters and variables and you assign values to them in the same manner as you normally do When declaring signals that are transporting information defined using ASN 1 it is recommended that you define a top level type of a ASN 1 module as the signal parameter When your variables have been assigned values you have created the abstract syntax Example 3 Assigning values to variables In this example the variable Reply has been declared as the type Message This type is a top level type that is defined in the ASN 1 module SNMP1157 asn see Example 10 on page 323 SDL Editor Process snm dcl Ly reply Message Figure 195 Declaration of the reply variable When the variable reply has been declared you can use it in the SDL diagram as a regular SDL variable Figure 196 on page 305 shows how reply is used as the argument of a s
12. ess 5 The decoded signal is sent to the SDL system This is performed by the SDL_Output function Generating Template Files Targeting Expert Follow the instructions below to generate environment files type node files and the template makefile using the Targeting Expert 1 From the Generate menu select the Targeting Expert command The SDL Targeting Expert window opens 2 From the drop down menu located above the Partitioning Diagram Model frame select Light Integrations and the desired SDL to C Compiler It is possible to used either Cadvanced or Cmicro The pre defined alternative specifies the type of compiler needed for the generation 3 Select the SDL to C Compiler tab 4 In the General box select Analyze generate code 5 In the Environment box select Environment functions Environment header file 6 Select the Communication tab In the Coders box select the Gener ate ASN 1 coder functions check box Telelogic Tau 4 5 SDL Suite Getting Started 315 Chapter 8 Tutorial Using ASN 1 Data Types 7 Press the Full Make button This generates the environment file Note Encode and decode calls are only generated if the Coder functions option is enabled In your target directory you will now find the generated files including system name env c Cadvanced env c Cmicro This is the environment skeleton file e system name ifc This is the environment header file e asnlmodule
13. g process You must perform steps 1 and 2 manually while steps 3 through 5 are generated by the SDL suite 1 Inorder to auto generate a correct environment file declare incom ing and outgoing signals in the SDL system If signal parameters are declared as ASN 1 types a top level type in the ASN 1 module should be used see Example 4 on page 305 It is recommended that you use the same top level type when decoding as you do when en coding 2 Extract the encoded information from the protocol specific packet and transfer it to a data buffer This should be implemented in C code in the environment file Instructions and further information is available in chapter 58 Building an Application in the User s Man ual The functions and function calls of the following functionality are auto generated in the environment file 3 Memory for the signal structure is allocated 4 The BER DECODE function is called The function is defined in the decoding library and handles the actual decoding process 5 The decoded signal is sent to the SDL system This is performed by the SDL Output function 320 Telelogic Tau 4 5 SDL Suite Getting Started July 2003 Compiling Your Application Compiling Your Application After you have created the transfer syntax you are ready to compile and build your application including the edited environment file and the template makefile Follow the appropriate instructions as presented in e Usin
14. g the edited files Organizer on page 321 Using the edited files Targeting Expert on page 322 Using the edited files Organizer Please follow the instructions below 1 Click the SDL system symbol in the Organizer 2 From the Generate menu select the Make command The SDL Make window opens 3 Change your options in the make dialog according to 0 following list Select Analyze amp generate code From the Code generator drop down list select Cadvanced De select Generate environment header file De select Generate environment functions De select Generate ASN 1 coder Select the Makefile button Select Generate makefile and use template and enter the gener ated template makefile new name env tmp in the text field Select Compile amp link From the Use standard kernel drop down list select Applica tion Figure 201 on page 322 shows the Make dialog with the selected options July 2003 Telelogic Tau 4 5 SDL Suite Getting Started 321 Chapter 8 Tutorial Using ASN 1 Data Types SDL Make a FT Application ss AN fhome develop ba sdt sdtdir SCTAAPPLCLENY El r Qo J homefdevelopihevisnmp grisnmp gritarget ro me j a e EINEN Figure 201 The Make dialog Compiling 4 Specify your target directory where the generated files will be stored 5 Press the Full Make button Using the edited files Targeting Expert
15. hat includes a skeleton of the environment functions The en vironment file is written in C code and by editing this file you can spec ify the behavior of signals from the SDL system and of signals going in to the SDL system An environment header file or system interface header file can also be created This file contains all type definitions and other external defini tions that are necessary in order to implement the environment func tions Note Environment files There are several ways to create the environment file You can e auto create the file This procedure is covered in this tutorial make your own file from scratch This is a more advanced pro cedure and is only partially covered in this tutorial Encoding Decoding When creating the transfer syntax the messages that will be transferred must be encoded and the incoming messages must be decoded The type of encoding rules to apply is specified in the environment file This means that the encoding decoding function calls must be included in the environment file Telelogic Tau 4 5 SDL Suite Getting Started July 2003 July 2003 Creating the Transfer Syntax The SDL suite supports the standard BER and PER encoding decoding schemes but it also allows you to use a user specified encoding scheme ASCII encoding is available in the SDL suite as well but it does not support encoding of ASN 1 types Type Nodes To include the ASN 1 data types in your application they
16. he Cmicro Kernel break Encoder and Decoder function calls As stated earlier it is not necessary to auto create the environment file By copying another environment file or by writing it from scratch you can customize the environment file for your needs If you do so you must use the correct syntax of the encoding and decoding functions The syntax of the BER function calls is BER ENCODE Buffer amp Typenode amp Signalparameter BER DECODE Buffer amp Typenode amp Signalparameter The syntax of the PER function calls is PER ENCODE Buffer amp Typenode amp Signalparameter PER DECODE Buffer amp Typenode amp Signalparameter Example 9 Encoding and Decoding function calls The following function calls are being used in the SNMP example BER ENCODE Buf tASN1TypeInfo amp yASN1 Message void amp yPDef snmp request SignalOut Paraml BER DECODE Buf tASN1TypeInfo amp yASN1 Message void amp yPDef snmp reply SignalIn gt Param1 July 2003 Telelogic Tau 4 5 SDL Suite Getting Started 319 Chapter 8 Tutorial Using ASN 1 Data Types Decoding incoming signals Before the SDL system can use the information that is encapsulated in the incoming signals a number of tasks must be performed Most of them are automatically performed by the SDL suite but some must be handled manually The following list defines the steps involved in the decodin
17. ignal that has been received by the SDL system 304 Telelogic Tau 4 5 SDL Suite Getting Started July 2003 Creating the Abstract Syntax wait_reply Figure 196 Usage of the reply variable Example 4 Declaring signals The signal snmp reply in the previous example must be declared before it can be used As mentioned before the argument of the sig nal is a top level type of the ASN 1 module SDL Editor System asn_snmp 2 E EL E SES use RFC1155 SMI use RFC1157 SNIv systemasn snmp Signal Figure 197 Signal Declarations July 2003 Telelogic Tau 4 5 SDL Suite Getting Started 305 Chapter 8 Tutorial Using ASN 1 Data Types Creating the Transfer Syntax 306 The SDL suite offers several way to create the transfer syntax The available coding access interfaces are e Basic SDL interface e Extended SDL interface e C code interface In this tutorial only the C code interface will be covered For a complete description of ASN 1 encoding and decoding please see chapter 59 ASN 1 Encoding and De coding in the SDL Suite in the User s Manual Using the C code interface the transfer syntax can be created either us ing the Organizer s make dialog or using the Targeting Expert Both methods are presented in this tutorial When using the Targeting Expert you can select to use the Cadvanced SDL to C Compiler or the Cmicro SDL to C Compiler when creating the transfer syntax Both methods wil
18. ihome developiba sdt sdtdir SCTAAPPLCLENV Vag Ho thomeidevelopihevisnmp_grisnmp gritarge D puse J on n pee f e Figure 200 The Make dialog generating template files 5 Press the Full Make button Note Encode and decode calls are only generated if the Generate ASN 1 coder option is enabled in the make dialog In your target directory you will now find the generated files including system name env c This is the environment skeleton file e system name gt ifc This is the environment header file July 2003 Telelogic Tau 4 5 SDL Suite Getting Started 311 Chapter 8 Tutorial Using ASN 1 Data Types system name env tpm This is the template makefile e asnlmodule name asnlcoder c asnlmodule name asnlcoder h These files are the type nodes created by the ASN 1 utilities Editing the Generated Files the Organizer As the generated files only consist of skeleton functions you must edit the files to suit the functionality of your application Note Make a habit of making a copy of the environment file and the tem plate makefile after they have been edited Otherwise the edits will be overwritten if the files are re generated from the Make dialog by mistake 1 Edit the environment file system name env c file using any text editor In the skeleton file macros are included but they are not defined To define the macros create a system name env hfile and enter the code manua
19. it XENV BUF BufCloseWriteMode Buf RELEASE SIGNAL END IF OUT SIGNAL Init Init Signal Close IF OUT SIGNAL Close Close OUT SIGNALI1 Close Close XENV BUF BufInitWriteMode Buf OUT SIGNAL2 Close Close XENV_BUF BufCloseWriteMode Buf RELEASE SIGNAL END IF OUT SIGNAL Close Close Encoder and Decoder function calls As stated earlier it is not necessary to auto create the environment file By copying another environment file or by writing it from scratch you can customize the environment file for your needs If you do so you must use the correct syntax of the encoding and decoding functions The syntax of the BER function calls is BER ENCODE Buffer July 2003 Telelogic Tau 4 5 SDL Suite Getting Started 313 Chapter 8 Tutorial Using ASN 1 Data Types amp Typenode amp Signalparameter BER DECODE Buffer amp Typenode amp Signalparameter The syntax of the PER function calls is PER ENCODE Buffer amp Typenode amp Signalparameter PER DECODE Buffer amp Typenode amp Signalparameter Example 6 Encoding and Decoding function calls The following function calls are being used in the SNMP example BER ENCODE Buf tASN1TypeInfo amp yASN1 Message void amp yPDef snmp request SignalOut Paraml BER DECODE Buf tASNITypeInfo amp yASN1 Message void amp yPDef snmp reply Signal
20. l be covered as well This section starts with a short introduction and the actual instructions are presented in Generating Template Files the Organizer on page 310 e Generating Template Files Targeting Expert on page 315 Introduction To be able to transfer the abstract syntax between two nodes in network you must first create the transfer syntax The transfer syntax represen tation is then transmitted in a protocol buffer When creating the transfer syntax you must perform the following tasks Generating template files Editing the generated template files The template files must be generated in order for you to include the ASN 1 data types in the compilation and code generation processes The template files extract information from your SDL system and create a skeleton Often these template files do not contain sufficient informa Telelogic Tau 4 5 SDL Suite Getting Started July 2003 July 2003 Creating the Transfer Syntax tion to meet the demands of the application and therefore you must edit the templates The template files that are generated cover the following areas e the environment functions e the make process However the SDL suite needs additional information in order to create the environment file Before the generation you must determine which encoding decoding schemes to use and you must create type nodes files Note Environment File There are several ways to create the environ
21. lly Example 5 on page 313 shows the unedited SNMP environment file Save the environment file Edit the template makefile system name env tpmif necessary Save the template makefile AF Y m Make copies of the edited files and save the copies in a different folder Notes e Jn order to transfer the information on the network you must add socket commands to an appropriate header file e If you want to use more than one encoding scheme for instance BER and PER you must enter the appropriate encoding function calls in the environment file 312 Telelogic Tau 4 5 SDL Suite Getting Started July 2003 Creating the Transfer Syntax Example 5 Environment Functions The following code is part of the environment file skeleton and dis plays the function that handles the out signals pas ENV OUT START Signals going to the env via the channel Signal env Signal snmp request IF OUT SIGNAL snmp request snmp request OUT SIGNAL1 snmp request snmp request XENV BUF BufInitWriteMode Buf XENV ENC BER ENCODE Buf tASN1TypeInfo amp yASN1 Message void amp yPDef snmp request SignalOut Paraml OUT SIGNAL2 snmp request snmp request XENV_BUF BufCloseWriteMode Buf RELEASE SIGNAL END IF OUT SIGNAL snmp request snmp request Signal Init IF OUT SIGNAL Init Init OUT SIGNAL1 Init Init XENV BUF BufInitWriteMode Buf OUT SIGNAL2 Init In
22. ment file This tutorial shows how to auto generate the file However you can also make your own file from scratch This procedure is more advanced and is only partially covered Note Type Nodes The type nodes are auto created by ASN 1 Utilities and must not be edited Note The Make process The template makefile is only created if you are using the Make di alog The default makefile of the Targeting Expert handles all nec essary make functionality Environment Functions The environment is defined as all devices or functions that are needed by the application but not specified within the SDL system By sending signals to the environment the SDL system wants certain tasks to be performed This could be for instance reading or writing information to a file sending or receiving messages across the network reading or writing information on hardware ports or sockets However the SDL system only controls events that occur within the system It does not specify how signals leaving the system are handled by the environment This is why you must provide an interface between Telelogic Tau 4 5 SDL Suite Getting Started 307 Chapter 8 Tutorial Using ASN 1 Data Types 308 the SDL system and the environment This interface is made up by the environment functions Environment Environment functions Figure 198 The environment functions The SDL suite is rather helpful and can generate a template environ ment file t
23. ment files and the type node files in the make process you must generate a template makefile that will be appended to the default makefile see Figure 199 The template make file can be generated by the SDL suite MakeFile 4 Template MakeF ile a Type N odes Coder libraries Figure 199 The make process Generating Template Files the Organizer Follow the instructions below to generate environment files type node files and the template makefile using the Organizer s Make dialog 1 Click the SDL system symbol in the Organizer 2 From the Generate menu select the Make command The SDL Make window opens 3 Specify your options in the make dialog according to the following list Select Analyze amp generate code From the Code generator drop down list select Cadvanced Select Generate environment header file Select Generate environment functions Select Generate ASN 1 coder to invoke ASN 1 Utilities Fromthe Use standard kernel drop down list select Application Telelogic Tau 4 5 SDL Suite Getting Started July 2003 Creating the Transfer Syntax Note Make sure that you de select the Compile amp link option as you only want to generate the template files 4 Specify your target directory where the generated files will be stored Figure 200 shows the Make dialog with the selected options eidevelop hevisnmp_gr snmp gritargetisnmp_env tpm gt AN A N Pas
24. name asnlcoder c asnlimodule name asnlcoder h These files are the type nodes created by the ASN 1 utilities Editing the Generated Files Targeting Expert As the generated files only consist of skeleton functions you must edit the files to suit the functionality of your application Note Make a habit of making a copy of the environment file after it has been edited Otherwise the edits will be overwritten if the file is re generated by mistake 1 Rename the environment file 2 Edit the environment file system name env c file according to your needs In the skeleton file macros are included but they are not defined To define the macros create a system name env hfile and enter the code manually Example 7 on page 317 shows the unedited SNMP environment file 3 Save the environment file 316 Telelogic Tau 4 5 SDL Suite Getting Started July 2003 ta Creating the Transfer Syntax Notes In order to transfer the information on the network you must add socket commands to an appropriate header file e If you want to use more than one encoding scheme for instance BER and PER you must enter the appropriate encoding function calls in the environment file Example 7 Environment Functions Cadvanced The following code is part of the environment file skeleton and dis plays the function that handles of the out signals ENV OUT START Signals going to the env via the channel Signal env
25. orial Using ASN 1 Data Types 326 Telelogic Tau 4 5 SDL Suite Getting Started July 2003
26. tilities This tool is automatically invoked when you analyze your SDL system However having the ASN 1 data types translated to SDL is not enough to include them in your application If you are going to transfer applica tion generated information on computer networks the values of the Telelogic Tau 4 5 SDL Suite Getting Started July 2003 Introduction data types must be encoded When transferring signals in or out of your SDL system you must also create the interface between the environ ment and the system Thus the process of implementing ASN 1 data types can be divided into three separate steps 1 Creating the abstract syntax 2 Creating the transfer syntax 3 Compiling the application The definitions of the abstract syntax and the transfer syntax is present ed below Abstract Syntax The basic idea is to transport some type of information between two nodes using protocol messages The abstract syntax is defined as the set of all possible messages that can be transported To create the abstract syntax you must e design some form of data structure defined in a high level program ming language for instance ASN 1 define the possible set of values that the data structure can take Transfer Syntax The transfer syntax is the set of bit patterns that represents the abstract syntax messages with each bit pattern representing just one value The rules determining the bit patterns are called the encoding rules Jul
27. y 2003 Telelogic Tau 4 5 SDL Suite Getting Started 299 Chapter 8 Tutorial Using ASN 1 Data Types Creating the Abstract Syntax When creating the abstract syntax you must perform the following tasks e Adding ASN 1 modules to your project Importing the ASN 1 modules in your SDL diagrams e Assigning values to the data types Adding ASN 1 Modules to your Project An ASN 1 module is a file containing the ASN 1 data type definitions If you are implementing a standard communication protocol it is very likely that pre defined ASN 1 modules have been created The modules can be obtained from standardization organizations RFCS etc In Example 10 on page 323 the ASN 1 module that defines the SNMP protocol is presented This module is available in the RFC 1157 However should a pre defined module not be available for your type of application you must create your own module Please see adequate ASN 1 literature for instructions and guidelines on creating ASN 1 modules Regardless how you obtain the ASN 1 modules you must add the mod ule to your project before the SDL suite can include the data types Follow the instructions below to add the ASN 1 module to your project 1 Save your ASN 1 module in a subdirectory to your project Make sure that you append the asn file extension to the saved module 2 Open the Organizer and select the chapter where you want to in clude the module This is done by clicking the chapter marker
Download Pdf Manuals
Related Search
Related Contents
SITE ABIA MANUEL D`UTILISATION Philips Spiral 929689828412 新潟県警察情報セキュリティ対策要綱の制定について(例規 通達) 4000 Classic Minox Hg 8x56BR Samsung GALAXY 580 User Manual(Froyo version) MANUALE UTENTE Samsung P2050N Lietotāja rokasgrāmata Braun BS 9765 Electric Shaver User Manual Formats vidéo pris en charge 52 Copyright © All rights reserved.
Failed to retrieve file