t_accept - accept a connect request
int t_accept(fd, resfd, call)
struct t_call *call;
t_accept() 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 connec-
tion is to be established, and call contains information required by
the transport provider to complete the connection. call points to a
t_call structure which contains the following members:
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
The netbuf structure contains the following members:
unsigned int maxlen;
unsigned int len;
buf points to a user input and/or output buffer. len generally speci-
fies the number of bytes contained in the buffer. If the structure is
used for both input and output, the transport function will replace the
user value of len on return. maxlen generally has significance only
when buf is used to receive output from the transport function. In
this case, it specifies the physical size of the buffer, and the maxi-
mum value of len that can be set by the function. If maxlen is not
large enough to hold the returned information, a TBUFOVFLW error will
generally result. However, certain functions may return part of the
data and not generate an error. 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(3N) that
uniquely associates the response with a previously received connect
A transport user may accept a connection on either the same, or on a
different, local transport endpoint than the one on which the connect
indication arrived. If the same endpoint is specified (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(3N)). For this condi-
tion, t_accept() will fail and set t_errno to TBADF.
If a different transport endpoint is specified (resfd != fd), the end-
point 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 (such as a connect or disconnect) wait-
ing to be received on that endpoint.
The values of parameters specified by opt and the syntax of those val-
ues are protocol specific. The udata field enables the called trans-
port 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 by t_open(3N) or t_getinfo(3N). If the len field of udata is
zero, no data will be sent to the caller.
0 on success.
-1 on failure and sets t_errno to indicate the error.
TACCES The user does not have permission to accept a con-
nection on the responding transport endpoint.
The user does not have permission to use the speci-
TBADDATA The amount of user data specified was not within
the bounds allowed by the transport provider.
TBADF The specified file descriptor does not refer to a
The user is illegally accepting a connection on the
same transport endpoint on which the connect indi-
TBADOPT The specified options were in an incorrect format
or contained illegal information.
TBADSEQ An invalid sequence number was specified.
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
TOUTSTATE The function was issued in the wrong sequence on
the transport endpoint referenced by fd.
The transport endpoint referred to by resfd is not
in the T_IDLE state.
TSYSERR The function failed due to a system error and set
errno to indicate the error.
intro(3), t_connect(3N), t_getstate(3N), t_listen(3N), t_open(3N),
21 January 1990 T_ACCEPT(3N)