Networking Services Library Functions taccept(3NSL)
NAME
taccept - accept a connection request
SYNOPSIS
#include
int taccept(int fd, int resfd, const struct tcall *call);
DESCRIPTION
This routine is part of the XTI interfaces that evolved from
the TLI interfaces. XTI represents the future evolution of
these interfaces. However, TLI interfaces are supported for
compatibility. When using a TLI routine that has the same
name as an XTI routine, a different header file, tiuser.h,
must be used. Refer to the TLI COMPATIBILITY section for a
description of differences between the two interfaces.
This function is issued by a transport user to accept a con-
nection request. The parameter fd identifies the local
transport endpoint where the connection indication arrived;
resfd specifies the local transport endpoint where the con-
nection is to be established, and call contains information
required by the transport provider to complete the connec-
tion. The parameter call points to a tcall structure which
contains the following members:
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
int sequence;
In call, addr is the protocol address of the calling tran-
sport user, opt indicates any options associated with the
connection, udata points to any user data to be returned to
the caller, and sequence is the value returned by
tlisten(3NSL) that uniquely associates the response with a
previously received connection indication. The address of
the caller, addr may be null (length zero). Where addr is
not null then it may optionally be checked by XTI.
A transport user may accept a connection on either the same,
or on a different, local transport endpoint than the one on
which the connection indication arrived. Before the connec-
tion can be accepted on the same endpoint (resfd==fd), the
SunOS 5.11 Last change: 1 May 1998 1
Networking Services Library Functions taccept(3NSL)
user must have responded to any previous connection indica-
tions received on that transport endpoint by means of
taccept() or tsnddis(3NSL). Otherwise, taccept() will
fail and set terrno to TINDOUT.
If a different transport endpoint is specified (resfd!=fd),
then the user may or may not choose to bind the endpoint
before the taccept() is issued. If the endpoint is not
bound prior to the taccept(), the endpoint must be in the
TUNBND state before the taccept() is issued, and the
transport provider will automatically bind it to an address
that is appropriate for the protocol concerned. If the tran-
sport user chooses to bind the endpoint it must be bound to
a protocol address with a qlen of zero and must be in the
TIDLE state before the taccept() is issued.
Responding endpoints should be supplied to taccept() in
the state TUNBND.
The call to taccept() may fail with terrno set to TLOK
if there are indications (for example connect or disconnect)
waiting to be received on endpoint fd. Applications should
be prepared for such a failure.
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
topen(3NSL) or tgetinfo(3NSL). If the len field of udata
is zero, no data will be sent to the caller. All the maxlen
fields are meaningless.
When the user does not indicate any option (call->opt.len =
0) the connection shall be accepted with the option values
currently set for the responding endpoint resfd.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned and terrno is set to
indicate an error.
VALID STATES
fd: TINCON
resfd (fd!=resfd): TIDLE, TUNBND
SunOS 5.11 Last change: 1 May 1998 2
Networking Services Library Functions taccept(3NSL)
ERORS
On failure, terrno is set to one of the following:
TACES The user does not have permission to accept
a connection on the responding transport
endpoint or to use the specified options.
TBADADR The specified protocol address was in an
incorrect format or contained illegal
information.
TBADATA The amount of user data specified was not
within the bounds allowed by the transport
provider.
TBADF The file descriptor fd or resfd does not
refer to a transport endpoint.
TBADOPT The specified options were in an incorrect
format or contained illegal information.
TBADSEQ Either an invalid sequence number was
specified, or a valid sequence number was
specified but the connection request was
aborted by the peer. In the latter case,
its TDISCONECT event will be received on
the listening endpoint.
TINDOUT The function was called with fd==resfd but
there are outstanding connection indica-
tions on the endpoint. Those other connec-
tion indications must be handled either by
rejecting them by means of tsnddis(3NSL)
or accepting them on a different endpoint
by means of taccept.
TLOK An asynchronous event has occurred on the
transport endpoint referenced by fd and
requires immediate attention.
TNOTSUPORT This function is not supported by the
underlying transport provider.
SunOS 5.11 Last change: 1 May 1998 3
Networking Services Library Functions taccept(3NSL)
TOUTSTATE The communications endpoint referenced by
fd or resfd is not in one of the states in
which a call to this function is valid.
TPROTO 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 (terrno).
TPROVMISMATCH The file descriptors fd and resfd do not
refer to the same transport provider.
TRESADR This transport provider requires both fd
and resfd to be bound to the same address.
This error results if they are not.
TRESQLEN The endpoint referenced by resfd (where
resfd != fd) was bound to a protocol
address with a qlen that is greater than
zero.
TSYSER A system error has occurred during execu-
tion of this function.
TLI COMPATIBILITY
The XTI and TLI interface definitions have common names but
use different header files. This, and other semantic differ-
ences between the two interfaces are described in the sub-
sections below.
Interface Header
The XTI interfaces use the header file, xti.h. TLI inter-
faces should not use this header. They should use the
header:
#include
Error Description Values
The terrno values that can be set by the XTI interface and
cannot be set by the TLI interface are:
TPROTO
SunOS 5.11 Last change: 1 May 1998 4
Networking Services Library Functions taccept(3NSL)
TINDOUT
TPROVMISMATCH
TRESADR
TRESQLEN
Option Buffer
The format of the options in an opt buffer is dictated by
the transport provider. Unlike the XTI interface, the TLI
interface does not specify the buffer format.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
MT Level Safe
SEE ALSO
tconnect(3NSL), tgetinfo(3NSL), tgetstate(3NSL),
tlisten(3NSL), topen(3NSL), toptmgmt(3NSL),
trcvconnect(3NSL), tsnddis(3NSL), attributes(5)
WARNINGS
There may be transport provider-specific restrictions on
address binding.
Some transport providers do not differentiate between a con-
nection indication and the connection itself. If the con-
nection has already been established after a successful
return of tlisten(3NSL), taccept() will assign the exist-
ing connection to the transport endpoint specified by resfd.
SunOS 5.11 Last change: 1 May 1998 5
|