webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
usrsctp.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2009-2010 Brad Penoff
3  * Copyright (c) 2009-2010 Humaira Kamal
4  * Copyright (c) 2011-2012 Irene Ruengeler
5  * Copyright (c) 2011-2012 Michael Tuexen
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  */
30 
31 #ifndef __USRSCTP_H__
32 #define __USRSCTP_H__
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #include <errno.h>
39 #include <sys/types.h>
40 #ifdef _WIN32
41 #ifdef _MSC_VER
42 #pragma warning(disable: 4200)
43 #endif
44 #include <winsock2.h>
45 #include <ws2tcpip.h>
46 #else
47 #include <sys/socket.h>
48 #include <netinet/in.h>
49 #endif
50 
51 #ifndef MSG_NOTIFICATION
52 /* This definition MUST be in sync with usrsctplib/user_socketvar.h */
53 #define MSG_NOTIFICATION 0x2000
54 #endif
55 
56 #ifndef IPPROTO_SCTP
57 /* This is the IANA assigned protocol number of SCTP. */
58 #define IPPROTO_SCTP 132
59 #endif
60 
61 #ifdef _WIN32
62 #if defined(_MSC_VER) && _MSC_VER >= 1600
63 #include <stdint.h>
64 #elif defined(SCTP_STDINT_INCLUDE)
65 #include SCTP_STDINT_INCLUDE
66 #else
67 #define uint8_t unsigned __int8
68 #define uint16_t unsigned __int16
69 #define uint32_t unsigned __int32
70 #define uint64_t unsigned __int64
71 #define int16_t __int16
72 #define int32_t __int32
73 #endif
74 
75 #define ssize_t __int64
76 #define MSG_EOR 0x8
77 #ifndef EWOULDBLOCK
78 #define EWOULDBLOCK WSAEWOULDBLOCK
79 #endif
80 #ifndef EINPROGRESS
81 #define EINPROGRESS WSAEINPROGRESS
82 #endif
83 #define SHUT_RD 1
84 #define SHUT_WR 2
85 #define SHUT_RDWR 3
86 #endif
87 
89 
90 #define AF_CONN 123
91 /* The definition of struct sockaddr_conn MUST be in
92  * tune with other sockaddr_* structures.
93  */
94 #if defined(__APPLE__) || defined(__Bitrig__) || defined(__DragonFly__) || \
95  defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
96 struct sockaddr_conn {
97  uint8_t sconn_len;
100  void *sconn_addr;
101 };
102 #else
103 struct sockaddr_conn {
106  void *sconn_addr;
107 };
108 #endif
109 
110 union sctp_sockstore {
111 #if defined(INET)
112  struct sockaddr_in sin;
113 #endif
114 #if defined(INET6)
115  struct sockaddr_in6 sin6;
116 #endif
117  struct sockaddr_conn sconn;
118  struct sockaddr sa;
119 };
120 
121 #define SCTP_FUTURE_ASSOC 0
122 #define SCTP_CURRENT_ASSOC 1
123 #define SCTP_ALL_ASSOC 2
124 
125 /*** Structures and definitions to use the socket API ***/
126 
127 #define SCTP_ALIGN_RESV_PAD 92
128 #define SCTP_ALIGN_RESV_PAD_SHORT 76
129 
130 struct sctp_rcvinfo {
131  uint16_t rcv_sid;
132  uint16_t rcv_ssn;
133  uint16_t rcv_flags;
134  uint32_t rcv_ppid;
135  uint32_t rcv_tsn;
136  uint32_t rcv_cumtsn;
137  uint32_t rcv_context;
138  sctp_assoc_t rcv_assoc_id;
139 };
140 
141 struct sctp_nxtinfo {
142  uint16_t nxt_sid;
143  uint16_t nxt_flags;
144  uint32_t nxt_ppid;
145  uint32_t nxt_length;
146  sctp_assoc_t nxt_assoc_id;
147 };
148 
149 #define SCTP_NO_NEXT_MSG 0x0000
150 #define SCTP_NEXT_MSG_AVAIL 0x0001
151 #define SCTP_NEXT_MSG_ISCOMPLETE 0x0002
152 #define SCTP_NEXT_MSG_IS_UNORDERED 0x0004
153 #define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008
154 
155 struct sctp_recvv_rn {
156  struct sctp_rcvinfo recvv_rcvinfo;
157  struct sctp_nxtinfo recvv_nxtinfo;
158 };
159 
160 #define SCTP_RECVV_NOINFO 0
161 #define SCTP_RECVV_RCVINFO 1
162 #define SCTP_RECVV_NXTINFO 2
163 #define SCTP_RECVV_RN 3
164 
165 #define SCTP_SENDV_NOINFO 0
166 #define SCTP_SENDV_SNDINFO 1
167 #define SCTP_SENDV_PRINFO 2
168 #define SCTP_SENDV_AUTHINFO 3
169 #define SCTP_SENDV_SPA 4
170 
171 #define SCTP_SEND_SNDINFO_VALID 0x00000001
172 #define SCTP_SEND_PRINFO_VALID 0x00000002
173 #define SCTP_SEND_AUTHINFO_VALID 0x00000004
174 
175 struct sctp_snd_all_completes {
176  uint16_t sall_stream;
177  uint16_t sall_flags;
178  uint32_t sall_ppid;
179  uint32_t sall_context;
180  uint32_t sall_num_sent;
181  uint32_t sall_num_failed;
182 };
183 
184 struct sctp_sndinfo {
185  uint16_t snd_sid;
186  uint16_t snd_flags;
187  uint32_t snd_ppid;
188  uint32_t snd_context;
189  sctp_assoc_t snd_assoc_id;
190 };
191 
192 struct sctp_prinfo {
193  uint16_t pr_policy;
194  uint32_t pr_value;
195 };
196 
197 struct sctp_authinfo {
198  uint16_t auth_keynumber;
199 };
200 
201 struct sctp_sendv_spa {
202  uint32_t sendv_flags;
203  struct sctp_sndinfo sendv_sndinfo;
204  struct sctp_prinfo sendv_prinfo;
205  struct sctp_authinfo sendv_authinfo;
206 };
207 
208 struct sctp_udpencaps {
209  struct sockaddr_storage sue_address;
211  uint16_t sue_port;
212 };
213 
214 /******** Notifications **************/
215 
216 /* notification types */
217 #define SCTP_ASSOC_CHANGE 0x0001
218 #define SCTP_PEER_ADDR_CHANGE 0x0002
219 #define SCTP_REMOTE_ERROR 0x0003
220 #define SCTP_SEND_FAILED 0x0004
221 #define SCTP_SHUTDOWN_EVENT 0x0005
222 #define SCTP_ADAPTATION_INDICATION 0x0006
223 #define SCTP_PARTIAL_DELIVERY_EVENT 0x0007
224 #define SCTP_AUTHENTICATION_EVENT 0x0008
225 #define SCTP_STREAM_RESET_EVENT 0x0009
226 #define SCTP_SENDER_DRY_EVENT 0x000a
227 #define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b
228 #define SCTP_ASSOC_RESET_EVENT 0x000c
229 #define SCTP_STREAM_CHANGE_EVENT 0x000d
230 #define SCTP_SEND_FAILED_EVENT 0x000e
231 
232 /* notification event structures */
233 
234 
235 /* association change event */
236 struct sctp_assoc_change {
237  uint16_t sac_type;
238  uint16_t sac_flags;
239  uint32_t sac_length;
240  uint16_t sac_state;
241  uint16_t sac_error;
242  uint16_t sac_outbound_streams;
243  uint16_t sac_inbound_streams;
244  sctp_assoc_t sac_assoc_id;
245  uint8_t sac_info[]; /* not available yet */
246 };
247 
248 /* sac_state values */
249 #define SCTP_COMM_UP 0x0001
250 #define SCTP_COMM_LOST 0x0002
251 #define SCTP_RESTART 0x0003
252 #define SCTP_SHUTDOWN_COMP 0x0004
253 #define SCTP_CANT_STR_ASSOC 0x0005
254 
255 /* sac_info values */
256 #define SCTP_ASSOC_SUPPORTS_PR 0x01
257 #define SCTP_ASSOC_SUPPORTS_AUTH 0x02
258 #define SCTP_ASSOC_SUPPORTS_ASCONF 0x03
259 #define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x04
260 #define SCTP_ASSOC_SUPPORTS_RE_CONFIG 0x05
261 #define SCTP_ASSOC_SUPPORTS_MAX 0x05
262 
263 /* Address event */
264 struct sctp_paddr_change {
265  uint16_t spc_type;
266  uint16_t spc_flags;
267  uint32_t spc_length;
268  struct sockaddr_storage spc_aaddr;
269  uint32_t spc_state;
270  uint32_t spc_error;
271  sctp_assoc_t spc_assoc_id;
272  uint8_t spc_padding[4];
273 };
274 
275 /* paddr state values */
276 #define SCTP_ADDR_AVAILABLE 0x0001
277 #define SCTP_ADDR_UNREACHABLE 0x0002
278 #define SCTP_ADDR_REMOVED 0x0003
279 #define SCTP_ADDR_ADDED 0x0004
280 #define SCTP_ADDR_MADE_PRIM 0x0005
281 #define SCTP_ADDR_CONFIRMED 0x0006
282 
283 /* remote error events */
284 struct sctp_remote_error {
285  uint16_t sre_type;
286  uint16_t sre_flags;
287  uint32_t sre_length;
288  uint16_t sre_error;
289  sctp_assoc_t sre_assoc_id;
290  uint8_t sre_data[4];
291 };
292 
293 /* shutdown event */
294 struct sctp_shutdown_event {
295  uint16_t sse_type;
296  uint16_t sse_flags;
297  uint32_t sse_length;
298  sctp_assoc_t sse_assoc_id;
299 };
300 
301 /* Adaptation layer indication */
302 struct sctp_adaptation_event {
303  uint16_t sai_type;
304  uint16_t sai_flags;
305  uint32_t sai_length;
306  uint32_t sai_adaptation_ind;
307  sctp_assoc_t sai_assoc_id;
308 };
309 
310 /* Partial delivery event */
311 struct sctp_pdapi_event {
312  uint16_t pdapi_type;
313  uint16_t pdapi_flags;
314  uint32_t pdapi_length;
315  uint32_t pdapi_indication;
318  sctp_assoc_t pdapi_assoc_id;
319 };
320 
321 /* indication values */
322 #define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001
323 
324 /* SCTP authentication event */
325 struct sctp_authkey_event {
326  uint16_t auth_type;
327  uint16_t auth_flags;
328  uint32_t auth_length;
329  uint16_t auth_keynumber;
330  uint32_t auth_indication;
331  sctp_assoc_t auth_assoc_id;
332 };
333 
334 /* indication values */
335 #define SCTP_AUTH_NEW_KEY 0x0001
336 #define SCTP_AUTH_NO_AUTH 0x0002
337 #define SCTP_AUTH_FREE_KEY 0x0003
338 
339 /* SCTP sender dry event */
340 struct sctp_sender_dry_event {
341  uint16_t sender_dry_type;
342  uint16_t sender_dry_flags;
343  uint32_t sender_dry_length;
344  sctp_assoc_t sender_dry_assoc_id;
345 };
346 
347 
348 /* Stream reset event - subscribe to SCTP_STREAM_RESET_EVENT */
350  uint16_t strreset_type;
351  uint16_t strreset_flags;
352  uint32_t strreset_length;
353  sctp_assoc_t strreset_assoc_id;
354  uint16_t strreset_stream_list[];
355 };
356 
357 /* flags in stream_reset_event (strreset_flags) */
358 #define SCTP_STREAM_RESET_INCOMING_SSN 0x0001
359 #define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002
360 #define SCTP_STREAM_RESET_DENIED 0x0004 /* SCTP_STRRESET_FAILED */
361 #define SCTP_STREAM_RESET_FAILED 0x0008 /* SCTP_STRRESET_FAILED */
362 #define SCTP_STREAM_CHANGED_DENIED 0x0010
363 
364 #define SCTP_STREAM_RESET_INCOMING 0x00000001
365 #define SCTP_STREAM_RESET_OUTGOING 0x00000002
366 
367 
368 /* Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT */
369 struct sctp_assoc_reset_event {
370  uint16_t assocreset_type;
371  uint16_t assocreset_flags;
372  uint32_t assocreset_length;
373  sctp_assoc_t assocreset_assoc_id;
374  uint32_t assocreset_local_tsn;
375  uint32_t assocreset_remote_tsn;
376 };
377 
378 #define SCTP_ASSOC_RESET_DENIED 0x0004
379 #define SCTP_ASSOC_RESET_FAILED 0x0008
380 
381 
382 /* Stream change event - subscribe to SCTP_STREAM_CHANGE_EVENT */
384  uint16_t strchange_type;
385  uint16_t strchange_flags;
386  uint32_t strchange_length;
387  sctp_assoc_t strchange_assoc_id;
388  uint16_t strchange_instrms;
389  uint16_t strchange_outstrms;
390 };
391 
392 #define SCTP_STREAM_CHANGE_DENIED 0x0004
393 #define SCTP_STREAM_CHANGE_FAILED 0x0008
394 
395 
396 /* SCTP send failed event */
397 struct sctp_send_failed_event {
398  uint16_t ssfe_type;
399  uint16_t ssfe_flags;
400  uint32_t ssfe_length;
401  uint32_t ssfe_error;
402  struct sctp_sndinfo ssfe_info;
403  sctp_assoc_t ssfe_assoc_id;
404  uint8_t ssfe_data[];
405 };
406 
407 /* flag that indicates state of data */
408 #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */
409 #define SCTP_DATA_SENT 0x0002 /* on wire at failure */
410 
411 /* SCTP event option */
412 struct sctp_event {
413  sctp_assoc_t se_assoc_id;
414  uint16_t se_type;
415  uint8_t se_on;
416 };
417 
418 union sctp_notification {
419  struct sctp_tlv {
423  } sn_header;
424  struct sctp_assoc_change sn_assoc_change;
425  struct sctp_paddr_change sn_paddr_change;
426  struct sctp_remote_error sn_remote_error;
427  struct sctp_shutdown_event sn_shutdown_event;
428  struct sctp_adaptation_event sn_adaptation_event;
429  struct sctp_pdapi_event sn_pdapi_event;
430  struct sctp_authkey_event sn_auth_event;
431  struct sctp_sender_dry_event sn_sender_dry_event;
432  struct sctp_send_failed_event sn_send_failed_event;
433  struct sctp_stream_reset_event sn_strreset_event;
434  struct sctp_assoc_reset_event sn_assocreset_event;
435  struct sctp_stream_change_event sn_strchange_event;
436 };
437 
438 struct sctp_event_subscribe {
439  uint8_t sctp_data_io_event;
440  uint8_t sctp_association_event;
441  uint8_t sctp_address_event;
442  uint8_t sctp_send_failure_event;
443  uint8_t sctp_peer_error_event;
445  uint8_t sctp_partial_delivery_event;
446  uint8_t sctp_adaptation_layer_event;
447  uint8_t sctp_authentication_event;
450 };
451 
452 
453 
454 /* Flags that go into the sinfo->sinfo_flags field */
455 #define SCTP_NOTIFICATION 0x0010 /* next message is a notification */
456 #define SCTP_COMPLETE 0x0020 /* next message is complete */
457 #define SCTP_EOF 0x0100 /* Start shutdown procedures */
458 #define SCTP_ABORT 0x0200 /* Send an ABORT to peer */
459 #define SCTP_UNORDERED 0x0400 /* Message is un-ordered */
460 #define SCTP_ADDR_OVER 0x0800 /* Override the primary-address */
461 #define SCTP_SENDALL 0x1000 /* Send this on all associations */
462 #define SCTP_EOR 0x2000 /* end of message signal */
463 #define SCTP_SACK_IMMEDIATELY 0x4000 /* Set I-Bit */
464 
465 #define INVALID_SINFO_FLAG(x) (((x) & 0xfffffff0 \
466  & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\
467  SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR |\
468  SCTP_SACK_IMMEDIATELY)) != 0)
469 /* for the endpoint */
470 
471 /* The lower byte is an enumeration of PR-SCTP policies */
472 #define SCTP_PR_SCTP_NONE 0x0000 /* Reliable transfer */
473 #define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */
474 #define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */
475 #define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */
476 
477 #define PR_SCTP_POLICY(x) ((x) & 0x0f)
478 #define PR_SCTP_ENABLED(x) (PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE)
479 #define PR_SCTP_TTL_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL)
480 #define PR_SCTP_BUF_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF)
481 #define PR_SCTP_RTX_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX)
482 #define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX)
483 
484 
485 /*
486  * user socket options: socket API defined
487  */
488 /*
489  * read-write options
490  */
491 #define SCTP_RTOINFO 0x00000001
492 #define SCTP_ASSOCINFO 0x00000002
493 #define SCTP_INITMSG 0x00000003
494 #define SCTP_NODELAY 0x00000004
495 #define SCTP_AUTOCLOSE 0x00000005
496 #define SCTP_PRIMARY_ADDR 0x00000007
497 #define SCTP_ADAPTATION_LAYER 0x00000008
498 #define SCTP_DISABLE_FRAGMENTS 0x00000009
499 #define SCTP_PEER_ADDR_PARAMS 0x0000000a
500 /* ancillary data/notification interest options */
501 /* Without this applied we will give V4 and V6 addresses on a V6 socket */
502 #define SCTP_I_WANT_MAPPED_V4_ADDR 0x0000000d
503 #define SCTP_MAXSEG 0x0000000e
504 #define SCTP_DELAYED_SACK 0x0000000f
505 #define SCTP_FRAGMENT_INTERLEAVE 0x00000010
506 #define SCTP_PARTIAL_DELIVERY_POINT 0x00000011
507 /* authentication support */
508 #define SCTP_HMAC_IDENT 0x00000014
509 #define SCTP_AUTH_ACTIVE_KEY 0x00000015
510 #define SCTP_AUTO_ASCONF 0x00000018
511 #define SCTP_MAX_BURST 0x00000019
512 /* assoc level context */
513 #define SCTP_CONTEXT 0x0000001a
514 /* explicit EOR signalling */
515 #define SCTP_EXPLICIT_EOR 0x0000001b
516 #define SCTP_REUSE_PORT 0x0000001c
517 
518 #define SCTP_EVENT 0x0000001e
519 #define SCTP_RECVRCVINFO 0x0000001f
520 #define SCTP_RECVNXTINFO 0x00000020
521 #define SCTP_DEFAULT_SNDINFO 0x00000021
522 #define SCTP_DEFAULT_PRINFO 0x00000022
523 #define SCTP_REMOTE_UDP_ENCAPS_PORT 0x00000024
524 
525 #define SCTP_ENABLE_STREAM_RESET 0x00000900 /* struct sctp_assoc_value */
526 
527 /* Pluggable Stream Scheduling Socket option */
528 #define SCTP_PLUGGABLE_SS 0x00001203
529 #define SCTP_SS_VALUE 0x00001204
530 
531 /*
532  * read-only options
533  */
534 #define SCTP_STATUS 0x00000100
535 #define SCTP_GET_PEER_ADDR_INFO 0x00000101
536 /* authentication support */
537 #define SCTP_PEER_AUTH_CHUNKS 0x00000102
538 #define SCTP_LOCAL_AUTH_CHUNKS 0x00000103
539 #define SCTP_GET_ASSOC_NUMBER 0x00000104
540 #define SCTP_GET_ASSOC_ID_LIST 0x00000105
541 #define SCTP_TIMEOUTS 0x00000106
542 #define SCTP_PR_STREAM_STATUS 0x00000107
543 #define SCTP_PR_ASSOC_STATUS 0x00000108
544 
545 /*
546  * write-only options
547  */
548 #define SCTP_SET_PEER_PRIMARY_ADDR 0x00000006
549 #define SCTP_AUTH_CHUNK 0x00000012
550 #define SCTP_AUTH_KEY 0x00000013
551 #define SCTP_AUTH_DEACTIVATE_KEY 0x0000001d
552 #define SCTP_AUTH_DELETE_KEY 0x00000016
553 #define SCTP_RESET_STREAMS 0x00000901 /* struct sctp_reset_streams */
554 #define SCTP_RESET_ASSOC 0x00000902 /* sctp_assoc_t */
555 #define SCTP_ADD_STREAMS 0x00000903 /* struct sctp_add_streams */
556 
557 struct sctp_initmsg {
558  uint16_t sinit_num_ostreams;
559  uint16_t sinit_max_instreams;
560  uint16_t sinit_max_attempts;
561  uint16_t sinit_max_init_timeo;
562 };
563 
564 struct sctp_rtoinfo {
565  sctp_assoc_t srto_assoc_id;
566  uint32_t srto_initial;
567  uint32_t srto_max;
568  uint32_t srto_min;
569 };
570 
571 struct sctp_assocparams {
572  sctp_assoc_t sasoc_assoc_id;
573  uint32_t sasoc_peer_rwnd;
574  uint32_t sasoc_local_rwnd;
575  uint32_t sasoc_cookie_life;
576  uint16_t sasoc_asocmaxrxt;
577  uint16_t sasoc_number_peer_destinations;
578 };
579 
580 struct sctp_setprim {
581  struct sockaddr_storage ssp_addr;
582  sctp_assoc_t ssp_assoc_id;
583  uint8_t ssp_padding[4];
584 };
585 
586 struct sctp_setadaptation {
587  uint32_t ssb_adaptation_ind;
588 };
589 
590 struct sctp_paddrparams {
591  struct sockaddr_storage spp_address;
592  sctp_assoc_t spp_assoc_id;
593  uint32_t spp_hbinterval;
594  uint32_t spp_pathmtu;
595  uint32_t spp_flags;
596  uint32_t spp_ipv6_flowlabel;
597  uint16_t spp_pathmaxrxt;
598  uint8_t spp_dscp;
599 };
600 
601 #define SPP_HB_ENABLE 0x00000001
602 #define SPP_HB_DISABLE 0x00000002
603 #define SPP_HB_DEMAND 0x00000004
604 #define SPP_PMTUD_ENABLE 0x00000008
605 #define SPP_PMTUD_DISABLE 0x00000010
606 #define SPP_HB_TIME_IS_ZERO 0x00000080
607 #define SPP_IPV6_FLOWLABEL 0x00000100
608 #define SPP_DSCP 0x00000200
609 
610 /* Used for SCTP_MAXSEG, SCTP_MAX_BURST, SCTP_ENABLE_STREAM_RESET, and SCTP_CONTEXT */
611 struct sctp_assoc_value {
612  sctp_assoc_t assoc_id;
613  uint32_t assoc_value;
614 };
615 
616 /* To enable stream reset */
617 #define SCTP_ENABLE_RESET_STREAM_REQ 0x00000001
618 #define SCTP_ENABLE_RESET_ASSOC_REQ 0x00000002
619 #define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x00000004
620 #define SCTP_ENABLE_VALUE_MASK 0x00000007
621 
622 struct sctp_reset_streams {
623  sctp_assoc_t srs_assoc_id;
624  uint16_t srs_flags;
625  uint16_t srs_number_streams; /* 0 == ALL */
626  uint16_t srs_stream_list[]; /* list if strrst_num_streams is not 0 */
627 };
628 
629 struct sctp_add_streams {
630  sctp_assoc_t sas_assoc_id;
631  uint16_t sas_instrms;
632  uint16_t sas_outstrms;
633 };
634 
635 struct sctp_hmacalgo {
636  uint32_t shmac_number_of_idents;
637  uint16_t shmac_idents[];
638 };
639 
640 /* AUTH hmac_id */
641 #define SCTP_AUTH_HMAC_ID_RSVD 0x0000
642 #define SCTP_AUTH_HMAC_ID_SHA1 0x0001 /* default, mandatory */
643 #define SCTP_AUTH_HMAC_ID_SHA256 0x0003
644 #define SCTP_AUTH_HMAC_ID_SHA224 0x0004
645 #define SCTP_AUTH_HMAC_ID_SHA384 0x0005
646 #define SCTP_AUTH_HMAC_ID_SHA512 0x0006
647 
648 
649 struct sctp_sack_info {
650  sctp_assoc_t sack_assoc_id;
651  uint32_t sack_delay;
652  uint32_t sack_freq;
653 };
654 
655 struct sctp_default_prinfo {
656  uint16_t pr_policy;
657  uint32_t pr_value;
658  sctp_assoc_t pr_assoc_id;
659 };
660 
661 struct sctp_paddrinfo {
662  struct sockaddr_storage spinfo_address;
663  sctp_assoc_t spinfo_assoc_id;
664  int32_t spinfo_state;
665  uint32_t spinfo_cwnd;
666  uint32_t spinfo_srtt;
667  uint32_t spinfo_rto;
668  uint32_t spinfo_mtu;
669 };
670 
671 struct sctp_status {
672  sctp_assoc_t sstat_assoc_id;
673  int32_t sstat_state;
674  uint32_t sstat_rwnd;
675  uint16_t sstat_unackdata;
676  uint16_t sstat_penddata;
677  uint16_t sstat_instrms;
678  uint16_t sstat_outstrms;
679  uint32_t sstat_fragmentation_point;
680  struct sctp_paddrinfo sstat_primary;
681 };
682 
683 /*
684  * user state values
685  */
686 #define SCTP_CLOSED 0x0000
687 #define SCTP_BOUND 0x1000
688 #define SCTP_LISTEN 0x2000
689 #define SCTP_COOKIE_WAIT 0x0002
690 #define SCTP_COOKIE_ECHOED 0x0004
691 #define SCTP_ESTABLISHED 0x0008
692 #define SCTP_SHUTDOWN_SENT 0x0010
693 #define SCTP_SHUTDOWN_RECEIVED 0x0020
694 #define SCTP_SHUTDOWN_ACK_SENT 0x0040
695 #define SCTP_SHUTDOWN_PENDING 0x0080
696 
697 
698 #define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */
699 #define SCTP_INACTIVE 0x0002 /* neither SCTP_ADDR_REACHABLE
700  nor SCTP_ADDR_UNCONFIRMED */
701 #define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */
702 
703 struct sctp_authchunks {
704  sctp_assoc_t gauth_assoc_id;
705 /* uint32_t gauth_number_of_chunks; not available */
706  uint8_t gauth_chunks[];
707 };
708 
709 struct sctp_assoc_ids {
710  uint32_t gaids_number_of_ids;
711  sctp_assoc_t gaids_assoc_id[];
712 };
713 
714 struct sctp_setpeerprim {
715  struct sockaddr_storage sspp_addr;
716  sctp_assoc_t sspp_assoc_id;
717  uint8_t sspp_padding[4];
718 };
719 
720 struct sctp_authchunk {
721  uint8_t sauth_chunk;
722 };
723 
724 
725 struct sctp_get_nonce_values {
726  sctp_assoc_t gn_assoc_id;
727  uint32_t gn_peers_tag;
728  uint32_t gn_local_tag;
729 };
730 
731 
732 /*
733  * Main SCTP chunk types
734  */
735 /************0x00 series ***********/
736 #define SCTP_DATA 0x00
737 #define SCTP_INITIATION 0x01
738 #define SCTP_INITIATION_ACK 0x02
739 #define SCTP_SELECTIVE_ACK 0x03
740 #define SCTP_HEARTBEAT_REQUEST 0x04
741 #define SCTP_HEARTBEAT_ACK 0x05
742 #define SCTP_ABORT_ASSOCIATION 0x06
743 #define SCTP_SHUTDOWN 0x07
744 #define SCTP_SHUTDOWN_ACK 0x08
745 #define SCTP_OPERATION_ERROR 0x09
746 #define SCTP_COOKIE_ECHO 0x0a
747 #define SCTP_COOKIE_ACK 0x0b
748 #define SCTP_ECN_ECHO 0x0c
749 #define SCTP_ECN_CWR 0x0d
750 #define SCTP_SHUTDOWN_COMPLETE 0x0e
751 /* RFC4895 */
752 #define SCTP_AUTHENTICATION 0x0f
753 /* EY nr_sack chunk id*/
754 #define SCTP_NR_SELECTIVE_ACK 0x10
755 /************0x40 series ***********/
756 /************0x80 series ***********/
757 /* RFC5061 */
758 #define SCTP_ASCONF_ACK 0x80
759 /* draft-ietf-stewart-pktdrpsctp */
760 #define SCTP_PACKET_DROPPED 0x81
761 /* draft-ietf-stewart-strreset-xxx */
762 #define SCTP_STREAM_RESET 0x82
763 
764 /* RFC4820 */
765 #define SCTP_PAD_CHUNK 0x84
766 /************0xc0 series ***********/
767 /* RFC3758 */
768 #define SCTP_FORWARD_CUM_TSN 0xc0
769 /* RFC5061 */
770 #define SCTP_ASCONF 0xc1
771 
772 struct sctp_authkey {
773  sctp_assoc_t sca_assoc_id;
774  uint16_t sca_keynumber;
775  uint16_t sca_keylength;
776  uint8_t sca_key[];
777 };
778 
779 struct sctp_authkeyid {
780  sctp_assoc_t scact_assoc_id;
781  uint16_t scact_keynumber;
782 };
783 
784 struct sctp_cc_option {
785  int option;
786  struct sctp_assoc_value aid_value;
787 };
788 
789 struct sctp_stream_value {
790  sctp_assoc_t assoc_id;
792  uint16_t stream_value;
793 };
794 
795 struct sctp_timeouts {
796  sctp_assoc_t stimo_assoc_id;
797  uint32_t stimo_init;
798  uint32_t stimo_data;
799  uint32_t stimo_sack;
800  uint32_t stimo_shutdown;
801  uint32_t stimo_heartbeat;
802  uint32_t stimo_cookie;
803  uint32_t stimo_shutdownack;
804 };
805 
806 struct sctp_prstatus {
807  sctp_assoc_t sprstat_assoc_id;
808  uint16_t sprstat_sid;
809  uint16_t sprstat_policy;
810  uint64_t sprstat_abandoned_unsent;
811  uint64_t sprstat_abandoned_sent;
812 };
813 
814 /* Standard TCP Congestion Control */
815 #define SCTP_CC_RFC2581 0x00000000
816 /* High Speed TCP Congestion Control (Floyd) */
817 #define SCTP_CC_HSTCP 0x00000001
818 /* HTCP Congestion Control */
819 #define SCTP_CC_HTCP 0x00000002
820 /* RTCC Congestion Control - RFC2581 plus */
821 #define SCTP_CC_RTCC 0x00000003
822 
823 #define SCTP_CC_OPT_RTCC_SETMODE 0x00002000
824 #define SCTP_CC_OPT_USE_DCCC_EC 0x00002001
825 #define SCTP_CC_OPT_STEADY_STEP 0x00002002
826 
827 #define SCTP_CMT_OFF 0
828 #define SCTP_CMT_BASE 1
829 #define SCTP_CMT_RPV1 2
830 #define SCTP_CMT_RPV2 3
831 #define SCTP_CMT_MPTCP 4
832 #define SCTP_CMT_MAX SCTP_CMT_MPTCP
833 
834 /* RS - Supported stream scheduling modules for pluggable
835  * stream scheduling
836  */
837 /* Default simple round-robin */
838 #define SCTP_SS_DEFAULT 0x00000000
839 /* Real round-robin */
840 #define SCTP_SS_ROUND_ROBIN 0x00000001
841 /* Real round-robin per packet */
842 #define SCTP_SS_ROUND_ROBIN_PACKET 0x00000002
843 /* Priority */
844 #define SCTP_SS_PRIORITY 0x00000003
845 /* Fair Bandwidth */
846 #define SCTP_SS_FAIR_BANDWITH 0x00000004
847 /* First-come, first-serve */
848 #define SCTP_SS_FIRST_COME 0x00000005
849 
850 /******************** System calls *************/
851 
852 struct socket;
853 
854 void
856  int (*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df),
857  void (*)(const char *format, ...));
858 
859 struct socket *
860 usrsctp_socket(int domain, int type, int protocol,
861  int (*receive_cb)(struct socket *sock, union sctp_sockstore addr, void *data,
862  size_t datalen, struct sctp_rcvinfo, int flags, void *ulp_info),
863  int (*send_cb)(struct socket *sock, uint32_t sb_free),
864  uint32_t sb_threshold,
865  void *ulp_info);
866 
867 int
868 usrsctp_setsockopt(struct socket *so,
869  int level,
870  int option_name,
871  const void *option_value,
872  socklen_t option_len);
873 
874 int
875 usrsctp_getsockopt(struct socket *so,
876  int level,
877  int option_name,
878  void *option_value,
879  socklen_t *option_len);
880 
881 int
882 usrsctp_getpaddrs(struct socket *so,
883  sctp_assoc_t id,
884  struct sockaddr **raddrs);
885 
886 void
887 usrsctp_freepaddrs(struct sockaddr *addrs);
888 
889 int
890 usrsctp_getladdrs(struct socket *so,
891  sctp_assoc_t id,
892  struct sockaddr **raddrs);
893 
894 void
895 usrsctp_freeladdrs(struct sockaddr *addrs);
896 
897 ssize_t
898 usrsctp_sendv(struct socket *so,
899  const void *data,
900  size_t len,
901  struct sockaddr *to,
902  int addrcnt,
903  void *info,
904  socklen_t infolen,
905  unsigned int infotype,
906  int flags);
907 
908 ssize_t
909 usrsctp_recvv(struct socket *so,
910  void *dbuf,
911  size_t len,
912  struct sockaddr *from,
913  socklen_t * fromlen,
914  void *info,
915  socklen_t *infolen,
916  unsigned int *infotype,
917  int *msg_flags);
918 
919 int
920 usrsctp_bind(struct socket *so,
921  struct sockaddr *name,
922  socklen_t namelen);
923 
924 #define SCTP_BINDX_ADD_ADDR 0x00008001
925 #define SCTP_BINDX_REM_ADDR 0x00008002
926 
927 int
928 usrsctp_bindx(struct socket *so,
929  struct sockaddr *addrs,
930  int addrcnt,
931  int flags);
932 
933 int
934 usrsctp_listen(struct socket *so,
935  int backlog);
936 
937 struct socket *
938 usrsctp_accept(struct socket *so,
939  struct sockaddr * aname,
940  socklen_t * anamelen);
941 
942 struct socket *
943 usrsctp_peeloff(struct socket *, sctp_assoc_t);
944 
945 int
946 usrsctp_connect(struct socket *so,
947  struct sockaddr *name,
948  socklen_t namelen);
949 
950 int
951 usrsctp_connectx(struct socket *so,
952  const struct sockaddr *addrs, int addrcnt,
953  sctp_assoc_t *id);
954 
955 void
956 usrsctp_close(struct socket *so);
957 
958 sctp_assoc_t
959 usrsctp_getassocid(struct socket *, struct sockaddr *);
960 
961 int
962 usrsctp_finish(void);
963 
964 int
965 usrsctp_shutdown(struct socket *so, int how);
966 
967 void
968 usrsctp_conninput(void *, const void *, size_t, uint8_t);
969 
970 int
971 usrsctp_set_non_blocking(struct socket *, int);
972 
973 int
975 
976 void
978 
979 void
981 
982 int
983 usrsctp_set_ulpinfo(struct socket *, void *);
984 
985 #define SCTP_DUMP_OUTBOUND 1
986 #define SCTP_DUMP_INBOUND 0
987 
988 char *
989 usrsctp_dumppacket(const void *, size_t, int);
990 
991 void
992 usrsctp_freedumpbuffer(char *);
993 
994 #define USRSCTP_SYSCTL_DECL(__field) \
995 void usrsctp_sysctl_set_ ## __field(uint32_t value);\
996 uint32_t usrsctp_sysctl_get_ ## __field(void);
997 
998 USRSCTP_SYSCTL_DECL(sctp_sendspace)
999 USRSCTP_SYSCTL_DECL(sctp_recvspace)
1000 USRSCTP_SYSCTL_DECL(sctp_auto_asconf)
1001 USRSCTP_SYSCTL_DECL(sctp_multiple_asconfs)
1002 USRSCTP_SYSCTL_DECL(sctp_ecn_enable)
1003 USRSCTP_SYSCTL_DECL(sctp_pr_enable)
1004 USRSCTP_SYSCTL_DECL(sctp_auth_enable)
1005 USRSCTP_SYSCTL_DECL(sctp_asconf_enable)
1006 USRSCTP_SYSCTL_DECL(sctp_reconfig_enable)
1007 USRSCTP_SYSCTL_DECL(sctp_nrsack_enable)
1008 USRSCTP_SYSCTL_DECL(sctp_pktdrop_enable)
1009 #if !defined(SCTP_WITH_NO_CSUM)
1010 USRSCTP_SYSCTL_DECL(sctp_no_csum_on_loopback)
1011 #endif
1012 USRSCTP_SYSCTL_DECL(sctp_peer_chunk_oh)
1013 USRSCTP_SYSCTL_DECL(sctp_max_burst_default)
1014 USRSCTP_SYSCTL_DECL(sctp_max_chunks_on_queue)
1015 USRSCTP_SYSCTL_DECL(sctp_hashtblsize)
1016 USRSCTP_SYSCTL_DECL(sctp_pcbtblsize)
1017 USRSCTP_SYSCTL_DECL(sctp_min_split_point)
1018 USRSCTP_SYSCTL_DECL(sctp_chunkscale)
1019 USRSCTP_SYSCTL_DECL(sctp_delayed_sack_time_default)
1020 USRSCTP_SYSCTL_DECL(sctp_sack_freq_default)
1021 USRSCTP_SYSCTL_DECL(sctp_system_free_resc_limit)
1022 USRSCTP_SYSCTL_DECL(sctp_asoc_free_resc_limit)
1023 USRSCTP_SYSCTL_DECL(sctp_heartbeat_interval_default)
1024 USRSCTP_SYSCTL_DECL(sctp_pmtu_raise_time_default)
1025 USRSCTP_SYSCTL_DECL(sctp_shutdown_guard_time_default)
1026 USRSCTP_SYSCTL_DECL(sctp_secret_lifetime_default)
1027 USRSCTP_SYSCTL_DECL(sctp_rto_max_default)
1028 USRSCTP_SYSCTL_DECL(sctp_rto_min_default)
1029 USRSCTP_SYSCTL_DECL(sctp_rto_initial_default)
1030 USRSCTP_SYSCTL_DECL(sctp_init_rto_max_default)
1031 USRSCTP_SYSCTL_DECL(sctp_valid_cookie_life_default)
1032 USRSCTP_SYSCTL_DECL(sctp_init_rtx_max_default)
1033 USRSCTP_SYSCTL_DECL(sctp_assoc_rtx_max_default)
1034 USRSCTP_SYSCTL_DECL(sctp_path_rtx_max_default)
1035 USRSCTP_SYSCTL_DECL(sctp_add_more_threshold)
1036 USRSCTP_SYSCTL_DECL(sctp_nr_incoming_streams_default)
1037 USRSCTP_SYSCTL_DECL(sctp_nr_outgoing_streams_default)
1038 USRSCTP_SYSCTL_DECL(sctp_cmt_on_off)
1039 USRSCTP_SYSCTL_DECL(sctp_cmt_use_dac)
1040 USRSCTP_SYSCTL_DECL(sctp_use_cwnd_based_maxburst)
1041 USRSCTP_SYSCTL_DECL(sctp_nat_friendly)
1042 USRSCTP_SYSCTL_DECL(sctp_L2_abc_variable)
1043 USRSCTP_SYSCTL_DECL(sctp_mbuf_threshold_count)
1044 USRSCTP_SYSCTL_DECL(sctp_do_drain)
1045 USRSCTP_SYSCTL_DECL(sctp_hb_maxburst)
1046 USRSCTP_SYSCTL_DECL(sctp_abort_if_one_2_one_hits_limit)
1047 USRSCTP_SYSCTL_DECL(sctp_min_residual)
1048 USRSCTP_SYSCTL_DECL(sctp_max_retran_chunk)
1049 USRSCTP_SYSCTL_DECL(sctp_logging_level)
1050 USRSCTP_SYSCTL_DECL(sctp_default_cc_module)
1051 USRSCTP_SYSCTL_DECL(sctp_default_frag_interleave)
1052 USRSCTP_SYSCTL_DECL(sctp_mobility_base)
1053 USRSCTP_SYSCTL_DECL(sctp_mobility_fasthandoff)
1054 USRSCTP_SYSCTL_DECL(sctp_inits_include_nat_friendly)
1055 USRSCTP_SYSCTL_DECL(sctp_udp_tunneling_port)
1056 USRSCTP_SYSCTL_DECL(sctp_enable_sack_immediately)
1057 USRSCTP_SYSCTL_DECL(sctp_vtag_time_wait)
1058 USRSCTP_SYSCTL_DECL(sctp_blackhole)
1059 USRSCTP_SYSCTL_DECL(sctp_diag_info_code)
1060 USRSCTP_SYSCTL_DECL(sctp_fr_max_burst_default)
1061 USRSCTP_SYSCTL_DECL(sctp_path_pf_threshold)
1062 USRSCTP_SYSCTL_DECL(sctp_default_ss_module)
1063 USRSCTP_SYSCTL_DECL(sctp_rttvar_bw)
1064 USRSCTP_SYSCTL_DECL(sctp_rttvar_rtt)
1065 USRSCTP_SYSCTL_DECL(sctp_rttvar_eqret)
1066 USRSCTP_SYSCTL_DECL(sctp_steady_step)
1067 USRSCTP_SYSCTL_DECL(sctp_use_dccc_ecn)
1068 USRSCTP_SYSCTL_DECL(sctp_buffer_splitting)
1069 USRSCTP_SYSCTL_DECL(sctp_initial_cwnd)
1070 #ifdef SCTP_DEBUG
1071 USRSCTP_SYSCTL_DECL(sctp_debug_on)
1072 /* More specific values can be found in sctp_constants, but
1073  * are not considered to be part of the API.
1074  */
1075 #define SCTP_DEBUG_NONE 0x00000000
1076 #define SCTP_DEBUG_ALL 0xffffffff
1077 #endif
1078 #undef USRSCTP_SYSCTL_DECL
1079 struct sctp_timeval {
1080  uint32_t tv_sec;
1081  uint32_t tv_usec;
1082 };
1083 
1084 struct sctpstat {
1085  struct sctp_timeval sctps_discontinuitytime; /* sctpStats 18 (TimeStamp) */
1086  /* MIB according to RFC 3873 */
1087  uint32_t sctps_currestab; /* sctpStats 1 (Gauge32) */
1088  uint32_t sctps_activeestab; /* sctpStats 2 (Counter32) */
1089  uint32_t sctps_restartestab;
1090  uint32_t sctps_collisionestab;
1091  uint32_t sctps_passiveestab; /* sctpStats 3 (Counter32) */
1092  uint32_t sctps_aborted; /* sctpStats 4 (Counter32) */
1093  uint32_t sctps_shutdown; /* sctpStats 5 (Counter32) */
1094  uint32_t sctps_outoftheblue; /* sctpStats 6 (Counter32) */
1095  uint32_t sctps_checksumerrors; /* sctpStats 7 (Counter32) */
1096  uint32_t sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */
1097  uint32_t sctps_outorderchunks; /* sctpStats 9 (Counter64) */
1098  uint32_t sctps_outunorderchunks; /* sctpStats 10 (Counter64) */
1099  uint32_t sctps_incontrolchunks; /* sctpStats 11 (Counter64) */
1100  uint32_t sctps_inorderchunks; /* sctpStats 12 (Counter64) */
1101  uint32_t sctps_inunorderchunks; /* sctpStats 13 (Counter64) */
1102  uint32_t sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */
1103  uint32_t sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */
1104  uint32_t sctps_outpackets; /* sctpStats 16 (Counter64) */
1105  uint32_t sctps_inpackets; /* sctpStats 17 (Counter64) */
1106 
1107  /* input statistics: */
1108  uint32_t sctps_recvpackets; /* total input packets */
1109  uint32_t sctps_recvdatagrams; /* total input datagrams */
1110  uint32_t sctps_recvpktwithdata; /* total packets that had data */
1111  uint32_t sctps_recvsacks; /* total input SACK chunks */
1112  uint32_t sctps_recvdata; /* total input DATA chunks */
1113  uint32_t sctps_recvdupdata; /* total input duplicate DATA chunks */
1114  uint32_t sctps_recvheartbeat; /* total input HB chunks */
1115  uint32_t sctps_recvheartbeatack; /* total input HB-ACK chunks */
1116  uint32_t sctps_recvecne; /* total input ECNE chunks */
1117  uint32_t sctps_recvauth; /* total input AUTH chunks */
1118  uint32_t sctps_recvauthmissing; /* total input chunks missing AUTH */
1119  uint32_t sctps_recvivalhmacid; /* total number of invalid HMAC ids received */
1120  uint32_t sctps_recvivalkeyid; /* total number of invalid secret ids received */
1121  uint32_t sctps_recvauthfailed; /* total number of auth failed */
1122  uint32_t sctps_recvexpress; /* total fast path receives all one chunk */
1123  uint32_t sctps_recvexpressm; /* total fast path multi-part data */
1124  uint32_t sctps_recvnocrc;
1125  uint32_t sctps_recvswcrc;
1126  uint32_t sctps_recvhwcrc;
1127 
1128  /* output statistics: */
1129  uint32_t sctps_sendpackets; /* total output packets */
1130  uint32_t sctps_sendsacks; /* total output SACKs */
1131  uint32_t sctps_senddata; /* total output DATA chunks */
1132  uint32_t sctps_sendretransdata; /* total output retransmitted DATA chunks */
1133  uint32_t sctps_sendfastretrans; /* total output fast retransmitted DATA chunks */
1134  uint32_t sctps_sendmultfastretrans; /* total FR's that happened more than once
1135  * to same chunk (u-del multi-fr algo).
1136  */
1137  uint32_t sctps_sendheartbeat; /* total output HB chunks */
1138  uint32_t sctps_sendecne; /* total output ECNE chunks */
1139  uint32_t sctps_sendauth; /* total output AUTH chunks FIXME */
1140  uint32_t sctps_senderrors; /* ip_output error counter */
1141  uint32_t sctps_sendnocrc;
1142  uint32_t sctps_sendswcrc;
1143  uint32_t sctps_sendhwcrc;
1144  /* PCKDROPREP statistics: */
1145  uint32_t sctps_pdrpfmbox; /* Packet drop from middle box */
1146  uint32_t sctps_pdrpfehos; /* P-drop from end host */
1147  uint32_t sctps_pdrpmbda; /* P-drops with data */
1148  uint32_t sctps_pdrpmbct; /* P-drops, non-data, non-endhost */
1149  uint32_t sctps_pdrpbwrpt; /* P-drop, non-endhost, bandwidth rep only */
1150  uint32_t sctps_pdrpcrupt; /* P-drop, not enough for chunk header */
1151  uint32_t sctps_pdrpnedat; /* P-drop, not enough data to confirm */
1152  uint32_t sctps_pdrppdbrk; /* P-drop, where process_chunk_drop said break */
1153  uint32_t sctps_pdrptsnnf; /* P-drop, could not find TSN */
1154  uint32_t sctps_pdrpdnfnd; /* P-drop, attempt reverse TSN lookup */
1155  uint32_t sctps_pdrpdiwnp; /* P-drop, e-host confirms zero-rwnd */
1156  uint32_t sctps_pdrpdizrw; /* P-drop, midbox confirms no space */
1157  uint32_t sctps_pdrpbadd; /* P-drop, data did not match TSN */
1158  uint32_t sctps_pdrpmark; /* P-drop, TSN's marked for Fast Retran */
1159  /* timeouts */
1160  uint32_t sctps_timoiterator; /* Number of iterator timers that fired */
1161  uint32_t sctps_timodata; /* Number of T3 data time outs */
1162  uint32_t sctps_timowindowprobe; /* Number of window probe (T3) timers that fired */
1163  uint32_t sctps_timoinit; /* Number of INIT timers that fired */
1164  uint32_t sctps_timosack; /* Number of sack timers that fired */
1165  uint32_t sctps_timoshutdown; /* Number of shutdown timers that fired */
1166  uint32_t sctps_timoheartbeat; /* Number of heartbeat timers that fired */
1167  uint32_t sctps_timocookie; /* Number of times a cookie timeout fired */
1168  uint32_t sctps_timosecret; /* Number of times an endpoint changed its cookie secret*/
1169  uint32_t sctps_timopathmtu; /* Number of PMTU timers that fired */
1170  uint32_t sctps_timoshutdownack; /* Number of shutdown ack timers that fired */
1171  uint32_t sctps_timoshutdownguard; /* Number of shutdown guard timers that fired */
1172  uint32_t sctps_timostrmrst; /* Number of stream reset timers that fired */
1173  uint32_t sctps_timoearlyfr; /* Number of early FR timers that fired */
1174  uint32_t sctps_timoasconf; /* Number of times an asconf timer fired */
1175  uint32_t sctps_timodelprim; /* Number of times a prim_deleted timer fired */
1176  uint32_t sctps_timoautoclose; /* Number of times auto close timer fired */
1177  uint32_t sctps_timoassockill; /* Number of asoc free timers expired */
1178  uint32_t sctps_timoinpkill; /* Number of inp free timers expired */
1179  /* former early FR counters */
1180  uint32_t sctps_spare[11];
1181  /* others */
1182  uint32_t sctps_hdrops; /* packet shorter than header */
1183  uint32_t sctps_badsum; /* checksum error */
1184  uint32_t sctps_noport; /* no endpoint for port */
1185  uint32_t sctps_badvtag; /* bad v-tag */
1186  uint32_t sctps_badsid; /* bad SID */
1187  uint32_t sctps_nomem; /* no memory */
1188  uint32_t sctps_fastretransinrtt; /* number of multiple FR in a RTT window */
1189  uint32_t sctps_markedretrans;
1190  uint32_t sctps_naglesent; /* nagle allowed sending */
1191  uint32_t sctps_naglequeued; /* nagle doesn't allow sending */
1192  uint32_t sctps_maxburstqueued; /* max burst doesn't allow sending */
1193  uint32_t sctps_ifnomemqueued; /* look ahead tells us no memory in
1194  * interface ring buffer OR we had a
1195  * send error and are queuing one send.
1196  */
1197  uint32_t sctps_windowprobed; /* total number of window probes sent */
1198  uint32_t sctps_lowlevelerr; /* total times an output error causes us
1199  * to clamp down on next user send.
1200  */
1201  uint32_t sctps_lowlevelerrusr; /* total times sctp_senderrors were caused from
1202  * a user send from a user invoked send not
1203  * a sack response
1204  */
1205  uint32_t sctps_datadropchklmt; /* Number of in data drops due to chunk limit reached */
1206  uint32_t sctps_datadroprwnd; /* Number of in data drops due to rwnd limit reached */
1207  uint32_t sctps_ecnereducedcwnd; /* Number of times a ECN reduced the cwnd */
1208  uint32_t sctps_vtagexpress; /* Used express lookup via vtag */
1209  uint32_t sctps_vtagbogus; /* Collision in express lookup. */
1210  uint32_t sctps_primary_randry; /* Number of times the sender ran dry of user data on primary */
1211  uint32_t sctps_cmt_randry; /* Same for above */
1212  uint32_t sctps_slowpath_sack; /* Sacks the slow way */
1213  uint32_t sctps_wu_sacks_sent; /* Window Update only sacks sent */
1214  uint32_t sctps_sends_with_flags; /* number of sends with sinfo_flags !=0 */
1215  uint32_t sctps_sends_with_unord; /* number of unordered sends */
1216  uint32_t sctps_sends_with_eof; /* number of sends with EOF flag set */
1217  uint32_t sctps_sends_with_abort; /* number of sends with ABORT flag set */
1218  uint32_t sctps_protocol_drain_calls;/* number of times protocol drain called */
1219  uint32_t sctps_protocol_drains_done;/* number of times we did a protocol drain */
1220  uint32_t sctps_read_peeks; /* Number of times recv was called with peek */
1221  uint32_t sctps_cached_chk; /* Number of cached chunks used */
1222  uint32_t sctps_cached_strmoq; /* Number of cached stream oq's used */
1223  uint32_t sctps_left_abandon; /* Number of unread messages abandoned by close */
1224  uint32_t sctps_send_burst_avoid; /* Unused */
1225  uint32_t sctps_send_cwnd_avoid; /* Send cwnd full avoidance, already max burst inflight to net */
1226  uint32_t sctps_fwdtsn_map_over; /* number of map array over-runs via fwd-tsn's */
1227  uint32_t sctps_queue_upd_ecne; /* Number of times we queued or updated an ECN chunk on send queue */
1228  uint32_t sctps_reserved[31]; /* Future ABI compat - remove int's from here when adding new */
1229 };
1230 
1231 void
1232 usrsctp_get_stat(struct sctpstat *);
1233 
1234 #ifdef _WIN32
1235 #ifdef _MSC_VER
1236 #pragma warning(default: 4200)
1237 #endif
1238 #endif
1239 #ifdef __cplusplus
1240 }
1241 #endif
1242 #endif
void usrsctp_freeladdrs(struct sockaddr *addrs)
Definition: user_socket.c:2870
Definition: sctp_uio.h:520
void usrsctp_close(struct socket *so)
Definition: user_socket.c:2160
void usrsctp_freedumpbuffer(char *)
Definition: user_socket.c:3304
Definition: sctp_uio.h:731
USVString protocol
Definition: RTCPeerConnection.idl:48
unsigned long long uint64_t
Definition: ptypes.h:120
Definition: sctp_uio.h:803
int usrsctp_connect(struct socket *so, struct sockaddr *name, socklen_t namelen)
Definition: sctp_uio.h:195
int usrsctp_shutdown(struct socket *so, int how)
Definition: user_socket.c:2190
Definition: sctp_uio.h:262
GLint GLint GLint GLsizei GLsizei GLenum format
Definition: gl2.h:403
Definition: sctp_uio.h:406
void usrsctp_init(uint16_t, int(*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df), void(*)(const char *format,...))
Definition: user_socket.c:80
Definition: sctp_uio.h:635
signed int int32_t
Definition: ptypes.h:101
unsigned int uint32_t
Definition: ptypes.h:105
Definition: sctp_uio.h:235
uint32_t pdapi_stream
Definition: usrsctp.h:316
int usrsctp_setsockopt(struct socket *so, int level, int option_name, const void *option_value, socklen_t option_len)
Definition: user_socket.c:2260
Definition: sctp_uio.h:968
uint32_t sn_length
Definition: usrsctp.h:422
Definition: sctp_uio.h:385
Definition: sctp_uio.h:759
def info(msg, args, kwargs)
Definition: __init__.py:1165
void * sconn_addr
Definition: sctp_os_userspace.h:1034
Definition: sctp_uio.h:669
Definition: sctp_uio.h:492
Definition: sctp_uio.h:429
Definition: user_socketvar.h:125
Definition: sctp_uio.h:651
struct socket * usrsctp_accept(struct socket *so, struct sockaddr *aname, socklen_t *anamelen)
Definition: user_socket.c:1932
sctp_assoc_t usrsctp_getassocid(struct socket *, struct sockaddr *)
Definition: user_socket.c:715
int usrsctp_connectx(struct socket *so, const struct sockaddr *addrs, int addrcnt, sctp_assoc_t *id)
Definition: user_socket.c:2628
Definition: sctp_uio.h:742
Definition: sctp_uio.h:200
Definition: sctp_uio.h:361
Definition: sctp_uio.h:810
struct socket * usrsctp_peeloff(struct socket *, sctp_assoc_t)
Definition: user_socket.c:1951
void usrsctp_register_address(void *)
Definition: user_socket.c:3195
Definition: sctp_uio.h:642
Definition: sctp_uio.h:709
void usrsctp_conninput(void *, const void *, size_t, uint8_t)
Definition: user_socket.c:3310
int usrsctp_finish(void)
Definition: user_socket.c:2221
Definition: sctp_uio.h:625
GLint level
Definition: gl2.h:402
uint16_t sn_type
Definition: usrsctp.h:420
int usrsctp_getpaddrs(struct socket *so, sctp_assoc_t id, struct sockaddr **raddrs)
Definition: user_socket.c:2722
Definition: sctp_uio.h:221
Definition: sctp_uio.h:206
Definition: sctp_uio.h:721
Definition: sctp_uio.h:1149
Definition: sctp_uio.h:816
Definition: sctp_uio.h:973
void usrsctp_get_stat(struct sctpstat *)
Definition: user_socket.c:3521
OPENSSL_EXPORT const ASN1_OBJECT int const unsigned char int len
Definition: x509.h:1053
int usrsctp_get_non_blocking(struct socket *)
Definition: user_socket.c:2010
Definition: sctp_uio.h:421
void usrsctp_deregister_address(void *)
Definition: user_socket.c:3218
Definition: sctp_uio.h:698
Definition: sctp_os_userspace.h:1026
uint16_t sconn_port
Definition: sctp_os_userspace.h:1033
unsigned char uint8_t
Definition: ptypes.h:89
char * usrsctp_dumppacket(const void *, size_t, int)
Definition: user_socket.c:3241
Definition: sctp_uio.h:251
unsigned short uint16_t
Definition: ptypes.h:97
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), uint32_t sb_threshold, void *ulp_info)
Definition: user_socket.c:1410
Definition: sctp_uio.h:187
EGLImageKHR EGLint * name
Definition: eglext.h:851
Definition: usrsctp.h:419
Definition: sctp_uio.h:437
Definition: sctp_uio.h:81
short sa[N]
Definition: gcc-loops.cpp:20
uint16_t sconn_family
Definition: sctp_os_userspace.h:1031
std::string stream_id
Definition: peerconnection_jni.cc:2055
Definition: sctp_uio.h:458
EGLenum type
Definition: eglext.h:63
Definition: sctp_uio.h:595
EGLStreamKHR EGLint EGLint EGLint const void * data
Definition: eglext.h:984
int usrsctp_bind(struct socket *so, struct sockaddr *name, socklen_t namelen)
void usrsctp_freepaddrs(struct sockaddr *addrs)
Definition: user_socket.c:2787
Definition: sctp_uio.h:503
int usrsctp_listen(struct socket *so, int backlog)
Definition: user_socket.c:1710
Definition: sctp_uio.h:685
Definition: sctp_uio.h:765
Definition: sctp_uio.h:748
Definition: sctp_uio.h:71
uint32_t pdapi_seq
Definition: usrsctp.h:317
Definition: sctp_uio.h:210
Definition: sctp_uio.h:475
Definition: sctp_uio.h:555
int usrsctp_set_non_blocking(struct socket *, int)
Definition: user_socket.c:1993
ssize_t usrsctp_sendv(struct socket *so, const void *data, size_t len, struct sockaddr *to, int addrcnt, void *info, socklen_t infolen, unsigned int infotype, int flags)
Definition: user_socket.c:827
uint32_t sue_assoc_id
Definition: usrsctp.h:210
Definition: sctp_uio.h:737
EGLContext EGLenum EGLClientBuffer buffer
Definition: eglext.h:192
Definition: sctp_uio.h:331
Definition: sctp_uio.h:110
int usrsctp_getsockopt(struct socket *so, int level, int option_name, void *option_value, socklen_t *option_len)
Definition: user_socket.c:2350
uint16_t sn_flags
Definition: usrsctp.h:421
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)
Definition: user_socket.c:1102
Definition: sctp_uio.h:657
Definition: bwe_rtp.cc:26
int usrsctp_set_ulpinfo(struct socket *, void *)
Definition: user_socket.c:2438
Definition: sctp_uio.h:535
Definition: sctp_uio.h:690
int usrsctp_bindx(struct socket *so, struct sockaddr *addrs, int addrcnt, int flags)
Definition: user_socket.c:2444
GLuint GLsizei GLsizei * length
Definition: gl2.h:435
uint32_t sctp_assoc_t
Definition: usrsctp.h:88
Definition: sctp_uio.h:715
int usrsctp_getladdrs(struct socket *so, sctp_assoc_t id, struct sockaddr **raddrs)
Definition: user_socket.c:2798
#define USRSCTP_SYSCTL_DECL(__field)
Definition: usrsctp.h:994
Definition: sctp_uio.h:726