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