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

The integers in BER are variable length.

That is a value that can fit into 24 bits will do so and not be encoded in 32 bits. We don't know the size of the integer until we see two things: the length in octets of the integer and its twos-complement sign bit. Side effect: this function, on a successful parsing of the integer, also skips the value field in the buffer.

The resulting value is always treated as a positive number.

NOTE, that "pBuffer[ index ]" MUST point to the start of the length field of the INTEGER type. That is the tag associated with the ASN.1 type should have already been processed by the caller and skipped. This function does not understand BER tags, but assumes that the caller does and has positioned pBuffer[ index ] to decode the length and value of the INTEGER.

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
pValue[ out ] the calculated integer value which can be negative or a postive value
Returns
SuccessP6R::eOk 
FailureP6R::eNotInitializedA successful call to initialize was not made before this call.
P6R::eInvalidArgOne of the parameters is NULL.
P6R::eTooBigAny integer larger than 8 octets (64 bits) is not handled.
errors from decodeLength()This function calls decodeLength.