t_rcvdis Subroutine for Transport Layer Interface

Purpose

Retrieves information from disconnect.

Library

Transport Layer Interface Library (libtli.a)

Syntax

#include <tiuser.h>

t_rcvdis(fd, discon)
int  fd;
struct t_discon * discon;

Description

The t_rcvdis subroutine is used to identify the cause of a disconnect, and to retrieve any user data sent with the disconnect.

Parameters

Item Description
fd Identifies the local transport end point where the connection existed.
discon Points to a t_discon structure that contains the reason for the disconnect and contains any user data that was sent with the disconnect.

The t_discon structure contains the following members:

struct netbuf udata;
int reason;
int sequence;

These fields are defined as follows:

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
Identifies 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 that has called 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 parameter may be null and any user data associated with the disconnect will be discarded. However, if a user has retrieved more than one outstanding connect indication (using the t_listen subroutine) and the discon parameter is null, the user will be unable to identify with which connect indication the disconnect is associated.

Return Values

On successful completion, the t_rcvdis subroutine returns a value of 0. Otherwise, it returns a value of -1 and sets the t_errno variable to indicate the error.

Error Codes

If unsuccessful, the t_errno variable may be set to one of the following:

Value Description
TBADF The specified file descriptor does not refer to a transport end point.
TBUFOVFLW The number of bytes allocated for incoming data is not sufficient to store the data. (The state of the provider, as seen by the user, will change to T_IDLE, and the disconnect indication information to be returned in the discon parameter will be discarded.)
TLOOK An asynchronous event has occurred on this transport endpoint and requires immediate attention.
TNODIS No disconnect indication currently exists on the specified transport end point.
TNOTSUPPORT This function is not supported by the underlying transport provider.
TOUTSTATE This subroutine was issued in the wrong sequence.
TSYSERR A system error has occurred during execution of this subroutine.