[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 2

t_accept Subroutine for Transport Layer Interface

Purpose

Accepts a connect request.

Library

Transport Layer Interface Library (libtli.a)

Syntax

#include <tiuser.h>
int t_accept (fd, resfd, call)
int fd;
int resfd;
struct t_call *call;

Description

The t_accept subroutine is issued by a transport user to accept a connect request. A transport user can accept a connection on either the same local transport end point or on an end point different from the one on which the connect indication arrived.

Parameters

fd Identifies the local transport end point where the connect indication arrived.
resfd Specifies the local transport end point where the connection is to be established.
call Contains information required by the transport provider to complete the connection. The call parameter points to a t_call structure, which contains the following members:
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
int sequence;

The netbuf structure is described in the tiuser.h file. In the call parameter, the addr field is the address of the caller, the opt field indicates any protocol-specific parameters associated with the connection, the udata field points to any user data to be returned to the caller, and the sequence field is the value returned by the t_listen subroutine which uniquely associates the response with a previously received connect indication.

If the same end point is specified (that is, the resfd value equals the fd value), the connection can be accepted unless the following condition is true: the user has received other indications on that end point, but has not responded to them (with either the t_accept or t_snddis subroutine). For this condition, the t_accept subroutine fails and sets the t_errno variable to TBADF.

If a different transport end point is specified (that is, the resfd value does not equal the fd value), the end point must be bound to a protocol address and must be in the T_IDLE state (see the t_getstate subroutine) before the t_accept subroutine is issued.

For both types of end points, the t_accept subroutine fails and sets the t_errno variable to TLOOK if there are indications (for example, a connect or disconnect) waiting to be received on that end point.

The values of parameters specified by the opt field and the syntax of those values are protocol-specific. The udata field enables the called transport user to send user data to the caller, the amount of user data must not exceed the limits supported by the transport provider as returned by the t_open or t_getinfo subroutine. If the value in the len field of the udata field is 0, no data will be sent to the caller.

Return Values

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

Error Codes

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

TACCES The user does not have permission to accept a connection on the responding transport end point or use the specified options.
TBADDATA The amount of user data specified was not within the bounds allowed by the transport provider.
TBADDR The specified protocol address was in an incorrect format or contained illegal information.
TBADF The specified file descriptor does not refer to a transport end point; or the user is illegally accepting a connection on the same transport end point on which the connect indication arrived.
TBADOPT The specified options were in an incorrect format or contained illegal information.
TBADSEQ An incorrect sequence number was specified.
TLOOK An asynchronous event has occurred on the transport end point referenced by the fd parameter and requires immediate attention.
TNOTSUPPORT This function is not supported by the underlying transport provider.
TOUTSTATE The function was issued in the wrong sequence on the transport end point referenced by the fd parameter, or the transport end point referred to by the resfd parameter is not in the T_IDLE state.
TSYSERR A system error has occurred during execution of this function.

Implementation Specifics

This subroutine is part of the Base Operating System (BOS) Runtime.

Related Information

The t_alloc subroutine, t_connect subroutine, t_getinfo subroutine, t_getstate subroutine, t_listen subroutine, t_open subroutine, t_rcvconnect subroutine and t_snddis subroutine.

List of Streams Programming References and STREAMS Overview in AIX Version 4.3 Communications Programming Concepts.


[ Previous | Next | Contents | Glossary | Home | Search ]