NAME
t_rcvdis() — retrieve information from disconnect
SYNOPSIS
#include <xti.h> /* for X/OPEN Transport Interface - XTI */
/* or */
#include <tiuser.h> /* for Transport Layer Interface - TLI */
int t_rcvdis (fd, discon);
int fd;
struct t_discon *discon;
DESCRIPTION
The
t_rcvdis()
function is used to identify the cause of a disconnect, and to retrieve
any user data sent with the disconnect.
fd
identifies the local transport endpoint where the connection existed.
discon
points to a
t_discon
structure containing the following members:
struct netbuf udata;
int reason;
int sequence;
The type
netbuf
structure is defined in the
<xti.h>
or
<tiuser.h>
header file. This structure, which is used to define buffer parameters, has
the following members:
- unsigned int maxlen
maximum byte length of the data buffer
- unsigned int len
actual byte length of data written to buffer
- char *buf
points to buffer location
reason
specifies the reason for the disconnect through a
protocol-dependent reason code. For HP XTI over the OSI transport provider,
these codes are described in the OTS/9000 manual section under "Transport
Errors". For TLI, see the documentation for the transport provider being used.
udata
identifies any user data that was sent with the disconnect.
sequence
may identify an outstanding connect indication with which the
disconnect is associated.
sequence
is only meaningful when
t_rcvdis()
is issued by a passive transport user who has executed one or more
t_listen()
functions and is processing the resulting connect indications.
If a disconnect indication occurs,
sequence
can be used to identify which
of the outstanding connect indications is associated with the disconnect.
If a user does not care that there is incoming data and does not need to
know the value of
reason
or
sequence,
discon
may be a null pointer and any user data associated with the disconnect
will be discarded.
However, if a user has retrieved more than one outstanding connect indication
(via
t_listen())
and
discon
is a null pointer, the user will be
unable to identify with which connect indication the disconnect is associated.
Valid States
T_DATAXFER,
T_OUTCON,
T_OUTREL,
T_INREL,
T_INCON
(ocnt > 0)
Fork Safety
t_rcvdis
is not fork-safe.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a
value of -1 is returned and
t_errno
is set to indicate the error.
ERRORS
On failure,
t_errno
is set to one of the following:
- [TBADF]
The specified identifier does not refer to a transport endpoint.
- [TNODIS]
No disconnect indication currently exists on the specified transport endpoint.
- [TBUFOVFLW]
The number of bytes allocated for incoming data is not sufficient to store the
data. If
fd
is a passive endpoint with
ocnt
(number of outstanding connections) > 1, it remains in state
T_INCON
(see
t_getstate).
Otherwise, the endpoint state is set to
T_IDLE.
- [TNOTSUPPORT]
This function is not supported by the underlying transport provider.
- [TOUTSTATE]
(XTI only) This function was issued in the wrong sequence on the transport
endpoint referenced by
fd.
- [TSYSERR]
A system error has occurred during execution of this function.
- [TPROTO]
(XTI only) This error indicates that a communication problem has been detected
between XTI and the transport provider for which there is no existing
XTI (t_errno).
STANDARDS CONFORMANCE
t_rcvdis(): SVID2, XPG3, XPG4