The IP address value uses an application specific tag but is encoded/decoded as a 4 byte OCTET STRING.
That is there is no universal tag or format for this data type. Each byte of the ipAddress parameter represents one of the 4 numbers that comprise an IP address. Refer to the encodeIPAddr function above for details.
NOTE, that "pBuffer[ index ]" MUST point to the start of the length field of the IP address. 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 ip address.
- 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 |
pIpAddress | [ out ] the extracted 32 bit IP address in network byte order. |
- Returns
Success | P6R::eOk | |
Failure | P6R::eNotInitialized | A successful call to initialize was not made before this call. |
P6R::eInvalidArg | One of the parameters is NULL. |
P6R::eFormatError | Could not properly decode type into IP address. |
errors from decodeLength() | This function calls decodeLength. |