Content-type: text/html Man page of t_connect

t_connect

Section: C Library Functions (3)
Index Return to Main Contents
 

NAME

t_connect - Establishes a connection with another transport user  

LIBRARY

XTI Library (libxti.a)  

SYNOPSIS

#include <xti.h>

int t_connect(
   int fd,
   struct t_call *sndcall,
   struct t_call *rcvcall) ;  

STANDARDS

Interfaces documented on this reference page conform to industry standards as follows:

t_connect: XPG4-UNIX

Refer to the standards(5) reference page for more information about industry standards and associated tags.  

PARAMETERS

The following table summarizes the relevance of input and output parameters before and after t_connect() is called.

ParametersBefore CallAfter Call

fdyn
sndcall->addr.maxlennn
sndcall->addr.lenyn
sndcall->addr.bufy(y)n
sndcall->opt.maxlennn
sndcall->opt.lenyn
sndcall->opt.bufy(y)n
sndcall->udata.maxlennn
sndcall->udata.lenyn
sndcall->udata.bufo(o)n
sndcall->sequencenn
rcvcall->addr.maxlenyn
rcvcall->addr.lenny
rcvcall->addr.bufo(o)
rcvcall->opt.maxlenyn
rcvcall->opt.lenny
rcvcall->opt.bufo(o)
rcvcall->udata.maxlenyn
rcvcall->udata.lenny
rcvcall->udata.bufo(o)
rcvcall->sequencenn

Notes to table:

y    This is a meaningful parameter.
n    This is not a meaningful parameter.
o    This 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 where the connection will be established.
sndcall
Points to a type t_call structure. The t_call structure pointed to by the sndcall parameter provides information required by the transport provider to establish a connection at the transport endpoint specified by the fd parameter. The t_call structure has the following four members:
struct netbuf   addr
Specifies protocol address parameters of the destination transport user needed by the transport provider. 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 explicitly, 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 the data written to the buffer.
char   *buf
Points to the buffer location.
struct netbuf   opt
Specifies protocol-specific information needed by the transport provider.
struct netbuf   udata
Specifies user-data parameters passed to the destination transport user.
int   sequence
This parameter is not meaningful.
 
The sndcall->addr.maxlen, sndcall->opt.maxlen, and sndcall->udata.maxlen parameters have no meaning when the t_connect() function is called.
 
When options are used, the sndcall->opt.buf parameter must specify the established options structure (such as isoco_options, isocl_options or tcp_options). A transport user may choose not to negotiate protocol options by setting the sndcall->opt.len parameter to 0 (zero). When options are not specified by the transport user, the transport provider has the option of returning default option values.

 
The amount of transport user data passed to the destination transport user must not exceed the limits specified by the transport provider as returned to the info->connect parameter of the t_open() or t_getinfo() function.
 
The sndcall->opt.len and sndcall->udata.len parameters must be set before the t_connect() function is called.
rcvcall
Points to a type t_call structure. The t_call structure pointed to by the rcvcall parameter reserves storage for information associated with the connection established at the transport endpoint specified by the fd parameter. When rcvcall is a null pointer, no data is returned to the caller. The structure pointed to by rcvcall has the following members:
struct netbuf   addr
Specifies protocol address parameters associated with the responding transport endpoint.
struct netbuf   opt
Specifies protocol-specific information associated with the transport provider.
struct netbuf   udata
Specifies parameters for user data that may be optionally returned to the caller from the destination transport user.
int   sequence
This parameter is not meaningful.
 
The rcvcall->addr.maxlen, rcvcall->opt.maxlen, and rcvcall->udata.maxlen parameters must be set before the t_connect() function is called.
 
When it is provided, the rcvcall->udata.len parameter specifies the actual destination user user-data byte length and the data buffer pointed to by rcvcall->udata.buf contains destination transport user data.
 

VALID STATES

The t_connect() function can only be called in the T_IDLE transport provider state.  

DESCRIPTION

The t_connect() XTI function is a connection-oriented service function issued by a transport user to request connection to the specified destination transport user. By default, this function executes in the synchronous operating mode. In this mode, the t_connect() function waits for the destination user to respond and the connection to be set up before returning control to the transport user who called this function.

When the transport endpoint, specified by the file descriptor, has been previously opened with the O_NONBLOCK flag set in the t_open() or fcntl() function, the t_connect() function executes in asynchronous mode and does not wait for the transport user at the specified endpoint to respond before returning control to the caller, but returns a [TNODATA] error, which indicates that the connection has not yet been established. In asynchronous mode, use the t_rcvconnect() function to determine the status of a connect request.

The t_connect() function uses type t_call and netbuf structures, which are defined in the xti.h include file.  

RETURN VALUE

Upon successful completion, a value of 0 (zero) is returned. Otherwise, a value of -1 is returned and t_errno is set to indicate an error.  

ERRORS


If the t_connect() function fails, t_errno may be set to one of the following values:

[TBADF]
File descriptor fd does not refer to a valid transport endpoint.
[TOUTSTATE]
The t_connect() function was issued in the wrong sequence.
[TNODATA]
Asynchronous mode is indicated because O_NONBLOCK was set, but no data is currently available from the transport provider.
[TBADADDR]
The specified protocol address was in an incorrect format or contained illegal information.
[TBADOPT]
The specified protocol 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.

[TACCESS]
The user does not have permission to use the specified protocol address or options.
[TBUFOVFLW]
The number of bytes allocated for incoming data is not sufficient for storage of that data. In asynchronous mode only, the connect information normally returned to the rcvcall function was discarded. The transport provider state was changed to T_DATAXFER.
[TLOOK]
An asynchronous event that requires immediate attention has occurred on the transport endpoint specified by the fd parameter.
[TSYSERR]
A system error occurred during execution of this function.
[TNOTSUPPORT]
This function is not supported by the underlying transport provider.
[TADDRBUSY]
This transport provider does not provide multiple connections with the same local and remote addresses. This error indicates that a connection already exists.
[TPROTO]
This error indicates that a communication problem has been detected between XTI and the transport provider for which there is no other suitable XTI(t_errno).
 

RELATED INFORMATION

Functions: fcntl(2), t_accept(3), t_alloc(3), t_getinfo(3), t_listen(3), t_open(3), t_optmgmt(3), t_rcvconnect(3) delim off


 

Index

NAME
LIBRARY
SYNOPSIS
STANDARDS
PARAMETERS
VALID STATES
DESCRIPTION
RETURN VALUE
ERRORS
RELATED INFORMATION

This document was created by man2html, using the manual pages.
Time: 02:40:59 GMT, October 02, 2010