t_rcvdis(3N)
NAME
t_rcvdis − retrieve information from disconnect
SYNOPSIS
cc [ flag ... ] file ... −lnsl [ library ... ]
#include <xti.h>
int t_rcvdis(int fd, struct t_discon ∗discon);
DESCRIPTION
This routine is part of the XTI interfaces which evolved from the TLI interfaces. XTI represents the future evolution of these interfaces. However, TLI interfaces are supported for compatibility. When using a TLI routine that has the same name as an XTI routine, a different header file, tiuser.h , must be used. Refer to the section, TLI COMPATIBILITY , for a description of differences between the two interfaces.
This function is used to identify the cause of a disconnection, and to retrieve any user data sent with the disconnection. fd identifies the local transport endpoint where the connection existed, and discon points to a t_discon structure containing the following members:
| struct netbuf | udata; |
| int | reason; |
| int | sequence; |
reason specifies the reason for the disconnection through a protocol-dependent reason code, udata identifies any user data that was sent with the disconnection, and sequence may identify an outstanding connection indication with which the disconnection is associated. sequence is only meaningful when t_rcvdis() is issued by a passive transport user who has executed one or more t_listen(3N) functions and is processing the resulting connection indications. If a disconnection indication occurs, sequence can be used to identify which of the outstanding connection indications is associated with the disconnection.
The maxlen field of udata may be set to zero to indicate that the user does not care about incoming data (see TLI COMPATIBILITY for different TLI behavior). Furthermore, a user may not care if there is incoming data and may not need to know the value of reason or sequence. In such cases, supplying a null pointer for discon causes any user data associated with the disconnection to be discarded. However, if a user has retrieved more than one outstanding connection indication (using t_listen()) and discon is a null pointer, the user will be unable to identify with which connection indication the disconnection is associated.
VALID STATES
Legitimate states (see t_getstate(3N)) for a call to this routine are:
T_DATAXFER
T_INCON with outstanding connection count (ocnt) greater than zero
T_INREL
T_OUTCON
T_OUTREL
RETURN VALUES
t_rcvdis returns:
0 On success.
−1 On failure.
On failure, t_errno is set to indicate the error, and possibly errno is set.
ERRORS
On failure, t_errno is set to one of the following:
TBADF The specified file descriptor does not refer to a transport endpoint.
TBUFOVFLW The number of bytes allocated for incoming data (maxlen in the udata portion of discon) is greater than 0 but not sufficient to store the data. If fd is a passive endpoint with ocnt>1, it remains in state T_INCON ; otherwise, the endpoint state is set to T_IDLE .
TNODIS No disconnection indication currently exists on the specified transport endpoint.
TNOTSUPPORT This function is not supported by the underlying transport provider.
TOUTSTATE The communications endpoint referenced by fd or resfd is not in one of the states in which a call to this function is valid.
TPROTO This error indicates that a communication problem has been detected between XTI and the transport provider for which there is no other suitable XTI t_errno.
TSYSERR A system error has occurred during execution of this function, errno will be set to the specific error.
TLI COMPATIBILITY
The XTI and TLI interface definitions have common names but use different header files. This, and other semantic differences between the two interfaces are described in the subsections below.
Interface Header
The XTI interfaces use the header file, xti.h . TLI interfaces should not use this header. They should use the header:
#include <tiuser.h>
Error Description Values
The t_errno values that can be set by the XTI interface and cannot be set by the TLI interface are:
TPROTO
TOUTSTATE
A failure return, and a t_errno value that this routine can set under different circumstances than its XTI counterpart is TBUFOVFLW . It can be returned even when the maxlen field of the corresponding buffer has been set to zero.
For more information refer to the Transport Interfaces Programming Guide.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
| MT-Level | MT-Safe |
SEE ALSO
t_alloc(3N), t_connect(3N), t_listen(3N), t_open(3N), t_snddis(3N), attributes(5)
Transport Interfaces Programming Guide
SunOS 5.6 — Last change: 10 Feb 1997