t_rcvdis - retrieve information from disconnection
#include <xti.h> int t_rcvdis(int fd, struct t_discon *discon);
Parameters Before call After call
fd x /
discon->udata.maxlen x =
discon->udata.len / x
discon->udata.buf ? (?)
discon->reason / x
discon->sequence / ?
This function is used to identify the cause of a disconnection and
to retrieve any user data sent with the disconnection. The argument 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;
The field 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. The field 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 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, if the user does not care about incoming data. If, in addition, the user does not need to know the value of reason or sequence, discon may be set to NULL and any user data associated with the disconnection indication shall be discarded. However, if a user has retrieved more than one outstanding connection indication (via
t_listen()) and discon is a null pointer, the user will be unable to identify with which connection indication the disconnection is associated.
T_DATAXFER,T_OUTCON,T_OUTREL,T_INREL,T_INCON(ocnt > 0)
On failure, t_errno is set to one of the following:
- The specified file descriptor does not refer to a transport endpoint.
- The number of bytes allocated for incoming data (maxlen) 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.
- No disconnection indication currently exists on the specified transport endpoint.
- This function is not supported by the underlying transport provider.
- The communications endpoint referenced by fd is not in one of the states in which a call to this function is valid.
- This error indicates that a communication problem has been detected between XTI and the transport provider for which there is no other suitable XTI error (t_errno).
- A system error has occurred during execution of this function.
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and t_errno is set to indicate an error.
t_alloc(), t_connect(), t_listen(), t_open(), t_snddis().
The SYNOPSIS section is placed in the form of a standard C function prototype.