t_accept(3) — Subroutines
NAME
t_accept − Accepts a connect request
LIBRARY
XTI Library (libxti.a)
SYNOPSIS
#include <xti.h> int t_accept(
int fd,
int resfd,
struct t_call ∗call) ;
PARAMETERS
The t_accept() function can only be called in the T_INCON transport provider state. The following table summarizes the relevance of input and output parameters before and after t_accept() is called:
| Parameter | Before Call | After Call |
| fd | y | n |
| resfd | y | n |
| call->addr.maxlen | n | n |
| call->addr.len | y | n |
| call->addr.buf | o(o) | n |
| call->opt.maxlen | n | n |
| call->opt.len | y | n |
| call->opt.buf | o(o) | n |
| call->udata.maxlen | n | n |
| call->udata.len | y | n |
| call->udata.buf | o(o) | n |
| call->sequence | y | n |
Notes to table:
yThis is a meaningful parameter.
nThis is not a meaningful parameter.
oThis is an optional parameter.
(o)The content of the object pointed to by o is optional.
fd Specifies a file descriptor returned by the t_open() function that identifies the local transport endpoint from which the connect indication arrived.
resfd Specifies the local transport endpoint where the connection is to be established. A calling 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 transport endpoint (resfd == fd), the calling transport user must have responded to any previous connect indications received on that same transport endpoint using the t_accept() or t_snddis() functions. Otherwise, the t_accept() function fails and sets t_errno to [TBADF].
When a different transport endpoint (resfd != fd) is specified, the transport endpoint must be bound to a protocol address with a call to the t_bind() function. When the address bound to the resfd parameter is the same as that bound to the fd parameter, the req->qlen parameter of t_bind() must be set to 0 (zero).
Also, the transport provider state must be T_IDLE, (refer to the t_getstate() function) before the t_accept() function is called. For both types of transport endpoint, t_accept() fails and sets t_errno to [TLOOK] when there are indications, such as connect or disconnect, waiting to be received at that endpoint.
call Points to a type t_call structure used to store information required by the transport provider to complete the connection. The t_call structure has the following four members:
struct netbuf addr
Specifies a buffer for protocol address information sent by the calling transport user. The type netbuf structure referenced by this member is defined in the xti.h include file. This structure, which is used to define buffer parameters, has the following members:
unsigned int maxlen
Specifies the maximum byte length of the data buffer.
unsigned int len
Specifies the actual byte length of data written to the buffer.
char ∗buf
Points to the buffer location.
struct netbuf opt
Specifies protocol-specific parameters associated with the calling transport user.
struct netbuf udata
Specifies parameters of user data returned to the calling transport user from the remote transport user.
int sequence
Specifies a unique identification number used to identify the previously received connect indication.
The values of parameters specified by call->opt and the syntax of those values are protocol-specific.
The call->udata parameters enable the remote transport user to send data to the calling transport user. The amount of user data must not exceed the limits specified by the transport provider as returned in the info->connect parameter of the t_open() and t_getinfo() functions. When the call->udata.len parameter is 0 (zero), no data is sent to the calling transport user.
Data specified by all call->udata.maxlen parameters are meaningless.
The call->sequence parameter is a value returned by the t_listen() function that uniquely associates the response with a previously received connect indication.
DESCRIPTION
The t_accept() function is an XTI connection-oriented service function that is issued by a calling transport user to accept a connect request after a connect indication has arrived. Structures of types t_call and netbuf, which are defined in the xti.h include file, are used by this function.
RETURN VALUES
Upon successful completion, a value of 0 (zero) is returned. Otherwise, a value of -1 is returned and t_errno is set to indicate the error.
ERRORS
If the t_accept() function fails, t_errno may be set to one of the following:
[TBADF]The fd or resfd file descriptor does not refer to a transport endpoint, or the user is illegally accepting a connection on the same transport endpoint on which the connect indication arrived.
[TOUTSTATE]
The t_accept() function was called in the wrong sequence at the transport endpoint referenced by the fd parameter, or the transport endpoint referred to by the resfd parameter is not in the appropriate state.
[TACCES]The user does not have permission to accept a connection on the responding transport endpoint or to 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 the fd parameter and requires immediate attention.
[TSYSERR]A system error occurred during execution of this function.
[TNOTSUPPORT]
This function is not supported by the underlying transport provider.
RELATED INFORMATION
Functions: t_connect(3), t_getstate(3), t_listen(3), t_open(3), t_optmgmt(3), t_rcvconnect(3)