t_open() — Establish a transport endpoint
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 | both |
Format
#define _XOPEN_SOURCE_EXTENDED 1
#include <xti.h>
int t_open(char *name, int oflag, struct t_info *info);
General description
The argument name points to a transport provider identifier. The only supported transport provider is "/dev/tcp", indicating a TCP transport provider. No device by that name actually exists in the file system. It is purely used to follow historical convention. The argument oflag identifies any open flags (as in open() ). It is constructed from O_RDWR optionally bitwise inclusive-OR'ed with O_NONBLOCK. These flags are defined by the header <fcntl.h>. The file descriptor returned by t_open() will be used by all subsequent functions to identify the particular local transport endpoint.
long addr; /* max size of the transport protocol address */
long options; /* max number of bytes of */
/* protocol-specific options */
long tsdu; /* max size of a transport service data */
/* unit (TSDU) */
long etsdu; /* max size of an expedited transport */
/* service data unit (ETSDU) */
long connect; /* max amount of data allowed on */
/* connection establishment functions */
long discon; /* max amount of data allowed on */
/* t_snddis() and t_rcvdis() functions */
long servtype; /* service type supported by the */
/* transport provider */
long flags; /* other info about the transport provider */
- addr
- The size of a struct sockaddr_in is returned.
- options
- The value 304, which is the maximum number of bytes of options which can possibly be specified or requested, is returned.
- tsdu
- Zero is returned, indicating that the TCP transport provider does not support the concept of TSDUs.
- etsdu
- A value of -1 is returned, indicating that there is no limit on the size of an ETSDU.
- connect
- A value of -2 is returned, indicating that the TCP transport provider does not allow data to be sent with connection establishment functions.
- discon
- A value of -2 is returned, indicating that the transport provider does not allow data to be sent with the abortive release functions.
- servtype
- T_COTS is always returned, since this is the only service type supported.
- flags
- The T_SENDZERO bit is always set in this field, indicating that the TCP transport provider supports the sending of zero-length TSDUs.
If info is set to a NULL pointer by the transport user, no protocol information is returned by t_open().
Valid states: T_UNINIT
Returned value
If successful, t_open() returns a valid file descriptor.
- Error Code
- Description
- TBADFLAG
- An invalid flag is specified.
- TBADNAME
- Invalid transport provider name.
- 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).
- TSYSERR
- A system error has occurred during execution of this function.