DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

OFComposeBmipResponseError(S_ADM)


OFComposeBmipResponseError -- create BMIP response

Syntax

#include <scoAdmin/osaStdDef.h>

bmipResponse_t (*OFComposeBmipResponseError errStatusPtr, bmipRequestPtr)

Description

This routine allocates the space and fills in the information for a BMIP response. This routine should be used when a BMIP response cannot be generated by the OFEvaluateOperation routine (most often when an error has occurred with the operation evaluation routine, or before that routine has had a chance to be run).

The routine fills in the fields of the BMIP response with information it receives from the BMIP request forwarded to it. It will also set the response's errorParameter field to match the error stack located at errStatusPtr. If the error stack is empty, the field will be left equal to NULL.

Since the BMIP response is identical on a field by field basis with the request, it might be necessary for the programmer to re-assign some of the values if the routine is used at certain times during the Request Processor. For example, if the routine is used while looping through all the object instances, the objectInstance field of the response would need to be set to the value of the current object instance (the routine having set it to the list of all the object instances listed in the BMIP request).

The space allocated to the BMIP response is freed by the routine OFReturnBmipResponse after it is done with it.

Arguments


bmipResponse_t *
This is the BMIP response structure returned by the function OFComposeBmipResponseError, to be used by the routine OFReturnBmipResponse.

errStatus_cl *errStatusPtr
A pointer to the error stack data structure. If an error occurs in retrieving the data, the appropriate error will be placed in the error stack. This data can be referenced using the library functions associated with the error stack.

bmipRequest_pt bmipRequestPtr
This is a pointer to the BMIP request structure forwarded as an argument to the request processor.

Example

void
ObjectRequestProcessor(errStatus_cl       *errStatusPtr,
                       int                 handleId,
                       bmipRequest_pt      bmipRequestPtr,
                       void               *osaDataPtr)
    {
    int    loop;
    int    objectCount;
    char **objectList;

. . . /* Compose a list of all the object instances and put them * in the array objectList[], also set objectCount equal to * the number of objects that exist. */ . . .

for (loop = 0; loop < objectCount; ++loop) { bmipResponse_t *bmipResponsePtr; bmipResponsePtr = OFEvaluateOperation(errStatusPtr, handleId, objectList[loop]); if (ErrorIsOk(errStatusPtr) == FALSE) { /* Something went wrong with the actual execution of * OFEvaluateOperation, not just a failure with the * BMIP request. */

bmipResponsePtr = OFComposeBmipResponseError(errStatusPtr, bmipRequestPtr);

/* Clear the error stack because it's now stored in the * BMIP response. */

ErrorClear(errStatusPtr);

/* Set the object instance to be equal to the current object, * as the error only happened with this one object. */

free(bmipResponsePtr->objectInstancePtr); strdup(bmipResponsePtr->objectInstancePtr, objectList[loop]); }

OFReturnBmipResponse(errStatusPtr, handleId, bmipResponsePtr, (loop + 1 == objectCount) ? FALSE : TRUE ); }

See also

OFEvaluateOperation(S_ADM), OFReturnBmipResponse(S_ADM).
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005