The format of the name of each generated XER encode function is as follows:
asn1XE_[<prefix>]<prodName>
where <prodName>
is the name of the ASN.1 production for which the
function is being generated and <prefix>
is an optional prefix that
can be set via a configuration file setting. The configuration setting used to set
the prefix is the <typePrefix> element. This element specifies a prefix that will
be applied to all generated typedef names and function names for the
production.
The calling sequence for each encode function is as follows:
status = asn1XE_<name> (OSCTXT* pctxt, <name>[*] value, const char* elemName, const char* attributes);
In this definition, <name> denotes the prefixed production name defined above.
The pctxt
argument is used to hold a context pointer to keep track of
encode parameters. This is a basic "handle" variable that is used to make the
function reentrant so it can be used in an asynchronous or threaded application. The
user is required to supply a pointer to a variable of this type declared somewhere
in his or her or her program.
The value
argument contains the value to be encoded or holds a
pointer to the value to be encoded. This variable is of the type generated from the
ASN.1 production. The object is passed by value if it is a primitive ASN.1 data type
such as BOOLEAN, INTEGER, ENUMERATED, etc.. It is passed using a pointer reference
if it is a structured ASN.1 type value (in this case, the name will be pvalue
instead of value). Check the generated function prototype in the header file to
determine how this argument is to be passed for a given function.
The elemName and attributes arguments are used to pass the XML element name and attributes respectively. The elemName argument is the name that will be included in the <name> </name> brackets used to delimit an XML item. There are three distinct ways this argument can be specified:
If it contains standard text, this text will be used as the element name.
If it is null, a default element name will be applied. Default names for all of the built-in ASN.1 types are defined in the 2002 X.680 standard. For example, <BOOLEAN> is the default element name for the BOOLEAN built-in type.
If the name is empty (i.e. equal to “”, a zero-length string – not to be confused with null), then no element name is applied to the encoded data.
The function result variable stat
returns the status of the encode
operation. Status code zero indicates the function was successful. A negative value
indicates encoding failed. Return status values are defined in the rtxErrCodes.h include file. The error text and a stack
trace can be displayed using the rtxErrPrint
function.