1 .\"
   2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
   3 .\" permission to reproduce portions of its copyrighted documentation.
   4 .\" Original documentation from The Open Group can be obtained online at
   5 .\" http://www.opengroup.org/bookstore/.
   6 .\"
   7 .\" The Institute of Electrical and Electronics Engineers and The Open
   8 .\" Group, have given us permission to reprint portions of their
   9 .\" documentation.
  10 .\"
  11 .\" In the following statement, the phrase ``this text'' refers to portions
  12 .\" of the system documentation.
  13 .\"
  14 .\" Portions of this text are reprinted and reproduced in electronic form
  15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
  16 .\" Standard for Information Technology -- Portable Operating System
  17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
  18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
  19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
  20 .\" between these versions and the original IEEE and The Open Group
  21 .\" Standard, the original IEEE and The Open Group Standard is the referee
  22 .\" document.  The original Standard can be obtained online at
  23 .\" http://www.opengroup.org/unix/online.html.
  24 .\"
  25 .\" This notice shall appear on any product containing this material.
  26 .\"
  27 .\" The contents of this file are subject to the terms of the
  28 .\" Common Development and Distribution License (the "License").
  29 .\" You may not use this file except in compliance with the License.
  30 .\"
  31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  32 .\" or http://www.opensolaris.org/os/licensing.
  33 .\" See the License for the specific language governing permissions
  34 .\" and limitations under the License.
  35 .\"
  36 .\" When distributing Covered Code, include this CDDL HEADER in each
  37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  38 .\" If applicable, add the following below this CDDL HEADER, with the
  39 .\" fields enclosed by brackets "[]" replaced with your own identifying
  40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  41 .\"
  42 .\"
  43 .\" Portions Copyright 1989 AT&T
  44 .\" Copyright 1994, The X/Open Company Ltd.  All Rights Reserved.
  45 .\" Portions Copyright (c) 1998, Sun Microsystems, Inc.  All Rights Reserved.
  46 .\"
  47 .TH T_SNDUDATA 3NSL "May 7, 1998"
  48 .SH NAME
  49 t_sndudata \- send a data unit
  50 .SH SYNOPSIS
  51 .LP
  52 .nf
  53 #include <xti.h>
  54 
  55 
  56 
  57 
  58 \fBint\fR \fBt_sndudata\fR(\fBint\fR \fIfd\fR, \fBconst struct t_unitdata *\fR\fIunitdata\fR);
  59 .fi
  60 
  61 .SH DESCRIPTION
  62 .LP
  63 This routine is part of the \fBXTI\fR interfaces which evolved from the
  64 \fBTLI\fR interfaces. \fBXTI\fR represents the future evolution of these
  65 interfaces. However, \fBTLI\fR interfaces are supported for compatibility. When
  66 using a \fBTLI\fR routine that has the same name as an \fBXTI\fR routine, the
  67 \fBtiuser.h\fR header file must be used.  Refer to the  \fBTLI\fR
  68 \fBCOMPATIBILITY\fR section for a description of differences between the two
  69 interfaces.
  70 .sp
  71 .LP
  72 This function is used in connectionless-mode to send a data unit to another
  73 transport user. The argument \fIfd\fR identifies the local transport endpoint
  74 through which data will be sent, and \fIunitdata\fR points to a
  75 \fBt_unitdata\fR structure containing the following members:
  76 .sp
  77 .in +2
  78 .nf
  79 struct netbuf addr;
  80 struct netbuf opt;
  81 struct netbuf udata;
  82 .fi
  83 .in -2
  84 
  85 .sp
  86 .LP
  87 In \fIunitdata\fR, \fIaddr\fR specifies the protocol address of the destination
  88 user, \fIopt\fR identifies options that the user wants associated with this
  89 request, and \fIudata\fR specifies the user data to be sent. The user may
  90 choose not to specify what protocol options are associated with the transfer by
  91 setting the \fIlen\fR field of \fIopt\fR to zero. In this case, the provider
  92 uses the option values currently set for the communications endpoint.
  93 .sp
  94 .LP
  95 If the \fIlen\fR field of \fIudata\fR is zero, and sending of zero octets is
  96 not supported by the underlying transport service, the \fBt_sndudata()\fR will
  97 return  -1 with \fBt_errno\fR set to \fBTBADDATA\fR.
  98 .sp
  99 .LP
 100 By default, \fBt_sndudata()\fR operates in synchronous mode and may wait if
 101 flow control restrictions prevent the data from being accepted by the local
 102 transport provider at the time the call is made.  However, if  \fBO_NONBLOCK\fR
 103 \fBis\fR \fBset\fR \fBby\fR \fBmeans\fR \fBof\fR \fBt_open\fR(3NSL) or
 104 \fBfcntl\fR(2), \fBt_sndudata()\fR will execute in asynchronous mode and will
 105 fail under such conditions. The process can arrange to be notified of the
 106 clearance of a flow control restriction by means of either \fBt_look\fR(3NSL)
 107 or the EM interface.
 108 .sp
 109 .LP
 110 If the amount of data specified in \fIudata\fR exceeds the TSDU size as
 111 returned in the \fItsdu\fR field of the \fIinfo\fR argument of
 112 \fBt_open\fR(3NSL) or \fBt_getinfo\fR(3NSL), a \fBTBADDATA\fR error will be
 113 generated. If \fBt_sndudata()\fR is called before the destination user has
 114 activated its transport endpoint (see \fBt_bind\fR(3NSL)), the data unit may be
 115 discarded.
 116 .sp
 117 .LP
 118 If it is not possible for the transport provider to immediately detect the
 119 conditions that cause the errors \fBTBADADDR\fR and \fBTBADOPT\fR, these
 120 errors will alternatively be returned by \fIt_rcvuderr.\fR Therefore, an
 121 application must be prepared to receive these errors in both of these ways.
 122 .sp
 123 .LP
 124 If the call is interrupted, \fBt_sndudata()\fR will return \fBEINTR\fR and the
 125 datagram will not be sent.
 126 .SH RETURN VALUES
 127 .LP
 128 Upon successful completion, a value of  \fB0\fR is returned.  Otherwise, a
 129 value of  -1 is returned and \fBt_errno\fR is set to indicate an error.
 130 .SH VALID STATES
 131 .LP
 132 \fBT_IDLE\fR.
 133 .SH ERRORS
 134 .LP
 135 On failure, \fBt_errno\fR is set to one of the following:
 136 .sp
 137 .ne 2
 138 .na
 139 \fB\fBTBADADDR\fR\fR
 140 .ad
 141 .RS 15n
 142 The specified protocol address was in an incorrect format or contained illegal
 143 information.
 144 .RE
 145 
 146 .sp
 147 .ne 2
 148 .na
 149 \fB\fBTBADDATA\fR\fR
 150 .ad
 151 .RS 15n
 152 Illegal amount of data. A single send was attempted specifying a TSDU greater
 153 than that specified in the \fIinfo\fR argument, or a send of a zero byte TSDU
 154 is not supported by the provider.
 155 .RE
 156 
 157 .sp
 158 .ne 2
 159 .na
 160 \fB\fBTBADF\fR\fR
 161 .ad
 162 .RS 15n
 163 The specified file descriptor does not refer to a transport endpoint.
 164 .RE
 165 
 166 .sp
 167 .ne 2
 168 .na
 169 \fB\fBTBADOPT\fR\fR
 170 .ad
 171 .RS 15n
 172 The specified options were in an incorrect format or contained illegal
 173 information.
 174 .RE
 175 
 176 .sp
 177 .ne 2
 178 .na
 179 \fB\fBTFLOW\fR\fR
 180 .ad
 181 .RS 15n
 182 \fBO_NONBLOCK\fR was set, but the flow control mechanism prevented the
 183 transport provider from accepting any data at this time.
 184 .RE
 185 
 186 .sp
 187 .ne 2
 188 .na
 189 \fB\fBTLOOK\fR\fR
 190 .ad
 191 .RS 15n
 192 An asynchronous event has occurred on this transport endpoint.
 193 .RE
 194 
 195 .sp
 196 .ne 2
 197 .na
 198 \fB\fBTNOTSUPPORT\fR\fR
 199 .ad
 200 .RS 15n
 201 This function is not supported by the underlying transport provider.
 202 .RE
 203 
 204 .sp
 205 .ne 2
 206 .na
 207 \fB\fBTOUTSTATE\fR\fR
 208 .ad
 209 .RS 15n
 210 The communications endpoint referenced by  \fIfd\fR is not in one of the states
 211 in which a call to this function is valid.
 212 .RE
 213 
 214 .sp
 215 .ne 2
 216 .na
 217 \fB\fBTPROTO\fR\fR
 218 .ad
 219 .RS 15n
 220 This error indicates that a communication problem has been detected between XTI
 221 and the transport provider for which there is no other suitable XTI error
 222 \fB(t_errno)\fR.
 223 .RE
 224 
 225 .sp
 226 .ne 2
 227 .na
 228 \fB\fBTSYSERR\fR\fR
 229 .ad
 230 .RS 15n
 231 A system error has occurred during execution of this function.
 232 .RE
 233 
 234 .SH TLI COMPATIBILITY
 235 .LP
 236 The \fBXTI\fR and \fBTLI\fR interface definitions have common names but use
 237 different header files. This, and other semantic differences between the two
 238 interfaces are described in the subsections below.
 239 .SS "Interface Header"
 240 .LP
 241 The \fBXTI\fR interfaces use the header file, \fBxti.h.\fR \fBTLI\fR interfaces
 242 should \fInot\fR use this header.  They should use the header:
 243 .br
 244 .in +2
 245 #include <tiuser.h>
 246 .in -2
 247 .SS "Error Description Values"
 248 .LP
 249 The \fBt_errno\fR values that can be set by the \fBXTI\fR interface and cannot
 250 be set by the \fBTLI\fR interface are:
 251 .br
 252 .in +2
 253 \fBTPROTO\fR
 254 .in -2
 255 .br
 256 .in +2
 257 \fBTBADADDR\fR
 258 .in -2
 259 .br
 260 .in +2
 261 \fBTBADOPT\fR
 262 .in -2
 263 .br
 264 .in +2
 265 \fBTLOOK\fR
 266 .in -2
 267 .br
 268 .in +2
 269 \fBTOUTSTATE\fR
 270 .in -2
 271 .SS "Notes"
 272 .LP
 273 Whenever this function fails with \fBt_error\fR set to \fBTFLOW,\fR
 274 \fBO_NONBLOCK\fR must have been set.
 275 .SS "Option Buffers"
 276 .LP
 277 The format of the options in an \fBopt\fR buffer is dictated by the transport
 278 provider. Unlike the \fBXTI\fR interface, the \fBTLI\fR interface does not fix
 279 the buffer format.
 280 .SH ATTRIBUTES
 281 .LP
 282 See \fBattributes\fR(5)  for descriptions of the following attributes:
 283 .sp
 284 
 285 .sp
 286 .TS
 287 box;
 288 c | c
 289 l | l .
 290 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 291 _
 292 MT Level        Safe
 293 .TE
 294 
 295 .SH SEE ALSO
 296 .LP
 297 \fBfcntl\fR(2), \fBt_alloc\fR(3NSL), \fBt_bind\fR(3NSL), \fBt_error\fR(3NSL),
 298 \fBt_getinfo\fR(3NSL), \fBt_look\fR(3NSL), \fBt_open\fR(3NSL),
 299 \fBt_rcvudata\fR(3NSL), \fBt_rcvuderr\fR(3NSL), \fBattributes\fR(5)