PER C Decode Functions.
[PER Runtime Library Functions.]

Defines

#define pd_moveBitCursor(pctxt, bitOffset)   rtxMoveBitCursor(pctxt,bitOffset)

Functions

int pd_BigInteger (OSCTXT *pctxt, const char **ppvalue)
int pd_BigIntegerEx (OSCTXT *pctxt, const char **ppvalue, int radix)
int pd_BigIntegerValue (OSCTXT *pctxt, const char **ppvalue, int radix, OSUINT32 nbytes)
int pd_BitString (OSCTXT *pctxt, OSUINT32 *numbits_p, OSOCTET *buffer, OSUINT32 bufsiz)
int pd_BitString32 (OSCTXT *pctxt, ASN1BitStr32 *pbitstr, OSUINT32 lower, OSUINT32 upper)
int pd_BMPString (OSCTXT *pctxt, ASN1BMPString *pvalue, Asn116BitCharSet *permCharSet)
int pd_UniversalString (OSCTXT *pctxt, ASN1UniversalString *pvalue, Asn132BitCharSet *permCharSet)
int pd_byte_align (OSCTXT *pctxt)
int pd_ChoiceOpenTypeExt (OSCTXT *pctxt, const OSOCTET **object_p2, OSUINT32 *pnumocts)
int pd_ConsInteger (OSCTXT *pctxt, OSINT32 *pvalue, OSINT32 lower, OSINT32 upper)
int pd_ConsInt8 (OSCTXT *pctxt, OSINT8 *pvalue, OSINT32 lower, OSINT32 upper)
int pd_ConsInt16 (OSCTXT *pctxt, OSINT16 *pvalue, OSINT32 lower, OSINT32 upper)
int pd_ConsInt64 (OSCTXT *pctxt, OSINT64 *pvalue, OSINT64 lower, OSINT64 upper)
int pd_ConsUnsigned (OSCTXT *pctxt, OSUINT32 *pvalue, OSUINT32 lower, OSUINT32 upper)
int pd_ConsUInt8 (OSCTXT *pctxt, OSUINT8 *pvalue, OSUINT32 lower, OSUINT32 upper)
int pd_ConsUInt16 (OSCTXT *pctxt, OSUINT16 *pvalue, OSUINT32 lower, OSUINT32 upper)
int pd_ConsUInt64 (OSCTXT *pctxt, OSUINT64 *pvalue, OSUINT64 lower, OSUINT64 upper)
int pd_ConsWholeNumber (OSCTXT *pctxt, OSUINT32 *padjusted_value, OSUINT32 range_value)
int pd_ConsWholeNumber64 (OSCTXT *pctxt, OSUINT64 *padjusted_value, OSUINT64 range_value)
int pd_ConstrainedString (OSCTXT *pctxt, const char **string, Asn1CharSet *pCharSet)
int pd_ConstrainedStringEx (OSCTXT *pctxt, const char **string, const char *charSet, OSUINT32 abits, OSUINT32 ubits, OSUINT32 canSetBits)
int pd_ConstrFixedLenStringEx (OSCTXT *pctxt, char *strbuf, size_t bufsiz, const char *charSet, OSUINT32 abits, OSUINT32 ubits, OSUINT32 canSetBits)
int pd_16BitConstrainedString (OSCTXT *pctxt, Asn116BitCharString *pString, Asn116BitCharSet *pCharSet)
int pd_32BitConstrainedString (OSCTXT *pctxt, Asn132BitCharString *pString, Asn132BitCharSet *pCharSet)
int pd_DateStr (OSCTXT *pctxt, const char **string, OSUINT32 flags)
int pd_DateTimeStr (OSCTXT *pctxt, const char **string, OSUINT32 flags)
int pd_Duration (OSCTXT *pctxt, const char **string, OSBOOL rec)
int pd_DynBitString (OSCTXT *pctxt, ASN1DynBitStr *pBitStr)
int pd_DynOctetString (OSCTXT *pctxt, ASN1DynOctStr *pOctStr)
int pd_GetBinStrDataOffset (OSCTXT *pctxt, OSUINT32 *pnumbits, OSBOOL bitStrFlag)
int pd_GetComponentLength (OSCTXT *pctxt, OSUINT32 itemBits)
int pd_Interval (OSCTXT *pctxt, const char **string, OSBOOL rec, OSUINT32 startFlags, OSUINT32 endFlags)
int pd_Length (OSCTXT *pctxt, OSUINT32 *pvalue)
int pd_ObjectIdentifier (OSCTXT *pctxt, ASN1OBJID *pvalue)
int pd_oid64 (OSCTXT *pctxt, ASN1OID64 *pvalue)
int pd_RelativeOID (OSCTXT *pctxt, ASN1OBJID *pvalue)
int pd_OctetString (OSCTXT *pctxt, OSUINT32 *pnumocts, OSOCTET *buffer, OSUINT32 bufsiz)
int pd_OpenType (OSCTXT *pctxt, const OSOCTET **object_p2, OSUINT32 *pnumocts)
int pd_OpenTypeExt (OSCTXT *pctxt, const OSOCTET **object_p2, OSUINT32 *pnumocts)
int pd_Real (OSCTXT *pctxt, OSREAL *pvalue)
int pd_SmallNonNegWholeNumber (OSCTXT *pctxt, OSUINT32 *pvalue)
int pd_SemiConsInteger (OSCTXT *pctxt, OSINT32 *pvalue, OSINT32 lower)
int pd_SemiConsUnsigned (OSCTXT *pctxt, OSUINT32 *pvalue, OSUINT32 lower)
int pd_SemiConsInt64 (OSCTXT *pctxt, OSINT64 *pvalue, OSINT64 lower)
int pd_SemiConsUInt64 (OSCTXT *pctxt, OSUINT64 *pvalue, OSUINT64 lower)
int pd_TimeStr (OSCTXT *pctxt, const char **string, OSUINT32 flags)
int pd_UnconsInteger (OSCTXT *pctxt, OSINT32 *pvalue)
int pd_UnconsLength (OSCTXT *pctxt, OSUINT32 *pvalue)
int pd_UnconsUnsigned (OSCTXT *pctxt, OSUINT32 *pvalue)
int pd_UnconsInt64 (OSCTXT *pctxt, OSINT64 *pvalue)
int pd_UnconsUInt64 (OSCTXT *pctxt, OSUINT64 *pvalue)
int pd_VarWidthCharString (OSCTXT *pctxt, const char **pvalue)
int pd_YearInt (OSCTXT *pctxt, OSINT32 *pvalue)
int pd_Real10 (OSCTXT *pctxt, const char **ppvalue)
OSBOOL pd_isFragmented (OSCTXT *pctxt)
void pd_OpenTypeStart (OSCTXT *pctxt, OSUINT32 *pSavedSize, OSINT16 *pSavedBitOff)
int pd_OpenTypeEnd (OSCTXT *pctxt, OSUINT32 savedSize, OSINT16 savedBitOff)
int uperDecConstrString (OSCTXT *pctxt, const char **string, const char *charSet, OSUINT32 nbits, OSUINT32 canSetBits)
int uperDecConstrFixedLenString (OSCTXT *pctxt, char *strbuf, size_t bufsiz, const char *charSet, OSUINT32 nbits, OSUINT32 canSetBits)

Detailed Description

PER runtime library decode functions handle the decoding of the primitive ASN.1 data types and length variables. Calls to these functions are assembled in the C source code generated by the ASN1C complier to decode complex ASN.1 structures. These functions are also directly callable from within a user's application program if the need to decode a primitive item exists.

The procedure to decode a primitive data item is as follows:

  1. Call the pu_newContext or pu_initContext function to specify the address of the buffer containing the encoded ASN.1 data to be decoded and whether the data is aligned, or unaligned.
  2. Call the specific decode function to decode the value.

Define Documentation

#define pd_moveBitCursor ( pctxt,
bitOffset   )     rtxMoveBitCursor(pctxt,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.
bitOffset The bit offset inside the message buffer.

Function Documentation

int pd_16BitConstrainedString ( OSCTXT *  pctxt,
Asn116BitCharString *  pString,
Asn116BitCharSet *  pCharSet 
)

This function will encode a constrained ASN.1 character string. This function is normally not called directly but rather is called from Useful Type Character String encode functions that deal with 16-bit strings. The only function that does not release is the pe_BMPString function.

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.
pString Character string to be encoded. The 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.
pCharSet 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 (0) = success,
  • negative return value is error.
int pd_32BitConstrainedString ( OSCTXT *  pctxt,
Asn132BitCharString *  pString,
Asn132BitCharSet *  pCharSet 
)

This function will encode a constrained ASN.1 character string. This function is normally not called directly but rather is called from Useful Type Character String encode functions that deal with 32-bit strings. The only function that does not release is the pe_UniversalString function.

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.
pString Character string to be encoded. The structure includes a count field containing the number of characters to encode and an array of unsigned short integers to hold the 32-bit characters to be encoded.
pCharSet 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 (0) = success,
  • negative return value is error.
int pd_BigInteger ( OSCTXT *  pctxt,
const char **  ppvalue 
)

This function decodes a variable of the ASN.1 INTEGER type. In this case, the integer is assumed to be of a larger size than can fit in a C or C++ long type (normally 32 or 64 bits). For example, parameters used to calculate security values are typically larger than these sizes. These variables are stored in character string constant variables. They are represented as hexadecimal strings starting with "0x" prefix. If it is necessary to convert a hexadecimal string to another radix, then use the rtxBigIntSetStr / rtxBigIntToString functions.

Parameters:
pctxt Pointer to context block structure.
ppvalue Pointer to a character pointer variable to receive the decoded unsigned value. Dynamic memory is allocated for the variable using the rtxMemAlloc function. The decoded variable is represented as a decimal string starting with no prefix.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_BigIntegerEx ( OSCTXT *  pctxt,
const char **  ppvalue,
int  radix 
)

This variant of the pd_BigInteger function allows the user to select the radix of the decoded integer string.

Parameters:
pctxt Pointer to context block structure.
ppvalue Pointer to a character pointer variable to receive the decoded unsigned value. Dynamic memory is allocated for the variable using the rtxMemAlloc function. The decoded variable is represented as a decimal string starting with no prefix.
radix Radix to be used for decoded string. Valid values are 2, 8, 10, or 16.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_BigIntegerValue ( OSCTXT *  pctxt,
const char **  ppvalue,
int  radix,
OSUINT32  nbytes 
)

This function decodes only the value portion of an integer field. It is assume the length was decode separately.

Parameters:
pctxt Pointer to context block structure.
ppvalue Pointer to a character pointer variable to receive the decoded unsigned value. Dynamic memory is allocated for the variable using the rtxMemAlloc function. The decoded variable is represented as a decimal string starting with no prefix.
radix Radix to be used for decoded string. Valid values are 2, 8, 10, or 16.
nbytes Length in bytes of the value component.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_BitString ( OSCTXT *  pctxt,
OSUINT32 *  numbits_p,
OSOCTET *  buffer,
OSUINT32  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 (0) = success,
  • negative return value is error.
int pd_BMPString ( OSCTXT *  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 (0) = success,
  • negative return value is error.
int pd_byte_align ( OSCTXT *  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 (0) = success,
  • negative return value is error.

Referenced by ASN1PERDecodeBuffer::byteAlign().

int pd_ChoiceOpenTypeExt ( OSCTXT *  pctxt,
const OSOCTET **  object_p2,
OSUINT32 *  pnumocts 
)
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.
object_p2 A pointer to an open type variable to receive the decoded data.
pnumocts A pointer to an unsigned buffer of bufsiz octets to receive decoded data.
int pd_ConsInt16 ( OSCTXT *  pctxt,
OSINT16 *  pvalue,
OSINT32  lower,
OSINT32  upper 
)

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

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

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

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to 64-bit integer variable to receive decoded value.
lower Lower range value, represented as 64-bit integer.
upper Upper range value, represented as 64-bit integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_ConsInt8 ( OSCTXT *  pctxt,
OSINT8 *  pvalue,
OSINT32  lower,
OSINT32  upper 
)

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

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to 8-bit integer variable to receive decoded value.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_ConsInteger ( OSCTXT *  pctxt,
OSINT32 *  pvalue,
OSINT32  lower,
OSINT32  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 (0) = success,
  • negative return value is error.
int pd_ConstrainedString ( OSCTXT *  pctxt,
const char **  string,
Asn1CharSet *  pCharSet 
)

This function decodes a constrained string value. This is a deprecated version of the function provided for backward compatibility.

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.
pCharSet Pointer to a character set descriptor structure. 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 (0) = success,
  • negative return value is error.
int pd_ConstrainedStringEx ( OSCTXT *  pctxt,
const char **  string,
const char *  charSet,
OSUINT32  abits,
OSUINT32  ubits,
OSUINT32  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 (0) = success,
  • negative return value is error.
int pd_ConstrFixedLenStringEx ( OSCTXT *  pctxt,
char *  strbuf,
size_t  bufsiz,
const char *  charSet,
OSUINT32  abits,
OSUINT32  ubits,
OSUINT32  canSetBits 
)

This function decodes a constrained string value into a fixed-size buffer. This function allows all of the required permitted alphabet constraint parameters to be passed in as arguments.

Parameters:
pctxt Pointer to context block structure.
strbuf Pointer to character array to receive decoded string.
bufsiz Size of strbuf character array.
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 (0) = success,
  • negative return value is error.
int pd_ConsUInt16 ( OSCTXT *  pctxt,
OSUINT16 *  pvalue,
OSUINT32  lower,
OSUINT32  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 (0) = success,
  • negative return value is error.
int pd_ConsUInt64 ( OSCTXT *  pctxt,
OSUINT64 *  pvalue,
OSUINT64  lower,
OSUINT64  upper 
)

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

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to 64-bit unsigned integer variable to receive decoded value.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_ConsUInt8 ( OSCTXT *  pctxt,
OSUINT8 *  pvalue,
OSUINT32  lower,
OSUINT32  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 (0) = success,
  • negative return value is error.
int pd_ConsUnsigned ( OSCTXT *  pctxt,
OSUINT32 *  pvalue,
OSUINT32  lower,
OSUINT32  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 (0) = success,
  • negative return value is error.
int pd_ConsWholeNumber ( OSCTXT *  pctxt,
OSUINT32 *  padjusted_value,
OSUINT32  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 (0) = success,
  • negative return value is error.
int pd_ConsWholeNumber64 ( OSCTXT *  pctxt,
OSUINT64 *  padjusted_value,
OSUINT64  range_value 
)

This function decodes a constrained whole number as specified in Section 10.5 of the X.691 standard, represented as 64-bit integer.

Parameters:
pctxt Pointer to context block structure.
padjusted_value Pointer to 64-bit 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 64-bit 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 (0) = success,
  • negative return value is error.
int pd_DateStr ( OSCTXT *  pctxt,
const char **  string,
OSUINT32  flags 
)

This function will decode an ISO 8601 DATE type.

Parameters:
pctxt Pointer to context block structure.
string Pointer to string variable to receive decoded value in string form (YYYY:MM:DD) and ect.
flags Set of flags: OSANY|OSCENTURY|OSYEAR|OSMONTH|OSWEEK|OSDAY.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_DateTimeStr ( OSCTXT *  pctxt,
const char **  string,
OSUINT32  flags 
)

This function will decode an ISO 8601 DATE-TIME type.

Parameters:
pctxt Pointer to context block structure.
string Pointer to string variable to receive decoded value in string form (YYYY-MM-DDTHH:MM:SS) and ect.
flags Set of flags: OSANY|OSCENTURY|OSYEAR|OSMONTH|OSWEEK|OSDAY| OSHOURS|OSMINUTES|OSSECONDS|OSUTC|OSDIFF|n. n - set digit number of fraction part.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_Duration ( OSCTXT *  pctxt,
const char **  string,
OSBOOL  rec 
)

This function will decode an ISO 8601 DURATION types.

Parameters:
pctxt Pointer to context block structure.
string Pointer to string variable to receive decoded value in string form (PnYnMnDTnHnMnS).
rec Decode recursive interval (Rn/).
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_DynBitString ( OSCTXT *  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 rtxMemAlloc function. This memory is tracked within the context and released when the pu_freeContext function is invoked.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_DynOctetString ( OSCTXT *  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 (0) = success,
  • negative return value is error.
int pd_GetBinStrDataOffset ( OSCTXT *  pctxt,
OSUINT32 *  pnumbits,
OSBOOL  bitStrFlag 
)

This function gets the offset in bits to the data field within a PER-encoded binary string (i.e a BIT or OCTET STRING).

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.
pnumbits A pointer to an unsigned integer to receive the bit count value.
bitStrFlag TRUE if type being operaton is a BIT STRING; FALSE if OCTET STRING.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_GetComponentLength ( OSCTXT *  pctxt,
OSUINT32  itemBits 
)

This function gets the total length of a PER-encoded component. In the case of a fragmented length, it will look ahead and add up each of the individual length components.

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.
itemBits The size of the specific entity.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_Interval ( OSCTXT *  pctxt,
const char **  string,
OSBOOL  rec,
OSUINT32  startFlags,
OSUINT32  endFlags 
)

This function will decode an ISO 8601 INTERVAL type.

Parameters:
pctxt Pointer to context block structure.
string Pointer to string variable to receive decoded value in string form (start/end).
rec Decode recursive interval (Rn/).
startFlags Set format flags of interval start: OSANY|OSCENTURY|OSYEAR|OSMONTH|OSWEEK|OSDAY| OSHOURS|OSMINUTES|OSSECONDS|OSUTC|OSDIFF|n or OSDURATION. n - set digit number of fraction part.
endFlags Set format flags of interval end.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
OSBOOL pd_isFragmented ( OSCTXT *  pctxt  ) 

This function peeks at the open type length to determine if it is fragmented.

Parameters:
pctxt Pointer to a context structure.
int pd_Length ( OSCTXT *  pctxt,
OSUINT32 *  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 (0) = success,
  • negative return value is error.
int pd_ObjectIdentifier ( OSCTXT *  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 (0) = success,
  • negative return value is error.
int pd_OctetString ( OSCTXT *  pctxt,
OSUINT32 *  pnumocts,
OSOCTET *  buffer,
OSUINT32  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.
pnumocts 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 (0) = success,
  • negative return value is error.
int pd_oid64 ( OSCTXT *  pctxt,
ASN1OID64 *  pvalue 
)

This function decodes a value of the ASN.1 object identifier type using 64-bit subidentifiers.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to value to receive decoded result. The ASN1OID64 structure contains an integer to hold the number of subidentifiers and an array of 64-bit unsigned integers to hold the subidentifier values.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_OpenType ( OSCTXT *  pctxt,
const OSOCTET **  object_p2,
OSUINT32 *  pnumocts 
)

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.
pnumocts 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 (0) = success,
  • negative return value is error.
int pd_OpenTypeExt ( OSCTXT *  pctxt,
const OSOCTET **  object_p2,
OSUINT32 *  pnumocts 
)

This function will decode an ASN.1 open type extension. These are extra fields in a version-2 message that may be present after the ... extension marker. An open type structure (extElem1) is added to a message structure that contains an extension marker but no extension elements. The pd_OpenTypeExt function will populate this structure with the complete extension information (optional bit or choice index, length and data). A subsequent call to pe_OpenTypeExt will cause the saved extension fields to be included in a newly encoded message of the given type.

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

This function will decode a value of the binary encoded ASN.1 real type. This function provides support for the plus-infinity special real values.

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 real variable to receive decoded value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_Real10 ( OSCTXT *  pctxt,
const char **  ppvalue 
)

This function will decode a value of the decimal encoded ASN.1 real type.

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.
ppvalue Pointer to a character pointer variable to receive the decoded result. Dynamic memory is allocated for the variable using the rtxMemAlloc function.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_RelativeOID ( OSCTXT *  pctxt,
ASN1OBJID *  pvalue 
)

This function decodes a value of the ASN.1 RELATIVE-OID 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 (0) = success,
  • negative return value is error.
int pd_SemiConsInt64 ( OSCTXT *  pctxt,
OSINT64 *  pvalue,
OSINT64  lower 
)

This function will decode a semi-constrained 64-bit integer.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to 64-bit integer variable to receive decoded value.
lower Lower range value, represented as signed 64-bit integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_SemiConsInteger ( OSCTXT *  pctxt,
OSINT32 *  pvalue,
OSINT32  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 (0) = success,
  • negative return value is error.
int pd_SemiConsUInt64 ( OSCTXT *  pctxt,
OSUINT64 *  pvalue,
OSUINT64  lower 
)

This function will decode a semi-constrained unsigned 64-bit integer.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to unsigned 64-bit integer variable to receive decoded value.
lower Lower range value, represented as unsigned 64-bit integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_SemiConsUnsigned ( OSCTXT *  pctxt,
OSUINT32 *  pvalue,
OSUINT32  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 (0) = success,
  • negative return value is error.
int pd_SmallNonNegWholeNumber ( OSCTXT *  pctxt,
OSUINT32 *  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 to receive decoded results.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_TimeStr ( OSCTXT *  pctxt,
const char **  string,
OSUINT32  flags 
)

This function will decode ISO 8601 TIME types.

Parameters:
pctxt Pointer to context block structure.
string Pointer to string variable to receive decoded value in string form (HH:MM:SS) and ect.
flags Set of flags: OSHOURS|OSMINUTES|OSSECONDS|OSUTC|OSDIFF|n. n - set digit number of fraction part.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_UnconsInt64 ( OSCTXT *  pctxt,
OSINT64 *  pvalue 
)

This function will decode an unconstrained 64-bit integer.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to 64-bit integer variable to receive decoded value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_UnconsInteger ( OSCTXT *  pctxt,
OSINT32 *  pvalue 
)

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 (0) = success,
  • negative return value is error.
int pd_UnconsLength ( OSCTXT *  pctxt,
OSUINT32 *  pvalue 
)

This function will decode an unconstrained length value or a length value with upper bound > 64k.

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

This function will decode an unconstrained integer into an unsigned 64-bit integer. An error is returned if the value being decoded cannot be represented by *pvalue (it is negative or too large).

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to unsigned 64-bit integer variable to receive decoded value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_UnconsUnsigned ( OSCTXT *  pctxt,
OSUINT32 *  pvalue 
)

This function will decode an unconstrained integer into an unsigned type. An error is returned if the value to be decoded cannot be represented by *pvalue (it is either negative or too large).

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

This function will decode a variable of the ASN.1 32-bit character string. This differs from the decode routines for the character strings previously described because the universal string type is based on 32-bit characters. A 32-bit character string is modeled using an array of unsigned 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 32-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 (0) = success,
  • negative return value is error.
int pd_VarWidthCharString ( OSCTXT *  pctxt,
const char **  pvalue 
)

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

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to a character pointer variable to receive the decoded result. Dynamic memory is allocated for the variable using the rtxMemAlloc function.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pd_YearInt ( OSCTXT *  pctxt,
OSINT32 *  pvalue 
)

This function will decode an ISO 8601 YEAR type.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to integer variable to receive decoded value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int uperDecConstrFixedLenString ( OSCTXT *  pctxt,
char *  strbuf,
size_t  bufsiz,
const char *  charSet,
OSUINT32  nbits,
OSUINT32  canSetBits 
)

This function decodes a constrained string value into a fixed-size buffer. This version supports unaligned PER only. It allows all of the required permitted alphabet constraint parameters to be passed in as arguments.

Parameters:
pctxt Pointer to context block structure.
strbuf Pointer to character array to receive decoded string.
bufsiz Size of strbuf character array.
charSet String containing permitted alphabet character set. Can be null if no character set was specified.
nbits 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 (0) = success,
  • negative return value is error.
int uperDecConstrString ( OSCTXT *  pctxt,
const char **  string,
const char *  charSet,
OSUINT32  nbits,
OSUINT32  canSetBits 
)

This function decodes a constrained string value. This version supports unaligned PER only. It 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.
nbits 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 (0) = success,
  • negative return value is error.