Download Generated C Function Format and Calling Parameters
Transcript
ASN.1 To C/C++ Mappings
_<ObjectName>_<FieldName>
where <ObjectName> is replaced with the information object name and <FieldName> is replaced with the name
of the field from within the object.
Information Object Set
Table constraint processing code to support Information Object Sets is generated in a header and source file with a C
struct / C++ class to hold the values. The name of the header and source file are of the following format:
<ModuleName >Table.h
<ModuleName >Table.c/cpp
In this definition, <ModuleName> would be replaced with the name of the ASN.1 module in which the information
object is defined.
C Code Generation
A C global variable is generated containing a static array of values for the ASN.1 CLASS definition. Each structure
in the array is the equivalent C structure representing the corresponding ASN.1 information object
An example of an Information Object Set definition that is derived from the ASN.1 ATTRIBUTE class above is as
follows:
SupportedAttributes ATTRIBUTE ::= { name | commonName }
This results in the generation of the following C constant:
ATTRIBUTE SupportedAttributes[2];
int SupportedAttributes_Size = 2;
Code generated in the Information Object Set initialization function:
SupportedAttributes[0].TypeSize = sizeof(_name_Type);
SupportedAttributes[0].encodeType = &asn1E__name_Type;
SupportedAttributes[0].decodeType = &asn1D__name_Type;
SupportedAttributes[0].id.numids = 3;
SupportedAttributes[0].id.subid[0] = 0;
SupportedAttributes[0].id.subid[1] = 1;
SupportedAttributes[0].id.subid[2] = 1;
SupportedAttributes[1].TypeSize = sizeof(_commonName_Type);
SupportedAttributes[1].encodeType = &asn1E__commonName_Type;
SupportedAttributes[1].decodeType = &asn1D__commonName_Type;
SupportedAttributes[1].id.numids = 3;
SupportedAttributes[1].id.subid[0] = 0;
SupportedAttributes[1].id.subid[1] = 1;
SupportedAttributes[1].id.subid[2] = 1;
SupportedAttributes[1].id.subid[3] = 1;
C++ Code Generation
In C++, ASN.1 information object sets are mapped to C++ classes. In this case, a C++ singleton class is generated.
This class contains a container to hold an instance of each of the ASN.1 information object C++ objects in a static
array. The class also contains an object lookup method for each of the key fields. Key fields are identified in the class
as either a) fields that are marked unique, or b) fields that are referenced in table constraints with the '@' notation.
101