Austin Schuh | 8d0a285 | 2019-12-28 22:54:28 -0800 | [diff] [blame] | 1 | .\" (C) Copyright Sridhar Samudrala IBM Corp. 2004, 2005. |
| 2 | .\" |
| 3 | .\" Permission is granted to distribute possibly modified copies |
| 4 | .\" of this manual provided the header is included verbatim, |
| 5 | .\" and in case of nontrivial modification author and date |
| 6 | .\" of the modification is added to the header. |
| 7 | .\" |
| 8 | .TH SCTP 7 2005-10-25 "Linux Man Page" "Linux Programmer's Manual" |
| 9 | .SH NAME |
| 10 | sctp \- SCTP protocol. |
| 11 | .SH SYNOPSIS |
| 12 | .nf |
| 13 | .B #include <sys/socket.h> |
| 14 | .B #include <netinet/in.h> |
| 15 | .B #include <netinet/sctp.h> |
| 16 | .sp |
| 17 | .B sctp_socket = socket(PF_INET, SOCK_STREAM, IPPROTO_SCTP); |
| 18 | .B sctp_socket = socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP); |
| 19 | .fi |
| 20 | .SH DESCRIPTION |
| 21 | This is an implementation of the SCTP protocol as defined in RFC2960 and |
| 22 | RFC3309. It is a message oriented, reliable transport protocol with direct |
| 23 | support for multihoming that runs on top of |
| 24 | .BR ip (7), |
| 25 | and supports both v4 and v6 versions. |
| 26 | .PP |
| 27 | Like TCP, SCTP provides reliable, connection oriented data delivery with |
| 28 | congestion control. Unlike TCP, SCTP also provides message boundary |
| 29 | preservation, ordered and unordered message delivery, multi-streaming and |
| 30 | multi-homing. Detection of data corruption, loss of data and duplication of |
| 31 | data is achieved by using checksums and sequence numbers. A selective |
| 32 | retransmission mechanism is applied to correct loss or corruption of data. |
| 33 | .PP |
| 34 | This implementation supports a mapping of SCTP into sockets API as defined |
| 35 | in the draft-ietf-tsvwg-sctpsocket-10.txt(Sockets API extensions for SCTP). |
| 36 | Two styles of interfaces are supported. |
| 37 | .PP |
| 38 | A |
| 39 | .B one-to-many |
| 40 | style interface with 1 to MANY relationship between socket and associations |
| 41 | where the outbound association setup is implicit. The syntax of a one-to-many |
| 42 | style socket() call is |
| 43 | .PP |
| 44 | .B sd = socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP); |
| 45 | .PP |
| 46 | A typical server in this style uses the following socket calls in sequence |
| 47 | to prepare an endpoint for servicing requests. |
| 48 | .PP |
| 49 | 1. socket() |
| 50 | 2. bind() |
| 51 | 3. listen() |
| 52 | 4. recvmsg() |
| 53 | 5. sendmsg() |
| 54 | 6. close() |
| 55 | .PP |
| 56 | A typical client uses the following calls in sequence to setup an association |
| 57 | with a server to request services. |
| 58 | .PP |
| 59 | 1. socket() |
| 60 | 2. sendmsg() |
| 61 | 3. recvmsg() |
| 62 | 4. close() |
| 63 | .PP |
| 64 | A |
| 65 | .B one-to-one style |
| 66 | interface with a 1 to 1 relationship between socket and |
| 67 | association which enables existing TCP applications to be ported to SCTP with |
| 68 | very little effort. The syntax of a one-to-one style socket() call is |
| 69 | .PP |
| 70 | .B sd = socket(PF_INET, SOCK_STREAM, IPPROTO_SCTP); |
| 71 | .PP |
| 72 | A typical server in one-to-one style uses the following |
| 73 | system call sequence to prepare an SCTP endpoint for servicing requests: |
| 74 | .PP |
| 75 | 1. socket() |
| 76 | 2. bind() |
| 77 | 3. listen() |
| 78 | 4. accept() |
| 79 | .PP |
| 80 | The accept() call blocks until a new association is set up. It returns with a |
| 81 | new socket descriptor. The server then uses the new socket descriptor to |
| 82 | communicate with the client, using recv() and send() calls to get requests and |
| 83 | send back responses. Then it calls |
| 84 | .PP |
| 85 | 5. close() |
| 86 | .PP |
| 87 | to terminate the association. A typical client uses the following system call |
| 88 | sequence to setup an association with a server to request services: |
| 89 | .PP |
| 90 | 1. socket() |
| 91 | 2. connect() |
| 92 | .PP |
| 93 | After returning from connect(), the client uses send() and recv() calls to |
| 94 | send out requests and receive responses from the server. The client calls |
| 95 | .PP |
| 96 | 3. close() |
| 97 | .PP |
| 98 | to terminate this association when done. |
| 99 | .SH "ADDRESS FORMATS" |
| 100 | SCTP is built on top of IP (see |
| 101 | .BR ip (7)). |
| 102 | The address formats defined by |
| 103 | .BR ip (7) |
| 104 | apply to SCTP. SCTP only supports point-to-point communication; broadcasting |
| 105 | and multicasting are not supported. |
| 106 | .SH SYSCTLS |
| 107 | These variables can be accessed by the |
| 108 | .B /proc/sys/net/sctp/* |
| 109 | files or with the |
| 110 | .BR sysctl (2) |
| 111 | interface. In addition, most IP sysctls also apply to SCTP. See |
| 112 | .BR ip (7). |
| 113 | .TP |
| 114 | Please check kernel documentation for this, at Documentation/networking/ip-sysctl.txt. |
| 115 | .SH "STATISTICS" |
| 116 | These variables can be accessed by the |
| 117 | .B /proc/net/sctp/* |
| 118 | files. |
| 119 | .TP |
| 120 | .B assocs |
| 121 | Displays the following information about the active associations. |
| 122 | assoc ptr, sock ptr, socket style, sock state, association state, hash bucket, |
| 123 | association id, bytes in transmit queue, bytes in receive queue, user id, |
| 124 | inode, local port, remote port, local addresses and remote addresses. |
| 125 | .TP |
| 126 | .B eps |
| 127 | Displays the following information about the active endpoints. |
| 128 | endpoint ptr, sock ptr, socket style, sock state, hash bucket, local port, |
| 129 | user id, inode and local addresses. |
| 130 | .TP |
| 131 | .B snmp |
| 132 | Displays the following statistics related to SCTP states, packets and chunks. |
| 133 | .TP |
| 134 | .TP |
| 135 | .B SctpCurrEstab |
| 136 | The number of associations for which the current state is either ESTABLISHED, |
| 137 | SHUTDOWN-RECEIVED or SHUTDOWN-PENDING. |
| 138 | .TP |
| 139 | .B SctpActiveEstabs |
| 140 | The number of times that associations have made a direct transition to the |
| 141 | ESTABLISHED state from the COOKIE-ECHOED state. The upper layer initiated the |
| 142 | association attempt. |
| 143 | .TP |
| 144 | .B SctpPassiveEstabs |
| 145 | The number of times that associations have made a direct transition to the |
| 146 | ESTABLISHED state from the CLOSED state. The remote endpoint initiated the |
| 147 | association attempt. |
| 148 | .TP |
| 149 | .B SctpAborteds |
| 150 | The number of times that associations have made a direct transition to the |
| 151 | CLOSED state from any state using the primitive 'ABORT'. Ungraceful |
| 152 | termination of the association. |
| 153 | .TP |
| 154 | .B SctpShutdowns |
| 155 | The number of times that associations have made a direct transition to the |
| 156 | CLOSED state from either the SHUTDOWN-SENT state or the SHUTDOWN-ACK-SENT |
| 157 | state. Graceful termination of the association. |
| 158 | .TP |
| 159 | .B SctpOutOfBlues |
| 160 | The number of out of the blue packets received by the host. An out of the blue |
| 161 | packet is an SCTP packet correctly formed, including the proper checksum, but |
| 162 | for which the receiver was unable to identify an appropriate association. |
| 163 | .TP |
| 164 | .B SctpChecksumErrors |
| 165 | The number of SCTP packets received with an invalid checksum. |
| 166 | .TP |
| 167 | .B SctpOutCtrlChunks |
| 168 | The number of SCTP control chunks sent (retransmissions are not included). |
| 169 | Control chunks are those chunks different from DATA. |
| 170 | .TP |
| 171 | .B SctpOutOrderChunks |
| 172 | The number of SCTP ordered data chunks sent (retransmissions are not included). |
| 173 | .TP |
| 174 | .B SctpOutUnorderChunks |
| 175 | The number of SCTP unordered chunks(data chunks in which the U bit is set |
| 176 | to 1) sent (retransmissions are not included). |
| 177 | .TP |
| 178 | .B SctpInCtrlChunks |
| 179 | The number of SCTP control chunks received (no duplicate chunks included). |
| 180 | .TP |
| 181 | .B SctpInOrderChunks |
| 182 | The number of SCTP ordered data chunks received (no duplicate chunks included). |
| 183 | .TP |
| 184 | .B SctpInUnorderChunks |
| 185 | The number of SCTP unordered chunks(data chunks in which the U bit is set |
| 186 | to 1) received (no duplicate chunks included). |
| 187 | .TP |
| 188 | .B SctpFragUsrMsgs |
| 189 | The number of user messages that have to be fragmented because of the MTU. |
| 190 | .TP |
| 191 | .B SctpReasmUsrMsgs |
| 192 | The number of user messages reassembled, after conversion into DATA chunks. |
| 193 | .TP |
| 194 | .B SctpOutSCTPPacks |
| 195 | The number of SCTP packets sent. Retransmitted DATA chunks are included. |
| 196 | .TP |
| 197 | .B SctpInSCTPPacks |
| 198 | The number of SCTP packets received. Duplicates are included. |
| 199 | .SH "SOCKET OPTIONS" |
| 200 | To set or get a SCTP socket option, call |
| 201 | .BR getsockopt (2) |
| 202 | to read or |
| 203 | .BR setsockopt (2) |
| 204 | to write the option with the option level argument set to |
| 205 | .BR SOL_SCTP. |
| 206 | .TP |
| 207 | .BR SCTP_RTOINFO. |
| 208 | This option is used to get or set the protocol parameters used to |
| 209 | initialize and bound retransmission timout(RTO). The structure sctp_rtoinfo |
| 210 | defined in /usr/include/netinet/sctp.h is used to access and modify these |
| 211 | parameters. |
| 212 | .TP |
| 213 | .B SCTP_ASSOCINFO |
| 214 | This option is used to both examine and set various association and endpoint |
| 215 | parameters. The sturcture sctp_assocparams defined in |
| 216 | /usr/include/netinet/sctp.h is used to access and modify these parameters. |
| 217 | .TP |
| 218 | .B SCTP_INITMSG |
| 219 | This option is used to get or set the protocol parameters for the default |
| 220 | association initialization. The structure sctp_initmsg defined in |
| 221 | /usr/include/netinet/sctp.h is used to access and modify these parameters. |
| 222 | |
| 223 | Setting initialization parameters is effective only on an unconnected |
| 224 | socket (for one-to-many style sockets only future associations are |
| 225 | effected by the change). With one-to-one style sockets, this option |
| 226 | is inherited by sockets derived from a listener socket. |
| 227 | .TP |
| 228 | .B SCTP_NODELAY |
| 229 | Turn on/off any Nagle-like algorithm. This means that packets are generally |
| 230 | sent as soon as possible and no unnecessary delays are introduced, at the cost |
| 231 | of more packets in the network. Expects an integer boolean flag. |
| 232 | .TP |
| 233 | .B SCTP_AUTOCLOSE |
| 234 | This socket option is applicable to the one-to-many style socket |
| 235 | only. When set it will cause associations that are idle for more than |
| 236 | the specified number of seconds to automatically close. An |
| 237 | association being idle is defined an association that has NOT sent or |
| 238 | received user data. The special value of 0 indicates that no |
| 239 | automatic close of any associations should be performed. The option |
| 240 | expects an integer defining the number of seconds of idle time before |
| 241 | an association is closed. |
| 242 | .TP |
| 243 | .B SCTP_SET_PEER_PRIMARY_ADDR |
| 244 | Requests that the peer mark the enclosed address as the association |
| 245 | primary. The enclosed address must be one of the association's |
| 246 | locally bound addresses. The structure sctp_setpeerprim defined in |
| 247 | /usr/include/netinet/sctp.h is used to make a set peer primary request. |
| 248 | .TP |
| 249 | .B SCTP_PRIMARY_ADDR |
| 250 | Requests that the local SCTP stack use the enclosed peer address as |
| 251 | the association primary. The enclosed address must be one of the |
| 252 | association peer's addresses. The structure sctp_prim defined in |
| 253 | /usr/include/netinet/sctp.h is used to make a get/set primary request. |
| 254 | .TP |
| 255 | .B SCTP_DISABLE_FRAGMENTS |
| 256 | This option is a on/off flag and is passed an integer where a non-zero is on |
| 257 | and a zero is off. If enabled no SCTP message fragmentation will be performed. |
| 258 | Instead if a message being sent exceeds the current PMTU size, the message will |
| 259 | NOT be sent and an error will be indicated to the user. |
| 260 | .TP |
| 261 | .B SCTP_PEER_ADDR_PARAMS |
| 262 | Using this option, applications can enable or disable heartbeats for any peer |
| 263 | address of an association, modify an address's heartbeat interval, force a |
| 264 | heartbeat to be sent immediately, and adjust the address's maximum number of |
| 265 | retransmissions sent before an address is considered unreachable. The structure |
| 266 | sctp_paddrparams defined in /usr/include/netinet/sctp.h is used to |
| 267 | access and modify an address's parameters. |
| 268 | .TP |
| 269 | .B SCTP_DEFAULT_SEND_PARAM |
| 270 | Applications that wish to use the sendto() system call may wish to specify |
| 271 | a default set of parameters that would normally be supplied through the |
| 272 | inclusion of ancillary data. This socket option allows such an application to |
| 273 | set the default sctp_sndrcvinfo structure. The application that wishes to use |
| 274 | this socket option simply passes in to this call the sctp_sndrcvinfo structure |
| 275 | defined in /usr/include/netinet/sctp.h. The input parameters accepted by this |
| 276 | call include sinfo_stream, sinfo_flags, sinfo_ppid, sinfo_context, |
| 277 | sinfo_timetolive. The user must set the sinfo_assoc_id field to identify the |
| 278 | association to affect if the caller is using the one-to-many style. |
| 279 | .TP |
| 280 | .B SCTP_EVENTS |
| 281 | This socket option is used to specify various notifications and ancillary data |
| 282 | the user wishes to receive. The structure sctp_event_subscribe defined in |
| 283 | /usr/include/netinet/sctp.h is used to access or modify the events of interest |
| 284 | to the user. |
| 285 | .TP |
| 286 | .B SCTP_I_WANT_MAPPED_V4_ADDR |
| 287 | This socket option is a boolean flag which turns on or off mapped V4 |
| 288 | addresses. If this option is turned on and the socket is type PF_INET6, |
| 289 | then IPv4 addresses will be mapped to V6 representation. If this option is |
| 290 | turned off, then no mapping will be done of V4 addresses and a user will |
| 291 | receive both PF_INET6 and PF_INET type addresses on the socket. |
| 292 | |
| 293 | By default this option is turned on and expects an integer to be passed where |
| 294 | non-zero turns on the option and zero turns off the option. |
| 295 | .TP |
| 296 | .B SCTP_MAXSEG |
| 297 | This socket option specifies the maximum size to put in any outgoing |
| 298 | SCTP DATA chunk. If a message is larger than this size it will be |
| 299 | fragmented by SCTP into the specified size. Note that the underlying |
| 300 | SCTP implementation may fragment into smaller sized chunks when the |
| 301 | PMTU of the underlying association is smaller than the value set by |
| 302 | the user. The option expects an integer. |
| 303 | |
| 304 | The default value for this option is 0 which indicates the user is |
| 305 | NOT limiting fragmentation and only the PMTU will effect SCTP's |
| 306 | choice of DATA chunk size. |
| 307 | .TP |
| 308 | .B SCTP_STATUS |
| 309 | Applications can retrieve current status information about an association, |
| 310 | including association state, peer receiver window size, number of unacked |
| 311 | data chunks, and number of data chunks pending receipt. This information is |
| 312 | read-only. The structure sctp_status defined in /usr/include/netinet/sctp.h |
| 313 | is used to access this information. |
| 314 | .TP |
| 315 | .B SCTP_GET_PEER_ADDR_INFO |
| 316 | Applications can retrieve information about a specific peer address |
| 317 | of an association, including its reachability state, congestion window, |
| 318 | and retransmission timer values. This information is read-only. The structure |
| 319 | sctp_paddr_info defined in /usr/include/netinet/sctp.h is used to access this |
| 320 | information. |
| 321 | .TP |
| 322 | .B SCTP_GET_ASSOC_STATS |
| 323 | Applications can retrieve current statistics about an association, including |
| 324 | SACKs sent and received, SCTP packets sent and received. The complete list can |
| 325 | be found in /usr/include/netinet/sctp.h in struct sctp_assoc_stats. |
| 326 | .SH AUTHORS |
| 327 | Sridhar Samudrala <sri@us.ibm.com> |
| 328 | .SH "SEE ALSO" |
| 329 | .BR socket (7), |
| 330 | .BR socket (2), |
| 331 | .BR ip (7), |
| 332 | .BR bind (2), |
| 333 | .BR listen (2), |
| 334 | .BR accept (2), |
| 335 | .BR connect (2), |
| 336 | .BR sendmsg (2), |
| 337 | .BR recvmsg (2), |
| 338 | .BR sysctl (2), |
| 339 | .BR getsockopt (2), |
| 340 | .BR sctp_bindx (3), |
| 341 | .BR sctp_connectx (3), |
| 342 | .BR sctp_sendmsg (3), |
| 343 | .BR sctp_sendv (3), |
| 344 | .BR sctp_send (3), |
| 345 | .BR sctp_recvmsg (3), |
| 346 | .BR sctp_recvv (3), |
| 347 | .BR sctp_peeloff (3), |
| 348 | .BR sctp_getladdrs (3), |
| 349 | .BR sctp_getpaddrs (3), |
| 350 | .BR sctp_opt_info (3). |
| 351 | .sp |
| 352 | RFC2960, RFC3309 for the SCTP specification. |