forked from sctplab/usrsctp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Manual.tex
1334 lines (1167 loc) · 56 KB
/
Manual.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%
% Copyright (C) 2012-2015 Irene Ruengeler
% Copyright (C) 2012-2015 Michael Tuexen
%
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions
% are met:
% 1. Redistributions of source code must retain the above copyright
% notice, this list of conditions and the following disclaimer.
% 2. Redistributions in binary form must reproduce the above copyright
% notice, this list of conditions and the following disclaimer in the
% documentation and/or other materials provided with the distribution.
% 3. Neither the name of the project nor the names of its contributors
% may be used to endorse or promote products derived from this software
% without specific prior written permission.
%
% THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
% ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
% ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
% FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
% DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
% OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
% HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
% LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
% OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
% SUCH DAMAGE.
%
\documentclass[a4paper]{article}
%
\usepackage{longtable}
%
\title{Socket API for the SCTP User-land Implementation (usrsctp)}
\author{I.~R\"ungeler%
\thanks{M\"unster University of Applied Sciences,
Department of Electrical Engineering
and Computer Science,
Stegerwaldstr.~39,
D-48565 Steinfurt,
Germany,
\texttt{[email protected]}.}
\and
M.~T\"uxen%
\thanks{M\"unster University of Applied Sciences,
Department of Electrical Engineering
and Computer Science,
Stegerwaldstr.~39,
D-48565 Steinfurt,
Germany,
\texttt{[email protected]}.}
}
%
\begin{document}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\maketitle
\tableofcontents
\section{Introduction}
In this manual the socket API for the SCTP User-land implementation will be described.
It is based on RFC 6458~\cite{socketAPI}. The main focus of this document is on pointing out
the differences to the SCTP Sockets API. For all aspects of the sockets API that are not
mentioned in this document, please refer to RFC~6458. Questions about SCTP can hopefully be
answered by RFC~4960~\cite{SCTP}.
\section{Getting Started}
The User-land stack has been tested on FreeBSD 10.0, Ubuntu 11.10, Windows 7, Mac OS X 10.6,
and MAC OS X 10.7.
The current version of the User-land stack is provided on \textit{http://sctp.fh-muenster.de/sctp-user-land-stack.html}.
Download the tarball and untar it in a folder of your choice.
The tarball contains all the sources to build the libusrsctp, which has to be linked to the object file of an
example program. In addition there are two applications in the folder \textit{programs} that can be built and run.
\subsection{Building the Library and the Applications}
\subsubsection{Unix-like Operating Systems}
In the folder \textit{usrsctp} type
\begin{verbatim}
./bootstrap
./configure
make
\end{verbatim}
Now, the library \textit{libusrsctp.la} has been built in the subdirectory \textit{usrsctplib}, and the example
programs are ready to run from the subdirectory \textit{programs}.
If you have root privileges or are in the sudoer group, you can install the library in \textit{/usr/local/lib}
and copy the header file to \textit{/usr/include} with the command
\begin{verbatim}
sudo make install
\end{verbatim}
\subsubsection{Windows}
On Windows you need a compiler like Microsoft Visual Studio. You can build the library and the
example programs with the command line tool of the compiler by typing
\begin{verbatim}
nmake -f Makefile.nmake
\end{verbatim}
in the directory \textit{usrsctp}.
\subsection{Running the Test Programs}
There are two test programs included, a discard server and a client. You can run both to send data from the
client to the server. The client reads data from stdin and sends them to the server, which prints the message
in the terminal and discards it. The sources of the server are also provided in Section~\ref{server} and those
of the client in Section~\ref{client}.
\subsubsection{Using UDP Encapsulation}
Both programs can either send data over SCTP directly or use UDP encapsulation, thus encapsulating the
SCTP packet in a UDP datagram. The first mode works on loopback or in a protected setup without any
NAT boxes involved. In all other cases it is better to use UDP encapsulation.
The usage of the discard\_server is
\begin{verbatim}
discard_server [local_encaps_port remote_encaps_port]
\end{verbatim}
For UDP encapsulation the ports have to be specified. The local and remote encapsulation ports can be arbitrarily
set.
For example, you can call
\begin{verbatim}
./discard_server 11111 22222
\end{verbatim}
on a Unix-like OS and
\begin{verbatim}
discard_server.exe 11111 22222
\end{verbatim}
on Windows.
The client needs two additional parameters, the server's address and its port.
Its usage is
\begin{verbatim}
client remote_addr remote_port [local_port local_encaps_port remote_encaps_port]
\end{verbatim}
The remote address is the server's address. If client and server are started on the same machine,
the loopback address 127.0.0.1 can be used for Unix-like OSs and the local address on Windows.
The discard port is 9, thus 9 has to be taken as remote port. The encapsulation ports have to
match those of the server, i.e. the server's local\_encaps\_port is the client's
remote\_encaps\_port and vice versa. Thus, the client can be started with
\begin{verbatim}
./client 127.0.0.1 9 0 22222 11111
\end{verbatim}
on a Unix-like OS and
\begin{verbatim}
client.exe 192.168.0.1 9 0 22222 11111
\end{verbatim}
on Windows provided your local IP address is 192.168.0.1.
\subsubsection{Sending over SCTP}
To send data over SCTP directly you might need root privileges because raw sockets are used.
Thus instead of specifying the encapsulation ports you have to start the programs prepending
\texttt{sudo} or in case of Windows start the program from an administrator console.
\subsubsection{Using the Callback API}
Instead of asking constantly for new data, a callback API can be used that is triggered by
SCTP. A callback function has to be registered that will be called whenever data is ready to
be delivered to the application.
The discard\_server has a flag to switch between the two modi. If use\_cb is set to 1, the
callback API will be used. To change the setting, just set the flag and compile the program again.
\section{Basic Operations}
All system calls start with the prefix \textit{usrsctp\_} to distinguish them from the kernel variants.
Some of them are changed to account for the different demands in the userland environment.
\subsection{Differences to RFC 6458}
\subsubsection{usrsctp\_init()}
Every application has to start with \textit{usrsctp\_init()}. This function calls \textit{sctp\_init()} and reserves
the memory necessary to administer the data transfer.
The function prototype is
\begin{verbatim}
void
usrsctp_init(uint16_t udp_port)
\end{verbatim}
As it is not always possible to send data directly over SCTP because not all NAT boxes can
process SCTP packets, the data can be sent over UDP. To encapsulate SCTP into UDP
a UDP port has to be specified, to which the datagrams can be sent. This local UDP port is set
with the parameter \texttt{udp\_port}. The default value is 9899, the standard UDP encapsulation port.
If UDP encapsulation is not necessary, the UDP port has to be set to 0.
\subsubsection{usrsctp\_finish()}
At the end of the program \textit{usrsctp\_finish()} should be called to free all the memory that has been
allocated before.
The function prototype is
\begin{verbatim}
int
usrsctp_finish(void).
\end{verbatim}
The return code is 0 on success and -1 in case of an error.
\subsubsection{usrsctp\_socket()}
A representation of an SCTP endpoint is a socket. Is it created with \textit{usrsctp\_socket()}.
The function prototype is:
\begin{verbatim}
struct socket *
usrsctp_socket(int domain,
int type,
int protocol,
int (*receive_cb)(struct socket *sock,
union sctp_sockstore addr,
void *data,
size_t datalen,
struct sctp_rcvinfo,
int flags,
void *ulp_info),
int (*send_cb)(struct socket *sock,
uint32_t sb_free,
void *ulp_info),
uint32_t sb_threshold,
void *ulp_info).
\end{verbatim}
The arguments taken from RFC~6458 are:
\begin{itemize}
\item domain: PF\_INET or PF\_INET6 can be used.
\item type: In case of a one-to-many style socket it is SOCK\_SEQPACKET, in case of a one-to-one style
socket it is SOCK\_STREAM. For an explanation of the differences between the socket types please
refer to RFC~6458.
\item protocol: Set IPPROTO\_SCTP.
\end{itemize}
In usrsctp, a callback API can be used.
\begin{itemize}
\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}.
\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.
\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.
\end{itemize}
On success \textit{usrsctp\_socket()} returns the pointer to the new socket in the \texttt{struct socket} data type.
It will be needed in all other system calls. In case of a failure NULL is returned and
errno is set to the appropriate error code.
\subsubsection{usrsctp\_close()}
The function prototype of \textit{usrsctp\_close()} is
\begin{verbatim}
void
usrsctp_close(struct socket *so).
\end{verbatim}
Thus the only difference is the absence of a return code.
\subsection{Same Functionality as RFC 6458}
The following functions have the same functionality as their kernel pendants. There prototypes
are described in the following subsections. For a detailed description please refer to RFC~6458.
\subsubsection{usrsctp\_bind()}
The function prototype of \textit{usrsctp\_bind()} is
\begin{verbatim}
int
usrsctp_bind(struct socket *so,
struct sockaddr *addr,
socklen_t addrlen).
\end{verbatim}
The arguments are
\begin{itemize}
\item so: Pointer to the socket as returned by \textit{usrsctp\_socket()}.
\item addr: The address structure (struct sockaddr\_in for an IPv4 address
or struct sockaddr\_in6 for an IPv6 address).
\item addrlen: The size of the address structure.
\end{itemize}
\textit{usrsctp\_bind()} returns 0 on success and -1 in case of an error.
\subsubsection{usrsctp\_listen()}
The function prototype of \textit{usrsctp\_listen()} is
\begin{verbatim}
int
usrsctp_listen(struct socket *so,
int backlog).
\end{verbatim}
The arguments are
\begin{itemize}
\item so: Pointer to the socket as returned by \textit{usrsctp\_socket()}.
\item backlog: If backlog is non-zero, enable listening, else disable
listening.
\end{itemize}
\textit{usrsctp\_listen()} returns 0 on success and -1 in case of an error.
\subsubsection{usrsctp\_accept()}
The function prototype of \textit{usrsctp\_accept()} is
\begin{verbatim}
struct socket *
usrsctp_accept(struct socket *so,
struct sockaddr * addr,
socklen_t * addrlen).
\end{verbatim}
The arguments are
\begin{itemize}
\item so: Pointer to the socket as returned by \textit{usrsctp\_socket()}.
\item addr: On return, the primary address of the peer (struct sockaddr\_in for an IPv4 address or
struct sockaddr\_in6 for an IPv6 address).
\item addrlen: Size of the returned address structure.
\end{itemize}
\textit{usrsctp\_accept()} returns the accepted socket on success and NULL in case of an error.
\subsubsection{usrsctp\_connect()}
The function prototype of \textit{usrsctp\_connect()} is
\begin{verbatim}
int
usrsctp_connect(struct socket *so,
struct sockaddr *name,
socklen_t addrlen)
\end{verbatim}
The arguments are
\begin{itemize}
\item so: Pointer to the socket as returned by \textit{usrsctp\_socket()}.
\item name: Address of the peer to connect to (struct sockaddr\_in for an IPv4 address or
struct sockaddr\_in6 for an IPv6 address).
\item addrlen: Size of the peer's address.
\end{itemize}
\textit{usrsctp\_connect()} returns 0 on success and -1 in case of an error.
\subsubsection{usrsctp\_shutdown()}
The function prototype of \textit{usrsctp\_shutdown()} is
\begin{verbatim}
int
usrsctp_shutdown(struct socket *so, int how).
\end{verbatim}
The arguments are
\begin{itemize}
\item so: Pointer to the socket of the association to be closed.
\item how: Specifies the type of shutdown. The values are as follows:
\begin{itemize}
\item SHUT\_RD: Disables further receive operations. No SCTP protocol
action is taken.
\item SHUT\_WR: Disables further send operations, and initiates the SCTP
shutdown sequence.
\item SHUT\_RDWR: Disables further send and receive operations, and
initiates the SCTP shutdown sequence.
\end{itemize}
\end{itemize}
\textit{usrsctp\_shutdown()} returns 0 on success and -1 in case of an error.
\section{Sending and Receiving Data}
Since the publication of RFC~6458 there is only one function for sending and one for receiving
that is not deprecated. Therefore, only these two are described here.
\subsection{usrsctp\_sendv()}
The function prototype is
\begin{verbatim}
ssize_t
usrsctp_sendv(struct socket *so,
const void *data,
size_t len,
struct sockaddr *addrs,
int addrcnt,
void *info,
socklen_t infolen,
unsigned int infotype,
int flags).
\end{verbatim}
The arguments are
\begin{itemize}
\item so: The socket to send data on.
\item data: As it is more convenient to send data in a buffer and not a \texttt{struct iovec} data structure, we
chose to pass the data as a void pointer.
\item len: Length of the data.
\item addrs: In this version of usrsctp at most one destination address is supported. In the case of a connected
socket, the parameter \texttt{addrs} can be set to NULL.
\item addrcnt: Number of addresses. As at most one address is supported, addrcnt is 0 if addrs is NULL and
1 otherwise.
\item info: Additional information for a message is stored in \texttt{void *info}. The data types \texttt{struct~sctp\_sndinfo},
\texttt{struct~sctp\_prinfo}, and \texttt{struct} \linebreak \texttt{sctp\_sendv\_spa} are supported as defined in
RFC~6458. Support for \texttt{structsctp\_authinfo} is not implemented yet, therefore, errno is set EINVAL
and -1 will be returned, if it is used.
\item infolen: Length of info in bytes.
\item infotype: Identifies the type of the information provided in info. Possible values are
SCTP\_SENDV\_NOINFO, SCTP\_SENDV\_SNDINFO, \linebreak SCTP\_SENDV\_PRINFO, SCTP\_SENDV\_SPA.
For additional information please refer to RFC~6458.
\item flags: Flags as described in RFC~6458.
\end{itemize}
\textit{usrsctp\_sendv()} returns the number of bytes sent, or -1 if an error
occurred. The variable errno is then set appropriately.
\subsection{usrsctp\_recvv()}
The function prototype is
\begin{verbatim}
ssize_t
usrsctp_recvv(struct socket *so,
void *dbuf,
size_t len,
struct sockaddr *from,
socklen_t * fromlen,
void *info,
socklen_t *infolen,
unsigned int *infotype,
int *msg_flags).
\end{verbatim}
The arguments are
\begin{itemize}
\item so: The socket to receive data on.
\item dbuf: Analog to \textit{usrsctp\_sendv()} the data is returned in a buffer.
\item len: Length of the buffer in bytes.
\item from: A pointer to an address to be filled with the sender of the
received message's address.
\item fromlen: An in/out parameter describing the from length.
\item info: A pointer to the buffer to hold the attributes of the received
message. The structure type of info is determined by the
infotype parameter. The attributes returned in \texttt{info} have to be
handled in the same way as specified in RFC~6458.
\item infolen: An in/out parameter describing the size of the info buffer.
\item infotype: On return, *infotype is set to the type of the info
buffer. The current defined values are SCTP\_RECVV\_NOINFO,
SCTP\_RECVV\_RCVINFO, SCTP\_RECVV\_NXTINFO, and
SCTP\_RECVV\_RN. A detailed description is given in RFC~6458.
\item flags: A pointer to an integer to be filled with any message flags
(e.g., MSG\_NOTIFICATION). Note that this field is an in/out
parameter. Options for the receive may also be passed into the
value (e.g., MSG\_EOR). Returning from the call, the flags' value
will differ from its original value.
\end{itemize}
\textit{usrsctp\_recvv()} returns the number of bytes sent, or -1 if an error
occurred. The variable errno is then set appropriately.
\section{Socket Options}
Socket options are used to change the default behavior of socket calls.
Their behavior is specified in RFC~6458. The functions to get or set them are
\begin{verbatim}
int
usrsctp_getsockopt(struct socket *so,
int level,
int optname,
void *optval,
socklen_t *optlen)
\end{verbatim}
and
\begin{verbatim}
int
usrsctp_setsockopt(struct socket *so,
int level,
int optname,
const void *optval,
socklen_t optlen).
\end{verbatim}
and the arguments are
\begin{itemize}
\item so: The socket of type struct socket.
\item level: Set to IPPROTO\_SCTP for all SCTP options.
\item optname: The option name as specified in Table~\ref{options}.
\item optval: The buffer to store the value of the option as specified in the second column of Table~\ref{options}.
\item optlen: The size of the buffer (or the length of the option
returned in case of \textit{usrsctp\_getsockopt}).
\end{itemize}
These functions return 0 on success and -1 in case of an error.
\begin{longtable}{|l|l|c|}
\hline
{\bfseries Option}&{\bfseries Datatype} &{\bfseries r/w}\tabularnewline
\endhead
\hline
SCTP\_RTOINFO&struct sctp\_rtoinfo&r/w\tabularnewline \hline
SCTP\_ASSOCINFO&struct sctp\_assocparams&r/w\tabularnewline \hline
SCTP\_INITMSG&struct sctp\_initmsg&r/w\tabularnewline \hline
SCTP\_NODELAY&int&r/w\tabularnewline \hline
SCTP\_AUTOCLOSE&int&r/w\tabularnewline \hline
SCTP\_PRIMARY\_ADDR&struct sctp\_setprim&r/w\tabularnewline \hline
SCTP\_ADAPTATION\_LAYER&struct sctp\_setadaptation&r/w\tabularnewline \hline
SCTP\_DISABLE\_FRAGMENTS&int&r/w\tabularnewline \hline
SCTP\_PEER\_ADDR\_PARAMS&struct sctp\_paddrparams&r/w\tabularnewline \hline
SCTP\_I\_WANT\_MAPPED\_V4\_ADDR&int&r/w\tabularnewline \hline
SCTP\_MAXSEG&struct sctp\_assoc\_value&r/w\tabularnewline \hline
SCTP\_DELAYED\_SACK&struct sctp\_sack\_info&r/w\tabularnewline \hline
SCTP\_FRAGMENT\_INTERLEAVE&int&r/w\tabularnewline \hline
SCTP\_PARTIAL\_DELIVERY\_POINT&int&r/w\tabularnewline \hline
SCTP\_HMAC\_IDENT&struct sctp\_hmacalgo&r/w\tabularnewline \hline
SCTP\_AUTH\_ACTIVE\_KEY&struct sctp\_authkeyid&r/w\tabularnewline \hline
SCTP\_AUTO\_ASCONF&int&r/w\tabularnewline \hline
SCTP\_MAX\_BURST&struct sctp\_assoc\_value&r/w\tabularnewline \hline
SCTP\_CONTEXT&struct sctp\_assoc\_value&r/w\tabularnewline \hline
SCTP\_EXPLICIT\_EOR&int&r/w\tabularnewline \hline
SCTP\_REUSE\_PORT&int&r/w\tabularnewline \hline
SCTP\_EVENT&struct sctp\_event&r/w\tabularnewline \hline
SCTP\_RECVRCVINFO&int&r/w\tabularnewline \hline
SCTP\_RECVNXTINFO&int&r/w\tabularnewline \hline
SCTP\_DEFAULT\_SNDINFO&struct sctp\_sndinfo&r/w\tabularnewline \hline
SCTP\_DEFAULT\_PRINFO&struct sctp\_default\_prinfo&r/w\tabularnewline \hline
SCTP\_REMOTE\_UDP\_ENCAPS\_PORT&int&r/w\tabularnewline \hline
SCTP\_ENABLE\_STREAM\_RESET&struct sctp\_assoc\_value&r/w\tabularnewline \hline
SCTP\_STATUS&struct sctp\_status&r\tabularnewline \hline
SCTP\_GET\_PEER\_ADDR\_INFO&struct sctp\_paddrinfo&r\tabularnewline \hline
SCTP\_PEER\_AUTH\_CHUNKS&struct sctp\_authchunks&r\tabularnewline \hline
SCTP\_LOCAL\_AUTH\_CHUNKS&struct sctp\_authchunks&r\tabularnewline \hline
SCTP\_GET\_ASSOC\_NUMBER&uint32\_t&r\tabularnewline \hline
SCTP\_GET\_ASSOC\_ID\_LIST&struct sctp\_assoc\_ids&r\tabularnewline \hline
SCTP\_RESET\_STREAMS&struct sctp\_reset\_streams&w\tabularnewline \hline
SCTP\_RESET\_ASSOC&struct sctp\_assoc\_t&w\tabularnewline \hline
SCTP\_ADD\_STREAMS&struct sctp\_add\_streams&w\tabularnewline \hline
\caption{Socket Options supported by usrsctp}
\label{options}
\end{longtable}
An 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}.
\section{Sysctl variables}
In kernel implementations like for instance FreeBSD, it is possible to change parameters
in the operating system. These parameters are called sysctl variables.
In usrsctp applications can set or retrieve these variables with the functions
\begin{verbatim}
void
usrsctp_sysctl_set_ ## (uint32_t value)
\end{verbatim}
and
\begin{verbatim}
uint32_t
usrsctp_sysctl_get_ ## (void)
\end{verbatim}
respectively, where \#\# stands for the name of the variable.
In the following paragraphs a short description of the parameters will be given.
\subsection{Manipulate Memory}
\subsubsection{usrsctp\_sysctl\_set\_sctp\_sendspace()}
The space of the available send buffer can be changed from its default value of 262,144 bytes
to a value between 0 and $2^{32}-1$ bytes.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_recvspace()}
The space of the available receive buffer can be changed from its default value of 262,144 bytes
to a value between 0 and $2^{32}-1$ bytes.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_hashtblsize()}
The TCB (Thread Control Block) hash table sizes, i.e. the size of one TCB in the hash table, can be tuned between
1 and $2^{32}-1$ bytes. The default value is 1,024 bytes. A TCB contains for instance pointers to the socket, the
endpoint, information about the association and some statistic data.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_pcbtblsize()}
The PCB (Protocol Control Block) hash table sizes, i.e. the size of one PCB in the hash table, can be tuned between
1 and $2^{32}-1$ bytes. The default value is 256 bytes. The PCB contains all variables that characterize an endpoint.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_system\_free\_resc\_limit()}
This parameters tunes the maximum number of cached resources in the system. It can be set between
0 and $2^{32}-1$. The default value is 1000.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_asoc\_free\_resc\_limit()}
This parameters tunes the maximum number of cached resources in an association. It can be set between
0 and $2^{32}-1$. The default value is 10.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_mbuf\_threshold\_count()}
Data is stored in mbufs. Several mbufs can be chained together. The maximum number of small mbufs in a chain
can be set with this parameter, before an mbuf cluset is used. The default is 5.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_add\_more\_threshold()}
TBD
This parameter configures the threshold below which more space should be added to a socket send buffer.
The default value is 1452 bytes.
\subsection{Configure RTO}
The retransmission timeout (RTO), i.e. the time that controls the retransmission of messages, has
several parameters, that can be changed, for example to shorten the time, before a message is
retransmitted. The range of these parameters is between 0 and $2^{32}-1$~ms.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_rto\_max\_default()}
The default value for the maximum retransmission timeout in ms is 60,000 (60~secs).
\subsubsection{usrsctp\_sysctl\_set\_sctp\_rto\_min\_default()}
The default value for the minimum retransmission timeout in ms is 1,000 (1~sec).
\subsubsection{usrsctp\_sysctl\_set\_sctp\_rto\_initial\_default()}
The default value for the initial retransmission timeout in ms is 3,000 (3~sec). This value is only
needed before the first calculation of a round trip time took place.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_init\_rto\_max\_default()}
The default value for the maximum retransmission timeout for an INIT chunk in ms is 60,000 (60~secs).
\subsection{Set Timers}
\subsubsection{usrsctp\_sysctl\_set\_sctp\_valid\_cookie\_life\_default()}
A cookie has a specified life time. If it expires the cookie is not valid any more and an ABORT is sent.
The default value in ms is 60,000 (60~secs).
\subsubsection{usrsctp\_sysctl\_set\_sctp\_heartbeat\_interval\_default()}
Set the default time between two heartbeats. The default is 30,000~ms.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_shutdown\_guard\_time\_default()}
If a SHUTDOWN is not answered with a SHUTDOWN-ACK while the shutdown guard timer is still
running, the association will be aborted after the default of 180~secs.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_pmtu\_raise\_time\_default()}
TBD
To set the size of the packets to the highest value possible, the maximum transfer unit (MTU)
of the complete path has to be known. The default time interval for the path mtu discovery
is 600~secs.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_secret\_lifetime\_default()}
TBD
The default secret lifetime of a server is 3600~secs.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_vtag\_time\_wait()}
TBD
Vtag time wait time, 0 disables it. Default: 60~secs
\subsection{Set Failure Limits}
Transmissions and retransmissions of messages might fail. To protect the system against too many
retransmissions, limits have to be defined.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_init\_rtx\_max\_default()}
The default maximum number of retransmissions of an INIT chunks is 8, before an ABORT is sent.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_assoc\_rtx\_max\_default()}
This parameter sets the maximum number of failed retransmissions before the association is aborted.
The default value is 10.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_path\_rtx\_max\_default()}
This parameter sets the maximum number of path failures before the association is aborted.
The default value is 5. Notice that the number of paths multiplied by this value should be
equal to sctp\_assoc\_rtx\_max\_default. That means that the default configuration is good for two
paths.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_max\_retran\_chunk()}
The parameter configures how many times an unlucky chunk can be retransmitted before the
association aborts. The default is set to 30.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_path\_pf\_threshold()}
TBD
Default potentially failed threshold. Default: 65535
\subsubsection{usrsctp\_sysctl\_set\_sctp\_abort\_if\_one\_2\_one\_hits\_limit()}
TBD
When one-2-one hits qlimit abort. Default: 0
\subsection{Control the Sending of SACKs}
\subsubsection{usrsctp\_sysctl\_set\_sctp\_sack\_freq\_default()}
The SACK frequency defines the number of packets that are awaited, before a SACK is sent.
The default value is 2.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_delayed\_sack\_time\_default()}
As a SACK (Selective Acknowledgment) is sent after every other packet, a timer is set to send a
SACK in case another packet does not arrive in due time. The default value for this timer is
200~ms.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_strict\_sacks()}
TBD
This is a flag to turn the controlling of the coherence of SACKs on or off. The default value is
1 (on).
\subsubsection{usrsctp\_sysctl\_set\_sctp\_nr\_sack\_on\_off()}
If a slow hosts receives data on a lossy link it is possible that its receiver window is full and new
data can only be accepted if one chunk with a higher TSN (Transmission Sequence Number) that has
previously been acknowledged is dropped. As a consequence the sender has to store data, even if
they have been acknowledged in case they have to be retransmitted. If this behavior is not necessary,
non-renegable SACKs can be turned on.
By default the use of non-renegable SACKs is turned off.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_enable\_sack\_immediately()}
In some cases it is not desirable to wait for the SACK timer to expire before a SACK is sent. In these
cases a bit called SACK-IMMEDIATELY~\cite{sack-imm} can be set to provoke the instant sending of a SACK.
The default is to turn it off.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_L2\_abc\_variable()}
TBD
SCTP ABC max increase per SACK (L). Default: 1
\subsection{Change Max Burst}
Max burst defines the maximum number of packets that may be sent in one flight.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_max\_burst\_default()}
The default value for max burst is 0, which means that the number of packets sent as a flight
is not limited by this parameter, but may be by another one, see the next paragraph.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_use\_cwnd\_based\_maxburst()}
The use of max burst is based on the size of the congestion window (cwnd).
This parameter is set by default.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_hb\_maxburst()}
Heartbeats are mostly used to verify a path. Their number can be limited. The default is 4.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_fr\_max\_burst\_default()}
In the state of fast retransmission the number of packet bursts can be limited. The default
value is 4.
\subsection{Handle Chunks}
\subsubsection{usrsctp\_sysctl\_set\_sctp\_peer\_chunk\_oh()}
In order to keep track of the peer's advertised receiver window, the sender calculates the window by
subtracting the amount of data sent. Yet, some OSs reduce the receiver window by the real space needed
to store the data. This parameter sets the additional amount to debit the peer's receiver window per
chunk sent. The default value is 256, which is the value needed by FreeBSD.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_max\_chunks\_on\_queue()}
This parameter sets the maximum number of chunks that can be queued per association. The default
value is 512.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_min\_split\_point()}
TBD
The minimum size when splitting a chunk is 2904 bytes by default.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_chunkscale()}
TBD
This parameter can be tuned for scaling of number of chunks and messages. The default is10.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_min\_residual()}
TBD
This parameter configures the minimum size of the residual data chunk in the second
part of the split. The default is 1452.
\subsection{Calculate RTT}
The calculation of the round trip time (RTT) depends on several parameters.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_rttvar\_bw()}
TBD
Shift amount for bw smoothing on rtt calc. Default: 4
\subsubsection{usrsctp\_sysctl\_set\_sctp\_rttvar\_rtt()}
TBD
Shift amount for rtt smoothing on rtt calc. Default: 5
\subsubsection{usrsctp\_sysctl\_set\_sctp\_rttvar\_eqret()}
TBD
What to return when rtt and bw are unchanged. Default: 0
\subsection{Influence the Congestion Control}
The congestion control should protect the network against fast senders.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_ecn\_enable}
Explicit congestion notifications are turned on by default.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_default\_cc\_module()}
This parameter sets the default algorithm for the congestion control.
Default is 0, i.e. the one specified in RFC~4960.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_initial\_cwnd()}
Set the initial congestion window in MTUs. The default is 3.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_use\_dccc\_ecn()}
TBD
Enable for RTCC CC datacenter ECN. Default: 1
\subsubsection{usrsctp\_sysctl\_set\_sctp\_steady\_step()}
TBD
How many the sames it takes to try step down of cwnd. Default: 20
\subsection{Configure AUTH and ADD-IP}
An important extension of SCTP is the dynamic address reconfiguration~\cite{addip}, also known as
ADD-IP, which allows the changing of addresses during the lifetime of an association.
For this feature the AUTH extension~\cite{auth} is necessary.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_auto\_asconf()}
If SCTP Auto-ASCONF is enabled, the peer is informed automatically when a new address
is added or removed. This feature is enabled by default.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_multiple\_asconfs()}
By default the sending of multiple ASCONFs is disabled.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_auth\_disable()}
The use of AUTH, which is normally turned on, can be disabled by setting this parameter to 1.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_asconf\_auth\_nochk()}
It is also possible to disable the requirement to use AUTH in conjunction with ADD-IP by setting this parameter
to 1.
\subsection{Concurrent Multipath Transfer (CMT)}
A prominent feature of SCTP is the possibility to use several addresses for the same association.
One is the primary path, and the others are needed in case of a path failure. Using CMT the data is sent
on several paths to enhance the throughput.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_cmt\_on\_off()}
To turn CMT on, this parameter has to be set to 1.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_cmt\_use\_dac()}
To use delayed acknowledgments with CMT this parameter has to be set to 1.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_buffer\_splitting()}
For CMT it makes sense to split the send and receive buffer to have shares for each path.
By default buffer splitting is turned off.
\subsection{Network Address Translation (NAT)}
To be able to pass NAT boxes, the boxes have to handle SCTP packets in a specific way.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_nat\_friendly()}
SCTP NAT friendly operation. Default:1
\subsubsection{usrsctp\_sysctl\_set\_sctp\_inits\_include\_nat\_friendly()}
Enable sending of the nat-friendly SCTP option on INITs. Default: 0
\subsubsection{usrsctp\_sysctl\_set\_sctp\_udp\_tunneling\_port()}
Set the SCTP/UDP tunneling port. Default: 9899
\subsection{SCTP Mobility}
\subsubsection{usrsctp\_sysctl\_set\_sctp\_mobility\_base()}
TBD
Enable SCTP base mobility. Default: 0
\subsubsection{usrsctp\_sysctl\_set\_sctp\_mobility\_fasthandoff()}
TBD
Enable SCTP fast handoff. default: 0
\subsection{Miscellaneous}
\subsubsection{usrsctp\_sysctl\_set\_sctp\_no\_csum\_on\_loopback()}
Calculating the checksum for packets sent on loopback is turned off by default.
To turn it on, set this parameter to 0.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_nr\_outgoing\_streams\_default()}
The peer is notified about the number of outgoing streams in the INIT or INIT-ACK chunk.
The default is 10.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_do\_drain()}
Determines whether SCTP should respond to the drain calls. Default: 1
\subsubsection{usrsctp\_sysctl\_set\_sctp\_strict\_data\_order()}
TBD
Enforce strict data ordering, abort if control inside data. Default: 0
\subsubsection{usrsctp\_sysctl\_set\_sctp\_default\_ss\_module()}
Set the default stream scheduling module. Implemented modules are:
SCTP\_SS\_DEFAULT, SCTP\_SS\_ROUND\_ROBIN, SCTP\_SS\_ROUND\_ROBIN\_PACKET,
SCTP\_SS\_PRIORITY, SCTP\_SS\_FAIR\_BANDWITH, and SCTP\_SS\_FIRST\_COME.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_default\_frag\_interleave()}
TBD
Default fragment interleave level. Default: 1
\subsubsection{usrsctp\_sysctl\_set\_sctp\_blackhole()}
TBD
Enable SCTP blackholing. Default: 0
\subsubsection{usrsctp\_sysctl\_set\_sctp\_logging\_level()}
Set the logging level. The default is 0.
\subsubsection{usrsctp\_sysctl\_set\_sctp\_debug\_on()}
Turn debug output on or off. It is disabled by default. To obtain debug output,
SCTP\_DEBUG has to be set as a compile flag.
%The following variables are supported:
%\begin{longtable}{|l|l|c|}
%\hline
%{\bfseries Parameter}&{\bfseries Meaning}&{\bfseries Default Value} \tabularnewline
%\endhead
%\hline
%sctp\_sendspace&Send buffer space&1864135\tabularnewline \hline
%sctp\_recvspace&Receive buffer space&1864135 \tabularnewline \hline
%sctp\_hashtblsize&Tunable for TCB hash table sizes&1024 \tabularnewline \hline
%sctp\_pcbtblsize&Tunable for PCB hash table sizes&256 \tabularnewline \hline
%sctp\_system\_free\_resc\_limit&Cached resources in the system&1000 \tabularnewline \hline
%sctp\_asoc\_free\_resc\_limit&Cashed resources in an association&10 \tabularnewline \hline
%sctp\_rto\_max\_default&Default value for RTO\_max&60000~ms \tabularnewline \hline
%sctp\_rto\_min\_default&Default value for RTO\_min&1000~ms \tabularnewline \hline
%sctp\_rto\_initial\_default&Default value for RTO\_initial&3000~ms \tabularnewline \hline
%sctp\_init\_rto\_max\_default&Default value for the maximum RTO&60000~ms \tabularnewline
% &for sending an INIT& \tabularnewline \hline
%sctp\_valid\_cookie\_life\_default&Valid cookie life time&60000~ms \tabularnewline \hline
%sctp\_init\_rtx\_max\_default&Maximum number of INIT retransmissions&8 \tabularnewline \hline
%sctp\_assoc\_rtx\_max\_default&Maximum number of failed retransmissions&10\tabularnewline
% & before the association is aborted&\tabularnewline \hline
%sctp\_path\_rtx\_max\_default&Maximum number of failed retransmissions&5\tabularnewline
% &before a path fails&\tabularnewline \hline
%sctp\_ecn\_enable&Enabling explicit congestion notifications&1\tabularnewline \hline
%sctp\_strict\_sacks&Control the coherence of SACKs&1 \tabularnewline \hline
%sctp\_delayed\_sack\_time\_default&Default delayed SACK timer&200~ms\tabularnewline \hline
%sctp\_sack\_freq\_default&Default SACK frequency&2 \tabularnewline \hline
%sctp\_nr\_sack\_on\_off&Turn non-renegable SACKs on or off&0 \tabularnewline \hline
%sctp\_enable\_sack\_immediately&Enable sending of the SACK-&0 \tabularnewline &IMMEDIATELY bit.&\tabularnewline \hline
%sctp\_no\_csum\_on\_loopback&Enable the compilation of the checksum on&1 \tabularnewline
% &packets sent on loopback&\tabularnewline \hline
%sctp\_peer\_chunk\_oh&Amount to debit peers rwnd per chunk sent&256 \tabularnewline \hline
%sctp\_max\_burst\_default&Default max burst for SCTP endpoints&0 \tabularnewline \hline
%sctp\_use\_cwnd\_based\_maxburst&Use max burst based on the size of &1\tabularnewline % &the congestion window&\tabularnewline \hline
%sctp\_hb\_maxburst&Confirmation Heartbeat max burst&4 \tabularnewline \hline
%sctp\_max\_chunks\_on\_queue&Default max chunks on queue per asoc&512 \tabularnewline \hline
%sctp\_min\_split\_point&Minimum size when splitting a chunk&2904 \tabularnewline \hline
%sctp\_chunkscale&Tunable for Scaling of number of chunks and&10\tabularnewline
% &messages&\tabularnewline \hline
%sctp\_mbuf\_threshold\_count&Maximum number of small mbufs in a chain&5\tabularnewline \hline
%sctp\_heartbeat\_interval\_default&Default time between two Heartbeats&30000~ms\tabularnewline \hline
%sctp\_pmtu\_raise\_time\_default&Default PMTU raise timer&600~secs\tabularnewline \hline
%sctp\_shutdown\_guard\_time\_default&Default shutdown guard timer&180~secs\tabularnewline \hline
%sctp\_secret\_lifetime\_default&Default secret lifetime&3600~secs \tabularnewline \hline
%sctp\_add\_more\_threshold&Threshold when more space should &1452\tabularnewline
% &be added to a socket send buffer&\tabularnewline \hline
%sctp\_nr\_outgoing\_streams\_default&Default number of outgoing streams&10\tabularnewline \hline
%sctp\_cmt\_on\_off&Turn CMT on or off.&0\tabularnewline \hline
%sctp\_cmt\_use\_dac&Use delayed acknowledgment for CMT&0\tabularnewline \hline
%sctp\_fr\_max\_burst\_default&Default max burst for SCTP endpoints when &4\tabularnewline
% &fast retransmitting&\tabularnewline \hline
%sctp\_auto\_asconf&Enable SCTP Auto-ASCONF&1\tabularnewline \hline
%sctp\_multiple\_asconfs&Enable SCTP Multiple-ASCONFs&0 \tabularnewline \hline
%sctp\_asconf\_auth\_nochk&Disable SCTP ASCONF AUTH requirement&0\tabularnewline \hline
%sctp\_auth\_disable&Disable SCTP AUTH function&0\tabularnewline \hline
%sctp\_nat\_friendly&SCTP NAT friendly operation&1\tabularnewline \hline
%sctp\_inits\_include\_nat\_friendly&Enable sending of the nat-friendly &0\tabularnewline
% &SCTP option on INITs.&\tabularnewline \hline
%sctp\_udp\_tunneling\_port&Set the SCTP/UDP tunneling port&9899\tabularnewline \hline
%sctp\_do\_drain&Determines whether SCTP should respond&1\tabularnewline
% &to the drain calls&\tabularnewline \hline
%sctp\_abort\_if\_one\_2\_one\_hits\_limit&When one-2-one hits qlimit abort&0 \tabularnewline \hline
%sctp\_strict\_data\_order&Enforce strict data ordering, abort if control&0\tabularnewline
% &inside data&\tabularnewline \hline
%sctp\_min\_residual&Minimum residual data chunk in second&1452\tabularnewline
% &part of split&\tabularnewline \hline
%sctp\_max\_retran\_chunk&Maximum times an unlucky chunk can be&30\tabularnewline
% & retransmitted before the association aborts&\tabularnewline \hline
%sctp\_default\_cc\_module&Default congestion control module&0\tabularnewline \hline
%sctp\_default\_ss\_module&Default stream scheduling module&0 \tabularnewline \hline
%sctp\_default\_frag\_interleave&Default fragment interleave level&1\tabularnewline \hline
%sctp\_mobility\_base&Enable SCTP base mobility&0\tabularnewline \hline
%sctp\_mobility\_fasthandoff&Enable SCTP fast handoff&0\tabularnewline \hline
%sctp\_L2\_abc\_variable&SCTP ABC max increase per SACK (L)&1\tabularnewline \hline
%sctp\_vtag\_time\_wait&Vtag time wait time, 0 disables it.&60~secs\tabularnewline \hline
%sctp\_blackhole&Enable SCTP blackholing&0\tabularnewline \hline
%sctp\_path\_pf\_threshold&Default potentially failed threshold&65535\tabularnewline \hline
%sctp\_rttvar\_bw&Shift amount for bw smoothing on rtt calc&4 \tabularnewline \hline
%sctp\_rttvar\_rtt&Shift amount for rtt smoothing on rtt calc&5 \tabularnewline \hline
%sctp\_rttvar\_eqret &What to return when rtt and bw are&0\tabularnewline
% &unchanged&\tabularnewline \hline
%sctp\_steady\_step&How many the sames it takes to try step&20\tabularnewline
% &down of cwnd&\tabularnewline \hline
%sctp\_use\_dccc\_ecn&Enable for RTCC CC datacenter ECN&1 \tabularnewline \hline
%sctp\_buffer\_splitting&Enable send/receive buffer splitting&0 \tabularnewline \hline
%sctp\_initial\_cwnd&Initial congestion window in MTUs&3\tabularnewline \hline
%sctp\_logging\_level&Logging level&0 \tabularnewline \hline
%sctp\_debug\_on&Turns debug output on or off.&0 \tabularnewline \hline
%\caption{Sysctl variables supported by usrsctp}
%\end{longtable}
\section{Examples}
\subsection{Discard Server}\label{server}
\begin{verbatim}
/*
* Copyright (C) 2011-2012 Michael Tuexen
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Usage: discard_server [local_encaps_port] [remote_encaps_port]
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#if !defined(_WIN32)
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
#include <usrsctp.h>
#define BUFFER_SIZE 10240
const int use_cb = 0;
static int
receive_cb(struct socket *sock, union sctp_sockstore addr, void *data,
size_t datalen, struct sctp_rcvinfo rcv, int flags)
{
char name[INET6_ADDRSTRLEN];
if (data) {
if (flags & MSG_NOTIFICATION) {
printf("Notification of length %d received.\n", (int)datalen);
} else {
printf("Msg of length %d received from %s:%u on stream %d with "
"SSN %u and TSN %u, PPID %d, context %u.\n",
(int)datalen,
addr.sa.sa_family == AF_INET ?
inet_ntop(AF_INET, &addr.sin.sin_addr, name,