|
Description
The transport user calls the t_accept() function to accept a connection over a transport endpoint, which another transport user requested with the t_connect() function.
The fd parameter designates the local transport endpoint on which a connection request arrived. The resfd parameter specifies the local transport endpoint over which the connection is to be set up.
Two cases must be discriminated with the resfd transport endpoint on which the connection is to be accepted:
resfd == fd
No further connection requests may be pending on fd in this case, i.e. the transport user must have already used t_accept() or t_snddis() to process all connection requests previously received on fd. Otherwise, t_accept() terminates with an error and sets t_errno to TINDOUT.resfd != fd
In this case, resfd must be in the T_UNBND or T_IDLE state when t_accept() is called (see section "t_getstate() - get current state").
The user calls the call parameter to pass information that the transport provider needs for setting the connection up. call is a pointer to an object of type struct t_call.
The t_call structure is declared in <xti.h> as follows:
struct t_call { struct netbuf addr; struct netbuf opt; struct netbuf udata; int sequence; };
call->addr contains the protocol address of the transport user who sent the connection request.
call->opt shows all the options of the connection concerned. The values and syntax of these options are protocol-specific.
call->udata (Sending user data) is not supported.
call->sequence contains the value previously returned by t_listen(), which uniquely identifies the connection request pending on transport endpoint fd.
If further events are pending on the transport endpoint passed by fd (connection request or connection shutdown request), t_accept() terminates with an error and sets t_errno to TLOOK.
Return value
0:
If successful.
-1:
If an error occurs. t_ errno is set to indicate the error.
Errors
TBADF
The specified descriptor does not reference a transport endpoint.
TOUTSTATE
t_accept() was called in the wrong position within a sequence of XTI function calls for transport endpoint fd or the transport endpoint passed by resfd is not in either the T_IDLE or T_UNBND state.
TACCES
The user has no allowance to accept a connection on the replying transport endpoint or use the specified options.
TBADDATA
Sending user data is not supported.
TBADOPT
The specified options had the wrong format or contained invalid information.
TBADSEQ
An invalid sequence number was specified.
TINDOUT
The function was called with fd == resfd and further connection requests are pending for the transport endpoint passed by fd. These previously received connection requests
must first be processed with t_accept() or t_snddis().
TLOOK
An asynchronous event arrived on the transport endpoint passed by fd and this must be processed immediately.
TNOTSUPPORT
The function is not supported by the underlying transport service.
TRESQLEN
The transport endpoint passed by resfd (with resfd != fd) is assigned a protocol address for which qlen > 0 applies.
TSYSERR
A system error occurred during execution of this function.
See also
t_connect(), t_getstate(), t_listen(), t_open(), t_rcvconnect()