tpacall
-routine for sending a service request
#include <atmi.h>
int tpacall(char *svc, char *data, long len, long flags)
tpacall
() sends a request message to the service named by svc
. The request is sent out at the priority defined for svc
unless overridden by a previous call to tpsprio
(3). If data
is non-NULL, it must point to a buffer previously allocated by tpalloc
(3) and len
should specify the amount of data in the buffer that should be sent. Note that if data
points to a buffer of a type that does not require a length to be specified, (for example, an FML
fielded buffer), then len
is ignored (and may be 0). If data
is NULL, len
is ignored and a request is sent with no data portion. The type and sub-type of data
must match one of the types and sub-types recognized by svc
. Note that for each request sent while in transaction mode, a corresponding reply must ultimately be received.
Following is a list of valid flags
.
TPNOTRAN
svc
is invoked, it is not performed on behalf of the caller's transaction. If svc
belongs to a server that does not support transactions, then this flag must be set when the caller is in transaction mode. Note that svc
may still be invoked in transaction mode but it will not be the same transaction: a svc
may have as a configuration attribute that it is automatically invoked in transaction mode. A caller in transaction mode that sets this flag is still subject to the transaction timeout (and no other). If a service fails that was invoked with this flag, the caller's transaction is not affected.
TPNOREPLY
TPNOREPLY
is set, the function returns 0 on success, where 0 is an invalid descriptor. When the caller is in transaction mode, this setting cannot be used unless TPNOTRAN
is also set.
TPNOBLOCK
TPNOBLOCK
is not specified and a blocking condition exists, the caller blocks until the condition subsides or a timeout occurs (either transaction or blocking timeout).
TPNOTIME
TPSIGRSTRT
Upon successful completion, tpacall
() returns a descriptor that can be used to receive the reply of the request sent. Otherwise it returns a value of \-1 and sets tperrno
to indicate the error condition.
Under the following conditions, tpacall
() fails and sets tperrno
to one of the following values. (Unless otherwise noted, failure does not affect the caller's transaction, if one exists.)
TPEINVAL
]
svc
is NULL, data
does not point to space allocated with tpalloc
(3), or flags
are invalid).
TPENOENT
]
svc
because it does not exist or is a conversational service.
TPEITYPE
]
data
is not one of the allowed types and sub-types that svc
accepts.
TPELIMIT
]
TPETRAN
]
svc
belongs to a server that does not support transactions and TPNOTRAN
was not set.
TPETIME
]
TPNOBLOCK
nor TPNOTIME
was specified. If a transaction timeout occurred, then with one exception, any attempts to send new requests or receive outstanding replies will fail with TPETIME
until the transaction has been aborted. The exception is a request that does not block, expects no reply, and is not sent on behalf of the caller's transaction (that is, tpacall() with TPNOTRAN
, TPNOBLOCK
, and TPNOREPLY
set).
TPEBLOCK
]
TPNOBLOCK
was specified.
TPGOTSIG
]
TPSIGRSTRT
was not specified.
TPEPROTO
]
TPESYSTEM
]
TPEOS
]
TPEOS
may be returned even if tpacall
returned successfully.
tpalloc
(3), tpcall
(3), tpcancel
(3), tpgetrply
(3), tpgprio
(3), tpsprio
(3)