Download Procedure for Calling C# PER Encode Methods

Transcript
Table Constraint Processing
<name> <ClassName> ::= { <Information Object1> | <Information Object2> }
Generated C# constants:
public static readonly <ClassName> <name> =
new <ClassName> {<Information Object1>, <Information Object1> };
For example, consider the following Information Object Set declaration for above ATTRIBUTE definition:
SupportedAttributes ATTRIBUTE ::= { name | commonName }
This would result in the following C# constant being generated:
public static readonly ATTRIBUTE[] SupportedAttributes =
new ATTRIBUTE[] {
_TestValues.name,
_TestValues.commonName
};
Generated Information Object Table Structure
Information Objects and Classes are used to define multi-layer protocols in which “holes” are defined within ASN.1
types for passing message components to different layers for processing. These items are also used to define the
contents of various messages that are allowed in a particular exchange of messages. The ASN1C compiler extracts the
types involved in these message exchanges and generates encoders/decoders for them. The “holes” in the types are
accounted for by adding open type holders to the generated structures. These open type holders consist of a byte array
for storing information on an encoded message fragment for processing at the next level.
The ASN1C compiler is capable of generating code in one of two forms for information in an object specification:
1. Simple form: in this form, references to variable type fields within standard types are simply treated as open types
and an open type placeholder is inserted.
2. Table form: in this form, all of the classes, objects, and object sets within a specification result in the generation
of code for parsing and formatting the information field references within standard type structures.
The second form is selected by specifying the –tables command line option.
To better understand the support in this area, the individual components of Information Object specifications are
examined. We begin with the “CLASS” specification that provides a schema for Information Object definitions. A
sample class specification is as follows:
OPERATION ::= CLASS {
&operationCode CHOICE { local INTEGER,
global OBJECT IDENTIFIER }
&ArgumentType,
&ResultType,
&Errors ERROR OPTIONAL
}
Users familiar with ASN.1 will recognize this as a simplified definition of the ROSE OPERATION MACRO using
the Information Object format. When a class specification such as this is parsed, information on its fields is maintained
in memory for later reference. In the simple form of code generation, the class definition itself does not result in the
generation of any corresponding C# code. It is only an abstract template that will be used to define new items later
99