xref: /freebsd/lib/libc/net/sctp_send.3 (revision 5590bacaafd8687bf522bb0413178c177c43f952)
1d8b5fd91SRandall Stewart.\" Copyright (c) 1983, 1991, 1993
2d8b5fd91SRandall Stewart.\"	The Regents of the University of California.  All rights reserved.
3d8b5fd91SRandall Stewart.\"
4d8b5fd91SRandall Stewart.\" Redistribution and use in source and binary forms, with or without
5d8b5fd91SRandall Stewart.\" modification, are permitted provided that the following conditions
6d8b5fd91SRandall Stewart.\" are met:
7d8b5fd91SRandall Stewart.\" 1. Redistributions of source code must retain the above copyright
8d8b5fd91SRandall Stewart.\"    notice, this list of conditions and the following disclaimer.
9d8b5fd91SRandall Stewart.\" 2. Redistributions in binary form must reproduce the above copyright
10d8b5fd91SRandall Stewart.\"    notice, this list of conditions and the following disclaimer in the
11d8b5fd91SRandall Stewart.\"    documentation and/or other materials provided with the distribution.
12921ca2fdSEd Maste.\" 3. Neither the name of the University nor the names of its contributors
13d8b5fd91SRandall Stewart.\"    may be used to endorse or promote products derived from this software
14d8b5fd91SRandall Stewart.\"    without specific prior written permission.
15d8b5fd91SRandall Stewart.\"
16d8b5fd91SRandall Stewart.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17d8b5fd91SRandall Stewart.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18d8b5fd91SRandall Stewart.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19d8b5fd91SRandall Stewart.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20d8b5fd91SRandall Stewart.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21d8b5fd91SRandall Stewart.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22d8b5fd91SRandall Stewart.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23d8b5fd91SRandall Stewart.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24d8b5fd91SRandall Stewart.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25d8b5fd91SRandall Stewart.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26d8b5fd91SRandall Stewart.\" SUCH DAMAGE.
27d8b5fd91SRandall Stewart.\"
28*5590bacaSLexi Winter.Dd February 2, 2024
29d8b5fd91SRandall Stewart.Dt SCTP_SEND 3
30d8b5fd91SRandall Stewart.Os
31d8b5fd91SRandall Stewart.Sh NAME
3216c90ceeSChristian Brueffer.Nm sctp_send ,
33*5590bacaSLexi Winter.Nm sctp_sendx ,
34*5590bacaSLexi Winter.Nm sctp_sendv
35d8b5fd91SRandall Stewart.Nd send a message from an SCTP socket
36d8b5fd91SRandall Stewart.Sh LIBRARY
37d8b5fd91SRandall Stewart.Lb libc
38d8b5fd91SRandall Stewart.Sh SYNOPSIS
39d8b5fd91SRandall Stewart.In sys/types.h
40d8b5fd91SRandall Stewart.In sys/socket.h
417c376800SRandall Stewart.In netinet/sctp.h
42d8b5fd91SRandall Stewart.Ft ssize_t
4316c90ceeSChristian Brueffer.Fo sctp_send
4416c90ceeSChristian Brueffer.Fa "int sd" "const void *msg" "size_t len"
4516c90ceeSChristian Brueffer.Fa "const struct sctp_sndrcvinfo *sinfo" "int flags"
4616c90ceeSChristian Brueffer.Fc
47d8b5fd91SRandall Stewart.Ft ssize_t
4816c90ceeSChristian Brueffer.Fo sctp_sendx
4916c90ceeSChristian Brueffer.Fa "int sd" "const void *msg" "size_t len" "struct sockaddr *addrs"
5016c90ceeSChristian Brueffer.Fa "int addrcnt" "const struct sctp_sndrcvinfo *sinfo" "int flags"
5116c90ceeSChristian Brueffer.Fc
52*5590bacaSLexi Winter.Ft ssize_t
53*5590bacaSLexi Winter.Fo sctp_sendv
54*5590bacaSLexi Winter.Fa "int sd" "const struct iovec *iov" "int iocnt" "struct sockaddr *addrs"
55*5590bacaSLexi Winter.Fa "int addrcnt" "void *info" "socklen_t infolen" "unsigned int infotype"
56*5590bacaSLexi Winter.Fa "int flags"
57*5590bacaSLexi Winter.Fc
58d8b5fd91SRandall Stewart.Sh DESCRIPTION
59d8b5fd91SRandall StewartThe
60d8b5fd91SRandall Stewart.Fn sctp_send
6116c90ceeSChristian Brueffersystem call
62d8b5fd91SRandall Stewartis used to transmit a message to another SCTP endpoint.
63*5590bacaSLexi WinterThe
64*5590bacaSLexi Winter.Fn sctp_sendx
65*5590bacaSLexi Winterfunction is used to specify multiple peer addresses when creating an implicit
66*5590bacaSLexi Winterassociation, as in
67*5590bacaSLexi Winter.Xr sctp_connectx 3 .
68*5590bacaSLexi WinterThe
69*5590bacaSLexi Winter.Fn sctp_sendv
70*5590bacaSLexi Winterfunction is used to transmit a message whose data is gathered from the
71*5590bacaSLexi Winterprovided I/O buffers.
72*5590bacaSLexi Winter.Pp
73d8b5fd91SRandall Stewart.Fn sctp_send
74d8b5fd91SRandall Stewartmay be used to send data to an existing association for both
75d8b5fd91SRandall Stewartone-to-many (SOCK_SEQPACKET) and one-to-one (SOCK_STREAM) socket types.
76d8b5fd91SRandall StewartThe length of the message
77d8b5fd91SRandall Stewart.Fa msg
78d8b5fd91SRandall Stewartis given by
79d8b5fd91SRandall Stewart.Fa len .
80d8b5fd91SRandall StewartIf the message is too long to pass atomically through the
8116c90ceeSChristian Bruefferunderlying protocol,
8216c90ceeSChristian Brueffer.Va errno
8316c90ceeSChristian Bruefferis set to
8416c90ceeSChristian Brueffer.Er EMSGSIZE ,
8516c90ceeSChristian Brueffer-1 is returned, and
86d8b5fd91SRandall Stewartthe message is not transmitted.
87d8b5fd91SRandall Stewart.Pp
88d8b5fd91SRandall StewartNo indication of failure to deliver is implicit in a
8944d9c281SChristian Brueffer.Fn sctp_send .
90d8b5fd91SRandall StewartLocally detected errors are indicated by a return value of -1.
91d8b5fd91SRandall Stewart.Pp
9244d9c281SChristian BruefferIf no space is available at the socket to hold
93d8b5fd91SRandall Stewartthe message to be transmitted, then
94d8b5fd91SRandall Stewart.Fn sctp_send
95d8b5fd91SRandall Stewartnormally blocks, unless the socket has been placed in
96d8b5fd91SRandall Stewartnon-blocking I/O mode.
97d8b5fd91SRandall StewartThe
9816c90ceeSChristian Brueffer.Xr select 2
99d8b5fd91SRandall Stewartsystem call may be used to determine when it is possible to
100d8b5fd91SRandall Stewartsend more data on one-to-one type (SOCK_STREAM) sockets.
101d8b5fd91SRandall Stewart.Pp
102d8b5fd91SRandall StewartThe
103d8b5fd91SRandall Stewart.Fa sinfo
104d8b5fd91SRandall Stewartstructure is used to control various SCTP features
105d8b5fd91SRandall Stewartand has the following format:
106d8b5fd91SRandall Stewart.Bd -literal
107d8b5fd91SRandall Stewartstruct sctp_sndrcvinfo {
1083d36ac98SRebecca Cran	uint16_t sinfo_stream;  /* Stream sending to */
1093d36ac98SRebecca Cran	uint16_t sinfo_ssn;     /* valid for recv only */
1103d36ac98SRebecca Cran	uint16_t sinfo_flags;   /* flags to control sending */
1113d36ac98SRebecca Cran	uint32_t sinfo_ppid;    /* ppid field */
1123d36ac98SRebecca Cran	uint32_t sinfo_context; /* context field */
1133d36ac98SRebecca Cran	uint32_t sinfo_timetolive; /* timetolive for PR-SCTP */
1143d36ac98SRebecca Cran	uint32_t sinfo_tsn;        /* valid for recv only */
1153d36ac98SRebecca Cran	uint32_t sinfo_cumtsn;     /* valid for recv only */
116d8b5fd91SRandall Stewart	sctp_assoc_t sinfo_assoc_id; /* The association id */
117d8b5fd91SRandall Stewart};
118d8b5fd91SRandall Stewart.Ed
11916c90ceeSChristian Brueffer.Pp
120d8b5fd91SRandall StewartThe
121d8b5fd91SRandall Stewart.Fa sinfo->sinfo_ppid
122d8b5fd91SRandall Stewartargument is an opaque 32 bit value that is passed transparently
123f18519e1SEnji Cooperthrough the stack to the peer endpoint.
124f18519e1SEnji CooperIt will be available on reception of a message (see
1251743ff6aSDaniel Gerzo.Xr sctp_recvmsg 3 ) .
12616c90ceeSChristian BruefferNote that the stack passes this value without regard to byte
127d8b5fd91SRandall Stewartorder.
128d8b5fd91SRandall Stewart.Pp
129d8b5fd91SRandall StewartThe
130d8b5fd91SRandall Stewart.Fa sinfo->sinfo_flags
131d8b5fd91SRandall Stewartargument may include one or more of the following:
132d8b5fd91SRandall Stewart.Bd -literal
133d8b5fd91SRandall Stewart#define SCTP_EOF 	  0x0100	/* Start a shutdown procedures */
134d8b5fd91SRandall Stewart#define SCTP_ABORT	  0x0200	/* Send an ABORT to peer */
135d8b5fd91SRandall Stewart#define SCTP_UNORDERED 	  0x0400	/* Message is un-ordered */
136d8b5fd91SRandall Stewart#define SCTP_ADDR_OVER	  0x0800	/* Override the primary-address */
137d8b5fd91SRandall Stewart#define SCTP_SENDALL      0x1000	/* Send this on all associations */
138d8b5fd91SRandall Stewart					/* for the endpoint */
139d8b5fd91SRandall Stewart/* The lower byte is an enumeration of PR-SCTP policies */
140d8b5fd91SRandall Stewart#define SCTP_PR_SCTP_TTL  0x0001	/* Time based PR-SCTP */
141d8b5fd91SRandall Stewart#define SCTP_PR_SCTP_BUF  0x0002	/* Buffer based PR-SCTP */
142d8b5fd91SRandall Stewart#define SCTP_PR_SCTP_RTX  0x0003	/* Number of retransmissions based PR-SCTP */
143d8b5fd91SRandall Stewart.Ed
144d8b5fd91SRandall Stewart.Pp
145d8b5fd91SRandall StewartThe flag
146d8b5fd91SRandall Stewart.Dv SCTP_EOF
147d8b5fd91SRandall Stewartis used to instruct the SCTP stack to queue this message
14816c90ceeSChristian Bruefferand then start a graceful shutdown of the association.
14916c90ceeSChristian BruefferAll
150d8b5fd91SRandall Stewartremaining data in queue will be sent after which the association
151d8b5fd91SRandall Stewartwill be shut down.
152d8b5fd91SRandall Stewart.Pp
153d8b5fd91SRandall Stewart.Dv SCTP_ABORT
15416c90ceeSChristian Bruefferis used to immediately terminate an association.
15516c90ceeSChristian BruefferAn abort
156d8b5fd91SRandall Stewartis sent to the peer and the local TCB is destroyed.
157d8b5fd91SRandall Stewart.Pp
158d8b5fd91SRandall Stewart.Dv SCTP_UNORDERED
159d8b5fd91SRandall Stewartis used to specify that the message being sent has no
160d8b5fd91SRandall Stewartspecific order and should be delivered to the peer application
16116c90ceeSChristian Bruefferas soon as possible.
16216c90ceeSChristian BruefferWhen this flag is absent messages
163d8b5fd91SRandall Stewartare delivered in order within the stream they are sent, but without
164d8b5fd91SRandall Stewartrespect to order to peer streams.
165d8b5fd91SRandall Stewart.Pp
166d8b5fd91SRandall StewartThe flag
167d8b5fd91SRandall Stewart.Dv SCTP_ADDR_OVER
16816c90ceeSChristian Bruefferis used to specify that a specific address should be used.
16916c90ceeSChristian BruefferNormally
17016c90ceeSChristian BruefferSCTP will use only one of a multi-homed peers addresses as the primary
17116c90ceeSChristian Bruefferaddress to send to.
17216c90ceeSChristian BruefferBy default, no matter what the
173d8b5fd91SRandall Stewart.Fa to
17416c90ceeSChristian Bruefferargument is, this primary address is used to send data.
17516c90ceeSChristian BruefferBy specifying
176d8b5fd91SRandall Stewartthis flag, the user is asking the stack to ignore the primary address
17716c90ceeSChristian Bruefferand instead use the specified address not only as a lookup mechanism
17816c90ceeSChristian Bruefferto find the association but also as the actual address to send to.
179d8b5fd91SRandall Stewart.Pp
180d8b5fd91SRandall StewartFor a one-to-many type (SOCK_SEQPACKET) socket the flag
181d8b5fd91SRandall Stewart.Dv SCTP_SENDALL
18216c90ceeSChristian Brueffercan be used as a convenient way to make one send call and have
183d8b5fd91SRandall Stewartall associations that are under the socket get a copy of the message.
184edfa427cSJoel DahlNote that this mechanism is quite efficient and makes only one actual
185d8b5fd91SRandall Stewartcopy of the data which is shared by all the associations for sending.
186d8b5fd91SRandall Stewart.Pp
18744d9c281SChristian BruefferThe remaining flags are used for the partial reliability extension (RFC3758)
188d8b5fd91SRandall Stewartand will only be effective if the peer endpoint supports this extension.
18916c90ceeSChristian BruefferThis option specifies what local policy the local endpoint should use
19016c90ceeSChristian Bruefferin skipping data.
19116c90ceeSChristian BruefferIf none of these options are set, then data is
192d8b5fd91SRandall Stewartnever skipped over.
193d8b5fd91SRandall Stewart.Pp
194d8b5fd91SRandall Stewart.Dv SCTP_PR_SCTP_TTL
19544d9c281SChristian Bruefferis used to indicate that a time based lifetime is being applied
19616c90ceeSChristian Bruefferto the data.
19716c90ceeSChristian BruefferThe
198d8b5fd91SRandall Stewart.Fa sinfo->sinfo_timetolive
199d8b5fd91SRandall Stewartargument is then a number of milliseconds for which the data is
20016c90ceeSChristian Bruefferattempted to be transmitted.
201c2025a76SJoel DahlIf that many milliseconds elapse
20216c90ceeSChristian Bruefferand the peer has not acknowledged the data, the data will be
20316c90ceeSChristian Bruefferskipped and no longer transmitted.
20416c90ceeSChristian BruefferNote that this policy does
2055512804bSRebecca Crannot even assure that the data will ever be sent.
20616c90ceeSChristian BruefferIn times of a congestion
207d8b5fd91SRandall Stewartwith large amounts of data being queued, the
208d8b5fd91SRandall Stewart.Fa sinfo->sinfo_timetolive
209d8b5fd91SRandall Stewartmay expire before the first transmission is ever made.
210d8b5fd91SRandall Stewart.Pp
211d8b5fd91SRandall StewartThe
212d8b5fd91SRandall Stewart.Dv SCTP_PR_SCTP_BUF
213d8b5fd91SRandall Stewartbased policy transforms the
214d8b5fd91SRandall Stewart.Fa sinfo->sinfo_timetolive
215d8b5fd91SRandall Stewartfield into a total number of bytes allowed on the outbound
21616c90ceeSChristian Brueffersend queue.
21716c90ceeSChristian BruefferIf that number or more bytes are in queue, then
21816c90ceeSChristian Bruefferother buffer-based sends are looked to be removed and
21944d9c281SChristian Bruefferskipped.
22044d9c281SChristian BruefferNote that this policy may also result in the data
221d8b5fd91SRandall Stewartnever being sent if no buffer based sends are in queue and
222d8b5fd91SRandall Stewartthe maximum specified by
223d8b5fd91SRandall Stewart.Fa timetolive
224d8b5fd91SRandall Stewartbytes is in queue.
225d8b5fd91SRandall Stewart.Pp
226d8b5fd91SRandall StewartThe
227d8b5fd91SRandall Stewart.Dv SCTP_PR_SCTP_RTX
228d8b5fd91SRandall Stewartpolicy transforms the
229d8b5fd91SRandall Stewart.Fa sinfo->sinfo_timetolive
23016c90ceeSChristian Bruefferinto a number of retransmissions to allow.
23116c90ceeSChristian BruefferThis policy
2325512804bSRebecca Cranalways assures that at a minimum one send attempt is
23316c90ceeSChristian Brueffermade of the data.
23416c90ceeSChristian BruefferAfter which no more than
235d8b5fd91SRandall Stewart.Fa sinfo->sinfo_timetolive
236d8b5fd91SRandall Stewartretransmissions will be made before the data is skipped.
237d8b5fd91SRandall Stewart.Pp
238d8b5fd91SRandall Stewart.Fa sinfo->sinfo_stream
239d8b5fd91SRandall Stewartis the SCTP stream that you wish to send the
24016c90ceeSChristian Brueffermessage on.
24116c90ceeSChristian BruefferStreams in SCTP are reliable (or partially reliable) flows of ordered
242d8b5fd91SRandall Stewartmessages.
243d8b5fd91SRandall Stewart.Pp
244d8b5fd91SRandall StewartThe
245d8b5fd91SRandall Stewart.Fa sinfo->sinfo_assoc_id
246d8b5fd91SRandall Stewartfield is used to
24744d9c281SChristian Bruefferselect the association to send to on a one-to-many socket.
24816c90ceeSChristian BruefferFor a one-to-one socket, this field is ignored.
249d8b5fd91SRandall Stewart.Pp
25044d9c281SChristian BruefferThe
251d8b5fd91SRandall Stewart.Fa sinfo->sinfo_context
25216c90ceeSChristian Bruefferfield is used only in the event the message cannot be sent.
25316c90ceeSChristian BruefferThis is an opaque
254d8b5fd91SRandall Stewartvalue that the stack retains and will give to the user when a failed send
255d8b5fd91SRandall Stewartis given if that notification is enabled (see
25644d9c281SChristian Brueffer.Xr sctp 4 ) .
25716c90ceeSChristian BruefferNormally a user process can use this value to index some application
258d8b5fd91SRandall Stewartspecific data structure when a send cannot be fulfilled.
259d8b5fd91SRandall Stewart.Pp
260d8b5fd91SRandall StewartThe
261d8b5fd91SRandall Stewart.Fa flags
26216c90ceeSChristian Bruefferargument holds the same meaning and values as those found in
26316c90ceeSChristian Brueffer.Xr sendmsg 2
264d8b5fd91SRandall Stewartbut is generally ignored by SCTP.
265d8b5fd91SRandall Stewart.Pp
266d8b5fd91SRandall StewartThe fields
267d8b5fd91SRandall Stewart.Fa sinfo->sinfo_ssn ,
268d8b5fd91SRandall Stewart.Fa sinfo->sinfo_tsn ,
269d8b5fd91SRandall Stewartand
270d8b5fd91SRandall Stewart.Fa sinfo->sinfo_cumtsn
271d8b5fd91SRandall Stewartare used only when receiving messages and are thus ignored by
272d8b5fd91SRandall Stewart.Fn sctp_send .
273*5590bacaSLexi Winter.Pp
274d8b5fd91SRandall StewartThe function
275d8b5fd91SRandall Stewart.Fn sctp_sendx
276d8b5fd91SRandall Stewarthas the same properties as
277d8b5fd91SRandall Stewart.Fn sctp_send
278d8b5fd91SRandall Stewartwith the additional arguments of an array of sockaddr structures
27916c90ceeSChristian Bruefferpassed in.
28016c90ceeSChristian BruefferWith the
281d8b5fd91SRandall Stewart.Fa addrs
282d8b5fd91SRandall Stewartargument being given as an array of addresses to be sent to and
283d8b5fd91SRandall Stewartthe
284d8b5fd91SRandall Stewart.Fa addrcnt
285d8b5fd91SRandall Stewartargument indicating how many socket addresses are in the passed
28616c90ceeSChristian Bruefferin array.
28716c90ceeSChristian BruefferNote that all of the addresses will only be used
28816c90ceeSChristian Bruefferwhen an implicit association is being set up.
28916c90ceeSChristian BruefferThis allows the
29044d9c281SChristian Bruefferuser the equivalent behavior as doing a
291d8b5fd91SRandall Stewart.Fn sctp_connectx
292d8b5fd91SRandall Stewartfollowed by a
293d8b5fd91SRandall Stewart.Fn sctp_send
29416c90ceeSChristian Bruefferto the association.
29516c90ceeSChristian BruefferNote that if the
296d8b5fd91SRandall Stewart.Fa sinfo->sinfo_assoc_id
297d8b5fd91SRandall Stewartfield is 0, then the first address will be used to look up
29816c90ceeSChristian Bruefferthe association in place of the association id.
29916c90ceeSChristian BruefferIf both
30016c90ceeSChristian Bruefferan address and an association id are specified, the association
301d8b5fd91SRandall Stewartid has priority.
302*5590bacaSLexi Winter.Pp
303*5590bacaSLexi WinterThe function
304*5590bacaSLexi Winter.Fn sctp_sendv
305*5590bacaSLexi Winterworks as
306*5590bacaSLexi Winter.Fn sctp_sendx ,
307*5590bacaSLexi Winterwith two differences.
308*5590bacaSLexi WinterFirstly, the data to be written is passed as an array containing
309*5590bacaSLexi Winter.Vt iocnt
310*5590bacaSLexi Winterobjects of type
311*5590bacaSLexi Winter.Vt struct iovec ,
312*5590bacaSLexi Winterwhich will be gathered for sending in the same manner as
313*5590bacaSLexi Winter.Xr writev 2 .
314*5590bacaSLexi WinterSecondly, the
315*5590bacaSLexi Winter.Fa info
316*5590bacaSLexi Winterargument is replaced by the tuple
317*5590bacaSLexi Winter.Fa sinfo ,
318*5590bacaSLexi Winter.Fa infolen ,
319*5590bacaSLexi Winter.Fa infotype ,
320*5590bacaSLexi Winterwhere
321*5590bacaSLexi Winter.Fa sinfo
322*5590bacaSLexi Winteris a pointer to a struct of size
323*5590bacaSLexi Winter.Fa infolen
324*5590bacaSLexi Winterwhose type is indicated by the
325*5590bacaSLexi Winter.Fa infotype
326*5590bacaSLexi Winterargument.
327*5590bacaSLexi Winter.Pp
328*5590bacaSLexi WinterIf no information is passed, set
329*5590bacaSLexi Winter.Fa infotype
330*5590bacaSLexi Winterto
331*5590bacaSLexi Winter.Va SCTP_SENDV_NOINFO .
332*5590bacaSLexi Winter.Fa sinfo
333*5590bacaSLexi Wintermay be a null pointer.
334*5590bacaSLexi Winter.Pp
335*5590bacaSLexi WinterIf
336*5590bacaSLexi Winter.Fa sinfo
337*5590bacaSLexi Winterpoints to a
338*5590bacaSLexi Winter.Vt struct sctp_sndinfo ,
339*5590bacaSLexi Winterset
340*5590bacaSLexi Winter.Fa infotype
341*5590bacaSLexi Winterto
342*5590bacaSLexi Winter.Va SCTP_SENDV_SNDINFO .
343*5590bacaSLexi WinterThe
344*5590bacaSLexi Winter.Vt sctp_sndinfo
345*5590bacaSLexi Winterstructure has the following format:
346*5590bacaSLexi Winter.Bd -literal
347*5590bacaSLexi Winterstruct sctp_sndinfo {
348*5590bacaSLexi Winter	uint16_t snd_sid;		/* stream identifier */
349*5590bacaSLexi Winter	uint16_t snd_flags;		/* Flags */
350*5590bacaSLexi Winter	uint32_t snd_ppid;		/* ppid field */
351*5590bacaSLexi Winter	uint32_t snd_context;		/* context field */
352*5590bacaSLexi Winter	sctp_assoc_t snd_assoc_id;	/* association id */
353*5590bacaSLexi Winter};
354*5590bacaSLexi Winter.Ed
355*5590bacaSLexi Winter.Pp
356*5590bacaSLexi WinterThe meaning of these fields is the same as in
357*5590bacaSLexi Winter.Vt struct sctp_sndrcvinfo ,
358*5590bacaSLexi Winterdescribed above.
359*5590bacaSLexi Winter.Pp
360*5590bacaSLexi WinterIf
361*5590bacaSLexi Winter.Fa sinfo
362*5590bacaSLexi Winterpoints to a
363*5590bacaSLexi Winter.Vt struct sctp_authinfo ,
364*5590bacaSLexi Winterset
365*5590bacaSLexi Winter.Fa infotype
366*5590bacaSLexi Winterto
367*5590bacaSLexi Winter.Va SCTP_SENDV_AUTHINFO .
368*5590bacaSLexi WinterThe
369*5590bacaSLexi Winter.Vt sctp_authinfo
370*5590bacaSLexi Winterstruct has the following format:
371*5590bacaSLexi Winter.Bd -literal
372*5590bacaSLexi Winterstruct sctp_authinfo {
373*5590bacaSLexi Winter	uint16_t auth_keynumber;	/* Shared key identifier */
374*5590bacaSLexi Winter};
375*5590bacaSLexi Winter.Ed
376*5590bacaSLexi Winter.Pp
377*5590bacaSLexi WinterThe
378*5590bacaSLexi Winter.Va auth_keynumber
379*5590bacaSLexi Winterfield specifies the shared key identifier that will be used for sending the
380*5590bacaSLexi Wintermessage.
381*5590bacaSLexi Winter.Pp
382*5590bacaSLexi WinterIf
383*5590bacaSLexi Winter.Fa sinfo
384*5590bacaSLexi Winterpoints to a
385*5590bacaSLexi Winter.Vt struct sctp_prinfo ,
386*5590bacaSLexi Winterset
387*5590bacaSLexi Winter.Fa infotype
388*5590bacaSLexi Winterto
389*5590bacaSLexi Winter.Va SCTP_SENDV_PRINFO .
390*5590bacaSLexi WinterThe
391*5590bacaSLexi Winter.Vt sctp_prinfo
392*5590bacaSLexi Winterstructure has the following format:
393*5590bacaSLexi Winter.Bd -literal
394*5590bacaSLexi Winterstruct sctp_prinfo {
395*5590bacaSLexi Winter	uint16_t pr_policy;	/* PR-SCTP policy */
396*5590bacaSLexi Winter	uint32_t pr_value;	/* PR-SCTP Policy option */
397*5590bacaSLexi Winter};
398*5590bacaSLexi Winter.Ed
399*5590bacaSLexi Winter.Pp
400*5590bacaSLexi WinterThe
401*5590bacaSLexi Winter.Va pr_policy
402*5590bacaSLexi Winterfield should be set to either
403*5590bacaSLexi Winter.Va SCTP_PR_SCTP_NONE
404*5590bacaSLexi Winterto use reliable transmission (in which case the field
405*5590bacaSLexi Winter.Va pr_value
406*5590bacaSLexi Winteris ignored), or
407*5590bacaSLexi Winter.Va SCTP_PR_SCTP_TTL
408*5590bacaSLexi Winterto use RFC 3758 timed reliability, in which case the field
409*5590bacaSLexi Winter.Va pr_value
410*5590bacaSLexi Wintercontains the lifetime in milliseconds.
411*5590bacaSLexi Winter.Pp
412*5590bacaSLexi WinterTo pass two or more types in
413*5590bacaSLexi Winter.Fa sinfo ,
414*5590bacaSLexi Winterset
415*5590bacaSLexi Winter.Fa infotype
416*5590bacaSLexi Winterto
417*5590bacaSLexi Winter.Va SCTP_SENDV_SPA
418*5590bacaSLexi Winterand pass a pointer to a
419*5590bacaSLexi Winter.Vt struct sctp_sendv_spa
420*5590bacaSLexi Winterin
421*5590bacaSLexi Winter.Fa sinfo .
422*5590bacaSLexi WinterThe
423*5590bacaSLexi Winter.Ft sctp_sendv_spa
424*5590bacaSLexi Winterstructure has the following format:
425*5590bacaSLexi Winter.Bd -literal
426*5590bacaSLexi Winterstruct sctp_sendv_spa {
427*5590bacaSLexi Winter	uint32_t sendv_flags;
428*5590bacaSLexi Winter	struct sctp_sndinfo sendv_sndinfo;
429*5590bacaSLexi Winter	struct sctp_prinfo sendv_prinfo;
430*5590bacaSLexi Winter	struct sctp_authinfo sendv_authinfo;
431*5590bacaSLexi Winter};
432*5590bacaSLexi Winter.Ed
433*5590bacaSLexi Winter.Pp
434*5590bacaSLexi WinterThe
435*5590bacaSLexi Winter.Va sendv_flags
436*5590bacaSLexi Wintermember should be set to the bitwise OR of the flags
437*5590bacaSLexi Winter.Va SCTP_SEND_SNDINFO_VALID ,
438*5590bacaSLexi Winter.Va SCTP_SEND_PRINFO_VALID ,
439*5590bacaSLexi Winterand
440*5590bacaSLexi Winter.Va SCTP_SEND_AUTHINFO_VALID
441*5590bacaSLexi Winterto indicate which fields of the struct contain valid data.
442*5590bacaSLexi Winter.Pp
443*5590bacaSLexi WinterIf
444*5590bacaSLexi Winter.Fa infotype
445*5590bacaSLexi Winteris set to SCTP_SENDV_NOINFO, the
446*5590bacaSLexi Winter.Fa infolen
447*5590bacaSLexi Winterargument should be set to zero.
448*5590bacaSLexi WinterOtherwise,
449*5590bacaSLexi Winter.Fa infolen
450*5590bacaSLexi Wintershould be set to the length of the data structure pointed to by
451*5590bacaSLexi Winter.Fa info .
452d8b5fd91SRandall Stewart.Sh RETURN VALUES
453d8b5fd91SRandall StewartThe call returns the number of characters sent, or -1
454d8b5fd91SRandall Stewartif an error occurred.
455d8b5fd91SRandall Stewart.Sh ERRORS
456d8b5fd91SRandall StewartThe
457d8b5fd91SRandall Stewart.Fn sctp_send
458d8b5fd91SRandall Stewartsystem call
459a47698f8SChristian Bruefferfails if:
460d8b5fd91SRandall Stewart.Bl -tag -width Er
461d8b5fd91SRandall Stewart.It Bq Er EBADF
462d8b5fd91SRandall StewartAn invalid descriptor was specified.
463d8b5fd91SRandall Stewart.It Bq Er ENOTSOCK
464d8b5fd91SRandall StewartThe argument
465d8b5fd91SRandall Stewart.Fa s
466d8b5fd91SRandall Stewartis not a socket.
467d8b5fd91SRandall Stewart.It Bq Er EFAULT
468d8b5fd91SRandall StewartAn invalid user space address was specified for an argument.
469d8b5fd91SRandall Stewart.It Bq Er EMSGSIZE
470d8b5fd91SRandall StewartThe socket requires that message be sent atomically,
471d8b5fd91SRandall Stewartand the size of the message to be sent made this impossible.
472d8b5fd91SRandall Stewart.It Bq Er EAGAIN
473d8b5fd91SRandall StewartThe socket is marked non-blocking and the requested operation
474d8b5fd91SRandall Stewartwould block.
475d8b5fd91SRandall Stewart.It Bq Er ENOBUFS
476d8b5fd91SRandall StewartThe system was unable to allocate an internal buffer.
477d8b5fd91SRandall StewartThe operation may succeed when buffers become available.
478d8b5fd91SRandall Stewart.It Bq Er ENOBUFS
479d8b5fd91SRandall StewartThe output queue for a network interface was full.
480d8b5fd91SRandall StewartThis generally indicates that the interface has stopped sending,
481d8b5fd91SRandall Stewartbut may be caused by transient congestion.
482d8b5fd91SRandall Stewart.It Bq Er EHOSTUNREACH
483d8b5fd91SRandall StewartThe remote host was unreachable.
4840add3200SRebecca Cran.It Bq Er ENOTCONN
48516c90ceeSChristian BruefferOn a one-to-one style socket no association exists.
486d8b5fd91SRandall Stewart.It Bq Er ECONNRESET
487d8b5fd91SRandall StewartAn abort was received by the stack while the user was
488d8b5fd91SRandall Stewartattempting to send data to the peer.
489d8b5fd91SRandall Stewart.It Bq Er ENOENT
49016c90ceeSChristian BruefferOn a one-to-many style socket no address is specified
491d8b5fd91SRandall Stewartso that the association cannot be located or the
492d8b5fd91SRandall StewartSCTP_ABORT flag was specified on a non-existing association.
493d8b5fd91SRandall Stewart.It Bq Er EPIPE
494d8b5fd91SRandall StewartThe socket is unable to send anymore data
495d8b5fd91SRandall Stewart.Dv ( SBS_CANTSENDMORE
496d8b5fd91SRandall Stewarthas been set on the socket).
497d8b5fd91SRandall StewartThis typically means that the socket
498d8b5fd91SRandall Stewartis not connected and is a one-to-one style socket.
499d8b5fd91SRandall Stewart.El
500*5590bacaSLexi Winter.Sh NOTES
501*5590bacaSLexi WinterThe functions
502*5590bacaSLexi Winter.Fn sctp_send
503*5590bacaSLexi Winterand
504*5590bacaSLexi Winter.Fn sctp_sendx
505*5590bacaSLexi Winterare deprecated.
506*5590bacaSLexi WinterNew applications should use
507*5590bacaSLexi Winter.Fn sctp_sendv .
508d8b5fd91SRandall Stewart.Sh SEE ALSO
509d8b5fd91SRandall Stewart.Xr getsockopt 2 ,
510d8b5fd91SRandall Stewart.Xr recv 2 ,
511d8b5fd91SRandall Stewart.Xr select 2 ,
51216c90ceeSChristian Brueffer.Xr sendmsg 2 ,
513d8b5fd91SRandall Stewart.Xr socket 2 ,
5140aee91e1SChristian Brueffer.Xr write 2 ,
51516c90ceeSChristian Brueffer.Xr sctp_connectx 3 ,
51616c90ceeSChristian Brueffer.Xr sctp_recvmsg 3 ,
51716c90ceeSChristian Brueffer.Xr sctp_sendmsg 3 ,
51816c90ceeSChristian Brueffer.Xr sctp 4
519*5590bacaSLexi Winter.Rs
520*5590bacaSLexi Winter.%A R. Stewart
521*5590bacaSLexi Winter.%A M. Tuexen
522*5590bacaSLexi Winter.%A K. Poon
523*5590bacaSLexi Winter.%A P. Lei
524*5590bacaSLexi Winter.%A V. Yasevich
525*5590bacaSLexi Winter.%T Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)
526*5590bacaSLexi Winter.%R RFC 6458
527*5590bacaSLexi Winter.%D December 2011
528*5590bacaSLexi Winter.Re
529*5590bacaSLexi Winter.Sh STANDARDS
530*5590bacaSLexi WinterThe functions described in this document conform to RFC 6458.
531d8b5fd91SRandall Stewart.Sh BUGS
532d8b5fd91SRandall StewartBecause
533d8b5fd91SRandall Stewart.Fn sctp_send
534d8b5fd91SRandall Stewartmay have multiple associations under one endpoint, a
535d8b5fd91SRandall Stewartselect on write will only work for a one-to-one style
536d8b5fd91SRandall Stewartsocket.
537