Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ t_sndudata(3) — Macintosh Execution Environment 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fcntl(2)

t_alloc(3)

t_open(3)

t_rcvudata(3)

t_rcvuderr(3)

t_sndudata(3)

NAME

t_sndudata − send a data unit

SYNOPSIS

#include <xti.h>     (for XTI)

or

#include <tiuser.h>  (for TLI)

 
int t_sndudata(fd, unitdata)
int fd;
struct t_unitdata *unitdata;

 

DESCRIPTION

This function is used in connectionless mode to send a data unit to another transport user.  The argument fd identifies the local transport endpoint through which data is sent.  The argument unitdata points to a type t_unitdata structure used to specify a data unit being sent through the transport endpoint specified by the fd parameter.  The t_unitdata structure has the following members:


struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
 

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 unitdata, addr specifies the protocol address of the destination user, opt identifies protocol-specific options that the user wants associated with this request and udata specifies the user data to be send.  The user may choose not to specify what protocol options are associated with the transfer by setting the len field of opt to zero.  In this case, the provider may use default options. 

If the len field of udata is zero, and sending of zero octets is not supported by the underlying transport service, the t_sndudata() will return -1 with t_errno set to [TBADDATA]. 

By default, t_sndudata() executes in the synchronous operating mode.  The t_sndudata() function waits for the transport provider to accept the data before returning control to the calling transport user. 

When the transport endpoint specified by the fd parameter has the O_NONBLOCK or O_NDELAY option set by t_open(3) or fcntl(2) functions, the t_sndudata() function executes in asynchronous mode.  In asynchronous mode, when a data unit is not accepted control is immediately returned to the caller.  For XTI only, the process can arrange to be notified of the clearance of a flow control restriction via either t_look(3) or the EM interface. 

If the amount of data specified in udata exceeds the TSDU size as returned in the tsdu field of the info argument of t_open(3) or t_getinfo(3), the provider will generate an [EPROTO] protocol error. (See [TSYSERR] below.)  If t_sndudata() is called before the destination user has activated its transport endpoint (see t_bind(3)), the data unit may be discarded.  For TLI only, if the transport endpoint specified by fd is in an invalid state, an [EPROTO] protocol error will be generated. (See [TSYSERR] below.) 

ERRORS

On failure, t_errno is set to one of the following:

­[TBADDATA] Illegal amount of data.  Zero octets is not supported. 

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

­[TFLOW] Asynchronous mode is indicated because O_NONBLOCK or O_NDELAY was set, but the transport provider cannot accept the data because of flow-control restrictions. 

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

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

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

­[TSYSERR] A system error occurred during execution of this function.  A protocol error may not cause the t_sndudata() function to fail until a subsequent call is made to access the transport endpoint specified by the fd parameter. 
 

RETURN VALUE

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

NOTES

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_alloc(3), t_open(3), t_rcvudata(3), t_rcvuderr(3). 
 

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

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