t_connect(3xti)t_connect(3xti)Namet_connect - establish a connection with another transport user
Syntax
#include <xti.h>
int t_connect(fd, sndcall, rcvcall)
int fd;
struct t_call *sndcall;
struct t_call *rcvcall;
Arguments
fd Identifies the local transport endpoint where communications
is established.
sndcall Specifies information needed by the transport provider to
establish a connection.
rcvcall Specifies information that is associated with the newly
established connection.
The sndcall and rcvcall point to a t_call structure that con‐
tains the following members:
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
int sequence;
Description
This function enables a transport user to request a connection to the
specified destination transport user. This function can be issued only
in the T_IDLE state.
In sndcall, the argument addr specifies the protocol address of the
destination transport user. The opt argument presents any protocol-spe‐
cific information that might be needed by the transport provider. The
udata argument points to optional user data that may be passed to the
destination transport user during connection establishment. The
sequence argument has no meaning for this function.
On return in rcvcall, addr argument returns the protocol address asso‐
ciated with the responding transport endpoint. The opt argument
presents any protocol-specific information associated with the connec‐
tion. The udata argument points to optional user data that may be
returned by the destination transport user during connection establish‐
ment. The sequence argument has no meaning for this function.
The opt argument permits users to define the options that can be passed
to the transport provider. These options are specific to the underlying
protocol of the transport provider. The user can choose not to negoti‐
ate protocol options by setting the len field of opt to zero. In this
case, the provider may use default options.
─────────────────────────────────────────────────
Parameters Before Call After Call
─────────────────────────────────────────────────
resfd x /
sndcall->addr.maxlen / /
sndcall->addr.len x /
sndcall->addr.buf x(x) /
sndcall->opt.maxlen / /
sndcall->opt.len x /
sndcall->opt.buf ?(?) /
sndcall->udata.maxlen / /
sndcall->udata.len x /
sndcall->udata.buf ?(?) /
sndcall->sequence / /
rcvcall->addr.maxlen x /
rcvcall->addr.len / x
rcvcall->addr.buf x (x)
rcvcall->opt.maxlen x /
rcvcall->opt.len / x
rcvcall->opt.buf x (x)
rcvcall->udata.maxlen x /
rcvcall->udata.len / x
rcvcall->udata.buf x (?)
rcvcall->sequence / /
─────────────────────────────────────────────────
If used, sndcall->opt.buf structure must point to the corresponding
options structures (isoco_options, isocl_options or tcp_options). The
maxlen and buf fields of the netbuf structure pointed by rcvcalladdr
and rcvcall->opt must be set before the call.
The udata argument enables the caller to pass user data to the destina‐
tion transport and receive user data from the destination user during
connection establishment. However, the amount of user data must not
exceed the limits supported by the transport provider as returned in
the connect field of the info argument of If the len of udata is zero
in sndcall, no data are sent to the destination transport user.
On return, the addr, opt, and udata fields of rcvcall updates to
reflect values associated with the connection. Thus, the maxlen field
of each argument must be set before issuing this function to indicate
the maximum size of the buffer for each. However, rcvcall can be NULL,
in which case no information is given to the user on return from
By default, executes in synchronous mode and waits for the destination
user's response before returning control to the local user. A success‐
ful return (that is, a return value of zero) indicates that the
requested connection has been established. However, if O_NONBLOCK is
set by means of or executes in asynchronous mode. In this case, the
call waits for the remote user's response but returns control immedi‐
ately to the local user and returns -1 with t_errno set to [TNODATA]
to indicate that the connection has not yet been established. In this
way, the function simply initiates the connection establishment proce‐
dure by sending a connect request to the destination transport user.
The function is used in conjunction with to determine the status of the
requested connection.
Return Values
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.
Diagnostics
On failure, t_errno is set to one of the following:
[TBADF] The specified file descriptor does not refer to a
transport endpoint.
[TOUTSTATE] The function was issued in the wrong sequence.
[TNODATA] O_NONBLOCK was set, so the function successfully
initiated the connection establishment procedure
but did not wait for a response from the remote
user.
[TACCES] The user does not have permission to use the speci‐
fied address or options.
[TBADOPT] The specified protocol options were in an incorrect
format or contained illegal information.
[TBADADDR] The specified protocol address was 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.
[TBUFOVFLW] The number of bytes allocated for an incoming argu‐
ment is not sufficient to store the value of that
argument. If executed in synchronous mode, the
provider's state, as seen by the user, changes to
T_DATAXFER, and the connect indication information
to be returned in rcvcall is discarded.
[TLOOK] An asynchronous event has occurred on this trans‐
port endpoint 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.
See Alsot_accept(3xti), t_alloc(3xti), t_getinfo(3xti), t_listen(3xti),
t_open(3xti), t_optmgmt(3xti), t_rcvconnect(3xti)t_connect(3xti)