.\" .TH t_accept 3xti .SH Name t_accept \- accept a connect request .SH Syntax .B #include .br .sp 1 .sp 1 .B int t_accept(\fIfd, resfd, call\fB) .br .B int \fIfd\fB; .br .B int \fIresfd\fB; .br .B struct t_\fIcall\fB *\fIcall\fB; .SH Arguments .IP \fIfd\fR 10 Identifies the local transport endpoint where the connect indication arrived. .IP \fIresfd\fR 10 Specifies the local transport endpoint where the connection is to be established. .IP \fIcall\fR 10 Contains information required by the transport provider to complete the connection. .IP The \fICall\fR argument points to a \fBt_call\fR structure that contains the following members: .EX struct netbuf \fIaddr\fP; struct netbuf \fIopt\fP; struct netbuf \fIudata\fP; int \fIsequence\fR; .EE .IP In \fIcall\fR, the members have the following meanings: .RS 10 .IP \fIaddr\fP 12 Specifies the address of the caller. .IP \fIopt\fP 12 Indicates any protocol-specific parameters associated with the connection. .IP \fIudata\fP 12 Points to any user data to be returned to the caller. .IP \fIsequence\fP 12 Is the value returned by .PN t_listen() that uniquely associates the response with a previously received connect indication. .RE .SH Description .NXR "t_accept system call" .NXR "transport user" "accepting connection" A transport user issues this function to accept a connect request. A transport user can 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 (\fIresfd==fd\fR), the user must have responded to any previous connect indications received on that transport endpoint by means of .PN t_accept() or .PN t_snddis()\fR.\fR Otherwise, .PN t_accept() fails and sets \fBt_errno\fR to [TBADF]. .PP If a different transport endpoint is specified (\fIresfd!=fd\fR), the endpoint must be bound to a protocol address (if it is the same, \fIqlen\fR must be set to 0) and must be in the T_IDLE state before the .PN t_accept() is issued. .PP For both types of endpoints, .PN t_accept() fails and sets \fBt_errno\fR to [TLOOK] if there are connection indications, (for example, connect or disconnect) waiting to be received on that endpoint. .PP The values of parameters specified by \fIopt\fR and the syntax of those values are protocol-specific. The \fIudata\fR argument enables the called transport user to send user data to the caller and the amount of user data must not exceed the limits supported by the transport provider as returned in the \fIconnect\fR field of the \fIinfo\fR argument of .PN t_open() or .PN t_getinfo(). If the \fIlen\fR field of \fIudata\fR is zero, no data is sent to the caller. .PP All the \fImaxlen\fR fields are meaningless. .PP .TS tab(@); lfHB lfHB lfHB lfR lfR lfR . _ .sp 4p Parameters@Before Call@After Call .sp 4p _ .sp 6p fd@x@/ resfd@x@/ call->addr.maxlen@/@/ call->addr.len@x@/ call->addr.buf@?(?)@/ call->opt.maxlen@/@/ call->opt.len@x@/ call->opt.buf@?(?)@/ call->udata.maxlen@/@/ call->udata.len@x@/ call->udata.buf@?(?)@/ call->sequence@x@/ .sp 6p _ .TE .PP .\" For example, .\" .NX R "ftp program" "options" .\" places ftp program with options as a subentry in the regular and .\" master index. .\" .\" .\" .EX means "start example" .\" .EE means "end example" .\" Check to be sure example is not too wide for the page .SH Return Values Upon successful completion, a value of 0 is returned. On failure, a value of \-1 is returned, and \fBt_errno\fR is set to indicate the error. .SH Diagnostics On failure, \fBt_errno\fR is set to one of the following: .TP 20 [TBADF] The file descriptor \fIfd\fR or \fIresfd\fR 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. .TP 20 [TOUTSTATE] The function was issued in the wrong sequence on the transport endpoint referenced by \fIfd\fR, or the transport endpoint referred to by \fIresfd\fR is not in the appropriate state. .TP 20 [TACCES] The user does not have permission to accept a connection on the responding transport endpoint or to use the specified options. .TP 20 [TBADOPT] The specified options were in an incorrect format or contained illegal information. .TP 20 [TBADDATA] The specific amount of user data was not within the bounds allowed by the transport provider. .TP 20 [TBADADDR] The specified protocol address was in an incorrect format or contained illegal information. .TP 20 [TBADSEQ] The specified sequence number was invalid. .TP 20 [TLOOK] An asynchronous event has occurred on the transport endpoint referenced by \fIfd\fR and requires immediate attention. .TP 20 [TNOTSUPPORT] This function is not supported by the underlying transport provider. .TP 20 [TSYSERR] A system error has occurred during execution of this function. .SH See Also t_connect(3xti), t_getstate(3xti), t_listen(3xti), t_open(3xti) , t_optmgmt(3xti), t_rcvconnect(3xti)