Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 | both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <xti.h>
int t_accept(int fd, int resfd, struct t_call *call);
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
int sequence;
In call, addr is
the protocol address of the calling transport user. opt indicates
any options 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() that uniquely associates the response
with a previously received connect indication. The address of the
caller, addr may be NULL (length zero). Where 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 endpoint (resfd==fd), the user must have responded to any previous connect indications received on that transport endpoint (using t_accept() or t_snddis() ). Otherwise, t_accept() fails and sets 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 the t_accept() is issued. If the endpoint is not bound before 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.
Return of user data over a connection accept is not supported under TCP, so the udata field is always 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.
Due to implementation restrictions, behavior is undefined if a different process accepts a connection pending on an endpoint than obtained it (with t_listen).
Valid states: fd: T_INCON resfd (fd!=resfd): T_IDLE
If successful, t_accept() returns 0.