blob: 0ddc08106fa247bb0c568fb3e18112a075184e82 [file] [log] [blame]
Michael Tuexenc60ec8b2015-12-10 22:39:23 +01001%
2% Copyright (C) 2012-2015 Irene Ruengeler
3% Copyright (C) 2012-2015 Michael Tuexen
4%
5% All rights reserved.
6%
7% Redistribution and use in source and binary forms, with or without
8% modification, are permitted provided that the following conditions
9% are met:
10% 1. Redistributions of source code must retain the above copyright
11% notice, this list of conditions and the following disclaimer.
12% 2. Redistributions in binary form must reproduce the above copyright
13% notice, this list of conditions and the following disclaimer in the
14% documentation and/or other materials provided with the distribution.
15% 3. Neither the name of the project nor the names of its contributors
16% may be used to endorse or promote products derived from this software
17% without specific prior written permission.
18%
19% THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22% ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23% FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24% DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25% OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26% HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27% LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28% OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29% SUCH DAMAGE.
30%
ruengelerb6a39f82012-05-25 12:57:43 +000031\documentclass[a4paper]{article}
32%
33\usepackage{longtable}
iruengeler05218e72012-09-12 09:32:13 +000034%
ruengelerb6a39f82012-05-25 12:57:43 +000035\title{Socket API for the SCTP User-land Implementation (usrsctp)}
36\author{I.~R\"ungeler%
37 \thanks{M\"unster University of Applied Sciences,
38 Department of Electrical Engineering
39 and Computer Science,
40 Stegerwaldstr.~39,
41 D-48565 Steinfurt,
42 Germany,
43 \texttt{i.ruengeler@fh-muenster.de}.}
44 \and
45 M.~T\"uxen%
46 \thanks{M\"unster University of Applied Sciences,
47 Department of Electrical Engineering
48 and Computer Science,
49 Stegerwaldstr.~39,
50 D-48565 Steinfurt,
51 Germany,
52 \texttt{tuexen@fh-muenster.de}.}
53}
54%
55\begin{document}
56\setcounter{secnumdepth}{4}
57\setcounter{tocdepth}{4}
58\maketitle
59\tableofcontents
60
61\section{Introduction}
62In this manual the socket API for the SCTP User-land implementation will be described.
63It is based on RFC 6458~\cite{socketAPI}. The main focus of this document is on pointing out
ruengeler870a7f62012-05-25 14:42:52 +000064 the differences to the SCTP Sockets API. For all aspects of the sockets API that are not
ruengelerb6a39f82012-05-25 12:57:43 +000065 mentioned in this document, please refer to RFC~6458. Questions about SCTP can hopefully be
66 answered by RFC~4960~\cite{SCTP}.
67
68\section{Getting Started}
69The User-land stack has been tested on FreeBSD 10.0, Ubuntu 11.10, Windows 7, Mac OS X 10.6,
70and MAC OS X 10.7.
71The current version of the User-land stack is provided on \textit{http://sctp.fh-muenster.de/sctp-user-land-stack.html}.
72Download the tarball and untar it in a folder of your choice.
ruengelerfa14a2a2012-05-30 09:49:03 +000073The tarball contains all the sources to build the libusrsctp, which has to be linked to the object file of an
ruengeler870a7f62012-05-25 14:42:52 +000074example program. In addition there are two applications in the folder \textit{programs} that can be built and run.
ruengelerb6a39f82012-05-25 12:57:43 +000075
76\subsection{Building the Library and the Applications}
77\subsubsection{Unix-like Operating Systems}
78In the folder \textit{usrsctp} type
79\begin{verbatim}
Felix Weinranke2a0eff2015-11-23 01:39:21 +010080./bootstrap
ruengelerb6a39f82012-05-25 12:57:43 +000081./configure
82make
83\end{verbatim}
84Now, the library \textit{libusrsctp.la} has been built in the subdirectory \textit{usrsctplib}, and the example
85programs are ready to run from the subdirectory \textit{programs}.
86
87If you have root privileges or are in the sudoer group, you can install the library in \textit{/usr/local/lib}
88and copy the header file to \textit{/usr/include} with the command
89\begin{verbatim}
90sudo make install
91\end{verbatim}
92
93\subsubsection{Windows}
94On Windows you need a compiler like Microsoft Visual Studio. You can build the library and the
95example programs with the command line tool of the compiler by typing
96\begin{verbatim}
97nmake -f Makefile.nmake
98\end{verbatim}
99in the directory \textit{usrsctp}.
100
ruengeler870a7f62012-05-25 14:42:52 +0000101\subsection{Running the Test Programs}
102There are two test programs included, a discard server and a client. You can run both to send data from the
103client to the server. The client reads data from stdin and sends them to the server, which prints the message
104in the terminal and discards it. The sources of the server are also provided in Section~\ref{server} and those
105of the client in Section~\ref{client}.
106
107\subsubsection{Using UDP Encapsulation}
108Both programs can either send data over SCTP directly or use UDP encapsulation, thus encapsulating the
109SCTP packet in a UDP datagram. The first mode works on loopback or in a protected setup without any
110NAT boxes involved. In all other cases it is better to use UDP encapsulation.
111
112The usage of the discard\_server is
113\begin{verbatim}
114discard_server [local_encaps_port remote_encaps_port]
115\end{verbatim}
ruengelerfa14a2a2012-05-30 09:49:03 +0000116For UDP encapsulation the ports have to be specified. The local and remote encapsulation ports can be arbitrarily
ruengeler870a7f62012-05-25 14:42:52 +0000117set.
118For example, you can call
119\begin{verbatim}
120./discard_server 11111 22222
121\end{verbatim}
122on a Unix-like OS and
123\begin{verbatim}
124discard_server.exe 11111 22222
125\end{verbatim}
126on Windows.
127
128The client needs two additional parameters, the server's address and its port.
129Its usage is
130\begin{verbatim}
t00fcxen891a25c2014-12-13 10:01:40 +0000131client remote_addr remote_port [local_port local_encaps_port remote_encaps_port]
ruengeler870a7f62012-05-25 14:42:52 +0000132\end{verbatim}
133The remote address is the server's address. If client and server are started on the same machine,
134the loopback address 127.0.0.1 can be used for Unix-like OSs and the local address on Windows.
135The discard port is 9, thus 9 has to be taken as remote port. The encapsulation ports have to
136match those of the server, i.e. the server's local\_encaps\_port is the client's
137remote\_encaps\_port and vice versa. Thus, the client can be started with
138\begin{verbatim}
t00fcxen891a25c2014-12-13 10:01:40 +0000139./client 127.0.0.1 9 0 22222 11111
ruengeler870a7f62012-05-25 14:42:52 +0000140\end{verbatim}
141on a Unix-like OS and
142\begin{verbatim}
t00fcxen891a25c2014-12-13 10:01:40 +0000143client.exe 192.168.0.1 9 0 22222 11111
ruengeler870a7f62012-05-25 14:42:52 +0000144\end{verbatim}
145on Windows provided your local IP address is 192.168.0.1.
146
147\subsubsection{Sending over SCTP}
148To send data over SCTP directly you might need root privileges because raw sockets are used.
149Thus instead of specifying the encapsulation ports you have to start the programs prepending
150\texttt{sudo} or in case of Windows start the program from an administrator console.
151
152\subsubsection{Using the Callback API}
153Instead of asking constantly for new data, a callback API can be used that is triggered by
154SCTP. A callback function has to be registered that will be called whenever data is ready to
155be delivered to the application.
156
157The discard\_server has a flag to switch between the two modi. If use\_cb is set to 1, the
158callback API will be used. To change the setting, just set the flag and compile the program again.
159
ruengelerb6a39f82012-05-25 12:57:43 +0000160
161
162
163\section{Basic Operations}
ruengelerfa14a2a2012-05-30 09:49:03 +0000164All system calls start with the prefix \textit{usrsctp\_} to distinguish them from the kernel variants.
ruengelerb6a39f82012-05-25 12:57:43 +0000165Some of them are changed to account for the different demands in the userland environment.
166
167\subsection{Differences to RFC 6458}
168\subsubsection{usrsctp\_init()}
ruengelerfa14a2a2012-05-30 09:49:03 +0000169Every application has to start with \textit{usrsctp\_init()}. This function calls \textit{sctp\_init()} and reserves
ruengelerb6a39f82012-05-25 12:57:43 +0000170the memory necessary to administer the data transfer.
171The function prototype is
172\begin{verbatim}
173void
174usrsctp_init(uint16_t udp_port)
175\end{verbatim}
176As it is not always possible to send data directly over SCTP because not all NAT boxes can
177process SCTP packets, the data can be sent over UDP. To encapsulate SCTP into UDP
178a UDP port has to be specified, to which the datagrams can be sent. This local UDP port is set
179with the parameter \texttt{udp\_port}. The default value is 9899, the standard UDP encapsulation port.
180If UDP encapsulation is not necessary, the UDP port has to be set to 0.
181
182\subsubsection{usrsctp\_finish()}
ruengelerfa14a2a2012-05-30 09:49:03 +0000183At the end of the program \textit{usrsctp\_finish()} should be called to free all the memory that has been
ruengelerb6a39f82012-05-25 12:57:43 +0000184allocated before.
185The function prototype is
186\begin{verbatim}
187int
188usrsctp_finish(void).
189\end{verbatim}
190The return code is 0 on success and -1 in case of an error.
191
192\subsubsection{usrsctp\_socket()}
ruengelerfa14a2a2012-05-30 09:49:03 +0000193A representation of an SCTP endpoint is a socket. Is it created with \textit{usrsctp\_socket()}.
Bruce Mitchenerce3056c2018-02-19 21:21:59 +0700194The function prototype is:
ruengelerb6a39f82012-05-25 12:57:43 +0000195\begin{verbatim}
196struct socket *
197usrsctp_socket(int domain,
198 int type,
199 int protocol,
200 int (*receive_cb)(struct socket *sock,
201 union sctp_sockstore addr,
202 void *data,
203 size_t datalen,
204 struct sctp_rcvinfo,
Bruce Mitchenerce3056c2018-02-19 21:21:59 +0700205 int flags,
206 void *ulp_info),
ruengelerb6a39f82012-05-25 12:57:43 +0000207 int (*send_cb)(struct socket *sock,
José Luis Millán3df8f522020-08-01 12:34:40 +0200208 uint32_t sb_free,
209 void *ulp_info),
Bruce Mitchenerce3056c2018-02-19 21:21:59 +0700210 uint32_t sb_threshold,
211 void *ulp_info).
ruengelerb6a39f82012-05-25 12:57:43 +0000212\end{verbatim}
Bruce Mitchenerce3056c2018-02-19 21:21:59 +0700213The arguments taken from RFC~6458 are:
ruengelerfa14a2a2012-05-30 09:49:03 +0000214\begin{itemize}
Bruce Mitchenerce3056c2018-02-19 21:21:59 +0700215\item domain: PF\_INET or PF\_INET6 can be used.
ruengelerfa14a2a2012-05-30 09:49:03 +0000216\item type: In case of a one-to-many style socket it is SOCK\_SEQPACKET, in case of a one-to-one style
217socket it is SOCK\_STREAM. For an explanation of the differences between the socket types please
218refer to RFC~6458.
219\item protocol: Set IPPROTO\_SCTP.
220\end{itemize}
221
Bruce Mitchenerce3056c2018-02-19 21:21:59 +0700222In usrsctp, a callback API can be used.
223\begin{itemize}
224\item The function pointers of the receive and send callbacks are new arguments to the socket call. If no callback API is used, these must be \textit{NULL}.
225\item The \textit{sb\_threshold} specifies the amount of free space in the send socket buffer before the send function in the application is called. If a send callback function is specified and \textit{sb\_threshold} is 0, the function is called whenever there is room in the send socket buffer.
226\item Additional data may be passed along within the \textit{ulp\_info} parameter. This value will be passed to the \textit{receive\_cb} when it is invoked.
227\end{itemize}
ruengelerb6a39f82012-05-25 12:57:43 +0000228
ruengelerfa14a2a2012-05-30 09:49:03 +0000229On success \textit{usrsctp\_socket()} returns the pointer to the new socket in the \texttt{struct socket} data type.
230It will be needed in all other system calls. In case of a failure NULL is returned and
231errno is set to the appropriate error code.
232
ruengelerb6a39f82012-05-25 12:57:43 +0000233\subsubsection{usrsctp\_close()}
234
ruengelerfa14a2a2012-05-30 09:49:03 +0000235The function prototype of \textit{usrsctp\_close()} is
ruengelerb6a39f82012-05-25 12:57:43 +0000236\begin{verbatim}
237void
238usrsctp_close(struct socket *so).
239 \end{verbatim}
240Thus the only difference is the absence of a return code.
241
242\subsection{Same Functionality as RFC 6458}
ruengelerfa14a2a2012-05-30 09:49:03 +0000243The following functions have the same functionality as their kernel pendants. There prototypes
244are described in the following subsections. For a detailed description please refer to RFC~6458.
ruengelerb6a39f82012-05-25 12:57:43 +0000245
ruengelerfa14a2a2012-05-30 09:49:03 +0000246\subsubsection{usrsctp\_bind()}
247The function prototype of \textit{usrsctp\_bind()} is
ruengelerb6a39f82012-05-25 12:57:43 +0000248\begin{verbatim}
249int
250usrsctp_bind(struct socket *so,
251 struct sockaddr *addr,
252 socklen_t addrlen).
ruengelerfa14a2a2012-05-30 09:49:03 +0000253\end{verbatim}
254The arguments are
255\begin{itemize}
256\item so: Pointer to the socket as returned by \textit{usrsctp\_socket()}.
257\item addr: The address structure (struct sockaddr\_in for an IPv4 address
258 or struct sockaddr\_in6 for an IPv6 address).
259\item addrlen: The size of the address structure.
260\end{itemize}
261\textit{usrsctp\_bind()} returns 0 on success and -1 in case of an error.
ruengelerb6a39f82012-05-25 12:57:43 +0000262
ruengelerfa14a2a2012-05-30 09:49:03 +0000263\subsubsection{usrsctp\_listen()}
264The function prototype of \textit{usrsctp\_listen()} is
ruengelerb6a39f82012-05-25 12:57:43 +0000265\begin{verbatim}
266int
267usrsctp_listen(struct socket *so,
268 int backlog).
269 \end{verbatim}
ruengelerfa14a2a2012-05-30 09:49:03 +0000270The arguments are
271\begin{itemize}
272\item so: Pointer to the socket as returned by \textit{usrsctp\_socket()}.
273\item backlog: If backlog is non-zero, enable listening, else disable
274 listening.
275\end{itemize}
276\textit{usrsctp\_listen()} returns 0 on success and -1 in case of an error.
ruengelerb6a39f82012-05-25 12:57:43 +0000277
ruengelerfa14a2a2012-05-30 09:49:03 +0000278\subsubsection{usrsctp\_accept()}
279The function prototype of \textit{usrsctp\_accept()} is
ruengelerb6a39f82012-05-25 12:57:43 +0000280\begin{verbatim}
281struct socket *
282usrsctp_accept(struct socket *so,
283 struct sockaddr * addr,
284 socklen_t * addrlen).
285 \end{verbatim}
ruengelerfa14a2a2012-05-30 09:49:03 +0000286 The arguments are
287\begin{itemize}
288\item so: Pointer to the socket as returned by \textit{usrsctp\_socket()}.
289\item addr: On return, the primary address of the peer (struct sockaddr\_in for an IPv4 address or
290 struct sockaddr\_in6 for an IPv6 address).
291\item addrlen: Size of the returned address structure.
292\end{itemize}
293\textit{usrsctp\_accept()} returns the accepted socket on success and NULL in case of an error.
294
295\subsubsection{usrsctp\_connect()}
296The function prototype of \textit{usrsctp\_connect()} is
ruengelerb6a39f82012-05-25 12:57:43 +0000297\begin{verbatim}
298int
299usrsctp_connect(struct socket *so,
300 struct sockaddr *name,
301 socklen_t addrlen)
302 \end{verbatim}
ruengelerfa14a2a2012-05-30 09:49:03 +0000303The arguments are
304\begin{itemize}
305\item so: Pointer to the socket as returned by \textit{usrsctp\_socket()}.
306 \item name: Address of the peer to connect to (struct sockaddr\_in for an IPv4 address or
307 struct sockaddr\_in6 for an IPv6 address).
308\item addrlen: Size of the peer's address.
309\end{itemize}
310\textit{usrsctp\_connect()} returns 0 on success and -1 in case of an error.
311
312\subsubsection{usrsctp\_shutdown()}
313The function prototype of \textit{usrsctp\_shutdown()} is
ruengelerb6a39f82012-05-25 12:57:43 +0000314\begin{verbatim}
315int
316usrsctp_shutdown(struct socket *so, int how).
317\end{verbatim}
ruengelerfa14a2a2012-05-30 09:49:03 +0000318The arguments are
319\begin{itemize}
320\item so: Pointer to the socket of the association to be closed.
321\item how: Specifies the type of shutdown. The values are as follows:
322\begin{itemize}
323\item SHUT\_RD: Disables further receive operations. No SCTP protocol
324 action is taken.
325\item SHUT\_WR: Disables further send operations, and initiates the SCTP
326 shutdown sequence.
327\item SHUT\_RDWR: Disables further send and receive operations, and
328 initiates the SCTP shutdown sequence.
329\end{itemize}
330\end{itemize}
Bruce Mitchener92b71982018-02-05 21:57:54 +0700331\textit{usrsctp\_shutdown()} returns 0 on success and -1 in case of an error.
ruengelerb6a39f82012-05-25 12:57:43 +0000332
333\section{Sending and Receiving Data}
334Since the publication of RFC~6458 there is only one function for sending and one for receiving
335that is not deprecated. Therefore, only these two are described here.
336
337\subsection{usrsctp\_sendv()}
338The function prototype is
339\begin{verbatim}
340ssize_t
341usrsctp_sendv(struct socket *so,
342 const void *data,
343 size_t len,
344 struct sockaddr *addrs,
345 int addrcnt,
346 void *info,
347 socklen_t infolen,
348 unsigned int infotype,
349 int flags).
350\end{verbatim}
ruengelerfa14a2a2012-05-30 09:49:03 +0000351The arguments are
352\begin{itemize}
353\item so: The socket to send data on.
354\item data: As it is more convenient to send data in a buffer and not a \texttt{struct iovec} data structure, we
355chose to pass the data as a void pointer.
356\item len: Length of the data.
357\item addrs: In this version of usrsctp at most one destination address is supported. In the case of a connected
358socket, the parameter \texttt{addrs} can be set to NULL.
359\item addrcnt: Number of addresses. As at most one address is supported, addrcnt is 0 if addrs is NULL and
3601 otherwise.
361\item info: Additional information for a message is stored in \texttt{void *info}. The data types \texttt{struct~sctp\_sndinfo},
362\texttt{struct~sctp\_prinfo}, and \texttt{struct} \linebreak \texttt{sctp\_sendv\_spa} are supported as defined in
363RFC~6458. Support for \texttt{structsctp\_authinfo} is not implemented yet, therefore, errno is set EINVAL
364and -1 will be returned, if it is used.
365\item infolen: Length of info in bytes.
366\item infotype: Identifies the type of the information provided in info. Possible values are
367SCTP\_SENDV\_NOINFO, SCTP\_SENDV\_SNDINFO, \linebreak SCTP\_SENDV\_PRINFO, SCTP\_SENDV\_SPA.
368For additional information please refer to RFC~6458.
369\item flags: Flags as described in RFC~6458.
370\end{itemize}
ruengelerb6a39f82012-05-25 12:57:43 +0000371
ruengelerfa14a2a2012-05-30 09:49:03 +0000372\textit{usrsctp\_sendv()} returns the number of bytes sent, or -1 if an error
373occurred. The variable errno is then set appropriately.
ruengelerb6a39f82012-05-25 12:57:43 +0000374
ruengelerfa14a2a2012-05-30 09:49:03 +0000375\subsection{usrsctp\_recvv()}
ruengelerb6a39f82012-05-25 12:57:43 +0000376The function prototype is
377\begin{verbatim}
378ssize_t
ruengelerfa14a2a2012-05-30 09:49:03 +0000379usrsctp_recvv(struct socket *so,
ruengelerb6a39f82012-05-25 12:57:43 +0000380 void *dbuf,
381 size_t len,
382 struct sockaddr *from,
383 socklen_t * fromlen,
384 void *info,
385 socklen_t *infolen,
386 unsigned int *infotype,
387 int *msg_flags).
388\end{verbatim}
ruengelerfa14a2a2012-05-30 09:49:03 +0000389The arguments are
390\begin{itemize}
391\item so: The socket to receive data on.
392\item dbuf: Analog to \textit{usrsctp\_sendv()} the data is returned in a buffer.
393\item len: Length of the buffer in bytes.
394\item from: A pointer to an address to be filled with the sender of the
395 received message's address.
396\item fromlen: An in/out parameter describing the from length.
397\item info: A pointer to the buffer to hold the attributes of the received
398 message. The structure type of info is determined by the
399 infotype parameter. The attributes returned in \texttt{info} have to be
400 handled in the same way as specified in RFC~6458.
401\item infolen: An in/out parameter describing the size of the info buffer.
402\item infotype: On return, *infotype is set to the type of the info
403 buffer. The current defined values are SCTP\_RECVV\_NOINFO,
404 SCTP\_RECVV\_RCVINFO, SCTP\_RECVV\_NXTINFO, and
405 SCTP\_RECVV\_RN. A detailed description is given in RFC~6458.
406\item flags: A pointer to an integer to be filled with any message flags
407 (e.g., MSG\_NOTIFICATION). Note that this field is an in/out
408 parameter. Options for the receive may also be passed into the
409 value (e.g., MSG\_EOR). Returning from the call, the flags' value
410 will differ from its original value.
411\end{itemize}
412
413\textit{usrsctp\_recvv()} returns the number of bytes sent, or -1 if an error
414occurred. The variable errno is then set appropriately.
415
416
ruengelerb6a39f82012-05-25 12:57:43 +0000417
418\section{Socket Options}
ruengelerfa14a2a2012-05-30 09:49:03 +0000419Socket options are used to change the default behavior of socket calls.
420Their behavior is specified in RFC~6458. The functions to get or set them are
ruengelerb6a39f82012-05-25 12:57:43 +0000421
422\begin{verbatim}
423int
424usrsctp_getsockopt(struct socket *so,
425 int level,
426 int optname,
427 void *optval,
428 socklen_t *optlen)
429\end{verbatim}
430and
431\begin{verbatim}
432int
433usrsctp_setsockopt(struct socket *so,
434 int level,
435 int optname,
436 const void *optval,
437 socklen_t optlen).
438\end{verbatim}
439
ruengelerfa14a2a2012-05-30 09:49:03 +0000440and the arguments are
441\begin{itemize}
442\item so: The socket of type struct socket.
443\item level: Set to IPPROTO\_SCTP for all SCTP options.
444\item optname: The option name as specified in Table~\ref{options}.
445\item optval: The buffer to store the value of the option as specified in the second column of Table~\ref{options}.
446\item optlen: The size of the buffer (or the length of the option
447 returned in case of \textit{usrsctp\_getsockopt}).
448\end{itemize}
449
450These functions return 0 on success and -1 in case of an error.
451
ruengelerb6a39f82012-05-25 12:57:43 +0000452\begin{longtable}{|l|l|c|}
453\hline
454{\bfseries Option}&{\bfseries Datatype} &{\bfseries r/w}\tabularnewline
455\endhead
456\hline
457SCTP\_RTOINFO&struct sctp\_rtoinfo&r/w\tabularnewline \hline
458SCTP\_ASSOCINFO&struct sctp\_assocparams&r/w\tabularnewline \hline
459SCTP\_INITMSG&struct sctp\_initmsg&r/w\tabularnewline \hline
460SCTP\_NODELAY&int&r/w\tabularnewline \hline
461SCTP\_AUTOCLOSE&int&r/w\tabularnewline \hline
462SCTP\_PRIMARY\_ADDR&struct sctp\_setprim&r/w\tabularnewline \hline
463SCTP\_ADAPTATION\_LAYER&struct sctp\_setadaptation&r/w\tabularnewline \hline
464SCTP\_DISABLE\_FRAGMENTS&int&r/w\tabularnewline \hline
465SCTP\_PEER\_ADDR\_PARAMS&struct sctp\_paddrparams&r/w\tabularnewline \hline
466SCTP\_I\_WANT\_MAPPED\_V4\_ADDR&int&r/w\tabularnewline \hline
467SCTP\_MAXSEG&struct sctp\_assoc\_value&r/w\tabularnewline \hline
468SCTP\_DELAYED\_SACK&struct sctp\_sack\_info&r/w\tabularnewline \hline
469SCTP\_FRAGMENT\_INTERLEAVE&int&r/w\tabularnewline \hline
470SCTP\_PARTIAL\_DELIVERY\_POINT&int&r/w\tabularnewline \hline
471SCTP\_HMAC\_IDENT&struct sctp\_hmacalgo&r/w\tabularnewline \hline
472SCTP\_AUTH\_ACTIVE\_KEY&struct sctp\_authkeyid&r/w\tabularnewline \hline
473SCTP\_AUTO\_ASCONF&int&r/w\tabularnewline \hline
474SCTP\_MAX\_BURST&struct sctp\_assoc\_value&r/w\tabularnewline \hline
475SCTP\_CONTEXT&struct sctp\_assoc\_value&r/w\tabularnewline \hline
476SCTP\_EXPLICIT\_EOR&int&r/w\tabularnewline \hline
477SCTP\_REUSE\_PORT&int&r/w\tabularnewline \hline
478SCTP\_EVENT&struct sctp\_event&r/w\tabularnewline \hline
479SCTP\_RECVRCVINFO&int&r/w\tabularnewline \hline
480SCTP\_RECVNXTINFO&int&r/w\tabularnewline \hline
481SCTP\_DEFAULT\_SNDINFO&struct sctp\_sndinfo&r/w\tabularnewline \hline
482SCTP\_DEFAULT\_PRINFO&struct sctp\_default\_prinfo&r/w\tabularnewline \hline
483SCTP\_REMOTE\_UDP\_ENCAPS\_PORT&int&r/w\tabularnewline \hline
484SCTP\_ENABLE\_STREAM\_RESET&struct sctp\_assoc\_value&r/w\tabularnewline \hline
485SCTP\_STATUS&struct sctp\_status&r\tabularnewline \hline
486SCTP\_GET\_PEER\_ADDR\_INFO&struct sctp\_paddrinfo&r\tabularnewline \hline
487SCTP\_PEER\_AUTH\_CHUNKS&struct sctp\_authchunks&r\tabularnewline \hline
488SCTP\_LOCAL\_AUTH\_CHUNKS&struct sctp\_authchunks&r\tabularnewline \hline
489SCTP\_GET\_ASSOC\_NUMBER&uint32\_t&r\tabularnewline \hline
490SCTP\_GET\_ASSOC\_ID\_LIST&struct sctp\_assoc\_ids&r\tabularnewline \hline
491SCTP\_RESET\_STREAMS&struct sctp\_reset\_streams&w\tabularnewline \hline
492SCTP\_RESET\_ASSOC&struct sctp\_assoc\_t&w\tabularnewline \hline
493SCTP\_ADD\_STREAMS&struct sctp\_add\_streams&w\tabularnewline \hline
494\caption{Socket Options supported by usrsctp}
495\label{options}
496\end{longtable}
497An overview of the supported options is given in Table~\ref{options}. Their use is described in RFC~6458~\cite{socketAPI}, RFC~6525~\cite{streamReset}, and~\cite{udpencaps}.
498
499\section{Sysctl variables}
500
501In kernel implementations like for instance FreeBSD, it is possible to change parameters
502in the operating system. These parameters are called sysctl variables.
503
504In usrsctp applications can set or retrieve these variables with the functions
505\begin{verbatim}
506void
507usrsctp_sysctl_set_ ## (uint32_t value)
508\end{verbatim}
509and
510\begin{verbatim}
511uint32_t
512usrsctp_sysctl_get_ ## (void)
513\end{verbatim}
514respectively, where \#\# stands for the name of the variable.
515
516In the following paragraphs a short description of the parameters will be given.
517
518\subsection{Manipulate Memory}
519\subsubsection{usrsctp\_sysctl\_set\_sctp\_sendspace()}
520The space of the available send buffer can be changed from its default value of 262,144 bytes
521to a value between 0 and $2^{32}-1$ bytes.
522
523\subsubsection{usrsctp\_sysctl\_set\_sctp\_recvspace()}
524The space of the available receive buffer can be changed from its default value of 262,144 bytes
525to a value between 0 and $2^{32}-1$ bytes.
526
527\subsubsection{usrsctp\_sysctl\_set\_sctp\_hashtblsize()}
528The TCB (Thread Control Block) hash table sizes, i.e. the size of one TCB in the hash table, can be tuned between
5291 and $2^{32}-1$ bytes. The default value is 1,024 bytes. A TCB contains for instance pointers to the socket, the
530endpoint, information about the association and some statistic data.
531
532\subsubsection{usrsctp\_sysctl\_set\_sctp\_pcbtblsize()}
533The PCB (Protocol Control Block) hash table sizes, i.e. the size of one PCB in the hash table, can be tuned between
5341 and $2^{32}-1$ bytes. The default value is 256 bytes. The PCB contains all variables that characterize an endpoint.
535
536\subsubsection{usrsctp\_sysctl\_set\_sctp\_system\_free\_resc\_limit()}
537This parameters tunes the maximum number of cached resources in the system. It can be set between
5380 and $2^{32}-1$. The default value is 1000.
539
540\subsubsection{usrsctp\_sysctl\_set\_sctp\_asoc\_free\_resc\_limit()}
541This parameters tunes the maximum number of cached resources in an association. It can be set between
5420 and $2^{32}-1$. The default value is 10.
543
544\subsubsection{usrsctp\_sysctl\_set\_sctp\_mbuf\_threshold\_count()}
545Data is stored in mbufs. Several mbufs can be chained together. The maximum number of small mbufs in a chain
546can be set with this parameter, before an mbuf cluset is used. The default is 5.
547
548\subsubsection{usrsctp\_sysctl\_set\_sctp\_add\_more\_threshold()}
ruengeler6e3a3872012-05-30 13:28:03 +0000549TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000550This parameter configures the threshold below which more space should be added to a socket send buffer.
551The default value is 1452 bytes.
552
553
554\subsection{Configure RTO}
555The retransmission timeout (RTO), i.e. the time that controls the retransmission of messages, has
556several parameters, that can be changed, for example to shorten the time, before a message is
557retransmitted. The range of these parameters is between 0 and $2^{32}-1$~ms.
558
559\subsubsection{usrsctp\_sysctl\_set\_sctp\_rto\_max\_default()}
560The default value for the maximum retransmission timeout in ms is 60,000 (60~secs).
561
562\subsubsection{usrsctp\_sysctl\_set\_sctp\_rto\_min\_default()}
563The default value for the minimum retransmission timeout in ms is 1,000 (1~sec).
564
565\subsubsection{usrsctp\_sysctl\_set\_sctp\_rto\_initial\_default()}
566The default value for the initial retransmission timeout in ms is 3,000 (3~sec). This value is only
567needed before the first calculation of a round trip time took place.
568
569\subsubsection{usrsctp\_sysctl\_set\_sctp\_init\_rto\_max\_default()}
570The default value for the maximum retransmission timeout for an INIT chunk in ms is 60,000 (60~secs).
571
572
573\subsection{Set Timers}
574\subsubsection{usrsctp\_sysctl\_set\_sctp\_valid\_cookie\_life\_default()}
575A cookie has a specified life time. If it expires the cookie is not valid any more and an ABORT is sent.
576The default value in ms is 60,000 (60~secs).
577
578\subsubsection{usrsctp\_sysctl\_set\_sctp\_heartbeat\_interval\_default()}
579Set the default time between two heartbeats. The default is 30,000~ms.
580
581\subsubsection{usrsctp\_sysctl\_set\_sctp\_shutdown\_guard\_time\_default()}
582If a SHUTDOWN is not answered with a SHUTDOWN-ACK while the shutdown guard timer is still
583running, the association will be aborted after the default of 180~secs.
584
585\subsubsection{usrsctp\_sysctl\_set\_sctp\_pmtu\_raise\_time\_default()}
ruengeler6e3a3872012-05-30 13:28:03 +0000586TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000587To set the size of the packets to the highest value possible, the maximum transfer unit (MTU)
588of the complete path has to be known. The default time interval for the path mtu discovery
589is 600~secs.
590
591\subsubsection{usrsctp\_sysctl\_set\_sctp\_secret\_lifetime\_default()}
ruengeler6e3a3872012-05-30 13:28:03 +0000592TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000593The default secret lifetime of a server is 3600~secs.
594
595\subsubsection{usrsctp\_sysctl\_set\_sctp\_vtag\_time\_wait()}
ruengeler6e3a3872012-05-30 13:28:03 +0000596TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000597Vtag time wait time, 0 disables it. Default: 60~secs
598
599
600\subsection{Set Failure Limits}
601Transmissions and retransmissions of messages might fail. To protect the system against too many
602retransmissions, limits have to be defined.
603
604\subsubsection{usrsctp\_sysctl\_set\_sctp\_init\_rtx\_max\_default()}
605The default maximum number of retransmissions of an INIT chunks is 8, before an ABORT is sent.
606
607\subsubsection{usrsctp\_sysctl\_set\_sctp\_assoc\_rtx\_max\_default()}
608This parameter sets the maximum number of failed retransmissions before the association is aborted.
Bruce Mitchener084b8ea2018-02-04 23:10:41 +0700609The default value is 10.
ruengelerb6a39f82012-05-25 12:57:43 +0000610
611\subsubsection{usrsctp\_sysctl\_set\_sctp\_path\_rtx\_max\_default()}
612This parameter sets the maximum number of path failures before the association is aborted.
613The default value is 5. Notice that the number of paths multiplied by this value should be
614equal to sctp\_assoc\_rtx\_max\_default. That means that the default configuration is good for two
615paths.
616
617\subsubsection{usrsctp\_sysctl\_set\_sctp\_max\_retran\_chunk()}
618The parameter configures how many times an unlucky chunk can be retransmitted before the
619association aborts. The default is set to 30.
620
621\subsubsection{usrsctp\_sysctl\_set\_sctp\_path\_pf\_threshold()}
ruengeler6e3a3872012-05-30 13:28:03 +0000622TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000623Default potentially failed threshold. Default: 65535
624
625\subsubsection{usrsctp\_sysctl\_set\_sctp\_abort\_if\_one\_2\_one\_hits\_limit()}
ruengeler6e3a3872012-05-30 13:28:03 +0000626TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000627When one-2-one hits qlimit abort. Default: 0
628
629
630\subsection{Control the Sending of SACKs}
631\subsubsection{usrsctp\_sysctl\_set\_sctp\_sack\_freq\_default()}
632The SACK frequency defines the number of packets that are awaited, before a SACK is sent.
633The default value is 2.
634
635\subsubsection{usrsctp\_sysctl\_set\_sctp\_delayed\_sack\_time\_default()}
David Sandersb519f512022-03-29 13:55:16 -0700636As a SACK (Selective Acknowledgment) is sent after every other packet, a timer is set to send a
ruengelerb6a39f82012-05-25 12:57:43 +0000637SACK in case another packet does not arrive in due time. The default value for this timer is
638200~ms.
639
640\subsubsection{usrsctp\_sysctl\_set\_sctp\_strict\_sacks()}
ruengeler6e3a3872012-05-30 13:28:03 +0000641TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000642This is a flag to turn the controlling of the coherence of SACKs on or off. The default value is
6431 (on).
644
645\subsubsection{usrsctp\_sysctl\_set\_sctp\_nr\_sack\_on\_off()}
646If a slow hosts receives data on a lossy link it is possible that its receiver window is full and new
647data can only be accepted if one chunk with a higher TSN (Transmission Sequence Number) that has
648previously been acknowledged is dropped. As a consequence the sender has to store data, even if
649they have been acknowledged in case they have to be retransmitted. If this behavior is not necessary,
650non-renegable SACKs can be turned on.
651By default the use of non-renegable SACKs is turned off.
652
653\subsubsection{usrsctp\_sysctl\_set\_sctp\_enable\_sack\_immediately()}
654In some cases it is not desirable to wait for the SACK timer to expire before a SACK is sent. In these
655cases a bit called SACK-IMMEDIATELY~\cite{sack-imm} can be set to provoke the instant sending of a SACK.
656The default is to turn it off.
657
658\subsubsection{usrsctp\_sysctl\_set\_sctp\_L2\_abc\_variable()}
ruengeler6e3a3872012-05-30 13:28:03 +0000659TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000660SCTP ABC max increase per SACK (L). Default: 1
661
662\subsection{Change Max Burst}
663Max burst defines the maximum number of packets that may be sent in one flight.
664
665\subsubsection{usrsctp\_sysctl\_set\_sctp\_max\_burst\_default()}
666The default value for max burst is 0, which means that the number of packets sent as a flight
667is not limited by this parameter, but may be by another one, see the next paragraph.
668
669\subsubsection{usrsctp\_sysctl\_set\_sctp\_use\_cwnd\_based\_maxburst()}
670The use of max burst is based on the size of the congestion window (cwnd).
671This parameter is set by default.
672
673\subsubsection{usrsctp\_sysctl\_set\_sctp\_hb\_maxburst()}
674Heartbeats are mostly used to verify a path. Their number can be limited. The default is 4.
675
676\subsubsection{usrsctp\_sysctl\_set\_sctp\_fr\_max\_burst\_default()}
ruengeler6e3a3872012-05-30 13:28:03 +0000677In the state of fast retransmission the number of packet bursts can be limited. The default
ruengelerb6a39f82012-05-25 12:57:43 +0000678value is 4.
679
680
681\subsection{Handle Chunks}
682\subsubsection{usrsctp\_sysctl\_set\_sctp\_peer\_chunk\_oh()}
683In order to keep track of the peer's advertised receiver window, the sender calculates the window by
684subtracting the amount of data sent. Yet, some OSs reduce the receiver window by the real space needed
685to store the data. This parameter sets the additional amount to debit the peer's receiver window per
686chunk sent. The default value is 256, which is the value needed by FreeBSD.
687
688\subsubsection{usrsctp\_sysctl\_set\_sctp\_max\_chunks\_on\_queue()}
ruengeler6e3a3872012-05-30 13:28:03 +0000689This parameter sets the maximum number of chunks that can be queued per association. The default
ruengelerb6a39f82012-05-25 12:57:43 +0000690value is 512.
691
692\subsubsection{usrsctp\_sysctl\_set\_sctp\_min\_split\_point()}
ruengeler6e3a3872012-05-30 13:28:03 +0000693TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000694The minimum size when splitting a chunk is 2904 bytes by default.
695
696\subsubsection{usrsctp\_sysctl\_set\_sctp\_chunkscale()}
ruengeler6e3a3872012-05-30 13:28:03 +0000697TBD
698This parameter can be tuned for scaling of number of chunks and messages. The default is10.
699
ruengelerb6a39f82012-05-25 12:57:43 +0000700\subsubsection{usrsctp\_sysctl\_set\_sctp\_min\_residual()}
ruengeler6e3a3872012-05-30 13:28:03 +0000701TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000702This parameter configures the minimum size of the residual data chunk in the second
703part of the split. The default is 1452.
704
705
706\subsection{Calculate RTT}
707The calculation of the round trip time (RTT) depends on several parameters.
708
709\subsubsection{usrsctp\_sysctl\_set\_sctp\_rttvar\_bw()}
ruengeler6e3a3872012-05-30 13:28:03 +0000710TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000711Shift amount for bw smoothing on rtt calc. Default: 4
712
713\subsubsection{usrsctp\_sysctl\_set\_sctp\_rttvar\_rtt()}
ruengeler6e3a3872012-05-30 13:28:03 +0000714TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000715Shift amount for rtt smoothing on rtt calc. Default: 5
716
717\subsubsection{usrsctp\_sysctl\_set\_sctp\_rttvar\_eqret()}
ruengeler6e3a3872012-05-30 13:28:03 +0000718TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000719What to return when rtt and bw are unchanged. Default: 0
720
721
722\subsection{Influence the Congestion Control}
723The congestion control should protect the network against fast senders.
724
725\subsubsection{usrsctp\_sysctl\_set\_sctp\_ecn\_enable}
726Explicit congestion notifications are turned on by default.
727
728\subsubsection{usrsctp\_sysctl\_set\_sctp\_default\_cc\_module()}
729This parameter sets the default algorithm for the congestion control.
730Default is 0, i.e. the one specified in RFC~4960.
731
732\subsubsection{usrsctp\_sysctl\_set\_sctp\_initial\_cwnd()}
733Set the initial congestion window in MTUs. The default is 3.
734
735\subsubsection{usrsctp\_sysctl\_set\_sctp\_use\_dccc\_ecn()}
ruengeler6e3a3872012-05-30 13:28:03 +0000736TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000737Enable for RTCC CC datacenter ECN. Default: 1
738
739\subsubsection{usrsctp\_sysctl\_set\_sctp\_steady\_step()}
ruengeler6e3a3872012-05-30 13:28:03 +0000740TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000741How many the sames it takes to try step down of cwnd. Default: 20
742
743
744\subsection{Configure AUTH and ADD-IP}
745An important extension of SCTP is the dynamic address reconfiguration~\cite{addip}, also known as
746ADD-IP, which allows the changing of addresses during the lifetime of an association.
747For this feature the AUTH extension~\cite{auth} is necessary.
748
749\subsubsection{usrsctp\_sysctl\_set\_sctp\_auto\_asconf()}
750If SCTP Auto-ASCONF is enabled, the peer is informed automatically when a new address
751is added or removed. This feature is enabled by default.
752
753\subsubsection{usrsctp\_sysctl\_set\_sctp\_multiple\_asconfs()}
754By default the sending of multiple ASCONFs is disabled.
755
756\subsubsection{usrsctp\_sysctl\_set\_sctp\_auth\_disable()}
757The use of AUTH, which is normally turned on, can be disabled by setting this parameter to 1.
758
759\subsubsection{usrsctp\_sysctl\_set\_sctp\_asconf\_auth\_nochk()}
760It is also possible to disable the requirement to use AUTH in conjunction with ADD-IP by setting this parameter
761to 1.
762
763
764\subsection{Concurrent Multipath Transfer (CMT)}
765A prominent feature of SCTP is the possibility to use several addresses for the same association.
766One is the primary path, and the others are needed in case of a path failure. Using CMT the data is sent
767on several paths to enhance the throughput.
768
769\subsubsection{usrsctp\_sysctl\_set\_sctp\_cmt\_on\_off()}
770To turn CMT on, this parameter has to be set to 1.
771
772\subsubsection{usrsctp\_sysctl\_set\_sctp\_cmt\_use\_dac()}
773To use delayed acknowledgments with CMT this parameter has to be set to 1.
774
775\subsubsection{usrsctp\_sysctl\_set\_sctp\_buffer\_splitting()}
776For CMT it makes sense to split the send and receive buffer to have shares for each path.
777By default buffer splitting is turned off.
778
779
780\subsection{Network Address Translation (NAT)}
781To be able to pass NAT boxes, the boxes have to handle SCTP packets in a specific way.
782
783\subsubsection{usrsctp\_sysctl\_set\_sctp\_nat\_friendly()}
784SCTP NAT friendly operation. Default:1
785
786\subsubsection{usrsctp\_sysctl\_set\_sctp\_inits\_include\_nat\_friendly()}
787Enable sending of the nat-friendly SCTP option on INITs. Default: 0
788
789\subsubsection{usrsctp\_sysctl\_set\_sctp\_udp\_tunneling\_port()}
790Set the SCTP/UDP tunneling port. Default: 9899
791
792\subsection{SCTP Mobility}
793\subsubsection{usrsctp\_sysctl\_set\_sctp\_mobility\_base()}
ruengeler6e3a3872012-05-30 13:28:03 +0000794TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000795Enable SCTP base mobility. Default: 0
796
797
798\subsubsection{usrsctp\_sysctl\_set\_sctp\_mobility\_fasthandoff()}
ruengeler6e3a3872012-05-30 13:28:03 +0000799TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000800Enable SCTP fast handoff. default: 0
801
802
803\subsection{Miscellaneous}
804\subsubsection{usrsctp\_sysctl\_set\_sctp\_no\_csum\_on\_loopback()}
805Calculating the checksum for packets sent on loopback is turned off by default.
806To turn it on, set this parameter to 0.
807
808\subsubsection{usrsctp\_sysctl\_set\_sctp\_nr\_outgoing\_streams\_default()}
809The peer is notified about the number of outgoing streams in the INIT or INIT-ACK chunk.
810The default is 10.
811
812\subsubsection{usrsctp\_sysctl\_set\_sctp\_do\_drain()}
813Determines whether SCTP should respond to the drain calls. Default: 1
814
815\subsubsection{usrsctp\_sysctl\_set\_sctp\_strict\_data\_order()}
ruengeler6e3a3872012-05-30 13:28:03 +0000816TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000817Enforce strict data ordering, abort if control inside data. Default: 0
818
819\subsubsection{usrsctp\_sysctl\_set\_sctp\_default\_ss\_module()}
820Set the default stream scheduling module. Implemented modules are:
821SCTP\_SS\_DEFAULT, SCTP\_SS\_ROUND\_ROBIN, SCTP\_SS\_ROUND\_ROBIN\_PACKET,
822SCTP\_SS\_PRIORITY, SCTP\_SS\_FAIR\_BANDWITH, and SCTP\_SS\_FIRST\_COME.
823
824\subsubsection{usrsctp\_sysctl\_set\_sctp\_default\_frag\_interleave()}
ruengeler6e3a3872012-05-30 13:28:03 +0000825TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000826Default fragment interleave level. Default: 1
827
828\subsubsection{usrsctp\_sysctl\_set\_sctp\_blackhole()}
ruengeler6e3a3872012-05-30 13:28:03 +0000829TBD
ruengelerb6a39f82012-05-25 12:57:43 +0000830Enable SCTP blackholing. Default: 0
831
832\subsubsection{usrsctp\_sysctl\_set\_sctp\_logging\_level()}
833Set the logging level. The default is 0.
834
835
836\subsubsection{usrsctp\_sysctl\_set\_sctp\_debug\_on()}
837Turn debug output on or off. It is disabled by default. To obtain debug output,
838SCTP\_DEBUG has to be set as a compile flag.
839
840
841%The following variables are supported:
842%\begin{longtable}{|l|l|c|}
843%\hline
844%{\bfseries Parameter}&{\bfseries Meaning}&{\bfseries Default Value} \tabularnewline
845%\endhead
846%\hline
847%sctp\_sendspace&Send buffer space&1864135\tabularnewline \hline
848%sctp\_recvspace&Receive buffer space&1864135 \tabularnewline \hline
849%sctp\_hashtblsize&Tunable for TCB hash table sizes&1024 \tabularnewline \hline
850%sctp\_pcbtblsize&Tunable for PCB hash table sizes&256 \tabularnewline \hline
851%sctp\_system\_free\_resc\_limit&Cached resources in the system&1000 \tabularnewline \hline
852%sctp\_asoc\_free\_resc\_limit&Cashed resources in an association&10 \tabularnewline \hline
853%sctp\_rto\_max\_default&Default value for RTO\_max&60000~ms \tabularnewline \hline
854%sctp\_rto\_min\_default&Default value for RTO\_min&1000~ms \tabularnewline \hline
855%sctp\_rto\_initial\_default&Default value for RTO\_initial&3000~ms \tabularnewline \hline
856%sctp\_init\_rto\_max\_default&Default value for the maximum RTO&60000~ms \tabularnewline
857 % &for sending an INIT& \tabularnewline \hline
858%sctp\_valid\_cookie\_life\_default&Valid cookie life time&60000~ms \tabularnewline \hline
859%sctp\_init\_rtx\_max\_default&Maximum number of INIT retransmissions&8 \tabularnewline \hline
860%sctp\_assoc\_rtx\_max\_default&Maximum number of failed retransmissions&10\tabularnewline
861% & before the association is aborted&\tabularnewline \hline
862%sctp\_path\_rtx\_max\_default&Maximum number of failed retransmissions&5\tabularnewline
863% &before a path fails&\tabularnewline \hline
864%sctp\_ecn\_enable&Enabling explicit congestion notifications&1\tabularnewline \hline
865%sctp\_strict\_sacks&Control the coherence of SACKs&1 \tabularnewline \hline
866%sctp\_delayed\_sack\_time\_default&Default delayed SACK timer&200~ms\tabularnewline \hline
867%sctp\_sack\_freq\_default&Default SACK frequency&2 \tabularnewline \hline
868%sctp\_nr\_sack\_on\_off&Turn non-renegable SACKs on or off&0 \tabularnewline \hline
869%sctp\_enable\_sack\_immediately&Enable sending of the SACK-&0 \tabularnewline &IMMEDIATELY bit.&\tabularnewline \hline
870%sctp\_no\_csum\_on\_loopback&Enable the compilation of the checksum on&1 \tabularnewline
871% &packets sent on loopback&\tabularnewline \hline
872%sctp\_peer\_chunk\_oh&Amount to debit peers rwnd per chunk sent&256 \tabularnewline \hline
873%sctp\_max\_burst\_default&Default max burst for SCTP endpoints&0 \tabularnewline \hline
874%sctp\_use\_cwnd\_based\_maxburst&Use max burst based on the size of &1\tabularnewline % &the congestion window&\tabularnewline \hline
875%sctp\_hb\_maxburst&Confirmation Heartbeat max burst&4 \tabularnewline \hline
876%sctp\_max\_chunks\_on\_queue&Default max chunks on queue per asoc&512 \tabularnewline \hline
877%sctp\_min\_split\_point&Minimum size when splitting a chunk&2904 \tabularnewline \hline
878%sctp\_chunkscale&Tunable for Scaling of number of chunks and&10\tabularnewline
879% &messages&\tabularnewline \hline
880%sctp\_mbuf\_threshold\_count&Maximum number of small mbufs in a chain&5\tabularnewline \hline
David Sandersb519f512022-03-29 13:55:16 -0700881%sctp\_heartbeat\_interval\_default&Default time between two Heartbeats&30000~ms\tabularnewline \hline
ruengelerb6a39f82012-05-25 12:57:43 +0000882%sctp\_pmtu\_raise\_time\_default&Default PMTU raise timer&600~secs\tabularnewline \hline
883%sctp\_shutdown\_guard\_time\_default&Default shutdown guard timer&180~secs\tabularnewline \hline
884%sctp\_secret\_lifetime\_default&Default secret lifetime&3600~secs \tabularnewline \hline
885%sctp\_add\_more\_threshold&Threshold when more space should &1452\tabularnewline
886% &be added to a socket send buffer&\tabularnewline \hline
887%sctp\_nr\_outgoing\_streams\_default&Default number of outgoing streams&10\tabularnewline \hline
888%sctp\_cmt\_on\_off&Turn CMT on or off.&0\tabularnewline \hline
889%sctp\_cmt\_use\_dac&Use delayed acknowledgment for CMT&0\tabularnewline \hline
890%sctp\_fr\_max\_burst\_default&Default max burst for SCTP endpoints when &4\tabularnewline
891% &fast retransmitting&\tabularnewline \hline
892%sctp\_auto\_asconf&Enable SCTP Auto-ASCONF&1\tabularnewline \hline
David Sandersb519f512022-03-29 13:55:16 -0700893%sctp\_multiple\_asconfs&Enable SCTP Multiple-ASCONFs&0 \tabularnewline \hline
ruengelerb6a39f82012-05-25 12:57:43 +0000894%sctp\_asconf\_auth\_nochk&Disable SCTP ASCONF AUTH requirement&0\tabularnewline \hline
895%sctp\_auth\_disable&Disable SCTP AUTH function&0\tabularnewline \hline
896%sctp\_nat\_friendly&SCTP NAT friendly operation&1\tabularnewline \hline
897%sctp\_inits\_include\_nat\_friendly&Enable sending of the nat-friendly &0\tabularnewline
898% &SCTP option on INITs.&\tabularnewline \hline
899%sctp\_udp\_tunneling\_port&Set the SCTP/UDP tunneling port&9899\tabularnewline \hline
900%sctp\_do\_drain&Determines whether SCTP should respond&1\tabularnewline
901% &to the drain calls&\tabularnewline \hline
902%sctp\_abort\_if\_one\_2\_one\_hits\_limit&When one-2-one hits qlimit abort&0 \tabularnewline \hline
903%sctp\_strict\_data\_order&Enforce strict data ordering, abort if control&0\tabularnewline
904% &inside data&\tabularnewline \hline
905%sctp\_min\_residual&Minimum residual data chunk in second&1452\tabularnewline
906% &part of split&\tabularnewline \hline
907%sctp\_max\_retran\_chunk&Maximum times an unlucky chunk can be&30\tabularnewline
908% & retransmitted before the association aborts&\tabularnewline \hline
909%sctp\_default\_cc\_module&Default congestion control module&0\tabularnewline \hline
910%sctp\_default\_ss\_module&Default stream scheduling module&0 \tabularnewline \hline
911%sctp\_default\_frag\_interleave&Default fragment interleave level&1\tabularnewline \hline
912%sctp\_mobility\_base&Enable SCTP base mobility&0\tabularnewline \hline
913%sctp\_mobility\_fasthandoff&Enable SCTP fast handoff&0\tabularnewline \hline
914%sctp\_L2\_abc\_variable&SCTP ABC max increase per SACK (L)&1\tabularnewline \hline
915%sctp\_vtag\_time\_wait&Vtag time wait time, 0 disables it.&60~secs\tabularnewline \hline
916%sctp\_blackhole&Enable SCTP blackholing&0\tabularnewline \hline
917%sctp\_path\_pf\_threshold&Default potentially failed threshold&65535\tabularnewline \hline
918%sctp\_rttvar\_bw&Shift amount for bw smoothing on rtt calc&4 \tabularnewline \hline
919%sctp\_rttvar\_rtt&Shift amount for rtt smoothing on rtt calc&5 \tabularnewline \hline
920%sctp\_rttvar\_eqret &What to return when rtt and bw are&0\tabularnewline
921% &unchanged&\tabularnewline \hline
922%sctp\_steady\_step&How many the sames it takes to try step&20\tabularnewline
923% &down of cwnd&\tabularnewline \hline
924%sctp\_use\_dccc\_ecn&Enable for RTCC CC datacenter ECN&1 \tabularnewline \hline
925%sctp\_buffer\_splitting&Enable send/receive buffer splitting&0 \tabularnewline \hline
926%sctp\_initial\_cwnd&Initial congestion window in MTUs&3\tabularnewline \hline
927%sctp\_logging\_level&Logging level&0 \tabularnewline \hline
928%sctp\_debug\_on&Turns debug output on or off.&0 \tabularnewline \hline
929
930%\caption{Sysctl variables supported by usrsctp}
931%\end{longtable}
932
933\section{Examples}
ruengeler870a7f62012-05-25 14:42:52 +0000934\subsection{Discard Server}\label{server}
ruengelerb6a39f82012-05-25 12:57:43 +0000935\begin{verbatim}
936/*
937 * Copyright (C) 2011-2012 Michael Tuexen
938 *
939 * All rights reserved.
940 *
941 * Redistribution and use in source and binary forms, with or without
942 * modification, are permitted provided that the following conditions
943 * are met:
944 * 1. Redistributions of source code must retain the above copyright
945 * notice, this list of conditions and the following disclaimer.
946 * 2. Redistributions in binary form must reproduce the above copyright
947 * notice, this list of conditions and the following disclaimer in the
948 * documentation and/or other materials provided with the distribution.
949 * 3. Neither the name of the project nor the names of its contributors
950 * may be used to endorse or promote products derived from this software
951 * without specific prior written permission.
952 *
953 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
954 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
955 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
956 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
957 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
958 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
959 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
960 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
961 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
962 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
963 * SUCH DAMAGE.
964 */
965
966/*
967 * Usage: discard_server [local_encaps_port] [remote_encaps_port]
968 */
969
970#include <stdio.h>
971#include <stdlib.h>
972#include <string.h>
973#include <sys/types.h>
Michael Tuexeneb611572020-06-13 17:27:02 +0200974#if !defined(_WIN32)
ruengelerb6a39f82012-05-25 12:57:43 +0000975#include <unistd.h>
976#include <sys/socket.h>
977#include <netinet/in.h>
978#include <arpa/inet.h>
979#endif
980#include <usrsctp.h>
981
982#define BUFFER_SIZE 10240
983
984const int use_cb = 0;
985
986static int
987receive_cb(struct socket *sock, union sctp_sockstore addr, void *data,
988 size_t datalen, struct sctp_rcvinfo rcv, int flags)
989{
990 char name[INET6_ADDRSTRLEN];
991
992 if (data) {
993 if (flags & MSG_NOTIFICATION) {
994 printf("Notification of length %d received.\n", (int)datalen);
995 } else {
996 printf("Msg of length %d received from %s:%u on stream %d with "
997 "SSN %u and TSN %u, PPID %d, context %u.\n",
998 (int)datalen,
999 addr.sa.sa_family == AF_INET ?
ruengeler870a7f62012-05-25 14:42:52 +00001000 inet_ntop(AF_INET, &addr.sin.sin_addr, name,
1001 INET6_ADDRSTRLEN):
1002 inet_ntop(AF_INET6, &addr.sin6.sin6_addr, name,
1003 INET6_ADDRSTRLEN),
ruengelerb6a39f82012-05-25 12:57:43 +00001004 ntohs(addr.sin.sin_port),
1005 rcv.rcv_sid,
1006 rcv.rcv_ssn,
1007 rcv.rcv_tsn,
1008 ntohl(rcv.rcv_ppid),
1009 rcv.rcv_context);
1010 }
1011 free(data);
1012 }
1013 return 1;
1014}
1015
1016int
1017main(int argc, char *argv[])
1018{
1019 struct socket *sock;
1020 struct sockaddr_in6 addr;
1021 struct sctp_udpencaps encaps;
1022 struct sctp_event event;
1023 uint16_t event_types[] = {SCTP_ASSOC_CHANGE,
ruengeler870a7f62012-05-25 14:42:52 +00001024 SCTP_PEER_ADDR_CHANGE,
1025 SCTP_REMOTE_ERROR,
1026 SCTP_SHUTDOWN_EVENT,
1027 SCTP_ADAPTATION_INDICATION,
1028 SCTP_PARTIAL_DELIVERY_EVENT};
ruengelerb6a39f82012-05-25 12:57:43 +00001029 unsigned int i;
1030 struct sctp_assoc_value av;
1031 const int on = 1;
1032 int n, flags;
1033 socklen_t from_len;
1034 char buffer[BUFFER_SIZE];
1035 char name[INET6_ADDRSTRLEN];
1036 struct sctp_recvv_rn rn;
1037 socklen_t infolen = sizeof(struct sctp_recvv_rn);
1038 struct sctp_rcvinfo rcv;
1039 struct sctp_nxtinfo nxt;
1040 unsigned int infotype = 0;
1041
1042 if (argc > 1) {
1043 usrsctp_init(atoi(argv[1]));
1044 } else {
1045 usrsctp_init(9899);
1046 }
1047 usrsctp_sysctl_set_sctp_debug_on(0);
1048 usrsctp_sysctl_set_sctp_blackhole(2);
1049
1050 if ((sock = usrsctp_socket(AF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP,
1051 use_cb?receive_cb:NULL, NULL, 0)) == NULL) {
1052 perror("userspace_socket");
1053 }
1054 if (usrsctp_setsockopt(sock, IPPROTO_SCTP, SCTP_I_WANT_MAPPED_V4_ADDR,
1055 (const void*)&on, (socklen_t)sizeof(int)) < 0) {
1056 perror("setsockopt");
1057 }
1058 memset(&av, 0, sizeof(struct sctp_assoc_value));
1059 av.assoc_id = SCTP_ALL_ASSOC;
1060 av.assoc_value = 47;
1061
1062 if (usrsctp_setsockopt(sock, IPPROTO_SCTP, SCTP_CONTEXT, (const void*)&av,
1063 (socklen_t)sizeof(struct sctp_assoc_value)) < 0) {
1064 perror("setsockopt");
1065 }
1066 if (argc > 2) {
1067 memset(&encaps, 0, sizeof(struct sctp_udpencaps));
1068 encaps.sue_address.ss_family = AF_INET6;
1069 encaps.sue_port = htons(atoi(argv[2]));
1070 if (usrsctp_setsockopt(sock, IPPROTO_SCTP, SCTP_REMOTE_UDP_ENCAPS_PORT,
1071 (const void*)&encaps,
1072 (socklen_t)sizeof(struct sctp_udpencaps)) < 0) {
1073 perror("setsockopt");
1074 }
1075 }
1076 memset(&event, 0, sizeof(event));
1077 event.se_assoc_id = SCTP_FUTURE_ASSOC;
1078 event.se_on = 1;
1079 for (i = 0; i < (unsigned int)(sizeof(event_types)/sizeof(uint16_t)); i++) {
1080 event.se_type = event_types[i];
1081 if (usrsctp_setsockopt(sock, IPPROTO_SCTP, SCTP_EVENT, &event,
1082 sizeof(struct sctp_event)) < 0) {
1083 perror("userspace_setsockopt");
1084 }
1085 }
1086 memset((void *)&addr, 0, sizeof(struct sockaddr_in6));
1087#ifdef HAVE_SIN_LEN
1088 addr.sin6_len = sizeof(struct sockaddr_in6);
1089#endif
1090 addr.sin6_family = AF_INET6;
1091 addr.sin6_port = htons(9);
1092 addr.sin6_addr = in6addr_any;
1093 if (usrsctp_bind(sock, (struct sockaddr *)&addr,
1094 sizeof(struct sockaddr_in6)) < 0) {
1095 perror("userspace_bind");
1096 }
1097 if (usrsctp_listen(sock, 1) < 0) {
1098 perror("userspace_listen");
1099 }
1100 while (1) {
1101 if (use_cb) {
Michael Tuexeneb611572020-06-13 17:27:02 +02001102#if defined(_WIN32)
ruengelerb6a39f82012-05-25 12:57:43 +00001103 Sleep(1*1000);
1104#else
1105 sleep(1);
1106#endif
1107 } else {
1108 from_len = (socklen_t)sizeof(struct sockaddr_in6);
1109 flags = 0;
1110 rn.recvv_rcvinfo = rcv;
1111 rn.recvv_nxtinfo = nxt;
1112 n = usrsctp_recvv(sock, (void*)buffer, BUFFER_SIZE,
1113 (struct sockaddr *) &addr, &from_len, (void *)&rn,
1114 &infolen, &infotype, &flags);
1115 if (n > 0) {
1116 if (flags & MSG_NOTIFICATION) {
1117 printf("Notification of length %d received.\n", n);
1118 } else {
1119 printf("Msg of length %d received from %s:%u on stream "
1120 "%d with SSN %u and TSN %u, PPID %d, context %u, "
1121 "complete %d.\n",
1122 n,
1123 inet_ntop(AF_INET6, &addr.sin6_addr, name,
1124 INET6_ADDRSTRLEN), ntohs(addr.sin6_port),
1125 rn.recvv_rcvinfo.rcv_sid,
1126 rn.recvv_rcvinfo.rcv_ssn,
1127 rn.recvv_rcvinfo.rcv_tsn,
1128 ntohl(rn.recvv_rcvinfo.rcv_ppid),
1129 rn.recvv_rcvinfo.rcv_context,
1130 (flags & MSG_EOR) ? 1 : 0);
1131 }
1132 }
1133 }
1134 }
1135 usrsctp_close(sock);
1136 while (usrsctp_finish() != 0) {
Michael Tuexeneb611572020-06-13 17:27:02 +02001137#if defined(_WIN32)
ruengelerb6a39f82012-05-25 12:57:43 +00001138 Sleep(1000);
1139#else
1140 sleep(1);
1141#endif
1142 }
1143 return (0);
1144}
1145
1146\end{verbatim}
1147
ruengeler870a7f62012-05-25 14:42:52 +00001148\subsection{Client}\label{client}
ruengelerb6a39f82012-05-25 12:57:43 +00001149\begin{verbatim}
1150/*
1151 * Copyright (C) 2011-2012 Michael Tuexen
1152 *
1153 * All rights reserved.
1154 *
1155 * Redistribution and use in source and binary forms, with or without
1156 * modification, are permitted provided that the following conditions
1157 * are met:
1158 * 1. Redistributions of source code must retain the above copyright
1159 * notice, this list of conditions and the following disclaimer.
1160 * 2. Redistributions in binary form must reproduce the above copyright
1161 * notice, this list of conditions and the following disclaimer in the
1162 * documentation and/or other materials provided with the distribution.
1163 * 3. Neither the name of the project nor the names of its contributors
1164 * may be used to endorse or promote products derived from this software
1165 * without specific prior written permission.
1166 *
1167 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
1168 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1169 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1170 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
1171 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1172 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1173 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1174 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1175 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1176 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1177 * SUCH DAMAGE.
1178 */
1179
1180/*
ruengeler870a7f62012-05-25 14:42:52 +00001181 * Usage: client remote_addr remote_port [local_encaps_port remote_encaps_port]
ruengelerb6a39f82012-05-25 12:57:43 +00001182 */
1183
1184#include <stdio.h>
1185#include <stdlib.h>
1186#include <string.h>
Michael Tuexeneb611572020-06-13 17:27:02 +02001187#if !defined(_WIN32)
ruengelerb6a39f82012-05-25 12:57:43 +00001188#include <unistd.h>
1189#endif
1190#include <sys/types.h>
Michael Tuexeneb611572020-06-13 17:27:02 +02001191#if !defined(_WIN32)
ruengelerb6a39f82012-05-25 12:57:43 +00001192#include <sys/socket.h>
1193#include <netinet/in.h>
1194#include <arpa/inet.h>
1195#endif
1196#include <usrsctp.h>
1197
1198int done = 0;
1199
1200static int
1201receive_cb(struct socket *sock, union sctp_sockstore addr, void *data,
1202 size_t datalen, struct sctp_rcvinfo rcv, int flags)
1203{
ruengeler870a7f62012-05-25 14:42:52 +00001204 if (data == NULL) {
1205 done = 1;
1206 usrsctp_close(sock);
1207 } else {
1208 write(fileno(stdout), data, datalen);
1209 free(data);
1210 }
1211 return 1;
ruengelerb6a39f82012-05-25 12:57:43 +00001212}
1213
1214int
1215main(int argc, char *argv[])
1216{
ruengeler870a7f62012-05-25 14:42:52 +00001217 struct socket *sock;
1218 struct sockaddr_in addr4;
1219 struct sockaddr_in6 addr6;
1220 struct sctp_udpencaps encaps;
1221 char buffer[80];
ruengelerb6a39f82012-05-25 12:57:43 +00001222
ruengeler870a7f62012-05-25 14:42:52 +00001223 if (argc > 3) {
1224 usrsctp_init(atoi(argv[3]));
1225 } else {
1226 usrsctp_init(9899);
1227 }
1228 usrsctp_sysctl_set_sctp_debug_on(0);
1229 usrsctp_sysctl_set_sctp_blackhole(2);
1230 if ((sock = usrsctp_socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP,
1231 receive_cb, NULL, 0)) == NULL) {
1232 perror("userspace_socket ipv6");
1233 }
1234 if (argc > 4) {
1235 memset(&encaps, 0, sizeof(struct sctp_udpencaps));
1236 encaps.sue_address.ss_family = AF_INET6;
1237 encaps.sue_port = htons(atoi(argv[4]));
1238 if (usrsctp_setsockopt(sock, IPPROTO_SCTP, SCTP_REMOTE_UDP_ENCAPS_PORT,
1239 (const void*)&encaps,
1240 (socklen_t)sizeof(struct sctp_udpencaps)) < 0) {
1241 perror("setsockopt");
1242 }
1243 }
1244 memset((void *)&addr4, 0, sizeof(struct sockaddr_in));
1245 memset((void *)&addr6, 0, sizeof(struct sockaddr_in6));
Michael Tuexeneb611572020-06-13 17:27:02 +02001246#if !defined(__linux__) && !defined(_WIN32)
ruengeler870a7f62012-05-25 14:42:52 +00001247 addr4.sin_len = sizeof(struct sockaddr_in);
1248 addr6.sin6_len = sizeof(struct sockaddr_in6);
ruengelerb6a39f82012-05-25 12:57:43 +00001249#endif
ruengeler870a7f62012-05-25 14:42:52 +00001250 addr4.sin_family = AF_INET;
1251 addr6.sin6_family = AF_INET6;
1252 addr4.sin_port = htons(atoi(argv[2]));
1253 addr6.sin6_port = htons(atoi(argv[2]));
1254 if (inet_pton(AF_INET6, argv[1], &addr6.sin6_addr) == 1) {
1255 if (usrsctp_connect(sock, (struct sockaddr *)&addr6,
1256 sizeof(struct sockaddr_in6)) < 0) {
1257 perror("userspace_connect");
1258 }
1259 } else if (inet_pton(AF_INET, argv[1], &addr4.sin_addr) == 1) {
1260 if (usrsctp_connect(sock, (struct sockaddr *)&addr4,
1261 sizeof(struct sockaddr_in)) < 0) {
1262 perror("userspace_connect");
1263 }
1264 } else {
1265 printf("Illegal destination address.\n");
1266 }
1267 while ((fgets(buffer, sizeof(buffer), stdin) != NULL) && !done) {
1268 usrsctp_sendv(sock, buffer, strlen(buffer), NULL, 0,
ruengelerb6a39f82012-05-25 12:57:43 +00001269 NULL, 0, SCTP_SENDV_NOINFO, 0);
ruengeler870a7f62012-05-25 14:42:52 +00001270 }
1271 if (!done) {
1272 usrsctp_shutdown(sock, SHUT_WR);
1273 }
1274 while (!done) {
Michael Tuexeneb611572020-06-13 17:27:02 +02001275#if defined(_WIN32)
ruengeler870a7f62012-05-25 14:42:52 +00001276 Sleep(1*1000);
ruengelerb6a39f82012-05-25 12:57:43 +00001277#else
ruengeler870a7f62012-05-25 14:42:52 +00001278 sleep(1);
ruengelerb6a39f82012-05-25 12:57:43 +00001279#endif
ruengeler870a7f62012-05-25 14:42:52 +00001280 }
1281 while (usrsctp_finish() != 0) {
Michael Tuexeneb611572020-06-13 17:27:02 +02001282#if defined(_WIN32)
ruengeler870a7f62012-05-25 14:42:52 +00001283 Sleep(1000);
ruengelerb6a39f82012-05-25 12:57:43 +00001284#else
ruengeler870a7f62012-05-25 14:42:52 +00001285 sleep(1);
ruengelerb6a39f82012-05-25 12:57:43 +00001286#endif
ruengeler870a7f62012-05-25 14:42:52 +00001287 }
1288 return(0);
ruengelerb6a39f82012-05-25 12:57:43 +00001289}
1290
1291\end{verbatim}
1292\bibliographystyle{plain}
1293%
1294\begin{thebibliography}{99}
1295
1296\bibitem{socketAPI}
1297R.~Stewart, M.~T\"uxen, K.~Poon, and V.~Yasevich:
1298\textit{Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)}.
1299RFC~6458, Dezember~2011.
1300
1301\bibitem{SCTP}
1302R.~Stewart:
1303\textit{Stream Control Transmission Protocol}.
1304RFC~4960, September~2007.
1305
1306
1307\bibitem{auth}
1308M.~T\"uxen, R.~Stewart, P.~Lei, and E.~Rescorla:
1309\textit{Authenticated Chunks for the Stream Control Transmission Protocol (SCTP)}.
1310RFC~4895, August~2007.
1311
1312\bibitem{streamReset}
1313R.~Stewart, M.~T\"uxen, and P.~Lei:
1314\textit{Stream Control Transmission Protocol (SCTP) Stream Reconfiguration}.
1315RFC~6525, February~2012.
1316
1317
1318\bibitem{addip}
1319R.~Stewart, Q.~Xie, M.~T\"uxen, S.~Maruyama, and M.~Kozuka:
1320\textit{Stream Control Transmission Protocol (SCTP) Dynamic Address Reconfiguration}.
1321RFC~5061, September~2007.
1322
1323\bibitem{sack-imm}
1324M.~T\"uxen, I.~R\"ungeler, and R.~Stewart:
1325\textit{SACK-IMMEDIATELY Extension for the Stream Control Transmission Protocol}.
1326draft-tuexen-tsvwg-sctp-sack-immediately-09 (work in progress), April~2012.
1327
1328\bibitem{udpencaps}
1329M.~T\"uxen and R.~Stewart
1330\textit{UDP Encapsulation of SCTP Packetsl}.
1331draft-ietf-tsvwg-sctp-udp-encaps-03 (work in progress), March~2012.
1332
1333\end{thebibliography}
iruengeler05218e72012-09-12 09:32:13 +00001334\end{document}