MWREPLY

Section: MidWay Programmer's Manual (3C)
Updated: DATE
Index Return to Main Contents
 

NAME

mwreply, mwreturn - Returning data from service routines  

SYNOPSIS

#include <MidWay.h>

int mwreply(char * reply, int replylen, int successflag, int applicationreturncode, int flags);

mwreturn(char * reply, int replylen, int successflag, int applicationreturncode);  

DESCRIPTION

mwreturn is quite simply an alias for mwreply followed by a return(successflag). It is offered as a convenience only.

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.

 

RETURN VALUES

On success mwreply return 1, on failure, -errno. mwreturn do of course never return.

 

ERRORS

EINVAL
mwreply return -EINVAL if the MWMORE flags is set, and the client has not set the MWMULTIPLE flag.
EALREADY
mwreply return -EALREADY if mwreply was previously called without MWMORE flag, or if the client has set the MWNOREPLY flag.

 

WARNINGS

It is very bad practice to omit this call. If you do a mwrealloc() on the input buffer and return by C return, you will pass back the original buffer, and cause a buffer leak. I may change this practice in the future, if I find that is as bad an idea as I believe it to be.

 

EXAMPLES

 

BUGS

 

SEE ALSO

mwservice(3C),mwcall(3C),mwacall(3C),mwfetch(3C),mwalloc(3C),mwrealloc(3C),mwfree(3C)

 

STANDARDS

NONE


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
ERRORS
WARNINGS
EXAMPLES
BUGS
SEE ALSO
STANDARDS

This document was created by man2html, using the manual pages.
Time: 11:18:50 GMT, October 24, 2000