OFC Parse Functions

OFC parse functions define a method for parsing OFC document instances. They utilize the data structures previously described.

There are five parse function prototypes:

InitOFCParse()


void  InitOFCParse()

This function MUST be called before any other parse calls are made to initialize the token lookup table. For an OFC server this call should be made when the server application or DLL is first loaded.

RcParseOFCRequest()


int RcParseOFCRequest(
    void * pvRequest, 
    int cbRequest,
    POFCDOC * ppofcdoc);

The first parameter must point to a block of memory containing the OFC request file to be parsed. This function will convert the OFC request file into a series of NULL terminated string buffers during the parsing process. The size of the memory block will not be altered during this process.

The second parameter indicates the count of bytes in the memory block pointed to by pvRequest.

The third parameter is a pointer to a POFCDOC. The function will allocate memory for an OFCDOC, and assign the pointer to the OFCDOC structure if the function succeeds. The OFCDOC will contain the linked list of OFC transactions found in the request file. The function will allocate memory for all of the required OFCTRN structures, and the corresponding OFC transaction and aggregate structures. All of the string buffer pointers (szFoo) contained in the OFC transaction structures will point into the memory block containing the converted OFC file (pvResquest).

The function will return one of the following:

Value

Meaning

ALL_OK

Successful

OFC_ERROR

Illegal OFC File

NO_MEMORY

A memory allocation failed

INVALID_DTD_VER

The DTD version of the file passed in doesn't match the parser

INVALID_CALL

An internal error, this should not occur after the Beta release.


The caller of this function must call CleanupOFCDOCParse() in order to free the OFCDOC and it's associated structures when they are no longer needed. After calling CleanupOFCDOCParse(), the caller will then be responsible for freeing the memory block pointed to by pvRequest.

RcParseOFCResponse()


int RcParseOFCResponse(
    void * pvResponse, 
    int cbResponse,
    POFCDOC * ppofcdoc);

The first parameter must point to a block of memory containing the OFC response file to be parsed. This function will convert the OFC response file into a series of NULL terminated string buffers during the parsing process. The size of the memory block will not be altered during this process.

The second parameter indicates the count of bytes in the memory block pointed to by pvResponse.

The third parameter is a pointer to a POFCDOC. The function will allocate memory for an OFCDOC, and assign the pointer to the OFCDOC structure if the function succeeds. The OFCDOC will contain the linked list of OFC transactions found in the response file. The function will allocate memory for all of the required OFCTRN structures, and the corresponding OFC transaction and aggregate structures. All of the string buffer pointers (szFoo) contained in the OFC transaction structures will point into the memory block containing the converted OFC file (pvResponse).

The function will return one of the following:

Value

Meaning

ALL_OK

Successful

OFC_ERROR

Illegal OFC File

NO_MEMORY

A memory allocation failed

INVALID_DTD_VER

The DTD version of the file passed in doesn't match the parser

INVALID_CALL

An internal error, this should not occur after the Beta release.


The caller of this function must call CleanupOFCDOCParse() in order to free the OFCDOC and it's associated structures when they are no longer needed. After calling CleanupOFCDOCParse(), the caller will then be responsible for freeing the memory block pointed to by pvResponse.

RcParseOFCStatement()


int RcParseOFCStatement(
    void * pvStatment, 
    int cbStatment,
    POFCDOC * ppofcdoc);

The first parameter must point to a block of memory containing the OFC statement file to be parsed. This function will convert the OFC statement file into a series of NULL terminated string buffers during the parsing process. The size of the memory block will not be altered during this process.

The second parameter indicates the count of bytes in the memory block pointed to by pvStatement.

The third parameter is a pointer to a POFCDOC. The function will allocate memory for an OFCDOC, and assign the pointer to the OFCDOC structure if the function succeeds. The OFCDOC will contain the linked list of OFC transactions found in the statement file. The function will allocate memory for all of the required OFCTRN structures, and the corresponding OFC transaction and aggregate structures. All of the string buffer pointers (szFoo) contained in the OFC transaction structures will point into the memory block containing the converted OFC file (pvStatement).

The function will return one of the following:

Value

Meaning

ALL_OK

Successful

OFC_ERROR

Illegal OFC File

NO_MEMORY

A memory allocation failed

INVALID_DTD_VER

The DTD version of the file passed in doesn't match the parser

INVALID_CALL

An internal error, this should not occur after the Beta release.


The caller of this function must call CleanupOFCDOCParse() in order to free the OFCDOC and it's associated structures when they are no longer needed. After calling CleanupOFCDOCParse(), the caller will then be responsible for freeing the memory block pointed to by pvStatement.

CleanupOFCDOCParse()


void CleanupOFCDOCParse(
    POFCDOC * ppofcdoc);

The first parameter is a pointer to a POFCDOC. This must point to the OFCDOC created as a result of calling one of the previous OFC parsing functions. This function will free all OFCDOC, OFCTRN, OFC transaction, and OFC aggregate structures created as a result of calling one of the parsing functions. The caller will be responsible for freeing the memory containing the converted OFC document instance.