User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.x:api:xatmi:tpservice.3

tpservice

Name

tpservice — Template service function signature

Synopsis

#include <atmi.h>

void tpservice(TPSVCINFO *svcinfo);

For XATMI client link with -latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm

For XATMI server link with -latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm

DESCRIPTION

This is service function signature/template. tpservice is service function that must be passed to tpadvertise() in order to provide callable service to XATMI system. Services can be called by tpcall(), tpacall() or tpforward(). If server is conversational, then tpconnect() is used to establish the connection with service. When service is invoked, then parameter svcinfo is initialised with following field:

typedef struct
{
        char    name[XATMI_SERVICE_NAME_LENGTH];
        char    *data;
        long    len;
        long    flags;
        int     cd;
        long    appkey;
        CLIENTID cltid;
        char    fname[XATMI_SERVICE_NAME_LENGTH+1];
} TPSVCINFO;

name is service name which is invoked. data is pointer XATMI buffer which is allocated by Enduro/X in current process scope. Note that is service was invoked with NULL buffer, then in this case data will be NULL too. len is XATMI buffer length. flags these are flags which were passed to origin tpcall(). appkey is reserved for future use. cltid is reserved for future use. fname is service function name which was invoked.

In case if using C++ compiler, function must be defined without name mangling, thus extern "C" prefix shall be used.

RETURN VALUE

The function does not return any value. But according to XATMI specification, the server function must terminate processing with tpreturn() or tpforward(), which effectively finish the service function processing and gives control back to client or next XATMI server. In case of success the server can pass TPSUCCESS or TPFAIL if doing tpreturn(). TPFAIL will automatically abort global transaction, if one in progress.

ERRORS

Not available.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd