cpiCreateContext

Purpose

Creates a user-defined extension context associated with a parser object. It is invoked by the message broker when an instance of a parser object is constructed or allocated. This occurs when a message flow causes the message data to be parsed; the broker constructs or allocates a parser object to acquire the appropriate section of the message data. Before this function is called, the broker will have created a name element as the effective root element for the parser. However, this element is not named. The parser should name this element in the cpiSetElementName function.

The responsibilities of the extension are to:
  1. Allocate any parser instance specific data areas (such as context) that might be required.
  2. Perform any additional resource acquisition or initialization that might be required.
  3. Return the address of the context to the calling function. Whenever an implementation function for this parser instance is invoked, the appropriate context is passed as an argument to that function. This means that a user-defined parser developed in C need not maintain its own static pointers to per-instance data areas.
Defined In Type Member
CPI_VFT Mandatory iFpCreateContext

Syntax

void cpiCreateContext(
  CciParser*   parser);

Parameters

parser
The address of the parser object (input).

Return values

If successful, the address of the user-defined extension context is returned. Otherwise, a value of zero is returned.

Related concepts
User-defined parsers
User-defined extensions
Related reference
C parser implementation functions