NAME [Toc] [Back]
t_accept() - accept a connect request
SYNOPSIS [Toc] [Back]
#include <xti.h> /* for X/OPEN Transport Interface - XTI */
/* or */
#include <tiuser.h> /* for Transport Layer Interface - TLI */
int t_accept (fd, resfd, call);
struct t_call *call;
DESCRIPTION [Toc] [Back]
The t_accept() 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. call contains
information required by the transport provider to complete the
connection. The parameter call points to a t_call structure which
contains the following members:
struct netbuf addr; /* address */
struct netbuf opt; /* options */
struct netbuf udata; /* user data */
int sequence; /* sequence number */
The netbuf structure is defined in the <xti.h> or <tiuser.h> header
file. This structure, which is used to define buffer parameters, has
the following members:
unsigned int maxlen maximum byte length of the data buffer
unsigned int len actual byte length of data written to
char *buf points to buffer location
In call, the addr, opt, udata, and sequence parameters are explained
here. addr is the protocol address of the calling transport user. opt
indicates any options associated with the connection. For XTI over the
OSI transport provider, this netbuf should point to a struct of type
isoco_options. udata points to any user data to be returned to the
caller. sequence is the value returned by t_listen() that uniquely
associates the response with a previously received connect indication.
The address of the caller, addr, may be null (length zero). When 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 connect
indication arrived. Before the connection can be accepted on the same
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
endpoint (resfd==fd), the user must have responded to any previous
connect indications received on that transport endpoint (via
t_accept() or t_snddis()). Otherwise, t_accept() will fail and set
t_errno to [TINDOUT].
If a different transport endpoint is specified (resfd!=fd), then the
user may or may not choose to bind the endpoint before t_accept() is
issued. If the endpoint is not bound prior to the t_accept(), then
the transport provider will automatically bind it to the same protocol
address fd is bound to. If the transport user chooses to bind the
endpoint, it must be bound to a protocol address with a qlen of zero
and must be in the T_IDLE state before the t_accept() is issued.
The call to t_accept() will fail with t_errno set to [TLOOK] if there
are indications for example, connect or disconnect waiting to be
received on the endpoint fd.
The udata argument 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 in the connect field
of the info argument of t_open() or t_getinfo(). 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), it is
assumed that the connection is to be accepted unconditionally. The
transport provider may choose options other than the defaults to
ensure that the connection is accepted successfully.
Thread-Safeness [Toc] [Back]
The t_accept() function is safe to be called by multithreaded
applications, and it is thread-safe for both POSIX Threads and DCE
User Threads. It has a cancellation point. It is neither asynccancel
safe nor async-signal safe. Finally, it is not fork-safe.
Valid States [Toc] [Back]
resfd (fd != resfd): T_IDLE
Caveats [Toc] [Back]
There may be transport provider-specific restrictions on address
Some transport providers do not differentiate between a connect
indication and the connection itself. If the connection has already
been established after a successful return of t_listen(), t_accept()
will assign the existing connection to the transport endpoint
specified by resfd.
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
RETURN VALUE [Toc] [Back]
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.
ERRORS [Toc] [Back]
On failure, t_errno is set to one of the following:
[TBADF] The file descriptor, fd or resfd, does not refer
to a transport endpoint, or the user is illegally
accepting a connection of 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 appropriate state.
[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 illegal information.
[TBADDATA] The amount of user data specified was not within
the bounds allowed by the transport provider.
[TBADADDR] The specified protocol address was 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
[TNOTSUPPORT] This function is not supported by the underlying
[TSYSERR] A system error has occurred during execution of
[TINDOUT] 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()
or accepting them on a different endpoint via
[TPROVMISTMATCH] (XTI only) The file descriptors fd and resfd do
not refer to the same transport provider.
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
[TRESQLEN] The endpoint referenced by resfd (where resfd !=
fd) was bound to a protocol address with a qlen
that is greater than zero.
[TPROTO] (XTI only) This error indicates that a
communication problem has been detected between
XTI and the transport provider for which there is
no other suitable XTI (t_errno).
[TRESADDR] This transport provider requires both fd and resfd
to be bound to the same address. This error
results if they are not.
FILES [Toc] [Back]
/usr/include/xti.h XTI data structures
/usr/include/xti_iso.h XTI data structures
/usr/include/tiuser.h TLI data structures
SEE ALSO [Toc] [Back]
t_connect(3), t_getstate(3), t_listen(3), t_open(3), t_rcvconnect(3).
STANDARDS CONFORMANCE [Toc] [Back]
t_accept(): SVID2, XPG3, XPG4
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003 [ Back ]