Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
virtual P6R::P6ERR P6R::p6IAsn1_2::decodeLength_2 ( P6UINT8 pBuffer,
P6UINT32  bufSize,
P6UINT32 pIndex,
P6UINT32 pLength 
)
pure virtual

For BER encodings, this function returns the length of the value field.

pBuffer[ index ] MUST point to the start of the length field of a BER encoded type. So for example, <Tag: integer, Length: 1, Value: 5>, this function will return 1. The pointer into the BER encoded buffer, that is index, is advanced to the start of the value field. This function will properly handle both the definite and indefinite form of length encodings.

This function would be useful when decoding the length of, for example, an ASN.1 SEQUENCE constructed type. Each of the other functions below will call decodeLength as part of processing their primitive types.

Parameters
pBuffer[ in ] Byte array containg the ASN.1 encoded data to decode
bufSize[ in ] the amount of data (in bytes) pointed to by pBuffer
pIndex[ in ] current offset into pBuffer, should be pointing to the length field of an integer tagged value [ out ] this index moves down the pBuffer data as the data is decoded
pLength[ out ] the number of octets that the current ASN.1 Value occupies
Returns
SuccessP6R::eOk 
FailureP6R::eNotInitializedA successful call to initialize was not made before this call.
P6R::eInvalidArgOne of the parameters is NULL.
P6R::eFormatErrorCould not properly decode the length field.
P6R::eTooBigMax length value decoded is 4,394,967,296, or what fits into a P6UINT32 type.