1f8829a4aSRandall Stewart /*- 2b1006367SRandall Stewart * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 35d40cf5dSRandall Stewart * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. 45d40cf5dSRandall Stewart * Copyright (c) 2008-2011, 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 /* $KAME: sctp_uio.h,v 1.11 2005/03/06 16:04:18 itojun Exp $ */ 34f8829a4aSRandall Stewart #include <sys/cdefs.h> 35f8829a4aSRandall Stewart __FBSDID("$FreeBSD$"); 36f8829a4aSRandall Stewart 37f8829a4aSRandall Stewart #ifndef __sctp_uio_h__ 38f8829a4aSRandall Stewart #define __sctp_uio_h__ 39f8829a4aSRandall Stewart 40f8829a4aSRandall Stewart 41f8829a4aSRandall Stewart #if ! defined(_KERNEL) 42f8829a4aSRandall Stewart #include <stdint.h> 43f8829a4aSRandall Stewart #endif 44f8829a4aSRandall Stewart #include <sys/types.h> 45f8829a4aSRandall Stewart #include <sys/socket.h> 4603b0b021SRandall Stewart #include <netinet/in.h> 47f8829a4aSRandall Stewart 48f8829a4aSRandall Stewart typedef uint32_t sctp_assoc_t; 49f8829a4aSRandall Stewart 50e2e7c62eSMichael Tuexen #define SCTP_FUTURE_ASSOC 0 51e2e7c62eSMichael Tuexen #define SCTP_CURRENT_ASSOC 1 52e2e7c62eSMichael Tuexen #define SCTP_ALL_ASSOC 2 53e2e7c62eSMichael Tuexen 54e2e7c62eSMichael Tuexen struct sctp_event { 55e2e7c62eSMichael Tuexen sctp_assoc_t se_assoc_id; 56e2e7c62eSMichael Tuexen uint16_t se_type; 57e2e7c62eSMichael Tuexen uint8_t se_on; 58e2e7c62eSMichael Tuexen }; 59e2e7c62eSMichael Tuexen 60a10c3242SRandall Stewart /* Compatibility to previous define's */ 61a10c3242SRandall Stewart #define sctp_stream_reset_events sctp_stream_reset_event 62a10c3242SRandall Stewart 63f8829a4aSRandall Stewart /* On/Off setup for subscription to events */ 64f8829a4aSRandall Stewart struct sctp_event_subscribe { 65f8829a4aSRandall Stewart uint8_t sctp_data_io_event; 66f8829a4aSRandall Stewart uint8_t sctp_association_event; 67f8829a4aSRandall Stewart uint8_t sctp_address_event; 68f8829a4aSRandall Stewart uint8_t sctp_send_failure_event; 69f8829a4aSRandall Stewart uint8_t sctp_peer_error_event; 70f8829a4aSRandall Stewart uint8_t sctp_shutdown_event; 71f8829a4aSRandall Stewart uint8_t sctp_partial_delivery_event; 72f8829a4aSRandall Stewart uint8_t sctp_adaptation_layer_event; 73f8829a4aSRandall Stewart uint8_t sctp_authentication_event; 74830d754dSRandall Stewart uint8_t sctp_sender_dry_event; 75a10c3242SRandall Stewart uint8_t sctp_stream_reset_event; 76f8829a4aSRandall Stewart }; 77f8829a4aSRandall Stewart 78f8829a4aSRandall Stewart /* ancillary data types */ 79f8829a4aSRandall Stewart #define SCTP_INIT 0x0001 80f8829a4aSRandall Stewart #define SCTP_SNDRCV 0x0002 81f8829a4aSRandall Stewart #define SCTP_EXTRCV 0x0003 82e2e7c62eSMichael Tuexen #define SCTP_SNDINFO 0x0004 83e2e7c62eSMichael Tuexen #define SCTP_RCVINFO 0x0005 84e2e7c62eSMichael Tuexen #define SCTP_NXTINFO 0x0006 85e2e7c62eSMichael Tuexen #define SCTP_PRINFO 0x0007 86e2e7c62eSMichael Tuexen #define SCTP_AUTHINFO 0x0008 87e2e7c62eSMichael Tuexen #define SCTP_DSTADDRV4 0x0009 88e2e7c62eSMichael Tuexen #define SCTP_DSTADDRV6 0x000a 89e2e7c62eSMichael Tuexen 90f8829a4aSRandall Stewart /* 91f8829a4aSRandall Stewart * ancillary data structures 92f8829a4aSRandall Stewart */ 93f8829a4aSRandall Stewart struct sctp_initmsg { 94667d2d3cSRandall Stewart uint16_t sinit_num_ostreams; 95667d2d3cSRandall Stewart uint16_t sinit_max_instreams; 96f8829a4aSRandall Stewart uint16_t sinit_max_attempts; 97f8829a4aSRandall Stewart uint16_t sinit_max_init_timeo; 98f8829a4aSRandall Stewart }; 99f8829a4aSRandall Stewart 100f8829a4aSRandall Stewart /* We add 96 bytes to the size of sctp_sndrcvinfo. 101f8829a4aSRandall Stewart * This makes the current structure 128 bytes long 102f8829a4aSRandall Stewart * which is nicely 64 bit aligned but also has room 103b1ce21c6SRebecca Cran * for us to add more and keep ABI compatibility. 104f8829a4aSRandall Stewart * For example, already we have the sctp_extrcvinfo 105f8829a4aSRandall Stewart * when enabled which is 48 bytes. 106f8829a4aSRandall Stewart */ 107f8829a4aSRandall Stewart 108f42a358aSRandall Stewart /* 109f42a358aSRandall Stewart * The assoc up needs a verfid 110f42a358aSRandall Stewart * all sendrcvinfo's need a verfid for SENDING only. 111f42a358aSRandall Stewart */ 112f42a358aSRandall Stewart 113f42a358aSRandall Stewart 114e2e7c62eSMichael Tuexen #define SCTP_ALIGN_RESV_PAD 92 115e2e7c62eSMichael Tuexen #define SCTP_ALIGN_RESV_PAD_SHORT 76 116f8829a4aSRandall Stewart 117f8829a4aSRandall Stewart struct sctp_sndrcvinfo { 118f8829a4aSRandall Stewart uint16_t sinfo_stream; 119f8829a4aSRandall Stewart uint16_t sinfo_ssn; 120f8829a4aSRandall Stewart uint16_t sinfo_flags; 121f8829a4aSRandall Stewart uint32_t sinfo_ppid; 122f8829a4aSRandall Stewart uint32_t sinfo_context; 123f8829a4aSRandall Stewart uint32_t sinfo_timetolive; 124f8829a4aSRandall Stewart uint32_t sinfo_tsn; 125f8829a4aSRandall Stewart uint32_t sinfo_cumtsn; 126f8829a4aSRandall Stewart sctp_assoc_t sinfo_assoc_id; 127e2e7c62eSMichael Tuexen uint16_t sinfo_keynumber; 128e2e7c62eSMichael Tuexen uint16_t sinfo_keynumber_valid; 129f8829a4aSRandall Stewart uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD]; 130f8829a4aSRandall Stewart }; 131f8829a4aSRandall Stewart 132f8829a4aSRandall Stewart struct sctp_extrcvinfo { 13363981c2bSRandall Stewart uint16_t sinfo_stream; 13463981c2bSRandall Stewart uint16_t sinfo_ssn; 13563981c2bSRandall Stewart uint16_t sinfo_flags; 13663981c2bSRandall Stewart uint32_t sinfo_ppid; 13763981c2bSRandall Stewart uint32_t sinfo_context; 13863981c2bSRandall Stewart uint32_t sinfo_timetolive; 13963981c2bSRandall Stewart uint32_t sinfo_tsn; 14063981c2bSRandall Stewart uint32_t sinfo_cumtsn; 14163981c2bSRandall Stewart sctp_assoc_t sinfo_assoc_id; 1429a6142d8SRandall Stewart uint16_t sreinfo_next_flags; 1439a6142d8SRandall Stewart uint16_t sreinfo_next_stream; 1449a6142d8SRandall Stewart uint32_t sreinfo_next_aid; 1459a6142d8SRandall Stewart uint32_t sreinfo_next_length; 1469a6142d8SRandall Stewart uint32_t sreinfo_next_ppid; 147e2e7c62eSMichael Tuexen uint16_t sinfo_keynumber; 148e2e7c62eSMichael Tuexen uint16_t sinfo_keynumber_valid; 149f42a358aSRandall Stewart uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT]; 150f8829a4aSRandall Stewart }; 151f8829a4aSRandall Stewart 152e2e7c62eSMichael Tuexen struct sctp_sndinfo { 153e2e7c62eSMichael Tuexen uint16_t snd_sid; 154e2e7c62eSMichael Tuexen uint16_t snd_flags; 155e2e7c62eSMichael Tuexen uint32_t snd_ppid; 156e2e7c62eSMichael Tuexen uint32_t snd_context; 157e2e7c62eSMichael Tuexen sctp_assoc_t snd_assoc_id; 158e2e7c62eSMichael Tuexen }; 159e2e7c62eSMichael Tuexen 160e2e7c62eSMichael Tuexen struct sctp_prinfo { 161e2e7c62eSMichael Tuexen uint16_t pr_policy; 162e2e7c62eSMichael Tuexen uint32_t pr_value; 163e2e7c62eSMichael Tuexen }; 164e2e7c62eSMichael Tuexen 1656037f89cSMichael Tuexen struct sctp_default_prinfo { 1666037f89cSMichael Tuexen uint16_t pr_policy; 1676037f89cSMichael Tuexen uint32_t pr_value; 1686037f89cSMichael Tuexen sctp_assoc_t pr_assoc_id; 1696037f89cSMichael Tuexen }; 1706037f89cSMichael Tuexen 171e2e7c62eSMichael Tuexen struct sctp_authinfo { 172e2e7c62eSMichael Tuexen uint16_t auth_keyid; 173e2e7c62eSMichael Tuexen }; 174e2e7c62eSMichael Tuexen 175e2e7c62eSMichael Tuexen struct sctp_rcvinfo { 176e2e7c62eSMichael Tuexen uint16_t rcv_sid; 177e2e7c62eSMichael Tuexen uint16_t rcv_ssn; 178e2e7c62eSMichael Tuexen uint16_t rcv_flags; 179e2e7c62eSMichael Tuexen uint32_t rcv_ppid; 180e2e7c62eSMichael Tuexen uint32_t rcv_tsn; 181e2e7c62eSMichael Tuexen uint32_t rcv_cumtsn; 182e2e7c62eSMichael Tuexen uint32_t rcv_context; 183e2e7c62eSMichael Tuexen sctp_assoc_t rcv_assoc_id; 184e2e7c62eSMichael Tuexen }; 185e2e7c62eSMichael Tuexen 186e2e7c62eSMichael Tuexen struct sctp_nxtinfo { 187e2e7c62eSMichael Tuexen uint16_t nxt_sid; 188e2e7c62eSMichael Tuexen uint16_t nxt_flags; 189e2e7c62eSMichael Tuexen uint32_t nxt_ppid; 190e2e7c62eSMichael Tuexen uint32_t nxt_length; 191e2e7c62eSMichael Tuexen sctp_assoc_t nxt_assoc_id; 192e2e7c62eSMichael Tuexen }; 193e2e7c62eSMichael Tuexen 194f8829a4aSRandall Stewart #define SCTP_NO_NEXT_MSG 0x0000 195f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_AVAIL 0x0001 196f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_ISCOMPLETE 0x0002 197f8829a4aSRandall Stewart #define SCTP_NEXT_MSG_IS_UNORDERED 0x0004 198f42a358aSRandall Stewart #define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008 199f8829a4aSRandall Stewart 200e2e7c62eSMichael Tuexen struct sctp_recvv_rn { 201e2e7c62eSMichael Tuexen struct sctp_rcvinfo recvv_rcvinfo; 202e2e7c62eSMichael Tuexen struct sctp_nxtinfo recvv_nxtinfo; 203e2e7c62eSMichael Tuexen }; 204e2e7c62eSMichael Tuexen 205e2e7c62eSMichael Tuexen #define SCTP_RECVV_NOINFO 0 206e2e7c62eSMichael Tuexen #define SCTP_RECVV_RCVINFO 1 207e2e7c62eSMichael Tuexen #define SCTP_RECVV_NXTINFO 2 208e2e7c62eSMichael Tuexen #define SCTP_RECVV_RN 3 209e2e7c62eSMichael Tuexen 2100b064106SMichael Tuexen #define SCTP_SENDV_NOINFO 0 211e2e7c62eSMichael Tuexen #define SCTP_SENDV_SNDINFO 1 212e2e7c62eSMichael Tuexen #define SCTP_SENDV_PRINFO 2 213e2e7c62eSMichael Tuexen #define SCTP_SENDV_AUTHINFO 3 214e2e7c62eSMichael Tuexen #define SCTP_SENDV_SPA 4 215e2e7c62eSMichael Tuexen 216e2e7c62eSMichael Tuexen struct sctp_sendv_spa { 217e2e7c62eSMichael Tuexen uint32_t sendv_flags; 218e2e7c62eSMichael Tuexen struct sctp_sndinfo sendv_sndinfo; 219e2e7c62eSMichael Tuexen struct sctp_prinfo sendv_prinfo; 220e2e7c62eSMichael Tuexen struct sctp_authinfo sendv_authinfo; 221e2e7c62eSMichael Tuexen }; 222e2e7c62eSMichael Tuexen 223e2e7c62eSMichael Tuexen #define SCTP_SEND_SNDINFO_VALID 0x00000001 224e2e7c62eSMichael Tuexen #define SCTP_SEND_PRINFO_VALID 0x00000002 225e2e7c62eSMichael Tuexen #define SCTP_SEND_AUTHINFO_VALID 0x00000004 226e2e7c62eSMichael Tuexen 227f8829a4aSRandall Stewart struct sctp_snd_all_completes { 228f8829a4aSRandall Stewart uint16_t sall_stream; 229f8829a4aSRandall Stewart uint16_t sall_flags; 230f8829a4aSRandall Stewart uint32_t sall_ppid; 231f8829a4aSRandall Stewart uint32_t sall_context; 232f8829a4aSRandall Stewart uint32_t sall_num_sent; 233f8829a4aSRandall Stewart uint32_t sall_num_failed; 234f8829a4aSRandall Stewart }; 235f8829a4aSRandall Stewart 236f8829a4aSRandall Stewart /* Flags that go into the sinfo->sinfo_flags field */ 237e2e7c62eSMichael Tuexen #define SCTP_NOTIFICATION 0x0010 /* next message is a notification */ 238e2e7c62eSMichael Tuexen #define SCTP_COMPLETE 0x0020 /* next message is complete */ 239f8829a4aSRandall Stewart #define SCTP_EOF 0x0100 /* Start shutdown procedures */ 240f8829a4aSRandall Stewart #define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ 241f8829a4aSRandall Stewart #define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ 242f8829a4aSRandall Stewart #define SCTP_ADDR_OVER 0x0800 /* Override the primary-address */ 243f8829a4aSRandall Stewart #define SCTP_SENDALL 0x1000 /* Send this on all associations */ 244f8829a4aSRandall Stewart #define SCTP_EOR 0x2000 /* end of message signal */ 245830d754dSRandall Stewart #define SCTP_SACK_IMMEDIATELY 0x4000 /* Set I-Bit */ 2462afb3e84SRandall Stewart 247e2e7c62eSMichael Tuexen #define INVALID_SINFO_FLAG(x) (((x) & 0xfffffff0 \ 24844b7479bSRandall Stewart & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\ 249830d754dSRandall Stewart SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR |\ 250830d754dSRandall Stewart SCTP_SACK_IMMEDIATELY)) != 0) 251f8829a4aSRandall Stewart /* for the endpoint */ 252f8829a4aSRandall Stewart 253f8829a4aSRandall Stewart /* The lower byte is an enumeration of PR-SCTP policies */ 2543c4401ecSMichael Tuexen #define SCTP_PR_SCTP_NONE 0x0000/* Reliable transfer */ 255f8829a4aSRandall Stewart #define SCTP_PR_SCTP_TTL 0x0001/* Time based PR-SCTP */ 256f8829a4aSRandall Stewart #define SCTP_PR_SCTP_BUF 0x0002/* Buffer based PR-SCTP */ 257f8829a4aSRandall Stewart #define SCTP_PR_SCTP_RTX 0x0003/* Number of retransmissions based PR-SCTP */ 258f8829a4aSRandall Stewart 259e2e7c62eSMichael Tuexen #define PR_SCTP_POLICY(x) ((x) & 0x0f) 2603c4401ecSMichael Tuexen #define PR_SCTP_ENABLED(x) (PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE) 261f8829a4aSRandall Stewart #define PR_SCTP_TTL_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL) 262f8829a4aSRandall Stewart #define PR_SCTP_BUF_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF) 263f8829a4aSRandall Stewart #define PR_SCTP_RTX_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX) 26444b7479bSRandall Stewart #define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX) 265f8829a4aSRandall Stewart /* Stat's */ 266f8829a4aSRandall Stewart struct sctp_pcbinfo { 267f8829a4aSRandall Stewart uint32_t ep_count; 268f8829a4aSRandall Stewart uint32_t asoc_count; 269f8829a4aSRandall Stewart uint32_t laddr_count; 270f8829a4aSRandall Stewart uint32_t raddr_count; 271f8829a4aSRandall Stewart uint32_t chk_count; 272f8829a4aSRandall Stewart uint32_t readq_count; 273f8829a4aSRandall Stewart uint32_t free_chunks; 274f8829a4aSRandall Stewart uint32_t stream_oque; 275f8829a4aSRandall Stewart }; 276f8829a4aSRandall Stewart 277f8829a4aSRandall Stewart struct sctp_sockstat { 278f8829a4aSRandall Stewart sctp_assoc_t ss_assoc_id; 279f8829a4aSRandall Stewart uint32_t ss_total_sndbuf; 280f8829a4aSRandall Stewart uint32_t ss_total_recv_buf; 281f8829a4aSRandall Stewart }; 282f8829a4aSRandall Stewart 283f8829a4aSRandall Stewart /* 284f8829a4aSRandall Stewart * notification event structures 285f8829a4aSRandall Stewart */ 286f8829a4aSRandall Stewart 287f8829a4aSRandall Stewart /* 288f8829a4aSRandall Stewart * association change event 289f8829a4aSRandall Stewart */ 290f8829a4aSRandall Stewart struct sctp_assoc_change { 291f8829a4aSRandall Stewart uint16_t sac_type; 292f8829a4aSRandall Stewart uint16_t sac_flags; 293f8829a4aSRandall Stewart uint32_t sac_length; 294f8829a4aSRandall Stewart uint16_t sac_state; 295f8829a4aSRandall Stewart uint16_t sac_error; 296f8829a4aSRandall Stewart uint16_t sac_outbound_streams; 297f8829a4aSRandall Stewart uint16_t sac_inbound_streams; 298f8829a4aSRandall Stewart sctp_assoc_t sac_assoc_id; 299f8829a4aSRandall Stewart }; 300f8829a4aSRandall Stewart 301f8829a4aSRandall Stewart /* sac_state values */ 302f8829a4aSRandall Stewart #define SCTP_COMM_UP 0x0001 303f8829a4aSRandall Stewart #define SCTP_COMM_LOST 0x0002 304f8829a4aSRandall Stewart #define SCTP_RESTART 0x0003 305f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_COMP 0x0004 306f8829a4aSRandall Stewart #define SCTP_CANT_STR_ASSOC 0x0005 307f8829a4aSRandall Stewart 308f8829a4aSRandall Stewart 309f8829a4aSRandall Stewart /* 310f8829a4aSRandall Stewart * Address event 311f8829a4aSRandall Stewart */ 312f8829a4aSRandall Stewart struct sctp_paddr_change { 313f8829a4aSRandall Stewart uint16_t spc_type; 314f8829a4aSRandall Stewart uint16_t spc_flags; 315f8829a4aSRandall Stewart uint32_t spc_length; 316f8829a4aSRandall Stewart struct sockaddr_storage spc_aaddr; 317f8829a4aSRandall Stewart uint32_t spc_state; 318f8829a4aSRandall Stewart uint32_t spc_error; 319f8829a4aSRandall Stewart sctp_assoc_t spc_assoc_id; 320671d309cSRandall Stewart uint8_t spc_padding[4]; 321f8829a4aSRandall Stewart }; 322f8829a4aSRandall Stewart 323f8829a4aSRandall Stewart /* paddr state values */ 324f8829a4aSRandall Stewart #define SCTP_ADDR_AVAILABLE 0x0001 325f8829a4aSRandall Stewart #define SCTP_ADDR_UNREACHABLE 0x0002 326f8829a4aSRandall Stewart #define SCTP_ADDR_REMOVED 0x0003 327f8829a4aSRandall Stewart #define SCTP_ADDR_ADDED 0x0004 328f8829a4aSRandall Stewart #define SCTP_ADDR_MADE_PRIM 0x0005 329f8829a4aSRandall Stewart #define SCTP_ADDR_CONFIRMED 0x0006 330f8829a4aSRandall Stewart 331f8829a4aSRandall Stewart #define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */ 332ca85e948SMichael Tuexen #define SCTP_INACTIVE 0x0002 /* neither SCTP_ADDR_REACHABLE nor 333ca85e948SMichael Tuexen * SCTP_ADDR_UNCONFIRMED */ 334f8829a4aSRandall Stewart #define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */ 335f8829a4aSRandall Stewart 336f8829a4aSRandall Stewart /* remote error events */ 337f8829a4aSRandall Stewart struct sctp_remote_error { 338f8829a4aSRandall Stewart uint16_t sre_type; 339f8829a4aSRandall Stewart uint16_t sre_flags; 340f8829a4aSRandall Stewart uint32_t sre_length; 341f8829a4aSRandall Stewart uint16_t sre_error; 342f8829a4aSRandall Stewart sctp_assoc_t sre_assoc_id; 343f8829a4aSRandall Stewart uint8_t sre_data[4]; 344f8829a4aSRandall Stewart }; 345f8829a4aSRandall Stewart 346f8829a4aSRandall Stewart /* data send failure event */ 347f8829a4aSRandall Stewart struct sctp_send_failed { 348f8829a4aSRandall Stewart uint16_t ssf_type; 349f8829a4aSRandall Stewart uint16_t ssf_flags; 350f8829a4aSRandall Stewart uint32_t ssf_length; 351f8829a4aSRandall Stewart uint32_t ssf_error; 352f8829a4aSRandall Stewart struct sctp_sndrcvinfo ssf_info; 353f8829a4aSRandall Stewart sctp_assoc_t ssf_assoc_id; 354663fdad8SMichael Tuexen uint8_t ssf_data[]; 355f8829a4aSRandall Stewart }; 356f8829a4aSRandall Stewart 357f8829a4aSRandall Stewart /* flag that indicates state of data */ 358f8829a4aSRandall Stewart #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */ 359f8829a4aSRandall Stewart #define SCTP_DATA_SENT 0x0002 /* on wire at failure */ 360f8829a4aSRandall Stewart 361f8829a4aSRandall Stewart /* shutdown event */ 362f8829a4aSRandall Stewart struct sctp_shutdown_event { 363f8829a4aSRandall Stewart uint16_t sse_type; 364f8829a4aSRandall Stewart uint16_t sse_flags; 365f8829a4aSRandall Stewart uint32_t sse_length; 366f8829a4aSRandall Stewart sctp_assoc_t sse_assoc_id; 367f8829a4aSRandall Stewart }; 368f8829a4aSRandall Stewart 369f8829a4aSRandall Stewart /* Adaptation layer indication stuff */ 370f8829a4aSRandall Stewart struct sctp_adaptation_event { 371f8829a4aSRandall Stewart uint16_t sai_type; 372f8829a4aSRandall Stewart uint16_t sai_flags; 373f8829a4aSRandall Stewart uint32_t sai_length; 374f8829a4aSRandall Stewart uint32_t sai_adaptation_ind; 375f8829a4aSRandall Stewart sctp_assoc_t sai_assoc_id; 376f8829a4aSRandall Stewart }; 377f8829a4aSRandall Stewart 378f8829a4aSRandall Stewart struct sctp_setadaptation { 379f8829a4aSRandall Stewart uint32_t ssb_adaptation_ind; 380f8829a4aSRandall Stewart }; 381f8829a4aSRandall Stewart 382b1ce21c6SRebecca Cran /* compatible old spelling */ 383f8829a4aSRandall Stewart struct sctp_adaption_event { 384f8829a4aSRandall Stewart uint16_t sai_type; 385f8829a4aSRandall Stewart uint16_t sai_flags; 386f8829a4aSRandall Stewart uint32_t sai_length; 387f8829a4aSRandall Stewart uint32_t sai_adaption_ind; 388f8829a4aSRandall Stewart sctp_assoc_t sai_assoc_id; 389f8829a4aSRandall Stewart }; 390f8829a4aSRandall Stewart 391f8829a4aSRandall Stewart struct sctp_setadaption { 392f8829a4aSRandall Stewart uint32_t ssb_adaption_ind; 393f8829a4aSRandall Stewart }; 394f8829a4aSRandall Stewart 395f8829a4aSRandall Stewart 396f8829a4aSRandall Stewart /* 397f8829a4aSRandall Stewart * Partial Delivery API event 398f8829a4aSRandall Stewart */ 399f8829a4aSRandall Stewart struct sctp_pdapi_event { 400f8829a4aSRandall Stewart uint16_t pdapi_type; 401f8829a4aSRandall Stewart uint16_t pdapi_flags; 402f8829a4aSRandall Stewart uint32_t pdapi_length; 403f8829a4aSRandall Stewart uint32_t pdapi_indication; 4049a6142d8SRandall Stewart uint16_t pdapi_stream; 4059a6142d8SRandall Stewart uint16_t pdapi_seq; 406f8829a4aSRandall Stewart sctp_assoc_t pdapi_assoc_id; 407f8829a4aSRandall Stewart }; 408f8829a4aSRandall Stewart 409f8829a4aSRandall Stewart /* indication values */ 410f8829a4aSRandall Stewart #define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001 411f8829a4aSRandall Stewart 412f8829a4aSRandall Stewart 413f8829a4aSRandall Stewart /* 414f8829a4aSRandall Stewart * authentication key event 415f8829a4aSRandall Stewart */ 416f8829a4aSRandall Stewart struct sctp_authkey_event { 417f8829a4aSRandall Stewart uint16_t auth_type; 418f8829a4aSRandall Stewart uint16_t auth_flags; 419f8829a4aSRandall Stewart uint32_t auth_length; 420f8829a4aSRandall Stewart uint16_t auth_keynumber; 421f8829a4aSRandall Stewart uint16_t auth_altkeynumber; 422f8829a4aSRandall Stewart uint32_t auth_indication; 423f8829a4aSRandall Stewart sctp_assoc_t auth_assoc_id; 424f8829a4aSRandall Stewart }; 425f8829a4aSRandall Stewart 426f8829a4aSRandall Stewart /* indication values */ 427f8829a4aSRandall Stewart #define SCTP_AUTH_NEWKEY 0x0001 428830d754dSRandall Stewart #define SCTP_AUTH_NO_AUTH 0x0002 429830d754dSRandall Stewart #define SCTP_AUTH_FREE_KEY 0x0003 430830d754dSRandall Stewart 431830d754dSRandall Stewart 432830d754dSRandall Stewart struct sctp_sender_dry_event { 433830d754dSRandall Stewart uint16_t sender_dry_type; 434830d754dSRandall Stewart uint16_t sender_dry_flags; 435830d754dSRandall Stewart uint32_t sender_dry_length; 436830d754dSRandall Stewart sctp_assoc_t sender_dry_assoc_id; 437830d754dSRandall Stewart }; 438f8829a4aSRandall Stewart 439f8829a4aSRandall Stewart 440f8829a4aSRandall Stewart /* 441f8829a4aSRandall Stewart * stream reset event 442f8829a4aSRandall Stewart */ 443f8829a4aSRandall Stewart struct sctp_stream_reset_event { 444f8829a4aSRandall Stewart uint16_t strreset_type; 445f8829a4aSRandall Stewart uint16_t strreset_flags; 446f8829a4aSRandall Stewart uint32_t strreset_length; 447f8829a4aSRandall Stewart sctp_assoc_t strreset_assoc_id; 448663fdad8SMichael Tuexen uint16_t strreset_list[]; 449f8829a4aSRandall Stewart }; 450f8829a4aSRandall Stewart 451f8829a4aSRandall Stewart /* flags in strreset_flags field */ 452f8829a4aSRandall Stewart #define SCTP_STRRESET_INBOUND_STR 0x0001 453f8829a4aSRandall Stewart #define SCTP_STRRESET_OUTBOUND_STR 0x0002 454f8829a4aSRandall Stewart #define SCTP_STRRESET_ALL_STREAMS 0x0004 455f8829a4aSRandall Stewart #define SCTP_STRRESET_STREAM_LIST 0x0008 456f8829a4aSRandall Stewart #define SCTP_STRRESET_FAILED 0x0010 457ea44232bSRandall Stewart #define SCTP_STRRESET_ADD_STREAM 0x0020 458f8829a4aSRandall Stewart 459f8829a4aSRandall Stewart /* SCTP notification event */ 460f8829a4aSRandall Stewart struct sctp_tlv { 461f8829a4aSRandall Stewart uint16_t sn_type; 462f8829a4aSRandall Stewart uint16_t sn_flags; 463f8829a4aSRandall Stewart uint32_t sn_length; 464f8829a4aSRandall Stewart }; 465f8829a4aSRandall Stewart 466f8829a4aSRandall Stewart union sctp_notification { 467f8829a4aSRandall Stewart struct sctp_tlv sn_header; 468f8829a4aSRandall Stewart struct sctp_assoc_change sn_assoc_change; 469f8829a4aSRandall Stewart struct sctp_paddr_change sn_paddr_change; 470f8829a4aSRandall Stewart struct sctp_remote_error sn_remote_error; 471f8829a4aSRandall Stewart struct sctp_send_failed sn_send_failed; 472f8829a4aSRandall Stewart struct sctp_shutdown_event sn_shutdown_event; 473f8829a4aSRandall Stewart struct sctp_adaptation_event sn_adaptation_event; 474b1ce21c6SRebecca Cran /* compatibility same as above */ 475f8829a4aSRandall Stewart struct sctp_adaption_event sn_adaption_event; 476f8829a4aSRandall Stewart struct sctp_pdapi_event sn_pdapi_event; 477f8829a4aSRandall Stewart struct sctp_authkey_event sn_auth_event; 478830d754dSRandall Stewart struct sctp_sender_dry_event sn_sender_dry_event; 479f8829a4aSRandall Stewart struct sctp_stream_reset_event sn_strreset_event; 480f8829a4aSRandall Stewart }; 481f8829a4aSRandall Stewart 482f8829a4aSRandall Stewart /* notification types */ 483f8829a4aSRandall Stewart #define SCTP_ASSOC_CHANGE 0x0001 484f8829a4aSRandall Stewart #define SCTP_PEER_ADDR_CHANGE 0x0002 485f8829a4aSRandall Stewart #define SCTP_REMOTE_ERROR 0x0003 486f8829a4aSRandall Stewart #define SCTP_SEND_FAILED 0x0004 487f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_EVENT 0x0005 488f8829a4aSRandall Stewart #define SCTP_ADAPTATION_INDICATION 0x0006 489f8829a4aSRandall Stewart /* same as above */ 490f8829a4aSRandall Stewart #define SCTP_ADAPTION_INDICATION 0x0006 491f8829a4aSRandall Stewart #define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 492f8829a4aSRandall Stewart #define SCTP_AUTHENTICATION_EVENT 0x0008 493f8829a4aSRandall Stewart #define SCTP_STREAM_RESET_EVENT 0x0009 494830d754dSRandall Stewart #define SCTP_SENDER_DRY_EVENT 0x000a 4950a80a2deSMichael Tuexen #define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b /* we don't send this */ 496f8829a4aSRandall Stewart /* 497f8829a4aSRandall Stewart * socket option structs 498f8829a4aSRandall Stewart */ 499f8829a4aSRandall Stewart 500f8829a4aSRandall Stewart struct sctp_paddrparams { 501f8829a4aSRandall Stewart struct sockaddr_storage spp_address; 502671d309cSRandall Stewart sctp_assoc_t spp_assoc_id; 503f8829a4aSRandall Stewart uint32_t spp_hbinterval; 504f8829a4aSRandall Stewart uint32_t spp_pathmtu; 505f8829a4aSRandall Stewart uint32_t spp_flags; 506f8829a4aSRandall Stewart uint32_t spp_ipv6_flowlabel; 507671d309cSRandall Stewart uint16_t spp_pathmaxrxt; 508b10f2dc8SMichael Tuexen uint8_t spp_dscp; 509f8829a4aSRandall Stewart }; 510f8829a4aSRandall Stewart 511b10f2dc8SMichael Tuexen #define spp_ipv4_tos spp_dscp 512b10f2dc8SMichael Tuexen 513f8829a4aSRandall Stewart #define SPP_HB_ENABLE 0x00000001 514f8829a4aSRandall Stewart #define SPP_HB_DISABLE 0x00000002 515f8829a4aSRandall Stewart #define SPP_HB_DEMAND 0x00000004 516f8829a4aSRandall Stewart #define SPP_PMTUD_ENABLE 0x00000008 517f8829a4aSRandall Stewart #define SPP_PMTUD_DISABLE 0x00000010 518f8829a4aSRandall Stewart #define SPP_HB_TIME_IS_ZERO 0x00000080 519f8829a4aSRandall Stewart #define SPP_IPV6_FLOWLABEL 0x00000100 520b10f2dc8SMichael Tuexen #define SPP_DSCP 0x00000200 521b10f2dc8SMichael Tuexen #define SPP_IPV4_TOS SPP_DSCP 522f8829a4aSRandall Stewart 523ca85e948SMichael Tuexen struct sctp_paddrthlds { 524ca85e948SMichael Tuexen struct sockaddr_storage spt_address; 525ec9925edSMichael Tuexen sctp_assoc_t spt_assoc_id; 526ca85e948SMichael Tuexen uint16_t spt_pathmaxrxt; 527ca85e948SMichael Tuexen uint16_t spt_pathpfthld; 528ca85e948SMichael Tuexen }; 529ca85e948SMichael Tuexen 530f8829a4aSRandall Stewart struct sctp_paddrinfo { 531f8829a4aSRandall Stewart struct sockaddr_storage spinfo_address; 532671d309cSRandall Stewart sctp_assoc_t spinfo_assoc_id; 533f8829a4aSRandall Stewart int32_t spinfo_state; 534f8829a4aSRandall Stewart uint32_t spinfo_cwnd; 535f8829a4aSRandall Stewart uint32_t spinfo_srtt; 536f8829a4aSRandall Stewart uint32_t spinfo_rto; 537f8829a4aSRandall Stewart uint32_t spinfo_mtu; 538f8829a4aSRandall Stewart }; 539f8829a4aSRandall Stewart 540f8829a4aSRandall Stewart struct sctp_rtoinfo { 541f8829a4aSRandall Stewart sctp_assoc_t srto_assoc_id; 542f8829a4aSRandall Stewart uint32_t srto_initial; 543f8829a4aSRandall Stewart uint32_t srto_max; 544f8829a4aSRandall Stewart uint32_t srto_min; 545f8829a4aSRandall Stewart }; 546f8829a4aSRandall Stewart 547f8829a4aSRandall Stewart struct sctp_assocparams { 548f8829a4aSRandall Stewart sctp_assoc_t sasoc_assoc_id; 549f8829a4aSRandall Stewart uint32_t sasoc_peer_rwnd; 550f8829a4aSRandall Stewart uint32_t sasoc_local_rwnd; 551f8829a4aSRandall Stewart uint32_t sasoc_cookie_life; 552671d309cSRandall Stewart uint16_t sasoc_asocmaxrxt; 553671d309cSRandall Stewart uint16_t sasoc_number_peer_destinations; 554f8829a4aSRandall Stewart }; 555f8829a4aSRandall Stewart 556f8829a4aSRandall Stewart struct sctp_setprim { 557f8829a4aSRandall Stewart struct sockaddr_storage ssp_addr; 558671d309cSRandall Stewart sctp_assoc_t ssp_assoc_id; 559671d309cSRandall Stewart uint8_t ssp_padding[4]; 560f8829a4aSRandall Stewart }; 561f8829a4aSRandall Stewart 562f8829a4aSRandall Stewart struct sctp_setpeerprim { 563f8829a4aSRandall Stewart struct sockaddr_storage sspp_addr; 564671d309cSRandall Stewart sctp_assoc_t sspp_assoc_id; 565671d309cSRandall Stewart uint8_t sspp_padding[4]; 566f8829a4aSRandall Stewart }; 567f8829a4aSRandall Stewart 568f8829a4aSRandall Stewart struct sctp_getaddresses { 569f8829a4aSRandall Stewart sctp_assoc_t sget_assoc_id; 570f8829a4aSRandall Stewart /* addr is filled in for N * sockaddr_storage */ 571f8829a4aSRandall Stewart struct sockaddr addr[1]; 572f8829a4aSRandall Stewart }; 573f8829a4aSRandall Stewart 574f8829a4aSRandall Stewart struct sctp_setstrm_timeout { 575f8829a4aSRandall Stewart sctp_assoc_t ssto_assoc_id; 576f8829a4aSRandall Stewart uint32_t ssto_timeout; 577f8829a4aSRandall Stewart uint32_t ssto_streamid_start; 578f8829a4aSRandall Stewart uint32_t ssto_streamid_end; 579f8829a4aSRandall Stewart }; 580f8829a4aSRandall Stewart 581f8829a4aSRandall Stewart struct sctp_status { 582f8829a4aSRandall Stewart sctp_assoc_t sstat_assoc_id; 583f8829a4aSRandall Stewart int32_t sstat_state; 584f8829a4aSRandall Stewart uint32_t sstat_rwnd; 585f8829a4aSRandall Stewart uint16_t sstat_unackdata; 586f8829a4aSRandall Stewart uint16_t sstat_penddata; 587f8829a4aSRandall Stewart uint16_t sstat_instrms; 588f8829a4aSRandall Stewart uint16_t sstat_outstrms; 589f8829a4aSRandall Stewart uint32_t sstat_fragmentation_point; 590f8829a4aSRandall Stewart struct sctp_paddrinfo sstat_primary; 591f8829a4aSRandall Stewart }; 592f8829a4aSRandall Stewart 593f8829a4aSRandall Stewart /* 594f8829a4aSRandall Stewart * AUTHENTICATION support 595f8829a4aSRandall Stewart */ 596f8829a4aSRandall Stewart /* SCTP_AUTH_CHUNK */ 597f8829a4aSRandall Stewart struct sctp_authchunk { 598f8829a4aSRandall Stewart uint8_t sauth_chunk; 599f8829a4aSRandall Stewart }; 600f8829a4aSRandall Stewart 601f8829a4aSRandall Stewart /* SCTP_AUTH_KEY */ 602f8829a4aSRandall Stewart struct sctp_authkey { 603f8829a4aSRandall Stewart sctp_assoc_t sca_assoc_id; 604f8829a4aSRandall Stewart uint16_t sca_keynumber; 605b845acdaSMichael Tuexen uint16_t sca_keylength; 606663fdad8SMichael Tuexen uint8_t sca_key[]; 607f8829a4aSRandall Stewart }; 608f8829a4aSRandall Stewart 609f8829a4aSRandall Stewart /* SCTP_HMAC_IDENT */ 610f8829a4aSRandall Stewart struct sctp_hmacalgo { 611bfefd190SRandall Stewart uint32_t shmac_number_of_idents; 612663fdad8SMichael Tuexen uint16_t shmac_idents[]; 613f8829a4aSRandall Stewart }; 614f8829a4aSRandall Stewart 615f8829a4aSRandall Stewart /* AUTH hmac_id */ 616f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_RSVD 0x0000 617f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA1 0x0001 /* default, mandatory */ 618f8829a4aSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA256 0x0003 61963981c2bSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA224 0x0004 62063981c2bSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA384 0x0005 62163981c2bSRandall Stewart #define SCTP_AUTH_HMAC_ID_SHA512 0x0006 622f8829a4aSRandall Stewart 623f8829a4aSRandall Stewart 624f8829a4aSRandall Stewart /* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */ 625f8829a4aSRandall Stewart struct sctp_authkeyid { 626f8829a4aSRandall Stewart sctp_assoc_t scact_assoc_id; 627f8829a4aSRandall Stewart uint16_t scact_keynumber; 628f8829a4aSRandall Stewart }; 629f8829a4aSRandall Stewart 630f8829a4aSRandall Stewart /* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */ 631f8829a4aSRandall Stewart struct sctp_authchunks { 632f8829a4aSRandall Stewart sctp_assoc_t gauth_assoc_id; 633663fdad8SMichael Tuexen uint8_t gauth_chunks[]; 634f8829a4aSRandall Stewart }; 635f8829a4aSRandall Stewart 636f8829a4aSRandall Stewart struct sctp_assoc_value { 637f8829a4aSRandall Stewart sctp_assoc_t assoc_id; 638f8829a4aSRandall Stewart uint32_t assoc_value; 639f8829a4aSRandall Stewart }; 640f8829a4aSRandall Stewart 641299108c5SRandall Stewart struct sctp_cc_option { 642299108c5SRandall Stewart int option; 643299108c5SRandall Stewart struct sctp_assoc_value aid_value; 644299108c5SRandall Stewart }; 645299108c5SRandall Stewart 646f7a77f6fSMichael Tuexen struct sctp_stream_value { 647f7a77f6fSMichael Tuexen sctp_assoc_t assoc_id; 648f7a77f6fSMichael Tuexen uint16_t stream_id; 649f7a77f6fSMichael Tuexen uint16_t stream_value; 650f7a77f6fSMichael Tuexen }; 651f7a77f6fSMichael Tuexen 652f8829a4aSRandall Stewart struct sctp_assoc_ids { 653830d754dSRandall Stewart uint32_t gaids_number_of_ids; 654663fdad8SMichael Tuexen sctp_assoc_t gaids_assoc_id[]; 655f8829a4aSRandall Stewart }; 656f8829a4aSRandall Stewart 657d61a0ae0SRandall Stewart struct sctp_sack_info { 658d61a0ae0SRandall Stewart sctp_assoc_t sack_assoc_id; 659d61a0ae0SRandall Stewart uint32_t sack_delay; 660d61a0ae0SRandall Stewart uint32_t sack_freq; 661d61a0ae0SRandall Stewart }; 662d61a0ae0SRandall Stewart 6636a67588bSMichael Tuexen struct sctp_timeouts { 6646a67588bSMichael Tuexen sctp_assoc_t stimo_assoc_id; 6656a67588bSMichael Tuexen uint32_t stimo_init; 6666a67588bSMichael Tuexen uint32_t stimo_data; 6676a67588bSMichael Tuexen uint32_t stimo_sack; 6686a67588bSMichael Tuexen uint32_t stimo_shutdown; 6696a67588bSMichael Tuexen uint32_t stimo_heartbeat; 6706a67588bSMichael Tuexen uint32_t stimo_cookie; 6716a67588bSMichael Tuexen uint32_t stimo_shutdownack; 6726a67588bSMichael Tuexen }; 6736a67588bSMichael Tuexen 674c9c58059SMichael Tuexen struct sctp_udpencaps { 675c9c58059SMichael Tuexen struct sockaddr_storage sue_address; 676052230f9SMichael Tuexen sctp_assoc_t sue_assoc_id; 677c9c58059SMichael Tuexen uint16_t sue_port; 678c9c58059SMichael Tuexen }; 679c9c58059SMichael Tuexen 680f8829a4aSRandall Stewart struct sctp_cwnd_args { 681671d309cSRandall Stewart struct sctp_nets *net; /* network to *//* FIXME: LP64 issue */ 682f8829a4aSRandall Stewart uint32_t cwnd_new_value;/* cwnd in k */ 683f8829a4aSRandall Stewart uint32_t pseudo_cumack; 6848933fa13SRandall Stewart uint16_t inflight; /* flightsize in k */ 6858933fa13SRandall Stewart uint16_t cwnd_augment; /* increment to it */ 686f8829a4aSRandall Stewart uint8_t meets_pseudo_cumack; 687f8829a4aSRandall Stewart uint8_t need_new_pseudo_cumack; 688f8829a4aSRandall Stewart uint8_t cnt_in_send; 689f8829a4aSRandall Stewart uint8_t cnt_in_str; 690f8829a4aSRandall Stewart }; 691f8829a4aSRandall Stewart 692f8829a4aSRandall Stewart struct sctp_blk_args { 693f8829a4aSRandall Stewart uint32_t onsb; /* in 1k bytes */ 694f8829a4aSRandall Stewart uint32_t sndlen; /* len of send being attempted */ 695f8829a4aSRandall Stewart uint32_t peer_rwnd; /* rwnd of peer */ 696f8829a4aSRandall Stewart uint16_t send_sent_qcnt;/* chnk cnt */ 697f8829a4aSRandall Stewart uint16_t stream_qcnt; /* chnk cnt */ 698f8829a4aSRandall Stewart uint16_t chunks_on_oque;/* chunks out */ 699f8829a4aSRandall Stewart uint16_t flight_size; /* flight size in k */ 700f8829a4aSRandall Stewart }; 701f8829a4aSRandall Stewart 702f8829a4aSRandall Stewart /* 703f8829a4aSRandall Stewart * Max we can reset in one setting, note this is dictated not by the define 704f8829a4aSRandall Stewart * but the size of a mbuf cluster so don't change this define and think you 705f8829a4aSRandall Stewart * can specify more. You must do multiple resets if you want to reset more 706f8829a4aSRandall Stewart * than SCTP_MAX_EXPLICIT_STR_RESET. 707f8829a4aSRandall Stewart */ 708f8829a4aSRandall Stewart #define SCTP_MAX_EXPLICT_STR_RESET 1000 709f8829a4aSRandall Stewart 710f8829a4aSRandall Stewart #define SCTP_RESET_LOCAL_RECV 0x0001 711f8829a4aSRandall Stewart #define SCTP_RESET_LOCAL_SEND 0x0002 712f8829a4aSRandall Stewart #define SCTP_RESET_BOTH 0x0003 713f8829a4aSRandall Stewart #define SCTP_RESET_TSN 0x0004 714ea44232bSRandall Stewart #define SCTP_RESET_ADD_STREAMS 0x0005 715f8829a4aSRandall Stewart 716f8829a4aSRandall Stewart struct sctp_stream_reset { 717f8829a4aSRandall Stewart sctp_assoc_t strrst_assoc_id; 718f8829a4aSRandall Stewart uint16_t strrst_flags; 719f8829a4aSRandall Stewart uint16_t strrst_num_streams; /* 0 == ALL */ 720663fdad8SMichael Tuexen uint16_t strrst_list[]; /* list if strrst_num_streams is not 0 */ 721f8829a4aSRandall Stewart }; 722f8829a4aSRandall Stewart 723f8829a4aSRandall Stewart 724f8829a4aSRandall Stewart struct sctp_get_nonce_values { 725f8829a4aSRandall Stewart sctp_assoc_t gn_assoc_id; 726f8829a4aSRandall Stewart uint32_t gn_peers_tag; 727f8829a4aSRandall Stewart uint32_t gn_local_tag; 728f8829a4aSRandall Stewart }; 729f8829a4aSRandall Stewart 730f8829a4aSRandall Stewart /* Debugging logs */ 731f8829a4aSRandall Stewart struct sctp_str_log { 732671d309cSRandall Stewart void *stcb; /* FIXME: LP64 issue */ 733f8829a4aSRandall Stewart uint32_t n_tsn; 734f8829a4aSRandall Stewart uint32_t e_tsn; 735f8829a4aSRandall Stewart uint16_t n_sseq; 736f8829a4aSRandall Stewart uint16_t e_sseq; 7376a91f103SRandall Stewart uint16_t strm; 738f8829a4aSRandall Stewart }; 739f8829a4aSRandall Stewart 740f8829a4aSRandall Stewart struct sctp_sb_log { 741671d309cSRandall Stewart void *stcb; /* FIXME: LP64 issue */ 742f8829a4aSRandall Stewart uint32_t so_sbcc; 743f8829a4aSRandall Stewart uint32_t stcb_sbcc; 744f8829a4aSRandall Stewart uint32_t incr; 745f8829a4aSRandall Stewart }; 746f8829a4aSRandall Stewart 747f8829a4aSRandall Stewart struct sctp_fr_log { 748f8829a4aSRandall Stewart uint32_t largest_tsn; 749f8829a4aSRandall Stewart uint32_t largest_new_tsn; 750f8829a4aSRandall Stewart uint32_t tsn; 751f8829a4aSRandall Stewart }; 752f8829a4aSRandall Stewart 753f8829a4aSRandall Stewart struct sctp_fr_map { 754f8829a4aSRandall Stewart uint32_t base; 755f8829a4aSRandall Stewart uint32_t cum; 756f8829a4aSRandall Stewart uint32_t high; 757f8829a4aSRandall Stewart }; 758f8829a4aSRandall Stewart 759f8829a4aSRandall Stewart struct sctp_rwnd_log { 760f8829a4aSRandall Stewart uint32_t rwnd; 761f8829a4aSRandall Stewart uint32_t send_size; 762f8829a4aSRandall Stewart uint32_t overhead; 763f8829a4aSRandall Stewart uint32_t new_rwnd; 764f8829a4aSRandall Stewart }; 765f8829a4aSRandall Stewart 766f8829a4aSRandall Stewart struct sctp_mbcnt_log { 767f8829a4aSRandall Stewart uint32_t total_queue_size; 768f8829a4aSRandall Stewart uint32_t size_change; 769f8829a4aSRandall Stewart uint32_t total_queue_mb_size; 770f8829a4aSRandall Stewart uint32_t mbcnt_change; 771f8829a4aSRandall Stewart }; 772f8829a4aSRandall Stewart 773f8829a4aSRandall Stewart struct sctp_sack_log { 774f8829a4aSRandall Stewart uint32_t cumack; 775f8829a4aSRandall Stewart uint32_t oldcumack; 776f8829a4aSRandall Stewart uint32_t tsn; 777f8829a4aSRandall Stewart uint16_t numGaps; 778f8829a4aSRandall Stewart uint16_t numDups; 779f8829a4aSRandall Stewart }; 780f8829a4aSRandall Stewart 781f8829a4aSRandall Stewart struct sctp_lock_log { 782671d309cSRandall Stewart void *sock; /* FIXME: LP64 issue */ 783671d309cSRandall Stewart void *inp; /* FIXME: LP64 issue */ 784f8829a4aSRandall Stewart uint8_t tcb_lock; 785f8829a4aSRandall Stewart uint8_t inp_lock; 786f8829a4aSRandall Stewart uint8_t info_lock; 787f8829a4aSRandall Stewart uint8_t sock_lock; 788f8829a4aSRandall Stewart uint8_t sockrcvbuf_lock; 789f8829a4aSRandall Stewart uint8_t socksndbuf_lock; 790f8829a4aSRandall Stewart uint8_t create_lock; 791f8829a4aSRandall Stewart uint8_t resv; 792f8829a4aSRandall Stewart }; 793f8829a4aSRandall Stewart 794f8829a4aSRandall Stewart struct sctp_rto_log { 795671d309cSRandall Stewart void *net; /* FIXME: LP64 issue */ 796f8829a4aSRandall Stewart uint32_t rtt; 797f8829a4aSRandall Stewart }; 798f8829a4aSRandall Stewart 799f8829a4aSRandall Stewart struct sctp_nagle_log { 800671d309cSRandall Stewart void *stcb; /* FIXME: LP64 issue */ 801f8829a4aSRandall Stewart uint32_t total_flight; 802f8829a4aSRandall Stewart uint32_t total_in_queue; 803f8829a4aSRandall Stewart uint16_t count_in_queue; 804f8829a4aSRandall Stewart uint16_t count_in_flight; 805f8829a4aSRandall Stewart }; 806f8829a4aSRandall Stewart 807f8829a4aSRandall Stewart struct sctp_sbwake_log { 808671d309cSRandall Stewart void *stcb; /* FIXME: LP64 issue */ 809f8829a4aSRandall Stewart uint16_t send_q; 810f8829a4aSRandall Stewart uint16_t sent_q; 811f8829a4aSRandall Stewart uint16_t flight; 812f8829a4aSRandall Stewart uint16_t wake_cnt; 813f8829a4aSRandall Stewart uint8_t stream_qcnt; /* chnk cnt */ 814f8829a4aSRandall Stewart uint8_t chunks_on_oque; /* chunks out */ 815f8829a4aSRandall Stewart uint8_t sbflags; 816f8829a4aSRandall Stewart uint8_t sctpflags; 817f8829a4aSRandall Stewart }; 818f8829a4aSRandall Stewart 819f8829a4aSRandall Stewart struct sctp_misc_info { 820f8829a4aSRandall Stewart uint32_t log1; 821f8829a4aSRandall Stewart uint32_t log2; 822f8829a4aSRandall Stewart uint32_t log3; 823f8829a4aSRandall Stewart uint32_t log4; 824f8829a4aSRandall Stewart }; 825f8829a4aSRandall Stewart 826f8829a4aSRandall Stewart struct sctp_log_closing { 827671d309cSRandall Stewart void *inp; /* FIXME: LP64 issue */ 828671d309cSRandall Stewart void *stcb; /* FIXME: LP64 issue */ 829f8829a4aSRandall Stewart uint32_t sctp_flags; 830f8829a4aSRandall Stewart uint16_t state; 831f8829a4aSRandall Stewart int16_t loc; 832f8829a4aSRandall Stewart }; 833f8829a4aSRandall Stewart 834f8829a4aSRandall Stewart struct sctp_mbuf_log { 835671d309cSRandall Stewart struct mbuf *mp; /* FIXME: LP64 issue */ 836f8829a4aSRandall Stewart caddr_t ext; 837f8829a4aSRandall Stewart caddr_t data; 838f8829a4aSRandall Stewart uint16_t size; 839f8829a4aSRandall Stewart uint8_t refcnt; 840f8829a4aSRandall Stewart uint8_t mbuf_flags; 841f8829a4aSRandall Stewart }; 842f8829a4aSRandall Stewart 843f8829a4aSRandall Stewart struct sctp_cwnd_log { 84480fefe0aSRandall Stewart uint64_t time_event; 845f8829a4aSRandall Stewart uint8_t from; 846f8829a4aSRandall Stewart uint8_t event_type; 847f8829a4aSRandall Stewart uint8_t resv[2]; 848f8829a4aSRandall Stewart union { 849f8829a4aSRandall Stewart struct sctp_log_closing close; 850f8829a4aSRandall Stewart struct sctp_blk_args blk; 851f8829a4aSRandall Stewart struct sctp_cwnd_args cwnd; 852f8829a4aSRandall Stewart struct sctp_str_log strlog; 853f8829a4aSRandall Stewart struct sctp_fr_log fr; 854f8829a4aSRandall Stewart struct sctp_fr_map map; 855f8829a4aSRandall Stewart struct sctp_rwnd_log rwnd; 856f8829a4aSRandall Stewart struct sctp_mbcnt_log mbcnt; 857f8829a4aSRandall Stewart struct sctp_sack_log sack; 858f8829a4aSRandall Stewart struct sctp_lock_log lock; 859f8829a4aSRandall Stewart struct sctp_rto_log rto; 860f8829a4aSRandall Stewart struct sctp_sb_log sb; 861f8829a4aSRandall Stewart struct sctp_nagle_log nagle; 862f8829a4aSRandall Stewart struct sctp_sbwake_log wake; 863f8829a4aSRandall Stewart struct sctp_mbuf_log mb; 864f8829a4aSRandall Stewart struct sctp_misc_info misc; 865f8829a4aSRandall Stewart } x; 866f8829a4aSRandall Stewart }; 867f8829a4aSRandall Stewart 868f8829a4aSRandall Stewart struct sctp_cwnd_log_req { 869671d309cSRandall Stewart int32_t num_in_log; /* Number in log */ 870671d309cSRandall Stewart int32_t num_ret; /* Number returned */ 871671d309cSRandall Stewart int32_t start_at; /* start at this one */ 872671d309cSRandall Stewart int32_t end_at; /* end at this one */ 873663fdad8SMichael Tuexen struct sctp_cwnd_log log[]; 874f8829a4aSRandall Stewart }; 875f8829a4aSRandall Stewart 876851b7298SRandall Stewart struct sctp_timeval { 877851b7298SRandall Stewart uint32_t tv_sec; 878851b7298SRandall Stewart uint32_t tv_usec; 879851b7298SRandall Stewart }; 880851b7298SRandall Stewart 881f8829a4aSRandall Stewart struct sctpstat { 882892f1c71SRandall Stewart struct sctp_timeval sctps_discontinuitytime; /* sctpStats 18 883892f1c71SRandall Stewart * (TimeStamp) */ 884f8829a4aSRandall Stewart /* MIB according to RFC 3873 */ 885671d309cSRandall Stewart uint32_t sctps_currestab; /* sctpStats 1 (Gauge32) */ 886671d309cSRandall Stewart uint32_t sctps_activeestab; /* sctpStats 2 (Counter32) */ 887671d309cSRandall Stewart uint32_t sctps_restartestab; 888671d309cSRandall Stewart uint32_t sctps_collisionestab; 889671d309cSRandall Stewart uint32_t sctps_passiveestab; /* sctpStats 3 (Counter32) */ 890671d309cSRandall Stewart uint32_t sctps_aborted; /* sctpStats 4 (Counter32) */ 891671d309cSRandall Stewart uint32_t sctps_shutdown;/* sctpStats 5 (Counter32) */ 892671d309cSRandall Stewart uint32_t sctps_outoftheblue; /* sctpStats 6 (Counter32) */ 893671d309cSRandall Stewart uint32_t sctps_checksumerrors; /* sctpStats 7 (Counter32) */ 894671d309cSRandall Stewart uint32_t sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */ 895671d309cSRandall Stewart uint32_t sctps_outorderchunks; /* sctpStats 9 (Counter64) */ 896671d309cSRandall Stewart uint32_t sctps_outunorderchunks; /* sctpStats 10 (Counter64) */ 897671d309cSRandall Stewart uint32_t sctps_incontrolchunks; /* sctpStats 11 (Counter64) */ 898671d309cSRandall Stewart uint32_t sctps_inorderchunks; /* sctpStats 12 (Counter64) */ 899671d309cSRandall Stewart uint32_t sctps_inunorderchunks; /* sctpStats 13 (Counter64) */ 900671d309cSRandall Stewart uint32_t sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */ 901671d309cSRandall Stewart uint32_t sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */ 902671d309cSRandall Stewart uint32_t sctps_outpackets; /* sctpStats 16 (Counter64) */ 903671d309cSRandall Stewart uint32_t sctps_inpackets; /* sctpStats 17 (Counter64) */ 904671d309cSRandall Stewart 905f8829a4aSRandall Stewart /* input statistics: */ 906671d309cSRandall Stewart uint32_t sctps_recvpackets; /* total input packets */ 907671d309cSRandall Stewart uint32_t sctps_recvdatagrams; /* total input datagrams */ 908671d309cSRandall Stewart uint32_t sctps_recvpktwithdata; /* total packets that had data */ 909671d309cSRandall Stewart uint32_t sctps_recvsacks; /* total input SACK chunks */ 910671d309cSRandall Stewart uint32_t sctps_recvdata;/* total input DATA chunks */ 911671d309cSRandall Stewart uint32_t sctps_recvdupdata; /* total input duplicate DATA chunks */ 912671d309cSRandall Stewart uint32_t sctps_recvheartbeat; /* total input HB chunks */ 913671d309cSRandall Stewart uint32_t sctps_recvheartbeatack; /* total input HB-ACK chunks */ 914671d309cSRandall Stewart uint32_t sctps_recvecne;/* total input ECNE chunks */ 915671d309cSRandall Stewart uint32_t sctps_recvauth;/* total input AUTH chunks */ 916671d309cSRandall Stewart uint32_t sctps_recvauthmissing; /* total input chunks missing AUTH */ 917671d309cSRandall Stewart uint32_t sctps_recvivalhmacid; /* total number of invalid HMAC ids 918f8829a4aSRandall Stewart * received */ 919671d309cSRandall Stewart uint32_t sctps_recvivalkeyid; /* total number of invalid secret ids 920f8829a4aSRandall Stewart * received */ 921671d309cSRandall Stewart uint32_t sctps_recvauthfailed; /* total number of auth failed */ 922671d309cSRandall Stewart uint32_t sctps_recvexpress; /* total fast path receives all one 923f8829a4aSRandall Stewart * chunk */ 924671d309cSRandall Stewart uint32_t sctps_recvexpressm; /* total fast path multi-part data */ 925a99b6783SRandall Stewart uint32_t sctps_recvnocrc; 926a99b6783SRandall Stewart uint32_t sctps_recvswcrc; 927a99b6783SRandall Stewart uint32_t sctps_recvhwcrc; 928a99b6783SRandall Stewart 929f8829a4aSRandall Stewart /* output statistics: */ 930671d309cSRandall Stewart uint32_t sctps_sendpackets; /* total output packets */ 931671d309cSRandall Stewart uint32_t sctps_sendsacks; /* total output SACKs */ 932671d309cSRandall Stewart uint32_t sctps_senddata;/* total output DATA chunks */ 933671d309cSRandall Stewart uint32_t sctps_sendretransdata; /* total output retransmitted DATA 934f8829a4aSRandall Stewart * chunks */ 935671d309cSRandall Stewart uint32_t sctps_sendfastretrans; /* total output fast retransmitted 936f8829a4aSRandall Stewart * DATA chunks */ 937671d309cSRandall Stewart uint32_t sctps_sendmultfastretrans; /* total FR's that happened 938478d3f09SRandall Stewart * more than once to same 939478d3f09SRandall Stewart * chunk (u-del multi-fr 940478d3f09SRandall Stewart * algo). */ 941671d309cSRandall Stewart uint32_t sctps_sendheartbeat; /* total output HB chunks */ 942671d309cSRandall Stewart uint32_t sctps_sendecne;/* total output ECNE chunks */ 943671d309cSRandall Stewart uint32_t sctps_sendauth;/* total output AUTH chunks FIXME */ 944671d309cSRandall Stewart uint32_t sctps_senderrors; /* ip_output error counter */ 945a99b6783SRandall Stewart uint32_t sctps_sendnocrc; 946a99b6783SRandall Stewart uint32_t sctps_sendswcrc; 947a99b6783SRandall Stewart uint32_t sctps_sendhwcrc; 948f8829a4aSRandall Stewart /* PCKDROPREP statistics: */ 949671d309cSRandall Stewart uint32_t sctps_pdrpfmbox; /* Packet drop from middle box */ 950671d309cSRandall Stewart uint32_t sctps_pdrpfehos; /* P-drop from end host */ 951671d309cSRandall Stewart uint32_t sctps_pdrpmbda;/* P-drops with data */ 952671d309cSRandall Stewart uint32_t sctps_pdrpmbct;/* P-drops, non-data, non-endhost */ 953671d309cSRandall Stewart uint32_t sctps_pdrpbwrpt; /* P-drop, non-endhost, bandwidth rep 954671d309cSRandall Stewart * only */ 955671d309cSRandall Stewart uint32_t sctps_pdrpcrupt; /* P-drop, not enough for chunk header */ 956671d309cSRandall Stewart uint32_t sctps_pdrpnedat; /* P-drop, not enough data to confirm */ 957671d309cSRandall Stewart uint32_t sctps_pdrppdbrk; /* P-drop, where process_chunk_drop 958671d309cSRandall Stewart * said break */ 959671d309cSRandall Stewart uint32_t sctps_pdrptsnnf; /* P-drop, could not find TSN */ 960671d309cSRandall Stewart uint32_t sctps_pdrpdnfnd; /* P-drop, attempt reverse TSN lookup */ 961671d309cSRandall Stewart uint32_t sctps_pdrpdiwnp; /* P-drop, e-host confirms zero-rwnd */ 962671d309cSRandall Stewart uint32_t sctps_pdrpdizrw; /* P-drop, midbox confirms no space */ 963671d309cSRandall Stewart uint32_t sctps_pdrpbadd;/* P-drop, data did not match TSN */ 964671d309cSRandall Stewart uint32_t sctps_pdrpmark;/* P-drop, TSN's marked for Fast Retran */ 965f8829a4aSRandall Stewart /* timeouts */ 966671d309cSRandall Stewart uint32_t sctps_timoiterator; /* Number of iterator timers that 967478d3f09SRandall Stewart * fired */ 968671d309cSRandall Stewart uint32_t sctps_timodata;/* Number of T3 data time outs */ 969671d309cSRandall Stewart uint32_t sctps_timowindowprobe; /* Number of window probe (T3) timers 970478d3f09SRandall Stewart * that fired */ 971671d309cSRandall Stewart uint32_t sctps_timoinit;/* Number of INIT timers that fired */ 972671d309cSRandall Stewart uint32_t sctps_timosack;/* Number of sack timers that fired */ 973671d309cSRandall Stewart uint32_t sctps_timoshutdown; /* Number of shutdown timers that 974478d3f09SRandall Stewart * fired */ 975671d309cSRandall Stewart uint32_t sctps_timoheartbeat; /* Number of heartbeat timers that 976478d3f09SRandall Stewart * fired */ 977671d309cSRandall Stewart uint32_t sctps_timocookie; /* Number of times a cookie timeout 978478d3f09SRandall Stewart * fired */ 979671d309cSRandall Stewart uint32_t sctps_timosecret; /* Number of times an endpoint changed 980671d309cSRandall Stewart * its cookie secret */ 981671d309cSRandall Stewart uint32_t sctps_timopathmtu; /* Number of PMTU timers that fired */ 982671d309cSRandall Stewart uint32_t sctps_timoshutdownack; /* Number of shutdown ack timers that 983478d3f09SRandall Stewart * fired */ 984671d309cSRandall Stewart uint32_t sctps_timoshutdownguard; /* Number of shutdown guard 985671d309cSRandall Stewart * timers that fired */ 986671d309cSRandall Stewart uint32_t sctps_timostrmrst; /* Number of stream reset timers that 987478d3f09SRandall Stewart * fired */ 988671d309cSRandall Stewart uint32_t sctps_timoearlyfr; /* Number of early FR timers that 989478d3f09SRandall Stewart * fired */ 990671d309cSRandall Stewart uint32_t sctps_timoasconf; /* Number of times an asconf timer 991671d309cSRandall Stewart * fired */ 992851b7298SRandall Stewart uint32_t sctps_timodelprim; /* Number of times a prim_deleted 993851b7298SRandall Stewart * timer fired */ 994671d309cSRandall Stewart uint32_t sctps_timoautoclose; /* Number of times auto close timer 995671d309cSRandall Stewart * fired */ 996671d309cSRandall Stewart uint32_t sctps_timoassockill; /* Number of asoc free timers expired */ 997671d309cSRandall Stewart uint32_t sctps_timoinpkill; /* Number of inp free timers expired */ 998ca85e948SMichael Tuexen /* former early FR counters */ 999ca85e948SMichael Tuexen uint32_t sctps_spare[11]; 1000b1ce21c6SRebecca Cran /* others */ 1001671d309cSRandall Stewart uint32_t sctps_hdrops; /* packet shorter than header */ 1002671d309cSRandall Stewart uint32_t sctps_badsum; /* checksum error */ 1003671d309cSRandall Stewart uint32_t sctps_noport; /* no endpoint for port */ 1004671d309cSRandall Stewart uint32_t sctps_badvtag; /* bad v-tag */ 1005671d309cSRandall Stewart uint32_t sctps_badsid; /* bad SID */ 1006671d309cSRandall Stewart uint32_t sctps_nomem; /* no memory */ 1007671d309cSRandall Stewart uint32_t sctps_fastretransinrtt; /* number of multiple FR in a 1008671d309cSRandall Stewart * RTT window */ 1009671d309cSRandall Stewart uint32_t sctps_markedretrans; 1010671d309cSRandall Stewart uint32_t sctps_naglesent; /* nagle allowed sending */ 1011b1ce21c6SRebecca Cran uint32_t sctps_naglequeued; /* nagle doesn't allow sending */ 1012b1ce21c6SRebecca Cran uint32_t sctps_maxburstqueued; /* max burst doesn't allow sending */ 1013671d309cSRandall Stewart uint32_t sctps_ifnomemqueued; /* look ahead tells us no memory in 1014478d3f09SRandall Stewart * interface ring buffer OR we had a 1015478d3f09SRandall Stewart * send error and are queuing one 1016478d3f09SRandall Stewart * send. */ 1017671d309cSRandall Stewart uint32_t sctps_windowprobed; /* total number of window probes sent */ 1018671d309cSRandall Stewart uint32_t sctps_lowlevelerr; /* total times an output error causes 1019478d3f09SRandall Stewart * us to clamp down on next user send. */ 1020671d309cSRandall Stewart uint32_t sctps_lowlevelerrusr; /* total times sctp_senderrors were 1021478d3f09SRandall Stewart * caused from a user send from a user 1022478d3f09SRandall Stewart * invoked send not a sack response */ 1023671d309cSRandall Stewart uint32_t sctps_datadropchklmt; /* Number of in data drops due to 1024478d3f09SRandall Stewart * chunk limit reached */ 1025671d309cSRandall Stewart uint32_t sctps_datadroprwnd; /* Number of in data drops due to rwnd 1026478d3f09SRandall Stewart * limit reached */ 1027671d309cSRandall Stewart uint32_t sctps_ecnereducedcwnd; /* Number of times a ECN reduced the 1028478d3f09SRandall Stewart * cwnd */ 1029671d309cSRandall Stewart uint32_t sctps_vtagexpress; /* Used express lookup via vtag */ 1030671d309cSRandall Stewart uint32_t sctps_vtagbogus; /* Collision in express lookup. */ 1031671d309cSRandall Stewart uint32_t sctps_primary_randry; /* Number of times the sender ran dry 1032f8829a4aSRandall Stewart * of user data on primary */ 1033671d309cSRandall Stewart uint32_t sctps_cmt_randry; /* Same for above */ 1034671d309cSRandall Stewart uint32_t sctps_slowpath_sack; /* Sacks the slow way */ 1035671d309cSRandall Stewart uint32_t sctps_wu_sacks_sent; /* Window Update only sacks sent */ 1036671d309cSRandall Stewart uint32_t sctps_sends_with_flags; /* number of sends with 1037671d309cSRandall Stewart * sinfo_flags !=0 */ 1038b1ce21c6SRebecca Cran uint32_t sctps_sends_with_unord; /* number of unordered sends */ 1039671d309cSRandall Stewart uint32_t sctps_sends_with_eof; /* number of sends with EOF flag set */ 1040671d309cSRandall Stewart uint32_t sctps_sends_with_abort; /* number of sends with ABORT 1041671d309cSRandall Stewart * flag set */ 1042671d309cSRandall Stewart uint32_t sctps_protocol_drain_calls; /* number of times protocol 1043478d3f09SRandall Stewart * drain called */ 1044671d309cSRandall Stewart uint32_t sctps_protocol_drains_done; /* number of times we did a 1045478d3f09SRandall Stewart * protocol drain */ 1046671d309cSRandall Stewart uint32_t sctps_read_peeks; /* Number of times recv was called 1047671d309cSRandall Stewart * with peek */ 1048671d309cSRandall Stewart uint32_t sctps_cached_chk; /* Number of cached chunks used */ 1049671d309cSRandall Stewart uint32_t sctps_cached_strmoq; /* Number of cached stream oq's used */ 1050b1ce21c6SRebecca Cran uint32_t sctps_left_abandon; /* Number of unread messages abandoned 1051f1f73e57SRandall Stewart * by close */ 1052ea44232bSRandall Stewart uint32_t sctps_send_burst_avoid; /* Unused */ 1053671d309cSRandall Stewart uint32_t sctps_send_cwnd_avoid; /* Send cwnd full avoidance, already 105417205eccSRandall Stewart * max burst inflight to net */ 1055671d309cSRandall Stewart uint32_t sctps_fwdtsn_map_over; /* number of map array over-runs via 1056207304d4SRandall Stewart * fwd-tsn's */ 1057d77e2e42SRandall Stewart uint32_t sctps_queue_upd_ecne; /* Number of times we queued or 1058d77e2e42SRandall Stewart * updated an ECN chunk on send queue */ 1059d77e2e42SRandall Stewart uint32_t sctps_reserved[31]; /* Future ABI compat - remove int's 1060892f1c71SRandall Stewart * from here when adding new */ 1061f8829a4aSRandall Stewart }; 1062f8829a4aSRandall Stewart 1063f8829a4aSRandall Stewart #define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1) 1064f8829a4aSRandall Stewart #define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1) 1065ff014514SRandall Stewart #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) 1066ff014514SRandall Stewart #define SCTP_STAT_INCR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x += _d) 1067ff014514SRandall Stewart #define SCTP_STAT_DECR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x -= _d) 1068ff014514SRandall Stewart #else 1069b3f1ea41SRandall Stewart #define SCTP_STAT_INCR_BY(_x,_d) atomic_add_int(&SCTP_BASE_STAT(_x), _d) 1070b3f1ea41SRandall Stewart #define SCTP_STAT_DECR_BY(_x,_d) atomic_subtract_int(&SCTP_BASE_STAT(_x), _d) 1071ff014514SRandall Stewart #endif 1072f8829a4aSRandall Stewart /* The following macros are for handling MIB values, */ 1073f8829a4aSRandall Stewart #define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x) 1074f8829a4aSRandall Stewart #define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x) 1075f8829a4aSRandall Stewart #define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x) 1076f8829a4aSRandall Stewart #define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x) 1077f8829a4aSRandall Stewart #define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x) 1078f8829a4aSRandall Stewart #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x) 1079f8829a4aSRandall Stewart 108003b0b021SRandall Stewart union sctp_sockstore { 108142551e99SRandall Stewart #if defined(INET) || !defined(_KERNEL) 108203b0b021SRandall Stewart struct sockaddr_in sin; 108303b0b021SRandall Stewart #endif 108442551e99SRandall Stewart #if defined(INET6) || !defined(_KERNEL) 108503b0b021SRandall Stewart struct sockaddr_in6 sin6; 108603b0b021SRandall Stewart #endif 108703b0b021SRandall Stewart struct sockaddr sa; 108803b0b021SRandall Stewart }; 108903b0b021SRandall Stewart 1090049640c1SMichael Tuexen 1091049640c1SMichael Tuexen /***********************************/ 1092049640c1SMichael Tuexen /* And something for us old timers */ 1093049640c1SMichael Tuexen /***********************************/ 1094049640c1SMichael Tuexen 1095049640c1SMichael Tuexen #ifndef ntohll 1096049640c1SMichael Tuexen #include <sys/endian.h> 1097049640c1SMichael Tuexen #define ntohll(x) be64toh(x) 1098049640c1SMichael Tuexen #endif 1099049640c1SMichael Tuexen 1100049640c1SMichael Tuexen #ifndef htonll 1101049640c1SMichael Tuexen #include <sys/endian.h> 1102049640c1SMichael Tuexen #define htonll(x) htobe64(x) 1103049640c1SMichael Tuexen #endif 1104049640c1SMichael Tuexen /***********************************/ 1105049640c1SMichael Tuexen 1106049640c1SMichael Tuexen 1107a5d547adSRandall Stewart struct xsctp_inpcb { 1108a5d547adSRandall Stewart uint32_t last; 1109a5d547adSRandall Stewart uint32_t flags; 1110a5d547adSRandall Stewart uint32_t features; 1111a5d547adSRandall Stewart uint32_t total_sends; 1112a5d547adSRandall Stewart uint32_t total_recvs; 1113a5d547adSRandall Stewart uint32_t total_nospaces; 111417205eccSRandall Stewart uint32_t fragmentation_point; 1115671d309cSRandall Stewart uint16_t local_port; 1116d61a0ae0SRandall Stewart uint16_t qlen; 1117d61a0ae0SRandall Stewart uint16_t maxqlen; 1118e29d4aa6SRandall Stewart uint32_t extra_padding[32]; /* future */ 1119a5d547adSRandall Stewart }; 1120a5d547adSRandall Stewart 1121a5d547adSRandall Stewart struct xsctp_tcb { 1122d61a0ae0SRandall Stewart union sctp_sockstore primary_addr; /* sctpAssocEntry 5/6 */ 1123671d309cSRandall Stewart uint32_t last; 1124d61a0ae0SRandall Stewart uint32_t heartbeat_interval; /* sctpAssocEntry 7 */ 1125d61a0ae0SRandall Stewart uint32_t state; /* sctpAssocEntry 8 */ 1126d61a0ae0SRandall Stewart uint32_t in_streams; /* sctpAssocEntry 9 */ 1127d61a0ae0SRandall Stewart uint32_t out_streams; /* sctpAssocEntry 10 */ 1128d61a0ae0SRandall Stewart uint32_t max_nr_retrans;/* sctpAssocEntry 11 */ 1129d61a0ae0SRandall Stewart uint32_t primary_process; /* sctpAssocEntry 12 */ 1130d61a0ae0SRandall Stewart uint32_t T1_expireries; /* sctpAssocEntry 13 */ 1131d61a0ae0SRandall Stewart uint32_t T2_expireries; /* sctpAssocEntry 14 */ 1132d61a0ae0SRandall Stewart uint32_t retransmitted_tsns; /* sctpAssocEntry 15 */ 1133a5d547adSRandall Stewart uint32_t total_sends; 1134a5d547adSRandall Stewart uint32_t total_recvs; 1135a5d547adSRandall Stewart uint32_t local_tag; 1136a5d547adSRandall Stewart uint32_t remote_tag; 1137a5d547adSRandall Stewart uint32_t initial_tsn; 1138a5d547adSRandall Stewart uint32_t highest_tsn; 1139a5d547adSRandall Stewart uint32_t cumulative_tsn; 1140a5d547adSRandall Stewart uint32_t cumulative_tsn_ack; 114117205eccSRandall Stewart uint32_t mtu; 1142207304d4SRandall Stewart uint32_t refcnt; 1143671d309cSRandall Stewart uint16_t local_port; /* sctpAssocEntry 3 */ 1144671d309cSRandall Stewart uint16_t remote_port; /* sctpAssocEntry 4 */ 1145851b7298SRandall Stewart struct sctp_timeval start_time; /* sctpAssocEntry 16 */ 1146851b7298SRandall Stewart struct sctp_timeval discontinuity_time; /* sctpAssocEntry 17 */ 11474f6b4933SRandall Stewart uint32_t peers_rwnd; 1148a99b6783SRandall Stewart sctp_assoc_t assoc_id; /* sctpAssocEntry 1 */ 1149e29d4aa6SRandall Stewart uint32_t extra_padding[32]; /* future */ 1150a5d547adSRandall Stewart }; 1151a5d547adSRandall Stewart 1152a5d547adSRandall Stewart struct xsctp_laddr { 1153d61a0ae0SRandall Stewart union sctp_sockstore address; /* sctpAssocLocalAddrEntry 1/2 */ 1154671d309cSRandall Stewart uint32_t last; 1155851b7298SRandall Stewart struct sctp_timeval start_time; /* sctpAssocLocalAddrEntry 3 */ 1156e29d4aa6SRandall Stewart uint32_t extra_padding[32]; /* future */ 1157a5d547adSRandall Stewart }; 1158a5d547adSRandall Stewart 1159a5d547adSRandall Stewart struct xsctp_raddr { 1160d61a0ae0SRandall Stewart union sctp_sockstore address; /* sctpAssocLocalRemEntry 1/2 */ 1161671d309cSRandall Stewart uint32_t last; 1162d61a0ae0SRandall Stewart uint32_t rto; /* sctpAssocLocalRemEntry 5 */ 1163d61a0ae0SRandall Stewart uint32_t max_path_rtx; /* sctpAssocLocalRemEntry 6 */ 1164d61a0ae0SRandall Stewart uint32_t rtx; /* sctpAssocLocalRemEntry 7 */ 1165d61a0ae0SRandall Stewart uint32_t error_counter; /* */ 1166d61a0ae0SRandall Stewart uint32_t cwnd; /* */ 1167d61a0ae0SRandall Stewart uint32_t flight_size; /* */ 1168d61a0ae0SRandall Stewart uint32_t mtu; /* */ 1169671d309cSRandall Stewart uint8_t active; /* sctpAssocLocalRemEntry 3 */ 1170671d309cSRandall Stewart uint8_t confirmed; /* */ 1171671d309cSRandall Stewart uint8_t heartbeat_enabled; /* sctpAssocLocalRemEntry 4 */ 1172ca85e948SMichael Tuexen uint8_t potentially_failed; 1173851b7298SRandall Stewart struct sctp_timeval start_time; /* sctpAssocLocalRemEntry 8 */ 1174e29d4aa6SRandall Stewart uint32_t rtt; 1175ca85e948SMichael Tuexen uint32_t heartbeat_interval; 1176ca85e948SMichael Tuexen uint32_t extra_padding[31]; /* future */ 1177a5d547adSRandall Stewart }; 117803b0b021SRandall Stewart 1179b27a6b7dSRandall Stewart #define SCTP_MAX_LOGGING_SIZE 30000 1180b27a6b7dSRandall Stewart #define SCTP_TRACE_PARAMS 6 /* This number MUST be even */ 1181b27a6b7dSRandall Stewart 1182b27a6b7dSRandall Stewart struct sctp_log_entry { 1183c99efcf6SRandall Stewart uint64_t timestamp; 1184b27a6b7dSRandall Stewart uint32_t subsys; 1185b27a6b7dSRandall Stewart uint32_t padding; 1186b27a6b7dSRandall Stewart uint32_t params[SCTP_TRACE_PARAMS]; 1187b27a6b7dSRandall Stewart }; 1188b27a6b7dSRandall Stewart 1189b27a6b7dSRandall Stewart struct sctp_log { 1190b27a6b7dSRandall Stewart struct sctp_log_entry entry[SCTP_MAX_LOGGING_SIZE]; 1191b27a6b7dSRandall Stewart uint32_t index; 1192b27a6b7dSRandall Stewart uint32_t padding; 1193b27a6b7dSRandall Stewart }; 1194b27a6b7dSRandall Stewart 1195f8829a4aSRandall Stewart /* 1196f8829a4aSRandall Stewart * Kernel defined for sctp_send 1197f8829a4aSRandall Stewart */ 1198fc14de76SRandall Stewart #if defined(_KERNEL) || defined(__Userspace__) 1199f8829a4aSRandall Stewart int 1200f8829a4aSRandall Stewart sctp_lower_sosend(struct socket *so, 1201f8829a4aSRandall Stewart struct sockaddr *addr, 1202f8829a4aSRandall Stewart struct uio *uio, 120317205eccSRandall Stewart struct mbuf *i_pak, 1204f8829a4aSRandall Stewart struct mbuf *control, 1205f8829a4aSRandall Stewart int flags, 1206c105859eSRandall Stewart struct sctp_sndrcvinfo *srcv 1207c105859eSRandall Stewart ,struct thread *p 1208f8829a4aSRandall Stewart ); 1209f8829a4aSRandall Stewart 1210f8829a4aSRandall Stewart int 1211f8829a4aSRandall Stewart sctp_sorecvmsg(struct socket *so, 1212f8829a4aSRandall Stewart struct uio *uio, 1213f8829a4aSRandall Stewart struct mbuf **mp, 1214f8829a4aSRandall Stewart struct sockaddr *from, 1215f8829a4aSRandall Stewart int fromlen, 1216f8829a4aSRandall Stewart int *msg_flags, 1217f8829a4aSRandall Stewart struct sctp_sndrcvinfo *sinfo, 1218f8829a4aSRandall Stewart int filling_sinfo); 1219f8829a4aSRandall Stewart 1220f8829a4aSRandall Stewart #endif 1221f8829a4aSRandall Stewart 1222f8829a4aSRandall Stewart /* 1223f8829a4aSRandall Stewart * API system calls 1224f8829a4aSRandall Stewart */ 1225fc14de76SRandall Stewart #if !(defined(_KERNEL)) && !(defined(__Userspace__)) 1226f8829a4aSRandall Stewart 1227f8829a4aSRandall Stewart __BEGIN_DECLS 1228f8829a4aSRandall Stewart int sctp_peeloff __P((int, sctp_assoc_t)); 1229f8829a4aSRandall Stewart int sctp_bindx __P((int, struct sockaddr *, int, int)); 123042551e99SRandall Stewart int sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *)); 1231f8829a4aSRandall Stewart int sctp_getaddrlen __P((sa_family_t)); 1232f8829a4aSRandall Stewart int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **)); 1233f8829a4aSRandall Stewart void sctp_freepaddrs __P((struct sockaddr *)); 1234f8829a4aSRandall Stewart int sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **)); 1235f8829a4aSRandall Stewart void sctp_freeladdrs __P((struct sockaddr *)); 1236f8829a4aSRandall Stewart int sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *)); 1237f8829a4aSRandall Stewart 1238e2e7c62eSMichael Tuexen /* deprecated */ 1239f8829a4aSRandall Stewart ssize_t sctp_sendmsg 1240e2e7c62eSMichael Tuexen __P((int, const void *, size_t, const struct sockaddr *, 1241f8829a4aSRandall Stewart socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); 1242f8829a4aSRandall Stewart 1243e2e7c62eSMichael Tuexen /* deprecated */ 1244e2e7c62eSMichael Tuexen ssize_t sctp_send __P((int, const void *, size_t, 1245e2e7c62eSMichael Tuexen const struct sctp_sndrcvinfo *, int)); 1246f8829a4aSRandall Stewart 1247e2e7c62eSMichael Tuexen /* deprecated */ 1248e2e7c62eSMichael Tuexen ssize_t sctp_sendx __P((int, const void *, size_t, struct sockaddr *, 1249e2e7c62eSMichael Tuexen int, struct sctp_sndrcvinfo *, int)); 125017205eccSRandall Stewart 1251e2e7c62eSMichael Tuexen /* deprecated */ 1252e2e7c62eSMichael Tuexen ssize_t sctp_sendmsgx __P((int sd, const void *, size_t, struct sockaddr *, 1253e2e7c62eSMichael Tuexen int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); 1254f8829a4aSRandall Stewart 1255e2e7c62eSMichael Tuexen sctp_assoc_t sctp_getassocid __P((int, struct sockaddr *)); 1256f8829a4aSRandall Stewart 1257e2e7c62eSMichael Tuexen /* deprecated */ 1258e2e7c62eSMichael Tuexen ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *, socklen_t *, 1259e2e7c62eSMichael Tuexen struct sctp_sndrcvinfo *, int *)); 1260e2e7c62eSMichael Tuexen 1261e2e7c62eSMichael Tuexen ssize_t sctp_sendv __P((int, const struct iovec *, int, struct sockaddr *, 1262e2e7c62eSMichael Tuexen int, void *, socklen_t, unsigned int, int)); 1263e2e7c62eSMichael Tuexen 1264e2e7c62eSMichael Tuexen ssize_t sctp_recvv __P((int, const struct iovec *, int, struct sockaddr *, 1265e2e7c62eSMichael Tuexen socklen_t *, void *, socklen_t *, unsigned int *, int *)); 1266f8829a4aSRandall Stewart 1267f8829a4aSRandall Stewart __END_DECLS 1268f8829a4aSRandall Stewart 1269f8829a4aSRandall Stewart #endif /* !_KERNEL */ 1270f8829a4aSRandall Stewart #endif /* !__sctp_uio_h__ */ 1271