Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /*- |
michael@0 | 2 | * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. |
michael@0 | 3 | * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. |
michael@0 | 4 | * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. |
michael@0 | 5 | * |
michael@0 | 6 | * Redistribution and use in source and binary forms, with or without |
michael@0 | 7 | * modification, are permitted provided that the following conditions are met: |
michael@0 | 8 | * |
michael@0 | 9 | * a) Redistributions of source code must retain the above copyright notice, |
michael@0 | 10 | * this list of conditions and the following disclaimer. |
michael@0 | 11 | * |
michael@0 | 12 | * b) Redistributions in binary form must reproduce the above copyright |
michael@0 | 13 | * notice, this list of conditions and the following disclaimer in |
michael@0 | 14 | * the documentation and/or other materials provided with the distribution. |
michael@0 | 15 | * |
michael@0 | 16 | * c) Neither the name of Cisco Systems, Inc. nor the names of its |
michael@0 | 17 | * contributors may be used to endorse or promote products derived |
michael@0 | 18 | * from this software without specific prior written permission. |
michael@0 | 19 | * |
michael@0 | 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
michael@0 | 21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
michael@0 | 22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
michael@0 | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
michael@0 | 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
michael@0 | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
michael@0 | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
michael@0 | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
michael@0 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
michael@0 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
michael@0 | 30 | * THE POSSIBILITY OF SUCH DAMAGE. |
michael@0 | 31 | */ |
michael@0 | 32 | |
michael@0 | 33 | #ifdef __FreeBSD__ |
michael@0 | 34 | #include <sys/cdefs.h> |
michael@0 | 35 | __FBSDID("$FreeBSD: head/sys/netinet/sctp_uio.h 255160 2013-09-02 22:48:41Z tuexen $"); |
michael@0 | 36 | #endif |
michael@0 | 37 | |
michael@0 | 38 | #ifndef _NETINET_SCTP_UIO_H_ |
michael@0 | 39 | #define _NETINET_SCTP_UIO_H_ |
michael@0 | 40 | |
michael@0 | 41 | #if (defined(__APPLE__) && defined(KERNEL)) |
michael@0 | 42 | #ifndef _KERNEL |
michael@0 | 43 | #define _KERNEL |
michael@0 | 44 | #endif |
michael@0 | 45 | #endif |
michael@0 | 46 | |
michael@0 | 47 | #if !(defined(__Windows__)) && !defined(__Userspace_os_Windows) |
michael@0 | 48 | #if ! defined(_KERNEL) |
michael@0 | 49 | #include <stdint.h> |
michael@0 | 50 | #endif |
michael@0 | 51 | #include <sys/types.h> |
michael@0 | 52 | #include <sys/socket.h> |
michael@0 | 53 | #include <netinet/in.h> |
michael@0 | 54 | #endif |
michael@0 | 55 | #if defined(__Windows__) |
michael@0 | 56 | #pragma warning(push) |
michael@0 | 57 | #pragma warning(disable: 4200) |
michael@0 | 58 | #if defined(_KERNEL) |
michael@0 | 59 | #include <sys/types.h> |
michael@0 | 60 | #include <sys/socket.h> |
michael@0 | 61 | #include <netinet/in.h> |
michael@0 | 62 | #endif |
michael@0 | 63 | #endif |
michael@0 | 64 | |
michael@0 | 65 | typedef uint32_t sctp_assoc_t; |
michael@0 | 66 | |
michael@0 | 67 | #define SCTP_FUTURE_ASSOC 0 |
michael@0 | 68 | #define SCTP_CURRENT_ASSOC 1 |
michael@0 | 69 | #define SCTP_ALL_ASSOC 2 |
michael@0 | 70 | |
michael@0 | 71 | struct sctp_event { |
michael@0 | 72 | sctp_assoc_t se_assoc_id; |
michael@0 | 73 | uint16_t se_type; |
michael@0 | 74 | uint8_t se_on; |
michael@0 | 75 | }; |
michael@0 | 76 | |
michael@0 | 77 | /* Compatibility to previous define's */ |
michael@0 | 78 | #define sctp_stream_reset_events sctp_stream_reset_event |
michael@0 | 79 | |
michael@0 | 80 | /* On/Off setup for subscription to events */ |
michael@0 | 81 | struct sctp_event_subscribe { |
michael@0 | 82 | uint8_t sctp_data_io_event; |
michael@0 | 83 | uint8_t sctp_association_event; |
michael@0 | 84 | uint8_t sctp_address_event; |
michael@0 | 85 | uint8_t sctp_send_failure_event; |
michael@0 | 86 | uint8_t sctp_peer_error_event; |
michael@0 | 87 | uint8_t sctp_shutdown_event; |
michael@0 | 88 | uint8_t sctp_partial_delivery_event; |
michael@0 | 89 | uint8_t sctp_adaptation_layer_event; |
michael@0 | 90 | uint8_t sctp_authentication_event; |
michael@0 | 91 | uint8_t sctp_sender_dry_event; |
michael@0 | 92 | uint8_t sctp_stream_reset_event; |
michael@0 | 93 | }; |
michael@0 | 94 | |
michael@0 | 95 | /* ancillary data types */ |
michael@0 | 96 | #define SCTP_INIT 0x0001 |
michael@0 | 97 | #define SCTP_SNDRCV 0x0002 |
michael@0 | 98 | #define SCTP_EXTRCV 0x0003 |
michael@0 | 99 | #define SCTP_SNDINFO 0x0004 |
michael@0 | 100 | #define SCTP_RCVINFO 0x0005 |
michael@0 | 101 | #define SCTP_NXTINFO 0x0006 |
michael@0 | 102 | #define SCTP_PRINFO 0x0007 |
michael@0 | 103 | #define SCTP_AUTHINFO 0x0008 |
michael@0 | 104 | #define SCTP_DSTADDRV4 0x0009 |
michael@0 | 105 | #define SCTP_DSTADDRV6 0x000a |
michael@0 | 106 | |
michael@0 | 107 | /* |
michael@0 | 108 | * ancillary data structures |
michael@0 | 109 | */ |
michael@0 | 110 | struct sctp_initmsg { |
michael@0 | 111 | #if defined(__FreeBSD__) && __FreeBSD_version < 800000 |
michael@0 | 112 | /* This is a bug. Not fixed for ABI compatibility */ |
michael@0 | 113 | uint32_t sinit_num_ostreams; |
michael@0 | 114 | uint32_t sinit_max_instreams; |
michael@0 | 115 | #else |
michael@0 | 116 | uint16_t sinit_num_ostreams; |
michael@0 | 117 | uint16_t sinit_max_instreams; |
michael@0 | 118 | #endif |
michael@0 | 119 | uint16_t sinit_max_attempts; |
michael@0 | 120 | uint16_t sinit_max_init_timeo; |
michael@0 | 121 | }; |
michael@0 | 122 | |
michael@0 | 123 | /* We add 96 bytes to the size of sctp_sndrcvinfo. |
michael@0 | 124 | * This makes the current structure 128 bytes long |
michael@0 | 125 | * which is nicely 64 bit aligned but also has room |
michael@0 | 126 | * for us to add more and keep ABI compatibility. |
michael@0 | 127 | * For example, already we have the sctp_extrcvinfo |
michael@0 | 128 | * when enabled which is 48 bytes. |
michael@0 | 129 | */ |
michael@0 | 130 | |
michael@0 | 131 | /* |
michael@0 | 132 | * The assoc up needs a verfid |
michael@0 | 133 | * all sendrcvinfo's need a verfid for SENDING only. |
michael@0 | 134 | */ |
michael@0 | 135 | |
michael@0 | 136 | |
michael@0 | 137 | #define SCTP_ALIGN_RESV_PAD 92 |
michael@0 | 138 | #define SCTP_ALIGN_RESV_PAD_SHORT 76 |
michael@0 | 139 | |
michael@0 | 140 | struct sctp_sndrcvinfo { |
michael@0 | 141 | uint16_t sinfo_stream; |
michael@0 | 142 | uint16_t sinfo_ssn; |
michael@0 | 143 | uint16_t sinfo_flags; |
michael@0 | 144 | #if defined(__FreeBSD__) && __FreeBSD_version < 800000 |
michael@0 | 145 | uint16_t sinfo_pr_policy; |
michael@0 | 146 | #endif |
michael@0 | 147 | uint32_t sinfo_ppid; |
michael@0 | 148 | uint32_t sinfo_context; |
michael@0 | 149 | uint32_t sinfo_timetolive; |
michael@0 | 150 | uint32_t sinfo_tsn; |
michael@0 | 151 | uint32_t sinfo_cumtsn; |
michael@0 | 152 | sctp_assoc_t sinfo_assoc_id; |
michael@0 | 153 | uint16_t sinfo_keynumber; |
michael@0 | 154 | uint16_t sinfo_keynumber_valid; |
michael@0 | 155 | uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD]; |
michael@0 | 156 | }; |
michael@0 | 157 | |
michael@0 | 158 | struct sctp_extrcvinfo { |
michael@0 | 159 | uint16_t sinfo_stream; |
michael@0 | 160 | uint16_t sinfo_ssn; |
michael@0 | 161 | uint16_t sinfo_flags; |
michael@0 | 162 | #if defined(__FreeBSD__) && __FreeBSD_version < 800000 |
michael@0 | 163 | uint16_t sinfo_pr_policy; |
michael@0 | 164 | #endif |
michael@0 | 165 | uint32_t sinfo_ppid; |
michael@0 | 166 | uint32_t sinfo_context; |
michael@0 | 167 | uint32_t sinfo_timetolive; |
michael@0 | 168 | uint32_t sinfo_tsn; |
michael@0 | 169 | uint32_t sinfo_cumtsn; |
michael@0 | 170 | sctp_assoc_t sinfo_assoc_id; |
michael@0 | 171 | uint16_t sreinfo_next_flags; |
michael@0 | 172 | uint16_t sreinfo_next_stream; |
michael@0 | 173 | uint32_t sreinfo_next_aid; |
michael@0 | 174 | uint32_t sreinfo_next_length; |
michael@0 | 175 | uint32_t sreinfo_next_ppid; |
michael@0 | 176 | uint16_t sinfo_keynumber; |
michael@0 | 177 | uint16_t sinfo_keynumber_valid; |
michael@0 | 178 | uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT]; |
michael@0 | 179 | }; |
michael@0 | 180 | |
michael@0 | 181 | struct sctp_sndinfo { |
michael@0 | 182 | uint16_t snd_sid; |
michael@0 | 183 | uint16_t snd_flags; |
michael@0 | 184 | uint32_t snd_ppid; |
michael@0 | 185 | uint32_t snd_context; |
michael@0 | 186 | sctp_assoc_t snd_assoc_id; |
michael@0 | 187 | }; |
michael@0 | 188 | |
michael@0 | 189 | struct sctp_prinfo { |
michael@0 | 190 | uint16_t pr_policy; |
michael@0 | 191 | uint32_t pr_value; |
michael@0 | 192 | }; |
michael@0 | 193 | |
michael@0 | 194 | struct sctp_default_prinfo { |
michael@0 | 195 | uint16_t pr_policy; |
michael@0 | 196 | uint32_t pr_value; |
michael@0 | 197 | sctp_assoc_t pr_assoc_id; |
michael@0 | 198 | }; |
michael@0 | 199 | |
michael@0 | 200 | struct sctp_authinfo { |
michael@0 | 201 | uint16_t auth_keynumber; |
michael@0 | 202 | }; |
michael@0 | 203 | |
michael@0 | 204 | struct sctp_rcvinfo { |
michael@0 | 205 | uint16_t rcv_sid; |
michael@0 | 206 | uint16_t rcv_ssn; |
michael@0 | 207 | uint16_t rcv_flags; |
michael@0 | 208 | uint32_t rcv_ppid; |
michael@0 | 209 | uint32_t rcv_tsn; |
michael@0 | 210 | uint32_t rcv_cumtsn; |
michael@0 | 211 | uint32_t rcv_context; |
michael@0 | 212 | sctp_assoc_t rcv_assoc_id; |
michael@0 | 213 | }; |
michael@0 | 214 | |
michael@0 | 215 | struct sctp_nxtinfo { |
michael@0 | 216 | uint16_t nxt_sid; |
michael@0 | 217 | uint16_t nxt_flags; |
michael@0 | 218 | uint32_t nxt_ppid; |
michael@0 | 219 | uint32_t nxt_length; |
michael@0 | 220 | sctp_assoc_t nxt_assoc_id; |
michael@0 | 221 | }; |
michael@0 | 222 | |
michael@0 | 223 | #define SCTP_NO_NEXT_MSG 0x0000 |
michael@0 | 224 | #define SCTP_NEXT_MSG_AVAIL 0x0001 |
michael@0 | 225 | #define SCTP_NEXT_MSG_ISCOMPLETE 0x0002 |
michael@0 | 226 | #define SCTP_NEXT_MSG_IS_UNORDERED 0x0004 |
michael@0 | 227 | #define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008 |
michael@0 | 228 | |
michael@0 | 229 | struct sctp_recvv_rn { |
michael@0 | 230 | struct sctp_rcvinfo recvv_rcvinfo; |
michael@0 | 231 | struct sctp_nxtinfo recvv_nxtinfo; |
michael@0 | 232 | }; |
michael@0 | 233 | |
michael@0 | 234 | #define SCTP_RECVV_NOINFO 0 |
michael@0 | 235 | #define SCTP_RECVV_RCVINFO 1 |
michael@0 | 236 | #define SCTP_RECVV_NXTINFO 2 |
michael@0 | 237 | #define SCTP_RECVV_RN 3 |
michael@0 | 238 | |
michael@0 | 239 | #define SCTP_SENDV_NOINFO 0 |
michael@0 | 240 | #define SCTP_SENDV_SNDINFO 1 |
michael@0 | 241 | #define SCTP_SENDV_PRINFO 2 |
michael@0 | 242 | #define SCTP_SENDV_AUTHINFO 3 |
michael@0 | 243 | #define SCTP_SENDV_SPA 4 |
michael@0 | 244 | |
michael@0 | 245 | struct sctp_sendv_spa { |
michael@0 | 246 | uint32_t sendv_flags; |
michael@0 | 247 | struct sctp_sndinfo sendv_sndinfo; |
michael@0 | 248 | struct sctp_prinfo sendv_prinfo; |
michael@0 | 249 | struct sctp_authinfo sendv_authinfo; |
michael@0 | 250 | }; |
michael@0 | 251 | |
michael@0 | 252 | #define SCTP_SEND_SNDINFO_VALID 0x00000001 |
michael@0 | 253 | #define SCTP_SEND_PRINFO_VALID 0x00000002 |
michael@0 | 254 | #define SCTP_SEND_AUTHINFO_VALID 0x00000004 |
michael@0 | 255 | |
michael@0 | 256 | struct sctp_snd_all_completes { |
michael@0 | 257 | uint16_t sall_stream; |
michael@0 | 258 | uint16_t sall_flags; |
michael@0 | 259 | uint32_t sall_ppid; |
michael@0 | 260 | uint32_t sall_context; |
michael@0 | 261 | uint32_t sall_num_sent; |
michael@0 | 262 | uint32_t sall_num_failed; |
michael@0 | 263 | }; |
michael@0 | 264 | |
michael@0 | 265 | /* Flags that go into the sinfo->sinfo_flags field */ |
michael@0 | 266 | #define SCTP_NOTIFICATION 0x0010 /* next message is a notification */ |
michael@0 | 267 | #define SCTP_COMPLETE 0x0020 /* next message is complete */ |
michael@0 | 268 | #define SCTP_EOF 0x0100 /* Start shutdown procedures */ |
michael@0 | 269 | #define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ |
michael@0 | 270 | #define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ |
michael@0 | 271 | #define SCTP_ADDR_OVER 0x0800 /* Override the primary-address */ |
michael@0 | 272 | #define SCTP_SENDALL 0x1000 /* Send this on all associations */ |
michael@0 | 273 | #define SCTP_EOR 0x2000 /* end of message signal */ |
michael@0 | 274 | #define SCTP_SACK_IMMEDIATELY 0x4000 /* Set I-Bit */ |
michael@0 | 275 | |
michael@0 | 276 | #define INVALID_SINFO_FLAG(x) (((x) & 0xfffffff0 \ |
michael@0 | 277 | & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\ |
michael@0 | 278 | SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR |\ |
michael@0 | 279 | SCTP_SACK_IMMEDIATELY)) != 0) |
michael@0 | 280 | /* for the endpoint */ |
michael@0 | 281 | |
michael@0 | 282 | /* The lower byte is an enumeration of PR-SCTP policies */ |
michael@0 | 283 | #define SCTP_PR_SCTP_NONE 0x0000 /* Reliable transfer */ |
michael@0 | 284 | #define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ |
michael@0 | 285 | #define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ |
michael@0 | 286 | #define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ |
michael@0 | 287 | |
michael@0 | 288 | #define PR_SCTP_POLICY(x) ((x) & 0x0f) |
michael@0 | 289 | #define PR_SCTP_ENABLED(x) (PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE) |
michael@0 | 290 | #define PR_SCTP_TTL_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL) |
michael@0 | 291 | #define PR_SCTP_BUF_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF) |
michael@0 | 292 | #define PR_SCTP_RTX_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX) |
michael@0 | 293 | #define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX) |
michael@0 | 294 | /* Stat's */ |
michael@0 | 295 | struct sctp_pcbinfo { |
michael@0 | 296 | uint32_t ep_count; |
michael@0 | 297 | uint32_t asoc_count; |
michael@0 | 298 | uint32_t laddr_count; |
michael@0 | 299 | uint32_t raddr_count; |
michael@0 | 300 | uint32_t chk_count; |
michael@0 | 301 | uint32_t readq_count; |
michael@0 | 302 | uint32_t free_chunks; |
michael@0 | 303 | uint32_t stream_oque; |
michael@0 | 304 | }; |
michael@0 | 305 | |
michael@0 | 306 | struct sctp_sockstat { |
michael@0 | 307 | sctp_assoc_t ss_assoc_id; |
michael@0 | 308 | uint32_t ss_total_sndbuf; |
michael@0 | 309 | uint32_t ss_total_recv_buf; |
michael@0 | 310 | }; |
michael@0 | 311 | |
michael@0 | 312 | /* |
michael@0 | 313 | * notification event structures |
michael@0 | 314 | */ |
michael@0 | 315 | |
michael@0 | 316 | /* |
michael@0 | 317 | * association change event |
michael@0 | 318 | */ |
michael@0 | 319 | struct sctp_assoc_change { |
michael@0 | 320 | uint16_t sac_type; |
michael@0 | 321 | uint16_t sac_flags; |
michael@0 | 322 | uint32_t sac_length; |
michael@0 | 323 | uint16_t sac_state; |
michael@0 | 324 | uint16_t sac_error; |
michael@0 | 325 | uint16_t sac_outbound_streams; |
michael@0 | 326 | uint16_t sac_inbound_streams; |
michael@0 | 327 | sctp_assoc_t sac_assoc_id; |
michael@0 | 328 | uint8_t sac_info[]; |
michael@0 | 329 | }; |
michael@0 | 330 | |
michael@0 | 331 | /* sac_state values */ |
michael@0 | 332 | #define SCTP_COMM_UP 0x0001 |
michael@0 | 333 | #define SCTP_COMM_LOST 0x0002 |
michael@0 | 334 | #define SCTP_RESTART 0x0003 |
michael@0 | 335 | #define SCTP_SHUTDOWN_COMP 0x0004 |
michael@0 | 336 | #define SCTP_CANT_STR_ASSOC 0x0005 |
michael@0 | 337 | |
michael@0 | 338 | /* sac_info values */ |
michael@0 | 339 | #define SCTP_ASSOC_SUPPORTS_PR 0x01 |
michael@0 | 340 | #define SCTP_ASSOC_SUPPORTS_AUTH 0x02 |
michael@0 | 341 | #define SCTP_ASSOC_SUPPORTS_ASCONF 0x03 |
michael@0 | 342 | #define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x04 |
michael@0 | 343 | #define SCTP_ASSOC_SUPPORTS_RE_CONFIG 0x05 |
michael@0 | 344 | #define SCTP_ASSOC_SUPPORTS_MAX 0x05 |
michael@0 | 345 | /* |
michael@0 | 346 | * Address event |
michael@0 | 347 | */ |
michael@0 | 348 | struct sctp_paddr_change { |
michael@0 | 349 | uint16_t spc_type; |
michael@0 | 350 | uint16_t spc_flags; |
michael@0 | 351 | uint32_t spc_length; |
michael@0 | 352 | struct sockaddr_storage spc_aaddr; |
michael@0 | 353 | uint32_t spc_state; |
michael@0 | 354 | uint32_t spc_error; |
michael@0 | 355 | sctp_assoc_t spc_assoc_id; |
michael@0 | 356 | uint8_t spc_padding[4]; |
michael@0 | 357 | }; |
michael@0 | 358 | |
michael@0 | 359 | /* paddr state values */ |
michael@0 | 360 | #define SCTP_ADDR_AVAILABLE 0x0001 |
michael@0 | 361 | #define SCTP_ADDR_UNREACHABLE 0x0002 |
michael@0 | 362 | #define SCTP_ADDR_REMOVED 0x0003 |
michael@0 | 363 | #define SCTP_ADDR_ADDED 0x0004 |
michael@0 | 364 | #define SCTP_ADDR_MADE_PRIM 0x0005 |
michael@0 | 365 | #define SCTP_ADDR_CONFIRMED 0x0006 |
michael@0 | 366 | |
michael@0 | 367 | #define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */ |
michael@0 | 368 | #define SCTP_INACTIVE 0x0002 /* neither SCTP_ADDR_REACHABLE |
michael@0 | 369 | nor SCTP_ADDR_UNCONFIRMED */ |
michael@0 | 370 | #define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */ |
michael@0 | 371 | |
michael@0 | 372 | /* remote error events */ |
michael@0 | 373 | struct sctp_remote_error { |
michael@0 | 374 | uint16_t sre_type; |
michael@0 | 375 | uint16_t sre_flags; |
michael@0 | 376 | uint32_t sre_length; |
michael@0 | 377 | uint16_t sre_error; |
michael@0 | 378 | sctp_assoc_t sre_assoc_id; |
michael@0 | 379 | uint8_t sre_data[4]; |
michael@0 | 380 | }; |
michael@0 | 381 | |
michael@0 | 382 | /* data send failure event (deprecated) */ |
michael@0 | 383 | struct sctp_send_failed { |
michael@0 | 384 | uint16_t ssf_type; |
michael@0 | 385 | uint16_t ssf_flags; |
michael@0 | 386 | uint32_t ssf_length; |
michael@0 | 387 | uint32_t ssf_error; |
michael@0 | 388 | struct sctp_sndrcvinfo ssf_info; |
michael@0 | 389 | sctp_assoc_t ssf_assoc_id; |
michael@0 | 390 | uint8_t ssf_data[]; |
michael@0 | 391 | }; |
michael@0 | 392 | |
michael@0 | 393 | /* data send failure event (not deprecated) */ |
michael@0 | 394 | struct sctp_send_failed_event { |
michael@0 | 395 | uint16_t ssfe_type; |
michael@0 | 396 | uint16_t ssfe_flags; |
michael@0 | 397 | uint32_t ssfe_length; |
michael@0 | 398 | uint32_t ssfe_error; |
michael@0 | 399 | struct sctp_sndinfo ssfe_info; |
michael@0 | 400 | sctp_assoc_t ssfe_assoc_id; |
michael@0 | 401 | uint8_t ssfe_data[]; |
michael@0 | 402 | }; |
michael@0 | 403 | |
michael@0 | 404 | /* flag that indicates state of data */ |
michael@0 | 405 | #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */ |
michael@0 | 406 | #define SCTP_DATA_SENT 0x0002 /* on wire at failure */ |
michael@0 | 407 | |
michael@0 | 408 | /* shutdown event */ |
michael@0 | 409 | struct sctp_shutdown_event { |
michael@0 | 410 | uint16_t sse_type; |
michael@0 | 411 | uint16_t sse_flags; |
michael@0 | 412 | uint32_t sse_length; |
michael@0 | 413 | sctp_assoc_t sse_assoc_id; |
michael@0 | 414 | }; |
michael@0 | 415 | |
michael@0 | 416 | /* Adaptation layer indication stuff */ |
michael@0 | 417 | struct sctp_adaptation_event { |
michael@0 | 418 | uint16_t sai_type; |
michael@0 | 419 | uint16_t sai_flags; |
michael@0 | 420 | uint32_t sai_length; |
michael@0 | 421 | uint32_t sai_adaptation_ind; |
michael@0 | 422 | sctp_assoc_t sai_assoc_id; |
michael@0 | 423 | }; |
michael@0 | 424 | |
michael@0 | 425 | struct sctp_setadaptation { |
michael@0 | 426 | uint32_t ssb_adaptation_ind; |
michael@0 | 427 | }; |
michael@0 | 428 | |
michael@0 | 429 | /* compatible old spelling */ |
michael@0 | 430 | struct sctp_adaption_event { |
michael@0 | 431 | uint16_t sai_type; |
michael@0 | 432 | uint16_t sai_flags; |
michael@0 | 433 | uint32_t sai_length; |
michael@0 | 434 | uint32_t sai_adaption_ind; |
michael@0 | 435 | sctp_assoc_t sai_assoc_id; |
michael@0 | 436 | }; |
michael@0 | 437 | |
michael@0 | 438 | struct sctp_setadaption { |
michael@0 | 439 | uint32_t ssb_adaption_ind; |
michael@0 | 440 | }; |
michael@0 | 441 | |
michael@0 | 442 | |
michael@0 | 443 | /* |
michael@0 | 444 | * Partial Delivery API event |
michael@0 | 445 | */ |
michael@0 | 446 | struct sctp_pdapi_event { |
michael@0 | 447 | uint16_t pdapi_type; |
michael@0 | 448 | uint16_t pdapi_flags; |
michael@0 | 449 | uint32_t pdapi_length; |
michael@0 | 450 | uint32_t pdapi_indication; |
michael@0 | 451 | uint16_t pdapi_stream; |
michael@0 | 452 | uint16_t pdapi_seq; |
michael@0 | 453 | sctp_assoc_t pdapi_assoc_id; |
michael@0 | 454 | }; |
michael@0 | 455 | |
michael@0 | 456 | /* indication values */ |
michael@0 | 457 | #define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001 |
michael@0 | 458 | |
michael@0 | 459 | |
michael@0 | 460 | /* |
michael@0 | 461 | * authentication key event |
michael@0 | 462 | */ |
michael@0 | 463 | struct sctp_authkey_event { |
michael@0 | 464 | uint16_t auth_type; |
michael@0 | 465 | uint16_t auth_flags; |
michael@0 | 466 | uint32_t auth_length; |
michael@0 | 467 | uint16_t auth_keynumber; |
michael@0 | 468 | uint16_t auth_altkeynumber; |
michael@0 | 469 | uint32_t auth_indication; |
michael@0 | 470 | sctp_assoc_t auth_assoc_id; |
michael@0 | 471 | }; |
michael@0 | 472 | |
michael@0 | 473 | /* indication values */ |
michael@0 | 474 | #define SCTP_AUTH_NEW_KEY 0x0001 |
michael@0 | 475 | #define SCTP_AUTH_NEWKEY SCTP_AUTH_NEW_KEY |
michael@0 | 476 | #define SCTP_AUTH_NO_AUTH 0x0002 |
michael@0 | 477 | #define SCTP_AUTH_FREE_KEY 0x0003 |
michael@0 | 478 | |
michael@0 | 479 | |
michael@0 | 480 | struct sctp_sender_dry_event { |
michael@0 | 481 | uint16_t sender_dry_type; |
michael@0 | 482 | uint16_t sender_dry_flags; |
michael@0 | 483 | uint32_t sender_dry_length; |
michael@0 | 484 | sctp_assoc_t sender_dry_assoc_id; |
michael@0 | 485 | }; |
michael@0 | 486 | |
michael@0 | 487 | |
michael@0 | 488 | /* |
michael@0 | 489 | * Stream reset event - subscribe to SCTP_STREAM_RESET_EVENT |
michael@0 | 490 | */ |
michael@0 | 491 | struct sctp_stream_reset_event { |
michael@0 | 492 | uint16_t strreset_type; |
michael@0 | 493 | uint16_t strreset_flags; |
michael@0 | 494 | uint32_t strreset_length; |
michael@0 | 495 | sctp_assoc_t strreset_assoc_id; |
michael@0 | 496 | uint16_t strreset_stream_list[]; |
michael@0 | 497 | }; |
michael@0 | 498 | |
michael@0 | 499 | /* flags in stream_reset_event (strreset_flags) */ |
michael@0 | 500 | #define SCTP_STREAM_RESET_INCOMING_SSN 0x0001 |
michael@0 | 501 | #define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 |
michael@0 | 502 | #define SCTP_STREAM_RESET_DENIED 0x0004 |
michael@0 | 503 | #define SCTP_STREAM_RESET_FAILED 0x0008 |
michael@0 | 504 | |
michael@0 | 505 | /* |
michael@0 | 506 | * Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT |
michael@0 | 507 | */ |
michael@0 | 508 | struct sctp_assoc_reset_event { |
michael@0 | 509 | uint16_t assocreset_type; |
michael@0 | 510 | uint16_t assocreset_flags; |
michael@0 | 511 | uint32_t assocreset_length; |
michael@0 | 512 | sctp_assoc_t assocreset_assoc_id; |
michael@0 | 513 | uint32_t assocreset_local_tsn; |
michael@0 | 514 | uint32_t assocreset_remote_tsn; |
michael@0 | 515 | }; |
michael@0 | 516 | |
michael@0 | 517 | #define SCTP_ASSOC_RESET_DENIED 0x0004 |
michael@0 | 518 | #define SCTP_ASSOC_RESET_FAILED 0x0008 |
michael@0 | 519 | |
michael@0 | 520 | /* |
michael@0 | 521 | * Stream change event - subscribe to SCTP_STREAM_CHANGE_EVENT |
michael@0 | 522 | */ |
michael@0 | 523 | struct sctp_stream_change_event { |
michael@0 | 524 | uint16_t strchange_type; |
michael@0 | 525 | uint16_t strchange_flags; |
michael@0 | 526 | uint32_t strchange_length; |
michael@0 | 527 | sctp_assoc_t strchange_assoc_id; |
michael@0 | 528 | uint16_t strchange_instrms; |
michael@0 | 529 | uint16_t strchange_outstrms; |
michael@0 | 530 | }; |
michael@0 | 531 | |
michael@0 | 532 | #define SCTP_STREAM_CHANGE_DENIED 0x0004 |
michael@0 | 533 | #define SCTP_STREAM_CHANGE_FAILED 0x0008 |
michael@0 | 534 | |
michael@0 | 535 | |
michael@0 | 536 | /* SCTP notification event */ |
michael@0 | 537 | struct sctp_tlv { |
michael@0 | 538 | uint16_t sn_type; |
michael@0 | 539 | uint16_t sn_flags; |
michael@0 | 540 | uint32_t sn_length; |
michael@0 | 541 | }; |
michael@0 | 542 | |
michael@0 | 543 | union sctp_notification { |
michael@0 | 544 | struct sctp_tlv sn_header; |
michael@0 | 545 | struct sctp_assoc_change sn_assoc_change; |
michael@0 | 546 | struct sctp_paddr_change sn_paddr_change; |
michael@0 | 547 | struct sctp_remote_error sn_remote_error; |
michael@0 | 548 | struct sctp_send_failed sn_send_failed; |
michael@0 | 549 | struct sctp_shutdown_event sn_shutdown_event; |
michael@0 | 550 | struct sctp_adaptation_event sn_adaptation_event; |
michael@0 | 551 | /* compatibility same as above */ |
michael@0 | 552 | struct sctp_adaption_event sn_adaption_event; |
michael@0 | 553 | struct sctp_pdapi_event sn_pdapi_event; |
michael@0 | 554 | struct sctp_authkey_event sn_auth_event; |
michael@0 | 555 | struct sctp_sender_dry_event sn_sender_dry_event; |
michael@0 | 556 | struct sctp_send_failed_event sn_send_failed_event; |
michael@0 | 557 | struct sctp_stream_reset_event sn_strreset_event; |
michael@0 | 558 | struct sctp_assoc_reset_event sn_assocreset_event; |
michael@0 | 559 | struct sctp_stream_change_event sn_strchange_event; |
michael@0 | 560 | }; |
michael@0 | 561 | |
michael@0 | 562 | /* notification types */ |
michael@0 | 563 | #define SCTP_ASSOC_CHANGE 0x0001 |
michael@0 | 564 | #define SCTP_PEER_ADDR_CHANGE 0x0002 |
michael@0 | 565 | #define SCTP_REMOTE_ERROR 0x0003 |
michael@0 | 566 | #define SCTP_SEND_FAILED 0x0004 |
michael@0 | 567 | #define SCTP_SHUTDOWN_EVENT 0x0005 |
michael@0 | 568 | #define SCTP_ADAPTATION_INDICATION 0x0006 |
michael@0 | 569 | /* same as above */ |
michael@0 | 570 | #define SCTP_ADAPTION_INDICATION 0x0006 |
michael@0 | 571 | #define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 |
michael@0 | 572 | #define SCTP_AUTHENTICATION_EVENT 0x0008 |
michael@0 | 573 | #define SCTP_STREAM_RESET_EVENT 0x0009 |
michael@0 | 574 | #define SCTP_SENDER_DRY_EVENT 0x000a |
michael@0 | 575 | #define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b /* we don't send this*/ |
michael@0 | 576 | #define SCTP_ASSOC_RESET_EVENT 0x000c |
michael@0 | 577 | #define SCTP_STREAM_CHANGE_EVENT 0x000d |
michael@0 | 578 | #define SCTP_SEND_FAILED_EVENT 0x000e |
michael@0 | 579 | /* |
michael@0 | 580 | * socket option structs |
michael@0 | 581 | */ |
michael@0 | 582 | |
michael@0 | 583 | struct sctp_paddrparams { |
michael@0 | 584 | struct sockaddr_storage spp_address; |
michael@0 | 585 | sctp_assoc_t spp_assoc_id; |
michael@0 | 586 | uint32_t spp_hbinterval; |
michael@0 | 587 | uint32_t spp_pathmtu; |
michael@0 | 588 | uint32_t spp_flags; |
michael@0 | 589 | uint32_t spp_ipv6_flowlabel; |
michael@0 | 590 | uint16_t spp_pathmaxrxt; |
michael@0 | 591 | uint8_t spp_dscp; |
michael@0 | 592 | }; |
michael@0 | 593 | #define spp_ipv4_tos spp_dscp |
michael@0 | 594 | |
michael@0 | 595 | #define SPP_HB_ENABLE 0x00000001 |
michael@0 | 596 | #define SPP_HB_DISABLE 0x00000002 |
michael@0 | 597 | #define SPP_HB_DEMAND 0x00000004 |
michael@0 | 598 | #define SPP_PMTUD_ENABLE 0x00000008 |
michael@0 | 599 | #define SPP_PMTUD_DISABLE 0x00000010 |
michael@0 | 600 | #define SPP_HB_TIME_IS_ZERO 0x00000080 |
michael@0 | 601 | #define SPP_IPV6_FLOWLABEL 0x00000100 |
michael@0 | 602 | #define SPP_DSCP 0x00000200 |
michael@0 | 603 | #define SPP_IPV4_TOS SPP_DSCP |
michael@0 | 604 | |
michael@0 | 605 | struct sctp_paddrthlds { |
michael@0 | 606 | struct sockaddr_storage spt_address; |
michael@0 | 607 | sctp_assoc_t spt_assoc_id; |
michael@0 | 608 | uint16_t spt_pathmaxrxt; |
michael@0 | 609 | uint16_t spt_pathpfthld; |
michael@0 | 610 | }; |
michael@0 | 611 | |
michael@0 | 612 | struct sctp_paddrinfo { |
michael@0 | 613 | struct sockaddr_storage spinfo_address; |
michael@0 | 614 | sctp_assoc_t spinfo_assoc_id; |
michael@0 | 615 | int32_t spinfo_state; |
michael@0 | 616 | uint32_t spinfo_cwnd; |
michael@0 | 617 | uint32_t spinfo_srtt; |
michael@0 | 618 | uint32_t spinfo_rto; |
michael@0 | 619 | uint32_t spinfo_mtu; |
michael@0 | 620 | }; |
michael@0 | 621 | |
michael@0 | 622 | struct sctp_rtoinfo { |
michael@0 | 623 | sctp_assoc_t srto_assoc_id; |
michael@0 | 624 | uint32_t srto_initial; |
michael@0 | 625 | uint32_t srto_max; |
michael@0 | 626 | uint32_t srto_min; |
michael@0 | 627 | }; |
michael@0 | 628 | |
michael@0 | 629 | struct sctp_assocparams { |
michael@0 | 630 | sctp_assoc_t sasoc_assoc_id; |
michael@0 | 631 | uint32_t sasoc_peer_rwnd; |
michael@0 | 632 | uint32_t sasoc_local_rwnd; |
michael@0 | 633 | uint32_t sasoc_cookie_life; |
michael@0 | 634 | uint16_t sasoc_asocmaxrxt; |
michael@0 | 635 | uint16_t sasoc_number_peer_destinations; |
michael@0 | 636 | }; |
michael@0 | 637 | |
michael@0 | 638 | struct sctp_setprim { |
michael@0 | 639 | struct sockaddr_storage ssp_addr; |
michael@0 | 640 | sctp_assoc_t ssp_assoc_id; |
michael@0 | 641 | uint8_t ssp_padding[4]; |
michael@0 | 642 | }; |
michael@0 | 643 | |
michael@0 | 644 | struct sctp_setpeerprim { |
michael@0 | 645 | struct sockaddr_storage sspp_addr; |
michael@0 | 646 | sctp_assoc_t sspp_assoc_id; |
michael@0 | 647 | uint8_t sspp_padding[4]; |
michael@0 | 648 | }; |
michael@0 | 649 | |
michael@0 | 650 | struct sctp_getaddresses { |
michael@0 | 651 | sctp_assoc_t sget_assoc_id; |
michael@0 | 652 | /* addr is filled in for N * sockaddr_storage */ |
michael@0 | 653 | struct sockaddr addr[1]; |
michael@0 | 654 | }; |
michael@0 | 655 | |
michael@0 | 656 | struct sctp_status { |
michael@0 | 657 | sctp_assoc_t sstat_assoc_id; |
michael@0 | 658 | int32_t sstat_state; |
michael@0 | 659 | uint32_t sstat_rwnd; |
michael@0 | 660 | uint16_t sstat_unackdata; |
michael@0 | 661 | uint16_t sstat_penddata; |
michael@0 | 662 | uint16_t sstat_instrms; |
michael@0 | 663 | uint16_t sstat_outstrms; |
michael@0 | 664 | uint32_t sstat_fragmentation_point; |
michael@0 | 665 | struct sctp_paddrinfo sstat_primary; |
michael@0 | 666 | }; |
michael@0 | 667 | |
michael@0 | 668 | /* |
michael@0 | 669 | * AUTHENTICATION support |
michael@0 | 670 | */ |
michael@0 | 671 | /* SCTP_AUTH_CHUNK */ |
michael@0 | 672 | struct sctp_authchunk { |
michael@0 | 673 | uint8_t sauth_chunk; |
michael@0 | 674 | }; |
michael@0 | 675 | |
michael@0 | 676 | /* SCTP_AUTH_KEY */ |
michael@0 | 677 | struct sctp_authkey { |
michael@0 | 678 | sctp_assoc_t sca_assoc_id; |
michael@0 | 679 | uint16_t sca_keynumber; |
michael@0 | 680 | uint16_t sca_keylength; |
michael@0 | 681 | uint8_t sca_key[]; |
michael@0 | 682 | }; |
michael@0 | 683 | |
michael@0 | 684 | /* SCTP_HMAC_IDENT */ |
michael@0 | 685 | struct sctp_hmacalgo { |
michael@0 | 686 | uint32_t shmac_number_of_idents; |
michael@0 | 687 | uint16_t shmac_idents[]; |
michael@0 | 688 | }; |
michael@0 | 689 | |
michael@0 | 690 | /* AUTH hmac_id */ |
michael@0 | 691 | #define SCTP_AUTH_HMAC_ID_RSVD 0x0000 |
michael@0 | 692 | #define SCTP_AUTH_HMAC_ID_SHA1 0x0001 /* default, mandatory */ |
michael@0 | 693 | #define SCTP_AUTH_HMAC_ID_SHA256 0x0003 |
michael@0 | 694 | |
michael@0 | 695 | /* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */ |
michael@0 | 696 | struct sctp_authkeyid { |
michael@0 | 697 | sctp_assoc_t scact_assoc_id; |
michael@0 | 698 | uint16_t scact_keynumber; |
michael@0 | 699 | }; |
michael@0 | 700 | |
michael@0 | 701 | /* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */ |
michael@0 | 702 | struct sctp_authchunks { |
michael@0 | 703 | sctp_assoc_t gauth_assoc_id; |
michael@0 | 704 | uint32_t gauth_number_of_chunks; |
michael@0 | 705 | uint8_t gauth_chunks[]; |
michael@0 | 706 | }; |
michael@0 | 707 | |
michael@0 | 708 | struct sctp_assoc_value { |
michael@0 | 709 | sctp_assoc_t assoc_id; |
michael@0 | 710 | uint32_t assoc_value; |
michael@0 | 711 | }; |
michael@0 | 712 | |
michael@0 | 713 | struct sctp_cc_option { |
michael@0 | 714 | int option; |
michael@0 | 715 | struct sctp_assoc_value aid_value; |
michael@0 | 716 | }; |
michael@0 | 717 | |
michael@0 | 718 | struct sctp_stream_value { |
michael@0 | 719 | sctp_assoc_t assoc_id; |
michael@0 | 720 | uint16_t stream_id; |
michael@0 | 721 | uint16_t stream_value; |
michael@0 | 722 | }; |
michael@0 | 723 | |
michael@0 | 724 | struct sctp_assoc_ids { |
michael@0 | 725 | uint32_t gaids_number_of_ids; |
michael@0 | 726 | sctp_assoc_t gaids_assoc_id[]; |
michael@0 | 727 | }; |
michael@0 | 728 | |
michael@0 | 729 | struct sctp_sack_info { |
michael@0 | 730 | sctp_assoc_t sack_assoc_id; |
michael@0 | 731 | uint32_t sack_delay; |
michael@0 | 732 | uint32_t sack_freq; |
michael@0 | 733 | }; |
michael@0 | 734 | |
michael@0 | 735 | struct sctp_timeouts { |
michael@0 | 736 | sctp_assoc_t stimo_assoc_id; |
michael@0 | 737 | uint32_t stimo_init; |
michael@0 | 738 | uint32_t stimo_data; |
michael@0 | 739 | uint32_t stimo_sack; |
michael@0 | 740 | uint32_t stimo_shutdown; |
michael@0 | 741 | uint32_t stimo_heartbeat; |
michael@0 | 742 | uint32_t stimo_cookie; |
michael@0 | 743 | uint32_t stimo_shutdownack; |
michael@0 | 744 | }; |
michael@0 | 745 | |
michael@0 | 746 | struct sctp_udpencaps { |
michael@0 | 747 | struct sockaddr_storage sue_address; |
michael@0 | 748 | sctp_assoc_t sue_assoc_id; |
michael@0 | 749 | uint16_t sue_port; |
michael@0 | 750 | }; |
michael@0 | 751 | |
michael@0 | 752 | struct sctp_cwnd_args { |
michael@0 | 753 | struct sctp_nets *net; /* network to */ /* FIXME: LP64 issue */ |
michael@0 | 754 | uint32_t cwnd_new_value;/* cwnd in k */ |
michael@0 | 755 | uint32_t pseudo_cumack; |
michael@0 | 756 | uint16_t inflight; /* flightsize in k */ |
michael@0 | 757 | uint16_t cwnd_augment; /* increment to it */ |
michael@0 | 758 | uint8_t meets_pseudo_cumack; |
michael@0 | 759 | uint8_t need_new_pseudo_cumack; |
michael@0 | 760 | uint8_t cnt_in_send; |
michael@0 | 761 | uint8_t cnt_in_str; |
michael@0 | 762 | }; |
michael@0 | 763 | |
michael@0 | 764 | struct sctp_blk_args { |
michael@0 | 765 | uint32_t onsb; /* in 1k bytes */ |
michael@0 | 766 | uint32_t sndlen; /* len of send being attempted */ |
michael@0 | 767 | uint32_t peer_rwnd; /* rwnd of peer */ |
michael@0 | 768 | uint16_t send_sent_qcnt;/* chnk cnt */ |
michael@0 | 769 | uint16_t stream_qcnt; /* chnk cnt */ |
michael@0 | 770 | uint16_t chunks_on_oque;/* chunks out */ |
michael@0 | 771 | uint16_t flight_size; /* flight size in k */ |
michael@0 | 772 | }; |
michael@0 | 773 | |
michael@0 | 774 | /* |
michael@0 | 775 | * Max we can reset in one setting, note this is dictated not by the define |
michael@0 | 776 | * but the size of a mbuf cluster so don't change this define and think you |
michael@0 | 777 | * can specify more. You must do multiple resets if you want to reset more |
michael@0 | 778 | * than SCTP_MAX_EXPLICIT_STR_RESET. |
michael@0 | 779 | */ |
michael@0 | 780 | #define SCTP_MAX_EXPLICT_STR_RESET 1000 |
michael@0 | 781 | |
michael@0 | 782 | struct sctp_reset_streams { |
michael@0 | 783 | sctp_assoc_t srs_assoc_id; |
michael@0 | 784 | uint16_t srs_flags; |
michael@0 | 785 | uint16_t srs_number_streams; /* 0 == ALL */ |
michael@0 | 786 | uint16_t srs_stream_list[];/* list if strrst_num_streams is not 0 */ |
michael@0 | 787 | }; |
michael@0 | 788 | |
michael@0 | 789 | struct sctp_add_streams { |
michael@0 | 790 | sctp_assoc_t sas_assoc_id; |
michael@0 | 791 | uint16_t sas_instrms; |
michael@0 | 792 | uint16_t sas_outstrms; |
michael@0 | 793 | }; |
michael@0 | 794 | |
michael@0 | 795 | struct sctp_get_nonce_values { |
michael@0 | 796 | sctp_assoc_t gn_assoc_id; |
michael@0 | 797 | uint32_t gn_peers_tag; |
michael@0 | 798 | uint32_t gn_local_tag; |
michael@0 | 799 | }; |
michael@0 | 800 | |
michael@0 | 801 | /* Debugging logs */ |
michael@0 | 802 | struct sctp_str_log { |
michael@0 | 803 | void *stcb; /* FIXME: LP64 issue */ |
michael@0 | 804 | uint32_t n_tsn; |
michael@0 | 805 | uint32_t e_tsn; |
michael@0 | 806 | uint16_t n_sseq; |
michael@0 | 807 | uint16_t e_sseq; |
michael@0 | 808 | uint16_t strm; |
michael@0 | 809 | }; |
michael@0 | 810 | |
michael@0 | 811 | struct sctp_sb_log { |
michael@0 | 812 | void *stcb; /* FIXME: LP64 issue */ |
michael@0 | 813 | uint32_t so_sbcc; |
michael@0 | 814 | uint32_t stcb_sbcc; |
michael@0 | 815 | uint32_t incr; |
michael@0 | 816 | }; |
michael@0 | 817 | |
michael@0 | 818 | struct sctp_fr_log { |
michael@0 | 819 | uint32_t largest_tsn; |
michael@0 | 820 | uint32_t largest_new_tsn; |
michael@0 | 821 | uint32_t tsn; |
michael@0 | 822 | }; |
michael@0 | 823 | |
michael@0 | 824 | struct sctp_fr_map { |
michael@0 | 825 | uint32_t base; |
michael@0 | 826 | uint32_t cum; |
michael@0 | 827 | uint32_t high; |
michael@0 | 828 | }; |
michael@0 | 829 | |
michael@0 | 830 | struct sctp_rwnd_log { |
michael@0 | 831 | uint32_t rwnd; |
michael@0 | 832 | uint32_t send_size; |
michael@0 | 833 | uint32_t overhead; |
michael@0 | 834 | uint32_t new_rwnd; |
michael@0 | 835 | }; |
michael@0 | 836 | |
michael@0 | 837 | struct sctp_mbcnt_log { |
michael@0 | 838 | uint32_t total_queue_size; |
michael@0 | 839 | uint32_t size_change; |
michael@0 | 840 | uint32_t total_queue_mb_size; |
michael@0 | 841 | uint32_t mbcnt_change; |
michael@0 | 842 | }; |
michael@0 | 843 | |
michael@0 | 844 | struct sctp_sack_log { |
michael@0 | 845 | uint32_t cumack; |
michael@0 | 846 | uint32_t oldcumack; |
michael@0 | 847 | uint32_t tsn; |
michael@0 | 848 | uint16_t numGaps; |
michael@0 | 849 | uint16_t numDups; |
michael@0 | 850 | }; |
michael@0 | 851 | |
michael@0 | 852 | struct sctp_lock_log { |
michael@0 | 853 | void *sock; /* FIXME: LP64 issue */ |
michael@0 | 854 | void *inp; /* FIXME: LP64 issue */ |
michael@0 | 855 | uint8_t tcb_lock; |
michael@0 | 856 | uint8_t inp_lock; |
michael@0 | 857 | uint8_t info_lock; |
michael@0 | 858 | uint8_t sock_lock; |
michael@0 | 859 | uint8_t sockrcvbuf_lock; |
michael@0 | 860 | uint8_t socksndbuf_lock; |
michael@0 | 861 | uint8_t create_lock; |
michael@0 | 862 | uint8_t resv; |
michael@0 | 863 | }; |
michael@0 | 864 | |
michael@0 | 865 | struct sctp_rto_log { |
michael@0 | 866 | void * net; /* FIXME: LP64 issue */ |
michael@0 | 867 | uint32_t rtt; |
michael@0 | 868 | }; |
michael@0 | 869 | |
michael@0 | 870 | struct sctp_nagle_log { |
michael@0 | 871 | void *stcb; /* FIXME: LP64 issue */ |
michael@0 | 872 | uint32_t total_flight; |
michael@0 | 873 | uint32_t total_in_queue; |
michael@0 | 874 | uint16_t count_in_queue; |
michael@0 | 875 | uint16_t count_in_flight; |
michael@0 | 876 | }; |
michael@0 | 877 | |
michael@0 | 878 | struct sctp_sbwake_log { |
michael@0 | 879 | void *stcb; /* FIXME: LP64 issue */ |
michael@0 | 880 | uint16_t send_q; |
michael@0 | 881 | uint16_t sent_q; |
michael@0 | 882 | uint16_t flight; |
michael@0 | 883 | uint16_t wake_cnt; |
michael@0 | 884 | uint8_t stream_qcnt; /* chnk cnt */ |
michael@0 | 885 | uint8_t chunks_on_oque;/* chunks out */ |
michael@0 | 886 | uint8_t sbflags; |
michael@0 | 887 | uint8_t sctpflags; |
michael@0 | 888 | }; |
michael@0 | 889 | |
michael@0 | 890 | struct sctp_misc_info { |
michael@0 | 891 | uint32_t log1; |
michael@0 | 892 | uint32_t log2; |
michael@0 | 893 | uint32_t log3; |
michael@0 | 894 | uint32_t log4; |
michael@0 | 895 | }; |
michael@0 | 896 | |
michael@0 | 897 | struct sctp_log_closing { |
michael@0 | 898 | void *inp; /* FIXME: LP64 issue */ |
michael@0 | 899 | void *stcb; /* FIXME: LP64 issue */ |
michael@0 | 900 | uint32_t sctp_flags; |
michael@0 | 901 | uint16_t state; |
michael@0 | 902 | int16_t loc; |
michael@0 | 903 | }; |
michael@0 | 904 | |
michael@0 | 905 | struct sctp_mbuf_log { |
michael@0 | 906 | struct mbuf *mp; /* FIXME: LP64 issue */ |
michael@0 | 907 | caddr_t ext; |
michael@0 | 908 | caddr_t data; |
michael@0 | 909 | uint16_t size; |
michael@0 | 910 | uint8_t refcnt; |
michael@0 | 911 | uint8_t mbuf_flags; |
michael@0 | 912 | }; |
michael@0 | 913 | |
michael@0 | 914 | struct sctp_cwnd_log { |
michael@0 | 915 | uint64_t time_event; |
michael@0 | 916 | uint8_t from; |
michael@0 | 917 | uint8_t event_type; |
michael@0 | 918 | uint8_t resv[2]; |
michael@0 | 919 | union { |
michael@0 | 920 | struct sctp_log_closing close; |
michael@0 | 921 | struct sctp_blk_args blk; |
michael@0 | 922 | struct sctp_cwnd_args cwnd; |
michael@0 | 923 | struct sctp_str_log strlog; |
michael@0 | 924 | struct sctp_fr_log fr; |
michael@0 | 925 | struct sctp_fr_map map; |
michael@0 | 926 | struct sctp_rwnd_log rwnd; |
michael@0 | 927 | struct sctp_mbcnt_log mbcnt; |
michael@0 | 928 | struct sctp_sack_log sack; |
michael@0 | 929 | struct sctp_lock_log lock; |
michael@0 | 930 | struct sctp_rto_log rto; |
michael@0 | 931 | struct sctp_sb_log sb; |
michael@0 | 932 | struct sctp_nagle_log nagle; |
michael@0 | 933 | struct sctp_sbwake_log wake; |
michael@0 | 934 | struct sctp_mbuf_log mb; |
michael@0 | 935 | struct sctp_misc_info misc; |
michael@0 | 936 | } x; |
michael@0 | 937 | }; |
michael@0 | 938 | |
michael@0 | 939 | struct sctp_cwnd_log_req { |
michael@0 | 940 | int32_t num_in_log; /* Number in log */ |
michael@0 | 941 | int32_t num_ret; /* Number returned */ |
michael@0 | 942 | int32_t start_at; /* start at this one */ |
michael@0 | 943 | int32_t end_at; /* end at this one */ |
michael@0 | 944 | struct sctp_cwnd_log log[]; |
michael@0 | 945 | }; |
michael@0 | 946 | |
michael@0 | 947 | struct sctp_timeval { |
michael@0 | 948 | uint32_t tv_sec; |
michael@0 | 949 | uint32_t tv_usec; |
michael@0 | 950 | }; |
michael@0 | 951 | |
michael@0 | 952 | struct sctpstat { |
michael@0 | 953 | struct sctp_timeval sctps_discontinuitytime; /* sctpStats 18 (TimeStamp) */ |
michael@0 | 954 | /* MIB according to RFC 3873 */ |
michael@0 | 955 | uint32_t sctps_currestab; /* sctpStats 1 (Gauge32) */ |
michael@0 | 956 | uint32_t sctps_activeestab; /* sctpStats 2 (Counter32) */ |
michael@0 | 957 | uint32_t sctps_restartestab; |
michael@0 | 958 | uint32_t sctps_collisionestab; |
michael@0 | 959 | uint32_t sctps_passiveestab; /* sctpStats 3 (Counter32) */ |
michael@0 | 960 | uint32_t sctps_aborted; /* sctpStats 4 (Counter32) */ |
michael@0 | 961 | uint32_t sctps_shutdown; /* sctpStats 5 (Counter32) */ |
michael@0 | 962 | uint32_t sctps_outoftheblue; /* sctpStats 6 (Counter32) */ |
michael@0 | 963 | uint32_t sctps_checksumerrors; /* sctpStats 7 (Counter32) */ |
michael@0 | 964 | uint32_t sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */ |
michael@0 | 965 | uint32_t sctps_outorderchunks; /* sctpStats 9 (Counter64) */ |
michael@0 | 966 | uint32_t sctps_outunorderchunks; /* sctpStats 10 (Counter64) */ |
michael@0 | 967 | uint32_t sctps_incontrolchunks; /* sctpStats 11 (Counter64) */ |
michael@0 | 968 | uint32_t sctps_inorderchunks; /* sctpStats 12 (Counter64) */ |
michael@0 | 969 | uint32_t sctps_inunorderchunks; /* sctpStats 13 (Counter64) */ |
michael@0 | 970 | uint32_t sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */ |
michael@0 | 971 | uint32_t sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */ |
michael@0 | 972 | uint32_t sctps_outpackets; /* sctpStats 16 (Counter64) */ |
michael@0 | 973 | uint32_t sctps_inpackets; /* sctpStats 17 (Counter64) */ |
michael@0 | 974 | |
michael@0 | 975 | /* input statistics: */ |
michael@0 | 976 | uint32_t sctps_recvpackets; /* total input packets */ |
michael@0 | 977 | uint32_t sctps_recvdatagrams; /* total input datagrams */ |
michael@0 | 978 | uint32_t sctps_recvpktwithdata; /* total packets that had data */ |
michael@0 | 979 | uint32_t sctps_recvsacks; /* total input SACK chunks */ |
michael@0 | 980 | uint32_t sctps_recvdata; /* total input DATA chunks */ |
michael@0 | 981 | uint32_t sctps_recvdupdata; /* total input duplicate DATA chunks */ |
michael@0 | 982 | uint32_t sctps_recvheartbeat; /* total input HB chunks */ |
michael@0 | 983 | uint32_t sctps_recvheartbeatack; /* total input HB-ACK chunks */ |
michael@0 | 984 | uint32_t sctps_recvecne; /* total input ECNE chunks */ |
michael@0 | 985 | uint32_t sctps_recvauth; /* total input AUTH chunks */ |
michael@0 | 986 | uint32_t sctps_recvauthmissing; /* total input chunks missing AUTH */ |
michael@0 | 987 | uint32_t sctps_recvivalhmacid; /* total number of invalid HMAC ids received */ |
michael@0 | 988 | uint32_t sctps_recvivalkeyid; /* total number of invalid secret ids received */ |
michael@0 | 989 | uint32_t sctps_recvauthfailed; /* total number of auth failed */ |
michael@0 | 990 | uint32_t sctps_recvexpress; /* total fast path receives all one chunk */ |
michael@0 | 991 | uint32_t sctps_recvexpressm; /* total fast path multi-part data */ |
michael@0 | 992 | uint32_t sctps_recvnocrc; |
michael@0 | 993 | uint32_t sctps_recvswcrc; |
michael@0 | 994 | uint32_t sctps_recvhwcrc; |
michael@0 | 995 | |
michael@0 | 996 | /* output statistics: */ |
michael@0 | 997 | uint32_t sctps_sendpackets; /* total output packets */ |
michael@0 | 998 | uint32_t sctps_sendsacks; /* total output SACKs */ |
michael@0 | 999 | uint32_t sctps_senddata; /* total output DATA chunks */ |
michael@0 | 1000 | uint32_t sctps_sendretransdata; /* total output retransmitted DATA chunks */ |
michael@0 | 1001 | uint32_t sctps_sendfastretrans; /* total output fast retransmitted DATA chunks */ |
michael@0 | 1002 | uint32_t sctps_sendmultfastretrans; /* total FR's that happened more than once |
michael@0 | 1003 | * to same chunk (u-del multi-fr algo). |
michael@0 | 1004 | */ |
michael@0 | 1005 | uint32_t sctps_sendheartbeat; /* total output HB chunks */ |
michael@0 | 1006 | uint32_t sctps_sendecne; /* total output ECNE chunks */ |
michael@0 | 1007 | uint32_t sctps_sendauth; /* total output AUTH chunks FIXME */ |
michael@0 | 1008 | uint32_t sctps_senderrors; /* ip_output error counter */ |
michael@0 | 1009 | uint32_t sctps_sendnocrc; |
michael@0 | 1010 | uint32_t sctps_sendswcrc; |
michael@0 | 1011 | uint32_t sctps_sendhwcrc; |
michael@0 | 1012 | /* PCKDROPREP statistics: */ |
michael@0 | 1013 | uint32_t sctps_pdrpfmbox; /* Packet drop from middle box */ |
michael@0 | 1014 | uint32_t sctps_pdrpfehos; /* P-drop from end host */ |
michael@0 | 1015 | uint32_t sctps_pdrpmbda; /* P-drops with data */ |
michael@0 | 1016 | uint32_t sctps_pdrpmbct; /* P-drops, non-data, non-endhost */ |
michael@0 | 1017 | uint32_t sctps_pdrpbwrpt; /* P-drop, non-endhost, bandwidth rep only */ |
michael@0 | 1018 | uint32_t sctps_pdrpcrupt; /* P-drop, not enough for chunk header */ |
michael@0 | 1019 | uint32_t sctps_pdrpnedat; /* P-drop, not enough data to confirm */ |
michael@0 | 1020 | uint32_t sctps_pdrppdbrk; /* P-drop, where process_chunk_drop said break */ |
michael@0 | 1021 | uint32_t sctps_pdrptsnnf; /* P-drop, could not find TSN */ |
michael@0 | 1022 | uint32_t sctps_pdrpdnfnd; /* P-drop, attempt reverse TSN lookup */ |
michael@0 | 1023 | uint32_t sctps_pdrpdiwnp; /* P-drop, e-host confirms zero-rwnd */ |
michael@0 | 1024 | uint32_t sctps_pdrpdizrw; /* P-drop, midbox confirms no space */ |
michael@0 | 1025 | uint32_t sctps_pdrpbadd; /* P-drop, data did not match TSN */ |
michael@0 | 1026 | uint32_t sctps_pdrpmark; /* P-drop, TSN's marked for Fast Retran */ |
michael@0 | 1027 | /* timeouts */ |
michael@0 | 1028 | uint32_t sctps_timoiterator; /* Number of iterator timers that fired */ |
michael@0 | 1029 | uint32_t sctps_timodata; /* Number of T3 data time outs */ |
michael@0 | 1030 | uint32_t sctps_timowindowprobe; /* Number of window probe (T3) timers that fired */ |
michael@0 | 1031 | uint32_t sctps_timoinit; /* Number of INIT timers that fired */ |
michael@0 | 1032 | uint32_t sctps_timosack; /* Number of sack timers that fired */ |
michael@0 | 1033 | uint32_t sctps_timoshutdown; /* Number of shutdown timers that fired */ |
michael@0 | 1034 | uint32_t sctps_timoheartbeat; /* Number of heartbeat timers that fired */ |
michael@0 | 1035 | uint32_t sctps_timocookie; /* Number of times a cookie timeout fired */ |
michael@0 | 1036 | uint32_t sctps_timosecret; /* Number of times an endpoint changed its cookie secret*/ |
michael@0 | 1037 | uint32_t sctps_timopathmtu; /* Number of PMTU timers that fired */ |
michael@0 | 1038 | uint32_t sctps_timoshutdownack; /* Number of shutdown ack timers that fired */ |
michael@0 | 1039 | uint32_t sctps_timoshutdownguard; /* Number of shutdown guard timers that fired */ |
michael@0 | 1040 | uint32_t sctps_timostrmrst; /* Number of stream reset timers that fired */ |
michael@0 | 1041 | uint32_t sctps_timoearlyfr; /* Number of early FR timers that fired */ |
michael@0 | 1042 | uint32_t sctps_timoasconf; /* Number of times an asconf timer fired */ |
michael@0 | 1043 | uint32_t sctps_timodelprim; /* Number of times a prim_deleted timer fired */ |
michael@0 | 1044 | uint32_t sctps_timoautoclose; /* Number of times auto close timer fired */ |
michael@0 | 1045 | uint32_t sctps_timoassockill; /* Number of asoc free timers expired */ |
michael@0 | 1046 | uint32_t sctps_timoinpkill; /* Number of inp free timers expired */ |
michael@0 | 1047 | /* former early FR counters */ |
michael@0 | 1048 | uint32_t sctps_spare[11]; |
michael@0 | 1049 | /* others */ |
michael@0 | 1050 | uint32_t sctps_hdrops; /* packet shorter than header */ |
michael@0 | 1051 | uint32_t sctps_badsum; /* checksum error */ |
michael@0 | 1052 | uint32_t sctps_noport; /* no endpoint for port */ |
michael@0 | 1053 | uint32_t sctps_badvtag; /* bad v-tag */ |
michael@0 | 1054 | uint32_t sctps_badsid; /* bad SID */ |
michael@0 | 1055 | uint32_t sctps_nomem; /* no memory */ |
michael@0 | 1056 | uint32_t sctps_fastretransinrtt; /* number of multiple FR in a RTT window */ |
michael@0 | 1057 | uint32_t sctps_markedretrans; |
michael@0 | 1058 | uint32_t sctps_naglesent; /* nagle allowed sending */ |
michael@0 | 1059 | uint32_t sctps_naglequeued; /* nagle doesn't allow sending */ |
michael@0 | 1060 | uint32_t sctps_maxburstqueued; /* max burst doesn't allow sending */ |
michael@0 | 1061 | uint32_t sctps_ifnomemqueued; /* look ahead tells us no memory in |
michael@0 | 1062 | * interface ring buffer OR we had a |
michael@0 | 1063 | * send error and are queuing one send. |
michael@0 | 1064 | */ |
michael@0 | 1065 | uint32_t sctps_windowprobed; /* total number of window probes sent */ |
michael@0 | 1066 | uint32_t sctps_lowlevelerr; /* total times an output error causes us |
michael@0 | 1067 | * to clamp down on next user send. |
michael@0 | 1068 | */ |
michael@0 | 1069 | uint32_t sctps_lowlevelerrusr; /* total times sctp_senderrors were caused from |
michael@0 | 1070 | * a user send from a user invoked send not |
michael@0 | 1071 | * a sack response |
michael@0 | 1072 | */ |
michael@0 | 1073 | uint32_t sctps_datadropchklmt; /* Number of in data drops due to chunk limit reached */ |
michael@0 | 1074 | uint32_t sctps_datadroprwnd; /* Number of in data drops due to rwnd limit reached */ |
michael@0 | 1075 | uint32_t sctps_ecnereducedcwnd; /* Number of times a ECN reduced the cwnd */ |
michael@0 | 1076 | uint32_t sctps_vtagexpress; /* Used express lookup via vtag */ |
michael@0 | 1077 | uint32_t sctps_vtagbogus; /* Collision in express lookup. */ |
michael@0 | 1078 | uint32_t sctps_primary_randry; /* Number of times the sender ran dry of user data on primary */ |
michael@0 | 1079 | uint32_t sctps_cmt_randry; /* Same for above */ |
michael@0 | 1080 | uint32_t sctps_slowpath_sack; /* Sacks the slow way */ |
michael@0 | 1081 | uint32_t sctps_wu_sacks_sent; /* Window Update only sacks sent */ |
michael@0 | 1082 | uint32_t sctps_sends_with_flags; /* number of sends with sinfo_flags !=0 */ |
michael@0 | 1083 | uint32_t sctps_sends_with_unord; /* number of unordered sends */ |
michael@0 | 1084 | uint32_t sctps_sends_with_eof; /* number of sends with EOF flag set */ |
michael@0 | 1085 | uint32_t sctps_sends_with_abort; /* number of sends with ABORT flag set */ |
michael@0 | 1086 | uint32_t sctps_protocol_drain_calls; /* number of times protocol drain called */ |
michael@0 | 1087 | uint32_t sctps_protocol_drains_done; /* number of times we did a protocol drain */ |
michael@0 | 1088 | uint32_t sctps_read_peeks; /* Number of times recv was called with peek */ |
michael@0 | 1089 | uint32_t sctps_cached_chk; /* Number of cached chunks used */ |
michael@0 | 1090 | uint32_t sctps_cached_strmoq; /* Number of cached stream oq's used */ |
michael@0 | 1091 | uint32_t sctps_left_abandon; /* Number of unread messages abandoned by close */ |
michael@0 | 1092 | uint32_t sctps_send_burst_avoid; /* Unused */ |
michael@0 | 1093 | uint32_t sctps_send_cwnd_avoid; /* Send cwnd full avoidance, already max burst inflight to net */ |
michael@0 | 1094 | uint32_t sctps_fwdtsn_map_over; /* number of map array over-runs via fwd-tsn's */ |
michael@0 | 1095 | uint32_t sctps_queue_upd_ecne; /* Number of times we queued or updated an ECN chunk on send queue */ |
michael@0 | 1096 | uint32_t sctps_reserved[31]; /* Future ABI compat - remove int's from here when adding new */ |
michael@0 | 1097 | }; |
michael@0 | 1098 | |
michael@0 | 1099 | #define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1) |
michael@0 | 1100 | #define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1) |
michael@0 | 1101 | #if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) |
michael@0 | 1102 | #define SCTP_STAT_INCR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x += _d) |
michael@0 | 1103 | #define SCTP_STAT_DECR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x -= _d) |
michael@0 | 1104 | #else |
michael@0 | 1105 | #define SCTP_STAT_INCR_BY(_x,_d) atomic_add_int(&SCTP_BASE_STAT(_x), _d) |
michael@0 | 1106 | #define SCTP_STAT_DECR_BY(_x,_d) atomic_subtract_int(&SCTP_BASE_STAT(_x), _d) |
michael@0 | 1107 | #endif |
michael@0 | 1108 | /* The following macros are for handling MIB values, */ |
michael@0 | 1109 | #define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x) |
michael@0 | 1110 | #define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x) |
michael@0 | 1111 | #define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x) |
michael@0 | 1112 | #define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x) |
michael@0 | 1113 | #define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x) |
michael@0 | 1114 | #define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x) |
michael@0 | 1115 | |
michael@0 | 1116 | #if defined(__Userspace__) |
michael@0 | 1117 | union sctp_sockstore { |
michael@0 | 1118 | #if defined(INET) |
michael@0 | 1119 | struct sockaddr_in sin; |
michael@0 | 1120 | #endif |
michael@0 | 1121 | #if defined(INET6) |
michael@0 | 1122 | struct sockaddr_in6 sin6; |
michael@0 | 1123 | #endif |
michael@0 | 1124 | struct sockaddr_conn sconn; |
michael@0 | 1125 | struct sockaddr sa; |
michael@0 | 1126 | }; |
michael@0 | 1127 | #else |
michael@0 | 1128 | union sctp_sockstore { |
michael@0 | 1129 | struct sockaddr_in sin; |
michael@0 | 1130 | struct sockaddr_in6 sin6; |
michael@0 | 1131 | struct sockaddr sa; |
michael@0 | 1132 | }; |
michael@0 | 1133 | #endif |
michael@0 | 1134 | |
michael@0 | 1135 | |
michael@0 | 1136 | /***********************************/ |
michael@0 | 1137 | /* And something for us old timers */ |
michael@0 | 1138 | /***********************************/ |
michael@0 | 1139 | |
michael@0 | 1140 | #ifndef __APPLE__ |
michael@0 | 1141 | #ifndef __Userspace__ |
michael@0 | 1142 | #ifndef ntohll |
michael@0 | 1143 | #if defined(__Userspace_os_Linux) |
michael@0 | 1144 | #ifndef _BSD_SOURCE |
michael@0 | 1145 | #define _BSD_SOURCE |
michael@0 | 1146 | #endif |
michael@0 | 1147 | #include <endian.h> |
michael@0 | 1148 | #else |
michael@0 | 1149 | #include <sys/endian.h> |
michael@0 | 1150 | #endif |
michael@0 | 1151 | #define ntohll(x) be64toh(x) |
michael@0 | 1152 | #endif |
michael@0 | 1153 | |
michael@0 | 1154 | #ifndef htonll |
michael@0 | 1155 | #if defined(__Userspace_os_Linux) |
michael@0 | 1156 | #ifndef _BSD_SOURCE |
michael@0 | 1157 | #define _BSD_SOURCE |
michael@0 | 1158 | #endif |
michael@0 | 1159 | #include <endian.h> |
michael@0 | 1160 | #else |
michael@0 | 1161 | #include <sys/endian.h> |
michael@0 | 1162 | #endif |
michael@0 | 1163 | #define htonll(x) htobe64(x) |
michael@0 | 1164 | #endif |
michael@0 | 1165 | #endif |
michael@0 | 1166 | #endif |
michael@0 | 1167 | /***********************************/ |
michael@0 | 1168 | |
michael@0 | 1169 | |
michael@0 | 1170 | struct xsctp_inpcb { |
michael@0 | 1171 | uint32_t last; |
michael@0 | 1172 | uint32_t flags; |
michael@0 | 1173 | #if defined(__FreeBSD__) && __FreeBSD_version < 1000048 |
michael@0 | 1174 | uint32_t features; |
michael@0 | 1175 | #else |
michael@0 | 1176 | uint64_t features; |
michael@0 | 1177 | #endif |
michael@0 | 1178 | uint32_t total_sends; |
michael@0 | 1179 | uint32_t total_recvs; |
michael@0 | 1180 | uint32_t total_nospaces; |
michael@0 | 1181 | uint32_t fragmentation_point; |
michael@0 | 1182 | uint16_t local_port; |
michael@0 | 1183 | uint16_t qlen; |
michael@0 | 1184 | uint16_t maxqlen; |
michael@0 | 1185 | #if defined(__Windows__) |
michael@0 | 1186 | uint16_t padding; |
michael@0 | 1187 | #endif |
michael@0 | 1188 | #if defined(__FreeBSD__) && __FreeBSD_version < 1000048 |
michael@0 | 1189 | uint32_t extra_padding[32]; /* future */ |
michael@0 | 1190 | #else |
michael@0 | 1191 | uint32_t extra_padding[31]; /* future */ |
michael@0 | 1192 | #endif |
michael@0 | 1193 | }; |
michael@0 | 1194 | |
michael@0 | 1195 | struct xsctp_tcb { |
michael@0 | 1196 | union sctp_sockstore primary_addr; /* sctpAssocEntry 5/6 */ |
michael@0 | 1197 | uint32_t last; |
michael@0 | 1198 | uint32_t heartbeat_interval; /* sctpAssocEntry 7 */ |
michael@0 | 1199 | uint32_t state; /* sctpAssocEntry 8 */ |
michael@0 | 1200 | uint32_t in_streams; /* sctpAssocEntry 9 */ |
michael@0 | 1201 | uint32_t out_streams; /* sctpAssocEntry 10 */ |
michael@0 | 1202 | uint32_t max_nr_retrans; /* sctpAssocEntry 11 */ |
michael@0 | 1203 | uint32_t primary_process; /* sctpAssocEntry 12 */ |
michael@0 | 1204 | uint32_t T1_expireries; /* sctpAssocEntry 13 */ |
michael@0 | 1205 | uint32_t T2_expireries; /* sctpAssocEntry 14 */ |
michael@0 | 1206 | uint32_t retransmitted_tsns; /* sctpAssocEntry 15 */ |
michael@0 | 1207 | uint32_t total_sends; |
michael@0 | 1208 | uint32_t total_recvs; |
michael@0 | 1209 | uint32_t local_tag; |
michael@0 | 1210 | uint32_t remote_tag; |
michael@0 | 1211 | uint32_t initial_tsn; |
michael@0 | 1212 | uint32_t highest_tsn; |
michael@0 | 1213 | uint32_t cumulative_tsn; |
michael@0 | 1214 | uint32_t cumulative_tsn_ack; |
michael@0 | 1215 | uint32_t mtu; |
michael@0 | 1216 | uint32_t refcnt; |
michael@0 | 1217 | uint16_t local_port; /* sctpAssocEntry 3 */ |
michael@0 | 1218 | uint16_t remote_port; /* sctpAssocEntry 4 */ |
michael@0 | 1219 | struct sctp_timeval start_time; /* sctpAssocEntry 16 */ |
michael@0 | 1220 | struct sctp_timeval discontinuity_time; /* sctpAssocEntry 17 */ |
michael@0 | 1221 | #if defined(__FreeBSD__) |
michael@0 | 1222 | #if __FreeBSD_version >= 800000 |
michael@0 | 1223 | uint32_t peers_rwnd; |
michael@0 | 1224 | sctp_assoc_t assoc_id; /* sctpAssocEntry 1 */ |
michael@0 | 1225 | uint32_t extra_padding[32]; /* future */ |
michael@0 | 1226 | #else |
michael@0 | 1227 | #endif |
michael@0 | 1228 | #else |
michael@0 | 1229 | uint32_t peers_rwnd; |
michael@0 | 1230 | sctp_assoc_t assoc_id; /* sctpAssocEntry 1 */ |
michael@0 | 1231 | uint32_t extra_padding[32]; /* future */ |
michael@0 | 1232 | #endif |
michael@0 | 1233 | }; |
michael@0 | 1234 | |
michael@0 | 1235 | struct xsctp_laddr { |
michael@0 | 1236 | union sctp_sockstore address; /* sctpAssocLocalAddrEntry 1/2 */ |
michael@0 | 1237 | uint32_t last; |
michael@0 | 1238 | struct sctp_timeval start_time; /* sctpAssocLocalAddrEntry 3 */ |
michael@0 | 1239 | uint32_t extra_padding[32]; /* future */ |
michael@0 | 1240 | }; |
michael@0 | 1241 | |
michael@0 | 1242 | struct xsctp_raddr { |
michael@0 | 1243 | union sctp_sockstore address; /* sctpAssocLocalRemEntry 1/2 */ |
michael@0 | 1244 | uint32_t last; |
michael@0 | 1245 | uint32_t rto; /* sctpAssocLocalRemEntry 5 */ |
michael@0 | 1246 | uint32_t max_path_rtx; /* sctpAssocLocalRemEntry 6 */ |
michael@0 | 1247 | uint32_t rtx; /* sctpAssocLocalRemEntry 7 */ |
michael@0 | 1248 | uint32_t error_counter; /* */ |
michael@0 | 1249 | uint32_t cwnd; /* */ |
michael@0 | 1250 | uint32_t flight_size; /* */ |
michael@0 | 1251 | uint32_t mtu; /* */ |
michael@0 | 1252 | uint8_t active; /* sctpAssocLocalRemEntry 3 */ |
michael@0 | 1253 | uint8_t confirmed; /* */ |
michael@0 | 1254 | uint8_t heartbeat_enabled; /* sctpAssocLocalRemEntry 4 */ |
michael@0 | 1255 | uint8_t potentially_failed; |
michael@0 | 1256 | struct sctp_timeval start_time; /* sctpAssocLocalRemEntry 8 */ |
michael@0 | 1257 | #if defined(__FreeBSD__) |
michael@0 | 1258 | #if __FreeBSD_version >= 800000 |
michael@0 | 1259 | uint32_t rtt; |
michael@0 | 1260 | uint32_t heartbeat_interval; |
michael@0 | 1261 | uint32_t extra_padding[31]; /* future */ |
michael@0 | 1262 | #endif |
michael@0 | 1263 | #else |
michael@0 | 1264 | uint32_t rtt; |
michael@0 | 1265 | uint32_t heartbeat_interval; |
michael@0 | 1266 | uint32_t extra_padding[31]; /* future */ |
michael@0 | 1267 | #endif |
michael@0 | 1268 | }; |
michael@0 | 1269 | |
michael@0 | 1270 | #define SCTP_MAX_LOGGING_SIZE 30000 |
michael@0 | 1271 | #define SCTP_TRACE_PARAMS 6 /* This number MUST be even */ |
michael@0 | 1272 | |
michael@0 | 1273 | struct sctp_log_entry { |
michael@0 | 1274 | uint64_t timestamp; |
michael@0 | 1275 | uint32_t subsys; |
michael@0 | 1276 | uint32_t padding; |
michael@0 | 1277 | uint32_t params[SCTP_TRACE_PARAMS]; |
michael@0 | 1278 | }; |
michael@0 | 1279 | |
michael@0 | 1280 | struct sctp_log { |
michael@0 | 1281 | struct sctp_log_entry entry[SCTP_MAX_LOGGING_SIZE]; |
michael@0 | 1282 | uint32_t index; |
michael@0 | 1283 | uint32_t padding; |
michael@0 | 1284 | }; |
michael@0 | 1285 | |
michael@0 | 1286 | /* |
michael@0 | 1287 | * Kernel defined for sctp_send |
michael@0 | 1288 | */ |
michael@0 | 1289 | #if defined(_KERNEL) || defined(__Userspace__) |
michael@0 | 1290 | int |
michael@0 | 1291 | sctp_lower_sosend(struct socket *so, |
michael@0 | 1292 | struct sockaddr *addr, |
michael@0 | 1293 | struct uio *uio, |
michael@0 | 1294 | #if defined(__Panda__) |
michael@0 | 1295 | pakhandle_type i_pak, |
michael@0 | 1296 | pakhandle_type i_control, |
michael@0 | 1297 | #else |
michael@0 | 1298 | struct mbuf *i_pak, |
michael@0 | 1299 | struct mbuf *control, |
michael@0 | 1300 | #endif |
michael@0 | 1301 | int flags, |
michael@0 | 1302 | struct sctp_sndrcvinfo *srcv |
michael@0 | 1303 | #if !(defined(__Panda__) || defined(__Userspace__)) |
michael@0 | 1304 | #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 |
michael@0 | 1305 | ,struct thread *p |
michael@0 | 1306 | #elif defined(__Windows__) |
michael@0 | 1307 | , PKTHREAD p |
michael@0 | 1308 | #else |
michael@0 | 1309 | ,struct proc *p |
michael@0 | 1310 | #endif |
michael@0 | 1311 | #endif |
michael@0 | 1312 | ); |
michael@0 | 1313 | |
michael@0 | 1314 | int |
michael@0 | 1315 | sctp_sorecvmsg(struct socket *so, |
michael@0 | 1316 | struct uio *uio, |
michael@0 | 1317 | #if defined(__Panda__) |
michael@0 | 1318 | particletype **mp, |
michael@0 | 1319 | #else |
michael@0 | 1320 | struct mbuf **mp, |
michael@0 | 1321 | #endif |
michael@0 | 1322 | struct sockaddr *from, |
michael@0 | 1323 | int fromlen, |
michael@0 | 1324 | int *msg_flags, |
michael@0 | 1325 | struct sctp_sndrcvinfo *sinfo, |
michael@0 | 1326 | int filling_sinfo); |
michael@0 | 1327 | #endif |
michael@0 | 1328 | |
michael@0 | 1329 | /* |
michael@0 | 1330 | * API system calls |
michael@0 | 1331 | */ |
michael@0 | 1332 | #if !(defined(_KERNEL)) && !(defined(__Userspace__)) |
michael@0 | 1333 | |
michael@0 | 1334 | __BEGIN_DECLS |
michael@0 | 1335 | #if defined(__FreeBSD__) && __FreeBSD_version < 902000 |
michael@0 | 1336 | int sctp_peeloff __P((int, sctp_assoc_t)); |
michael@0 | 1337 | int sctp_bindx __P((int, struct sockaddr *, int, int)); |
michael@0 | 1338 | int sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *)); |
michael@0 | 1339 | int sctp_getaddrlen __P((sa_family_t)); |
michael@0 | 1340 | int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **)); |
michael@0 | 1341 | void sctp_freepaddrs __P((struct sockaddr *)); |
michael@0 | 1342 | int sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **)); |
michael@0 | 1343 | void sctp_freeladdrs __P((struct sockaddr *)); |
michael@0 | 1344 | int sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *)); |
michael@0 | 1345 | |
michael@0 | 1346 | /* deprecated */ |
michael@0 | 1347 | ssize_t sctp_sendmsg __P((int, const void *, size_t, const struct sockaddr *, |
michael@0 | 1348 | socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); |
michael@0 | 1349 | |
michael@0 | 1350 | /* deprecated */ |
michael@0 | 1351 | ssize_t sctp_send __P((int, const void *, size_t, |
michael@0 | 1352 | const struct sctp_sndrcvinfo *, int)); |
michael@0 | 1353 | |
michael@0 | 1354 | /* deprecated */ |
michael@0 | 1355 | ssize_t sctp_sendx __P((int, const void *, size_t, struct sockaddr *, |
michael@0 | 1356 | int, struct sctp_sndrcvinfo *, int)); |
michael@0 | 1357 | |
michael@0 | 1358 | /* deprecated */ |
michael@0 | 1359 | ssize_t sctp_sendmsgx __P((int sd, const void *, size_t, struct sockaddr *, |
michael@0 | 1360 | int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); |
michael@0 | 1361 | |
michael@0 | 1362 | sctp_assoc_t sctp_getassocid __P((int, struct sockaddr *)); |
michael@0 | 1363 | |
michael@0 | 1364 | /* deprecated */ |
michael@0 | 1365 | ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *, socklen_t *, |
michael@0 | 1366 | struct sctp_sndrcvinfo *, int *)); |
michael@0 | 1367 | |
michael@0 | 1368 | ssize_t sctp_sendv __P((int, const struct iovec *, int, struct sockaddr *, |
michael@0 | 1369 | int, void *, socklen_t, unsigned int, int)); |
michael@0 | 1370 | |
michael@0 | 1371 | ssize_t sctp_recvv __P((int, const struct iovec *, int, struct sockaddr *, |
michael@0 | 1372 | socklen_t *, void *, socklen_t *, unsigned int *, int *)); |
michael@0 | 1373 | #else |
michael@0 | 1374 | int sctp_peeloff(int, sctp_assoc_t); |
michael@0 | 1375 | int sctp_bindx(int, struct sockaddr *, int, int); |
michael@0 | 1376 | int sctp_connectx(int, const struct sockaddr *, int, sctp_assoc_t *); |
michael@0 | 1377 | int sctp_getaddrlen(sa_family_t); |
michael@0 | 1378 | int sctp_getpaddrs(int, sctp_assoc_t, struct sockaddr **); |
michael@0 | 1379 | void sctp_freepaddrs(struct sockaddr *); |
michael@0 | 1380 | int sctp_getladdrs(int, sctp_assoc_t, struct sockaddr **); |
michael@0 | 1381 | void sctp_freeladdrs(struct sockaddr *); |
michael@0 | 1382 | int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *); |
michael@0 | 1383 | |
michael@0 | 1384 | /* deprecated */ |
michael@0 | 1385 | ssize_t sctp_sendmsg(int, const void *, size_t, const struct sockaddr *, |
michael@0 | 1386 | socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); |
michael@0 | 1387 | |
michael@0 | 1388 | /* deprecated */ |
michael@0 | 1389 | ssize_t sctp_send(int, const void *, size_t, |
michael@0 | 1390 | const struct sctp_sndrcvinfo *, int); |
michael@0 | 1391 | |
michael@0 | 1392 | /* deprecated */ |
michael@0 | 1393 | ssize_t sctp_sendx(int, const void *, size_t, struct sockaddr *, |
michael@0 | 1394 | int, struct sctp_sndrcvinfo *, int); |
michael@0 | 1395 | |
michael@0 | 1396 | /* deprecated */ |
michael@0 | 1397 | ssize_t sctp_sendmsgx(int sd, const void *, size_t, struct sockaddr *, |
michael@0 | 1398 | int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); |
michael@0 | 1399 | |
michael@0 | 1400 | sctp_assoc_t sctp_getassocid(int, struct sockaddr *); |
michael@0 | 1401 | |
michael@0 | 1402 | /* deprecated */ |
michael@0 | 1403 | ssize_t sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *, |
michael@0 | 1404 | struct sctp_sndrcvinfo *, int *); |
michael@0 | 1405 | |
michael@0 | 1406 | ssize_t sctp_sendv(int, const struct iovec *, int, struct sockaddr *, |
michael@0 | 1407 | int, void *, socklen_t, unsigned int, int); |
michael@0 | 1408 | |
michael@0 | 1409 | ssize_t sctp_recvv(int, const struct iovec *, int, struct sockaddr *, |
michael@0 | 1410 | socklen_t *, void *, socklen_t *, unsigned int *, int *); |
michael@0 | 1411 | #endif |
michael@0 | 1412 | __END_DECLS |
michael@0 | 1413 | |
michael@0 | 1414 | #endif /* !_KERNEL */ |
michael@0 | 1415 | #endif /* !__sctp_uio_h__ */ |