Objective Systems, Inc.  

C Runtime Common Functions


Modules

 Memory Allocation Macros and Functions
 Memory allocation functions and macros handle memory management for the ASN1C run-time.
 Context Management Functions
 Context initialization functions handle the allocation, initialization, and destruction of ASN.1 context variables (variables of type OOCTXT).
 Error Formatting and Print Functions
 Error formatting and print functions allow information about the encode/decode errors to be added to a context block structure and then printed out when the error is propagated to the top level.
 Rtmem

Data Structures

struct  ASN1OBJID
struct  ASN1OctStr
struct  ASN1DynOctStr
struct  ASN1DynBitStr
struct  ASN1BitStr32
struct  ASN1SeqOf
struct  ASN1SeqOfOctStr
struct  ASN1OpenType
struct  Asn116BitCharString
struct  Asn132BitCharString
struct  Asn1CharArray
struct  Asn1CharSet
struct  Asn116BitCharSet
struct  _Asn1SizeCnst
struct  ASN1BUFFER
struct  ASN1BUFSAVE
struct  ASN1ErrLocn
struct  ASN1ErrInfo
struct  OOCTXT
struct  _OOMsgBuf
struct  OOEnumItem

Defines

#define ASN_OK   0
#define ASN_OK_FRAG   2
#define ASN_E_BUFOVFLW   -1
#define ASN_E_ENDOFBUF   -2
#define ASN_E_IDNOTFOU   -3
#define ASN_E_INVOBJID   -4
#define ASN_E_INVLEN   -5
#define ASN_E_INVENUM   -6
#define ASN_E_SETDUPL   -7
#define ASN_E_SETMISRQ   -8
#define ASN_E_NOTINSET   -9
#define ASN_E_SEQOVFLW   -10
#define ASN_E_INVOPT   -11
#define ASN_E_NOMEM   -12
#define ASN_E_INVHEXS   -14
#define ASN_E_INVBINS   -15
#define ASN_E_INVREAL   -16
#define ASN_E_STROVFLW   -17
#define ASN_E_BADVALUE   -18
#define ASN_E_UNDEFVAL   -19
#define ASN_E_UNDEFTYP   -20
#define ASN_E_BADTAG   -21
#define ASN_E_TOODEEP   -22
#define ASN_E_CONSVIO   -23
#define ASN_E_RANGERR   -24
#define ASN_E_ENDOFFILE   -25
#define ASN_E_INVUTF8   -26
#define ASN_E_CONCMODF   -27
#define ASN_E_ILLSTATE   -28
#define ASN_E_OUTOFBND   -29
#define ASN_E_INVPARAM   -30
#define ASN_E_INVFORMAT   -31
#define ASN_E_NOTINIT   -32
#define ASN_E_TOOBIG   -33
#define ASN_E_INVCHAR   -34
#define ASN_E_XMLSTATE   -35
#define ASN_E_XMLPARSE   -36
#define ASN_E_SEQORDER   -37
#define ASN_E_INVINDEX   -38
#define ASN_E_INVTCVAL   -39
#define ASN_E_FILNOTFOU   -40
#define ASN_E_FILEREAD   -41
#define ASN_E_FILEWRITE   -42
#define ASN_E_INVBASE64   -43
#define ASN_E_INVSOCKET   -44
#define ASN_E_XMLLIBNFOU   -45
#define ASN_E_XMLLIBINV   -46
#define ASN_E_NOTSUPP   -99
#define ASN_K_INDEFLEN   -9999
#define ASN_ID_EOC   0
#define ASN_ID_BOOL   1
#define ASN_ID_INT   2
#define ASN_ID_BITSTR   3
#define ASN_ID_OCTSTR   4
#define ASN_ID_NULL   5
#define ASN_ID_OBJID   6
#define ASN_ID_OBJDSC   7
#define ASN_ID_EXTERN   8
#define ASN_ID_REAL   9
#define ASN_ID_ENUM   10
#define ASN_ID_EPDV   11
#define ASN_ID_RELOID   13
#define ASN_ID_SEQ   16
#define ASN_ID_SET   17
#define ASN_SEQ_TAG   0x30
#define ASN_SET_TAG   0x31
#define ASN_ID_NumericString   18
#define ASN_ID_PrintableString   19
#define ASN_ID_TeletexString   20
#define ASN_ID_T61String   ASN_ID_TeletexString
#define ASN_ID_VideotexString   21
#define ASN_ID_IA5String   22
#define ASN_ID_UTCTime   23
#define ASN_ID_GeneralTime   24
#define ASN_ID_GraphicString   25
#define ASN_ID_VisibleString   26
#define ASN_ID_GeneralString   27
#define ASN_ID_UniversalString   28
#define ASN_ID_BMPString   30
#define XM_SEEK   0x01
#define XM_ADVANCE   0x02
#define XM_DYNAMIC   0x04
#define XM_SKIP   0x08
#define ASN_K_MAXDEPTH   32
#define ASN_K_MAXSUBIDS   128
#define ASN_K_MAXENUM   100
#define ASN_K_MAXERRP   5
#define ASN_K_MAXERRSTK   8
#define ASN_K_ENCBUFSIZ   2*1024
#define ASN_K_MEMBUFSEG   1024
#define NUM_ABITS   4
#define NUM_UBITS   4
#define NUM_CANSET   " 0123456789"
#define PRN_ABITS   8
#define PRN_UBITS   7
#define PRN_CANSET   " '()+,-./0123456789:=?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
#define VIS_ABITS   8
#define VIS_UBITS   7
#define VIS_CANSET
#define T61_ABITS   8
#define T61_UBITS   7
#define T61_CANSET
#define IA5_ABITS   8
#define IA5_UBITS   7
#define IA5_CANSET
#define IA5_RANGE1_LOWER   0
#define IA5_RANGE2_LOWER   0x5f
#define GEN_ABITS   8
#define GEN_UBITS   7
#define GEN_CANSET
#define BMP_ABITS   16
#define BMP_UBITS   16
#define BMP_FIRST   0
#define BMP_LAST   0xffff
#define UCS_ABITS   32
#define UCS_UBITS   32
#define UCS_FIRST   0
#define UCS_LAST   0xfffffffful
#define ASN1TAG_LSHIFT   24
#define ASN1UINT_MAX   4294967295U
#define ASN1INT_MAX   ((ASN1INT)2147483647L)
#define ASN1INT_MIN   ((ASN1INT)(-ASN1INT_MAX-1))
#define ASN1UINTCNT(val)   val##u
#define ASN1INT64   long
#define XM_K_MEMBLKSIZ   (4*1024)
#define ASN1DYNCTXT   0x8000
#define ASN1INDEFLEN   0x4000
#define ASN1TRACE   0x2000
#define ASN1LASTEOC   0x1000
#define ASN1FASTCOPY   0x0800
#define ASN1CONSTAG   0x0400
#define ASN1CANXER   0x0200
#define ASN1SAVEBUF   0x0100
#define ASN1OPENTYPE   0x0080
#define ASN1MAX(a, b)   (((a)>(b))?(a):(b))
#define ASN1MIN(a, b)   (((a)<(b))?(a):(b))
#define ASN1BUFCUR(cp)   (cp)->buffer.data[(cp)->buffer.byteIndex]
#define ASN1BUFPTR(cp)   &(cp)->buffer.data[(cp)->buffer.byteIndex]
#define ASN1CRTMALLOC0(nbytes)   malloc(nbytes)
#define ASN1CRTFREE0(ptr)   free(ptr)
#define ASN1CRTMALLOC   memHeapAlloc
#define ASN1CRTFREE   ASN1MEMFREEPTR
#define encodeIA5String(pctxt, value, permCharSet)   encodeConstrainedStringEx (pctxt, value, permCharSet, 8, 7, 7)
#define encodeGeneralizedTime   encodeIA5String
#define decodeIA5String(pctxt, pvalue, permCharSet)   decodeConstrainedStringEx (pctxt, pvalue, permCharSet, 8, 7, 7)
#define decodeGeneralizedTime   decodeIA5String
#define RT_MH_DONTKEEPFREE   0x1
 errfp
#define OSRTMH_PROPID_DEFBLKSIZE   1
#define OSRTMH_PROPID_SETFLAGS   2
#define OSRTMH_PROPID_CLEARFLAGS   3
#define OSRTMH_PROPID_USER   10
#define INCRBITIDX(pctxt)
 rtmem
#define DECODEBIT(pctxt, pvalue)
#define decodeUnconsInteger(pctxt, pvalue)   decodeSemiConsInteger(pctxt, pvalue, ASN1INT_MIN)
 This function will decode an unconstrained integer.
#define decodeUnconsUnsigned(pctxt, pvalue)   decodeSemiConsUnsigned(pctxt, pvalue, 0U)
 This function will decode an unconstrained unsigned integer.
#define encodeUnconsInteger(pctxt, value)   encodeSemiConsInteger(pctxt,value,ASN1INT_MIN)
 This function encodes an unconstrained integer.
#define OOUINT32_MAX   4294967295U
#define OOINT32_MAX   ((OOINT32)2147483647L)
#define OOINT32_MIN   ((OOINT32)(-OOINT32_MAX-1))
#define FALSE   0
#define TRUE   1
#define OOERRINVPARAM   (-50)
#define OOERRBUFOVFLW   (-51)
#define OOERRNOMEM   (-52)
#define OOMEMALLOC   malloc
#define OOMEMFREE   free
#define OOMAX(a, b)   (((a)>(b))?(a):(b))
#define OOMIN(a, b)   (((a)<(b))?(a):(b))
#define OONUMBEROF(items)   (sizeof(items)/sizeof(items[0]))
#define EXTERN

Typedefs

typedef char ASN1CHAR
typedef unsigned char ASN1OCTET
typedef ASN1OCTET ASN1BOOL
typedef signed char ASN1INT8
typedef unsigned char ASN1UINT8
typedef int ASN1INT
typedef unsigned int ASN1UINT
typedef ASN1INT ASN1ENUM
typedef double ASN1REAL
typedef short ASN1SINT
typedef unsigned short ASN1USINT
typedef ASN1UINT ASN1TAG
typedef ASN1USINT ASN116BITCHAR
typedef ASN1UINT ASN132BITCHAR
typedef void * ASN1ANY
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 * ASN1UTF8String
typedef const char * ASN1VideotexString
typedef const char * ASN1VisibleString
typedef Asn116BitCharString ASN1BMPString
typedef Asn132BitCharString ASN1UniversalString
typedef _Asn1SizeCnst Asn1SizeCnst
typedef char OOCHAR
typedef unsigned char OOUCHAR
typedef signed char OOINT8
typedef unsigned char OOUINT8
typedef short OOINT16
typedef unsigned short OOUINT16
typedef int OOINT32
typedef unsigned int OOUINT32
typedef OOUINT8 OOBOOL
typedef _OOMsgBuf OOMsgBuf

Functions

EXTERN int decodeBits (OOCTXT *pctxt, ASN1UINT *pvalue, ASN1UINT nbits)
 This function will decode a series of multiple bits and place the results in an unsigned integer variable.
EXTERN int decodeBitString (OOCTXT *pctxt, ASN1UINT *numbits_p, ASN1OCTET *buffer, ASN1UINT bufsiz)
 This function will decode a value of the ASN.1 bit string type whose maximum size is is known in advance.
EXTERN int decodeBitString32 (OOCTXT *pctxt, ASN1BitStr32 *pvalue, ASN1UINT lower, ASN1UINT upper)
EXTERN int decodeBMPString (OOCTXT *pctxt, ASN1BMPString *pvalue, Asn116BitCharSet *permCharSet)
 This function will decode a variable of the ASN.1 BMP character string.
EXTERN int decodeByteAlign (OOCTXT *pctxt)
 This function will position the decode bit cursor on the next byte boundary.
EXTERN int decodeConsInteger (OOCTXT *pctxt, ASN1INT *pvalue, ASN1INT lower, ASN1INT upper)
 This function will decode an integer constrained either by a value or value range constraint.
EXTERN int decodeConsUnsigned (OOCTXT *pctxt, ASN1UINT *pvalue, ASN1UINT lower, ASN1UINT upper)
 This function will decode an unsigned integer constrained either by a value or value range constraint.
EXTERN int decodeConsUInt8 (OOCTXT *pctxt, ASN1UINT8 *pvalue, ASN1UINT lower, ASN1UINT upper)
 This function will decode an 8-bit unsigned integer constrained either by a value or value range constraint.
EXTERN int decodeConsUInt16 (OOCTXT *pctxt, ASN1USINT *pvalue, ASN1UINT lower, ASN1UINT upper)
 This function will decode a 16-bit unsigned integer constrained either by a value or value range constraint.
EXTERN int decodeConsWholeNumber (OOCTXT *pctxt, ASN1UINT *padjusted_value, ASN1UINT range_value)
 This function decodes a constrained whole number as specified in Section 10.5 of the X.691 standard.
EXTERN int decodeConstrainedStringEx (OOCTXT *pctxt, const char **string, const char *charSet, ASN1UINT abits, ASN1UINT ubits, ASN1UINT canSetBits)
 This function decodes a constrained string value.
EXTERN int decodeDynBitString (OOCTXT *pctxt, ASN1DynBitStr *pBitStr)
 This function will decode a variable of thr ASN.1 BIT STRING type.
EXTERN int decodeDynOctetString (OOCTXT *pctxt, ASN1DynOctStr *pOctStr)
 This function will decode a value of the ASN.1 octet string type whose maximum size is known in advance.
EXTERN int decodeLength (OOCTXT *pctxt, ASN1UINT *pvalue)
 This function will decode a length determinant value.
EXTERN int moveBitCursor (OOCTXT *pctxt, int bitOffset)
 
Parameters:
pctxt A pointer to a context structure.

EXTERN int decodeObjectIdentifier (OOCTXT *pctxt, ASN1OBJID *pvalue)
 This function decodes a value of the ASN.1 object identifier type.
EXTERN int decodeOctetString (OOCTXT *pctxt, ASN1UINT *numocts_p, ASN1OCTET *buffer, ASN1UINT bufsiz)
 This function will decode a value of the ASN.1 octet string type whose maximun size is known in advance.
EXTERN int decodeOpenType (OOCTXT *pctxt, const ASN1OCTET **object_p2, ASN1UINT *numocts_p)
 This function will decode an ASN.1 open type.
EXTERN int decodeSmallNonNegWholeNumber (OOCTXT *pctxt, ASN1UINT *pvalue)
 This function will decode a small non-negative whole number as specified in Section 10.6 of the X.691 standard.
EXTERN int decodeSemiConsInteger (OOCTXT *pctxt, ASN1INT *pvalue, ASN1INT lower)
 This function will decode a semi-constrained integer.
EXTERN int decodeSemiConsUnsigned (OOCTXT *pctxt, ASN1UINT *pvalue, ASN1UINT lower)
 This function will decode a semi-constrained unsigned integer.
EXTERN int decodeVarWidthCharString (OOCTXT *pctxt, const char **pvalue)
EXTERN int encodeBit (OOCTXT *pctxt, ASN1BOOL value)
 This function will encode a variable of the ASN.1 BOOLEAN type in a single bit.
EXTERN int encodeBits (OOCTXT *pctxt, ASN1UINT value, ASN1UINT nbits)
 This function encodes multiple bits.
EXTERN int encodeBitString (OOCTXT *pctxt, ASN1UINT numocts, const ASN1OCTET *data)
 This function will encode a value of the ASN.1 bit string type.
EXTERN int encodeBitString32 (OOCTXT *pctxt, ASN1BitStr32 *pvalue, ASN1UINT lower, ASN1UINT upper)
EXTERN int encodeBMPString (OOCTXT *pctxt, ASN1BMPString value, Asn116BitCharSet *permCharSet)
 This function will encode a variable of the ASN.1 BMP character string.
EXTERN int encodeByteAlign (OOCTXT *pctxt)
 This function will position the encode bit cursor on the next byte boundry.
EXTERN int encodeCheckBuffer (OOCTXT *pctxt, ASN1UINT nbytes)
 This function will determine if the given number of bytes will fit in the encode buffer.
EXTERN int encodeConstrainedStringEx (OOCTXT *pctxt, const char *string, const char *charSet, ASN1UINT abits, ASN1UINT ubits, ASN1UINT canSetBits)
 This function encodes a constrained string value.
EXTERN int encodeConsInteger (OOCTXT *pctxt, ASN1INT value, ASN1INT lower, ASN1INT upper)
 This function encodes an integer constrained either by a value or value range constraint.
EXTERN int encodeConsUnsigned (OOCTXT *pctxt, ASN1UINT value, ASN1UINT lower, ASN1UINT upper)
 This function encodes an unsigned integer constrained either by a value or value range constraint.
EXTERN int encodeConsWholeNumber (OOCTXT *pctxt, ASN1UINT adjusted_value, ASN1UINT range_value)
 This function encodes a constrained whole number as specified in Section 10.5 of the X.691 standard.
EXTERN int encodeExpandBuffer (OOCTXT *pctxt, ASN1UINT nbytes)
 This function will expand the buffer to hold the given number of bytes.
EXTERN ASN1OCTETencodeGetMsgPtr (OOCTXT *pctxt, int *pLength)
 This function will return the message pointer and length of an encoded message.
EXTERN int encodeLength (OOCTXT *pctxt, ASN1UINT value)
 This function will encode a length determinant value.
EXTERN int encodeObjectIdentifier (OOCTXT *pctxt, ASN1OBJID *pvalue)
 This function encodes a value of the ASN.1 object identifier type.
EXTERN int encodeBitsFromOctet (OOCTXT *pctxt, ASN1OCTET value, ASN1UINT nbits)
 This function encodes bits from a given octet to the output buffer.
EXTERN int encodeOctets (OOCTXT *pctxt, const ASN1OCTET *pvalue, ASN1UINT nbits)
 This fuction will encode an array of octets.
EXTERN int encodeOctetString (OOCTXT *pctxt, ASN1UINT numocts, const ASN1OCTET *data)
 This function will encode a value of the ASN.1 octet string type.
EXTERN int encodeOpenType (OOCTXT *pctxt, ASN1UINT numocts, const ASN1OCTET *data)
 This function will encode an ASN.1 open type.
EXTERN int encodeOpenTypeExt (OOCTXT *pctxt, DList *pElemList)
 This function will encode an ASN.1 open type extension.
EXTERN int encodeOpenTypeExtBits (OOCTXT *pctxt, DList *pElemList)
EXTERN int encodeSmallNonNegWholeNumber (OOCTXT *pctxt, ASN1UINT value)
 This function will endcode a small, non-negative whole number as specified in Section 10.6 of teh X.691 standard.
EXTERN int encodeSemiConsInteger (OOCTXT *pctxt, ASN1INT value, ASN1INT lower)
 This function encodes a semi-constrained integer.
EXTERN int encodeSemiConsUnsigned (OOCTXT *pctxt, ASN1UINT value, ASN1UINT lower)
 This function encodes an semi-constrained unsigned integer.
EXTERN int encodeUnconsUnsigned (OOCTXT *pctxt, ASN1UINT value)
EXTERN int encodeVarWidthCharString (OOCTXT *pctxt, const char *value)
EXTERN int addSizeConstraint (OOCTXT *pctxt, Asn1SizeCnst *pSize)
EXTERN ASN1BOOL alignCharStr (OOCTXT *pctxt, ASN1UINT len, ASN1UINT nbits, Asn1SizeCnst *pSize)
EXTERN int bitAndOctetStringAlignmentTest (Asn1SizeCnst *pSizeList, ASN1UINT itemCount, ASN1BOOL bitStrFlag, ASN1BOOL *pAlignFlag)
EXTERN int getPERMsgLen (OOCTXT *pctxt)
EXTERN Asn1SizeCnstgetSizeConstraint (OOCTXT *pctxt, ASN1BOOL extbit)
EXTERN int checkSizeConstraint (OOCTXT *pctxt, int size)
EXTERN ASN1UINT getUIntBitCount (ASN1UINT value)
EXTERN Asn1SizeCnstcheckSize (Asn1SizeCnst *pSizeList, ASN1UINT value, ASN1BOOL *pExtendable)
EXTERN void init16BitCharSet (Asn116BitCharSet *pCharSet, ASN116BITCHAR first, ASN116BITCHAR last, ASN1UINT abits, ASN1UINT ubits)
EXTERN ASN1BOOL isExtendableSize (Asn1SizeCnst *pSizeList)
EXTERN void set16BitCharSet (OOCTXT *pctxt, Asn116BitCharSet *pCharSet, Asn116BitCharSet *pAlphabet)
EXTERN OOINT32 lookupEnum (const char *strValue, size_t strValueSize, const OOEnumItem enumTable[], OOUINT16 enumTableSize)

Define Documentation

#define VIS_CANSET

Value:

" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]"\
"^_`abcdefghijklmnopqrstuvwxyz{|}~"

Definition at line 156 of file ooasn1.h.

#define T61_CANSET

Value:

" !\"%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]"\
"_abcdefghijklmnopqrstuvwxyz"

Definition at line 162 of file ooasn1.h.

#define IA5_CANSET

Value:

"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017"\
"\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"\
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]"\
"^_`abcdefghijklmnopqrstuvwxyz{|}~"

Definition at line 168 of file ooasn1.h.

#define GEN_CANSET

Value:

"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017"\
"\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"\
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"\
"`abcdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207"\
"\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237"\
"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257"\
"\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277"\
"\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317"\
"\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337"\
"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357"\
"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377"

Definition at line 179 of file ooasn1.h.

#define INCRBITIDX ( pctxt   ) 

Value:

((--(pctxt)->buffer.bitOffset < 0) ? \
((++(pctxt)->buffer.byteIndex >= (pctxt)->buffer.size) ? ASN_E_ENDOFBUF : \
((pctxt)->buffer.bitOffset = 7, ASN_OK)) : ASN_OK)
rtmem

Definition at line 1019 of file ooasn1.h.

#define DECODEBIT ( pctxt,
pvalue   ) 

Value:

((INCRBITIDX (pctxt) != ASN_OK) ? ((*(pvalue) = 0), ASN_E_ENDOFBUF) : \
((*(pvalue) = (((pctxt)->buffer.data[(pctxt)->buffer.byteIndex]) & \
(1 << (pctxt)->buffer.bitOffset)) != 0), ASN_OK))

Definition at line 1024 of file ooasn1.h.

#define decodeUnconsInteger ( pctxt,
pvalue   )     decodeSemiConsInteger(pctxt, pvalue, ASN1INT_MIN)

This function will decode an unconstrained integer.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to integer variable to receive decoded value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

Definition at line 1412 of file ooasn1.h.

#define decodeUnconsUnsigned ( pctxt,
pvalue   )     decodeSemiConsUnsigned(pctxt, pvalue, 0U)

This function will decode an unconstrained unsigned integer.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to unsigned integer variable to receive decoded value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

Definition at line 1425 of file ooasn1.h.

#define encodeUnconsInteger ( pctxt,
value   )     encodeSemiConsInteger(pctxt,value,ASN1INT_MIN)

This function encodes an unconstrained integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

Definition at line 1802 of file ooasn1.h.


Function Documentation

EXTERN int decodeBits ( OOCTXT pctxt,
ASN1UINT pvalue,
ASN1UINT  nbits 
)

This function will decode a series of multiple bits and place the results in an unsigned integer variable.

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.
pvalue A pointer to an unsigned integer variable to receive the decoded result.
nbits The number of bits to decode.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeBitString ( OOCTXT pctxt,
ASN1UINT numbits_p,
ASN1OCTET buffer,
ASN1UINT  bufsiz 
)

This function will decode a value of the ASN.1 bit string type whose maximum size is is known in advance.

The ASN1C complier generates a call to this function to decode bit string productions or elements that contain a size constraint.

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.
numbits_p Pointer to an unsigned integer variable to receive decoded number of bits.
buffer Pointer to a fixed-size or pre-allocated array of bufsiz octets to receive a decoded bit string.
bufsiz Length (in octets) of the buffer to receive the decoded bit string.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeBMPString ( OOCTXT pctxt,
ASN1BMPString pvalue,
Asn116BitCharSet permCharSet 
)

This function will decode a variable of the ASN.1 BMP character string.

This differs from the decode routines for the character strings previously described in that the BMP string type is based on 16-bit characters. A 16-bit character string is modeled using an array of unsigned short integers.

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.
pvalue Pointer to character string structure to receive the decoded result The structure includes a count field containing the number of characters and an array of unsigned short integers to hold the 16-bit character values.
permCharSet A pointer to the constraining character set. This contains an array containing all valid characters in the set as well as the aligned and unaligned bit counts required to encode the characters.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeByteAlign ( OOCTXT pctxt  ) 

This function will position the decode bit cursor on the next byte boundary.

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.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeConsInteger ( OOCTXT pctxt,
ASN1INT pvalue,
ASN1INT  lower,
ASN1INT  upper 
)

This function will decode an integer constrained either by a value or value range constraint.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to integer variable to receive decoded value.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeConsUnsigned ( OOCTXT pctxt,
ASN1UINT pvalue,
ASN1UINT  lower,
ASN1UINT  upper 
)

This function will decode an unsigned integer constrained either by a value or value range constraint.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to unsigned integer variable to receive decoded value.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeConsUInt8 ( OOCTXT pctxt,
ASN1UINT8 pvalue,
ASN1UINT  lower,
ASN1UINT  upper 
)

This function will decode an 8-bit unsigned integer constrained either by a value or value range constraint.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to 8-bit unsigned integer variable to receive decoded value.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeConsUInt16 ( OOCTXT pctxt,
ASN1USINT pvalue,
ASN1UINT  lower,
ASN1UINT  upper 
)

This function will decode a 16-bit unsigned integer constrained either by a value or value range constraint.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to 16-bit unsigned integer variable to receive decoded value.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeConsWholeNumber ( OOCTXT pctxt,
ASN1UINT padjusted_value,
ASN1UINT  range_value 
)

This function decodes a constrained whole number as specified in Section 10.5 of the X.691 standard.

Parameters:
pctxt Pointer to context block structure.
padjusted_value Pointer to unsigned adjusted integer value to receive decoded result. To get the final value, this value is added to the lower boundary of the range.
range_value Unsigned integer value specifying the total size of the range. This is obtained by subtracting the lower range value from the upper range value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeConstrainedStringEx ( OOCTXT pctxt,
const char **  string,
const char *  charSet,
ASN1UINT  abits,
ASN1UINT  ubits,
ASN1UINT  canSetBits 
)

This function decodes a constrained string value.

This version of the function allows all of the required permitted alphabet constraint parameters to be passed in as arguments.

Parameters:
pctxt Pointer to context block structure.
string Pointer to const char* to receive decoded string. Memory will be allocated for this variable using internal memory management functions.
charSet String containing permitted alphabet character set. Can be null if no character set was specified.
abits Number of bits in a character set character (aligned).
ubits Number of bits in a character set character (unaligned).
canSetBits Number of bits in a character from the canonical set representing this string.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeDynBitString ( OOCTXT pctxt,
ASN1DynBitStr pBitStr 
)

This function will decode a variable of thr ASN.1 BIT STRING type.

This function allocates dynamic memory t store the decoded result. The ASN1C complier generates a call to this function to decode an unconstrained bit string production or 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.
pBitStr Pointer to a dynamic bit string structure to receive the decoded result. This structure contains a field to hold the number of decoded bits and a pointer to an octet string to hold the decoded data. Memory is allocated by the decoder using the memAlloc function. This memory is tracked within the context and released when the freeContext function is invoked.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeDynOctetString ( OOCTXT pctxt,
ASN1DynOctStr pOctStr 
)

This function will decode a value of the ASN.1 octet string type whose maximum size is known in advance.

The ASN1C complier generates a call to this function to decode octet string productions or elements that contain a size constraint.

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.
pOctStr A pointer to a dynamic octet string to receive the decoded result.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeLength ( OOCTXT pctxt,
ASN1UINT pvalue 
)

This function will decode a length determinant value.

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.
pvalue A pointer to an unsigned integer variable to receive the decoded length value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int moveBitCursor ( OOCTXT pctxt,
int  bitOffset 
)

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.

Parameters:
bitOffset The bit offset inside the message buffer.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeObjectIdentifier ( OOCTXT pctxt,
ASN1OBJID pvalue 
)

This function decodes a value of the ASN.1 object identifier type.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to value to receive decoded result. The ASN1OBJID structure contains an integer to hold the number of subidentifiers and an array to hold the subidentifier values.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeOctetString ( OOCTXT pctxt,
ASN1UINT numocts_p,
ASN1OCTET buffer,
ASN1UINT  bufsiz 
)

This function will decode a value of the ASN.1 octet string type whose maximun size is known in advance.

The ASN1C compiler generates a call to this function to decode octet string productions or elements that contain a size constraint.

Parameters:
pctxt 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.
numocts_p A pointer to an unsigned buffer of bufsiz octets to receive decoded data.
buffer A pointer to a pre-allocated buffer of size octets to receive the decoded data.
bufsiz The size of the buffer to receive the decoded result.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeOpenType ( OOCTXT pctxt,
const ASN1OCTET **  object_p2,
ASN1UINT numocts_p 
)

This function will decode an ASN.1 open type.

This used to be the ASN.1 ANY type, but now is used in a variety of applications requiring an encoding that can be interpreted by a decoder without prior knowledge of the type of the variable.

Parameters:
pctxt 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.
numocts_p A pointer to an unsigned buffer of bufsiz octets to receive decoded data.
object_p2 A pointer to an open type variable to receive the decoded data.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeSmallNonNegWholeNumber ( OOCTXT pctxt,
ASN1UINT pvalue 
)

This function will decode a small non-negative whole number as specified in Section 10.6 of the X.691 standard.

This is a number that is expected to be small, but whose size is potentially unlimited due to the presence of an extension maker.

Parameters:
pctxt Pointer to a context structure. This provides a storage area for the function to store all workings variables that must be maintained between function calls.
pvalue Pointer to an unsigned integer value t receive decoded results.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeSemiConsInteger ( OOCTXT pctxt,
ASN1INT pvalue,
ASN1INT  lower 
)

This function will decode a semi-constrained integer.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to integer variable to receive decoded value.
lower Lower range value, represented as signed integer.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int decodeSemiConsUnsigned ( OOCTXT pctxt,
ASN1UINT pvalue,
ASN1UINT  lower 
)

This function will decode a semi-constrained unsigned integer.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to unsigned integer variable to receive decoded value.
lower Lower range value, represented as unsigned integer.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeBit ( OOCTXT pctxt,
ASN1BOOL  value 
)

This function will encode a variable of the ASN.1 BOOLEAN type in a single bit.

Parameters:
pctxt 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 The BOOLEAN value to be encoded.

EXTERN int encodeBits ( OOCTXT pctxt,
ASN1UINT  value,
ASN1UINT  nbits 
)

This function encodes multiple bits.

Parameters:
pctxt Pointer to context block structure.
value Unsigned integer containing the bits to be encoded.
nbits Number of bits in value to encode.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeBitString ( OOCTXT pctxt,
ASN1UINT  numocts,
const ASN1OCTET data 
)

This function will encode a value 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.
numocts The number of bits n the string to be encoded.
data Pointer to the bit string data to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeBMPString ( OOCTXT pctxt,
ASN1BMPString  value,
Asn116BitCharSet permCharSet 
)

This function will encode a variable of the ASN.1 BMP character string.

This differs from the encode routines for the character strings previously described in that the BMP string type is based on 16-bit characters. A 16-bit character string is modeled using an array of unsigned short integers.

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 Character string to be encoded. This structure includes a count field containing the number of characters to encode and an array of unsigned short integers to hold the 16-bit characters to be encoded.
permCharSet Pointer to the constraining character set. This contains an array containing all valid characters in the set as well as the aligned and unaligned bit counts required to encode the characters.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeByteAlign ( OOCTXT pctxt  ) 

This function will position the encode bit cursor on the next byte boundry.

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.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeCheckBuffer ( OOCTXT pctxt,
ASN1UINT  nbytes 
)

This function will determine if the given number of bytes will fit in the encode buffer.

If not, either the buffer is expanded (if it is a dynamic buffer) or an error is signaled.

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.
nbytes Number of bytes of space required to hold the variable to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeConstrainedStringEx ( OOCTXT pctxt,
const char *  string,
const char *  charSet,
ASN1UINT  abits,
ASN1UINT  ubits,
ASN1UINT  canSetBits 
)

This function encodes a constrained string value.

This version of the function allows all of the required permitted alphabet constraint parameters to be passed in as arguments.

Parameters:
pctxt Pointer to context block structure.
string Pointer to string to be encoded.
charSet String containing permitted alphabet character set. Can be null if no character set was specified.
abits Number of bits in a character set character (aligned).
ubits Number of bits in a character set character (unaligned).
canSetBits Number of bits in a character from the canonical set representing this string.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeConsInteger ( OOCTXT pctxt,
ASN1INT  value,
ASN1INT  lower,
ASN1INT  upper 
)

This function encodes an integer constrained either by a value or value range constraint.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeConsUnsigned ( OOCTXT pctxt,
ASN1UINT  value,
ASN1UINT  lower,
ASN1UINT  upper 
)

This function encodes an unsigned integer constrained either by a value or value range constraint.

The constrained unsigned integer option is used if:

1. The lower value of the range is >= 0, and 2. The upper value of the range is >= MAXINT

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeConsWholeNumber ( OOCTXT pctxt,
ASN1UINT  adjusted_value,
ASN1UINT  range_value 
)

This function encodes a constrained whole number as specified in Section 10.5 of the X.691 standard.

Parameters:
pctxt Pointer to context block structure.
adjusted_value Unsigned adjusted integer value to be encoded. The adjustment is done by subtracting the lower value of the range from the value to be encoded.
range_value Unsigned integer value specifying the total size of the range. This is obtained by subtracting the lower range value from the upper range value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeExpandBuffer ( OOCTXT pctxt,
ASN1UINT  nbytes 
)

This function will expand the buffer to hold the given number of bytes.

Parameters:
pctxt 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.
nbytes The number of bytes the buffer is to be expanded by. Note that the buffer will be expanded by ASN_K_ENCBIFXIZ or nbytes (whichever is larger.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN ASN1OCTET* encodeGetMsgPtr ( OOCTXT pctxt,
int *  pLength 
)

This function will return the message pointer and length of an encoded message.

This function is called after a complier generated encode function to get the pointer and length of the message. It is normally used when dynamic encoding is specified because the message pointer is not known until encoding is complete. If static encoding is used, the message starts at the beginning of the specified buffer adn the encodeGetMsgLen function can be used to obtain the lenght of the message.

Parameters:
pctxt 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.
pLength Pointer to variable to receive length of the encoded message.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeLength ( OOCTXT pctxt,
ASN1UINT  value 
)

This function will encode a length determinant value.

Parameters:
pctxt 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 Length value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeObjectIdentifier ( OOCTXT pctxt,
ASN1OBJID pvalue 
)

This function encodes a value of the ASN.1 object identifier type.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to value to be encoded. The ASN1OBJID structure contains a numids fields to hold the number of subidentifiers and an array to hold the subidentifier values.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeBitsFromOctet ( OOCTXT pctxt,
ASN1OCTET  value,
ASN1UINT  nbits 
)

This function encodes bits from a given octet to the output buffer.

Parameters:
pctxt Pointer to ASN.1 PER context structure
value Value of bits to be encoded
nbits Number of bits to be encoded
Returns:
Status of operation

EXTERN int encodeOctets ( OOCTXT pctxt,
const ASN1OCTET pvalue,
ASN1UINT  nbits 
)

This fuction will encode an array of octets.

The Octets will be encoded unaligned starting at the current bit offset within the encode buffer.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
pvalue A pointer to an array of octets to encode
nbits The number of Octets to encode
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeOctetString ( OOCTXT pctxt,
ASN1UINT  numocts,
const ASN1OCTET data 
)

This function will encode a value of the ASN.1 octet string type.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
numocts Number of octets in the string to be encoded.
data Pointer to octet string data to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeOpenType ( OOCTXT pctxt,
ASN1UINT  numocts,
const ASN1OCTET data 
)

This function will encode an ASN.1 open type.

This used to be the ANY type, but now is used in a variety of applications requiring an encoding that can be interpreted by a decoder without a prior knowledge of the type of the variable.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
numocts Number of octets in the string to be encoded.
data Pointer to octet string data to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeOpenTypeExt ( OOCTXT pctxt,
DList *  pElemList 
)

This function will encode an ASN.1 open type extension.

An open type extension field is the data that potentially resides after the ... marker in a version-1 message. The open type structure contains a complete encoded bit set including option element bits or choice index, length, and data. Typically, this data is populated when a version-1 system decodes a version-2 message. The extension fields are retained and can then be re-encoded if a new message is to be sent out (for example, in a store and forward system).

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
pElemList A pointer to the open type to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeSmallNonNegWholeNumber ( OOCTXT pctxt,
ASN1UINT  value 
)

This function will endcode a small, non-negative whole number as specified in Section 10.6 of teh X.691 standard.

This is a number that is expected to be small, but whose size is potentially unlimited due to the presence of an extension marker.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
value An unsigned integer value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeSemiConsInteger ( OOCTXT pctxt,
ASN1INT  value,
ASN1INT  lower 
)

This function encodes a semi-constrained integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
lower Lower range value, represented as signed integer.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

EXTERN int encodeSemiConsUnsigned ( OOCTXT pctxt,
ASN1UINT  value,
ASN1UINT  lower 
)

This function encodes an semi-constrained unsigned integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
lower Lower range value, represented as unsigned integer.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.


This file was last modified on 28 May 2010.
Objective Open H.323 Stack, 0.9.1