XML C Encode Functions.
[XER Runtime Library Functions.]

Functions

int xmlEncBitStr (OSCTXT *pctxt, XmlNamedBitsDict *namedbits, OSUINT32 noofnamedbits, OSUINT32 nbits, const OSOCTET *data, const char *elemName, ASN1StrType outputType)
int xmlEncBoolValue (OSCTXT *pctxt, OSBOOL value)
int xmlEncBool (OSCTXT *pctxt, OSBOOL value, const char *elemName)
int xmlEncEnum (OSCTXT *pctxt, const char *value)
int xmlEncGeneralizedTime (OSCTXT *pctxt, const char *value, const char *elemName)
int xmlEncNamedValue (OSCTXT *pctxt, const char *value, const char *elemName, const char *attributes)
int xerEncOpenTypeExt (OSCTXT *pctxt, OSRTDList *pElemList)
int xmlEncReal (OSCTXT *pctxt, OSREAL value, const char *elemName)
int xmlEncUTCTime (OSCTXT *pctxt, const char *value, const char *elemName)

Detailed Description

The XML low-level encode functions handle the XML encoding of primitive ASN.1 data types. In most cases XER encoding functions can be used for encoding XML. But there are some differences between XER and XML encodings, described in X.693 and X.694. These functions are very similar to XER ones, and only functions provide different encoding are added.


Function Documentation

int xmlEncBitStr ( OSCTXT *  pctxt,
XmlNamedBitsDict namedbits,
OSUINT32  noofnamedbits,
OSUINT32  nbits,
const OSOCTET *  data,
const char *  elemName,
ASN1StrType  outputType 
)

This function encodes a variable of the ASN.1 BIT STRING type.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
namedbits Bits' dictionary to be used to encode each bit. It is an array of name-value pairs, represented by an array of XmlNamedBitsDict structure.
noofnamedbits Number of named bits in bits' dictionary.
nbits The number of bits within the bit string to be encoded.
data A pointer to an OCTET string containing the bit data to be encoded. This string contains bytes having the actual bit settings as they are to be encoded in the message.
elemName This argument specifies the name of the element that is wrapped around the encoded value. If the name is null, the default name for this type (<BIT_STRING>) is added. If an empty string is passed (""), no element tag is added to the encoded value.
outputType An enumerated type whose value is set to either 'ASN1BIN' (for binary format) or 'ASN1HEX' (for hexadecimal format).
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int xmlEncBool ( OSCTXT *  pctxt,
OSBOOL  value,
const char *  elemName 
)

This function encodes a variable of the ASN.1 BOOLEAN type.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
value A BOOLEAN value to be encoded. A BOOLEAN is defined as a single octet whose value is 0 for False and any other value for TRUE.
elemName This argument specifies the name of the element that is wrapped around the encoded value. If the name is null, the default name for this type (<BOOLEAN>) is added. If an empty string is passed (""), no element tag is added to the encoded value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int xmlEncEnum ( OSCTXT *  pctxt,
const char *  value 
)

This function encodes an enumeration value for the ASN.1 ENUMERATED and INTEGER types.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
value An enumeration identifier to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int xmlEncGeneralizedTime ( OSCTXT *  pctxt,
const char *  value,
const char *  elemName 
)

This function encodes a variable of the ASN.1 GeneralizedTime type. It performs conversion from ASN.1 time format into the XML dateTime format.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
value A pointer to a null-terminated C character string to be encoded. It should contain GeneralizedTime in ASN.1 format.
elemName This argument specifies the name of the element that is wrapped around the encoded value. If an empty string is passed (""), no element tag is added to the encoded value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int xmlEncNamedValue ( OSCTXT *  pctxt,
const char *  value,
const char *  elemName,
const char *  attributes 
)

This function encodes a named value, for example an enumerated value, such as <element>value</element>.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
value A pointer to a value string
elemName A pointer to the name of the element.
attributes A pointer to the attributes of the element.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int xmlEncReal ( OSCTXT *  pctxt,
OSREAL  value,
const char *  elemName 
)

This function encodes a variable of the REAL data type. This function provides support for the plus-infinity, minus-infinity, NaN and minus zero special real values. Use the rtxGetPlusInfinity, rtxGetMinusInfinity, rtxGetNaN and rtxGetMinusZero functions to get these special values.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
value A value to be encoded. Special real values are encoded by using the apropriate functions to set the real value to be encoded.
elemName A pointer to the name of the element.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int xmlEncUTCTime ( OSCTXT *  pctxt,
const char *  value,
const char *  elemName 
)

This function encodes a variable of the ASN.1 UTCTime type. It performs conversion from ASN.1 time format into the XML dateTime format.

Parameters:
pctxt A pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
value A pointer to a null-terminated C character string to be encoded. It should contain UTCTime in ASN.1 format.
elemName This argument specifies the name of the element that is wrapped around the encoded value. If an empty string is passed (""), no element tag is added to the encoded value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.