1 T_SNDUDATA(3NSL) Networking Services Library Functions T_SNDUDATA(3NSL) 2 3 4 5 NAME 6 t_sndudata - send a data unit 7 8 SYNOPSIS 9 #include <xti.h> 10 11 12 13 14 int t_sndudata(int fd, const struct t_unitdata *unitdata); 15 16 17 DESCRIPTION 18 This routine is part of the XTI interfaces which evolved from the TLI 19 interfaces. XTI represents the future evolution of these interfaces. 20 However, TLI interfaces are supported for compatibility. When using a 21 TLI routine that has the same name as an XTI routine, the tiuser.h 22 header file must be used. Refer to the TLI COMPATIBILITY section for 23 a description of differences between the two interfaces. 24 25 26 This function is used in connectionless-mode to send a data unit to 27 another transport user. The argument fd identifies the local transport 28 endpoint through which data will be sent, and unitdata points to a 29 t_unitdata structure containing the following members: 30 31 struct netbuf addr; 32 struct netbuf opt; 33 struct netbuf udata; 34 35 36 37 In unitdata, addr specifies the protocol address of the destination 38 user, opt identifies options that the user wants associated with this 39 request, and udata specifies the user data to be sent. The user may 40 choose not to specify what protocol options are associated with the 41 transfer by setting the len field of opt to zero. In this case, the 42 provider uses the option values currently set for the communications 43 endpoint. 44 45 46 If the len field of udata is zero, and sending of zero octets is not 47 supported by the underlying transport service, the t_sndudata() will 48 return -1 with t_errno set to TBADDATA. 49 50 51 By default, t_sndudata() operates in synchronous mode and may wait if 52 flow control restrictions prevent the data from being accepted by the 53 local transport provider at the time the call is made. However, if 54 O_NONBLOCK is set by means of t_open(3NSL) or fcntl(2), t_sndudata() 55 will execute in asynchronous mode and will fail under such conditions. 56 The process can arrange to be notified of the clearance of a flow 57 control restriction by means of either t_look(3NSL) or the EM 58 interface. 59 60 61 If the amount of data specified in udata exceeds the TSDU size as 62 returned in the tsdu field of the info argument of t_open(3NSL) or 63 t_getinfo(3NSL), a TBADDATA error will be generated. If t_sndudata() is 64 called before the destination user has activated its transport endpoint 65 (see t_bind(3NSL)), the data unit may be discarded. 66 67 68 If it is not possible for the transport provider to immediately detect 69 the conditions that cause the errors TBADADDR and TBADOPT, these errors 70 will alternatively be returned by t_rcvuderr. Therefore, an application 71 must be prepared to receive these errors in both of these ways. 72 73 74 If the call is interrupted, t_sndudata() will return EINTR and the 75 datagram will not be sent. 76 77 RETURN VALUES 78 Upon successful completion, a value of 0 is returned. Otherwise, a 79 value of -1 is returned and t_errno is set to indicate an error. 80 81 VALID STATES 82 T_IDLE. 83 84 ERRORS 85 On failure, t_errno is set to one of the following: 86 87 TBADADDR 88 The specified protocol address was in an incorrect 89 format or contained illegal information. 90 91 92 TBADDATA 93 Illegal amount of data. A single send was attempted 94 specifying a TSDU greater than that specified in the 95 info argument, or a send of a zero byte TSDU is not 96 supported by the provider. 97 98 99 TBADF 100 The specified file descriptor does not refer to a 101 transport endpoint. 102 103 104 TBADOPT 105 The specified options were in an incorrect format or 106 contained illegal information. 107 108 109 TFLOW 110 O_NONBLOCK was set, but the flow control mechanism 111 prevented the transport provider from accepting any data 112 at this time. 113 114 115 TLOOK 116 An asynchronous event has occurred on this transport 117 endpoint. 118 119 120 TNOTSUPPORT 121 This function is not supported by the underlying 122 transport provider. 123 124 125 TOUTSTATE 126 The communications endpoint referenced by fd is not in 127 one of the states in which a call to this function is 128 valid. 129 130 131 TPROTO 132 This error indicates that a communication problem has 133 been detected between XTI and the transport provider for 134 which there is no other suitable XTI error (t_errno). 135 136 137 TSYSERR 138 A system error has occurred during execution of this 139 function. 140 141 142 TLI COMPATIBILITY 143 The XTI and TLI interface definitions have common names but use 144 different header files. This, and other semantic differences between 145 the two interfaces are described in the subsections below. 146 147 Interface Header 148 The XTI interfaces use the header file, xti.h. TLI interfaces should 149 not use this header. They should use the header: 150 #include <tiuser.h> 151 152 Error Description Values 153 The t_errno values that can be set by the XTI interface and cannot be 154 set by the TLI interface are: 155 TPROTO 156 TBADADDR 157 TBADOPT 158 TLOOK 159 TOUTSTATE 160 161 Notes 162 Whenever this function fails with t_error set to TFLOW, O_NONBLOCK must 163 have been set. 164 165 Option Buffers 166 The format of the options in an opt buffer is dictated by the transport 167 provider. Unlike the XTI interface, the TLI interface does not fix the 168 buffer format. 169 170 ATTRIBUTES 171 See attributes(5) for descriptions of the following attributes: 172 173 174 175 176 +---------------+-----------------+ 177 |ATTRIBUTE TYPE | ATTRIBUTE VALUE | 178 +---------------+-----------------+ 179 |MT Level | Safe | 180 +---------------+-----------------+ 181 182 SEE ALSO 183 fcntl(2), t_alloc(3NSL), t_bind(3NSL), t_error(3NSL), t_getinfo(3NSL), 184 t_look(3NSL), t_open(3NSL), t_rcvudata(3NSL), t_rcvuderr(3NSL), 185 attributes(5) 186 187 188 189 May 7, 1998 T_SNDUDATA(3NSL)