int mwreply(char * reply, int replylen, int successflag, int applicationreturncode, int flags);
mwreturn(char * reply, int replylen, int successflag, int applicationreturncode);
This function is used in a service routine to return a reply to the service request. The reply argument is a pointer to the data to be sent. If NULL no data is returned, only return codes, and the calling client gets confirmation that the call was executed. If replylen is 0, we assume a NULL terminated reply string. The successflag is interpreted by MidWay as success of failure. (Not really used, but important for future support for the XA interface, where a failure causes a rollback.) Zero on failure, non zero for success. mwfetch() on the client will return EFAULT if this flag is zero. In addition to successflag programmers may pass another return code, applicationreturncode for private use. MidWay ignore it, so it is optional.
The only legal flag is MWMORE, which signal that the server intends to issue more mwreply's. It is only legal is the calling client set the MWMULTIPLE flag.
If the service perform a normal C return without calling mwreply() first, the input buffer is returned, and the C return code is used as successflag.
Note that if the mw(a)call() had the MWNOREPLY flag set (see mwservice()) this call is silently ignored and may be omitted.
mwservice(3C),mwcall(3C),mwacall(3C),mwfetch(3C),mwalloc(3C),mwrealloc(3C),mwfree(3C)