t_rcvdis Subroutine for X/Open Transport Interface

Purpose

Retrieve information from disconnect.

Library

X/Open Transport Interface Library (libxti.a)

Syntax

#include <xti.h>
int t_rcvdis (fd, discon)
int fd;
struct t_discon *discon;

Description

The t_rcvdis subroutine identifies the cause of a disconnect and retrieves any user data sent with the disconnect.

Parameters

Item Description
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 t_discon structure fields are:

reason
Specifies the reason for the disconnect through a protocol-dependent reason code.
udata
Identifies any user data that was sent with the disconnect.
sequence
May identify an outstanding connect indication with which the disconnect is associated. The sequence field is only meaningful when the t_rcvdis subroutine is issued by a passive transport user who has executed one or more t_listen subroutines and is processing the resulting connect indications. If a disconnect indication occurs, the sequence field can be used to identify which of the outstanding connect indications is associated with the disconnect.

If a user does not care if there is incoming data and does not need to know the value of the reason or sequence fields, the discon field value 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 the t_listen subroutine) and the discon field value 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).

Return Values

Item Description
0 Successful completion.
-1 t_errno is set to indicate an error.

Error Codes

On failure, t_errno is set to one of the following:

Value Description
TBADF The specified file descriptor does not refer to a transport endpoint.
TBUFOVFLW The number of bytes allocated for incoming data (maxlen) is greater than 0 but not sufficient to store the data. If the fd parameter is a passive endpoint with ocnt > 1, it remains in state T_INCON; otherwise, the endpoint state is set to T_IDLE.
TNODIS No disconnect indication currently exists on the specified transport endpoint.
TNOTSUPPORT This subroutine is not supported by the underlying transport provider.
TOUTSTATE The subroutine was issued in the wrong sequence on the transport endpoint referenced by the fd parameter.
TPROTO This error indicates that a communication problem has been detected between the X/Open Transport Interface and the transport provider for which there is no other suitable X/Open Transport Interface (t_errno).
TSYSERR A system error has occurred during execution of this subroutine.