C Streaming BER Decode Functions.
[Streaming BER Runtime Library Functions.]

Functions

int berDecStrmBMPStr (OSCTXT *pctxt, Asn116BitCharString *object_p, ASN1TagType tagging, int length)
int berDecStrmBigInt (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, int length)
int berDecStrmBigEnum (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, int length)
int berDecStrmBitStr (OSCTXT *pctxt, OSOCTET *pvalue, OSUINT32 *pnbits, ASN1TagType tagging, int length)
int berDecStrmBool (OSCTXT *pctxt, OSBOOL *object_p, ASN1TagType tagging, int length)
int berDecStrmCharStr (OSCTXT *pctxt, const char **ppvalue, ASN1TagType tagging, ASN1TAG tag, int length)
OSBOOL berDecStrmCheckEnd (OSCTXT *pctxt, ASN1CCB *pccb)
int berDecStrmDynBitStr (OSCTXT *pctxt, const OSOCTET **ppvalue, OSUINT32 *pnbits, ASN1TagType tagging, int length)
int berDecStrmDynOctStr (OSCTXT *pctxt, const OSOCTET **ppvalue, OSUINT32 *pnocts, ASN1TagType tagging, int length)
int berDecStrmEnum (OSCTXT *pctxt, OSINT32 *object_p, ASN1TagType tagging, int length)
int berDecStrmGetTLVLength (OSCTXT *pctxt)
int berDecStrmInt (OSCTXT *pctxt, OSINT32 *object_p, ASN1TagType tagging, int length)
int berDecStrmInt8 (OSCTXT *pctxt, OSINT8 *object_p, ASN1TagType tagging, int length)
int berDecStrmInt16 (OSCTXT *pctxt, OSINT16 *object_p, ASN1TagType tagging, int length)
int berDecStrmInt64 (OSCTXT *pctxt, OSINT64 *object_p, ASN1TagType tagging, int length)
int berDecStrmLength (OSCTXT *pctxt, int *len_p)
int berDecStrmMatchEOC (OSCTXT *pctxt)
int berDecStrmMatchTag (OSCTXT *pctxt, ASN1TAG tag, int *len_p, OSBOOL advance)
int berDecStrmNextElement (OSCTXT *pctxt)
int berDecStrmNull (OSCTXT *pctxt, ASN1TagType tagging)
int berDecStrmObjId (OSCTXT *pctxt, ASN1OBJID *object_p, ASN1TagType tagging, int length)
int berDecStrmObjId64 (OSCTXT *pctxt, ASN1OID64 *object_p, ASN1TagType tagging, int length)
int berDecStrmOctStr (OSCTXT *pctxt, OSOCTET *pvalue, OSUINT32 *pnocts, ASN1TagType tagging, int length)
int berDecStrmOpenType (OSCTXT *pctxt, const OSOCTET **object_p2, OSUINT32 *pnumocts)
int berDecStrmOpenTypeAppend (OSCTXT *pctxt, OSRTDList *pElemList)
int berDecStrmOpenTypeExt (OSCTXT *pctxt, ASN1CCB *ccb_p, ASN1TAG *tags, int tagCount, OSRTDList *pElemList)
int berDecStrmPeekTagAndLen (OSCTXT *pctxt, ASN1TAG *ptag, int *plen)
int berDecStrmReadDynTLV (OSCTXT *pctxt, OSOCTET **ppbuf)
int berDecStrmReadTLV (OSCTXT *pctxt, OSOCTET *buf, size_t bufsiz)
int berDecStrmReal (OSCTXT *pctxt, OSREAL *object_p, ASN1TagType tagging, int length)
int berDecStrmReal10 (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, int length)
int berDecStrmRelativeOID (OSCTXT *pctxt, ASN1OBJID *object_p, ASN1TagType tagging, int length)
int berDecStrmTag (OSCTXT *pctxt, ASN1TAG *tag_p)
int berDecStrmTagAndLen (OSCTXT *pctxt, ASN1TAG *tag_p, int *len_p)
OSBOOL berDecStrmTestEOC (OSCTXT *pctxt, ASN1CCB *ccb_p)
int berDecStrmTestTag (OSCTXT *pctxt, ASN1TAG tag, int *len_p, OSBOOL advance)
int berDecStrmUInt (OSCTXT *pctxt, OSUINT32 *object_p, ASN1TagType tagging, int length)
int berDecStrmUInt8 (OSCTXT *pctxt, OSUINT8 *object_p, ASN1TagType tagging, int length)
int berDecStrmUInt16 (OSCTXT *pctxt, OSUINT16 *object_p, ASN1TagType tagging, int length)
int berDecStrmUInt64 (OSCTXT *pctxt, OSUINT64 *object_p, ASN1TagType tagging, int length)
int berDecStrmUnivStr (OSCTXT *pctxt, Asn132BitCharString *object_p, ASN1TagType tagging, int length)

Detailed Description

The C streaming BER Decode Functions decode ASN.1 primitive data types directly from the input stream. The input stream should be initialized as buffered stream by using rtxStreamInit function. It also must be already opened by using any of the following functions: rtxStreamFileOpen, rtxStreamFileAttach, rtxStreamSocketAttach, rtxStreamMemoryCreate, rtxStreamMemoryAttach.


Function Documentation

int berDecStrmBigInt ( OSCTXT *  pctxt,
const char **  object_p,
ASN1TagType  tagging,
int  length 
)

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 a "0x" prefix. If it is necessary to convert a hexadecimal string to another radix, then use the rtxBigIntSetStr / rtxBigIntToString functions.

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_p Pointer to a character pointer variable to receive the decoded value. Dynamic memory is allocated for the variable using the rtxMemAlloc function. The decoded variable is represented as a hexadecimal string starting with a "0x" prefix.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmBitStr ( OSCTXT *  pctxt,
OSOCTET *  pvalue,
OSUINT32 *  pnbits,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable of the ASN.1 BIT STRING type into a static memory structure. This function call is generated by ASN1C to decode a sized bit string production.

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.
pvalue Pointer to a variable to receive the decoded bit string. This is assumed to be a static array large enough to hold the number of bits specified in the *pnbits input parameter.
pnbits As input parameter it is a pointer to an integer variable containing the size (in bits) of the sized ASN.1 bit string. An error will occur if the number of bits in the decoded string is larger than this value. Note that this is also used as an output variable - the actual number of decoded bits will be returned in this variable.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmBMPStr ( OSCTXT *  pctxt,
Asn116BitCharString *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable an ASN.1 16-bit character string type. This includes the BMPString 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_p Pointer to a structure variable to receive the decoded string. The string is stored as an array of short integer characters. Memory is allocated for the string by the rtxMemAlloc function.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmBool ( OSCTXT *  pctxt,
OSBOOL *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable of the ASN.1 BOOLEAN 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_p Pointer to a variable to receive the decoded BOOLEAN value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmCharStr ( OSCTXT *  pctxt,
const char **  ppvalue,
ASN1TagType  tagging,
ASN1TAG  tag,
int  length 
)

This function decodes a variable of one of the ASN.1 8-bit character string types. These types include IA5String, VisibleString, PrintableString, and NumericString.

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.
ppvalue Pointer to a character string pointer variable to receive the decoded string. The string is stored as a standard null-terminated C string. Memory is allocated for the string by the rtxMemAlloc function.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
tag The ASN.1 tag to be decoded. This parameter is passed using the ASN1C internal tag representation. It is passed as an unsigned 32-bit integer. This parameter only has meaning if the tagging parameter specifies explicit decoding.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
OSBOOL berDecStrmCheckEnd ( OSCTXT *  pctxt,
ASN1CCB *  pccb 
)

This function tests for the end of a constructed context. It is used in loop control statements to determine when a block of repeating elements has ended.

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.
pccb Pointer to a 'context control block' structure. This is basically a loop control mechanism to keep the variable associated with parsing a nested constructed element straight.
Returns:
A result of testing:
  • TRUE, if end of current context has been reached;
  • FALSE, otherwise.
int berDecStrmDynBitStr ( OSCTXT *  pctxt,
const OSOCTET **  ppvalue,
OSUINT32 *  pnbits,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable of the ASN.1 BIT STRING type. It will allocate dynamic memory to store the decoded result.

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.
ppvalue Pointer to a pointer variable to receive the decoded bit string. Dynamic memory is allocated to hold the string.
pnbits Pointer to an integer value to receive the decoded number of bits.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmDynOctStr ( OSCTXT *  pctxt,
const OSOCTET **  ppvalue,
OSUINT32 *  pnocts,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable of the ASN.1 OCTET STRING type. It will allocate dynamic memory to store the decoded result.

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.
ppvalue Pointer to a pointer variable to receive the decoded octet string. Dynamic memory is allocated to hold the string.
pnocts Pointer to an integer value to receive the decoded number of octets.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmEnum ( OSCTXT *  pctxt,
OSINT32 *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable of the ASN.1 ENUMERATED 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_p Pointer to a variable to receive the decoded enumerated value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmGetTLVLength ( OSCTXT *  pctxt  ) 

This function returns the length of the tag-length-value at the current position in the stream.

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.
Returns:
Total length (in bytes) of TLV component or negative error code.
int berDecStrmInt ( OSCTXT *  pctxt,
OSINT32 *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable of the ASN.1 INTEGER 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_p Pointer to a variable to receive a decoded 32-bit integer value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmInt16 ( OSCTXT *  pctxt,
OSINT16 *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a 16-bit variable of the ASN.1 INTEGER 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_p Pointer to a variable to receive a decoded 16-bit integer value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmInt64 ( OSCTXT *  pctxt,
OSINT64 *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a 64-bit variable of the ASN.1 INTEGER 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_p Pointer to a variable to receive a decoded 64-bit integer value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmInt8 ( OSCTXT *  pctxt,
OSINT8 *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes an 8-bit variable of the ASN.1 INTEGER 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_p Pointer to a variable to receive a decoded 8-bit integer value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmLength ( OSCTXT *  pctxt,
int *  len_p 
)

This function decodes a BER 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.
len_p Pointer to a variable to receive the decoded length of the tagged component. The returned value will either be the actual length or the special constant 'ASN_K_INDEFLEN', which indicates indefinite length.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmMatchEOC ( OSCTXT *  pctxt  ) 

This function does a comparison between the end-of-contents octets (EOC) and the tag at the current decode pointer position to determine if they match. It then returns the result of the match operation. If match is not successful, the decode pointer will be unchanged; otherwise the pointer will be moved behind the EOC.

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.
Returns:
Completion status of operation:
  • 0 (0) - match is successful;
  • RTERR_IDNOTFOU - match is not successful;
  • negative value - error occurred.
int berDecStrmMatchTag ( OSCTXT *  pctxt,
ASN1TAG  tag,
int *  len_p,
OSBOOL  advance 
)

This function does a comparison between the given tag and the tag at the current decode pointer position to determine if they match. It then returns the result of the match operation.

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.
tag Tag variable to match.
len_p Pointer to a variable to receive the decoded length of the tagged component. The returned value will either be the actual length or the special constant 'ASN_K_INDEFLEN', which indicates indefinite length.
advance The boolean value indicates the behaviour of the decode pointer. If it is set to TRUE and match is successful, then the pointer will be moved behind the tag. Otherwise, it will be left unchanged.
Returns:
Completion status of operation:
  • 0 (0) - match is successful;
  • RTERR_IDNOTFOU - match is not successful;
  • negative value - error occurred.
int berDecStrmNextElement ( OSCTXT *  pctxt  ) 

This function moves the decode pointer to the next tagged element in the decode stream. It is useful for use in an error handling callback function because it allows an unknown or bogus element to be skipped.

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.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmNull ( OSCTXT *  pctxt,
ASN1TagType  tagging 
)

This function decodes an ASN.1 NULL placeholder.

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.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmObjId ( OSCTXT *  pctxt,
ASN1OBJID *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a value of the ASN.1 OBJECT IDENTIFIER 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_p 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.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmObjId64 ( OSCTXT *  pctxt,
ASN1OID64 *  object_p,
ASN1TagType  tagging,
int  length 
)

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

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_p 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.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmOctStr ( OSCTXT *  pctxt,
OSOCTET *  pvalue,
OSUINT32 *  pnocts,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable of the ASN.1 OCTET STRING type into a static memory structure. This function call is generated by ASN1C to decode a sized octet string production.

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.
pvalue Pointer to a variable to receive the decoded octet string. This is assumed to be a static array large enough to hold the number of octets specified in the *pnocts input parameter.
pnocts Pointer to an integer variable containing the size (in octets) of the sized ASN.1 octet string. An error will occur if the number of octets in the decoded string is larger than this value. Note that this is also used as an output variable - the actual number of decoded octets will be returned in this variable.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmOpenType ( OSCTXT *  pctxt,
const OSOCTET **  object_p2,
OSUINT32 *  pnumocts 
)

This function decodes a variable of an ASN.1 open type. This includes the now deprecated ANY and ANY DEFINED BY types from the 1990 standard as well as other types defined to be open in the new standards (for example, a variable type declaration in an X.681 Information Object Class definition).
Decoding is accomplished by returning a pointer to the encoded message component at the current decode pointer location and skipping to the next field. The caller must then call additional decode functions to further decode the component.

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 a pointer (**) to hold the address of a byte buffer. This buffer will contain a copy of the encoded message component located at the current decode pointer location.
pnumocts Pointer to an integer value to receive the decoded number of octets.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmOpenTypeAppend ( OSCTXT *  pctxt,
OSRTDList *  pElemList 
)

This function is similar to the berDecStrmOpenType. The difference is that after it decodes the open type data into an ASN1OpenType structure, it appends the structure to a doubly-linked list. This function is typically used for decoding extension items in extensible types. The user is provided with a list of each extension item in 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.
pElemList The pointer to linked list structure. The decoded ASN1OpenType structure will be appended to this list.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmOpenTypeExt ( OSCTXT *  pctxt,
ASN1CCB *  ccb_p,
ASN1TAG *  tags,
int  tagCount,
OSRTDList *  pElemList 
)

This function is similar to the berDecStrmOpenType function except that it is used in places where open type extensions are specified. An open type extension is defined as an extensibility marker on a constructed type without any extension elements defined (for example, SEQUENCE { a INTEGER, : }). The difference is that this is an implicit field that can span one or more elements whereas the standard Open Type is assumed to be a single tagged field.

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.
ccb_p Pointer to a 'context control block' structure. This is basically a loop control mechanism to keep the variable associated with parsing a nested constructed element straight.
tags Array of next expected tag values (null if last field). The routine will loop through elements until a matching tag is found or some other error occurs.
tagCount The number of tags in the tags array.
pElemList The pointer to linked list structure. The decoded ASN1OpenType structure will be appended to this list.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmPeekTagAndLen ( OSCTXT *  pctxt,
ASN1TAG *  ptag,
int *  plen 
)

This function "peeks" the tag and length at the current decode pointer location and returns the results. The decode pointer location is left as it was before call to this function.

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.
ptag Pointer to a variable to receive the decoded ASN.1 tag value.
plen Pointer to a variable to receive the decoded length of the tagged component. The returned value will either be the actual length or the special constant 'ASN_K_INDEFLEN', which indicates indefinite length.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmReadDynTLV ( OSCTXT *  pctxt,
OSOCTET **  ppbuf 
)

This function reads a complete tag-length-value (TLV) from the decode stream into a dynamic memory buffer.

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.
ppbuf Pointer to a pointer to a buffer to receive the allocated memory pointer. The memory is allocated using the rtxMem* memory management functions. This may be freed using rtxMemFree or rtxMemFreePtr.
Returns:
The total number of octets read into the buffer, or negative error code.
int berDecStrmReadTLV ( OSCTXT *  pctxt,
OSOCTET *  buf,
size_t  bufsiz 
)

This function reads a complete tag-length-value (TLV) from the decode stream into the given memory buffer.

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.
buf Pointer to a buffer to receive a data.
bufsiz Size of the buffer.
Returns:
The total number of octets read into the buffer, or negative error code.
int berDecStrmReal ( OSCTXT *  pctxt,
OSREAL *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable of the binary encoded ASN.1 REAL 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_p Pointer to a variable to receive the decoded real value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmReal10 ( OSCTXT *  pctxt,
const char **  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes 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 working variables that must be maintained between function calls.
object_p Pointer to a character pointer variable to receive the decoded result. Dynamic memory is allocated for the variable using the rtxMemAlloc function.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmRelativeOID ( OSCTXT *  pctxt,
ASN1OBJID *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a value of the ASN.1 RELATIVE-OID 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_p 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.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmTag ( OSCTXT *  pctxt,
ASN1TAG *  tag_p 
)

This function decodes the tag at the current decode pointer location and returns the results.

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.
tag_p Pointer to a variable to receive the decoded ASN.1 tag value.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmTagAndLen ( OSCTXT *  pctxt,
ASN1TAG *  tag_p,
int *  len_p 
)

This function decodes the tag and length at the current decode pointer location and returns the results.

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.
tag_p Pointer to a variable to receive the decoded ASN.1 tag value.
len_p Pointer to a variable to receive the decoded length of the tagged component. The returned value will either be the actual length or the special constant 'ASN_K_INDEFLEN', which indicates indefinite length.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
OSBOOL berDecStrmTestEOC ( OSCTXT *  pctxt,
ASN1CCB *  ccb_p 
)

This function does a quick test on end-of-contents octets at the current decode pointer. In contrast to the berDecStrmMatchEOC this function never moves the decode pointer and it returns a boolean result of testing.

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.
ccb_p Pointer to a 'context control block' structure. This is basically a loop control mechanism to keep the variable associated with parsing a nested constructed element straight.
Returns:
A result of testing:
  • TRUE, if EOC at the current decode pointer;
  • FALSE, otherwise.
int berDecStrmTestTag ( OSCTXT *  pctxt,
ASN1TAG  tag,
int *  len_p,
OSBOOL  advance 
)

This function does a comparison between the given tag and the tag at the current decode pointer position to determine if they match. It then returns the result of the match operation. In contrary to the berDecStrmMatchTag function this one does NOT log error, if tags are not matched.

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.
tag Tag variable to match.
len_p Pointer to a variable to receive the decoded length of the tagged component. The returned value will either be the actual length or the special constant 'ASN_K_INDEFLEN', which indicates indefinite length.
advance The boolean value indicates the behaviour of the decode pointer. If it is set to TRUE and match is successful, then the pointer will be moved behind the tag. Otherwise, it will be left unchanged.
Returns:
Completion status of operation:
  • 0 (0) - match is successful;
  • RTERR_IDNOTFOU - match is not successful;
  • another negative value - error occurred.
int berDecStrmUInt ( OSCTXT *  pctxt,
OSUINT32 *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable of the unsigned variant of ASN.1 INTEGER 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_p Pointer to a variable to receive a decoded unsigned 32-bit integer value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmUInt16 ( OSCTXT *  pctxt,
OSUINT16 *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a 16-bit variable of the unsigned variant of ASN.1 INTEGER 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_p Pointer to a variable to receive a decoded unsigned 16-bit integer value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmUInt64 ( OSCTXT *  pctxt,
OSUINT64 *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a 64-bit variable of the unsigned variant of ASN.1 INTEGER 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_p Pointer to a variable to receive a decoded unsigned 64-bit integer value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmUInt8 ( OSCTXT *  pctxt,
OSUINT8 *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes an 8-bit variable of the unsigned variant of ASN.1 INTEGER 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_p Pointer to a variable to receive a decoded unsigned 8-bit integer value.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.
int berDecStrmUnivStr ( OSCTXT *  pctxt,
Asn132BitCharString *  object_p,
ASN1TagType  tagging,
int  length 
)

This function decodes a variable an ASN.1 32-bit character UniversalString 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_p Pointer to a structure variable to receive the decoded string. The string is stored as an array of unsigned integer characters. Memory is allocated for the string by the rtxMemAlloc function.
tagging An enumerated type whose value is set to either 'ASN1EXPL' (for explicit tagging) or 'ASN1IMPL' (for implicit). Controls whether the universal tag value for this type is added or not. Users will generally always set this value to 'ASN1EXPL'.
length The length, in octets, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field.
Returns:
Completion status of operation: 0 (0) = success, negative return value is error.