'\"macro stdmacro
.if n .pH g3n.t_open @(#)t_open	40.6 of 9/8/89
.nr X
.if \nX=0 .ds x} t_open 3N "Networking Support Utilities" "\&"
.if \nX=1 .ds x} t_open 3N "Networking Support Utilities"
.if \nX=2 .ds x} t_open 3N "" "\&"
.if \nX=3 .ds x} t_open "" "" "\&"
.if \nX=4 .ds x} t_open "NS_LIB" "EXTENSION" " "
.TH \*(x}
.SH NAME
\f4t_open\f1 \- establish a transport endpoint
.SH SYNOPSIS
\f4#include <tiuser.h>\f1
.PP
\f4#include <fcntl.h>\f1
.PP
\f4int t_open (char path, int oflag, struct t_info \(**info);\f1
.SH DESCRIPTION
\f4t_open\fP must be called as the first step in the initialization of a
transport endpoint.
This function establishes a transport endpoint by opening a
UNIX file that identifies a particular transport provider (i.e.,
transport protocol) and returning a file descriptor that
identifies that endpoint.
For example, opening the file \f4/dev/iso_cots\fP
identifies an
.SM OSI
connection-oriented transport layer protocol
as the transport provider.
.PP
\f4path\fP
points to the path name of the file to open, and
\f4oflag\fP
identifies any open flags [as in
\f4open\fP(2)].
\f4oflag\fP
may be constructed from \f4O_NDELAY\fP or \f4O_NONBLOCK\fP
\f4OR\c
\&\f1-ed with
\f4O_RDWR\f1.
These flags are defined in the header file
\f4<fcntl.h>\fP.
\f4t_open\fP
returns a file descriptor that will be used by all subsequent functions
to identify the particular local transport endpoint.
.PP
This function also returns various default characteristics of
the underlying transport protocol 
by setting fields in the \f4t_info\f1 structure.
This argument points to a \f4t_info\f1 which contains the following
members:
.PP
.nf
.ps-1
.ta1i
\f4long addr;\fP	/* max size of the transport protocol address */
.br
\f4long options;\fP	/* max number of bytes of protocol-specific options */
.br
\f4long tsdu;\fP	/* max size of a transport service data unit (\f4TSDU\fP) */
.br
\f4long etsdu;\fP	/* max size of an expedited transport service data unit (\f4ETSDU\fP) */
.br
\f4long connect;\fP	/* max amount of data allowed on connection establishment functions */
.br
\f4long discon;\fP	/* max amount of data allowed on \f4t_snddis\fP and \f4t_rcvdis\fP functions */
.br
\f4long servtype;\fP	/* service type supported by the transport provider */
.ps+1
.fi
.PP
The values of the fields have the following meanings:
.TP 14
\f4addr\f1
A value greater than or equal to zero indicates the maximum
size of a transport protocol address; a value of \-1 specifies
that there is no limit on the address size; and a value of -2
specifies that the transport provider does not provide user
access to transport protocol addresses.
.TP
\f4options\f1
A value greater than or equal to zero indicates the maximum
number of bytes of protocol-specific options supported by the
provider; a value of \-1 specifies that there is no limit on the
option size; and a value of \-2 specifies that the transport provider
does not support user-settable options.
.TP
\f4tsdu\f1
A value greater than zero specifies
the maximum size of a transport service
data unit (\f4TSDU\fP);
a value of zero specifies that the
transport provider does not support the concept of
\f4TSDU\fP,
although it does support the sending of a data stream with no
logical boundaries preserved across a connection;
a value of \-1 specifies that there is no limit on the size of a
\f4TSDU\fP;
and a value of \-2 specifies that the transfer of normal data is
not supported by the transport provider.
.TP
\f4etsdu\f1
A value greater than zero specifies
the maximum size of an expedited transport
service data unit (\f4ETSDU\fP);
a value of zero specifies that the
transport provider does not support the concept of \f4ETSDU\fP,
although it does support the sending of an expedited data stream with no
logical boundaries preserved across a connection;
a value of \-1 specifies that there is no limit on the size of an
\f4ETSDU\fP;
and a value of \-2 specifies that the transfer of expedited data is
not supported by the transport provider.
.TP
\f4connect\f1
A value greater than or equal to zero specifies
the maximum amount of data that may be associated with
connection establishment functions;
a value of \-1 specifies that there is no limit on the amount of data
sent during connection establishment;
and a value of \-2 specifies that the transport provider does not
allow data to be sent with connection establishment functions.
.TP
\f4discon\f1
A value greater than or equal to zero specifies
the maximum amount of data that may be associated with the
\f4t_snddis\fP and \f4t_rcvdis\fP functions;
a value of \-1 specifies that there is no limit on the amount of data
sent with these abortive release functions;
and a value of \-2 specifies that the transport provider does not
allow data to be sent with the abortive release functions.
.TP
\f4servtype\f1
This field specifies the service type supported by the transport provider,
as described below.
.LE
.PP
If a transport user is concerned with protocol independence, the above
sizes may be accessed to determine how large the buffers must be
to hold each piece of information.
Alternatively, the
\f4t_alloc\fP
function may be used to allocate these
buffers.
An error will result if a transport user exceeds the allowed
data size on any function.
.PP
The \f4servtype\fP field of \f4info\f1
may specify one of the following values on return:
.TP 14
\f4T_COTS\fP
The transport provider supports a connection-mode service but
does not support the optional orderly release facility.
.TP
\f4T_COTS_ORD\fP
The transport provider supports a connection-mode service with
the optional orderly release facility.
.TP
\f4T_CLTS\fP
The transport provider supports a connectionless-mode service.
For this service type,
\f4t_open\fP will return \-2 for \f4etsdu\fP, \f4connect\fP, and
\f4discon\fP.
.PP
A single transport endpoint may support only one of the above
services at one time.
.PP
If \f4info\fP is set to \s-NULL\s0 by the transport user, no protocol
information is returned by \f4t_open\fP.
.P
On failure, \f4t_errno\f1 may be set to the following:
.TP 20
\f4[TSYSERR]
A system error has occurred during execution of this function.
.TP 20
\f4[TBADFLAG]
An invalid flag is specified.
.SH SEE ALSO
\f4open\fP(2).
.sp .2
\f2UNIX System V Network Programmer's Guide\f1.
.SH DIAGNOSTICS
\f4t_open\fP returns a valid file descriptor on success
and \-1 on failure and \f4t_errno\f1 is set to indicate the error.
.Ee
