Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ t_listen(3) — Macintosh Execution Environment 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fcntl(2)

t_accept(3)

t_alloc(3)

t_bind(3)

t_connect(3)

t_open(3)

t_snddis(3)

t_rcvconnect(3)

t_listen(3)

NAME

t_listen − listen for a connect request

SYNOPSIS

#include <xti.h>     (for XTI)

or

#include <tiuser.h>  (for TLI)

 
int t_listen (fd, call)
int fd;
struct t_call *call;

 

DESCRIPTION

This function listens for a connect request from a calling transport user.  fd identifies the local transport endpoint where connect indications arrive, and on return, call contains information describing the connect indication.  The parameter call points to a t_call structure which contains the following members:

 struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
int sequence;
 

The type netbuf structure is defined in the <xti.h> or <tiuser.h> header file.  This structure, which is used to define buffer parameters, has the following members:

­unsigned int maxlen maximum byte length of the data buffer

­unsigned int len actual byte length of data written to buffer

­char *buf points to buffer location

In call, addr returns the protocol address of the calling transport user. 

opt returns protocol-specific parameters associated with the connect request.  For XTI over the OSI transport provider, struct isoco_options should be used.  For TLI, see the documentation for the transport provider being used. 

udata returns any user data sent by the caller on the connect request. 

sequence is a number that uniquely identifies the returned connect indication.  The value of sequence enables the user to listen for multiple connect indications before responding to any of them. 

Since this function returns values for the addr, opt, and udata fields of call, the maxlen field of each must be set before issuing the t_listen to indicate the maximum size of the buffer for each. 

By default, t_listen executes in synchronous mode and waits for a connect indication to arrive before returning to the user.  However, if O_NONBLOCK or O_NDELAY is set [via t_open (3) or fcntl (2)], t_listen executes asynchronously, reducing to a poll for existing connect indications.  If none are available, it returns -1 and sets t_errno to [TNODATA]. 
 

ERRORS

On failure, t_errno is set to the following:

­[TBADF] The specified identifier does not refer to a transport endpoint. 

­[TBADQLEN] (XTI only) The argument qlen of the endpoint referenced by fd is zero. 

­[TBUFOVFLW] The number of bytes allocated for an incoming argument is not sufficient to store the value of that argument.  The provider’s state, as seen by the user, changes to T_INCON, and the connect indication information to be returned in call is discarded.  For XTI only, the value of sequence returned can be used to do a t_snddis(). 

­[TNODATA] O_NONBLOCK or O_NDELAY was set, but no connect indications has been queued. 

­[TLOOK] An asynchronous event has occurred on this transport endpoint and requires immediate attention. 

­[TOUTSTATE] (XTI only) This function was issued in the wrong sequence on the transport endpoint referenced by fd. 

­[TSYSERR] A system error has occurred during execution of this function. 

­[TNOTSUPPORT] This function is not supported by the underlying transport provider. 

RETURN VALUE

Upon successful completion, a value of 0 is returned  Otherwise, a value of -1 it returned and t_errno is set to indicate the error. 
 

FILES

For more information on data structures refer to /usr/include/xti.h and /usr/include/xti_iso.h for XTI, or /usr/include/tiuser.h for TLI. 
 

NOTE

For portability purposes, it is recommended that O_NONBLOCK be used instead of O_NDELAY. 

In HP-UX 9.0, XTI (X/Open Transport Interface) supports only OSI as a transport provider, and is available only as part of the OSI Transport Services 9000 product. Users of this product can access XTI versions of the t_* routines by linking with /usr/lib/libxti.a.  For more information on XTI, see "HP-UX/9000 XTI Programmer’s Guide". 

In HP-UX 9.0, TLI (Transport Layer Interface) supports any transport provider which is compliant with TPI (Transport Provider Interface).  TLI is available only as part of the STREAMS product.  Users of this product can access TLI versions of the t_* routines by linking with /usr/lib/libnsl_s.a.  For more information on TLI, see the TLI section of "STREAMS/UX for HP 9000 Reference Manual". 

SEE ALSO

fcntl(2), t_accept(3), t_alloc(3), t_bind(3), t_connect(3), t_open(3), t_snddis(3), t_rcvconnect(3). 

Hewlett-Packard Company  —  HP-UX Release 9.0: October 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026