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