Generated C Function Format and Calling Parameters

The format of the name of each generated encode function is as follows:

   asn1JsonEnc_[<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 follows:

   stat = asn1JsonEnc_<name> (OSCTXT* pctxt,
                       <name>* pvalue);

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 variable should be initialized using the rtInitContext run-time library function (see the C JSON Runtime Library Reference Manual for a complete description of this function).

The pvalue argument holds a pointer to the data to be encoded and is of the type generated from the ASN.1 production.

The function result variable stat returns an error status code if encoding fails. Return status values are defined in the asn1type.h include file.