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.

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


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 rtStreamBufInit function. It also must be already opened by using any of the following functions: rtStreamFileOpen, rtStreamFileAttach, rtStreamSocketAttach, rtStreamMemoryCreate, rtStreamMemoryAttach.


Functions

int berDecStrmBMPStr (ASN1CTXT *pctxt, Asn116BitCharString *object_p, ASN1TagType tagging, int length)
int berDecStrmBigInt (ASN1CTXT *pctxt, ASN1ConstCharPtr *object_p, ASN1TagType tagging, int length)
int berDecStrmBitStr (ASN1CTXT *pctxt, ASN1OCTET *pvalue, ASN1UINT *pnbits, ASN1TagType tagging, int length)
int berDecStrmBool (ASN1CTXT *pctxt, ASN1BOOL *object_p, ASN1TagType tagging, int length)
int berDecStrmCharStr (ASN1CTXT *pctxt, ASN1ConstCharPtr *ppvalue, ASN1TagType tagging, ASN1TAG tag, int length)
int berDecStrmDynBitStr (ASN1CTXT *pctxt, ASN1ConstOctetPtr *ppvalue, ASN1UINT *pnbits, ASN1TagType tagging, int length)
int berDecStrmDynOctStr (ASN1CTXT *pctxt, ASN1ConstOctetPtr *ppvalue, ASN1UINT *pnocts, ASN1TagType tagging, int length)
int berDecStrmEnum (ASN1CTXT *pctxt, ASN1ENUM *object_p, ASN1TagType tagging, int length)
int berDecStrmInt (ASN1CTXT *pctxt, ASN1INT *object_p, ASN1TagType tagging, int length)
int berDecStrmInt8 (ASN1CTXT *pctxt, ASN1INT8 *object_p, ASN1TagType tagging, int length)
int berDecStrmInt16 (ASN1CTXT *pctxt, ASN1SINT *object_p, ASN1TagType tagging, int length)
int berDecStrmInt64 (ASN1CTXT *pctxt, ASN1INT64 *object_p, ASN1TagType tagging, int length)
int berDecStrmLength (ASN1CTXT *pctxt, int *len_p)
int berDecStrmMatchEOC (ASN1CTXT *pctxt)
int berDecStrmMatchTag (ASN1CTXT *pctxt, ASN1TAG tag, int *len_p, ASN1BOOL advance)
int berDecStrmNextElement (ASN1CTXT *pctxt)
int berDecStrmNull (ASN1CTXT *pctxt, ASN1TagType tagging)
int berDecStrmObjId (ASN1CTXT *pctxt, ASN1OBJID *object_p, ASN1TagType tagging, int length)
int berDecStrmObjId64 (ASN1CTXT *pctxt, ASN1OID64 *object_p, ASN1TagType tagging, int length)
int berDecStrmOctStr (ASN1CTXT *pctxt, ASN1OCTET *pvalue, ASN1UINT *pnocts, ASN1TagType tagging, int length)
int berDecStrmOpenType (ASN1CTXT *pctxt, ASN1ConstOctetPtr *object_p2, ASN1UINT *numocts_p)
int berDecStrmOpenTypeAppend (ASN1CTXT *pctxt, Asn1RTDList *pElemList)
int berDecStrmOpenTypeExt (ASN1CTXT *pctxt, ASN1CCB *ccb_p, ASN1TAG tag, Asn1RTDList *pElemList)
int berDecStrmPeekTagAndLen (ASN1CTXT *pctxt, ASN1TAG *ptag, int *plen)
int berDecStrmReal (ASN1CTXT *pctxt, ASN1REAL *object_p, ASN1TagType tagging, int length)
int berDecStrmRelativeOID (ASN1CTXT *pctxt, ASN1OBJID *object_p, ASN1TagType tagging, int length)
int berDecStrmTag (ASN1CTXT *pctxt, ASN1TAG *tag_p)
int berDecStrmTagAndLen (ASN1CTXT *pctxt, ASN1TAG *tag_p, int *len_p)
ASN1BOOL berDecStrmTestEOC (ASN1CTXT *pctxt, ASN1CCB *ccb_p)
int berDecStrmTestTag (ASN1CTXT *pctxt, ASN1TAG tag, int *len_p, ASN1BOOL advance)
int berDecStrmUInt (ASN1CTXT *pctxt, ASN1UINT *object_p, ASN1TagType tagging, int length)
int berDecStrmUInt8 (ASN1CTXT *pctxt, ASN1UINT8 *object_p, ASN1TagType tagging, int length)
int berDecStrmUInt16 (ASN1CTXT *pctxt, ASN1USINT *object_p, ASN1TagType tagging, int length)
int berDecStrmUInt64 (ASN1CTXT *pctxt, ASN1UINT64 *object_p, ASN1TagType tagging, int length)
int berDecStrmUnivStr (ASN1CTXT *pctxt, Asn132BitCharString *object_p, ASN1TagType tagging, int length)


Function Documentation

int berDecStrmBigInt ASN1CTXT *  pctxt,
ASN1ConstCharPtr *  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 rtBigIntSetStr / rtBigIntToString 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. The rtStreamBufInit function must be called for this context before use it.
object_p Pointer to a character pointer variable to receive the decoded value. Dynamic memory is allocated for the variable using the rtMemAlloc 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 (ASN_OK) = success, negative return value is error.

int berDecStrmBitStr ASN1CTXT *  pctxt,
ASN1OCTET *  pvalue,
ASN1UINT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmBMPStr ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
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 rtMemAlloc 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 (ASN_OK) = success, negative return value is error.

int berDecStrmBool ASN1CTXT *  pctxt,
ASN1BOOL *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmCharStr ASN1CTXT *  pctxt,
ASN1ConstCharPtr *  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. The rtStreamBufInit function must be called for this context before use it.
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 rtMemAlloc 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 (ASN_OK) = success, negative return value is error.

int berDecStrmDynBitStr ASN1CTXT *  pctxt,
ASN1ConstOctetPtr *  ppvalue,
ASN1UINT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmDynOctStr ASN1CTXT *  pctxt,
ASN1ConstOctetPtr *  ppvalue,
ASN1UINT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmEnum ASN1CTXT *  pctxt,
ASN1ENUM *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmInt ASN1CTXT *  pctxt,
ASN1INT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmInt16 ASN1CTXT *  pctxt,
ASN1SINT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmInt64 ASN1CTXT *  pctxt,
ASN1INT64 *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmInt8 ASN1CTXT *  pctxt,
ASN1INT8 *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmLength ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmMatchEOC ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
Returns:
Completion status of operation:
  • 0 (ASN_OK) - match is successful;
  • ASN_E_IDNOTFOU - match is not successful;
  • negative value - error occurred.

int berDecStrmMatchTag ASN1CTXT *  pctxt,
ASN1TAG  tag,
int *  len_p,
ASN1BOOL  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) - match is successful;
  • ASN_E_IDNOTFOU - match is not successful;
  • negative value - error occurred.

int berDecStrmNextElement ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
Returns:
Completion status of operation: 0 (ASN_OK) = success, negative return value is error.

int berDecStrmNull ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmObjId ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmObjId64 ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmOctStr ASN1CTXT *  pctxt,
ASN1OCTET *  pvalue,
ASN1UINT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmOpenType ASN1CTXT *  pctxt,
ASN1ConstOctetPtr *  object_p2,
ASN1UINT *  numocts_p
 

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. The rtStreamBufInit function must be called for this context before use it.
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.
numocts_p Pointer to an integer value to receive the decoded number of octets.
Returns:
Completion status of operation: 0 (ASN_OK) = success, negative return value is error.

int berDecStrmOpenTypeAppend ASN1CTXT *  pctxt,
Asn1RTDList *  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. The rtStreamBufInit function must be called for this context before use it.
pElemList The pointer to linked list structure. The decoded ASN1OpenType structure will be appended to this list.
Returns:
Completion status of operation: 0 (ASN_OK) = success, negative return value is error.

int berDecStrmOpenTypeExt ASN1CTXT *  pctxt,
ASN1CCB *  ccb_p,
ASN1TAG  tag,
Asn1RTDList *  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. The rtStreamBufInit function must be called for this context before use it.
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.
tag Next expected tag value (or ASN_K_NOTAG value if last field). The routine will loop through elements until matching tag found or some other error occurs.
pElemList The pointer to linked list structure. The decoded ASN1OpenType structure will be appended to this list.
Returns:
Completion status of operation: 0 (ASN_OK) = success, negative return value is error.

int berDecStrmPeekTagAndLen ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmReal ASN1CTXT *  pctxt,
ASN1REAL *  object_p,
ASN1TagType  tagging,
int  length
 

This function decodes a variable of the 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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmRelativeOID ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmTag ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
tag_p Pointer to a variable to receive the decoded ASN.1 tag value.
Returns:
Completion status of operation: 0 (ASN_OK) = success, negative return value is error.

int berDecStrmTagAndLen ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

ASN1BOOL berDecStrmTestEOC ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
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 ASN1CTXT *  pctxt,
ASN1TAG  tag,
int *  len_p,
ASN1BOOL  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) - match is successful;
  • ASN_E_IDNOTFOU - match is not successful;
  • another negative value - error occurred.

int berDecStrmUInt ASN1CTXT *  pctxt,
ASN1UINT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmUInt16 ASN1CTXT *  pctxt,
ASN1USINT *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmUInt64 ASN1CTXT *  pctxt,
ASN1UINT64 *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmUInt8 ASN1CTXT *  pctxt,
ASN1UINT8 *  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. The rtStreamBufInit function must be called for this context before use it.
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 (ASN_OK) = success, negative return value is error.

int berDecStrmUnivStr ASN1CTXT *  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. The rtStreamBufInit function must be called for this context before use it.
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 rtMemAlloc 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 (ASN_OK) = success, negative return value is error.


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