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.

asn1per.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1997-2005 by Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
00022  *
00023  *****************************************************************************/
00024 
00025 /*
00026 // CHANGE LOG
00027 // Date         Init    Description
00028 // 04/24/02     ED      Moved character set data to asn1CharSet.h
00029 // 04/30/02     AB      Added Universal string routines
00030 // 05/08/02     AB      Added p?_oid64 prototypes
00031 // 05/10/02     AB      Added RELATIVE-OID
00032 // 10/15/02     ED      Changes to PER permitted alphabet constraint
00033 //                      handling.
00034 // 10/27/02     AB      Int64/UInt64 encode/decode funcs added
00035 // 11/06/02     AB      PD_BYTE_ALIGN0 added
00036 // 10/31/03     CZ      Expand mainpage text.
00037 //
00039 */
00075 #ifndef _ASN1PER_H_
00076 #define _ASN1PER_H_
00077 
00078 #include "asn1type.h"
00079 
00092 /* The following constant is stored in an enumerated value if the       */
00093 /* parsed value is not within the defined set of extended enum values   */
00094 /* (note: this is only done in the case of PER because the actual value */
00095 /* is not known - in BER, the actual value is stored)..                 */
00096 
00097 #define ASN_K_EXTENUM   999
00098 
00099 /* 
00100 *Structure to track encoded PER fields 
00101 */
00102 
00103 typedef struct PERField {
00104    ASN1ConstCharPtr name;
00105    size_t       bitOffset;
00106    size_t       numbits;
00107 } PERField;
00108 
00109 /* 
00110 *Structure to track encoded PER fields 
00111 */
00112 typedef struct {
00113    unsigned char lb, lbm;
00114    char fmtBitBuffer[40], fmtHexBuffer[10], fmtAscBuffer[10];
00115    int  fmtBitCharIdx, fmtHexCharIdx, fmtAscCharIdx;
00116 } BinDumpBuffer;
00117 
00118 /* Macro to create a character set */
00119 
00120 #define PU_SETCHARSET(csetvar, canset, abits, ubits) \
00121 csetvar.charSet.nchars = 0; \
00122 csetvar.canonicalSet = canset; \
00123 csetvar.canonicalSetSize = sizeof(canset)-1; \
00124 csetvar.canonicalSetBits = pu_bitcnt(csetvar.canonicalSetSize); \
00125 csetvar.charSetUnalignedBits = ubits; \
00126 csetvar.charSetAlignedBits = abits;
00127 
00128 #include "asn1CharSet.h"
00129 
00130 /* Macros */
00131 
00132 #ifdef _TRACE
00133 #define PU_INSLENFLD(ctxt_p)       pu_insLenField(ctxt_p)
00134 #define PU_NEWFIELD(ctxt_p,suffix) pu_newField(ctxt_p,suffix)
00135 #define PU_PUSHNAME(ctxt_p,name)   pu_pushName(ctxt_p,name)
00136 #define PU_POPNAME(ctxt_p)         pu_popName(ctxt_p)
00137 #define PU_SETBITOFFSET(ctxt_p)    pu_setFldBitOffset(ctxt_p)
00138 #define PU_SETBITCOUNT(ctxt_p)     pu_setFldBitCount(ctxt_p)
00139 #define PU_PUSHELEMNAME(ctxt_p,idx) pu_pushElemName(ctxt_p,idx)
00140 #else
00141 #define PU_INSLENFLD(ctxt_p)
00142 #define PU_NEWFIELD(ctxt_p,suffix)
00143 #define PU_PUSHNAME(ctxt_p,name)
00144 #define PU_POPNAME(ctxt_p)
00145 #define PU_SETBITOFFSET(ctxt_p)
00146 #define PU_SETBITCOUNT(ctxt_p)
00147 #define PU_PUSHELEMNAME(ctxt_p,idx)
00148 #endif
00149 
00150 #ifdef __cplusplus
00151 extern "C" {
00152 #endif
00153 
00154 #ifdef BUILDASN1PERDLL
00155 #define EXTERNPER __declspec(dllexport)
00156 #elif defined (USEASN1PERDLL)
00157 #define EXTERNPER __declspec(dllimport)
00158 #else
00159 #define EXTERNPER
00160 #endif /* BUILDASN1PERDLL */
00161 
00162 /* Function prototypes */
00163 
00164 #define PD_INCRBITIDX(ctxt_p) \
00165 ((--(ctxt_p)->buffer.bitOffset < 0) ? \
00166 ((++(ctxt_p)->buffer.byteIndex >= (ctxt_p)->buffer.size) ? ASN_E_ENDOFBUF : \
00167 ((ctxt_p)->buffer.bitOffset = 7, ASN_OK)) : ASN_OK)
00168 
00169 /* This macro is an optimized version of pd_bit function */
00170 
00171 #define PD_BIT(ctxt_p,pvalue) \
00172 ((PD_INCRBITIDX (ctxt_p) != ASN_OK) ? ASN_E_ENDOFBUF : ((pvalue) ? \
00173 ((*(pvalue) = (ASN1OCTET)((((ctxt_p)->buffer.data[(ctxt_p)->buffer.byteIndex]) & \
00174 (1 << (ctxt_p)->buffer.bitOffset)) != 0)), ASN_OK) : ASN_OK ))
00175 
00176 /* This macro is an optimized version of pu_getSizeConstraint function */
00177 
00178 #define PU_GETSIZECONSTRAINT(ctxt_p,extbit,pSize) \
00179 ((((pSize) = ctxt_p->pSizeConstraint) != 0) ? \
00180 ((((pSize) = ctxt_p->pSizeConstraint)->extended == extbit)?(pSize) : \
00181 pu_getSizeConstraint (ctxt_p,extbit)) : NULL)
00182 
00183 /* This macro calculates the relative bit offset to the current buffer position. */
00184 
00185 #define PU_GETCTXTBITOFFSET(ctxt_p) \
00186 (((ctxt_p)->buffer.byteIndex * 8) + (8 - (ctxt_p)->buffer.bitOffset))
00187 
00188 /* This macro sets the bit offset to the given value within the context */
00189 
00190 #define PU_SETCTXTBITOFFSET(ctxt_p,_bitOffset) \
00191 do { \
00192 (ctxt_p)->buffer.byteIndex = (_bitOffset / 8); \
00193 (ctxt_p)->buffer.bitOffset = (ASN1USINT)(8 - (_bitOffset % 8)); \
00194 } while(0)
00195 
00196 /* These macros are an optimized version of pd_byte_align function */
00197 
00198 #define PD_BYTE_ALIGN0(ctxt_p) \
00199 ((!(ctxt_p)->buffer.aligned) ? ASN_OK : \
00200 (((ctxt_p)->buffer.bitOffset != 8) ? ( \
00201 (ctxt_p)->buffer.byteIndex++,       \
00202 (ctxt_p)->buffer.bitOffset = 8,     \
00203 ASN_OK) : ASN_OK                    \
00204 ))
00205 
00206 #ifdef _TRACE
00207 #define PD_BYTE_ALIGN(ctxt_p) \
00208 ((!(ctxt_p)->buffer.aligned) ? ASN_OK : \
00209 (((ctxt_p)->buffer.bitOffset != 8) ? ( \
00210 (ctxt_p)->buffer.byteIndex++,       \
00211 (ctxt_p)->buffer.bitOffset = 8,     \
00212 pu_setFldBitOffset(ctxt_p),         \
00213 ASN_OK) : ASN_OK                    \
00214 ))
00215 #else
00216 #define PD_BYTE_ALIGN PD_BYTE_ALIGN0
00217 #endif
00218 
00219 #define PD_CHECKSEQOFLEN(pctxt,numElements,minElemBits) \
00220 ((pctxt->buffer.size > 0) ?  \
00221 (((numElements * minElemBits) > (pctxt->buffer.size * 8)) ? \
00222 ASN_E_INVLEN : ASN_OK) : ASN_OK)
00223 
00255 EXTERNPER int pd_bit (ASN1CTXT* ctxt_p, ASN1BOOL* pvalue);
00256 
00272 EXTERNPER int pd_bits 
00273 (ASN1CTXT* ctxt_p, ASN1UINT* pvalue, ASN1UINT nbits);
00274 
00295 EXTERNPER int pd_BigInteger 
00296 (ASN1CTXT *ctxt_p, ASN1ConstCharPtr* ppvalue);
00297 
00318 EXTERNPER int pd_BitString 
00319 (ASN1CTXT* ctxt_p, ASN1UINT* numbits_p, ASN1OCTET* buffer,
00320  ASN1UINT bufsiz);
00321 
00346 EXTERNPER int pd_BMPString 
00347 (ASN1CTXT* ctxt_p, ASN1BMPString* pvalue, Asn116BitCharSet* permCharSet);
00348 
00372 EXTERNPER int pd_UniversalString 
00373 (ASN1CTXT* ctxt_p, ASN1UniversalString* pvalue, Asn132BitCharSet* permCharSet);
00374 
00386 EXTERNPER int pd_byte_align (ASN1CTXT* ctxt_p);
00387 
00398 EXTERNPER int pd_ChoiceOpenTypeExt 
00399 (ASN1CTXT* ctxt_p, ASN1ConstOctetPtr* object_p2, ASN1UINT* numocts_p);
00400 
00413 EXTERNPER int pd_ConsInteger 
00414 (ASN1CTXT* ctxt_p, ASN1INT* pvalue, ASN1INT lower, ASN1INT upper);
00415 
00429 EXTERNPER int pd_ConsInt8 
00430 (ASN1CTXT* ctxt_p, ASN1INT8* pvalue, ASN1INT lower, ASN1INT upper);
00431 
00445 EXTERNPER int pd_ConsInt16 (ASN1CTXT* ctxt_p, 
00446                             ASN1SINT* pvalue, ASN1INT lower, ASN1INT upper);
00447 
00461 EXTERNPER int pd_ConsInt64 (ASN1CTXT* ctxt_p, 
00462                             ASN1INT64* pvalue, ASN1INT64 lower, ASN1INT64 upper);
00463 
00477 EXTERNPER int pd_ConsUnsigned 
00478 (ASN1CTXT* ctxt_p, ASN1UINT* pvalue, ASN1UINT lower, ASN1UINT upper);
00479 
00493 EXTERNPER int pd_ConsUInt8 (ASN1CTXT* ctxt_p, 
00494                             ASN1UINT8* pvalue, ASN1UINT lower, ASN1UINT upper);
00495 
00509 EXTERNPER int pd_ConsUInt16 
00510 (ASN1CTXT* ctxt_p, ASN1USINT* pvalue, ASN1UINT lower, ASN1UINT upper);
00511 
00525 EXTERNPER int pd_ConsUInt64 (ASN1CTXT* ctxt_p, ASN1UINT64* pvalue, 
00526                              ASN1UINT64 lower, ASN1UINT64 upper);
00527 
00545 EXTERNPER int pd_ConsWholeNumber 
00546 (ASN1CTXT* ctxt_p, ASN1UINT* padjusted_value, ASN1UINT range_value);
00547 
00565 EXTERNPER int pd_ConsWholeNumber64 
00566 (ASN1CTXT* ctxt_p, ASN1UINT64* padjusted_value, ASN1UINT64 range_value);
00567 
00584 EXTERNPER int pd_ConstrainedString 
00585 (ASN1CTXT* ctxt_p, ASN1ConstCharPtr* string, Asn1CharSet* pCharSet);
00586 
00606 EXTERNPER int pd_ConstrainedStringEx 
00607 (ASN1CTXT* ctxt_p, ASN1ConstCharPtr* string, ASN1ConstCharPtr charSet,
00608  ASN1UINT abits, ASN1UINT ubits, ASN1UINT canSetBits);
00609 
00632 EXTERNPER int pd_16BitConstrainedString 
00633 (ASN1CTXT* ctxt_p, Asn116BitCharString* pString, Asn116BitCharSet* pCharSet);
00634 
00657 EXTERNPER int pd_32BitConstrainedString 
00658 (ASN1CTXT* ctxt_p, Asn132BitCharString* pString, Asn132BitCharSet* pCharSet);
00659 
00682 EXTERNPER int pd_DynBitString 
00683 (ASN1CTXT* ctxt_p, ASN1DynBitStr* pBitStr);
00684 
00701 EXTERNPER int pd_DynOctetString 
00702 (ASN1CTXT* ctxt_p, ASN1DynOctStr* pOctStr);
00703 
00714 EXTERNPER int pd_GetComponentLength 
00715 (ASN1CTXT* ctxt_p, ASN1UINT itemBits);
00716 
00730 EXTERNPER int pd_Length (ASN1CTXT* ctxt_p, ASN1UINT* pvalue);
00731 
00739 EXTERNPER int pd_moveBitCursor (ASN1CTXT* ctxt_p, int bitOffset);
00740 
00753 EXTERNPER int pd_ObjectIdentifier (ASN1CTXT* ctxt_p, ASN1OBJID* pvalue);
00754 
00768 EXTERNPER int pd_oid64 (ASN1CTXT* ctxt_p, ASN1OID64* pvalue);
00769 
00782 EXTERNPER int pd_RelativeOID (ASN1CTXT* ctxt_p, ASN1OBJID* pvalue);
00783 
00802 EXTERNPER int pd_OctetString 
00803 (ASN1CTXT* ctxt_p, ASN1UINT* numocts_p, ASN1OCTET* buffer,
00804  ASN1UINT bufsiz);
00805 
00823 EXTERNPER int pd_OpenType 
00824 (ASN1CTXT* ctxt_p, ASN1ConstOctetPtr* object_p2, ASN1UINT* numocts_p);
00825 
00847 EXTERNPER int pd_OpenTypeExt 
00848 (ASN1CTXT* ctxt_p, ASN1ConstOctetPtr* object_p2, ASN1UINT* numocts_p);
00849 
00867 EXTERNPER int pd_Real 
00868 (ASN1CTXT* ctxt_p, ASN1REAL* pvalue);
00869 
00885 EXTERNPER int pd_SmallNonNegWholeNumber 
00886 (ASN1CTXT* ctxt_p, ASN1UINT* pvalue);
00887 
00899 EXTERNPER int pd_SemiConsInteger 
00900    (ASN1CTXT* ctxt_p, ASN1INT* pvalue, ASN1INT lower);
00901 
00914 EXTERNPER int pd_SemiConsUnsigned 
00915    (ASN1CTXT* ctxt_p, ASN1UINT* pvalue, ASN1UINT lower);
00916 
00929 EXTERNPER int pd_SemiConsInt64 
00930    (ASN1CTXT* ctxt_p, ASN1INT64* pvalue, ASN1INT64 lower);
00931 
00944 EXTERNPER int pd_SemiConsUInt64 
00945    (ASN1CTXT* ctxt_p, ASN1UINT64* pvalue, ASN1UINT64 lower);
00946 
00947 
00957 #define pd_UnconsInteger(ctxt_p,pvalue) \
00958 pd_SemiConsInteger(ctxt_p, pvalue, ASN1INT_MIN)
00959 
00970 #define pd_UnconsUnsigned(ctxt_p,pvalue) \
00971 pd_SemiConsUnsigned(ctxt_p, pvalue, 0U)
00972 
00983 #define pd_UnconsInt64(ctxt_p,pvalue) \
00984 pd_SemiConsInt64(ctxt_p, pvalue, ASN1INT64MIN)
00985 
00996 #define pd_UnconsUInt64(ctxt_p,pvalue) \
00997 pd_SemiConsUInt64(ctxt_p, pvalue, 0)
00998 
01004 EXTERNPER int pd_VarWidthCharString (ASN1CTXT* pctxt, ASN1ConstCharPtr* pvalue);
01005 
01008 /* Encode functions */
01052 EXTERNPER int pe_16BitConstrainedString 
01053 (ASN1CTXT* ctxt_p, Asn116BitCharString value, Asn116BitCharSet* pCharSet);
01054 
01077 EXTERNPER int pe_32BitConstrainedString 
01078 (ASN1CTXT* ctxt_p, Asn132BitCharString value, Asn132BitCharSet* pCharSet);
01079 
01090 EXTERNPER int pe_2sCompBinInt 
01091 (ASN1CTXT* ctxt_p, ASN1INT value);
01092 
01103 EXTERNPER int pe_2sCompBinInt64 (ASN1CTXT* ctxt_p, ASN1INT64 value);
01104 
01111 EXTERNPER int pe_aligned_octets 
01112 (ASN1CTXT* ctxt_p, ASN1OCTET* pvalue, ASN1UINT nocts);
01113 
01133 EXTERNPER int pe_BigInteger 
01134 (ASN1CTXT* ctxt_p, ASN1ConstCharPtr pvalue);
01135 
01145 EXTERNPER int pe_bit 
01146 (ASN1CTXT* ctxt_p, ASN1BOOL value);
01147 
01158 EXTERNPER int pe_bits 
01159 (ASN1CTXT* ctxt_p, ASN1UINT value, ASN1UINT nbits);
01160 
01173 EXTERNPER int pe_bits64 (ASN1CTXT* ctxt_p, ASN1UINT64 value, ASN1UINT nbits);
01174 
01188 EXTERNPER int pe_BitString 
01189 (ASN1CTXT* ctxt_p, ASN1UINT numocts, ASN1ConstOctetPtr data);
01190 
01214 EXTERNPER int pe_BMPString 
01215 (ASN1CTXT* ctxt_p, ASN1BMPString value, Asn116BitCharSet* permCharSet);
01216 
01240 EXTERNPER int pe_UniversalString 
01241 (ASN1CTXT* ctxt_p, ASN1UniversalString value, Asn132BitCharSet* permCharSet);
01242 
01254 EXTERNPER int pe_byte_align (ASN1CTXT* ctxt_p);
01255 
01271 EXTERNPER int pe_CheckBuffer (ASN1CTXT* ctxt_p, size_t nbytes);
01272 
01284 EXTERNPER int pe_ChoiceTypeExt 
01285 (ASN1CTXT* ctxt_p, ASN1UINT numocts, ASN1ConstOctetPtr data);
01286 
01299 EXTERNPER int pe_ConsInteger 
01300 (ASN1CTXT* ctxt_p, ASN1INT value, ASN1INT lower, ASN1INT upper);
01301 
01314 EXTERNPER int pe_ConsInt64 (ASN1CTXT* ctxt_p, 
01315                             ASN1INT64 value, ASN1INT64 lower, ASN1INT64 upper);
01316 
01328 EXTERNPER int pe_ConstrainedString 
01329 (ASN1CTXT* ctxt_p, ASN1ConstCharPtr string, Asn1CharSet* pCharSet);
01330 
01348 EXTERNPER int pe_ConstrainedStringEx 
01349 (ASN1CTXT* ctxt_p, ASN1ConstCharPtr string, ASN1ConstCharPtr charSet,
01350  ASN1UINT abits, ASN1UINT ubits, ASN1UINT canSetBits);
01351 
01367 EXTERNPER int pe_ConsUnsigned 
01368 (ASN1CTXT* ctxt_p, ASN1UINT value, ASN1UINT lower, ASN1UINT upper);
01369 
01389 EXTERNPER int pe_ConsUInt64 (ASN1CTXT* ctxt_p, ASN1UINT64 value, 
01390                              ASN1UINT64 lower, ASN1UINT64 upper);
01391 
01407 EXTERNPER int pe_ConsWholeNumber 
01408 (ASN1CTXT* ctxt_p, ASN1UINT adjusted_value, ASN1UINT range_value);
01409 
01425 EXTERNPER int pe_ConsWholeNumber64 
01426 (ASN1CTXT* ctxt_p, ASN1UINT64 adjusted_value, ASN1UINT64 range_value);
01427 
01441 EXTERNPER int pe_ExpandBuffer (ASN1CTXT* ctxt_p, size_t nbytes);
01442 
01446 EXTERNPER ASN1UINT pe_GetIntLen (ASN1UINT value);
01447 
01453 EXTERNPER size_t pe_GetMsgBitCnt (ASN1CTXT* ctxt_p);
01454 
01473 EXTERNPER ASN1OCTET* pe_GetMsgPtr (ASN1CTXT* ctxt_p, int* pLength);
01474 
01485 EXTERNPER ASN1OCTET* pe_GetMsgPtrU (ASN1CTXT* ctxt_p, ASN1UINT* pLength);
01486 
01498 EXTERNPER int pe_Length (ASN1CTXT* ctxt_p, ASN1UINT value);
01499 
01510 EXTERNPER int pe_NonNegBinInt (ASN1CTXT* ctxt_p, ASN1UINT value);
01511 
01522 EXTERNPER int pe_NonNegBinInt64 (ASN1CTXT* ctxt_p, ASN1UINT64 value);
01523 
01536 EXTERNPER int pe_ObjectIdentifier (ASN1CTXT* ctxt_p, ASN1OBJID* pvalue);
01537 
01551 EXTERNPER int pe_oid64 (ASN1CTXT* ctxt_p, ASN1OID64* pvalue);
01552 
01565 EXTERNPER int pe_RelativeOID (ASN1CTXT* ctxt_p, ASN1OBJID* pvalue);
01566 
01580 EXTERNPER int pe_octets 
01581 (ASN1CTXT* ctxt_p, ASN1ConstOctetPtr pvalue, ASN1UINT nbits);
01582 
01595 EXTERNPER int pe_OctetString 
01596 (ASN1CTXT* ctxt_p, ASN1UINT numocts, ASN1ConstOctetPtr data);
01597 
01613 EXTERNPER int pe_OpenType 
01614 (ASN1CTXT* ctxt_p, ASN1UINT numocts, ASN1ConstOctetPtr data);
01615 
01634 EXTERNPER int pe_OpenTypeExt 
01635 (ASN1CTXT* ctxt_p, Asn1RTDList* pElemList);
01636 
01646 EXTERNPER int pe_OpenTypeExtBits 
01647 (ASN1CTXT* ctxt_p, Asn1RTDList* pElemList);
01648 
01666 EXTERNPER int pe_Real (ASN1CTXT* ctxt_p, ASN1REAL value);
01667 
01682 EXTERNPER int pe_SmallNonNegWholeNumber (ASN1CTXT* ctxt_p, ASN1UINT value);
01683 
01695 EXTERNPER int pe_SemiConsInteger 
01696    (ASN1CTXT* ctxt_p, ASN1INT value, ASN1INT lower);
01697 
01709 EXTERNPER int pe_SemiConsInt64 
01710    (ASN1CTXT* ctxt_p, ASN1INT64 value, ASN1INT64 lower);
01711 
01723 EXTERNPER int pe_SemiConsUnsigned 
01724    (ASN1CTXT* ctxt_p, ASN1UINT value, ASN1UINT lower);
01725 
01738 EXTERNPER int pe_SemiConsUInt64 
01739    (ASN1CTXT* ctxt_p, ASN1UINT64 value, ASN1UINT64 lower);
01740 
01750 EXTERNPER int pe_UnconsLength (ASN1CTXT* ctxt_p, ASN1UINT value);
01751 
01761 #define pe_UnconsInteger(ctxt_p,value) \
01762 pe_SemiConsInteger(ctxt_p,value,ASN1INT_MIN)
01763 
01773 #define pe_UnconsInt64(ctxt_p,value) \
01774 pe_SemiConsInt64(ctxt_p,value,ASN1INT64MIN)
01775 
01785 #define pe_UnconsUnsigned(ctxt_p,value) \
01786 pe_SemiConsUnsigned(ctxt_p,value,0)
01787 
01798 #define pe_UnconsUInt64(ctxt_p,value) \
01799 pe_SemiConsUInt64(ctxt_p,value,0)
01800 
01809 EXTERNPER int pe_VarWidthCharString (ASN1CTXT* pctxt, ASN1ConstCharPtr value); 
01810 
01813 /* Utility functions */
01814 
01815 
01836 EXTERNPER int pu_addSizeConstraint (ASN1CTXT* ctxt_p, Asn1SizeCnst* pSize);
01837 
01838 EXTERNPER ASN1BOOL pu_alignCharStr 
01839 (ASN1CTXT* ctxt_p, ASN1UINT len, ASN1UINT nbits, Asn1SizeCnst* pSize);
01840 
01847 EXTERNPER int pu_checkSizeConstraint(ASN1CTXT* ctxt_p, int size);
01848 
01852 EXTERNPER ASN1UINT pu_bitcnt (ASN1UINT value);
01853 
01854 EXTERNPER Asn1SizeCnst* pu_checkSize 
01855 (Asn1SizeCnst* pSizeList, ASN1UINT value, ASN1BOOL* pExtendable);
01856 
01870 EXTERNPER void pu_freeContext (ASN1CTXT* ctxt_p);
01871 
01872 
01879 EXTERNPER int  pu_getBitOffset (ASN1CTXT* ctxt_p);
01880 
01881 
01882 EXTERNPER size_t pu_getMaskAndIndex (size_t bitOffset, unsigned char* pMask);
01883 
01895 EXTERNPER size_t pu_getMsgLen (ASN1CTXT* ctxt_p);
01896 
01905 EXTERNPER void pu_hexdump (ASN1CTXT* ctxt_p);
01906 
01907 EXTERNPER int pu_setBuffer 
01908 (ASN1CTXT* ctxt_p, ASN1OCTET* bufaddr, size_t bufsiz, ASN1BOOL aligned);
01909 
01910 EXTERNPER int pe_setp (ASN1CTXT* ctxt_p,
01911              ASN1OCTET* bufaddr, size_t bufsiz, ASN1BOOL aligned);
01912 
01913 
01914 
01915 #define pd_setp(ctxt_p, bufaddr, bufsiz, aligned) \
01916    pu_setBuffer(ctxt_p, bufaddr, bufsiz, aligned)
01917 #define pe_resetp(ctxt_p)   rtResetContext(ctxt_p)
01918 #define pd_resetp(ctxt_p)   rtResetContext(ctxt_p)
01919 
01920 
01921 
01949 EXTERNPER int pu_initContext 
01950 (ASN1CTXT* ctxt_p, ASN1OCTET* bufaddr, ASN1UINT bufsiz, ASN1BOOL aligned);
01951 
01968 EXTERNPER int pu_initContextBuffer (ASN1CTXT* pTarget, ASN1CTXT* pSource);
01969 
01970 EXTERNPER ASN1ConstCharPtr pu_getFullName 
01971 (ASN1CTXT* ctxt_p, ASN1ConstCharPtr suffix);
01972 
01973 EXTERNPER Asn1SizeCnst* pu_getSizeConstraint 
01974 (ASN1CTXT* ctxt_p, ASN1BOOL extbit);
01975 
01976 EXTERNPER void pu_init16BitCharSet 
01977 (Asn116BitCharSet* pCharSet, ASN116BITCHAR first, ASN116BITCHAR last, 
01978  ASN1UINT abits, ASN1UINT ubits);
01979 
01986 EXTERNPER void pu_insLenField (ASN1CTXT* ctxt_p);
01987 
01991 EXTERNPER ASN1BOOL pu_isExtendableSize (Asn1SizeCnst* pSizeList);
01992 
01996 EXTERNPER ASN1BOOL pu_isFixedSize (Asn1SizeCnst* pSizeList);
01997 
02022 EXTERNPER ASN1CTXT* pu_newContext 
02023 (ASN1OCTET* bufaddr, ASN1UINT bufsiz, ASN1BOOL aligned);
02024 
02025 EXTERNPER PERField* pu_newField 
02026 (ASN1CTXT* ctxt_p, ASN1ConstCharPtr nameSuffix);
02027 
02031 EXTERNPER void pu_popName (ASN1CTXT* ctxt_p);
02032 
02039 EXTERNPER void pu_pushElemName (ASN1CTXT* ctxt_p, int index);
02040 
02045 EXTERNPER void pu_pushName (ASN1CTXT* ctxt_p, ASN1ConstCharPtr name);
02046 
02047 
02048 EXTERNPER void pu_setBitOffset (ASN1CTXT* ctxt_p, int bitOffset);
02049 
02061 EXTERNPER void pu_setCharSet (Asn1CharSet* pCharSet, ASN1ConstCharPtr permSet);
02062 
02077 EXTERNPER void pu_set16BitCharSet 
02078 (ASN1CTXT* ctxt_p, Asn116BitCharSet* pCharSet, Asn116BitCharSet* pAlphabet);
02079 
02080 
02089 EXTERNPER void pu_set16BitCharSetFromRange 
02090 (Asn116BitCharSet* pCharSet, ASN1USINT firstChar, ASN1USINT lastChar);
02091 
02095 EXTERNPER void pu_setFldBitCount (ASN1CTXT* ctxt_p);
02096 
02097 
02101 EXTERNPER void pu_setFldBitOffset (ASN1CTXT* ctxt_p);
02102 
02107 EXTERNPER ASN1BOOL pu_setTrace (ASN1CTXT* pCtxt, ASN1BOOL value);
02108 
02123 EXTERNPER void pu_bindump (ASN1CTXT* ctxt_p, ASN1ConstCharPtr varname);
02124 EXTERNPER void pu_dumpField 
02125 (ASN1CTXT* ctxt_p, PERField* pField, ASN1ConstCharPtr varname, 
02126  size_t nextBitOffset, BinDumpBuffer* pbuf);
02127 
02128 EXTERNPER void pu_init32BitCharSet 
02129 (Asn132BitCharSet* pCharSet, ASN132BITCHAR first, ASN132BITCHAR last, 
02130  ASN1UINT abits, ASN1UINT ubits);
02131 
02146 EXTERNPER void pu_set32BitCharSet 
02147 (ASN1CTXT* ctxt_p, Asn132BitCharSet* pCharSet, Asn132BitCharSet* pAlphabet);
02148 
02157 EXTERNPER void pu_set32BitCharSetFromRange 
02158 (Asn132BitCharSet* pCharSet, ASN1UINT firstChar, ASN1UINT lastChar);
02159 
02164 #ifdef __cplusplus
02165 }
02166 #endif
02167 
02168 /* Macros */
02169 
02170 #define pe_GeneralString(ctxt_p,value,permCharSet) \
02171 pe_VarWidthCharString(ctxt_p, value)
02172 
02173 #define pe_GraphicString(ctxt_p,value,permCharSet) \
02174 pe_VarWidthCharString(ctxt_p, value)
02175 
02176 #define pe_T61String(ctxt_p,value,permCharSet) \
02177 pe_VarWidthCharString(ctxt_p, value)
02178 
02179 #define pe_TeletexString(ctxt_p,value,permCharSet) \
02180 pe_VarWidthCharString(ctxt_p, value)
02181 
02182 #define pe_VideotexString(ctxt_p,value,permCharSet) \
02183 pe_VarWidthCharString(ctxt_p, value)
02184 
02185 #define pe_ObjectDescriptor(ctxt_p,value,permCharSet) \
02186 pe_VarWidthCharString(ctxt_p, value)
02187 
02188 #define pe_UTF8String(ctxt_p,value,permCharSet) \
02189 pe_VarWidthCharString(ctxt_p, value)
02190 
02191         
02192 #define pe_IA5String(ctxt_p,value,permCharSet) \
02193 pe_ConstrainedStringEx (ctxt_p, value, permCharSet, 8, 7, 7)
02194 
02195 #define pe_NumericString(ctxt_p,value,permCharSet) \
02196 pe_ConstrainedStringEx (ctxt_p, value, \
02197 (permCharSet == 0)?NUM_CANSET:permCharSet, 4, 4, 4)
02198 
02199 #define pe_PrintableString(ctxt_p,value,permCharSet) \
02200 pe_ConstrainedStringEx (ctxt_p, value, permCharSet, 8, 7, 7)
02201 
02202 #define pe_VisibleString(ctxt_p,value,permCharSet) \
02203 
02204 #define pe_ISO646String      pe_IA5String
02205 #define pe_GeneralizedTime   pe_IA5String
02206 #define pe_UTCTime           pe_GeneralizedTime
02207 
02208 
02209 #define pd_GeneralString(ctxt_p,pvalue,permCharSet) \
02210 pd_VarWidthCharString (ctxt_p, pvalue)
02211 
02212 #define pd_GraphicString(ctxt_p,pvalue,permCharSet) \
02213 pd_VarWidthCharString (ctxt_p, pvalue)
02214 
02215 #define pd_VideotexString(ctxt_p,pvalue,permCharSet) \
02216 pd_VarWidthCharString (ctxt_p, pvalue)
02217 
02218 #define pd_TeletexString(ctxt_p,pvalue,permCharSet) \
02219 pd_VarWidthCharString (ctxt_p, pvalue)
02220 
02221 #define pd_T61String(ctxt_p,pvalue,permCharSet) \
02222 pd_VarWidthCharString (ctxt_p, pvalue)
02223 
02224 #define pd_ObjectDescriptor(ctxt_p,pvalue,permCharSet) \
02225 pd_VarWidthCharString (ctxt_p, pvalue)
02226 
02227 #define pd_UTF8String(ctxt_p,pvalue,permCharSet) \
02228 pd_VarWidthCharString (ctxt_p, pvalue)
02229 
02230 
02231 #define pd_IA5String(ctxt_p,pvalue,permCharSet) \
02232 pd_ConstrainedStringEx (ctxt_p, pvalue, permCharSet, 8, 7, 7)
02233 
02234 #define pd_NumericString(ctxt_p,pvalue,permCharSet) \
02235 pd_ConstrainedStringEx (ctxt_p, pvalue, \
02236 (permCharSet == 0)?NUM_CANSET:permCharSet, 4, 4, 4)
02237 
02238 #define pd_PrintableString(ctxt_p,pvalue,permCharSet) \
02239 pd_ConstrainedStringEx (ctxt_p, pvalue, permCharSet, 8, 7, 7)
02240 
02241 #define pd_VisibleString(ctxt_p,pvalue,permCharSet) \
02242 pd_ConstrainedStringEx (ctxt_p, pvalue, permCharSet, 8, 7, 7)
02243 
02244 
02245 #define pd_ISO646String      pd_IA5String
02246 #define pd_GeneralizedTime   pd_IA5String
02247 #define pd_UTCTime           pd_GeneralizedTime
02248 
02249 #define pe_GetMsgLen         pu_getMsgLen
02250 
02253 #endif

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 PER Runtime, ASN1C v5.8x