Look at the end of the qapitest.c sample file to find a section that looks like this:
note: This option only allow to call when xcbp->state is in PREALLOCATION_STATE */
xcomqparm->funccode = 'p';
/* check for error message */
/* print out queue entry information */
printf("==== QAPI ended ===\n");
To call the XCOMPRE script from the XcomQAPI
1. You should have a customized XCOMPRE script.
2. You must point to that script in the xcom.glb file with the XPRECMD parameter.
3. Recycle the XCOM daemon so your changes made to the xcom.glb file to be effective.
After a file transfer request is submitted, but before any data transmission begins, XCOM adds the transfer to the queue. It is during this same pre-data-transmission phase of the transfer that XCOM runs the XCOMPRE scrip. If you want your program to be able to check for specific conditions or parameter values and conditionally change those values, you could do so with the XCOMPRE script.
For example, suppose it was against policy to write a file to a particular directory, but rather than have a transfer fail with a security error, you will just re-route that transfer to a different directory. As you can see from the above excerpt from the sample qapitest.c file, you have access to the "lfile" parameter, allowing your application the ability to make the directory name change in the transfer request before the transfer is started from the queue.