C Runtime Common Functions

Classes

struct  ASN1OctStr
struct  ASN1DynBitStr
struct  ASN1BitStr32
struct  ASN1SeqOf
struct  ASN1SeqOfOctStr
struct  ASN1OpenType
struct  Asn1Object
struct  Asn116BitCharString
struct  Asn132BitCharString
struct  Asn1CharArray
struct  Asn1CharSet
struct  Asn116BitCharSet
struct  Asn132BitCharSet
struct  ASN1BigInt
struct  ASN1CCB

Modules

 Object Identifier Helper Functions
 Time Helper Functions
 Character String Conversion Functions
 Comparison Functions
 Comparison to Standard Output Functions
 Copy Functions
 Print values to text buffer functions.

Defines

#define XM_SEEK   0x01
#define XM_ADVANCE   0x02
#define XM_DYNAMIC   0x04
#define XM_SKIP   0x08
#define XM_OPTIONAL   0x10
#define ASN_K_MAXDEPTH   32
#define ASN_K_MAXENUM   100
#define ASN_K_MAXERRP   5
#define ASN_K_MAXERRSTK   8
#define ASN_K_ENCBUFSIZ   16*1024
#define ASN_K_MEMBUFSEG   1024
#define OSRTINDENTSPACES   3
#define ASN1_K_PLUS_INFINITY   0x40
#define ASN1_K_MINUS_INFINITY   0x41
#define REAL_BINARY   0x80
#define REAL_SIGN   0x40
#define REAL_EXPLEN_MASK   0x03
#define REAL_EXPLEN_1   0x00
#define REAL_EXPLEN_2   0x01
#define REAL_EXPLEN_3   0x02
#define REAL_EXPLEN_LONG   0x03
#define REAL_FACTOR_MASK   0x0c
#define REAL_BASE_MASK   0x30
#define REAL_BASE_2   0x00
#define REAL_BASE_8   0x10
#define REAL_BASE_16   0x20
#define REAL_ISO6093_MASK   0x3F
#define ASN1REALMAX   (OSREAL)DBL_MAX
#define ASN1REALMIN   (OSREAL)-DBL_MAX
#define ASN1DynOctStr   OSDynOctStr
#define OSSETBIT(bitStr, bitIndex)   rtxSetBit (bitStr.data, bitStr.numbits, bitIndex)
#define OSSETBITP(pBitStr, bitIndex)   rtxSetBit ((pBitStr)->data, (pBitStr)->numbits, bitIndex)
#define OSCLEARBIT(bitStr, bitIndex)   rtxClearBit (bitStr.data, bitStr.numbits, bitIndex)
#define OSCLEARBITP(pBitStr, bitIndex)   rtxClearBit ((pBitStr)->data, (pBitStr)->numbits, bitIndex)
#define OSTESTBIT(bitStr, bitIndex)   rtxTestBit (bitStr.data, bitStr.numbits, bitIndex)
#define OSTESTBITP(pBitStr, bitIndex)   rtxTestBit ((pBitStr)->data, (pBitStr)->numbits, bitIndex)
#define ASN1_K_CCBMaskSize   32
#define ASN1_K_NumBitsPerMask   16
#define ASN1_K_MaxSetElements   (ASN1_K_CCBMaskSize*ASN1_K_NumBitsPerMask)
#define ASN1NUMOCTS(nbits)   ((nbits>0)?(((nbits-1)/8)+1):0)

Typedefs

typedef void * ASN1ANY
typedef Asn1Object ASN1Object
typedef OSUNICHAR ASN116BITCHAR
typedef const char * ASN1GeneralizedTime
typedef const char * ASN1GeneralString
typedef const char * ASN1GraphicString
typedef const char * ASN1IA5String
typedef const char * ASN1ISO646String
typedef const char * ASN1NumericString
typedef const char * ASN1ObjectDescriptor
typedef const char * ASN1PrintableString
typedef const char * ASN1TeletexString
typedef const char * ASN1T61String
typedef const char * ASN1UTCTime
typedef const char * ASN1VideotexString
typedef const char * ASN1VisibleString
typedef const OSUTF8CHAR * ASN1UTF8String
typedef Asn116BitCharString ASN1BMPString
typedef Asn132BitCharString ASN1UniversalString
typedef struct ASN1BigInt ASN1BigInt
typedef int(* ASN1DumpCbFunc )(const char *text_p, void *cbArg_p)

Enumerations

enum  ASN1StrType { ASN1HEX, ASN1BIN, ASN1CHR }
enum  ASN1ActionType { ASN1ENCODE, ASN1DECODE }



#define ALLOC_ASN1ARRAY(pctxt, pseqof, type)
#define ALLOC_ASN1ARRAY1(pctxt, pseqof, type)

Detailed Description

The C run-time common library contains common C functions used by the low-level encode/decode functions. These functions are identified by their rt and rtx prefixes.

The categories of functions provided are as follows:

  • Context management functions handle the allocation, initialization, and destruction of context variables (variables of type OSCTXT) that handle the working data used during the encoding or decoding of a message.
  • Memory allocation macros and functions provide an optimized memory management interface.
  • Doubly linked list (DList) functions are used to manipulate linked list structures that are used to model repeating XSD types and elements.
  • UTF-8 and Unicode character string functions provide support for conversions to and from these formats in C or C++.
  • Date/time conversion functions provide utilities for converting system and structured numeric date/time values to XML schema standard string format.
  • Pattern matching function compare strings against patterns specified using regular expressions (regexp's).
  • Diagnostic trace functions allow the output of trace messages to standard output.
  • Error formatting and print functions allow information about encode/decode errors to be added to a context block structure and printed out.
  • Memory buffer management functions handle the allocation, expansion, and de-allocation of dynamic memory buffers used by some encode/decode functions.
  • Formatted print functions allow binary data to be formatted and printed to standard output and other output devices.
  • Big Integer helper functions are arbitrary-precision integer manipulating functions used to maintain big integers.

Define Documentation

#define ALLOC_ASN1ARRAY ( pctxt,
pseqof,
type   ) 
Value:
do {\
if (sizeof(type)*(pseqof)->n < (pseqof)->n) return RTERR_NOMEM; \
if (((pseqof)->elem = (type*) rtxMemHeapAllocZ \
(&(pctxt)->pMemHeap, sizeof(type)*(pseqof)->n)) == 0) return RTERR_NOMEM; \
} while (0)

Memory allocation functions and macros handle memory management for the ASN1C run-time. Special algorithms are used for allocation and deallocation of memory to improve the run-time performance. Allocate a dynamic array. This macro allocates a dynamic array of records of the given type. This version of the macro will return the RTERR_NOMEM error status if the memory request cannot be fulfilled.

Parameters:
pctxt - Pointer to a context block
pseqof - Pointer to a generated SEQUENCE OF array structure. The n member variable must be set to the number of records to allocate.
type - Data type of an array record
#define ALLOC_ASN1ARRAY1 ( pctxt,
pseqof,
type   ) 
Value:
do {\
if (sizeof(type)*(pseqof)->n < (pseqof)->n) (pseqof)->elem = 0; \
else (pseqof)->elem = (type*) rtxMemHeapAllocZ \
(&(pctxt)->pMemHeap, sizeof(type)*(pseqof)->n); \
} while (0)

Allocate a dynamic array. This macro allocates a dynamic array of records of the given type. This version of the macro will set the internal parameters of the SEQUENCE OF structure to NULL if the memory request cannot be fulfilled.

Parameters:
pctxt - Pointer to a context block
pseqof - Pointer to a generated SEQUENCE OF array structure. The n member variable must be set to the number of records to allocate.
type - Data type of an array record
#define ASN1_K_CCBMaskSize   32

The maximum size for the context control block mask.

#define ASN1_K_MaxSetElements   (ASN1_K_CCBMaskSize*ASN1_K_NumBitsPerMask)

The maximum number of set elements that can be handled by the CCB.

#define ASN1_K_MINUS_INFINITY   0x41

The ASN.1 Real value Minus Infinity.

#define ASN1_K_NumBitsPerMask   16

The number of bits that can be set per mask.

#define ASN1_K_PLUS_INFINITY   0x40

The ASN.1 Real value Plus Infinity.

#define ASN1DynOctStr   OSDynOctStr

We define ASN1DynOctStr to be the common generic OSDynOctStr type.

#define ASN_K_ENCBUFSIZ   16*1024

dynamic encode buffer extent size

#define ASN_K_MAXDEPTH   32

maximum nesting depth for messages

#define ASN_K_MAXENUM   100

maximum enum values in an enum type

#define ASN_K_MAXERRP   5

maximum error parameters

#define ASN_K_MAXERRSTK   8

maximum levels on error ctxt stack

#define ASN_K_MEMBUFSEG   1024

memory buffer extent size

#define OSCLEARBIT ( bitStr,
bitIndex   )     rtxClearBit (bitStr.data, bitStr.numbits, bitIndex)

This macro clears the given bit in the given static bit string.

Parameters:
bitStr The bit string to manipulate.
bitIndex The index to clear.
#define OSCLEARBITP ( pBitStr,
bitIndex   )     rtxClearBit ((pBitStr)->data, (pBitStr)->numbits, bitIndex)

This macro clears the given bit in the given dynamic bit string.

Parameters:
pBitStr The pointer-to-bit string to manipulate.
bitIndex The index to clear.
#define OSRTINDENTSPACES   3

number of spaces for indent

#define OSSETBIT ( bitStr,
bitIndex   )     rtxSetBit (bitStr.data, bitStr.numbits, bitIndex)

This macro sets the given bit in the given static bit string.

Parameters:
bitStr The bit string to manipulate.
bitIndex The index to set.
#define OSSETBITP ( pBitStr,
bitIndex   )     rtxSetBit ((pBitStr)->data, (pBitStr)->numbits, bitIndex)

This macro sets the given bit in the given dynamic bit string.

Parameters:
pBitStr A pointer-to-bit string to manipulate.
bitIndex The index to set.
#define OSTESTBIT ( bitStr,
bitIndex   )     rtxTestBit (bitStr.data, bitStr.numbits, bitIndex)

This macro tests the given bit in the given static bit string.

Parameters:
bitStr The bit string to manipulate.
bitIndex The index to test.
Returns:
TRUE if the bit is on; FALSE if the bit is off.
#define OSTESTBITP ( pBitStr,
bitIndex   )     rtxTestBit ((pBitStr)->data, (pBitStr)->numbits, bitIndex)

This macro tests the given bit in the given dynamic bit string.

Parameters:
pBitStr The pointer-to-bit string to manipulate.
bitIndex The index to set.
#define XM_ADVANCE   0x02

advance pointer to contents on match

#define XM_DYNAMIC   0x04

alloc dyn mem for decoded variable

#define XM_OPTIONAL   0x10

tag test is for optional element

#define XM_SEEK   0x01

seek match until found or end-of-buf

#define XM_SKIP   0x08

skip to next field after parsing tag


Typedef Documentation

typedef struct ASN1BigInt ASN1BigInt

A structure used to define an ASN.1 big integer. This structure is rarely, if ever, used by client code, and will instead be used by generated code to facilitate encoding and decoding integer values that cannot fit in normal C/C++ integer types.

typedef int(* ASN1DumpCbFunc)(const char *text_p, void *cbArg_p)

ASN.1 dump utility callback function definition


Enumeration Type Documentation

An enumerated list of ASN.1 actions: encode or decode.

An enumerated list of the various string types: hexadecimal, binary, and character strings.