t_accept - accept a connect request
int t_accept( int fd, int resfd, struct t_call *call);
This function is issued by a transport user to accept a connect request.
fd identifies the local transport endpoint where the connect indication
arrived, resfd specifies the local transport endpoint where the
connection is to be established, and call contains information required
by the transport provider to complete the connection. call points to a
t_call structure that contains the following members:
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
netbuf is described in intro(3N). In call, addr is the address of the
caller, opt indicates any protocol-specific parameters associated with
the connection, udata points to any user data to be returned to the
caller, and sequence is the value returned by t_listen that uniquely
associates the response with a previously received connect indication.
A transport user may accept a connection on either the same, or on a
different, local transport endpoint from the one on which the connect
indication arrived. If the same endpoint is specified (that is,
resfd=fd), the connection can be accepted unless the following condition
is true: The user has received other indications on that endpoint but
has not responded to them (with t_accept or t_snddis). For this
t_accept will fail and set t_errno to TINDOUT.
t_accept will fail and set t_errno to TBADF.
If a different transport endpoint is specified (resfd!=fd), the endpoint
must be bound to a protocol address and must be in the T_IDLE state [see
t_getstate(3N)] before the t_accept is issued.
For both types of endpoints, t_accept will fail and set t_errno to TLOOK
if there are indications (for example, a connect or disconnect) waiting
to be received on that endpoint.
The values of parameters specified by opt and the syntax of those values
are protocol specific. The udata argument enables the called transport
user to send user data to the caller and the amount of user data must not
exceed the limits supported by the transport provider as returned in the
connect field of the info argument of t_open or t_getinfo. If the len
[see netbuf in intro(3N)] field of udata is zero, no data will be sent to
This function resides within both the X/Open compliant libxnet and the
SVR4 compliant libnsl Network Services libraries. Network Services
applications which require X/Open compliance must link-load with -lxnet.
Network Services applications which require SVR4 compliance must linkload
On failure, t_errno may be set to one of the following:
TBADF The specified file descriptor does not refer to a
transport endpoint, or the user is invalidly accepting
a connection on the same transport endpoint on which
the connect indication arrived.
TOUTSTATE The function was issued in the wrong sequence on the
transport endpoint referenced by fd, or the transport
endpoint referred to by resfd is not in the T_IDLE
TACCES The user does not have permission to accept a
connection on the responding transport endpoint or use
the specified options.
TBADOPT The specified options were in an incorrect format or
contained invalid information.
TBADDATA The amount of user data specified was not within the
bounds supported by the transport provider as returned
in the connect field of the info argument of t_open or
TBADADDR If _XOPEN_SOURCE is defined, TBADADDR will be returned
because the specified protocol address was in an
incorrect format or contained illegal information.
TBADSEQ An invalid sequence number was specified.
TFLOW An errno of EAGAIN was returned from the ioctl() call
when trying to send the connection response packet.
When this happens, t_errno is set to TFLOW.
TLOOK An asynchronous event has occurred on the transport
endpoint referenced by fd and requires immediate
TNOTSUPPORT This function is not supported by the underlying
TSYSERR A system error has occurred during execution of this
TINDOUT If _XOPEN_SOURCE is defined, TINDOUT will be returned
because the function was called with fd=resfd but
there are outstanding connection indications on the
endpoint. Those other connection indications must be
handled either by rejecting them via t_snddis(3N) or
accepting them on a different endpoint via
TPRIVMISMATCH If _XOPEN_SOURCE is defined, TPRIVMISMATCH will be
returned because the file descriptors fd and resfd do
not refer to the same transport provider.
TRESQLEN If _XOPEN_SOURCE is defined, TRESQLEN will be returned
because the endpoint referenced by resfd (where resfd
!= fd) was bound to a protocol address with a qlen
that is greater than zero.
TPROTO If _XOPEN_SOURCE is defined, TPROTO will be returned
because a communication problem has been detected
between XTI and the transport provider for whicjh
there is no other suitable XTI (t_errno).
TRESADDR If _XOPEN_SOURCE is defined, TRESADDR will be returned
because this transport provider requires both fd and
resfd to be bound to the same address. This error
results if they are not.
intro(3N), t_connect(3N), t_getstate(3N), t_listen(3N), t_open(3N),
Upon successful completion, a value of 0 is returned. Otherwise, a value
of -1 is returned and t_errno is set to indicate the error.
PPPPaaaaggggeeee 3333 [ Back ]