Home > Support > Documentation

PER Runtime Library Functions.


Detailed Description

The ASN.1 Packed Encoding Rules (PER) runtime library contains the low-level constants, types, and functions that are assembled by the compiler to encode/decode more complex structures. The PER low-level C encode/decode functions are identified by their prefixes: pe_ for PER encode, pd_ for PERdecode, and pu_ for PER utility functions.


Modules

 PER C Decode Functions.
 PER C Encode Functions.
 PER C Utility Functions

Classes

struct  PERField
struct  BinDumpBuffer

Defines

#define ASN_K_EXTENUM   999
#define PU_SETCHARSET(csetvar, canset, abits, ubits)
#define PU_INSLENFLD(pctxt)
#define PU_NEWFIELD(pctxt, suffix)
#define PU_PUSHNAME(pctxt, name)
#define PU_POPNAME(pctxt)
#define PU_SETBITOFFSET(pctxt)
#define PU_SETBITCOUNT(pctxt)
#define PU_PUSHELEMNAME(pctxt, idx)
#define EXTERNPER
#define PD_INCRBITIDX(pctxt)
#define PD_BIT(pctxt, pvalue)
#define PU_GETSIZECONSTRAINT(pctxt, extbit, pSize)
#define PU_GETCTXTBITOFFSET(pctxt)   (((pctxt)->buffer.byteIndex * 8) + (8 - (pctxt)->buffer.bitOffset))
#define PU_SETCTXTBITOFFSET(pctxt, _bitOffset)
#define PD_BYTE_ALIGN0(pctxt)
#define PD_BYTE_ALIGN   PD_BYTE_ALIGN0
#define PD_CHECKSEQOFLEN(pctxt, numElements, minElemBits)
#define pe_GeneralString(pctxt, value, permCharSet)   pe_VarWidthCharString(pctxt, value)
#define pe_GraphicString(pctxt, value, permCharSet)   pe_VarWidthCharString(pctxt, value)
#define pe_T61String(pctxt, value, permCharSet)   pe_VarWidthCharString(pctxt, value)
#define pe_TeletexString(pctxt, value, permCharSet)   pe_VarWidthCharString(pctxt, value)
#define pe_VideotexString(pctxt, value, permCharSet)   pe_VarWidthCharString(pctxt, value)
#define pe_ObjectDescriptor(pctxt, value, permCharSet)   pe_VarWidthCharString(pctxt, value)
#define pe_UTF8String(pctxt, value, permCharSet)   pe_VarWidthCharString(pctxt, value)
#define pe_IA5String(pctxt, value, permCharSet)   pe_ConstrainedStringEx (pctxt, value, permCharSet, 8, 7, 7)
#define pe_NumericString(pctxt, value, permCharSet)
#define pe_PrintableString(pctxt, value, permCharSet)   pe_ConstrainedStringEx (pctxt, value, permCharSet, 8, 7, 7)
#define pe_VisibleString(pctxt, value, permCharSet)
#define pe_ISO646String   pe_IA5String
#define pe_GeneralizedTime   pe_IA5String
#define pe_UTCTime   pe_GeneralizedTime
#define pd_GeneralString(pctxt, pvalue, permCharSet)   pd_VarWidthCharString (pctxt, pvalue)
#define pd_GraphicString(pctxt, pvalue, permCharSet)   pd_VarWidthCharString (pctxt, pvalue)
#define pd_VideotexString(pctxt, pvalue, permCharSet)   pd_VarWidthCharString (pctxt, pvalue)
#define pd_TeletexString(pctxt, pvalue, permCharSet)   pd_VarWidthCharString (pctxt, pvalue)
#define pd_T61String(pctxt, pvalue, permCharSet)   pd_VarWidthCharString (pctxt, pvalue)
#define pd_ObjectDescriptor(pctxt, pvalue, permCharSet)   pd_VarWidthCharString (pctxt, pvalue)
#define pd_UTF8String(pctxt, pvalue, permCharSet)   pd_VarWidthCharString (pctxt, pvalue)
#define pd_IA5String(pctxt, pvalue, permCharSet)   pd_ConstrainedStringEx (pctxt, pvalue, permCharSet, 8, 7, 7)
#define pd_NumericString(pctxt, pvalue, permCharSet)
#define pd_PrintableString(pctxt, pvalue, permCharSet)   pd_ConstrainedStringEx (pctxt, pvalue, permCharSet, 8, 7, 7)
#define pd_VisibleString(pctxt, pvalue, permCharSet)   pd_ConstrainedStringEx (pctxt, pvalue, permCharSet, 8, 7, 7)
#define pd_ISO646String   pd_IA5String
#define pd_GeneralizedTime   pd_IA5String
#define pd_UTCTime   pd_GeneralizedTime
#define pe_GetMsgLen   pu_getMsgLen

Define Documentation

#define PD_BIT pctxt,
pvalue   ) 
 

Value:

((PD_INCRBITIDX (pctxt) != 0) ? RTERR_ENDOFBUF : ((pvalue) ? \
((*(pvalue) = (OSOCTET)((((pctxt)->buffer.data[(pctxt)->buffer.byteIndex]) & \
(OSINTCONST(1) << (pctxt)->buffer.bitOffset)) != 0)), 0) : 0 ))

#define PD_BYTE_ALIGN0 pctxt   ) 
 

Value:

((!(pctxt)->buffer.aligned) ? 0 : \
(((pctxt)->buffer.bitOffset != 8) ? ( \
(pctxt)->buffer.byteIndex++,       \
(pctxt)->buffer.bitOffset = 8,     \
0) : 0                    \
))

#define PD_CHECKSEQOFLEN pctxt,
numElements,
minElemBits   ) 
 

Value:

((pctxt->buffer.size > 0) ?  \
(((numElements * minElemBits) > (pctxt->buffer.size * 8)) ? \
ASN_E_INVLEN : 0) : 0)

#define PD_INCRBITIDX pctxt   ) 
 

Value:

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

#define pd_NumericString pctxt,
pvalue,
permCharSet   ) 
 

Value:

pd_ConstrainedStringEx (pctxt, pvalue, \
(permCharSet == 0)?NUM_CANSET:permCharSet, 4, 4, 4)

#define pe_GeneralString pctxt,
value,
permCharSet   )     pe_VarWidthCharString(pctxt, value)
 

perutil

#define pe_NumericString pctxt,
value,
permCharSet   ) 
 

Value:

pe_ConstrainedStringEx (pctxt, value, \
(permCharSet == 0)?NUM_CANSET:permCharSet, 4, 4, 4)

#define PU_GETSIZECONSTRAINT pctxt,
extbit,
pSize   ) 
 

Value:

((((pSize) = ACINFO(pctxt)->pSizeConstraint) != 0) ? \
((((pSize) = ACINFO(pctxt)->pSizeConstraint)->extended == extbit)?(pSize) : \
pu_getSizeConstraint (pctxt,extbit)) : NULL)

#define PU_SETCHARSET csetvar,
canset,
abits,
ubits   ) 
 

Value:

csetvar.charSet.nchars = 0; \
csetvar.canonicalSet = canset; \
csetvar.canonicalSetSize = sizeof(canset)-1; \
csetvar.canonicalSetBits = pu_bitcnt(csetvar.canonicalSetSize); \
csetvar.charSetUnalignedBits = ubits; \
csetvar.charSetAlignedBits = abits;

#define PU_SETCTXTBITOFFSET pctxt,
_bitOffset   ) 
 

Value:

do { \
(pctxt)->buffer.byteIndex = (_bitOffset / 8); \
(pctxt)->buffer.bitOffset = (OSUINT16)(8 - (_bitOffset % 8)); \
} while(0)