|
Description
The user calls the t_open() function to set up a transport endpoint by opening a file in a UNIX system which identifies a particular transport provider (i.e. the transport protocol). The t_open() call is the first step in initializing a transport endpoint.
t_open() returns a file descriptor to a transport endpoint of this type.
The following are supported, based on the TCP/IP protocol:
/dev/tcp for opening a connection-oriented transport endpoint
/dev/udp for opening a connectionless transport endpoint
The user passes a pointer to the path name of the file to be opened, with the path parameter. oflag can be formed by inclusive bit ORing of O_NDELAY or O_NONBLOCK with O_RDWR. These options are declared in the <fcntl.h> header file.
The transport endpoint set up with t_open() is identified in subsequent XTI function calls by the file descriptor returned by t_open().
The info parameter points to an object of type struct t_info in which t_open() returns the characteristics of the underlying transport protocol.
t_open() does not return any protocol information if the null pointer is passed as the current parameter for info when t_open() is called.
The t_info structure is declared in <xti.h> as follows:
struct t_info { long addr; /* Maximum length of the transport protocol address */ long options; /* Maximum number of bytes of the protocol specification options */ long tsdu; /* Maximum size of a data packet (TSDU) */ long etsdu; /* Maximum size of an expedited data packet (ETSDU) */ long connect; /* Maximum allowed amount of data for connection setup functions */ long discon; /* Maximum allowed amount of data for t_snddis() and t_rcvdis() */ long servtype; /* Service type offered by the transport provider */ long flags; /* Other transport provider information /* };
The values of the t_info components have the following meaning:
addr
A value ≥ 0 defines the maximum length of a transport protocol address. The value -1 indicates that the address length is unlimited. The value -2 indicates that the transport provider does not support user accesses to the transport protocol address.
options
A value ≥ 0 defines the maximum length in bytes that the transport provider supports for protocol-specific options. The value -1 indicates that the length of the options is unlimited. The value
-2 indicates that the transport provider does not support options that can be influenced by the user.
tsdu
A value > 0 defines the maximum length of a transport service data unit (TSDU). The value 0 indicates that the transport provider does not support the TSDU concept although he does offer sending a data stream over the connection without maintaining logical block limits. The value -1 indicates that the length of a TSDU is unlimited. The value -2 indicates that the transport provider does not support transferring normal data.
etsdu
A value > 0 defines the maximum length of an expedited transport service data unit (ETSDU). The value 0 indicates that the transport provider does not support the ETSDU concept although he does offer sending a data stream over the connection without maintaining logical block limits. The value -1 indicates that the length of an ETSDU is unlimited. The value -2 indicates that the transport provider does not support transferring expedited data.
connect
A value ≥ 0 defines the maximum amount of data that can be sent with connection setup functions. The value -1 indicates that the amount of data that can be sent during connection setup is unlimited. The value -2 indicates that the transport provider does not support sending data with connection setup functions.
discon
A value ≥ 0 defines the maximum amount of data that can be sent with the t_snddis() and t_rcvdis() functions. The value -1 indicates that the amount of data that can be sent with connection shutdown functions is unlimited. The value -2 indicates that the transport provider does not support sending data with connection shutdown functions.
servtype
This component specifies the service type supported by the transport provider (see below).
flags
This field specifies other transport provider information (no information is currently supplied).
If the transport service user wishes to be independent of protocols, he can use the above values to determine the size of buffers required for storing the separate pieces of information. The user can also alternatively call the t_alloc() function to reserve memory for these buffers. An error occurs if a user exceeds the permissible limits with an XTI function call.
The info->servtype component contains one of the following values after t_open() is executed:
T_COTS_ORD
The transport provider supports a connection-oriented service with an optional orderly connection shutdown. t_open() returns the value -2 for etsdu, connect and discon for this service type.
T_CLTS
The transport provider supports a connectionless service. t_open() returns the value -2 for etsdu, connect and discon for this service type.
A transport endpoint can only support one of the above services at any one time.
Return value
If successful, t_open() returns a valid file descriptor.
If an error occurs, -1 is returned and t_errno is set to indicate the error.
Errors
TSYSERR
A system error occurred during execution of this function.
TBADFLAG
An invalid option was specified.
TBADNAME
The name specified in path is invalid.
TPROTO
A connection could not be set up to the transport system.