t_open(3xti_spx)


t_open -- establish a transport endpoint for a specified transport provider

Synopsis

#include "spx_app.h" 

int t_open ( char spxDevice, int oflag, struct t_info *spxInfo )

Parameters

(IN) spxDevice
Passes a pointer to the path of the SPXII driver.

(IN) oflag
Passes the option flags for the opened stream.

(IN) spxInfo
Passes a pointer to the t_info structure. See "Remarks" for the format of the t_info structure.

(OUT) spxInfo
Receives the SPXII protocol information as a t_info structure. See "Remarks" for the format of the t_info structure.

Return values

>0
Successful

-1
Unsuccessful
See t_open(3xti) and ``Programming with the X/Open Transport Interface (XTI)'' for other possible errors.

If the t_open is successful, the value returned is a file descriptor that identifies the local transport endpoint. This document uses the variable spxFd to refer to this value.

If t_open returns an error, t_errno may be set to one of the following.

TSYSERR
A system error has occurred during execution of this function. Check errno for possible further information.

TBADFLAG
An invalid flag was specified.

Remarks

The t_open function creates a local transport endpoint and returns protocol-specific information associated with that endpoint as well as a file descriptor that serves as the local identifier of the endpoint. Both server and client applications can use this call to open a transport endpoint.

This function works as specified in ``Programming with the X/Open Transport Interface (XTI)''. SPX/SPXII can be used either synchronously or asynchronously.

The path and name of the clonable SPXII device is /dev/nspx2 or /dev/nspx. The difference between opening nspx2 and nspx depends on the options that are allowed in other TLI calls:

A successful t_open call returns a TLI information structure. The t_info structure contains the following information about SPX/SPXII.

SPX/SPXII Information in the t_info Structure

Field Value Description
addr 12 (bytes) This is the number of bytes required for an IPX address. The address consists of three components: network address (4 bytes), node address (6 bytes), socket number (2 bytes)
tsdu -1 An unlimited amount of data can be sent during a connection
etsdu -2 Not supported
connect -2 Not supported
discon -2 Not supported
servtype T_COTS_ORD The service type for SPXII is always T_COTS_ORD. SPXII is a connection-oriented service with orderly release
(nspx) options 4 SPX supports 4 bytes of option data. For a description, see t_optmgmt(3xti_spx)
(nspx2) options 52 SPXII supports 52 bytes of option data. For a description, see t_optmgmt(3xti_spx)

 
 ------------------------------------------------------------------------------ 
| Field          |  Value          |  Description                             | 
|----------------|-----------------|------------------------------------------| 
| addr           |  12 (bytes)     |  This is the number of bytes required for| 
|                |                 |  an IPX address.  The address consists of| 
|                |                 |  three components: network address (4    | 
|                |                 |  bytes), node address (6 bytes), socket  | 
|                |                 |  number (2 bytes)                        | 
|----------------|-----------------|------------------------------------------| 
| tsdu           |  -1             |  An unlimited amount of data can be sent | 
|                |                 |  during a connection                     | 
|----------------|-----------------|------------------------------------------| 
| etsdu          |  -2             |  Not supported                           | 
|----------------|-----------------|------------------------------------------| 
| connect        |  -2             |  Not supported                           | 
|----------------|-----------------|------------------------------------------| 
| discon         |  -2             |  Not supported                           | 
|----------------|-----------------|------------------------------------------| 
| servtype       |  T_COTS_ORD     |  The service type for SPXII is always    | 
|                |                 |  T_COTS_ORD.  SPXII is a connection-     | 
|                |                 |  oriented service with orderly release   | 
|----------------|-----------------|------------------------------------------| 
| (nspx) options |   4             |  SPX supports 4 bytes of option data. For| 
|                |                 |  a description, see t_optmgmt(3xti_spx)  | 
|----------------|-----------------|------------------------------------------| 
| (nspx2) options|  52             |  SPXII supports 52 bytes of option data. | 
|                |                 |  For a description, see                  | 
|                |                 |  t_optmgmt(3xti_spx)                     | 
|----------------|-----------------|------------------------------------------| 

Example

 { 
   char   *spxDevice = "/dev/nspx2"; 
   int    spxFd; 
   struct t_info   spxInfo; 
    ... 

/* Open spxII with expanded options */ if ((spxFd = t_open(spxDevice, O_RDWR, &spxInfo)) < 0) { fprintf(stderr,"open of %s failed \n",spxDevice); t_error( "t_open failed"); exit(-1); } ... }

State

A t_open call changes the state of the service connection to T_UNBND (unbound).

References

t_bind(3xti_spx), t_close(3xti), t_open(3xti), t_optmgmt(3xti_spx)
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.