sctp_send.3 (212463) | sctp_send.3 (233648) |
---|---|
1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 15 unchanged lines hidden (view full) --- 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" | 1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 15 unchanged lines hidden (view full) --- 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" |
32.\" $FreeBSD: head/lib/libc/net/sctp_send.3 212463 2010-09-11 10:49:56Z brucec $ | 32.\" $FreeBSD: head/lib/libc/net/sctp_send.3 233648 2012-03-29 05:02:12Z eadler $ |
33.\" 34.Dd December 15, 2006 35.Dt SCTP_SEND 3 36.Os 37.Sh NAME 38.Nm sctp_send , 39.Nm sctp_sendx 40.Nd send a message from an SCTP socket --- 16 unchanged lines hidden (view full) --- 57.Sh DESCRIPTION 58The 59.Fn sctp_send 60system call 61is used to transmit a message to another SCTP endpoint. 62.Fn sctp_send 63may be used to send data to an existing association for both 64one-to-many (SOCK_SEQPACKET) and one-to-one (SOCK_STREAM) socket types. | 33.\" 34.Dd December 15, 2006 35.Dt SCTP_SEND 3 36.Os 37.Sh NAME 38.Nm sctp_send , 39.Nm sctp_sendx 40.Nd send a message from an SCTP socket --- 16 unchanged lines hidden (view full) --- 57.Sh DESCRIPTION 58The 59.Fn sctp_send 60system call 61is used to transmit a message to another SCTP endpoint. 62.Fn sctp_send 63may be used to send data to an existing association for both 64one-to-many (SOCK_SEQPACKET) and one-to-one (SOCK_STREAM) socket types. |
65The length of the message | 65The length of the message |
66.Fa msg 67is given by 68.Fa len . 69If the message is too long to pass atomically through the 70underlying protocol, 71.Va errno | 66.Fa msg 67is given by 68.Fa len . 69If the message is too long to pass atomically through the 70underlying protocol, 71.Va errno |
72is set to | 72is set to |
73.Er EMSGSIZE , 74-1 is returned, and 75the message is not transmitted. 76.Pp 77No indication of failure to deliver is implicit in a 78.Fn sctp_send . 79Locally detected errors are indicated by a return value of -1. 80.Pp 81If no space is available at the socket to hold 82the message to be transmitted, then 83.Fn sctp_send 84normally blocks, unless the socket has been placed in 85non-blocking I/O mode. 86The 87.Xr select 2 88system call may be used to determine when it is possible to 89send more data on one-to-one type (SOCK_STREAM) sockets. 90.Pp | 73.Er EMSGSIZE , 74-1 is returned, and 75the message is not transmitted. 76.Pp 77No indication of failure to deliver is implicit in a 78.Fn sctp_send . 79Locally detected errors are indicated by a return value of -1. 80.Pp 81If no space is available at the socket to hold 82the message to be transmitted, then 83.Fn sctp_send 84normally blocks, unless the socket has been placed in 85non-blocking I/O mode. 86The 87.Xr select 2 88system call may be used to determine when it is possible to 89send more data on one-to-one type (SOCK_STREAM) sockets. 90.Pp |
91The | 91The |
92.Fa sinfo 93structure is used to control various SCTP features 94and has the following format: 95.Bd -literal 96struct sctp_sndrcvinfo { 97 uint16_t sinfo_stream; /* Stream sending to */ 98 uint16_t sinfo_ssn; /* valid for recv only */ 99 uint16_t sinfo_flags; /* flags to control sending */ 100 uint32_t sinfo_ppid; /* ppid field */ 101 uint32_t sinfo_context; /* context field */ 102 uint32_t sinfo_timetolive; /* timetolive for PR-SCTP */ 103 uint32_t sinfo_tsn; /* valid for recv only */ 104 uint32_t sinfo_cumtsn; /* valid for recv only */ 105 sctp_assoc_t sinfo_assoc_id; /* The association id */ 106}; 107.Ed 108.Pp | 92.Fa sinfo 93structure is used to control various SCTP features 94and has the following format: 95.Bd -literal 96struct sctp_sndrcvinfo { 97 uint16_t sinfo_stream; /* Stream sending to */ 98 uint16_t sinfo_ssn; /* valid for recv only */ 99 uint16_t sinfo_flags; /* flags to control sending */ 100 uint32_t sinfo_ppid; /* ppid field */ 101 uint32_t sinfo_context; /* context field */ 102 uint32_t sinfo_timetolive; /* timetolive for PR-SCTP */ 103 uint32_t sinfo_tsn; /* valid for recv only */ 104 uint32_t sinfo_cumtsn; /* valid for recv only */ 105 sctp_assoc_t sinfo_assoc_id; /* The association id */ 106}; 107.Ed 108.Pp |
109The | 109The |
110.Fa sinfo->sinfo_ppid 111argument is an opaque 32 bit value that is passed transparently 112through the stack to the peer endpoint. It will be available on 113reception of a message (see 114.Xr sctp_recvmsg 3 ) . 115Note that the stack passes this value without regard to byte 116order. 117.Pp --- 8 unchanged lines hidden (view full) --- 126#define SCTP_SENDALL 0x1000 /* Send this on all associations */ 127 /* for the endpoint */ 128/* The lower byte is an enumeration of PR-SCTP policies */ 129#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ 130#define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ 131#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ 132.Ed 133.Pp | 110.Fa sinfo->sinfo_ppid 111argument is an opaque 32 bit value that is passed transparently 112through the stack to the peer endpoint. It will be available on 113reception of a message (see 114.Xr sctp_recvmsg 3 ) . 115Note that the stack passes this value without regard to byte 116order. 117.Pp --- 8 unchanged lines hidden (view full) --- 126#define SCTP_SENDALL 0x1000 /* Send this on all associations */ 127 /* for the endpoint */ 128/* The lower byte is an enumeration of PR-SCTP policies */ 129#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ 130#define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ 131#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ 132.Ed 133.Pp |
134The flag | 134The flag |
135.Dv SCTP_EOF 136is used to instruct the SCTP stack to queue this message 137and then start a graceful shutdown of the association. 138All 139remaining data in queue will be sent after which the association 140will be shut down. 141.Pp 142.Dv SCTP_ABORT --- 10 unchanged lines hidden (view full) --- 153respect to order to peer streams. 154.Pp 155The flag 156.Dv SCTP_ADDR_OVER 157is used to specify that a specific address should be used. 158Normally 159SCTP will use only one of a multi-homed peers addresses as the primary 160address to send to. | 135.Dv SCTP_EOF 136is used to instruct the SCTP stack to queue this message 137and then start a graceful shutdown of the association. 138All 139remaining data in queue will be sent after which the association 140will be shut down. 141.Pp 142.Dv SCTP_ABORT --- 10 unchanged lines hidden (view full) --- 153respect to order to peer streams. 154.Pp 155The flag 156.Dv SCTP_ADDR_OVER 157is used to specify that a specific address should be used. 158Normally 159SCTP will use only one of a multi-homed peers addresses as the primary 160address to send to. |
161By default, no matter what the | 161By default, no matter what the |
162.Fa to 163argument is, this primary address is used to send data. 164By specifying 165this flag, the user is asking the stack to ignore the primary address 166and instead use the specified address not only as a lookup mechanism 167to find the association but also as the actual address to send to. 168.Pp 169For a one-to-many type (SOCK_SEQPACKET) socket the flag --- 18 unchanged lines hidden (view full) --- 188argument is then a number of milliseconds for which the data is 189attempted to be transmitted. 190If that many milliseconds elapse 191and the peer has not acknowledged the data, the data will be 192skipped and no longer transmitted. 193Note that this policy does 194not even assure that the data will ever be sent. 195In times of a congestion | 162.Fa to 163argument is, this primary address is used to send data. 164By specifying 165this flag, the user is asking the stack to ignore the primary address 166and instead use the specified address not only as a lookup mechanism 167to find the association but also as the actual address to send to. 168.Pp 169For a one-to-many type (SOCK_SEQPACKET) socket the flag --- 18 unchanged lines hidden (view full) --- 188argument is then a number of milliseconds for which the data is 189attempted to be transmitted. 190If that many milliseconds elapse 191and the peer has not acknowledged the data, the data will be 192skipped and no longer transmitted. 193Note that this policy does 194not even assure that the data will ever be sent. 195In times of a congestion |
196with large amounts of data being queued, the | 196with large amounts of data being queued, the |
197.Fa sinfo->sinfo_timetolive 198may expire before the first transmission is ever made. 199.Pp 200The 201.Dv SCTP_PR_SCTP_BUF 202based policy transforms the | 197.Fa sinfo->sinfo_timetolive 198may expire before the first transmission is ever made. 199.Pp 200The 201.Dv SCTP_PR_SCTP_BUF 202based policy transforms the |
203.Fa sinfo->sinfo_timetolive | 203.Fa sinfo->sinfo_timetolive |
204field into a total number of bytes allowed on the outbound 205send queue. 206If that number or more bytes are in queue, then 207other buffer-based sends are looked to be removed and 208skipped. 209Note that this policy may also result in the data 210never being sent if no buffer based sends are in queue and | 204field into a total number of bytes allowed on the outbound 205send queue. 206If that number or more bytes are in queue, then 207other buffer-based sends are looked to be removed and 208skipped. 209Note that this policy may also result in the data 210never being sent if no buffer based sends are in queue and |
211the maximum specified by 212.Fa timetolive | 211the maximum specified by 212.Fa timetolive |
213bytes is in queue. 214.Pp 215The 216.Dv SCTP_PR_SCTP_RTX 217policy transforms the | 213bytes is in queue. 214.Pp 215The 216.Dv SCTP_PR_SCTP_RTX 217policy transforms the |
218.Fa sinfo->sinfo_timetolive | 218.Fa sinfo->sinfo_timetolive |
219into a number of retransmissions to allow. 220This policy 221always assures that at a minimum one send attempt is 222made of the data. | 219into a number of retransmissions to allow. 220This policy 221always assures that at a minimum one send attempt is 222made of the data. |
223After which no more than | 223After which no more than |
224.Fa sinfo->sinfo_timetolive 225retransmissions will be made before the data is skipped. 226.Pp 227.Fa sinfo->sinfo_stream 228is the SCTP stream that you wish to send the 229message on. 230Streams in SCTP are reliable (or partially reliable) flows of ordered | 224.Fa sinfo->sinfo_timetolive 225retransmissions will be made before the data is skipped. 226.Pp 227.Fa sinfo->sinfo_stream 228is the SCTP stream that you wish to send the 229message on. 230Streams in SCTP are reliable (or partially reliable) flows of ordered |
231messages. | 231messages. |
232.Pp 233The 234.Fa sinfo->sinfo_assoc_id | 232.Pp 233The 234.Fa sinfo->sinfo_assoc_id |
235field is used to | 235field is used to |
236select the association to send to on a one-to-many socket. 237For a one-to-one socket, this field is ignored. 238.Pp 239The 240.Fa sinfo->sinfo_context 241field is used only in the event the message cannot be sent. 242This is an opaque 243value that the stack retains and will give to the user when a failed send --- 7 unchanged lines hidden (view full) --- 251argument holds the same meaning and values as those found in 252.Xr sendmsg 2 253but is generally ignored by SCTP. 254.Pp 255The fields 256.Fa sinfo->sinfo_ssn , 257.Fa sinfo->sinfo_tsn , 258and | 236select the association to send to on a one-to-many socket. 237For a one-to-one socket, this field is ignored. 238.Pp 239The 240.Fa sinfo->sinfo_context 241field is used only in the event the message cannot be sent. 242This is an opaque 243value that the stack retains and will give to the user when a failed send --- 7 unchanged lines hidden (view full) --- 251argument holds the same meaning and values as those found in 252.Xr sendmsg 2 253but is generally ignored by SCTP. 254.Pp 255The fields 256.Fa sinfo->sinfo_ssn , 257.Fa sinfo->sinfo_tsn , 258and |
259.Fa sinfo->sinfo_cumtsn | 259.Fa sinfo->sinfo_cumtsn |
260are used only when receiving messages and are thus ignored by 261.Fn sctp_send . 262The function | 260are used only when receiving messages and are thus ignored by 261.Fn sctp_send . 262The function |
263.Fn sctp_sendx 264has the same properties as | 263.Fn sctp_sendx 264has the same properties as |
265.Fn sctp_send 266with the additional arguments of an array of sockaddr structures 267passed in. | 265.Fn sctp_send 266with the additional arguments of an array of sockaddr structures 267passed in. |
268With the | 268With the |
269.Fa addrs 270argument being given as an array of addresses to be sent to and 271the 272.Fa addrcnt 273argument indicating how many socket addresses are in the passed 274in array. 275Note that all of the addresses will only be used 276when an implicit association is being set up. 277This allows the 278user the equivalent behavior as doing a 279.Fn sctp_connectx | 269.Fa addrs 270argument being given as an array of addresses to be sent to and 271the 272.Fa addrcnt 273argument indicating how many socket addresses are in the passed 274in array. 275Note that all of the addresses will only be used 276when an implicit association is being set up. 277This allows the 278user the equivalent behavior as doing a 279.Fn sctp_connectx |
280followed by a | 280followed by a |
281.Fn sctp_send 282to the association. 283Note that if the 284.Fa sinfo->sinfo_assoc_id 285field is 0, then the first address will be used to look up 286the association in place of the association id. 287If both 288an address and an association id are specified, the association --- 66 unchanged lines hidden --- | 281.Fn sctp_send 282to the association. 283Note that if the 284.Fa sinfo->sinfo_assoc_id 285field is 0, then the first address will be used to look up 286the association in place of the association id. 287If both 288an address and an association id are specified, the association --- 66 unchanged lines hidden --- |