t_accept(3)
NAME
t_accept − accept a connect request
SYNOPSIS
#include <xti.h> (for XTI)
or
#include <tiuser.h> (for TLI)
int t_accept (fd, resfd, call)
int fd;
int resfd;
struct t_call *call;
DESCRIPTION
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 the following structure:
struct t_call {
struct netbuf addr; /* address */
struct netbuf opt; /* options */
struct netbuf udata; /* user data */
int sequence; /* sequence number */
}
The type 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 buffer
char *buf points to buffer location
addr is a netbuf structure containing the address of the caller.
opt is a netbuf structure containing any protocol-specific parameters associated with the connection. For XTI over the OSI transport provider, this netbuf should point to a struct of type isoco_options. For TLI, see the documentation for the transport provider being used.
udata is a netbuf structure pointing to any user data to be returned to the caller.
sequence is the value returned by t_listen(3) that uniquely associates the response with a previously received connect indication.
t_accept can only be called in the T_INCON transport provider state.
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 endpoint (resfd == fd), the user must have responded to any previous connect indications received on that transport endpoint (via t_accept or t_snddis (3)). Otherwise, 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 (if the protocol address for resfd and fd is the same, qlen must be set to 0 for resfd) and must be in the T_IDLE state (see t_getstate(3)) before the t_accept is issued.
For both types of endpoints t_accept(3) will fail and set t_errno to [TLOOK] if there are indications (e.g. 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 info argument of t_open(3) or t_getinfo(3). If the len field of udata is zero, no data will be sent to the caller. All the maxlen fields are meaningless.
ERRORS
On failure, t_errno is set to one of the following:
[TBADF] Either 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] (XTI only) The specified options were in an incorrect format or contained illegal information.
[TBADDATA] (XTI only) The amount of user data specified was not within the bounds allowed by the transport provider.
[TBADSEQ] (XTI only) An invalid sequence number was specified
[TLOOK] An asynchronous event has occurred on the transport endpoint referenced by fd and requires immediate attention.
[TNOTSUPPORT] This function is not supported by the underlying transport provider.
[TSYSERR] A system error has occurred during execution of this function.
RETURN VALUE
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.
FILES
For more information on data structures refer to /usr/include/xti.h and /usr/include/xti_iso.h for XTI, or /usr/include/tiuser.h for TLI.
NOTE
In HP-UX 9.0, XTI (X/Open Transport Interface) supports only OSI as a transport provider, and is available only as part of the OSI Transport Services 9000 product. Users of this product can access XTI versions of the t_* routines by linking with /usr/lib/libxti.a. For more information on XTI, see "HP-UX/9000 XTI Programmer’s Guide".
In HP-UX 9.0, TLI (Transport Layer Interface) supports any transport provider which is compliant with TPI (Transport Provider Interface). TLI is available only as part of the STREAMS product. Users of this product can access TLI versions of the t_* routines by linking with /usr/lib/libnsl_s.a. For more information on TLI, see the TLI section of "STREAMS/UX for HP 9000 Reference Manual".
SEE ALSO
t_connect(3), t_getstate(3), t_listen(3), t_open(3), t_rcvconnect(3).
Hewlett-Packard Company — HP-UX Release 9.0: October 1992