|
|
#include <scoAdmin/osaStdDef.h>bmipResponse_t (*OFComposeBmipResponseError errStatusPtr, bmipRequestPtr)
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.
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 ); }