OSI/MHS P7 Application Programmatic Interface (P7 API) Manual

C Language Example Program
OSI/MHS P7 Application Programmatic Interface (P7 API) Manual424825-001
E-12
}
}
return;
} /* end sendCompletion */
#pragma page
/***************************************************************************/
/* Function name: resultCompletion */
/* */
/* Arguments: fileNum */
/* buffer */
/* */
/* Description: This function processes a completion on the result file.*/
/* It receives the data from OSI/MHS and passes it to the */
/* client. It may require more than one completion for */
/* large PDUs; in this case, a static buffer is used to */
/* build up the data. Once all the data has been received */
/* for a PDU, it is sent to the client. */
/* */
/***************************************************************************/
void
resultCompletion ( short int fileNum, /* File number completion occurred on*/
char * buffer) /* Data from OSI/MHS */
{
long int maxBufLen = ZMHS_VAL_LOUAPI_MAX_DATA_SIZE;
long int status; /* Used in calling P7 API proc */
long int bufLen; /* Used in calling P7 API proc */
int dataType; /* Used in calling P7 API proc */
int moreData; /* Used in calling P7 API proc */
int sendFile;
char *tmpBuffer;
tmpBuffer = buffer;
/*
* If this is the first in a sequence of calls, determine
* the size of the buffer to be allocated by setting bufLen to 0.
*/
if (RecvOffset == 0)
{
bufLen = 0;
printf ("calling LOS_DT_FINISH_RESULT_() on result file(check
len)\n");
status = LOS_DT_FINISH_RESULT_(fileNum,
(long int *) &tmpBuffer,
&bufLen,
maxBufLen,
&dataType,
&moreData);
if (status != P7_SUCCESS)
{
/* Report Error and aborted association to client */
statusError("LOS_DT_FINISH_RESULT_ failed", status);
mapResultFileNum(fileNum, &sendFile);
status = LOS_CLOSE_(sendFile, fileNum);
return;
}
printf("LOS_DT_FINISH_RESULT_ success\n");
/* allocate buffer to receive data into if one is needed */
if (bufLen != 0 )
{
RecvBufferPtr = calloc(1, bufLen);
}
}
/* Receive the maximum data sent by OSI/MHS */
bufLen = ZMHS_VAL_LOUAPI_MAX_DATA_SIZE;
printf ("calling LOS_DT_FINISH_RESULT_() on result file(get the