cpiBufferByte
This function gets a single byte from the buffer containing the bit stream representation of the input message, for the specified parser object. The value of the index argument indicates which byte in the byte array is to be returned.
Syntax
CciByte cpiBufferByte(
int* returnCode,
CciParser* parser,
CciSize index);
Parameters
- returnCode
- Receives the return code from the function (output). Possible return codes are:
- CCI_SUCCESS
- CCI_EXCEPTION
- CCI_INV_PARSER_OBJECT
- CCI_NO_BUFFER_EXISTS
- parser
- Specifies the address of the parser object (input).
- index
- Specifies the offset to use as an index into the buffer (input).
Return values
The requested byte is returned. If an error occurs, returnCode indicates the reason for the error.
Sample
This example is taken from the sample parser file BipSampPluginParser.c:
void advance(
PARSER_CONTEXT_ST* context,
CciParser* parser
){
int rc = 0;
/* Advance to the next character */
context->iIndex++;
/* Detect and handle the end condition */
if (context->iIndex == context->iSize) return;
/* Obtain the next character from the buffer */
context->iCurrentCharacter = cpiBufferByte(&rc, parser, context->iIndex);
}