1f8829a4aSRandall Stewart /*- 2b1006367SRandall Stewart * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3807aad63SMichael Tuexen * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 4807aad63SMichael Tuexen * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 5f8829a4aSRandall Stewart * 6f8829a4aSRandall Stewart * Redistribution and use in source and binary forms, with or without 7f8829a4aSRandall Stewart * modification, are permitted provided that the following conditions are met: 8f8829a4aSRandall Stewart * 9f8829a4aSRandall Stewart * a) Redistributions of source code must retain the above copyright notice, 10f8829a4aSRandall Stewart * this list of conditions and the following disclaimer. 11f8829a4aSRandall Stewart * 12f8829a4aSRandall Stewart * b) Redistributions in binary form must reproduce the above copyright 13f8829a4aSRandall Stewart * notice, this list of conditions and the following disclaimer in 14f8829a4aSRandall Stewart * the documentation and/or other materials provided with the distribution. 15f8829a4aSRandall Stewart * 16f8829a4aSRandall Stewart * c) Neither the name of Cisco Systems, Inc. nor the names of its 17f8829a4aSRandall Stewart * contributors may be used to endorse or promote products derived 18f8829a4aSRandall Stewart * from this software without specific prior written permission. 19f8829a4aSRandall Stewart * 20f8829a4aSRandall Stewart * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21f8829a4aSRandall Stewart * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22f8829a4aSRandall Stewart * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23f8829a4aSRandall Stewart * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24f8829a4aSRandall Stewart * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25f8829a4aSRandall Stewart * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26f8829a4aSRandall Stewart * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27f8829a4aSRandall Stewart * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28f8829a4aSRandall Stewart * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29f8829a4aSRandall Stewart * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30f8829a4aSRandall Stewart * THE POSSIBILITY OF SUCH DAMAGE. 31f8829a4aSRandall Stewart */ 32f8829a4aSRandall Stewart 33f8829a4aSRandall Stewart #include <sys/cdefs.h> 34f8829a4aSRandall Stewart __FBSDID("$FreeBSD$"); 35f8829a4aSRandall Stewart 36807aad63SMichael Tuexen #ifndef _NETINET_SCTP_UIO_H_ 37807aad63SMichael Tuexen #define _NETINET_SCTP_UIO_H_ 38f8829a4aSRandall Stewart 39f8829a4aSRandall Stewart 40f8829a4aSRandall Stewart #if ! defined(_KERNEL) 41f8829a4aSRandall Stewart #include <stdint.h> 42f8829a4aSRandall Stewart #endif 43f8829a4aSRandall Stewart #include <sys/types.h> 44f8829a4aSRandall Stewart #include <sys/socket.h> 4503b0b021SRandall Stewart #include <netinet/in.h> 46f8829a4aSRandall Stewart 47f8829a4aSRandall Stewart typedef uint32_t sctp_assoc_t; 48f8829a4aSRandall Stewart 49e2e7c62eSMichael Tuexen #define SCTP_FUTURE_ASSOC 0 50e2e7c62eSMichael Tuexen #define SCTP_CURRENT_ASSOC 1 51e2e7c62eSMichael Tuexen #define SCTP_ALL_ASSOC 2 52e2e7c62eSMichael Tuexen 53e2e7c62eSMichael Tuexen struct sctp_event { 54e2e7c62eSMichael Tuexen sctp_assoc_t se_assoc_id; 55e2e7c62eSMichael Tuexen uint16_t se_type; 56e2e7c62eSMichael Tuexen uint8_t se_on; 57e2e7c62eSMichael Tuexen }; 58e2e7c62eSMichael Tuexen 59a10c3242SRandall Stewart /* Compatibility to previous define's */ 60a10c3242SRandall Stewart #define sctp_stream_reset_events sctp_stream_reset_event 61a10c3242SRandall Stewart 62f8829a4aSRandall Stewart /* On/Off setup for subscription to events */ 63f8829a4aSRandall Stewart struct sctp_event_subscribe { 64f8829a4aSRandall Stewart uint8_t sctp_data_io_event; 65f8829a4aSRandall Stewart uint8_t sctp_association_event; 66f8829a4aSRandall Stewart uint8_t sctp_address_event; 67f8829a4aSRandall Stewart uint8_t sctp_send_failure_event; 68f8829a4aSRandall Stewart uint8_t sctp_peer_error_event; 69f8829a4aSRandall Stewart uint8_t sctp_shutdown_event; 70f8829a4aSRandall Stewart uint8_t sctp_partial_delivery_event; 71f8829a4aSRandall Stewart uint8_t sctp_adaptation_layer_event; 72f8829a4aSRandall Stewart uint8_t sctp_authentication_event; 73830d754dSRandall Stewart uint8_t sctp_sender_dry_event; 74a10c3242SRandall Stewart uint8_t sctp_stream_reset_event; 75f8829a4aSRandall Stewart }; 76f8829a4aSRandall Stewart 77f8829a4aSRandall Stewart /* ancillary data types */ 78f8829a4aSRandall Stewart #define SCTP_INIT 0x0001 79f8829a4aSRandall Stewart #define SCTP_SNDRCV 0x0002 80f8829a4aSRandall Stewart #define SCTP_EXTRCV 0x0003 81e2e7c62eSMichael Tuexen #define SCTP_SNDINFO 0x0004 82e2e7c62eSMichael Tuexen #define SCTP_RCVINFO 0x0005 83e2e7c62eSMichael Tuexen #define SCTP_NXTINFO 0x0006 84e2e7c62eSMichael Tuexen #define SCTP_PRINFO 0x0007 85e2e7c62eSMichael Tuexen #define SCTP_AUTHINFO 0x0008 86e2e7c62eSMichael Tuexen #define SCTP_DSTADDRV4 0x0009 87e2e7c62eSMichael Tuexen #define SCTP_DSTADDRV6 0x000a 88e2e7c62eSMichael Tuexen 89f8829a4aSRandall Stewart /* 90f8829a4aSRandall Stewart * ancillary data structures 91f8829a4aSRandall Stewart */ 92f8829a4aSRandall Stewart struct sctp_initmsg { 93667d2d3cSRandall Stewart uint16_t sinit_num_ostreams; 94667d2d3cSRandall Stewart uint16_t sinit_max_instreams; 95f8829a4aSRandall Stewart uint16_t sinit_max_attempts; 96f8829a4aSRandall Stewart uint16_t sinit_max_init_timeo; 97f8829a4aSRandall Stewart }; 98f8829a4aSRandall Stewart 99f8829a4aSRandall Stewart /* We add 96 bytes to the size of sctp_sndrcvinfo. 100f8829a4aSRandall Stewart * This makes the current structure 128 bytes long 101f8829a4aSRandall Stewart * which is nicely 64 bit aligned but also has room 102b1ce21c6SRebecca Cran * for us to add more and keep ABI compatibility. 103f8829a4aSRandall Stewart * For example, already we have the sctp_extrcvinfo 104f8829a4aSRandall Stewart * when enabled which is 48 bytes. 105f8829a4aSRandall Stewart */ 106f8829a4aSRandall Stewart 107f42a358aSRandall Stewart /* 108f42a358aSRandall Stewart * The assoc up needs a verfid 109f42a358aSRandall Stewart * all sendrcvinfo's need a verfid for SENDING only. 110f42a358aSRandall Stewart */ 111f42a358aSRandall Stewart 112f42a358aSRandall Stewart 113e2e7c62eSMichael Tuexen #define SCTP_ALIGN_RESV_PAD 92 114e2e7c62eSMichael Tuexen #define SCTP_ALIGN_RESV_PAD_SHORT 76 115f8829a4aSRandall Stewart 116f8829a4aSRandall Stewart struct sctp_sndrcvinfo { 117f8829a4aSRandall Stewart uint16_t sinfo_stream; 118f8829a4aSRandall Stewart uint16_t sinfo_ssn; 119f8829a4aSRandall Stewart uint16_t sinfo_flags; 120f8829a4aSRandall Stewart uint32_t sinfo_ppid; 121f8829a4aSRandall Stewart uint32_t sinfo_context; 122f8829a4aSRandall Stewart uint32_t sinfo_timetolive; 123f8829a4aSRandall Stewart uint32_t sinfo_tsn; 124f8829a4aSRandall Stewart uint32_t sinfo_cumtsn; 125f8829a4aSRandall Stewart sctp_assoc_t sinfo_assoc_id; 126e2e7c62eSMichael Tuexen uint16_t sinfo_keynumber; 127e2e7c62eSMichael Tuexen uint16_t sinfo_keynumber_valid; 128f8829a4aSRandall Stewart uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD]; 129f8829a4aSRandall Stewart }; 130f8829a4aSRandall Stewart 131f8829a4aSRandall Stewart struct sctp_extrcvinfo { 13263981c2bSRandall Stewart uint16_t sinfo_stream; 13363981c2bSRandall Stewart uint16_t sinfo_ssn; 13463981c2bSRandall Stewart uint16_t sinfo_flags; 13563981c2bSRandall Stewart uint32_t sinfo_ppid; 13663981c2bSRandall Stewart uint32_t sinfo_context; 13763981c2bSRandall Stewart uint32_t sinfo_timetolive; 13863981c2bSRandall Stewart uint32_t sinfo_tsn; 13963981c2bSRandall Stewart uint32_t sinfo_cumtsn; 14063981c2bSRandall Stewart sctp_assoc_t sinfo_assoc_id; 1419a6142d8SRandall Stewart uint16_t sreinfo_next_flags; 1429a6142d8SRandall Stewart uint16_t sreinfo_next_stream; 1439a6142d8SRandall Stewart uint32_t sreinfo_next_aid; 1449a6142d8SRandall Stewart uint32_t sreinfo_next_length; 1459a6142d8SRandall Stewart uint32_t sreinfo_next_ppid; 146e2e7c62eSMichael Tuexen uint16_t sinfo_keynumber; 147e2e7c62eSMichael Tuexen uint16_t sinfo_keynumber_valid; 148f42a358aSRandall Stewart uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT]; 149f8829a4aSRandall Stewart }; 150f8829a4aSRandall Stewart 151e2e7c62eSMichael Tuexen struct sctp_sndinfo { 152e2e7c62eSMichael Tuexen uint16_t snd_sid; 153e2e7c62eSMichael Tuexen uint16_t snd_flags; 154e2e7c62eSMichael Tuexen uint32_t snd_ppid; 155e2e7c62eSMichael Tuexen uint32_t snd_context; 156e2e7c62eSMichael Tuexen sctp_assoc_t snd_assoc_id; 157e2e7c62eSMichael Tuexen }; 158e2e7c62eSMichael Tuexen 159e2e7c62eSMichael Tuexen struct sctp_prinfo { 160e2e7c62eSMichael Tuexen uint16_t pr_policy; 161e2e7c62eSMichael Tuexen uint32_t pr_value; 162e2e7c62eSMichael Tuexen }; 163e2e7c62eSMichael Tuexen 1646037f89cSMichael Tuexen struct sctp_default_prinfo { 1656037f89cSMichael Tuexen uint16_t pr_policy; 1666037f89cSMichael Tuexen uint32_t pr_value; 1676037f89cSMichael Tuexen sctp_assoc_t pr_assoc_id; 1686037f89cSMichael Tuexen }; 1696037f89cSMichael Tuexen 170e2e7c62eSMichael Tuexen struct sctp_authinfo { 171254945d7SMichael Tuexen uint16_t auth_keynumber; 172e2e7c62eSMichael Tuexen }; 173e2e7c62eSMichael Tuexen 174e2e7c62eSMichael Tuexen struct sctp_rcvinfo { 175e2e7c62eSMichael Tuexen uint16_t rcv_sid; 176e2e7c62eSMichael Tuexen uint16_t rcv_ssn; 177e2e7c62eSMichael Tuexen uint16_t rcv_flags; 178e2e7c62eSMichael Tuexen uint32_t rcv_ppid; 179e2e7c62eSMichael Tuexen uint32_t rcv_tsn; 180e2e7c62eSMichael Tuexen uint32_t rcv_cumtsn; 181e2e7c62eSMichael Tuexen uint32_t rcv_context; 182e2e7c62eSMichael Tuexen sctp_assoc_t rcv_assoc_id; 183e2e7c62eSMichael Tuexen }; 184e2e7c62eSMichael Tuexen 185e2e7c62eSMichael Tuexen struct sctp_nxtinfo { 186e2e7c62eSMichael Tuexen uint16_t nxt_sid; 187e2e7c62eSMichael Tuexen uint16_t nxt_flags; 188e2e7c62eSMichael Tuexen uint32_t nxt_ppid; 189e2e7c62eSMichael Tuexen uint32_t nxt_length; 190e2e7c62eSMichael Tuexen sctp_assoc_t nxt_assoc_id; 191e2e7c62eSMichael Tuexen }; 192e2e7c62eSMichael Tuexen 193f8829a4aSRandall Stewart #define SCTP_NO_NEXT_MSG 0x0000 194f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_AVAIL 0x0001 195f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_ISCOMPLETE 0x0002 196f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_IS_UNORDERED 0x0004 197f42a358aSRandall Stewart #define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008 198f8829a4aSRandall Stewart 199e2e7c62eSMichael Tuexen struct sctp_recvv_rn { 200e2e7c62eSMichael Tuexen struct sctp_rcvinfo recvv_rcvinfo; 201e2e7c62eSMichael Tuexen struct sctp_nxtinfo recvv_nxtinfo; 202e2e7c62eSMichael Tuexen }; 203e2e7c62eSMichael Tuexen 204e2e7c62eSMichael Tuexen #define SCTP_RECVV_NOINFO 0 205e2e7c62eSMichael Tuexen #define SCTP_RECVV_RCVINFO 1 206e2e7c62eSMichael Tuexen #define SCTP_RECVV_NXTINFO 2 207e2e7c62eSMichael Tuexen #define SCTP_RECVV_RN 3 208e2e7c62eSMichael Tuexen 2090b064106SMichael Tuexen #define SCTP_SENDV_NOINFO 0 210e2e7c62eSMichael Tuexen #define SCTP_SENDV_SNDINFO 1 211e2e7c62eSMichael Tuexen #define SCTP_SENDV_PRINFO 2 212e2e7c62eSMichael Tuexen #define SCTP_SENDV_AUTHINFO 3 213e2e7c62eSMichael Tuexen #define SCTP_SENDV_SPA 4 214e2e7c62eSMichael Tuexen 215e2e7c62eSMichael Tuexen struct sctp_sendv_spa { 216e2e7c62eSMichael Tuexen uint32_t sendv_flags; 217e2e7c62eSMichael Tuexen struct sctp_sndinfo sendv_sndinfo; 218e2e7c62eSMichael Tuexen struct sctp_prinfo sendv_prinfo; 219e2e7c62eSMichael Tuexen struct sctp_authinfo sendv_authinfo; 220e2e7c62eSMichael Tuexen }; 221e2e7c62eSMichael Tuexen 222e2e7c62eSMichael Tuexen #define SCTP_SEND_SNDINFO_VALID 0x00000001 223e2e7c62eSMichael Tuexen #define SCTP_SEND_PRINFO_VALID 0x00000002 224e2e7c62eSMichael Tuexen #define SCTP_SEND_AUTHINFO_VALID 0x00000004 225e2e7c62eSMichael Tuexen 226f8829a4aSRandall Stewart struct sctp_snd_all_completes { 227f8829a4aSRandall Stewart uint16_t sall_stream; 228f8829a4aSRandall Stewart uint16_t sall_flags; 229f8829a4aSRandall Stewart uint32_t sall_ppid; 230f8829a4aSRandall Stewart uint32_t sall_context; 231f8829a4aSRandall Stewart uint32_t sall_num_sent; 232f8829a4aSRandall Stewart uint32_t sall_num_failed; 233f8829a4aSRandall Stewart }; 234f8829a4aSRandall Stewart 235f8829a4aSRandall Stewart /* Flags that go into the sinfo->sinfo_flags field */ 236e2e7c62eSMichael Tuexen #define SCTP_NOTIFICATION 0x0010 /* next message is a notification */ 237e2e7c62eSMichael Tuexen #define SCTP_COMPLETE 0x0020 /* next message is complete */ 238f8829a4aSRandall Stewart #define SCTP_EOF 0x0100 /* Start shutdown procedures */ 239f8829a4aSRandall Stewart #define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ 240f8829a4aSRandall Stewart #define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ 241f8829a4aSRandall Stewart #define SCTP_ADDR_OVER 0x0800 /* Override the primary-address */ 242f8829a4aSRandall Stewart #define SCTP_SENDALL 0x1000 /* Send this on all associations */ 243f8829a4aSRandall Stewart #define SCTP_EOR 0x2000 /* end of message signal */ 244830d754dSRandall Stewart #define SCTP_SACK_IMMEDIATELY 0x4000 /* Set I-Bit */ 2452afb3e84SRandall Stewart 246e2e7c62eSMichael Tuexen #define INVALID_SINFO_FLAG(x) (((x) & 0xfffffff0 \ 24744b7479bSRandall Stewart & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\ 248830d754dSRandall Stewart SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR |\ 249830d754dSRandall Stewart SCTP_SACK_IMMEDIATELY)) != 0) 250f8829a4aSRandall Stewart /* for the endpoint */ 251f8829a4aSRandall Stewart 252f0396ad1SMichael Tuexen /* The lower four bits is an enumeration of PR-SCTP policies */ 2533c4401ecSMichael Tuexen #define SCTP_PR_SCTP_NONE 0x0000/* Reliable transfer */ 254f8829a4aSRandall Stewart #define SCTP_PR_SCTP_TTL 0x0001/* Time based PR-SCTP */ 255f8829a4aSRandall Stewart #define SCTP_PR_SCTP_BUF 0x0002/* Buffer based PR-SCTP */ 256f8829a4aSRandall Stewart #define SCTP_PR_SCTP_RTX 0x0003/* Number of retransmissions based PR-SCTP */ 257f0396ad1SMichael Tuexen #define SCTP_PR_SCTP_MAX SCTP_PR_SCTP_RTX 258f0396ad1SMichael Tuexen #define SCTP_PR_SCTP_ALL 0x000f/* Used for aggregated stats */ 259f8829a4aSRandall Stewart 260e2e7c62eSMichael Tuexen #define PR_SCTP_POLICY(x) ((x) & 0x0f) 261f0396ad1SMichael Tuexen #define PR_SCTP_ENABLED(x) ((PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE) && \ 262f0396ad1SMichael Tuexen (PR_SCTP_POLICY(x) != SCTP_PR_SCTP_ALL)) 263f8829a4aSRandall Stewart #define PR_SCTP_TTL_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL) 264f8829a4aSRandall Stewart #define PR_SCTP_BUF_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF) 265f8829a4aSRandall Stewart #define PR_SCTP_RTX_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX) 266f0396ad1SMichael Tuexen #define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_MAX) 267f0396ad1SMichael Tuexen #define PR_SCTP_VALID_POLICY(x) (PR_SCTP_POLICY(x) <= SCTP_PR_SCTP_MAX) 268f0396ad1SMichael Tuexen 269f8829a4aSRandall Stewart /* Stat's */ 270f8829a4aSRandall Stewart struct sctp_pcbinfo { 271f8829a4aSRandall Stewart uint32_t ep_count; 272f8829a4aSRandall Stewart uint32_t asoc_count; 273f8829a4aSRandall Stewart uint32_t laddr_count; 274f8829a4aSRandall Stewart uint32_t raddr_count; 275f8829a4aSRandall Stewart uint32_t chk_count; 276f8829a4aSRandall Stewart uint32_t readq_count; 277f8829a4aSRandall Stewart uint32_t free_chunks; 278f8829a4aSRandall Stewart uint32_t stream_oque; 279f8829a4aSRandall Stewart }; 280f8829a4aSRandall Stewart 281f8829a4aSRandall Stewart struct sctp_sockstat { 282f8829a4aSRandall Stewart sctp_assoc_t ss_assoc_id; 283f8829a4aSRandall Stewart uint32_t ss_total_sndbuf; 284f8829a4aSRandall Stewart uint32_t ss_total_recv_buf; 285f8829a4aSRandall Stewart }; 286f8829a4aSRandall Stewart 287f8829a4aSRandall Stewart /* 288f8829a4aSRandall Stewart * notification event structures 289f8829a4aSRandall Stewart */ 290f8829a4aSRandall Stewart 291f8829a4aSRandall Stewart /* 292f8829a4aSRandall Stewart * association change event 293f8829a4aSRandall Stewart */ 294f8829a4aSRandall Stewart struct sctp_assoc_change { 295f8829a4aSRandall Stewart uint16_t sac_type; 296f8829a4aSRandall Stewart uint16_t sac_flags; 297f8829a4aSRandall Stewart uint32_t sac_length; 298f8829a4aSRandall Stewart uint16_t sac_state; 299f8829a4aSRandall Stewart uint16_t sac_error; 300f8829a4aSRandall Stewart uint16_t sac_outbound_streams; 301f8829a4aSRandall Stewart uint16_t sac_inbound_streams; 302f8829a4aSRandall Stewart sctp_assoc_t sac_assoc_id; 303e06b67c7SMichael Tuexen uint8_t sac_info[]; 304f8829a4aSRandall Stewart }; 305f8829a4aSRandall Stewart 306f8829a4aSRandall Stewart /* sac_state values */ 307f8829a4aSRandall Stewart #define SCTP_COMM_UP 0x0001 308f8829a4aSRandall Stewart #define SCTP_COMM_LOST 0x0002 309f8829a4aSRandall Stewart #define SCTP_RESTART 0x0003 310f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_COMP 0x0004 311f8829a4aSRandall Stewart #define SCTP_CANT_STR_ASSOC 0x0005 312f8829a4aSRandall Stewart 313e06b67c7SMichael Tuexen /* sac_info values */ 314e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_PR 0x01 315e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_AUTH 0x02 316e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_ASCONF 0x03 317e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x04 318e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_RE_CONFIG 0x05 319e06b67c7SMichael Tuexen #define SCTP_ASSOC_SUPPORTS_MAX 0x05 320f8829a4aSRandall Stewart /* 321f8829a4aSRandall Stewart * Address event 322f8829a4aSRandall Stewart */ 323f8829a4aSRandall Stewart struct sctp_paddr_change { 324f8829a4aSRandall Stewart uint16_t spc_type; 325f8829a4aSRandall Stewart uint16_t spc_flags; 326f8829a4aSRandall Stewart uint32_t spc_length; 327f8829a4aSRandall Stewart struct sockaddr_storage spc_aaddr; 328f8829a4aSRandall Stewart uint32_t spc_state; 329f8829a4aSRandall Stewart uint32_t spc_error; 330f8829a4aSRandall Stewart sctp_assoc_t spc_assoc_id; 331f8829a4aSRandall Stewart }; 332f8829a4aSRandall Stewart 333f8829a4aSRandall Stewart /* paddr state values */ 334f8829a4aSRandall Stewart #define SCTP_ADDR_AVAILABLE 0x0001 335f8829a4aSRandall Stewart #define SCTP_ADDR_UNREACHABLE 0x0002 336f8829a4aSRandall Stewart #define SCTP_ADDR_REMOVED 0x0003 337f8829a4aSRandall Stewart #define SCTP_ADDR_ADDED 0x0004 338f8829a4aSRandall Stewart #define SCTP_ADDR_MADE_PRIM 0x0005 339f8829a4aSRandall Stewart #define SCTP_ADDR_CONFIRMED 0x0006 340f8829a4aSRandall Stewart 341f8829a4aSRandall Stewart #define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */ 342ca85e948SMichael Tuexen #define SCTP_INACTIVE 0x0002 /* neither SCTP_ADDR_REACHABLE nor 343ca85e948SMichael Tuexen * SCTP_ADDR_UNCONFIRMED */ 344f8829a4aSRandall Stewart #define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */ 345f8829a4aSRandall Stewart 346f8829a4aSRandall Stewart /* remote error events */ 347f8829a4aSRandall Stewart struct sctp_remote_error { 348f8829a4aSRandall Stewart uint16_t sre_type; 349f8829a4aSRandall Stewart uint16_t sre_flags; 350f8829a4aSRandall Stewart uint32_t sre_length; 351f8829a4aSRandall Stewart uint16_t sre_error; 352f8829a4aSRandall Stewart sctp_assoc_t sre_assoc_id; 353e710ed26SMichael Tuexen uint8_t sre_data[]; 354f8829a4aSRandall Stewart }; 355f8829a4aSRandall Stewart 3569935403aSMichael Tuexen /* data send failure event (deprecated) */ 357f8829a4aSRandall Stewart struct sctp_send_failed { 358f8829a4aSRandall Stewart uint16_t ssf_type; 359f8829a4aSRandall Stewart uint16_t ssf_flags; 360f8829a4aSRandall Stewart uint32_t ssf_length; 361f8829a4aSRandall Stewart uint32_t ssf_error; 362f8829a4aSRandall Stewart struct sctp_sndrcvinfo ssf_info; 363f8829a4aSRandall Stewart sctp_assoc_t ssf_assoc_id; 364663fdad8SMichael Tuexen uint8_t ssf_data[]; 365f8829a4aSRandall Stewart }; 366f8829a4aSRandall Stewart 3679935403aSMichael Tuexen /* data send failure event (not deprecated) */ 3689935403aSMichael Tuexen struct sctp_send_failed_event { 3699935403aSMichael Tuexen uint16_t ssfe_type; 3709935403aSMichael Tuexen uint16_t ssfe_flags; 3719935403aSMichael Tuexen uint32_t ssfe_length; 3729935403aSMichael Tuexen uint32_t ssfe_error; 3739935403aSMichael Tuexen struct sctp_sndinfo ssfe_info; 3749935403aSMichael Tuexen sctp_assoc_t ssfe_assoc_id; 3759935403aSMichael Tuexen uint8_t ssfe_data[]; 3769935403aSMichael Tuexen }; 3779935403aSMichael Tuexen 378f8829a4aSRandall Stewart /* flag that indicates state of data */ 379f8829a4aSRandall Stewart #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */ 380f8829a4aSRandall Stewart #define SCTP_DATA_SENT 0x0002 /* on wire at failure */ 381f8829a4aSRandall Stewart 382f8829a4aSRandall Stewart /* shutdown event */ 383f8829a4aSRandall Stewart struct sctp_shutdown_event { 384f8829a4aSRandall Stewart uint16_t sse_type; 385f8829a4aSRandall Stewart uint16_t sse_flags; 386f8829a4aSRandall Stewart uint32_t sse_length; 387f8829a4aSRandall Stewart sctp_assoc_t sse_assoc_id; 388f8829a4aSRandall Stewart }; 389f8829a4aSRandall Stewart 390f8829a4aSRandall Stewart /* Adaptation layer indication stuff */ 391f8829a4aSRandall Stewart struct sctp_adaptation_event { 392f8829a4aSRandall Stewart uint16_t sai_type; 393f8829a4aSRandall Stewart uint16_t sai_flags; 394f8829a4aSRandall Stewart uint32_t sai_length; 395f8829a4aSRandall Stewart uint32_t sai_adaptation_ind; 396f8829a4aSRandall Stewart sctp_assoc_t sai_assoc_id; 397f8829a4aSRandall Stewart }; 398f8829a4aSRandall Stewart 399f8829a4aSRandall Stewart struct sctp_setadaptation { 400f8829a4aSRandall Stewart uint32_t ssb_adaptation_ind; 401f8829a4aSRandall Stewart }; 402f8829a4aSRandall Stewart 403b1ce21c6SRebecca Cran /* compatible old spelling */ 404f8829a4aSRandall Stewart struct sctp_adaption_event { 405f8829a4aSRandall Stewart uint16_t sai_type; 406f8829a4aSRandall Stewart uint16_t sai_flags; 407f8829a4aSRandall Stewart uint32_t sai_length; 408f8829a4aSRandall Stewart uint32_t sai_adaption_ind; 409f8829a4aSRandall Stewart sctp_assoc_t sai_assoc_id; 410f8829a4aSRandall Stewart }; 411f8829a4aSRandall Stewart 412f8829a4aSRandall Stewart struct sctp_setadaption { 413f8829a4aSRandall Stewart uint32_t ssb_adaption_ind; 414f8829a4aSRandall Stewart }; 415f8829a4aSRandall Stewart 416f8829a4aSRandall Stewart 417f8829a4aSRandall Stewart /* 418f8829a4aSRandall Stewart * Partial Delivery API event 419f8829a4aSRandall Stewart */ 420f8829a4aSRandall Stewart struct sctp_pdapi_event { 421f8829a4aSRandall Stewart uint16_t pdapi_type; 422f8829a4aSRandall Stewart uint16_t pdapi_flags; 423f8829a4aSRandall Stewart uint32_t pdapi_length; 424f8829a4aSRandall Stewart uint32_t pdapi_indication; 4259a6142d8SRandall Stewart uint16_t pdapi_stream; 4269a6142d8SRandall Stewart uint16_t pdapi_seq; 427f8829a4aSRandall Stewart sctp_assoc_t pdapi_assoc_id; 428f8829a4aSRandall Stewart }; 429f8829a4aSRandall Stewart 430f8829a4aSRandall Stewart /* indication values */ 431f8829a4aSRandall Stewart #define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001 432f8829a4aSRandall Stewart 433f8829a4aSRandall Stewart 434f8829a4aSRandall Stewart /* 435f8829a4aSRandall Stewart * authentication key event 436f8829a4aSRandall Stewart */ 437f8829a4aSRandall Stewart struct sctp_authkey_event { 438f8829a4aSRandall Stewart uint16_t auth_type; 439f8829a4aSRandall Stewart uint16_t auth_flags; 440f8829a4aSRandall Stewart uint32_t auth_length; 441f8829a4aSRandall Stewart uint16_t auth_keynumber; 442f8829a4aSRandall Stewart uint16_t auth_altkeynumber; 443f8829a4aSRandall Stewart uint32_t auth_indication; 444f8829a4aSRandall Stewart sctp_assoc_t auth_assoc_id; 445f8829a4aSRandall Stewart }; 446f8829a4aSRandall Stewart 447f8829a4aSRandall Stewart /* indication values */ 44878f28045SMichael Tuexen #define SCTP_AUTH_NEW_KEY 0x0001 44978f28045SMichael Tuexen #define SCTP_AUTH_NEWKEY SCTP_AUTH_NEW_KEY 450830d754dSRandall Stewart #define SCTP_AUTH_NO_AUTH 0x0002 451830d754dSRandall Stewart #define SCTP_AUTH_FREE_KEY 0x0003 452830d754dSRandall Stewart 453830d754dSRandall Stewart 454830d754dSRandall Stewart struct sctp_sender_dry_event { 455830d754dSRandall Stewart uint16_t sender_dry_type; 456830d754dSRandall Stewart uint16_t sender_dry_flags; 457830d754dSRandall Stewart uint32_t sender_dry_length; 458830d754dSRandall Stewart sctp_assoc_t sender_dry_assoc_id; 459830d754dSRandall Stewart }; 460f8829a4aSRandall Stewart 461f8829a4aSRandall Stewart 462f8829a4aSRandall Stewart /* 463c4e848b7SRandall Stewart * Stream reset event - subscribe to SCTP_STREAM_RESET_EVENT 464f8829a4aSRandall Stewart */ 465f8829a4aSRandall Stewart struct sctp_stream_reset_event { 466f8829a4aSRandall Stewart uint16_t strreset_type; 467f8829a4aSRandall Stewart uint16_t strreset_flags; 468f8829a4aSRandall Stewart uint32_t strreset_length; 469f8829a4aSRandall Stewart sctp_assoc_t strreset_assoc_id; 470c4e848b7SRandall Stewart uint16_t strreset_stream_list[]; 471f8829a4aSRandall Stewart }; 472f8829a4aSRandall Stewart 473c4e848b7SRandall Stewart /* flags in stream_reset_event (strreset_flags) */ 474d7714577SMichael Tuexen #define SCTP_STREAM_RESET_INCOMING_SSN 0x0001 475d7714577SMichael Tuexen #define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 476d7714577SMichael Tuexen #define SCTP_STREAM_RESET_DENIED 0x0004 477d7714577SMichael Tuexen #define SCTP_STREAM_RESET_FAILED 0x0008 478c4e848b7SRandall Stewart 479c4e848b7SRandall Stewart /* 480c4e848b7SRandall Stewart * Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT 481c4e848b7SRandall Stewart */ 482c4e848b7SRandall Stewart struct sctp_assoc_reset_event { 483c4e848b7SRandall Stewart uint16_t assocreset_type; 484c4e848b7SRandall Stewart uint16_t assocreset_flags; 485c4e848b7SRandall Stewart uint32_t assocreset_length; 486c4e848b7SRandall Stewart sctp_assoc_t assocreset_assoc_id; 487c4e848b7SRandall Stewart uint32_t assocreset_local_tsn; 488c4e848b7SRandall Stewart uint32_t assocreset_remote_tsn; 489c4e848b7SRandall Stewart }; 490c4e848b7SRandall Stewart 491c4e848b7SRandall Stewart #define SCTP_ASSOC_RESET_DENIED 0x0004 492c4e848b7SRandall Stewart #define SCTP_ASSOC_RESET_FAILED 0x0008 493c4e848b7SRandall Stewart 494c4e848b7SRandall Stewart /* 495c4e848b7SRandall Stewart * Stream change event - subscribe to SCTP_STREAM_CHANGE_EVENT 496c4e848b7SRandall Stewart */ 497c4e848b7SRandall Stewart struct sctp_stream_change_event { 498c4e848b7SRandall Stewart uint16_t strchange_type; 499c4e848b7SRandall Stewart uint16_t strchange_flags; 500c4e848b7SRandall Stewart uint32_t strchange_length; 501c4e848b7SRandall Stewart sctp_assoc_t strchange_assoc_id; 502c4e848b7SRandall Stewart uint16_t strchange_instrms; 503c4e848b7SRandall Stewart uint16_t strchange_outstrms; 504c4e848b7SRandall Stewart }; 505c4e848b7SRandall Stewart 506c4e848b7SRandall Stewart #define SCTP_STREAM_CHANGE_DENIED 0x0004 507c4e848b7SRandall Stewart #define SCTP_STREAM_CHANGE_FAILED 0x0008 508c4e848b7SRandall Stewart 509f8829a4aSRandall Stewart 510f8829a4aSRandall Stewart /* SCTP notification event */ 511f8829a4aSRandall Stewart struct sctp_tlv { 512f8829a4aSRandall Stewart uint16_t sn_type; 513f8829a4aSRandall Stewart uint16_t sn_flags; 514f8829a4aSRandall Stewart uint32_t sn_length; 515f8829a4aSRandall Stewart }; 516f8829a4aSRandall Stewart 517f8829a4aSRandall Stewart union sctp_notification { 518f8829a4aSRandall Stewart struct sctp_tlv sn_header; 519f8829a4aSRandall Stewart struct sctp_assoc_change sn_assoc_change; 520f8829a4aSRandall Stewart struct sctp_paddr_change sn_paddr_change; 521f8829a4aSRandall Stewart struct sctp_remote_error sn_remote_error; 522f8829a4aSRandall Stewart struct sctp_send_failed sn_send_failed; 523f8829a4aSRandall Stewart struct sctp_shutdown_event sn_shutdown_event; 524f8829a4aSRandall Stewart struct sctp_adaptation_event sn_adaptation_event; 525b1ce21c6SRebecca Cran /* compatibility same as above */ 526f8829a4aSRandall Stewart struct sctp_adaption_event sn_adaption_event; 527f8829a4aSRandall Stewart struct sctp_pdapi_event sn_pdapi_event; 528f8829a4aSRandall Stewart struct sctp_authkey_event sn_auth_event; 529830d754dSRandall Stewart struct sctp_sender_dry_event sn_sender_dry_event; 53014ce0c0cSMichael Tuexen struct sctp_send_failed_event sn_send_failed_event; 531f8829a4aSRandall Stewart struct sctp_stream_reset_event sn_strreset_event; 532c4e848b7SRandall Stewart struct sctp_assoc_reset_event sn_assocreset_event; 533c4e848b7SRandall Stewart struct sctp_stream_change_event sn_strchange_event; 534f8829a4aSRandall Stewart }; 535f8829a4aSRandall Stewart 536f8829a4aSRandall Stewart /* notification types */ 537f8829a4aSRandall Stewart #define SCTP_ASSOC_CHANGE 0x0001 538f8829a4aSRandall Stewart #define SCTP_PEER_ADDR_CHANGE 0x0002 539f8829a4aSRandall Stewart #define SCTP_REMOTE_ERROR 0x0003 540f8829a4aSRandall Stewart #define SCTP_SEND_FAILED 0x0004 541f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_EVENT 0x0005 542f8829a4aSRandall Stewart #define SCTP_ADAPTATION_INDICATION 0x0006 543f8829a4aSRandall Stewart /* same as above */ 544f8829a4aSRandall Stewart #define SCTP_ADAPTION_INDICATION 0x0006 545f8829a4aSRandall Stewart #define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 546f8829a4aSRandall Stewart #define SCTP_AUTHENTICATION_EVENT 0x0008 547f8829a4aSRandall Stewart #define SCTP_STREAM_RESET_EVENT 0x0009 548830d754dSRandall Stewart #define SCTP_SENDER_DRY_EVENT 0x000a 5490a80a2deSMichael Tuexen #define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b /* we don't send this */ 550c4e848b7SRandall Stewart #define SCTP_ASSOC_RESET_EVENT 0x000c 551c4e848b7SRandall Stewart #define SCTP_STREAM_CHANGE_EVENT 0x000d 5529935403aSMichael Tuexen #define SCTP_SEND_FAILED_EVENT 0x000e 553f8829a4aSRandall Stewart /* 554f8829a4aSRandall Stewart * socket option structs 555f8829a4aSRandall Stewart */ 556f8829a4aSRandall Stewart 557f8829a4aSRandall Stewart struct sctp_paddrparams { 558f8829a4aSRandall Stewart struct sockaddr_storage spp_address; 559671d309cSRandall Stewart sctp_assoc_t spp_assoc_id; 560f8829a4aSRandall Stewart uint32_t spp_hbinterval; 561f8829a4aSRandall Stewart uint32_t spp_pathmtu; 562f8829a4aSRandall Stewart uint32_t spp_flags; 563f8829a4aSRandall Stewart uint32_t spp_ipv6_flowlabel; 564671d309cSRandall Stewart uint16_t spp_pathmaxrxt; 565b10f2dc8SMichael Tuexen uint8_t spp_dscp; 566f8829a4aSRandall Stewart }; 567f8829a4aSRandall Stewart 568b10f2dc8SMichael Tuexen #define spp_ipv4_tos spp_dscp 569b10f2dc8SMichael Tuexen 570f8829a4aSRandall Stewart #define SPP_HB_ENABLE 0x00000001 571f8829a4aSRandall Stewart #define SPP_HB_DISABLE 0x00000002 572f8829a4aSRandall Stewart #define SPP_HB_DEMAND 0x00000004 573f8829a4aSRandall Stewart #define SPP_PMTUD_ENABLE 0x00000008 574f8829a4aSRandall Stewart #define SPP_PMTUD_DISABLE 0x00000010 575f8829a4aSRandall Stewart #define SPP_HB_TIME_IS_ZERO 0x00000080 576f8829a4aSRandall Stewart #define SPP_IPV6_FLOWLABEL 0x00000100 577b10f2dc8SMichael Tuexen #define SPP_DSCP 0x00000200 578b10f2dc8SMichael Tuexen #define SPP_IPV4_TOS SPP_DSCP 579f8829a4aSRandall Stewart 580ca85e948SMichael Tuexen struct sctp_paddrthlds { 581ca85e948SMichael Tuexen struct sockaddr_storage spt_address; 582ec9925edSMichael Tuexen sctp_assoc_t spt_assoc_id; 583ca85e948SMichael Tuexen uint16_t spt_pathmaxrxt; 584ca85e948SMichael Tuexen uint16_t spt_pathpfthld; 585ca85e948SMichael Tuexen }; 586ca85e948SMichael Tuexen 587f8829a4aSRandall Stewart struct sctp_paddrinfo { 588f8829a4aSRandall Stewart struct sockaddr_storage spinfo_address; 589671d309cSRandall Stewart sctp_assoc_t spinfo_assoc_id; 590f8829a4aSRandall Stewart int32_t spinfo_state; 591f8829a4aSRandall Stewart uint32_t spinfo_cwnd; 592f8829a4aSRandall Stewart uint32_t spinfo_srtt; 593f8829a4aSRandall Stewart uint32_t spinfo_rto; 594f8829a4aSRandall Stewart uint32_t spinfo_mtu; 595f8829a4aSRandall Stewart }; 596f8829a4aSRandall Stewart 597f8829a4aSRandall Stewart struct sctp_rtoinfo { 598f8829a4aSRandall Stewart sctp_assoc_t srto_assoc_id; 599f8829a4aSRandall Stewart uint32_t srto_initial; 600f8829a4aSRandall Stewart uint32_t srto_max; 601f8829a4aSRandall Stewart uint32_t srto_min; 602f8829a4aSRandall Stewart }; 603f8829a4aSRandall Stewart 604f8829a4aSRandall Stewart struct sctp_assocparams { 605f8829a4aSRandall Stewart sctp_assoc_t sasoc_assoc_id; 606f8829a4aSRandall Stewart uint32_t sasoc_peer_rwnd; 607f8829a4aSRandall Stewart uint32_t sasoc_local_rwnd; 608f8829a4aSRandall Stewart uint32_t sasoc_cookie_life; 609671d309cSRandall Stewart uint16_t sasoc_asocmaxrxt; 610671d309cSRandall Stewart uint16_t sasoc_number_peer_destinations; 611f8829a4aSRandall Stewart }; 612f8829a4aSRandall Stewart 613f8829a4aSRandall Stewart struct sctp_setprim { 614f8829a4aSRandall Stewart struct sockaddr_storage ssp_addr; 615671d309cSRandall Stewart sctp_assoc_t ssp_assoc_id; 616671d309cSRandall Stewart uint8_t ssp_padding[4]; 617f8829a4aSRandall Stewart }; 618f8829a4aSRandall Stewart 619f8829a4aSRandall Stewart struct sctp_setpeerprim { 620f8829a4aSRandall Stewart struct sockaddr_storage sspp_addr; 621671d309cSRandall Stewart sctp_assoc_t sspp_assoc_id; 622671d309cSRandall Stewart uint8_t sspp_padding[4]; 623f8829a4aSRandall Stewart }; 624f8829a4aSRandall Stewart 625f8829a4aSRandall Stewart struct sctp_getaddresses { 626f8829a4aSRandall Stewart sctp_assoc_t sget_assoc_id; 627f8829a4aSRandall Stewart /* addr is filled in for N * sockaddr_storage */ 628f8829a4aSRandall Stewart struct sockaddr addr[1]; 629f8829a4aSRandall Stewart }; 630f8829a4aSRandall Stewart 631f8829a4aSRandall Stewart struct sctp_status { 632f8829a4aSRandall Stewart sctp_assoc_t sstat_assoc_id; 633f8829a4aSRandall Stewart int32_t sstat_state; 634f8829a4aSRandall Stewart uint32_t sstat_rwnd; 635f8829a4aSRandall Stewart uint16_t sstat_unackdata; 636f8829a4aSRandall Stewart uint16_t sstat_penddata; 637f8829a4aSRandall Stewart uint16_t sstat_instrms; 638f8829a4aSRandall Stewart uint16_t sstat_outstrms; 639f8829a4aSRandall Stewart uint32_t sstat_fragmentation_point; 640f8829a4aSRandall Stewart struct sctp_paddrinfo sstat_primary; 641f8829a4aSRandall Stewart }; 642f8829a4aSRandall Stewart 643f8829a4aSRandall Stewart /* 644f8829a4aSRandall Stewart * AUTHENTICATION support 645f8829a4aSRandall Stewart */ 646f8829a4aSRandall Stewart /* SCTP_AUTH_CHUNK */ 647f8829a4aSRandall Stewart struct sctp_authchunk { 648f8829a4aSRandall Stewart uint8_t sauth_chunk; 649f8829a4aSRandall Stewart }; 650f8829a4aSRandall Stewart 651f8829a4aSRandall Stewart /* SCTP_AUTH_KEY */ 652f8829a4aSRandall Stewart struct sctp_authkey { 653f8829a4aSRandall Stewart sctp_assoc_t sca_assoc_id; 654f8829a4aSRandall Stewart uint16_t sca_keynumber; 655b845acdaSMichael Tuexen uint16_t sca_keylength; 656663fdad8SMichael Tuexen uint8_t sca_key[]; 657f8829a4aSRandall Stewart }; 658f8829a4aSRandall Stewart 659f8829a4aSRandall Stewart /* SCTP_HMAC_IDENT */ 660f8829a4aSRandall Stewart struct sctp_hmacalgo { 661bfefd190SRandall Stewart uint32_t shmac_number_of_idents; 662663fdad8SMichael Tuexen uint16_t shmac_idents[]; 663f8829a4aSRandall Stewart }; 664f8829a4aSRandall Stewart 665f8829a4aSRandall Stewart /* AUTH hmac_id */ 666f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_RSVD 0x0000 667f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA1 0x0001 /* default, mandatory */ 668f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA256 0x0003 669f8829a4aSRandall Stewart 670f8829a4aSRandall Stewart /* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */ 671f8829a4aSRandall Stewart struct sctp_authkeyid { 672f8829a4aSRandall Stewart sctp_assoc_t scact_assoc_id; 673f8829a4aSRandall Stewart uint16_t scact_keynumber; 674f8829a4aSRandall Stewart }; 675f8829a4aSRandall Stewart 676f8829a4aSRandall Stewart /* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */ 677f8829a4aSRandall Stewart struct sctp_authchunks { 678f8829a4aSRandall Stewart sctp_assoc_t gauth_assoc_id; 6795fc8d746SMichael Tuexen uint32_t gauth_number_of_chunks; 680663fdad8SMichael Tuexen uint8_t gauth_chunks[]; 681f8829a4aSRandall Stewart }; 682f8829a4aSRandall Stewart 683f8829a4aSRandall Stewart struct sctp_assoc_value { 684f8829a4aSRandall Stewart sctp_assoc_t assoc_id; 685f8829a4aSRandall Stewart uint32_t assoc_value; 686f8829a4aSRandall Stewart }; 687f8829a4aSRandall Stewart 688299108c5SRandall Stewart struct sctp_cc_option { 689299108c5SRandall Stewart int option; 690299108c5SRandall Stewart struct sctp_assoc_value aid_value; 691299108c5SRandall Stewart }; 692299108c5SRandall Stewart 693f7a77f6fSMichael Tuexen struct sctp_stream_value { 694f7a77f6fSMichael Tuexen sctp_assoc_t assoc_id; 695f7a77f6fSMichael Tuexen uint16_t stream_id; 696f7a77f6fSMichael Tuexen uint16_t stream_value; 697f7a77f6fSMichael Tuexen }; 698f7a77f6fSMichael Tuexen 699f8829a4aSRandall Stewart struct sctp_assoc_ids { 700830d754dSRandall Stewart uint32_t gaids_number_of_ids; 701663fdad8SMichael Tuexen sctp_assoc_t gaids_assoc_id[]; 702f8829a4aSRandall Stewart }; 703f8829a4aSRandall Stewart 704d61a0ae0SRandall Stewart struct sctp_sack_info { 705d61a0ae0SRandall Stewart sctp_assoc_t sack_assoc_id; 706d61a0ae0SRandall Stewart uint32_t sack_delay; 707d61a0ae0SRandall Stewart uint32_t sack_freq; 708d61a0ae0SRandall Stewart }; 709d61a0ae0SRandall Stewart 7106a67588bSMichael Tuexen struct sctp_timeouts { 7116a67588bSMichael Tuexen sctp_assoc_t stimo_assoc_id; 7126a67588bSMichael Tuexen uint32_t stimo_init; 7136a67588bSMichael Tuexen uint32_t stimo_data; 7146a67588bSMichael Tuexen uint32_t stimo_sack; 7156a67588bSMichael Tuexen uint32_t stimo_shutdown; 7166a67588bSMichael Tuexen uint32_t stimo_heartbeat; 7176a67588bSMichael Tuexen uint32_t stimo_cookie; 7186a67588bSMichael Tuexen uint32_t stimo_shutdownack; 7196a67588bSMichael Tuexen }; 7206a67588bSMichael Tuexen 721c9c58059SMichael Tuexen struct sctp_udpencaps { 722c9c58059SMichael Tuexen struct sockaddr_storage sue_address; 723052230f9SMichael Tuexen sctp_assoc_t sue_assoc_id; 724c9c58059SMichael Tuexen uint16_t sue_port; 725c9c58059SMichael Tuexen }; 726c9c58059SMichael Tuexen 727f0396ad1SMichael Tuexen struct sctp_prstatus { 728f0396ad1SMichael Tuexen sctp_assoc_t sprstat_assoc_id; 729f0396ad1SMichael Tuexen uint16_t sprstat_sid; 730f0396ad1SMichael Tuexen uint16_t sprstat_policy; 731f0396ad1SMichael Tuexen uint64_t sprstat_abandoned_unsent; 732f0396ad1SMichael Tuexen uint64_t sprstat_abandoned_sent; 733f0396ad1SMichael Tuexen }; 734f0396ad1SMichael Tuexen 735f8829a4aSRandall Stewart struct sctp_cwnd_args { 736671d309cSRandall Stewart struct sctp_nets *net; /* network to *//* FIXME: LP64 issue */ 737f8829a4aSRandall Stewart uint32_t cwnd_new_value;/* cwnd in k */ 738f8829a4aSRandall Stewart uint32_t pseudo_cumack; 7398933fa13SRandall Stewart uint16_t inflight; /* flightsize in k */ 7408933fa13SRandall Stewart uint16_t cwnd_augment; /* increment to it */ 741f8829a4aSRandall Stewart uint8_t meets_pseudo_cumack; 742f8829a4aSRandall Stewart uint8_t need_new_pseudo_cumack; 743f8829a4aSRandall Stewart uint8_t cnt_in_send; 744f8829a4aSRandall Stewart uint8_t cnt_in_str; 745f8829a4aSRandall Stewart }; 746f8829a4aSRandall Stewart 747f8829a4aSRandall Stewart struct sctp_blk_args { 748f8829a4aSRandall Stewart uint32_t onsb; /* in 1k bytes */ 749f8829a4aSRandall Stewart uint32_t sndlen; /* len of send being attempted */ 750f8829a4aSRandall Stewart uint32_t peer_rwnd; /* rwnd of peer */ 751f8829a4aSRandall Stewart uint16_t send_sent_qcnt;/* chnk cnt */ 752f8829a4aSRandall Stewart uint16_t stream_qcnt; /* chnk cnt */ 753f8829a4aSRandall Stewart uint16_t chunks_on_oque;/* chunks out */ 754f8829a4aSRandall Stewart uint16_t flight_size; /* flight size in k */ 755f8829a4aSRandall Stewart }; 756f8829a4aSRandall Stewart 757f8829a4aSRandall Stewart /* 758f8829a4aSRandall Stewart * Max we can reset in one setting, note this is dictated not by the define 759f8829a4aSRandall Stewart * but the size of a mbuf cluster so don't change this define and think you 760f8829a4aSRandall Stewart * can specify more. You must do multiple resets if you want to reset more 761f8829a4aSRandall Stewart * than SCTP_MAX_EXPLICIT_STR_RESET. 762f8829a4aSRandall Stewart */ 763f8829a4aSRandall Stewart #define SCTP_MAX_EXPLICT_STR_RESET 1000 764f8829a4aSRandall Stewart 765c4e848b7SRandall Stewart struct sctp_reset_streams { 766c4e848b7SRandall Stewart sctp_assoc_t srs_assoc_id; 767c4e848b7SRandall Stewart uint16_t srs_flags; 768c4e848b7SRandall Stewart uint16_t srs_number_streams; /* 0 == ALL */ 769c4e848b7SRandall Stewart uint16_t srs_stream_list[]; /* list if strrst_num_streams is not 0 */ 770f8829a4aSRandall Stewart }; 771f8829a4aSRandall Stewart 772c4e848b7SRandall Stewart struct sctp_add_streams { 773c4e848b7SRandall Stewart sctp_assoc_t sas_assoc_id; 774c4e848b7SRandall Stewart uint16_t sas_instrms; 775c4e848b7SRandall Stewart uint16_t sas_outstrms; 776c4e848b7SRandall Stewart }; 777f8829a4aSRandall Stewart 778f8829a4aSRandall Stewart struct sctp_get_nonce_values { 779f8829a4aSRandall Stewart sctp_assoc_t gn_assoc_id; 780f8829a4aSRandall Stewart uint32_t gn_peers_tag; 781f8829a4aSRandall Stewart uint32_t gn_local_tag; 782f8829a4aSRandall Stewart }; 783f8829a4aSRandall Stewart 784f8829a4aSRandall Stewart /* Debugging logs */ 785f8829a4aSRandall Stewart struct sctp_str_log { 786671d309cSRandall Stewart void *stcb; /* FIXME: LP64 issue */ 787f8829a4aSRandall Stewart uint32_t n_tsn; 788f8829a4aSRandall Stewart uint32_t e_tsn; 789f8829a4aSRandall Stewart uint16_t n_sseq; 790f8829a4aSRandall Stewart uint16_t e_sseq; 7916a91f103SRandall Stewart uint16_t strm; 792f8829a4aSRandall Stewart }; 793f8829a4aSRandall Stewart 794f8829a4aSRandall Stewart struct sctp_sb_log { 795671d309cSRandall Stewart void *stcb; /* FIXME: LP64 issue */ 796f8829a4aSRandall Stewart uint32_t so_sbcc; 797f8829a4aSRandall Stewart uint32_t stcb_sbcc; 798f8829a4aSRandall Stewart uint32_t incr; 799f8829a4aSRandall Stewart }; 800f8829a4aSRandall Stewart 801f8829a4aSRandall Stewart struct sctp_fr_log { 802f8829a4aSRandall Stewart uint32_t largest_tsn; 803f8829a4aSRandall Stewart uint32_t largest_new_tsn; 804f8829a4aSRandall Stewart uint32_t tsn; 805f8829a4aSRandall Stewart }; 806f8829a4aSRandall Stewart 807f8829a4aSRandall Stewart struct sctp_fr_map { 808f8829a4aSRandall Stewart uint32_t base; 809f8829a4aSRandall Stewart uint32_t cum; 810f8829a4aSRandall Stewart uint32_t high; 811f8829a4aSRandall Stewart }; 812f8829a4aSRandall Stewart 813f8829a4aSRandall Stewart struct sctp_rwnd_log { 814f8829a4aSRandall Stewart uint32_t rwnd; 815f8829a4aSRandall Stewart uint32_t send_size; 816f8829a4aSRandall Stewart uint32_t overhead; 817f8829a4aSRandall Stewart uint32_t new_rwnd; 818f8829a4aSRandall Stewart }; 819f8829a4aSRandall Stewart 820f8829a4aSRandall Stewart struct sctp_mbcnt_log { 821f8829a4aSRandall Stewart uint32_t total_queue_size; 822f8829a4aSRandall Stewart uint32_t size_change; 823f8829a4aSRandall Stewart uint32_t total_queue_mb_size; 824f8829a4aSRandall Stewart uint32_t mbcnt_change; 825f8829a4aSRandall Stewart }; 826f8829a4aSRandall Stewart 827f8829a4aSRandall Stewart struct sctp_sack_log { 828f8829a4aSRandall Stewart uint32_t cumack; 829f8829a4aSRandall Stewart uint32_t oldcumack; 830f8829a4aSRandall Stewart uint32_t tsn; 831f8829a4aSRandall Stewart uint16_t numGaps; 832f8829a4aSRandall Stewart uint16_t numDups; 833f8829a4aSRandall Stewart }; 834f8829a4aSRandall Stewart 835f8829a4aSRandall Stewart struct sctp_lock_log { 836671d309cSRandall Stewart void *sock; /* FIXME: LP64 issue */ 837671d309cSRandall Stewart void *inp; /* FIXME: LP64 issue */ 838f8829a4aSRandall Stewart uint8_t tcb_lock; 839f8829a4aSRandall Stewart uint8_t inp_lock; 840f8829a4aSRandall Stewart uint8_t info_lock; 841f8829a4aSRandall Stewart uint8_t sock_lock; 842f8829a4aSRandall Stewart uint8_t sockrcvbuf_lock; 843f8829a4aSRandall Stewart uint8_t socksndbuf_lock; 844f8829a4aSRandall Stewart uint8_t create_lock; 845f8829a4aSRandall Stewart uint8_t resv; 846f8829a4aSRandall Stewart }; 847f8829a4aSRandall Stewart 848f8829a4aSRandall Stewart struct sctp_rto_log { 849671d309cSRandall Stewart void *net; /* FIXME: LP64 issue */ 850f8829a4aSRandall Stewart uint32_t rtt; 851f8829a4aSRandall Stewart }; 852f8829a4aSRandall Stewart 853f8829a4aSRandall Stewart struct sctp_nagle_log { 854671d309cSRandall Stewart void *stcb; /* FIXME: LP64 issue */ 855f8829a4aSRandall Stewart uint32_t total_flight; 856f8829a4aSRandall Stewart uint32_t total_in_queue; 857f8829a4aSRandall Stewart uint16_t count_in_queue; 858f8829a4aSRandall Stewart uint16_t count_in_flight; 859f8829a4aSRandall Stewart }; 860f8829a4aSRandall Stewart 861f8829a4aSRandall Stewart struct sctp_sbwake_log { 862671d309cSRandall Stewart void *stcb; /* FIXME: LP64 issue */ 863f8829a4aSRandall Stewart uint16_t send_q; 864f8829a4aSRandall Stewart uint16_t sent_q; 865f8829a4aSRandall Stewart uint16_t flight; 866f8829a4aSRandall Stewart uint16_t wake_cnt; 867f8829a4aSRandall Stewart uint8_t stream_qcnt; /* chnk cnt */ 868f8829a4aSRandall Stewart uint8_t chunks_on_oque; /* chunks out */ 869f8829a4aSRandall Stewart uint8_t sbflags; 870f8829a4aSRandall Stewart uint8_t sctpflags; 871f8829a4aSRandall Stewart }; 872f8829a4aSRandall Stewart 873f8829a4aSRandall Stewart struct sctp_misc_info { 874f8829a4aSRandall Stewart uint32_t log1; 875f8829a4aSRandall Stewart uint32_t log2; 876f8829a4aSRandall Stewart uint32_t log3; 877f8829a4aSRandall Stewart uint32_t log4; 878f8829a4aSRandall Stewart }; 879f8829a4aSRandall Stewart 880f8829a4aSRandall Stewart struct sctp_log_closing { 881671d309cSRandall Stewart void *inp; /* FIXME: LP64 issue */ 882671d309cSRandall Stewart void *stcb; /* FIXME: LP64 issue */ 883f8829a4aSRandall Stewart uint32_t sctp_flags; 884f8829a4aSRandall Stewart uint16_t state; 885f8829a4aSRandall Stewart int16_t loc; 886f8829a4aSRandall Stewart }; 887f8829a4aSRandall Stewart 888f8829a4aSRandall Stewart struct sctp_mbuf_log { 889671d309cSRandall Stewart struct mbuf *mp; /* FIXME: LP64 issue */ 890f8829a4aSRandall Stewart caddr_t ext; 891f8829a4aSRandall Stewart caddr_t data; 892f8829a4aSRandall Stewart uint16_t size; 893f8829a4aSRandall Stewart uint8_t refcnt; 894f8829a4aSRandall Stewart uint8_t mbuf_flags; 895f8829a4aSRandall Stewart }; 896f8829a4aSRandall Stewart 897f8829a4aSRandall Stewart struct sctp_cwnd_log { 89880fefe0aSRandall Stewart uint64_t time_event; 899f8829a4aSRandall Stewart uint8_t from; 900f8829a4aSRandall Stewart uint8_t event_type; 901f8829a4aSRandall Stewart uint8_t resv[2]; 902f8829a4aSRandall Stewart union { 903f8829a4aSRandall Stewart struct sctp_log_closing close; 904f8829a4aSRandall Stewart struct sctp_blk_args blk; 905f8829a4aSRandall Stewart struct sctp_cwnd_args cwnd; 906f8829a4aSRandall Stewart struct sctp_str_log strlog; 907f8829a4aSRandall Stewart struct sctp_fr_log fr; 908f8829a4aSRandall Stewart struct sctp_fr_map map; 909f8829a4aSRandall Stewart struct sctp_rwnd_log rwnd; 910f8829a4aSRandall Stewart struct sctp_mbcnt_log mbcnt; 911f8829a4aSRandall Stewart struct sctp_sack_log sack; 912f8829a4aSRandall Stewart struct sctp_lock_log lock; 913f8829a4aSRandall Stewart struct sctp_rto_log rto; 914f8829a4aSRandall Stewart struct sctp_sb_log sb; 915f8829a4aSRandall Stewart struct sctp_nagle_log nagle; 916f8829a4aSRandall Stewart struct sctp_sbwake_log wake; 917f8829a4aSRandall Stewart struct sctp_mbuf_log mb; 918f8829a4aSRandall Stewart struct sctp_misc_info misc; 919f8829a4aSRandall Stewart } x; 920f8829a4aSRandall Stewart }; 921f8829a4aSRandall Stewart 922f8829a4aSRandall Stewart struct sctp_cwnd_log_req { 923671d309cSRandall Stewart int32_t num_in_log; /* Number in log */ 924671d309cSRandall Stewart int32_t num_ret; /* Number returned */ 925671d309cSRandall Stewart int32_t start_at; /* start at this one */ 926671d309cSRandall Stewart int32_t end_at; /* end at this one */ 927663fdad8SMichael Tuexen struct sctp_cwnd_log log[]; 928f8829a4aSRandall Stewart }; 929f8829a4aSRandall Stewart 930851b7298SRandall Stewart struct sctp_timeval { 931851b7298SRandall Stewart uint32_t tv_sec; 932851b7298SRandall Stewart uint32_t tv_usec; 933851b7298SRandall Stewart }; 934851b7298SRandall Stewart 935f8829a4aSRandall Stewart struct sctpstat { 936892f1c71SRandall Stewart struct sctp_timeval sctps_discontinuitytime; /* sctpStats 18 937892f1c71SRandall Stewart * (TimeStamp) */ 938f8829a4aSRandall Stewart /* MIB according to RFC 3873 */ 939671d309cSRandall Stewart uint32_t sctps_currestab; /* sctpStats 1 (Gauge32) */ 940671d309cSRandall Stewart uint32_t sctps_activeestab; /* sctpStats 2 (Counter32) */ 941671d309cSRandall Stewart uint32_t sctps_restartestab; 942671d309cSRandall Stewart uint32_t sctps_collisionestab; 943671d309cSRandall Stewart uint32_t sctps_passiveestab; /* sctpStats 3 (Counter32) */ 944671d309cSRandall Stewart uint32_t sctps_aborted; /* sctpStats 4 (Counter32) */ 945671d309cSRandall Stewart uint32_t sctps_shutdown;/* sctpStats 5 (Counter32) */ 946671d309cSRandall Stewart uint32_t sctps_outoftheblue; /* sctpStats 6 (Counter32) */ 947671d309cSRandall Stewart uint32_t sctps_checksumerrors; /* sctpStats 7 (Counter32) */ 948671d309cSRandall Stewart uint32_t sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */ 949671d309cSRandall Stewart uint32_t sctps_outorderchunks; /* sctpStats 9 (Counter64) */ 950671d309cSRandall Stewart uint32_t sctps_outunorderchunks; /* sctpStats 10 (Counter64) */ 951671d309cSRandall Stewart uint32_t sctps_incontrolchunks; /* sctpStats 11 (Counter64) */ 952671d309cSRandall Stewart uint32_t sctps_inorderchunks; /* sctpStats 12 (Counter64) */ 953671d309cSRandall Stewart uint32_t sctps_inunorderchunks; /* sctpStats 13 (Counter64) */ 954671d309cSRandall Stewart uint32_t sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */ 955671d309cSRandall Stewart uint32_t sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */ 956671d309cSRandall Stewart uint32_t sctps_outpackets; /* sctpStats 16 (Counter64) */ 957671d309cSRandall Stewart uint32_t sctps_inpackets; /* sctpStats 17 (Counter64) */ 958671d309cSRandall Stewart 959f8829a4aSRandall Stewart /* input statistics: */ 960671d309cSRandall Stewart uint32_t sctps_recvpackets; /* total input packets */ 961671d309cSRandall Stewart uint32_t sctps_recvdatagrams; /* total input datagrams */ 962671d309cSRandall Stewart uint32_t sctps_recvpktwithdata; /* total packets that had data */ 963671d309cSRandall Stewart uint32_t sctps_recvsacks; /* total input SACK chunks */ 964671d309cSRandall Stewart uint32_t sctps_recvdata;/* total input DATA chunks */ 965671d309cSRandall Stewart uint32_t sctps_recvdupdata; /* total input duplicate DATA chunks */ 966671d309cSRandall Stewart uint32_t sctps_recvheartbeat; /* total input HB chunks */ 967671d309cSRandall Stewart uint32_t sctps_recvheartbeatack; /* total input HB-ACK chunks */ 968671d309cSRandall Stewart uint32_t sctps_recvecne;/* total input ECNE chunks */ 969671d309cSRandall Stewart uint32_t sctps_recvauth;/* total input AUTH chunks */ 970671d309cSRandall Stewart uint32_t sctps_recvauthmissing; /* total input chunks missing AUTH */ 971671d309cSRandall Stewart uint32_t sctps_recvivalhmacid; /* total number of invalid HMAC ids 972f8829a4aSRandall Stewart * received */ 973671d309cSRandall Stewart uint32_t sctps_recvivalkeyid; /* total number of invalid secret ids 974f8829a4aSRandall Stewart * received */ 975671d309cSRandall Stewart uint32_t sctps_recvauthfailed; /* total number of auth failed */ 976671d309cSRandall Stewart uint32_t sctps_recvexpress; /* total fast path receives all one 977f8829a4aSRandall Stewart * chunk */ 978671d309cSRandall Stewart uint32_t sctps_recvexpressm; /* total fast path multi-part data */ 979a99b6783SRandall Stewart uint32_t sctps_recvnocrc; 980a99b6783SRandall Stewart uint32_t sctps_recvswcrc; 981a99b6783SRandall Stewart uint32_t sctps_recvhwcrc; 982a99b6783SRandall Stewart 983f8829a4aSRandall Stewart /* output statistics: */ 984671d309cSRandall Stewart uint32_t sctps_sendpackets; /* total output packets */ 985671d309cSRandall Stewart uint32_t sctps_sendsacks; /* total output SACKs */ 986671d309cSRandall Stewart uint32_t sctps_senddata;/* total output DATA chunks */ 987671d309cSRandall Stewart uint32_t sctps_sendretransdata; /* total output retransmitted DATA 988f8829a4aSRandall Stewart * chunks */ 989671d309cSRandall Stewart uint32_t sctps_sendfastretrans; /* total output fast retransmitted 990f8829a4aSRandall Stewart * DATA chunks */ 991671d309cSRandall Stewart uint32_t sctps_sendmultfastretrans; /* total FR's that happened 992478d3f09SRandall Stewart * more than once to same 993478d3f09SRandall Stewart * chunk (u-del multi-fr 994478d3f09SRandall Stewart * algo). */ 995671d309cSRandall Stewart uint32_t sctps_sendheartbeat; /* total output HB chunks */ 996671d309cSRandall Stewart uint32_t sctps_sendecne;/* total output ECNE chunks */ 997671d309cSRandall Stewart uint32_t sctps_sendauth;/* total output AUTH chunks FIXME */ 998671d309cSRandall Stewart uint32_t sctps_senderrors; /* ip_output error counter */ 999a99b6783SRandall Stewart uint32_t sctps_sendnocrc; 1000a99b6783SRandall Stewart uint32_t sctps_sendswcrc; 1001a99b6783SRandall Stewart uint32_t sctps_sendhwcrc; 1002f8829a4aSRandall Stewart /* PCKDROPREP statistics: */ 1003671d309cSRandall Stewart uint32_t sctps_pdrpfmbox; /* Packet drop from middle box */ 1004671d309cSRandall Stewart uint32_t sctps_pdrpfehos; /* P-drop from end host */ 1005671d309cSRandall Stewart uint32_t sctps_pdrpmbda;/* P-drops with data */ 1006671d309cSRandall Stewart uint32_t sctps_pdrpmbct;/* P-drops, non-data, non-endhost */ 1007671d309cSRandall Stewart uint32_t sctps_pdrpbwrpt; /* P-drop, non-endhost, bandwidth rep 1008671d309cSRandall Stewart * only */ 1009671d309cSRandall Stewart uint32_t sctps_pdrpcrupt; /* P-drop, not enough for chunk header */ 1010671d309cSRandall Stewart uint32_t sctps_pdrpnedat; /* P-drop, not enough data to confirm */ 1011671d309cSRandall Stewart uint32_t sctps_pdrppdbrk; /* P-drop, where process_chunk_drop 1012671d309cSRandall Stewart * said break */ 1013671d309cSRandall Stewart uint32_t sctps_pdrptsnnf; /* P-drop, could not find TSN */ 1014671d309cSRandall Stewart uint32_t sctps_pdrpdnfnd; /* P-drop, attempt reverse TSN lookup */ 1015671d309cSRandall Stewart uint32_t sctps_pdrpdiwnp; /* P-drop, e-host confirms zero-rwnd */ 1016671d309cSRandall Stewart uint32_t sctps_pdrpdizrw; /* P-drop, midbox confirms no space */ 1017671d309cSRandall Stewart uint32_t sctps_pdrpbadd;/* P-drop, data did not match TSN */ 1018671d309cSRandall Stewart uint32_t sctps_pdrpmark;/* P-drop, TSN's marked for Fast Retran */ 1019f8829a4aSRandall Stewart /* timeouts */ 1020671d309cSRandall Stewart uint32_t sctps_timoiterator; /* Number of iterator timers that 1021478d3f09SRandall Stewart * fired */ 1022671d309cSRandall Stewart uint32_t sctps_timodata;/* Number of T3 data time outs */ 1023671d309cSRandall Stewart uint32_t sctps_timowindowprobe; /* Number of window probe (T3) timers 1024478d3f09SRandall Stewart * that fired */ 1025671d309cSRandall Stewart uint32_t sctps_timoinit;/* Number of INIT timers that fired */ 1026671d309cSRandall Stewart uint32_t sctps_timosack;/* Number of sack timers that fired */ 1027671d309cSRandall Stewart uint32_t sctps_timoshutdown; /* Number of shutdown timers that 1028478d3f09SRandall Stewart * fired */ 1029671d309cSRandall Stewart uint32_t sctps_timoheartbeat; /* Number of heartbeat timers that 1030478d3f09SRandall Stewart * fired */ 1031671d309cSRandall Stewart uint32_t sctps_timocookie; /* Number of times a cookie timeout 1032478d3f09SRandall Stewart * fired */ 1033671d309cSRandall Stewart uint32_t sctps_timosecret; /* Number of times an endpoint changed 1034671d309cSRandall Stewart * its cookie secret */ 1035671d309cSRandall Stewart uint32_t sctps_timopathmtu; /* Number of PMTU timers that fired */ 1036671d309cSRandall Stewart uint32_t sctps_timoshutdownack; /* Number of shutdown ack timers that 1037478d3f09SRandall Stewart * fired */ 1038671d309cSRandall Stewart uint32_t sctps_timoshutdownguard; /* Number of shutdown guard 1039671d309cSRandall Stewart * timers that fired */ 1040671d309cSRandall Stewart uint32_t sctps_timostrmrst; /* Number of stream reset timers that 1041478d3f09SRandall Stewart * fired */ 1042671d309cSRandall Stewart uint32_t sctps_timoearlyfr; /* Number of early FR timers that 1043478d3f09SRandall Stewart * fired */ 1044671d309cSRandall Stewart uint32_t sctps_timoasconf; /* Number of times an asconf timer 1045671d309cSRandall Stewart * fired */ 1046851b7298SRandall Stewart uint32_t sctps_timodelprim; /* Number of times a prim_deleted 1047851b7298SRandall Stewart * timer fired */ 1048671d309cSRandall Stewart uint32_t sctps_timoautoclose; /* Number of times auto close timer 1049671d309cSRandall Stewart * fired */ 1050671d309cSRandall Stewart uint32_t sctps_timoassockill; /* Number of asoc free timers expired */ 1051671d309cSRandall Stewart uint32_t sctps_timoinpkill; /* Number of inp free timers expired */ 1052ca85e948SMichael Tuexen /* former early FR counters */ 1053ca85e948SMichael Tuexen uint32_t sctps_spare[11]; 1054b1ce21c6SRebecca Cran /* others */ 1055671d309cSRandall Stewart uint32_t sctps_hdrops; /* packet shorter than header */ 1056671d309cSRandall Stewart uint32_t sctps_badsum; /* checksum error */ 1057671d309cSRandall Stewart uint32_t sctps_noport; /* no endpoint for port */ 1058671d309cSRandall Stewart uint32_t sctps_badvtag; /* bad v-tag */ 1059671d309cSRandall Stewart uint32_t sctps_badsid; /* bad SID */ 1060671d309cSRandall Stewart uint32_t sctps_nomem; /* no memory */ 1061671d309cSRandall Stewart uint32_t sctps_fastretransinrtt; /* number of multiple FR in a 1062671d309cSRandall Stewart * RTT window */ 1063671d309cSRandall Stewart uint32_t sctps_markedretrans; 1064671d309cSRandall Stewart uint32_t sctps_naglesent; /* nagle allowed sending */ 1065b1ce21c6SRebecca Cran uint32_t sctps_naglequeued; /* nagle doesn't allow sending */ 1066b1ce21c6SRebecca Cran uint32_t sctps_maxburstqueued; /* max burst doesn't allow sending */ 1067671d309cSRandall Stewart uint32_t sctps_ifnomemqueued; /* look ahead tells us no memory in 1068478d3f09SRandall Stewart * interface ring buffer OR we had a 1069478d3f09SRandall Stewart * send error and are queuing one 1070478d3f09SRandall Stewart * send. */ 1071671d309cSRandall Stewart uint32_t sctps_windowprobed; /* total number of window probes sent */ 1072671d309cSRandall Stewart uint32_t sctps_lowlevelerr; /* total times an output error causes 1073478d3f09SRandall Stewart * us to clamp down on next user send. */ 1074671d309cSRandall Stewart uint32_t sctps_lowlevelerrusr; /* total times sctp_senderrors were 1075478d3f09SRandall Stewart * caused from a user send from a user 1076478d3f09SRandall Stewart * invoked send not a sack response */ 1077671d309cSRandall Stewart uint32_t sctps_datadropchklmt; /* Number of in data drops due to 1078478d3f09SRandall Stewart * chunk limit reached */ 1079671d309cSRandall Stewart uint32_t sctps_datadroprwnd; /* Number of in data drops due to rwnd 1080478d3f09SRandall Stewart * limit reached */ 1081671d309cSRandall Stewart uint32_t sctps_ecnereducedcwnd; /* Number of times a ECN reduced the 1082478d3f09SRandall Stewart * cwnd */ 1083671d309cSRandall Stewart uint32_t sctps_vtagexpress; /* Used express lookup via vtag */ 1084671d309cSRandall Stewart uint32_t sctps_vtagbogus; /* Collision in express lookup. */ 1085671d309cSRandall Stewart uint32_t sctps_primary_randry; /* Number of times the sender ran dry 1086f8829a4aSRandall Stewart * of user data on primary */ 1087671d309cSRandall Stewart uint32_t sctps_cmt_randry; /* Same for above */ 1088671d309cSRandall Stewart uint32_t sctps_slowpath_sack; /* Sacks the slow way */ 1089671d309cSRandall Stewart uint32_t sctps_wu_sacks_sent; /* Window Update only sacks sent */ 1090671d309cSRandall Stewart uint32_t sctps_sends_with_flags; /* number of sends with 1091671d309cSRandall Stewart * sinfo_flags !=0 */ 1092b1ce21c6SRebecca Cran uint32_t sctps_sends_with_unord; /* number of unordered sends */ 1093671d309cSRandall Stewart uint32_t sctps_sends_with_eof; /* number of sends with EOF flag set */ 1094671d309cSRandall Stewart uint32_t sctps_sends_with_abort; /* number of sends with ABORT 1095671d309cSRandall Stewart * flag set */ 1096671d309cSRandall Stewart uint32_t sctps_protocol_drain_calls; /* number of times protocol 1097478d3f09SRandall Stewart * drain called */ 1098671d309cSRandall Stewart uint32_t sctps_protocol_drains_done; /* number of times we did a 1099478d3f09SRandall Stewart * protocol drain */ 1100671d309cSRandall Stewart uint32_t sctps_read_peeks; /* Number of times recv was called 1101671d309cSRandall Stewart * with peek */ 1102671d309cSRandall Stewart uint32_t sctps_cached_chk; /* Number of cached chunks used */ 1103671d309cSRandall Stewart uint32_t sctps_cached_strmoq; /* Number of cached stream oq's used */ 1104b1ce21c6SRebecca Cran uint32_t sctps_left_abandon; /* Number of unread messages abandoned 1105f1f73e57SRandall Stewart * by close */ 1106ea44232bSRandall Stewart uint32_t sctps_send_burst_avoid; /* Unused */ 1107671d309cSRandall Stewart uint32_t sctps_send_cwnd_avoid; /* Send cwnd full avoidance, already 110817205eccSRandall Stewart * max burst inflight to net */ 1109671d309cSRandall Stewart uint32_t sctps_fwdtsn_map_over; /* number of map array over-runs via 1110207304d4SRandall Stewart * fwd-tsn's */ 1111d77e2e42SRandall Stewart uint32_t sctps_queue_upd_ecne; /* Number of times we queued or 1112d77e2e42SRandall Stewart * updated an ECN chunk on send queue */ 1113d77e2e42SRandall Stewart uint32_t sctps_reserved[31]; /* Future ABI compat - remove int's 1114892f1c71SRandall Stewart * from here when adding new */ 1115f8829a4aSRandall Stewart }; 1116f8829a4aSRandall Stewart 1117f8829a4aSRandall Stewart #define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1) 1118f8829a4aSRandall Stewart #define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1) 1119ff014514SRandall Stewart #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) 1120ff014514SRandall Stewart #define SCTP_STAT_INCR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x += _d) 1121ff014514SRandall Stewart #define SCTP_STAT_DECR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x -= _d) 1122ff014514SRandall Stewart #else 1123b3f1ea41SRandall Stewart #define SCTP_STAT_INCR_BY(_x,_d) atomic_add_int(&SCTP_BASE_STAT(_x), _d) 1124b3f1ea41SRandall Stewart #define SCTP_STAT_DECR_BY(_x,_d) atomic_subtract_int(&SCTP_BASE_STAT(_x), _d) 1125ff014514SRandall Stewart #endif 1126f8829a4aSRandall Stewart /* The following macros are for handling MIB values, */ 1127f8829a4aSRandall Stewart #define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x) 1128f8829a4aSRandall Stewart #define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x) 1129f8829a4aSRandall Stewart #define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x) 1130f8829a4aSRandall Stewart #define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x) 1131f8829a4aSRandall Stewart #define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x) 1132f8829a4aSRandall Stewart #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x) 1133f8829a4aSRandall Stewart 113403b0b021SRandall Stewart union sctp_sockstore { 113503b0b021SRandall Stewart struct sockaddr_in sin; 113603b0b021SRandall Stewart struct sockaddr_in6 sin6; 113703b0b021SRandall Stewart struct sockaddr sa; 113803b0b021SRandall Stewart }; 113903b0b021SRandall Stewart 1140049640c1SMichael Tuexen 1141049640c1SMichael Tuexen /***********************************/ 1142049640c1SMichael Tuexen /* And something for us old timers */ 1143049640c1SMichael Tuexen /***********************************/ 1144049640c1SMichael Tuexen 1145049640c1SMichael Tuexen #ifndef ntohll 1146049640c1SMichael Tuexen #include <sys/endian.h> 1147049640c1SMichael Tuexen #define ntohll(x) be64toh(x) 1148049640c1SMichael Tuexen #endif 1149049640c1SMichael Tuexen 1150049640c1SMichael Tuexen #ifndef htonll 1151049640c1SMichael Tuexen #include <sys/endian.h> 1152049640c1SMichael Tuexen #define htonll(x) htobe64(x) 1153049640c1SMichael Tuexen #endif 1154049640c1SMichael Tuexen /***********************************/ 1155049640c1SMichael Tuexen 1156049640c1SMichael Tuexen 1157a5d547adSRandall Stewart struct xsctp_inpcb { 1158a5d547adSRandall Stewart uint32_t last; 1159a5d547adSRandall Stewart uint32_t flags; 11606be15a24SMichael Tuexen uint64_t features; 1161a5d547adSRandall Stewart uint32_t total_sends; 1162a5d547adSRandall Stewart uint32_t total_recvs; 1163a5d547adSRandall Stewart uint32_t total_nospaces; 116417205eccSRandall Stewart uint32_t fragmentation_point; 1165671d309cSRandall Stewart uint16_t local_port; 1166d61a0ae0SRandall Stewart uint16_t qlen; 1167d61a0ae0SRandall Stewart uint16_t maxqlen; 11686be15a24SMichael Tuexen uint32_t extra_padding[31]; /* future */ 1169a5d547adSRandall Stewart }; 1170a5d547adSRandall Stewart 1171a5d547adSRandall Stewart struct xsctp_tcb { 1172d61a0ae0SRandall Stewart union sctp_sockstore primary_addr; /* sctpAssocEntry 5/6 */ 1173671d309cSRandall Stewart uint32_t last; 1174d61a0ae0SRandall Stewart uint32_t heartbeat_interval; /* sctpAssocEntry 7 */ 1175d61a0ae0SRandall Stewart uint32_t state; /* sctpAssocEntry 8 */ 1176d61a0ae0SRandall Stewart uint32_t in_streams; /* sctpAssocEntry 9 */ 1177d61a0ae0SRandall Stewart uint32_t out_streams; /* sctpAssocEntry 10 */ 1178d61a0ae0SRandall Stewart uint32_t max_nr_retrans;/* sctpAssocEntry 11 */ 1179d61a0ae0SRandall Stewart uint32_t primary_process; /* sctpAssocEntry 12 */ 1180d61a0ae0SRandall Stewart uint32_t T1_expireries; /* sctpAssocEntry 13 */ 1181d61a0ae0SRandall Stewart uint32_t T2_expireries; /* sctpAssocEntry 14 */ 1182d61a0ae0SRandall Stewart uint32_t retransmitted_tsns; /* sctpAssocEntry 15 */ 1183a5d547adSRandall Stewart uint32_t total_sends; 1184a5d547adSRandall Stewart uint32_t total_recvs; 1185a5d547adSRandall Stewart uint32_t local_tag; 1186a5d547adSRandall Stewart uint32_t remote_tag; 1187a5d547adSRandall Stewart uint32_t initial_tsn; 1188a5d547adSRandall Stewart uint32_t highest_tsn; 1189a5d547adSRandall Stewart uint32_t cumulative_tsn; 1190a5d547adSRandall Stewart uint32_t cumulative_tsn_ack; 119117205eccSRandall Stewart uint32_t mtu; 1192207304d4SRandall Stewart uint32_t refcnt; 1193671d309cSRandall Stewart uint16_t local_port; /* sctpAssocEntry 3 */ 1194671d309cSRandall Stewart uint16_t remote_port; /* sctpAssocEntry 4 */ 1195851b7298SRandall Stewart struct sctp_timeval start_time; /* sctpAssocEntry 16 */ 1196851b7298SRandall Stewart struct sctp_timeval discontinuity_time; /* sctpAssocEntry 17 */ 11974f6b4933SRandall Stewart uint32_t peers_rwnd; 1198a99b6783SRandall Stewart sctp_assoc_t assoc_id; /* sctpAssocEntry 1 */ 1199e29d4aa6SRandall Stewart uint32_t extra_padding[32]; /* future */ 1200a5d547adSRandall Stewart }; 1201a5d547adSRandall Stewart 1202a5d547adSRandall Stewart struct xsctp_laddr { 1203d61a0ae0SRandall Stewart union sctp_sockstore address; /* sctpAssocLocalAddrEntry 1/2 */ 1204671d309cSRandall Stewart uint32_t last; 1205851b7298SRandall Stewart struct sctp_timeval start_time; /* sctpAssocLocalAddrEntry 3 */ 1206e29d4aa6SRandall Stewart uint32_t extra_padding[32]; /* future */ 1207a5d547adSRandall Stewart }; 1208a5d547adSRandall Stewart 1209a5d547adSRandall Stewart struct xsctp_raddr { 1210d61a0ae0SRandall Stewart union sctp_sockstore address; /* sctpAssocLocalRemEntry 1/2 */ 1211671d309cSRandall Stewart uint32_t last; 1212d61a0ae0SRandall Stewart uint32_t rto; /* sctpAssocLocalRemEntry 5 */ 1213d61a0ae0SRandall Stewart uint32_t max_path_rtx; /* sctpAssocLocalRemEntry 6 */ 1214d61a0ae0SRandall Stewart uint32_t rtx; /* sctpAssocLocalRemEntry 7 */ 1215d61a0ae0SRandall Stewart uint32_t error_counter; /* */ 1216d61a0ae0SRandall Stewart uint32_t cwnd; /* */ 1217d61a0ae0SRandall Stewart uint32_t flight_size; /* */ 1218d61a0ae0SRandall Stewart uint32_t mtu; /* */ 1219671d309cSRandall Stewart uint8_t active; /* sctpAssocLocalRemEntry 3 */ 1220671d309cSRandall Stewart uint8_t confirmed; /* */ 1221671d309cSRandall Stewart uint8_t heartbeat_enabled; /* sctpAssocLocalRemEntry 4 */ 1222ca85e948SMichael Tuexen uint8_t potentially_failed; 1223851b7298SRandall Stewart struct sctp_timeval start_time; /* sctpAssocLocalRemEntry 8 */ 1224e29d4aa6SRandall Stewart uint32_t rtt; 1225ca85e948SMichael Tuexen uint32_t heartbeat_interval; 1226ca85e948SMichael Tuexen uint32_t extra_padding[31]; /* future */ 1227a5d547adSRandall Stewart }; 122803b0b021SRandall Stewart 1229b27a6b7dSRandall Stewart #define SCTP_MAX_LOGGING_SIZE 30000 1230b27a6b7dSRandall Stewart #define SCTP_TRACE_PARAMS 6 /* This number MUST be even */ 1231b27a6b7dSRandall Stewart 1232b27a6b7dSRandall Stewart struct sctp_log_entry { 1233c99efcf6SRandall Stewart uint64_t timestamp; 1234b27a6b7dSRandall Stewart uint32_t subsys; 1235b27a6b7dSRandall Stewart uint32_t padding; 1236b27a6b7dSRandall Stewart uint32_t params[SCTP_TRACE_PARAMS]; 1237b27a6b7dSRandall Stewart }; 1238b27a6b7dSRandall Stewart 1239b27a6b7dSRandall Stewart struct sctp_log { 1240b27a6b7dSRandall Stewart struct sctp_log_entry entry[SCTP_MAX_LOGGING_SIZE]; 1241b27a6b7dSRandall Stewart uint32_t index; 1242b27a6b7dSRandall Stewart uint32_t padding; 1243b27a6b7dSRandall Stewart }; 1244b27a6b7dSRandall Stewart 1245f8829a4aSRandall Stewart /* 1246f8829a4aSRandall Stewart * Kernel defined for sctp_send 1247f8829a4aSRandall Stewart */ 1248fc14de76SRandall Stewart #if defined(_KERNEL) || defined(__Userspace__) 1249f8829a4aSRandall Stewart int 1250f8829a4aSRandall Stewart sctp_lower_sosend(struct socket *so, 1251f8829a4aSRandall Stewart struct sockaddr *addr, 1252f8829a4aSRandall Stewart struct uio *uio, 125317205eccSRandall Stewart struct mbuf *i_pak, 1254f8829a4aSRandall Stewart struct mbuf *control, 1255f8829a4aSRandall Stewart int flags, 1256c105859eSRandall Stewart struct sctp_sndrcvinfo *srcv 1257c105859eSRandall Stewart ,struct thread *p 1258f8829a4aSRandall Stewart ); 1259f8829a4aSRandall Stewart 1260f8829a4aSRandall Stewart int 1261f8829a4aSRandall Stewart sctp_sorecvmsg(struct socket *so, 1262f8829a4aSRandall Stewart struct uio *uio, 1263f8829a4aSRandall Stewart struct mbuf **mp, 1264f8829a4aSRandall Stewart struct sockaddr *from, 1265f8829a4aSRandall Stewart int fromlen, 1266f8829a4aSRandall Stewart int *msg_flags, 1267f8829a4aSRandall Stewart struct sctp_sndrcvinfo *sinfo, 1268f8829a4aSRandall Stewart int filling_sinfo); 1269f8829a4aSRandall Stewart 1270f8829a4aSRandall Stewart #endif 1271f8829a4aSRandall Stewart 1272f8829a4aSRandall Stewart /* 1273f8829a4aSRandall Stewart * API system calls 1274f8829a4aSRandall Stewart */ 1275fc14de76SRandall Stewart #if !(defined(_KERNEL)) && !(defined(__Userspace__)) 1276f8829a4aSRandall Stewart 1277f8829a4aSRandall Stewart __BEGIN_DECLS 12786f56329aSXin LI int sctp_peeloff(int, sctp_assoc_t); 12796f56329aSXin LI int sctp_bindx(int, struct sockaddr *, int, int); 12806f56329aSXin LI int sctp_connectx(int, const struct sockaddr *, int, sctp_assoc_t *); 12816f56329aSXin LI int sctp_getaddrlen(sa_family_t); 12826f56329aSXin LI int sctp_getpaddrs(int, sctp_assoc_t, struct sockaddr **); 12836f56329aSXin LI void sctp_freepaddrs(struct sockaddr *); 12846f56329aSXin LI int sctp_getladdrs(int, sctp_assoc_t, struct sockaddr **); 12856f56329aSXin LI void sctp_freeladdrs(struct sockaddr *); 12866f56329aSXin LI int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *); 1287f8829a4aSRandall Stewart 1288e2e7c62eSMichael Tuexen /* deprecated */ 128921f67da7SMichael Tuexen ssize_t 129021f67da7SMichael Tuexen sctp_sendmsg(int, const void *, size_t, const struct sockaddr *, 12916f56329aSXin LI socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); 1292f8829a4aSRandall Stewart 1293e2e7c62eSMichael Tuexen /* deprecated */ 129421f67da7SMichael Tuexen ssize_t 129521f67da7SMichael Tuexen sctp_send(int, const void *, size_t, 12966f56329aSXin LI const struct sctp_sndrcvinfo *, int); 1297f8829a4aSRandall Stewart 1298e2e7c62eSMichael Tuexen /* deprecated */ 129921f67da7SMichael Tuexen ssize_t 130021f67da7SMichael Tuexen sctp_sendx(int, const void *, size_t, struct sockaddr *, 13016f56329aSXin LI int, struct sctp_sndrcvinfo *, int); 130217205eccSRandall Stewart 1303e2e7c62eSMichael Tuexen /* deprecated */ 130421f67da7SMichael Tuexen ssize_t 130521f67da7SMichael Tuexen sctp_sendmsgx(int sd, const void *, size_t, struct sockaddr *, 13066f56329aSXin LI int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); 1307f8829a4aSRandall Stewart 13086f56329aSXin LI sctp_assoc_t sctp_getassocid(int, struct sockaddr *); 1309f8829a4aSRandall Stewart 1310e2e7c62eSMichael Tuexen /* deprecated */ 131121f67da7SMichael Tuexen ssize_t 131221f67da7SMichael Tuexen sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *, 13136f56329aSXin LI struct sctp_sndrcvinfo *, int *); 1314e2e7c62eSMichael Tuexen 131521f67da7SMichael Tuexen ssize_t 131621f67da7SMichael Tuexen sctp_sendv(int, const struct iovec *, int, struct sockaddr *, 13176f56329aSXin LI int, void *, socklen_t, unsigned int, int); 1318e2e7c62eSMichael Tuexen 131921f67da7SMichael Tuexen ssize_t 132021f67da7SMichael Tuexen sctp_recvv(int, const struct iovec *, int, struct sockaddr *, 13216f56329aSXin LI socklen_t *, void *, socklen_t *, unsigned int *, int *); 1322f8829a4aSRandall Stewart 1323f8829a4aSRandall Stewart __END_DECLS 1324f8829a4aSRandall Stewart 1325f8829a4aSRandall Stewart #endif /* !_KERNEL */ 1326f8829a4aSRandall Stewart #endif /* !__sctp_uio_h__ */ 1327