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 .sp
  63 .LP
  64 This routine is part of the \fBXTI\fR interfaces which evolved from the
  65 \fBTLI\fR interfaces. \fBXTI\fR represents the future evolution of these
  66 interfaces. However, \fBTLI\fR interfaces are supported for compatibility. When
  67 using a \fBTLI\fR routine that has the same name as an \fBXTI\fR routine, the
  68 \fBtiuser.h\fR header file must be used.  Refer to the  \fBTLI\fR
  69 \fBCOMPATIBILITY\fR section for a description of differences between the two
  70 interfaces.
  71 .sp
  72 .LP
  73 This function is used in connectionless-mode to send a data unit to another
  74 transport user. The argument \fIfd\fR identifies the local transport endpoint
  75 through which data will be sent, and \fIunitdata\fR points to a
  76 \fBt_unitdata\fR structure containing the following members:
  77 .sp
  78 .in +2
  79 .nf
  80 struct netbuf addr;
  81 struct netbuf opt;
  82 struct netbuf udata;
  83 .fi
  84 .in -2
  85 
  86 .sp
  87 .LP
  88 In \fIunitdata\fR, \fIaddr\fR specifies the protocol address of the destination
  89 user, \fIopt\fR identifies options that the user wants associated with this
  90 request, and \fIudata\fR specifies the user data to be sent. The user may
  91 choose not to specify what protocol options are associated with the transfer by
  92 setting the \fIlen\fR field of \fIopt\fR to zero. In this case, the provider
  93 uses the option values currently set for the communications endpoint.
  94 .sp
  95 .LP
  96 If the \fIlen\fR field of \fIudata\fR is zero, and sending of zero octets is
  97 not supported by the underlying transport service, the \fBt_sndudata()\fR will
  98 return  -1 with \fBt_errno\fR set to \fBTBADDATA\fR.
  99 .sp
 100 .LP
 101 By default, \fBt_sndudata()\fR operates in synchronous mode and may wait if
 102 flow control restrictions prevent the data from being accepted by the local
 103 transport provider at the time the call is made.  However, if  \fBO_NONBLOCK\fR
 104 \fBis\fR \fBset\fR \fBby\fR \fBmeans\fR \fBof\fR \fBt_open\fR(3NSL) or
 105 \fBfcntl\fR(2), \fBt_sndudata()\fR will execute in asynchronous mode and will
 106 fail under such conditions. The process can arrange to be notified of the
 107 clearance of a flow control restriction by means of either \fBt_look\fR(3NSL)
 108 or the EM interface.
 109 .sp
 110 .LP
 111 If the amount of data specified in \fIudata\fR exceeds the TSDU size as
 112 returned in the \fItsdu\fR field of the \fIinfo\fR argument of
 113 \fBt_open\fR(3NSL) or \fBt_getinfo\fR(3NSL), a \fBTBADDATA\fR error will be
 114 generated. If \fBt_sndudata()\fR is called before the destination user has
 115 activated its transport endpoint (see \fBt_bind\fR(3NSL)), the data unit may be
 116 discarded.
 117 .sp
 118 .LP
 119 If it is not possible for the transport provider to immediately detect the
 120 conditions that cause the errors \fBTBADDADDR\fR and \fBTBADOPT\fR, these
 121 errors will alternatively be returned by \fIt_rcvuderr.\fR Therefore, an
 122 application must be prepared to receive these errors in both of these ways.
 123 .sp
 124 .LP
 125 If the call is interrupted, \fBt_sndudata()\fR will return \fBEINTR\fR and the
 126 datagram will not be sent.
 127 .SH RETURN VALUES
 128 .sp
 129 .LP
 130 Upon successful completion, a value of  \fB0\fR is returned.  Otherwise, a
 131 value of  -1 is returned and \fBt_errno\fR is set to indicate an error.
 132 .SH VALID STATES
 133 .sp
 134 .LP
 135 \fBT_IDLE\fR.
 136 .SH ERRORS
 137 .sp
 138 .LP
 139 On failure, \fBt_errno\fR is set to one of the following:
 140 .sp
 141 .ne 2
 142 .na
 143 \fB\fBTBADADDR\fR\fR
 144 .ad
 145 .RS 15n
 146 The specified protocol address was in an incorrect format or contained illegal
 147 information.
 148 .RE
 149 
 150 .sp
 151 .ne 2
 152 .na
 153 \fB\fBTBADDATA\fR\fR
 154 .ad
 155 .RS 15n
 156 Illegal amount of data. A single send was attempted specifying a TSDU greater
 157 than that specified in the \fIinfo\fR argument, or a send of a zero byte TSDU
 158 is not supported by the provider.
 159 .RE
 160 
 161 .sp
 162 .ne 2
 163 .na
 164 \fB\fBTBADF\fR\fR
 165 .ad
 166 .RS 15n
 167 The specified file descriptor does not refer to a transport endpoint.
 168 .RE
 169 
 170 .sp
 171 .ne 2
 172 .na
 173 \fB\fBTBADOPT\fR\fR
 174 .ad
 175 .RS 15n
 176 The specified options were in an incorrect format or contained illegal
 177 information.
 178 .RE
 179 
 180 .sp
 181 .ne 2
 182 .na
 183 \fB\fBTFLOW\fR\fR
 184 .ad
 185 .RS 15n
 186 \fBO_NONBLOCK\fR was set, but the flow control mechanism prevented the
 187 transport provider from accepting any data at this time.
 188 .RE
 189 
 190 .sp
 191 .ne 2
 192 .na
 193 \fB\fBTLOOK\fR\fR
 194 .ad
 195 .RS 15n
 196 An asynchronous event has occurred on this transport endpoint.
 197 .RE
 198 
 199 .sp
 200 .ne 2
 201 .na
 202 \fB\fBTNOTSUPPORT\fR\fR
 203 .ad
 204 .RS 15n
 205 This function is not supported by the underlying transport provider.
 206 .RE
 207 
 208 .sp
 209 .ne 2
 210 .na
 211 \fB\fBTOUTSTATE\fR\fR
 212 .ad
 213 .RS 15n
 214 The communications endpoint referenced by  \fIfd\fR is not in one of the states
 215 in which a call to this function is valid.
 216 .RE
 217 
 218 .sp
 219 .ne 2
 220 .na
 221 \fB\fBTPROTO\fR\fR
 222 .ad
 223 .RS 15n
 224 This error indicates that a communication problem has been detected between XTI
 225 and the transport provider for which there is no other suitable XTI error
 226 \fB(t_errno)\fR.
 227 .RE
 228 
 229 .sp
 230 .ne 2
 231 .na
 232 \fB\fBTSYSERR\fR\fR
 233 .ad
 234 .RS 15n
 235 A system error has occurred during execution of this function.
 236 .RE
 237 
 238 .SH TLI COMPATIBILITY
 239 .sp
 240 .LP
 241 The \fBXTI\fR and \fBTLI\fR interface definitions have common names but use
 242 different header files. This, and other semantic differences between the two
 243 interfaces are described in the subsections below.
 244 .SS "Interface Header"
 245 .sp
 246 .LP
 247 The \fBXTI\fR interfaces use the header file, \fBxti.h.\fR \fBTLI\fR interfaces
 248 should \fInot\fR use this header.  They should use the header:
 249 .br
 250 .in +2
 251 #include <tiuser.h>
 252 .in -2
 253 .SS "Error Description Values"
 254 .sp
 255 .LP
 256 The \fBt_errno\fR values that can be set by the \fBXTI\fR interface and cannot
 257 be set by the \fBTLI\fR interface are:
 258 .br
 259 .in +2
 260 \fBTPROTO\fR
 261 .in -2
 262 .br
 263 .in +2
 264 \fBTBADADDR\fR
 265 .in -2
 266 .br
 267 .in +2
 268 \fBTBADOPT\fR
 269 .in -2
 270 .br
 271 .in +2
 272 \fBTLOOK\fR
 273 .in -2
 274 .br
 275 .in +2
 276 \fBTOUTSTATE\fR
 277 .in -2
 278 .SS "Notes"
 279 .sp
 280 .LP
 281 Whenever this function fails with \fBt_error\fR set to \fBTFLOW,\fR
 282 \fBO_NONBLOCK\fR must have been set.
 283 .SS "Option Buffers"
 284 .sp
 285 .LP
 286 The format of the options in an \fBopt\fR buffer is dictated by the transport
 287 provider. Unlike the \fBXTI\fR interface, the \fBTLI\fR interface does not fix
 288 the buffer format.
 289 .SH ATTRIBUTES
 290 .sp
 291 .LP
 292 See \fBattributes\fR(5)  for descriptions of the following attributes:
 293 .sp
 294 
 295 .sp
 296 .TS
 297 box;
 298 c | c
 299 l | l .
 300 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 301 _
 302 MT Level        Safe
 303 .TE
 304 
 305 .SH SEE ALSO
 306 .sp
 307 .LP
 308 \fBfcntl\fR(2), \fBt_alloc\fR(3NSL), \fBt_bind\fR(3NSL), \fBt_error\fR(3NSL),
 309 \fBt_getinfo\fR(3NSL), \fBt_look\fR(3NSL), \fBt_open\fR(3NSL),
 310 \fBt_rcvudata\fR(3NSL), \fBt_rcvuderr\fR(3NSL), \fBattributes\fR(5)