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

Google


Objective Systems, Inc.

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

C Runtime Common Functions


Modules

Memory Allocation Macros and Functions
Context Management Functions
Linked List Utility Functions
Diagnostic Trace Functions
Error Formatting and Print Functions
Memory Buffer Management Functions
Object Identifier Helper Functions
Linked List and Stack Utility Functions
REAL Helper Functions
Formatted Printing Functions
Binary Coded Decimal (BCD) Helper Functions
Character String Conversion Functions
Big Integer Helper Functions
Time Helper Functions
Comparison Functions
Comparison to Standard Output Functions
Copy Functions
Print Values to Standard Output

Compounds

struct  _ASN1ListElem
struct  _Asn1RTDList
struct  _Asn1RTDListNode
struct  _Asn1RTSList
struct  _Asn1RTSListNode
struct  _Asn1RTStack
struct  _Asn1SizeCnst
struct  _OSDATETIME
struct  Asn116BitCharSet
struct  Asn116BitCharString
struct  Asn132BitCharSet
struct  Asn132BitCharString
union  ASN1_DFLOAT
struct  ASN1BigInt
struct  ASN1BUFFER
struct  ASN1BUFSAVE
struct  ASN1CCB
struct  Asn1CharArray
struct  Asn1CharSet
struct  ASN1CTXT
struct  ASN1DynBitStr
struct  ASN1DynOctStr
struct  ASN1ErrInfo
struct  ASN1ErrLocn
struct  ASN1MemBuf
struct  Asn1Object
struct  ASN1OBJID
struct  ASN1OctStr
struct  ASN1OID64
struct  ASN1OpenType
struct  ASN1SeqOf
struct  ASN1SeqOfOctStr

Defines

#define ASN1C_EXPANDED_TAGS
#define TV_UNIV   0
#define TV_APPL   1
#define TV_CTXT   2
#define TV_PRIV   3
#define TV_PRIM   0
#define TV_CONS   1
#define TM_UNIV   0x00000000
#define TM_APPL   0x40000000
#define TM_CTXT   0x80000000
#define TM_PRIV   0xC0000000
#define TM_PRIM   0x00000000
#define TM_CONS   0x20000000
#define TM_IDCODE   0x1FFFFFFF
#define ASN_K_BADTAG   0xFFFFFFFF
#define ASN_K_NOTAG   0xFFFFFFFF
#define TM_CLASS   0xC0
#define TM_FORM   0x20
#define TM_CLASS_FORM   0xE0
#define TM_B_IDCODE   0x1F
#define FALSE   0
#define TRUE   1
#define MINMSGLEN   8
#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   16*1024
#define ASN_K_MEMBUFSEG   1024
#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   (ASN1REAL)DBL_MAX
#define ASN1REALMIN   (ASN1REAL)-DBL_MAX
#define ASN1TAG_LSHIFT   24
#define ASN1UINT_MAX   4294967295U
#define ASN1INT_MAX   ((ASN1INT)2147483647L)
#define ASN1INT_MIN   ((ASN1INT)(-ASN1INT_MAX-1))
#define ASN1INT64   long
#define ASN1UINT64   unsigned long
#define ASN1INT64FMT   "%ld"
#define ASN1UINT64FMT   "%lu"
#define ASN1INT64FMTX   "%lx"
#define ASN1INT64MAX   LONG_MAX
#define ASN1UINT64MAX   ULONG_MAX
#define ASN1INT64MIN   LONG_MIN
#define ASN1I64CONST(val)   val##L
#define ASN1UI64CONST(val)   val##UL
#define ASN1Const
#define ASN1_K_CCBMaskSize   32
#define ASN1_K_NumBitsPerMask   16
#define ASN1_K_MaxSetElements   (ASN1_K_CCBMaskSize*ASN1_K_NumBitsPerMask)
#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 OSRTISSTREAM(pctxt)   ((pctxt)->pStream != 0)
#define OSDT_MAXSECFRAC   20
#define ASN1MEMBUFPTR(pmb)   ((pmb)->buffer + (pmb)->startidx)
#define ASN1MEMBUFENDPTR(pmb)   ((pmb)->buffer + (pmb)->startidx + (pmb)->usedcnt)
#define ASN1MEMBUFUSEDSIZE(pmb)   ((size_t)(pmb)->usedcnt)
#define ASN1MBAPPENDSTR(pmb, str)   rtMemBufAppend(pmb,(ASN1OCTET*)str,strlen(str))
#define ASN1MBAPPENDUTF8(pmb, str)   rtMemBufAppend(pmb,(ASN1OCTET*)str,rtxUTF8LenBytes(str))
#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 ASN1BUF_INDEFLEN(cp)   (((cp)->flags&ASN1INDEFLEN)!=0)
#define ASN1BUF_PTR(cp)   ASN1BUFPTR(cp)
#define ASN1NUMOCTS(nbits)   ((nbits>0)?(((nbits-1)/8)+1):0)
#define RTDIAG1(msg)
#define RTDIAG2(msg, a)
#define RTDIAG3(msg, a, b)
#define RTDIAG4(msg, a, b, c)
#define RTDIAG5(msg, a, b, c, d)
#define RTDIAG6(msg, a, b, c, d, e)
#define RTDIAG7(msg, a, b, c, d, e, f)
#define RTDIAG8(msg, a, b, c, d, e, f, g)
#define RTDIAG9(msg, a, b, c, d, e, f, g, h)
#define RTDIAG10(msg, a, b, c, d, e, f, g, h, i)
#define RTHEXDUMP(buffer, numocts)
#define HEXCHARTONIBBLE(ch, b)
#define NIBBLETOHEXCHAR(b, ch)
#define EXTERN
#define ASN1CRTMALLOC0(nbytes)   malloc(nbytes)
#define ASN1CRTFREE0(ptr)   free(ptr)
#define ASN1CRTMALLOC   ASN1MALLOC
#define ASN1CRTFREE   ASN1MEMFREEPTR
#define OSSETBIT(bitStr, bitIndex)   rtSetBit (bitStr.data, bitStr.numbits, bitIndex)
#define OSSETBITP(pBitStr, bitIndex)   rtSetBit ((pBitStr)->data, (pBitStr)->numbits, bitIndex)
#define OSCLEARBIT(bitStr, bitIndex)   rtClearBit (bitStr.data, bitStr.numbits, bitIndex)
#define OSCLEARBITP(pBitStr, bitIndex)   rtClearBit ((pBitStr)->data, (pBitStr)->numbits, bitIndex)
#define OSTESTBIT(bitStr, bitIndex)   rtTestBit (bitStr.data, bitStr.numbits, bitIndex)
#define OSTESTBITP(pBitStr, bitIndex)   rtTestBit ((pBitStr)->data, (pBitStr)->numbits, bitIndex)
#define rtSetStrToBigInt   rtBigIntSetStr
#define rtSetInt64ToBigInt   rtBigIntSetInt64
#define rtSetBytesToBigInt   rtBigIntSetBytes
#define rtGetBigIntLen   rtBigIntGetDataLen
#define rtGetBigInt   rtBigIntGetData
#define rtPrintBigInt   rtBigIntPrint
#define rtCompareBigInt   rtBigIntCompare
#define rtCompareBigIntStr   rtBigIntStrCompare

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 char * ASN1ConstCharPtr
typedef ASN1OCTET * ASN1ConstOctetPtr
typedef void * ASN1ConstVoidPtr
typedef ASN116BITCHAR * ASN1Const16BitCharPtr
typedef _ASN1ListElem ASN1ListElem
typedef Asn1Object ASN1Object
typedef ASN1ConstCharPtr ASN1GeneralizedTime
typedef ASN1ConstCharPtr ASN1GeneralString
typedef ASN1ConstCharPtr ASN1GraphicString
typedef ASN1ConstCharPtr ASN1IA5String
typedef ASN1ConstCharPtr ASN1ISO646String
typedef ASN1ConstCharPtr ASN1NumericString
typedef ASN1ConstCharPtr ASN1ObjectDescriptor
typedef ASN1ConstCharPtr ASN1PrintableString
typedef ASN1ConstCharPtr ASN1TeletexString
typedef ASN1ConstCharPtr ASN1T61String
typedef ASN1ConstCharPtr ASN1UTCTime
typedef ASN1ConstCharPtr ASN1UTF8String
typedef ASN1ConstCharPtr ASN1VideotexString
typedef ASN1ConstCharPtr ASN1VisibleString
typedef Asn116BitCharString ASN1BMPString
typedef Asn132BitCharString ASN1UniversalString
typedef ASN1BigInt ASN1BigInt
typedef _Asn1RTSListNode Asn1RTSListNode
typedef _Asn1RTSList Asn1RTSList
typedef _Asn1RTDListNode Asn1RTDListNode
typedef _Asn1RTDList Asn1RTDList
typedef _Asn1RTStack Asn1RTStack
typedef _Asn1SizeCnst Asn1SizeCnst
typedef ASN1CTXT ASN1CTXT
typedef ASN1MemBuf ASN1MemBuf
typedef _OSDATETIME OSDATETIME
typedef int(* ASN1DumpCbFunc )(ASN1ConstCharPtr text_p, void *cbArg_p)

Enumerations

enum  ASN1TagType { ASN1IMPL, ASN1EXPL }
enum  ASN1StrType { ASN1HEX, ASN1BIN, ASN1CHR }
enum  ASN1ActionType { ASN1ENCODE, ASN1DECODE }

Functions

int rtBase64EncodeData (ASN1CTXT *pctxt, ASN1ConstOctetPtr pSrcData, int srcDataSize, ASN1OCTET **ppDstData)
int rtBase64DecodeData (ASN1CTXT *pctxt, ASN1ConstOctetPtr pSrcData, int srcDataSize, ASN1OCTET **ppDstData)
int rtCheckBuffer (ASN1CTXT *pctxt, ASN1UINT nbytes)
void rtCopyContext (ASN1CTXT *pdest, ASN1CTXT *psrc)
void rtXchgContext (ASN1CTXT *pdest, ASN1CTXT *psrc)
void rtCtxtSetFlag (ASN1CTXT *pctxt, ASN1USINT mask)
void rtCtxtClearFlag (ASN1CTXT *pctxt, ASN1USINT mask)
int rtGetIdentByteCount (ASN1UINT ident)
int rtGetIdent64ByteCount (ASN1UINT64 ident)
unsigned int rtIntByteCount (ASN1INT val)
int rtOctetBitLen (ASN1OCTET w)
int rtSetBit (ASN1OCTET *pBits, int numbits, int bitIndex)
int rtClearBit (ASN1OCTET *pBits, int numbits, int bitIndex)
ASN1BOOL rtTestBit (ASN1ConstOctetPtr pBits, int numbits, int bitIndex)
int rtWriteBytes (ASN1CTXT *pctxt, ASN1ConstOctetPtr pdata, ASN1UINT nocts)
int rtFileReadBinary (ASN1CTXT *pctxt, ASN1ConstCharPtr filePath, ASN1OCTET **ppMsgBuf, int *pLength)

Variables

int g_debug


Define Documentation

#define HEXCHARTONIBBLE ch,
 ) 
 

Value:

if (ch >= '0' && ch <= '9') b = (unsigned char)(ch - '0'); \
else if (ch >= 'a' && ch <= 'f') b = (unsigned char)((ch - 'a') + 10); \
else if (ch >= 'A' && ch <= 'F') b = (unsigned char)((ch - 'A') + 10); \
else b = 0xFF;

#define NIBBLETOHEXCHAR b,
ch   ) 
 

Value:

if (b >= 0 && b <= 9) ch = (char)(b + '0'); \
else if (b >= 0x0a && b <= 0x0f) ch = (char)((b - 10)+ 'a'); \
else ch = '?';


Function Documentation

int rtClearBit ASN1OCTET *  pBits,
int  numbits,
int  bitIndex
 

This function clears specified bit in the bit string.

Parameters:
pBits Pointer to octets of bit string.
numbits Number of bits in the bit string.
bitIndex Index of bit to be cleared. The bit with index 0 is a most significant bit in the octet with index 0.
Returns:
If successful, returns the previous state of bit. If bit was set the return value is positive, if bit was not set the return value is zero. Otherwise, return value is an error code:
  • ASN_E_OUTOFBND = bitIndex is out of bound (see errno)

int rtFileReadBinary ASN1CTXT *  pctxt,
ASN1ConstCharPtr  filePath,
ASN1OCTET **  ppMsgBuf,
int *  pLength
 

This function reads the entire contents of a binary file into memory. A memory buffer is allocated for the file contents using the ASN1C run-time memory management functions.

Parameters:
pctxt Pointer to context block structure.
filePath Complete file path name of file to read.
ppMsgBuf Pointer to message buffer to receive allocated memory pointer.
pLength Pointer to integer to receive length of data read.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • ASN_E_FILNOTFOU = file not found
  • ASN_E_FILEREAD = file read error (see errno)

int rtSetBit ASN1OCTET *  pBits,
int  numbits,
int  bitIndex
 

This function sets specified bit in the bit string.

Parameters:
pBits Pointer to octets of bit string.
numbits Number of bits in the bit string.
bitIndex Index of bit to be set. The bit with index 0 is a most significant bit in the octet with index 0.
Returns:
If successful, returns the previous state of bit. If bit was set the return value is positive, if bit was not set the return value is zero. Otherwise, return value is an error code:
  • ASN_E_OUTOFBND = bitIndex is out of bound (see errno)

ASN1BOOL rtTestBit ASN1ConstOctetPtr  pBits,
int  numbits,
int  bitIndex
 

This function tests specified bit in the bit string.

Parameters:
pBits Pointer to octets of bit string.
numbits Number of bits in the bit string.
bitIndex Index of bit to be tested. The bit with index 0 is a most significant bit in the octet with index 0.
Returns:
True if bit set or false if not set or array index is beyond range of number of bits in the string.


Copyright © 1997-2003 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 14 Nov 2003.
ASN1C C/C++ Common Runtime, ASN1C v5.6x