The format of the name of each generated PER encode function is as follows:
asn1PE_[<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 = asn1PE_<name> (OSCTXT* pctxt, <name>[*] value);
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 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. Check the generated function prototype in
the header file to determine how the value argument is to be passed for a given
function.
The function result variable stat
returns the status of the encode
operation. Status code 0 (0) indicates the function was successful. Note that this
return value differs from that of BER encode functions in that the encoded length of
the message component is not returned – only an OK status indicating encoding was
successful. A negative value indicates encoding failed. Return status values are
defined in the "asn1type.h" include file. The error text and a stack trace can be
displayed using the rtxErrPrint function.