Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ t_sndudata(3N) — SunOS 5.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fcntl(2)

poll(2)

t_alloc(3N)

t_bind(3N)

t_connect(3N)

t_getinfo(3N)

t_look(3N)

t_open(3N)

t_rcvudata(3N)

t_rcvuderr(3N)

attributes(5)

t_sndudata(3N)

NAME

t_sndudata − send a data unit

SYNOPSIS

cc [ flag ... ] file ... −lnsl [ library ... ]

#include <xti.h>

int t_sndudata(int fd, const struct t_unitdata ∗unitdata);

DESCRIPTION

This routine is part of the XTI interfaces which evolved from the TLI interfaces.  XTI represents the future evolution of these interfaces.  However, TLI interfaces are supported for compatibility. When using a TLI routine that has the same name as an XTI routine, a different header file, tiuser.h , must be used.  Refer to the section, TLI COMPATIBILITY , for a description of differences between the two interfaces. 

This function is used in connectionless mode to send a data unit to another transport user.  fd identifies the local transport endpoint through which data will be sent, and unitdata points to a t_unitdata structure containing the following members:

struct netbufaddr;
struct netbufopt;
struct netbufudata;

netbuf is described in t_connect(3N).  In unitdata, addr specifies the protocol address of the destination user, opt identifies options that the user wants associated with this request, and udata specifies the user data to be sent.  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 uses the option values currently set for the communications endpoint. 

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

By default, t_sndudata() operates in synchronous mode and may wait if flow control restrictions prevent the data from being accepted by the local transport provider at the time the call is made.  However, if O_NONBLOCK is set using t_open(3N) or fcntl(2), t_sndudata() will execute in asynchronous mode and will fail under such conditions.  The process can arrange to be notified of the clearance of a flow control restriction using either t_look(3N) or the EM interface, possibly through poll(2). 

If t_sndudata() is issued from an invalid state, or 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() or t_getinfo(), a TBADDATA error will be generated.  If t_sndudata() is called before the destination user has activated its transport endpoint (see t_bind(3N)), the data unit may be discarded. 

If it is not possible for the transport provider to immediately detect the conditions that cause the errors TBADDADDR and TBADOPT , these errors will alternatively be returned by t_rcvuderr(3N).  Therefore, an application must be prepared to receive these errors in both of these ways. 

If the call is interrupted, t_sndudata() will return EINTR and the datagram will not be sent. 

VALID STATES

The only legitimate state (see t_getstate(3N)) for a call to this routine is T_IDLE .

RETURN VALUES

t_sndudata() returns:

  0 On success. 

−1 On failure. 

On failure, t_errno is set to indicate the error, and possibly errno is set. 

ERRORS

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

TBADADDR The specified protocol address was in an incorrect format or contained illegal information. 

TBADDATA Illegal amount of data. A single send was attempted specifying a TSDU greater than that specified in an earlier info argument (see t_open(3N) and t_connect(3N)), or a send of a zero byte TSDU is not supported by the provider. 

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

TBADOPT The specified options were in an incorrect format or contained illegal information. 

TFLOW O_NONBLOCK was set, but the flow control mechanism prevented the transport provider from accepting data at this time. 

TLOOK An asynchronous event has occurred on this transport endpoint. 

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

TOUTSTATE The communications endpoint referenced by fd or resfd is not in one of the states in which a call to this function is valid. 

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 value. 

TSYSERR A system error has occurred during execution of this function, errno will be set to the specific error. 

TLI COMPATIBILITY

The XTI and TLI interface definitions have common names but use different header files.  This, and other semantic differences between the two interfaces are described in the subsections below. 

Interface Header

The XTI interfaces use the header file, xti.h .  TLI interfaces should not use this header.  They should use the header:

#include <tiuser.h>

Error Description Values

The t_errno values that can be set by the XTI interface and cannot be set by the TLI interface are:

TPROTO

TBADADDR

TBADOPT

TLOOK

TOUTSTATE

Notes

Whenever this function fails with t_error set to TFLOW O_NONBLOCK must have been set. 

Option Buffers

The format of the options in an opt buffer is dictated by the transport provider.  Unlike the XTI interface, the TLI interface does not fix the buffer format. 

For more information refer to the Transport Interfaces Programming Guide. 

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
MT-Level MT-Safe

SEE ALSO

fcntl(2), poll(2), t_alloc(3N), t_bind(3N), t_connect(3N), t_getinfo(3N), t_look(3N), t_open(3N), t_rcvudata(3N), t_rcvuderr(3N), attributes(5)

Transport Interfaces Programming Guide

SunOS 5.6  —  Last change: 10 Feb 1997

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