Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Open Source
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

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


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.


Functions

int xmlEncBitStr (ASN1CTXT *pctxt, XmlNamedBitsDict *namedbits, ASN1UINT noofnamedbits, ASN1UINT nbits, ASN1ConstOctetPtr data, ASN1ConstCharPtr elemName, ASN1StrType outputType)
int xmlEncBoolValue (ASN1CTXT *pctxt, ASN1BOOL value)
int xmlEncBool (ASN1CTXT *pctxt, ASN1BOOL value, ASN1ConstCharPtr elemName)
int xmlEncEnum (ASN1CTXT *pctxt, ASN1ConstCharPtr value)
int xmlEncGeneralizedTime (ASN1CTXT *pctxt, ASN1ConstCharPtr value, ASN1ConstCharPtr elemName)
int xmlEncNamedValue (ASN1CTXT *pctxt, ASN1ConstCharPtr value, ASN1ConstCharPtr elemName, ASN1ConstCharPtr attributes)
int xerEncOpenTypeExt (ASN1CTXT *pctxt, Asn1RTDList *pElemList)
int xmlEncReal (ASN1CTXT *pctxt, ASN1REAL value, ASN1ConstCharPtr elemName)
int xmlEncUTCTime (ASN1CTXT *pctxt, ASN1ConstCharPtr value, ASN1ConstCharPtr elemName)


Function Documentation

int xmlEncBitStr ASN1CTXT *  pctxt,
XmlNamedBitsDict *  namedbits,
ASN1UINT  noofnamedbits,
ASN1UINT  nbits,
ASN1ConstOctetPtr  data,
ASN1ConstCharPtr  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 (ASN_OK) = success,
  • negative return value is error.

int xmlEncBool ASN1CTXT *  pctxt,
ASN1BOOL  value,
ASN1ConstCharPtr  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 (ASN_OK) = success,
  • negative return value is error.

int xmlEncEnum ASN1CTXT *  pctxt,
ASN1ConstCharPtr  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 (ASN_OK) = success,
  • negative return value is error.

int xmlEncGeneralizedTime ASN1CTXT *  pctxt,
ASN1ConstCharPtr  value,
ASN1ConstCharPtr  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 (ASN_OK) = success,
  • negative return value is error.

int xmlEncNamedValue ASN1CTXT *  pctxt,
ASN1ConstCharPtr  value,
ASN1ConstCharPtr  elemName,
ASN1ConstCharPtr  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 (ASN_OK) = success,
  • negative return value is error.

int xmlEncReal ASN1CTXT *  pctxt,
ASN1REAL  value,
ASN1ConstCharPtr  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 rtGetPlusInfinity, rtGetMinusInfinity, rtGetNaN and rtGetMinusZero 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 (ASN_OK) = success,
  • negative return value is error.

int xmlEncUTCTime ASN1CTXT *  pctxt,
ASN1ConstCharPtr  value,
ASN1ConstCharPtr  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 (ASN_OK) = success,
  • negative return value is error.


Copyright © 1997-2005 Objective Systems,Inc.
All Rights Reserved.
This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.

This file was last modified on 8 Sep 2005.
ASN1C XER Runtime, ASN1C v5.8x