1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/sctp/src/netinet/sctp_uio.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,1415 @@ 1.4 +/*- 1.5 + * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 1.6 + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 1.7 + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 1.8 + * 1.9 + * Redistribution and use in source and binary forms, with or without 1.10 + * modification, are permitted provided that the following conditions are met: 1.11 + * 1.12 + * a) Redistributions of source code must retain the above copyright notice, 1.13 + * this list of conditions and the following disclaimer. 1.14 + * 1.15 + * b) Redistributions in binary form must reproduce the above copyright 1.16 + * notice, this list of conditions and the following disclaimer in 1.17 + * the documentation and/or other materials provided with the distribution. 1.18 + * 1.19 + * c) Neither the name of Cisco Systems, Inc. nor the names of its 1.20 + * contributors may be used to endorse or promote products derived 1.21 + * from this software without specific prior written permission. 1.22 + * 1.23 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.24 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 1.25 + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.26 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 1.27 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1.28 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1.29 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1.30 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1.31 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.32 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 1.33 + * THE POSSIBILITY OF SUCH DAMAGE. 1.34 + */ 1.35 + 1.36 +#ifdef __FreeBSD__ 1.37 +#include <sys/cdefs.h> 1.38 +__FBSDID("$FreeBSD: head/sys/netinet/sctp_uio.h 255160 2013-09-02 22:48:41Z tuexen $"); 1.39 +#endif 1.40 + 1.41 +#ifndef _NETINET_SCTP_UIO_H_ 1.42 +#define _NETINET_SCTP_UIO_H_ 1.43 + 1.44 +#if (defined(__APPLE__) && defined(KERNEL)) 1.45 +#ifndef _KERNEL 1.46 +#define _KERNEL 1.47 +#endif 1.48 +#endif 1.49 + 1.50 +#if !(defined(__Windows__)) && !defined(__Userspace_os_Windows) 1.51 +#if ! defined(_KERNEL) 1.52 +#include <stdint.h> 1.53 +#endif 1.54 +#include <sys/types.h> 1.55 +#include <sys/socket.h> 1.56 +#include <netinet/in.h> 1.57 +#endif 1.58 +#if defined(__Windows__) 1.59 +#pragma warning(push) 1.60 +#pragma warning(disable: 4200) 1.61 +#if defined(_KERNEL) 1.62 +#include <sys/types.h> 1.63 +#include <sys/socket.h> 1.64 +#include <netinet/in.h> 1.65 +#endif 1.66 +#endif 1.67 + 1.68 +typedef uint32_t sctp_assoc_t; 1.69 + 1.70 +#define SCTP_FUTURE_ASSOC 0 1.71 +#define SCTP_CURRENT_ASSOC 1 1.72 +#define SCTP_ALL_ASSOC 2 1.73 + 1.74 +struct sctp_event { 1.75 + sctp_assoc_t se_assoc_id; 1.76 + uint16_t se_type; 1.77 + uint8_t se_on; 1.78 +}; 1.79 + 1.80 +/* Compatibility to previous define's */ 1.81 +#define sctp_stream_reset_events sctp_stream_reset_event 1.82 + 1.83 +/* On/Off setup for subscription to events */ 1.84 +struct sctp_event_subscribe { 1.85 + uint8_t sctp_data_io_event; 1.86 + uint8_t sctp_association_event; 1.87 + uint8_t sctp_address_event; 1.88 + uint8_t sctp_send_failure_event; 1.89 + uint8_t sctp_peer_error_event; 1.90 + uint8_t sctp_shutdown_event; 1.91 + uint8_t sctp_partial_delivery_event; 1.92 + uint8_t sctp_adaptation_layer_event; 1.93 + uint8_t sctp_authentication_event; 1.94 + uint8_t sctp_sender_dry_event; 1.95 + uint8_t sctp_stream_reset_event; 1.96 +}; 1.97 + 1.98 +/* ancillary data types */ 1.99 +#define SCTP_INIT 0x0001 1.100 +#define SCTP_SNDRCV 0x0002 1.101 +#define SCTP_EXTRCV 0x0003 1.102 +#define SCTP_SNDINFO 0x0004 1.103 +#define SCTP_RCVINFO 0x0005 1.104 +#define SCTP_NXTINFO 0x0006 1.105 +#define SCTP_PRINFO 0x0007 1.106 +#define SCTP_AUTHINFO 0x0008 1.107 +#define SCTP_DSTADDRV4 0x0009 1.108 +#define SCTP_DSTADDRV6 0x000a 1.109 + 1.110 +/* 1.111 + * ancillary data structures 1.112 + */ 1.113 +struct sctp_initmsg { 1.114 +#if defined(__FreeBSD__) && __FreeBSD_version < 800000 1.115 + /* This is a bug. Not fixed for ABI compatibility */ 1.116 + uint32_t sinit_num_ostreams; 1.117 + uint32_t sinit_max_instreams; 1.118 +#else 1.119 + uint16_t sinit_num_ostreams; 1.120 + uint16_t sinit_max_instreams; 1.121 +#endif 1.122 + uint16_t sinit_max_attempts; 1.123 + uint16_t sinit_max_init_timeo; 1.124 +}; 1.125 + 1.126 +/* We add 96 bytes to the size of sctp_sndrcvinfo. 1.127 + * This makes the current structure 128 bytes long 1.128 + * which is nicely 64 bit aligned but also has room 1.129 + * for us to add more and keep ABI compatibility. 1.130 + * For example, already we have the sctp_extrcvinfo 1.131 + * when enabled which is 48 bytes. 1.132 + */ 1.133 + 1.134 +/* 1.135 + * The assoc up needs a verfid 1.136 + * all sendrcvinfo's need a verfid for SENDING only. 1.137 + */ 1.138 + 1.139 + 1.140 +#define SCTP_ALIGN_RESV_PAD 92 1.141 +#define SCTP_ALIGN_RESV_PAD_SHORT 76 1.142 + 1.143 +struct sctp_sndrcvinfo { 1.144 + uint16_t sinfo_stream; 1.145 + uint16_t sinfo_ssn; 1.146 + uint16_t sinfo_flags; 1.147 +#if defined(__FreeBSD__) && __FreeBSD_version < 800000 1.148 + uint16_t sinfo_pr_policy; 1.149 +#endif 1.150 + uint32_t sinfo_ppid; 1.151 + uint32_t sinfo_context; 1.152 + uint32_t sinfo_timetolive; 1.153 + uint32_t sinfo_tsn; 1.154 + uint32_t sinfo_cumtsn; 1.155 + sctp_assoc_t sinfo_assoc_id; 1.156 + uint16_t sinfo_keynumber; 1.157 + uint16_t sinfo_keynumber_valid; 1.158 + uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD]; 1.159 +}; 1.160 + 1.161 +struct sctp_extrcvinfo { 1.162 + uint16_t sinfo_stream; 1.163 + uint16_t sinfo_ssn; 1.164 + uint16_t sinfo_flags; 1.165 +#if defined(__FreeBSD__) && __FreeBSD_version < 800000 1.166 + uint16_t sinfo_pr_policy; 1.167 +#endif 1.168 + uint32_t sinfo_ppid; 1.169 + uint32_t sinfo_context; 1.170 + uint32_t sinfo_timetolive; 1.171 + uint32_t sinfo_tsn; 1.172 + uint32_t sinfo_cumtsn; 1.173 + sctp_assoc_t sinfo_assoc_id; 1.174 + uint16_t sreinfo_next_flags; 1.175 + uint16_t sreinfo_next_stream; 1.176 + uint32_t sreinfo_next_aid; 1.177 + uint32_t sreinfo_next_length; 1.178 + uint32_t sreinfo_next_ppid; 1.179 + uint16_t sinfo_keynumber; 1.180 + uint16_t sinfo_keynumber_valid; 1.181 + uint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT]; 1.182 +}; 1.183 + 1.184 +struct sctp_sndinfo { 1.185 + uint16_t snd_sid; 1.186 + uint16_t snd_flags; 1.187 + uint32_t snd_ppid; 1.188 + uint32_t snd_context; 1.189 + sctp_assoc_t snd_assoc_id; 1.190 +}; 1.191 + 1.192 +struct sctp_prinfo { 1.193 + uint16_t pr_policy; 1.194 + uint32_t pr_value; 1.195 +}; 1.196 + 1.197 +struct sctp_default_prinfo { 1.198 + uint16_t pr_policy; 1.199 + uint32_t pr_value; 1.200 + sctp_assoc_t pr_assoc_id; 1.201 +}; 1.202 + 1.203 +struct sctp_authinfo { 1.204 + uint16_t auth_keynumber; 1.205 +}; 1.206 + 1.207 +struct sctp_rcvinfo { 1.208 + uint16_t rcv_sid; 1.209 + uint16_t rcv_ssn; 1.210 + uint16_t rcv_flags; 1.211 + uint32_t rcv_ppid; 1.212 + uint32_t rcv_tsn; 1.213 + uint32_t rcv_cumtsn; 1.214 + uint32_t rcv_context; 1.215 + sctp_assoc_t rcv_assoc_id; 1.216 +}; 1.217 + 1.218 +struct sctp_nxtinfo { 1.219 + uint16_t nxt_sid; 1.220 + uint16_t nxt_flags; 1.221 + uint32_t nxt_ppid; 1.222 + uint32_t nxt_length; 1.223 + sctp_assoc_t nxt_assoc_id; 1.224 +}; 1.225 + 1.226 +#define SCTP_NO_NEXT_MSG 0x0000 1.227 +#define SCTP_NEXT_MSG_AVAIL 0x0001 1.228 +#define SCTP_NEXT_MSG_ISCOMPLETE 0x0002 1.229 +#define SCTP_NEXT_MSG_IS_UNORDERED 0x0004 1.230 +#define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008 1.231 + 1.232 +struct sctp_recvv_rn { 1.233 + struct sctp_rcvinfo recvv_rcvinfo; 1.234 + struct sctp_nxtinfo recvv_nxtinfo; 1.235 +}; 1.236 + 1.237 +#define SCTP_RECVV_NOINFO 0 1.238 +#define SCTP_RECVV_RCVINFO 1 1.239 +#define SCTP_RECVV_NXTINFO 2 1.240 +#define SCTP_RECVV_RN 3 1.241 + 1.242 +#define SCTP_SENDV_NOINFO 0 1.243 +#define SCTP_SENDV_SNDINFO 1 1.244 +#define SCTP_SENDV_PRINFO 2 1.245 +#define SCTP_SENDV_AUTHINFO 3 1.246 +#define SCTP_SENDV_SPA 4 1.247 + 1.248 +struct sctp_sendv_spa { 1.249 + uint32_t sendv_flags; 1.250 + struct sctp_sndinfo sendv_sndinfo; 1.251 + struct sctp_prinfo sendv_prinfo; 1.252 + struct sctp_authinfo sendv_authinfo; 1.253 +}; 1.254 + 1.255 +#define SCTP_SEND_SNDINFO_VALID 0x00000001 1.256 +#define SCTP_SEND_PRINFO_VALID 0x00000002 1.257 +#define SCTP_SEND_AUTHINFO_VALID 0x00000004 1.258 + 1.259 +struct sctp_snd_all_completes { 1.260 + uint16_t sall_stream; 1.261 + uint16_t sall_flags; 1.262 + uint32_t sall_ppid; 1.263 + uint32_t sall_context; 1.264 + uint32_t sall_num_sent; 1.265 + uint32_t sall_num_failed; 1.266 +}; 1.267 + 1.268 +/* Flags that go into the sinfo->sinfo_flags field */ 1.269 +#define SCTP_NOTIFICATION 0x0010 /* next message is a notification */ 1.270 +#define SCTP_COMPLETE 0x0020 /* next message is complete */ 1.271 +#define SCTP_EOF 0x0100 /* Start shutdown procedures */ 1.272 +#define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ 1.273 +#define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ 1.274 +#define SCTP_ADDR_OVER 0x0800 /* Override the primary-address */ 1.275 +#define SCTP_SENDALL 0x1000 /* Send this on all associations */ 1.276 +#define SCTP_EOR 0x2000 /* end of message signal */ 1.277 +#define SCTP_SACK_IMMEDIATELY 0x4000 /* Set I-Bit */ 1.278 + 1.279 +#define INVALID_SINFO_FLAG(x) (((x) & 0xfffffff0 \ 1.280 + & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\ 1.281 + SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR |\ 1.282 + SCTP_SACK_IMMEDIATELY)) != 0) 1.283 +/* for the endpoint */ 1.284 + 1.285 +/* The lower byte is an enumeration of PR-SCTP policies */ 1.286 +#define SCTP_PR_SCTP_NONE 0x0000 /* Reliable transfer */ 1.287 +#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ 1.288 +#define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ 1.289 +#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ 1.290 + 1.291 +#define PR_SCTP_POLICY(x) ((x) & 0x0f) 1.292 +#define PR_SCTP_ENABLED(x) (PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE) 1.293 +#define PR_SCTP_TTL_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL) 1.294 +#define PR_SCTP_BUF_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF) 1.295 +#define PR_SCTP_RTX_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX) 1.296 +#define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX) 1.297 +/* Stat's */ 1.298 +struct sctp_pcbinfo { 1.299 + uint32_t ep_count; 1.300 + uint32_t asoc_count; 1.301 + uint32_t laddr_count; 1.302 + uint32_t raddr_count; 1.303 + uint32_t chk_count; 1.304 + uint32_t readq_count; 1.305 + uint32_t free_chunks; 1.306 + uint32_t stream_oque; 1.307 +}; 1.308 + 1.309 +struct sctp_sockstat { 1.310 + sctp_assoc_t ss_assoc_id; 1.311 + uint32_t ss_total_sndbuf; 1.312 + uint32_t ss_total_recv_buf; 1.313 +}; 1.314 + 1.315 +/* 1.316 + * notification event structures 1.317 + */ 1.318 + 1.319 +/* 1.320 + * association change event 1.321 + */ 1.322 +struct sctp_assoc_change { 1.323 + uint16_t sac_type; 1.324 + uint16_t sac_flags; 1.325 + uint32_t sac_length; 1.326 + uint16_t sac_state; 1.327 + uint16_t sac_error; 1.328 + uint16_t sac_outbound_streams; 1.329 + uint16_t sac_inbound_streams; 1.330 + sctp_assoc_t sac_assoc_id; 1.331 + uint8_t sac_info[]; 1.332 +}; 1.333 + 1.334 +/* sac_state values */ 1.335 +#define SCTP_COMM_UP 0x0001 1.336 +#define SCTP_COMM_LOST 0x0002 1.337 +#define SCTP_RESTART 0x0003 1.338 +#define SCTP_SHUTDOWN_COMP 0x0004 1.339 +#define SCTP_CANT_STR_ASSOC 0x0005 1.340 + 1.341 +/* sac_info values */ 1.342 +#define SCTP_ASSOC_SUPPORTS_PR 0x01 1.343 +#define SCTP_ASSOC_SUPPORTS_AUTH 0x02 1.344 +#define SCTP_ASSOC_SUPPORTS_ASCONF 0x03 1.345 +#define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x04 1.346 +#define SCTP_ASSOC_SUPPORTS_RE_CONFIG 0x05 1.347 +#define SCTP_ASSOC_SUPPORTS_MAX 0x05 1.348 +/* 1.349 + * Address event 1.350 + */ 1.351 +struct sctp_paddr_change { 1.352 + uint16_t spc_type; 1.353 + uint16_t spc_flags; 1.354 + uint32_t spc_length; 1.355 + struct sockaddr_storage spc_aaddr; 1.356 + uint32_t spc_state; 1.357 + uint32_t spc_error; 1.358 + sctp_assoc_t spc_assoc_id; 1.359 + uint8_t spc_padding[4]; 1.360 +}; 1.361 + 1.362 +/* paddr state values */ 1.363 +#define SCTP_ADDR_AVAILABLE 0x0001 1.364 +#define SCTP_ADDR_UNREACHABLE 0x0002 1.365 +#define SCTP_ADDR_REMOVED 0x0003 1.366 +#define SCTP_ADDR_ADDED 0x0004 1.367 +#define SCTP_ADDR_MADE_PRIM 0x0005 1.368 +#define SCTP_ADDR_CONFIRMED 0x0006 1.369 + 1.370 +#define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */ 1.371 +#define SCTP_INACTIVE 0x0002 /* neither SCTP_ADDR_REACHABLE 1.372 + nor SCTP_ADDR_UNCONFIRMED */ 1.373 +#define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */ 1.374 + 1.375 +/* remote error events */ 1.376 +struct sctp_remote_error { 1.377 + uint16_t sre_type; 1.378 + uint16_t sre_flags; 1.379 + uint32_t sre_length; 1.380 + uint16_t sre_error; 1.381 + sctp_assoc_t sre_assoc_id; 1.382 + uint8_t sre_data[4]; 1.383 +}; 1.384 + 1.385 +/* data send failure event (deprecated) */ 1.386 +struct sctp_send_failed { 1.387 + uint16_t ssf_type; 1.388 + uint16_t ssf_flags; 1.389 + uint32_t ssf_length; 1.390 + uint32_t ssf_error; 1.391 + struct sctp_sndrcvinfo ssf_info; 1.392 + sctp_assoc_t ssf_assoc_id; 1.393 + uint8_t ssf_data[]; 1.394 +}; 1.395 + 1.396 +/* data send failure event (not deprecated) */ 1.397 +struct sctp_send_failed_event { 1.398 + uint16_t ssfe_type; 1.399 + uint16_t ssfe_flags; 1.400 + uint32_t ssfe_length; 1.401 + uint32_t ssfe_error; 1.402 + struct sctp_sndinfo ssfe_info; 1.403 + sctp_assoc_t ssfe_assoc_id; 1.404 + uint8_t ssfe_data[]; 1.405 +}; 1.406 + 1.407 +/* flag that indicates state of data */ 1.408 +#define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */ 1.409 +#define SCTP_DATA_SENT 0x0002 /* on wire at failure */ 1.410 + 1.411 +/* shutdown event */ 1.412 +struct sctp_shutdown_event { 1.413 + uint16_t sse_type; 1.414 + uint16_t sse_flags; 1.415 + uint32_t sse_length; 1.416 + sctp_assoc_t sse_assoc_id; 1.417 +}; 1.418 + 1.419 +/* Adaptation layer indication stuff */ 1.420 +struct sctp_adaptation_event { 1.421 + uint16_t sai_type; 1.422 + uint16_t sai_flags; 1.423 + uint32_t sai_length; 1.424 + uint32_t sai_adaptation_ind; 1.425 + sctp_assoc_t sai_assoc_id; 1.426 +}; 1.427 + 1.428 +struct sctp_setadaptation { 1.429 + uint32_t ssb_adaptation_ind; 1.430 +}; 1.431 + 1.432 +/* compatible old spelling */ 1.433 +struct sctp_adaption_event { 1.434 + uint16_t sai_type; 1.435 + uint16_t sai_flags; 1.436 + uint32_t sai_length; 1.437 + uint32_t sai_adaption_ind; 1.438 + sctp_assoc_t sai_assoc_id; 1.439 +}; 1.440 + 1.441 +struct sctp_setadaption { 1.442 + uint32_t ssb_adaption_ind; 1.443 +}; 1.444 + 1.445 + 1.446 +/* 1.447 + * Partial Delivery API event 1.448 + */ 1.449 +struct sctp_pdapi_event { 1.450 + uint16_t pdapi_type; 1.451 + uint16_t pdapi_flags; 1.452 + uint32_t pdapi_length; 1.453 + uint32_t pdapi_indication; 1.454 + uint16_t pdapi_stream; 1.455 + uint16_t pdapi_seq; 1.456 + sctp_assoc_t pdapi_assoc_id; 1.457 +}; 1.458 + 1.459 +/* indication values */ 1.460 +#define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001 1.461 + 1.462 + 1.463 +/* 1.464 + * authentication key event 1.465 + */ 1.466 +struct sctp_authkey_event { 1.467 + uint16_t auth_type; 1.468 + uint16_t auth_flags; 1.469 + uint32_t auth_length; 1.470 + uint16_t auth_keynumber; 1.471 + uint16_t auth_altkeynumber; 1.472 + uint32_t auth_indication; 1.473 + sctp_assoc_t auth_assoc_id; 1.474 +}; 1.475 + 1.476 +/* indication values */ 1.477 +#define SCTP_AUTH_NEW_KEY 0x0001 1.478 +#define SCTP_AUTH_NEWKEY SCTP_AUTH_NEW_KEY 1.479 +#define SCTP_AUTH_NO_AUTH 0x0002 1.480 +#define SCTP_AUTH_FREE_KEY 0x0003 1.481 + 1.482 + 1.483 +struct sctp_sender_dry_event { 1.484 + uint16_t sender_dry_type; 1.485 + uint16_t sender_dry_flags; 1.486 + uint32_t sender_dry_length; 1.487 + sctp_assoc_t sender_dry_assoc_id; 1.488 +}; 1.489 + 1.490 + 1.491 +/* 1.492 + * Stream reset event - subscribe to SCTP_STREAM_RESET_EVENT 1.493 + */ 1.494 +struct sctp_stream_reset_event { 1.495 + uint16_t strreset_type; 1.496 + uint16_t strreset_flags; 1.497 + uint32_t strreset_length; 1.498 + sctp_assoc_t strreset_assoc_id; 1.499 + uint16_t strreset_stream_list[]; 1.500 +}; 1.501 + 1.502 +/* flags in stream_reset_event (strreset_flags) */ 1.503 +#define SCTP_STREAM_RESET_INCOMING_SSN 0x0001 1.504 +#define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 1.505 +#define SCTP_STREAM_RESET_DENIED 0x0004 1.506 +#define SCTP_STREAM_RESET_FAILED 0x0008 1.507 + 1.508 +/* 1.509 + * Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT 1.510 + */ 1.511 +struct sctp_assoc_reset_event { 1.512 + uint16_t assocreset_type; 1.513 + uint16_t assocreset_flags; 1.514 + uint32_t assocreset_length; 1.515 + sctp_assoc_t assocreset_assoc_id; 1.516 + uint32_t assocreset_local_tsn; 1.517 + uint32_t assocreset_remote_tsn; 1.518 +}; 1.519 + 1.520 +#define SCTP_ASSOC_RESET_DENIED 0x0004 1.521 +#define SCTP_ASSOC_RESET_FAILED 0x0008 1.522 + 1.523 +/* 1.524 + * Stream change event - subscribe to SCTP_STREAM_CHANGE_EVENT 1.525 + */ 1.526 +struct sctp_stream_change_event { 1.527 + uint16_t strchange_type; 1.528 + uint16_t strchange_flags; 1.529 + uint32_t strchange_length; 1.530 + sctp_assoc_t strchange_assoc_id; 1.531 + uint16_t strchange_instrms; 1.532 + uint16_t strchange_outstrms; 1.533 +}; 1.534 + 1.535 +#define SCTP_STREAM_CHANGE_DENIED 0x0004 1.536 +#define SCTP_STREAM_CHANGE_FAILED 0x0008 1.537 + 1.538 + 1.539 +/* SCTP notification event */ 1.540 +struct sctp_tlv { 1.541 + uint16_t sn_type; 1.542 + uint16_t sn_flags; 1.543 + uint32_t sn_length; 1.544 +}; 1.545 + 1.546 +union sctp_notification { 1.547 + struct sctp_tlv sn_header; 1.548 + struct sctp_assoc_change sn_assoc_change; 1.549 + struct sctp_paddr_change sn_paddr_change; 1.550 + struct sctp_remote_error sn_remote_error; 1.551 + struct sctp_send_failed sn_send_failed; 1.552 + struct sctp_shutdown_event sn_shutdown_event; 1.553 + struct sctp_adaptation_event sn_adaptation_event; 1.554 + /* compatibility same as above */ 1.555 + struct sctp_adaption_event sn_adaption_event; 1.556 + struct sctp_pdapi_event sn_pdapi_event; 1.557 + struct sctp_authkey_event sn_auth_event; 1.558 + struct sctp_sender_dry_event sn_sender_dry_event; 1.559 + struct sctp_send_failed_event sn_send_failed_event; 1.560 + struct sctp_stream_reset_event sn_strreset_event; 1.561 + struct sctp_assoc_reset_event sn_assocreset_event; 1.562 + struct sctp_stream_change_event sn_strchange_event; 1.563 +}; 1.564 + 1.565 +/* notification types */ 1.566 +#define SCTP_ASSOC_CHANGE 0x0001 1.567 +#define SCTP_PEER_ADDR_CHANGE 0x0002 1.568 +#define SCTP_REMOTE_ERROR 0x0003 1.569 +#define SCTP_SEND_FAILED 0x0004 1.570 +#define SCTP_SHUTDOWN_EVENT 0x0005 1.571 +#define SCTP_ADAPTATION_INDICATION 0x0006 1.572 +/* same as above */ 1.573 +#define SCTP_ADAPTION_INDICATION 0x0006 1.574 +#define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 1.575 +#define SCTP_AUTHENTICATION_EVENT 0x0008 1.576 +#define SCTP_STREAM_RESET_EVENT 0x0009 1.577 +#define SCTP_SENDER_DRY_EVENT 0x000a 1.578 +#define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b /* we don't send this*/ 1.579 +#define SCTP_ASSOC_RESET_EVENT 0x000c 1.580 +#define SCTP_STREAM_CHANGE_EVENT 0x000d 1.581 +#define SCTP_SEND_FAILED_EVENT 0x000e 1.582 +/* 1.583 + * socket option structs 1.584 + */ 1.585 + 1.586 +struct sctp_paddrparams { 1.587 + struct sockaddr_storage spp_address; 1.588 + sctp_assoc_t spp_assoc_id; 1.589 + uint32_t spp_hbinterval; 1.590 + uint32_t spp_pathmtu; 1.591 + uint32_t spp_flags; 1.592 + uint32_t spp_ipv6_flowlabel; 1.593 + uint16_t spp_pathmaxrxt; 1.594 + uint8_t spp_dscp; 1.595 +}; 1.596 +#define spp_ipv4_tos spp_dscp 1.597 + 1.598 +#define SPP_HB_ENABLE 0x00000001 1.599 +#define SPP_HB_DISABLE 0x00000002 1.600 +#define SPP_HB_DEMAND 0x00000004 1.601 +#define SPP_PMTUD_ENABLE 0x00000008 1.602 +#define SPP_PMTUD_DISABLE 0x00000010 1.603 +#define SPP_HB_TIME_IS_ZERO 0x00000080 1.604 +#define SPP_IPV6_FLOWLABEL 0x00000100 1.605 +#define SPP_DSCP 0x00000200 1.606 +#define SPP_IPV4_TOS SPP_DSCP 1.607 + 1.608 +struct sctp_paddrthlds { 1.609 + struct sockaddr_storage spt_address; 1.610 + sctp_assoc_t spt_assoc_id; 1.611 + uint16_t spt_pathmaxrxt; 1.612 + uint16_t spt_pathpfthld; 1.613 +}; 1.614 + 1.615 +struct sctp_paddrinfo { 1.616 + struct sockaddr_storage spinfo_address; 1.617 + sctp_assoc_t spinfo_assoc_id; 1.618 + int32_t spinfo_state; 1.619 + uint32_t spinfo_cwnd; 1.620 + uint32_t spinfo_srtt; 1.621 + uint32_t spinfo_rto; 1.622 + uint32_t spinfo_mtu; 1.623 +}; 1.624 + 1.625 +struct sctp_rtoinfo { 1.626 + sctp_assoc_t srto_assoc_id; 1.627 + uint32_t srto_initial; 1.628 + uint32_t srto_max; 1.629 + uint32_t srto_min; 1.630 +}; 1.631 + 1.632 +struct sctp_assocparams { 1.633 + sctp_assoc_t sasoc_assoc_id; 1.634 + uint32_t sasoc_peer_rwnd; 1.635 + uint32_t sasoc_local_rwnd; 1.636 + uint32_t sasoc_cookie_life; 1.637 + uint16_t sasoc_asocmaxrxt; 1.638 + uint16_t sasoc_number_peer_destinations; 1.639 +}; 1.640 + 1.641 +struct sctp_setprim { 1.642 + struct sockaddr_storage ssp_addr; 1.643 + sctp_assoc_t ssp_assoc_id; 1.644 + uint8_t ssp_padding[4]; 1.645 +}; 1.646 + 1.647 +struct sctp_setpeerprim { 1.648 + struct sockaddr_storage sspp_addr; 1.649 + sctp_assoc_t sspp_assoc_id; 1.650 + uint8_t sspp_padding[4]; 1.651 +}; 1.652 + 1.653 +struct sctp_getaddresses { 1.654 + sctp_assoc_t sget_assoc_id; 1.655 + /* addr is filled in for N * sockaddr_storage */ 1.656 + struct sockaddr addr[1]; 1.657 +}; 1.658 + 1.659 +struct sctp_status { 1.660 + sctp_assoc_t sstat_assoc_id; 1.661 + int32_t sstat_state; 1.662 + uint32_t sstat_rwnd; 1.663 + uint16_t sstat_unackdata; 1.664 + uint16_t sstat_penddata; 1.665 + uint16_t sstat_instrms; 1.666 + uint16_t sstat_outstrms; 1.667 + uint32_t sstat_fragmentation_point; 1.668 + struct sctp_paddrinfo sstat_primary; 1.669 +}; 1.670 + 1.671 +/* 1.672 + * AUTHENTICATION support 1.673 + */ 1.674 +/* SCTP_AUTH_CHUNK */ 1.675 +struct sctp_authchunk { 1.676 + uint8_t sauth_chunk; 1.677 +}; 1.678 + 1.679 +/* SCTP_AUTH_KEY */ 1.680 +struct sctp_authkey { 1.681 + sctp_assoc_t sca_assoc_id; 1.682 + uint16_t sca_keynumber; 1.683 + uint16_t sca_keylength; 1.684 + uint8_t sca_key[]; 1.685 +}; 1.686 + 1.687 +/* SCTP_HMAC_IDENT */ 1.688 +struct sctp_hmacalgo { 1.689 + uint32_t shmac_number_of_idents; 1.690 + uint16_t shmac_idents[]; 1.691 +}; 1.692 + 1.693 +/* AUTH hmac_id */ 1.694 +#define SCTP_AUTH_HMAC_ID_RSVD 0x0000 1.695 +#define SCTP_AUTH_HMAC_ID_SHA1 0x0001 /* default, mandatory */ 1.696 +#define SCTP_AUTH_HMAC_ID_SHA256 0x0003 1.697 + 1.698 +/* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */ 1.699 +struct sctp_authkeyid { 1.700 + sctp_assoc_t scact_assoc_id; 1.701 + uint16_t scact_keynumber; 1.702 +}; 1.703 + 1.704 +/* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */ 1.705 +struct sctp_authchunks { 1.706 + sctp_assoc_t gauth_assoc_id; 1.707 + uint32_t gauth_number_of_chunks; 1.708 + uint8_t gauth_chunks[]; 1.709 +}; 1.710 + 1.711 +struct sctp_assoc_value { 1.712 + sctp_assoc_t assoc_id; 1.713 + uint32_t assoc_value; 1.714 +}; 1.715 + 1.716 +struct sctp_cc_option { 1.717 + int option; 1.718 + struct sctp_assoc_value aid_value; 1.719 +}; 1.720 + 1.721 +struct sctp_stream_value { 1.722 + sctp_assoc_t assoc_id; 1.723 + uint16_t stream_id; 1.724 + uint16_t stream_value; 1.725 +}; 1.726 + 1.727 +struct sctp_assoc_ids { 1.728 + uint32_t gaids_number_of_ids; 1.729 + sctp_assoc_t gaids_assoc_id[]; 1.730 +}; 1.731 + 1.732 +struct sctp_sack_info { 1.733 + sctp_assoc_t sack_assoc_id; 1.734 + uint32_t sack_delay; 1.735 + uint32_t sack_freq; 1.736 +}; 1.737 + 1.738 +struct sctp_timeouts { 1.739 + sctp_assoc_t stimo_assoc_id; 1.740 + uint32_t stimo_init; 1.741 + uint32_t stimo_data; 1.742 + uint32_t stimo_sack; 1.743 + uint32_t stimo_shutdown; 1.744 + uint32_t stimo_heartbeat; 1.745 + uint32_t stimo_cookie; 1.746 + uint32_t stimo_shutdownack; 1.747 +}; 1.748 + 1.749 +struct sctp_udpencaps { 1.750 + struct sockaddr_storage sue_address; 1.751 + sctp_assoc_t sue_assoc_id; 1.752 + uint16_t sue_port; 1.753 +}; 1.754 + 1.755 +struct sctp_cwnd_args { 1.756 + struct sctp_nets *net; /* network to */ /* FIXME: LP64 issue */ 1.757 + uint32_t cwnd_new_value;/* cwnd in k */ 1.758 + uint32_t pseudo_cumack; 1.759 + uint16_t inflight; /* flightsize in k */ 1.760 + uint16_t cwnd_augment; /* increment to it */ 1.761 + uint8_t meets_pseudo_cumack; 1.762 + uint8_t need_new_pseudo_cumack; 1.763 + uint8_t cnt_in_send; 1.764 + uint8_t cnt_in_str; 1.765 +}; 1.766 + 1.767 +struct sctp_blk_args { 1.768 + uint32_t onsb; /* in 1k bytes */ 1.769 + uint32_t sndlen; /* len of send being attempted */ 1.770 + uint32_t peer_rwnd; /* rwnd of peer */ 1.771 + uint16_t send_sent_qcnt;/* chnk cnt */ 1.772 + uint16_t stream_qcnt; /* chnk cnt */ 1.773 + uint16_t chunks_on_oque;/* chunks out */ 1.774 + uint16_t flight_size; /* flight size in k */ 1.775 +}; 1.776 + 1.777 +/* 1.778 + * Max we can reset in one setting, note this is dictated not by the define 1.779 + * but the size of a mbuf cluster so don't change this define and think you 1.780 + * can specify more. You must do multiple resets if you want to reset more 1.781 + * than SCTP_MAX_EXPLICIT_STR_RESET. 1.782 + */ 1.783 +#define SCTP_MAX_EXPLICT_STR_RESET 1000 1.784 + 1.785 +struct sctp_reset_streams { 1.786 + sctp_assoc_t srs_assoc_id; 1.787 + uint16_t srs_flags; 1.788 + uint16_t srs_number_streams; /* 0 == ALL */ 1.789 + uint16_t srs_stream_list[];/* list if strrst_num_streams is not 0 */ 1.790 +}; 1.791 + 1.792 +struct sctp_add_streams { 1.793 + sctp_assoc_t sas_assoc_id; 1.794 + uint16_t sas_instrms; 1.795 + uint16_t sas_outstrms; 1.796 +}; 1.797 + 1.798 +struct sctp_get_nonce_values { 1.799 + sctp_assoc_t gn_assoc_id; 1.800 + uint32_t gn_peers_tag; 1.801 + uint32_t gn_local_tag; 1.802 +}; 1.803 + 1.804 +/* Debugging logs */ 1.805 +struct sctp_str_log { 1.806 + void *stcb; /* FIXME: LP64 issue */ 1.807 + uint32_t n_tsn; 1.808 + uint32_t e_tsn; 1.809 + uint16_t n_sseq; 1.810 + uint16_t e_sseq; 1.811 + uint16_t strm; 1.812 +}; 1.813 + 1.814 +struct sctp_sb_log { 1.815 + void *stcb; /* FIXME: LP64 issue */ 1.816 + uint32_t so_sbcc; 1.817 + uint32_t stcb_sbcc; 1.818 + uint32_t incr; 1.819 +}; 1.820 + 1.821 +struct sctp_fr_log { 1.822 + uint32_t largest_tsn; 1.823 + uint32_t largest_new_tsn; 1.824 + uint32_t tsn; 1.825 +}; 1.826 + 1.827 +struct sctp_fr_map { 1.828 + uint32_t base; 1.829 + uint32_t cum; 1.830 + uint32_t high; 1.831 +}; 1.832 + 1.833 +struct sctp_rwnd_log { 1.834 + uint32_t rwnd; 1.835 + uint32_t send_size; 1.836 + uint32_t overhead; 1.837 + uint32_t new_rwnd; 1.838 +}; 1.839 + 1.840 +struct sctp_mbcnt_log { 1.841 + uint32_t total_queue_size; 1.842 + uint32_t size_change; 1.843 + uint32_t total_queue_mb_size; 1.844 + uint32_t mbcnt_change; 1.845 +}; 1.846 + 1.847 +struct sctp_sack_log { 1.848 + uint32_t cumack; 1.849 + uint32_t oldcumack; 1.850 + uint32_t tsn; 1.851 + uint16_t numGaps; 1.852 + uint16_t numDups; 1.853 +}; 1.854 + 1.855 +struct sctp_lock_log { 1.856 + void *sock; /* FIXME: LP64 issue */ 1.857 + void *inp; /* FIXME: LP64 issue */ 1.858 + uint8_t tcb_lock; 1.859 + uint8_t inp_lock; 1.860 + uint8_t info_lock; 1.861 + uint8_t sock_lock; 1.862 + uint8_t sockrcvbuf_lock; 1.863 + uint8_t socksndbuf_lock; 1.864 + uint8_t create_lock; 1.865 + uint8_t resv; 1.866 +}; 1.867 + 1.868 +struct sctp_rto_log { 1.869 + void * net; /* FIXME: LP64 issue */ 1.870 + uint32_t rtt; 1.871 +}; 1.872 + 1.873 +struct sctp_nagle_log { 1.874 + void *stcb; /* FIXME: LP64 issue */ 1.875 + uint32_t total_flight; 1.876 + uint32_t total_in_queue; 1.877 + uint16_t count_in_queue; 1.878 + uint16_t count_in_flight; 1.879 +}; 1.880 + 1.881 +struct sctp_sbwake_log { 1.882 + void *stcb; /* FIXME: LP64 issue */ 1.883 + uint16_t send_q; 1.884 + uint16_t sent_q; 1.885 + uint16_t flight; 1.886 + uint16_t wake_cnt; 1.887 + uint8_t stream_qcnt; /* chnk cnt */ 1.888 + uint8_t chunks_on_oque;/* chunks out */ 1.889 + uint8_t sbflags; 1.890 + uint8_t sctpflags; 1.891 +}; 1.892 + 1.893 +struct sctp_misc_info { 1.894 + uint32_t log1; 1.895 + uint32_t log2; 1.896 + uint32_t log3; 1.897 + uint32_t log4; 1.898 +}; 1.899 + 1.900 +struct sctp_log_closing { 1.901 + void *inp; /* FIXME: LP64 issue */ 1.902 + void *stcb; /* FIXME: LP64 issue */ 1.903 + uint32_t sctp_flags; 1.904 + uint16_t state; 1.905 + int16_t loc; 1.906 +}; 1.907 + 1.908 +struct sctp_mbuf_log { 1.909 + struct mbuf *mp; /* FIXME: LP64 issue */ 1.910 + caddr_t ext; 1.911 + caddr_t data; 1.912 + uint16_t size; 1.913 + uint8_t refcnt; 1.914 + uint8_t mbuf_flags; 1.915 +}; 1.916 + 1.917 +struct sctp_cwnd_log { 1.918 + uint64_t time_event; 1.919 + uint8_t from; 1.920 + uint8_t event_type; 1.921 + uint8_t resv[2]; 1.922 + union { 1.923 + struct sctp_log_closing close; 1.924 + struct sctp_blk_args blk; 1.925 + struct sctp_cwnd_args cwnd; 1.926 + struct sctp_str_log strlog; 1.927 + struct sctp_fr_log fr; 1.928 + struct sctp_fr_map map; 1.929 + struct sctp_rwnd_log rwnd; 1.930 + struct sctp_mbcnt_log mbcnt; 1.931 + struct sctp_sack_log sack; 1.932 + struct sctp_lock_log lock; 1.933 + struct sctp_rto_log rto; 1.934 + struct sctp_sb_log sb; 1.935 + struct sctp_nagle_log nagle; 1.936 + struct sctp_sbwake_log wake; 1.937 + struct sctp_mbuf_log mb; 1.938 + struct sctp_misc_info misc; 1.939 + } x; 1.940 +}; 1.941 + 1.942 +struct sctp_cwnd_log_req { 1.943 + int32_t num_in_log; /* Number in log */ 1.944 + int32_t num_ret; /* Number returned */ 1.945 + int32_t start_at; /* start at this one */ 1.946 + int32_t end_at; /* end at this one */ 1.947 + struct sctp_cwnd_log log[]; 1.948 +}; 1.949 + 1.950 +struct sctp_timeval { 1.951 + uint32_t tv_sec; 1.952 + uint32_t tv_usec; 1.953 +}; 1.954 + 1.955 +struct sctpstat { 1.956 + struct sctp_timeval sctps_discontinuitytime; /* sctpStats 18 (TimeStamp) */ 1.957 + /* MIB according to RFC 3873 */ 1.958 + uint32_t sctps_currestab; /* sctpStats 1 (Gauge32) */ 1.959 + uint32_t sctps_activeestab; /* sctpStats 2 (Counter32) */ 1.960 + uint32_t sctps_restartestab; 1.961 + uint32_t sctps_collisionestab; 1.962 + uint32_t sctps_passiveestab; /* sctpStats 3 (Counter32) */ 1.963 + uint32_t sctps_aborted; /* sctpStats 4 (Counter32) */ 1.964 + uint32_t sctps_shutdown; /* sctpStats 5 (Counter32) */ 1.965 + uint32_t sctps_outoftheblue; /* sctpStats 6 (Counter32) */ 1.966 + uint32_t sctps_checksumerrors; /* sctpStats 7 (Counter32) */ 1.967 + uint32_t sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */ 1.968 + uint32_t sctps_outorderchunks; /* sctpStats 9 (Counter64) */ 1.969 + uint32_t sctps_outunorderchunks; /* sctpStats 10 (Counter64) */ 1.970 + uint32_t sctps_incontrolchunks; /* sctpStats 11 (Counter64) */ 1.971 + uint32_t sctps_inorderchunks; /* sctpStats 12 (Counter64) */ 1.972 + uint32_t sctps_inunorderchunks; /* sctpStats 13 (Counter64) */ 1.973 + uint32_t sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */ 1.974 + uint32_t sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */ 1.975 + uint32_t sctps_outpackets; /* sctpStats 16 (Counter64) */ 1.976 + uint32_t sctps_inpackets; /* sctpStats 17 (Counter64) */ 1.977 + 1.978 + /* input statistics: */ 1.979 + uint32_t sctps_recvpackets; /* total input packets */ 1.980 + uint32_t sctps_recvdatagrams; /* total input datagrams */ 1.981 + uint32_t sctps_recvpktwithdata; /* total packets that had data */ 1.982 + uint32_t sctps_recvsacks; /* total input SACK chunks */ 1.983 + uint32_t sctps_recvdata; /* total input DATA chunks */ 1.984 + uint32_t sctps_recvdupdata; /* total input duplicate DATA chunks */ 1.985 + uint32_t sctps_recvheartbeat; /* total input HB chunks */ 1.986 + uint32_t sctps_recvheartbeatack; /* total input HB-ACK chunks */ 1.987 + uint32_t sctps_recvecne; /* total input ECNE chunks */ 1.988 + uint32_t sctps_recvauth; /* total input AUTH chunks */ 1.989 + uint32_t sctps_recvauthmissing; /* total input chunks missing AUTH */ 1.990 + uint32_t sctps_recvivalhmacid; /* total number of invalid HMAC ids received */ 1.991 + uint32_t sctps_recvivalkeyid; /* total number of invalid secret ids received */ 1.992 + uint32_t sctps_recvauthfailed; /* total number of auth failed */ 1.993 + uint32_t sctps_recvexpress; /* total fast path receives all one chunk */ 1.994 + uint32_t sctps_recvexpressm; /* total fast path multi-part data */ 1.995 + uint32_t sctps_recvnocrc; 1.996 + uint32_t sctps_recvswcrc; 1.997 + uint32_t sctps_recvhwcrc; 1.998 + 1.999 + /* output statistics: */ 1.1000 + uint32_t sctps_sendpackets; /* total output packets */ 1.1001 + uint32_t sctps_sendsacks; /* total output SACKs */ 1.1002 + uint32_t sctps_senddata; /* total output DATA chunks */ 1.1003 + uint32_t sctps_sendretransdata; /* total output retransmitted DATA chunks */ 1.1004 + uint32_t sctps_sendfastretrans; /* total output fast retransmitted DATA chunks */ 1.1005 + uint32_t sctps_sendmultfastretrans; /* total FR's that happened more than once 1.1006 + * to same chunk (u-del multi-fr algo). 1.1007 + */ 1.1008 + uint32_t sctps_sendheartbeat; /* total output HB chunks */ 1.1009 + uint32_t sctps_sendecne; /* total output ECNE chunks */ 1.1010 + uint32_t sctps_sendauth; /* total output AUTH chunks FIXME */ 1.1011 + uint32_t sctps_senderrors; /* ip_output error counter */ 1.1012 + uint32_t sctps_sendnocrc; 1.1013 + uint32_t sctps_sendswcrc; 1.1014 + uint32_t sctps_sendhwcrc; 1.1015 + /* PCKDROPREP statistics: */ 1.1016 + uint32_t sctps_pdrpfmbox; /* Packet drop from middle box */ 1.1017 + uint32_t sctps_pdrpfehos; /* P-drop from end host */ 1.1018 + uint32_t sctps_pdrpmbda; /* P-drops with data */ 1.1019 + uint32_t sctps_pdrpmbct; /* P-drops, non-data, non-endhost */ 1.1020 + uint32_t sctps_pdrpbwrpt; /* P-drop, non-endhost, bandwidth rep only */ 1.1021 + uint32_t sctps_pdrpcrupt; /* P-drop, not enough for chunk header */ 1.1022 + uint32_t sctps_pdrpnedat; /* P-drop, not enough data to confirm */ 1.1023 + uint32_t sctps_pdrppdbrk; /* P-drop, where process_chunk_drop said break */ 1.1024 + uint32_t sctps_pdrptsnnf; /* P-drop, could not find TSN */ 1.1025 + uint32_t sctps_pdrpdnfnd; /* P-drop, attempt reverse TSN lookup */ 1.1026 + uint32_t sctps_pdrpdiwnp; /* P-drop, e-host confirms zero-rwnd */ 1.1027 + uint32_t sctps_pdrpdizrw; /* P-drop, midbox confirms no space */ 1.1028 + uint32_t sctps_pdrpbadd; /* P-drop, data did not match TSN */ 1.1029 + uint32_t sctps_pdrpmark; /* P-drop, TSN's marked for Fast Retran */ 1.1030 + /* timeouts */ 1.1031 + uint32_t sctps_timoiterator; /* Number of iterator timers that fired */ 1.1032 + uint32_t sctps_timodata; /* Number of T3 data time outs */ 1.1033 + uint32_t sctps_timowindowprobe; /* Number of window probe (T3) timers that fired */ 1.1034 + uint32_t sctps_timoinit; /* Number of INIT timers that fired */ 1.1035 + uint32_t sctps_timosack; /* Number of sack timers that fired */ 1.1036 + uint32_t sctps_timoshutdown; /* Number of shutdown timers that fired */ 1.1037 + uint32_t sctps_timoheartbeat; /* Number of heartbeat timers that fired */ 1.1038 + uint32_t sctps_timocookie; /* Number of times a cookie timeout fired */ 1.1039 + uint32_t sctps_timosecret; /* Number of times an endpoint changed its cookie secret*/ 1.1040 + uint32_t sctps_timopathmtu; /* Number of PMTU timers that fired */ 1.1041 + uint32_t sctps_timoshutdownack; /* Number of shutdown ack timers that fired */ 1.1042 + uint32_t sctps_timoshutdownguard; /* Number of shutdown guard timers that fired */ 1.1043 + uint32_t sctps_timostrmrst; /* Number of stream reset timers that fired */ 1.1044 + uint32_t sctps_timoearlyfr; /* Number of early FR timers that fired */ 1.1045 + uint32_t sctps_timoasconf; /* Number of times an asconf timer fired */ 1.1046 + uint32_t sctps_timodelprim; /* Number of times a prim_deleted timer fired */ 1.1047 + uint32_t sctps_timoautoclose; /* Number of times auto close timer fired */ 1.1048 + uint32_t sctps_timoassockill; /* Number of asoc free timers expired */ 1.1049 + uint32_t sctps_timoinpkill; /* Number of inp free timers expired */ 1.1050 + /* former early FR counters */ 1.1051 + uint32_t sctps_spare[11]; 1.1052 + /* others */ 1.1053 + uint32_t sctps_hdrops; /* packet shorter than header */ 1.1054 + uint32_t sctps_badsum; /* checksum error */ 1.1055 + uint32_t sctps_noport; /* no endpoint for port */ 1.1056 + uint32_t sctps_badvtag; /* bad v-tag */ 1.1057 + uint32_t sctps_badsid; /* bad SID */ 1.1058 + uint32_t sctps_nomem; /* no memory */ 1.1059 + uint32_t sctps_fastretransinrtt; /* number of multiple FR in a RTT window */ 1.1060 + uint32_t sctps_markedretrans; 1.1061 + uint32_t sctps_naglesent; /* nagle allowed sending */ 1.1062 + uint32_t sctps_naglequeued; /* nagle doesn't allow sending */ 1.1063 + uint32_t sctps_maxburstqueued; /* max burst doesn't allow sending */ 1.1064 + uint32_t sctps_ifnomemqueued; /* look ahead tells us no memory in 1.1065 + * interface ring buffer OR we had a 1.1066 + * send error and are queuing one send. 1.1067 + */ 1.1068 + uint32_t sctps_windowprobed; /* total number of window probes sent */ 1.1069 + uint32_t sctps_lowlevelerr; /* total times an output error causes us 1.1070 + * to clamp down on next user send. 1.1071 + */ 1.1072 + uint32_t sctps_lowlevelerrusr; /* total times sctp_senderrors were caused from 1.1073 + * a user send from a user invoked send not 1.1074 + * a sack response 1.1075 + */ 1.1076 + uint32_t sctps_datadropchklmt; /* Number of in data drops due to chunk limit reached */ 1.1077 + uint32_t sctps_datadroprwnd; /* Number of in data drops due to rwnd limit reached */ 1.1078 + uint32_t sctps_ecnereducedcwnd; /* Number of times a ECN reduced the cwnd */ 1.1079 + uint32_t sctps_vtagexpress; /* Used express lookup via vtag */ 1.1080 + uint32_t sctps_vtagbogus; /* Collision in express lookup. */ 1.1081 + uint32_t sctps_primary_randry; /* Number of times the sender ran dry of user data on primary */ 1.1082 + uint32_t sctps_cmt_randry; /* Same for above */ 1.1083 + uint32_t sctps_slowpath_sack; /* Sacks the slow way */ 1.1084 + uint32_t sctps_wu_sacks_sent; /* Window Update only sacks sent */ 1.1085 + uint32_t sctps_sends_with_flags; /* number of sends with sinfo_flags !=0 */ 1.1086 + uint32_t sctps_sends_with_unord; /* number of unordered sends */ 1.1087 + uint32_t sctps_sends_with_eof; /* number of sends with EOF flag set */ 1.1088 + uint32_t sctps_sends_with_abort; /* number of sends with ABORT flag set */ 1.1089 + uint32_t sctps_protocol_drain_calls; /* number of times protocol drain called */ 1.1090 + uint32_t sctps_protocol_drains_done; /* number of times we did a protocol drain */ 1.1091 + uint32_t sctps_read_peeks; /* Number of times recv was called with peek */ 1.1092 + uint32_t sctps_cached_chk; /* Number of cached chunks used */ 1.1093 + uint32_t sctps_cached_strmoq; /* Number of cached stream oq's used */ 1.1094 + uint32_t sctps_left_abandon; /* Number of unread messages abandoned by close */ 1.1095 + uint32_t sctps_send_burst_avoid; /* Unused */ 1.1096 + uint32_t sctps_send_cwnd_avoid; /* Send cwnd full avoidance, already max burst inflight to net */ 1.1097 + uint32_t sctps_fwdtsn_map_over; /* number of map array over-runs via fwd-tsn's */ 1.1098 + uint32_t sctps_queue_upd_ecne; /* Number of times we queued or updated an ECN chunk on send queue */ 1.1099 + uint32_t sctps_reserved[31]; /* Future ABI compat - remove int's from here when adding new */ 1.1100 +}; 1.1101 + 1.1102 +#define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1) 1.1103 +#define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1) 1.1104 +#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) 1.1105 +#define SCTP_STAT_INCR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x += _d) 1.1106 +#define SCTP_STAT_DECR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x -= _d) 1.1107 +#else 1.1108 +#define SCTP_STAT_INCR_BY(_x,_d) atomic_add_int(&SCTP_BASE_STAT(_x), _d) 1.1109 +#define SCTP_STAT_DECR_BY(_x,_d) atomic_subtract_int(&SCTP_BASE_STAT(_x), _d) 1.1110 +#endif 1.1111 +/* The following macros are for handling MIB values, */ 1.1112 +#define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x) 1.1113 +#define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x) 1.1114 +#define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x) 1.1115 +#define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x) 1.1116 +#define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x) 1.1117 +#define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x) 1.1118 + 1.1119 +#if defined(__Userspace__) 1.1120 +union sctp_sockstore { 1.1121 +#if defined(INET) 1.1122 + struct sockaddr_in sin; 1.1123 +#endif 1.1124 +#if defined(INET6) 1.1125 + struct sockaddr_in6 sin6; 1.1126 +#endif 1.1127 + struct sockaddr_conn sconn; 1.1128 + struct sockaddr sa; 1.1129 +}; 1.1130 +#else 1.1131 +union sctp_sockstore { 1.1132 + struct sockaddr_in sin; 1.1133 + struct sockaddr_in6 sin6; 1.1134 + struct sockaddr sa; 1.1135 +}; 1.1136 +#endif 1.1137 + 1.1138 + 1.1139 +/***********************************/ 1.1140 +/* And something for us old timers */ 1.1141 +/***********************************/ 1.1142 + 1.1143 +#ifndef __APPLE__ 1.1144 +#ifndef __Userspace__ 1.1145 +#ifndef ntohll 1.1146 +#if defined(__Userspace_os_Linux) 1.1147 +#ifndef _BSD_SOURCE 1.1148 +#define _BSD_SOURCE 1.1149 +#endif 1.1150 +#include <endian.h> 1.1151 +#else 1.1152 +#include <sys/endian.h> 1.1153 +#endif 1.1154 +#define ntohll(x) be64toh(x) 1.1155 +#endif 1.1156 + 1.1157 +#ifndef htonll 1.1158 +#if defined(__Userspace_os_Linux) 1.1159 +#ifndef _BSD_SOURCE 1.1160 +#define _BSD_SOURCE 1.1161 +#endif 1.1162 +#include <endian.h> 1.1163 +#else 1.1164 +#include <sys/endian.h> 1.1165 +#endif 1.1166 +#define htonll(x) htobe64(x) 1.1167 +#endif 1.1168 +#endif 1.1169 +#endif 1.1170 +/***********************************/ 1.1171 + 1.1172 + 1.1173 +struct xsctp_inpcb { 1.1174 + uint32_t last; 1.1175 + uint32_t flags; 1.1176 +#if defined(__FreeBSD__) && __FreeBSD_version < 1000048 1.1177 + uint32_t features; 1.1178 +#else 1.1179 + uint64_t features; 1.1180 +#endif 1.1181 + uint32_t total_sends; 1.1182 + uint32_t total_recvs; 1.1183 + uint32_t total_nospaces; 1.1184 + uint32_t fragmentation_point; 1.1185 + uint16_t local_port; 1.1186 + uint16_t qlen; 1.1187 + uint16_t maxqlen; 1.1188 +#if defined(__Windows__) 1.1189 + uint16_t padding; 1.1190 +#endif 1.1191 +#if defined(__FreeBSD__) && __FreeBSD_version < 1000048 1.1192 + uint32_t extra_padding[32]; /* future */ 1.1193 +#else 1.1194 + uint32_t extra_padding[31]; /* future */ 1.1195 +#endif 1.1196 +}; 1.1197 + 1.1198 +struct xsctp_tcb { 1.1199 + union sctp_sockstore primary_addr; /* sctpAssocEntry 5/6 */ 1.1200 + uint32_t last; 1.1201 + uint32_t heartbeat_interval; /* sctpAssocEntry 7 */ 1.1202 + uint32_t state; /* sctpAssocEntry 8 */ 1.1203 + uint32_t in_streams; /* sctpAssocEntry 9 */ 1.1204 + uint32_t out_streams; /* sctpAssocEntry 10 */ 1.1205 + uint32_t max_nr_retrans; /* sctpAssocEntry 11 */ 1.1206 + uint32_t primary_process; /* sctpAssocEntry 12 */ 1.1207 + uint32_t T1_expireries; /* sctpAssocEntry 13 */ 1.1208 + uint32_t T2_expireries; /* sctpAssocEntry 14 */ 1.1209 + uint32_t retransmitted_tsns; /* sctpAssocEntry 15 */ 1.1210 + uint32_t total_sends; 1.1211 + uint32_t total_recvs; 1.1212 + uint32_t local_tag; 1.1213 + uint32_t remote_tag; 1.1214 + uint32_t initial_tsn; 1.1215 + uint32_t highest_tsn; 1.1216 + uint32_t cumulative_tsn; 1.1217 + uint32_t cumulative_tsn_ack; 1.1218 + uint32_t mtu; 1.1219 + uint32_t refcnt; 1.1220 + uint16_t local_port; /* sctpAssocEntry 3 */ 1.1221 + uint16_t remote_port; /* sctpAssocEntry 4 */ 1.1222 + struct sctp_timeval start_time; /* sctpAssocEntry 16 */ 1.1223 + struct sctp_timeval discontinuity_time; /* sctpAssocEntry 17 */ 1.1224 +#if defined(__FreeBSD__) 1.1225 +#if __FreeBSD_version >= 800000 1.1226 + uint32_t peers_rwnd; 1.1227 + sctp_assoc_t assoc_id; /* sctpAssocEntry 1 */ 1.1228 + uint32_t extra_padding[32]; /* future */ 1.1229 +#else 1.1230 +#endif 1.1231 +#else 1.1232 + uint32_t peers_rwnd; 1.1233 + sctp_assoc_t assoc_id; /* sctpAssocEntry 1 */ 1.1234 + uint32_t extra_padding[32]; /* future */ 1.1235 +#endif 1.1236 +}; 1.1237 + 1.1238 +struct xsctp_laddr { 1.1239 + union sctp_sockstore address; /* sctpAssocLocalAddrEntry 1/2 */ 1.1240 + uint32_t last; 1.1241 + struct sctp_timeval start_time; /* sctpAssocLocalAddrEntry 3 */ 1.1242 + uint32_t extra_padding[32]; /* future */ 1.1243 +}; 1.1244 + 1.1245 +struct xsctp_raddr { 1.1246 + union sctp_sockstore address; /* sctpAssocLocalRemEntry 1/2 */ 1.1247 + uint32_t last; 1.1248 + uint32_t rto; /* sctpAssocLocalRemEntry 5 */ 1.1249 + uint32_t max_path_rtx; /* sctpAssocLocalRemEntry 6 */ 1.1250 + uint32_t rtx; /* sctpAssocLocalRemEntry 7 */ 1.1251 + uint32_t error_counter; /* */ 1.1252 + uint32_t cwnd; /* */ 1.1253 + uint32_t flight_size; /* */ 1.1254 + uint32_t mtu; /* */ 1.1255 + uint8_t active; /* sctpAssocLocalRemEntry 3 */ 1.1256 + uint8_t confirmed; /* */ 1.1257 + uint8_t heartbeat_enabled; /* sctpAssocLocalRemEntry 4 */ 1.1258 + uint8_t potentially_failed; 1.1259 + struct sctp_timeval start_time; /* sctpAssocLocalRemEntry 8 */ 1.1260 +#if defined(__FreeBSD__) 1.1261 +#if __FreeBSD_version >= 800000 1.1262 + uint32_t rtt; 1.1263 + uint32_t heartbeat_interval; 1.1264 + uint32_t extra_padding[31]; /* future */ 1.1265 +#endif 1.1266 +#else 1.1267 + uint32_t rtt; 1.1268 + uint32_t heartbeat_interval; 1.1269 + uint32_t extra_padding[31]; /* future */ 1.1270 +#endif 1.1271 +}; 1.1272 + 1.1273 +#define SCTP_MAX_LOGGING_SIZE 30000 1.1274 +#define SCTP_TRACE_PARAMS 6 /* This number MUST be even */ 1.1275 + 1.1276 +struct sctp_log_entry { 1.1277 + uint64_t timestamp; 1.1278 + uint32_t subsys; 1.1279 + uint32_t padding; 1.1280 + uint32_t params[SCTP_TRACE_PARAMS]; 1.1281 +}; 1.1282 + 1.1283 +struct sctp_log { 1.1284 + struct sctp_log_entry entry[SCTP_MAX_LOGGING_SIZE]; 1.1285 + uint32_t index; 1.1286 + uint32_t padding; 1.1287 +}; 1.1288 + 1.1289 +/* 1.1290 + * Kernel defined for sctp_send 1.1291 + */ 1.1292 +#if defined(_KERNEL) || defined(__Userspace__) 1.1293 +int 1.1294 +sctp_lower_sosend(struct socket *so, 1.1295 + struct sockaddr *addr, 1.1296 + struct uio *uio, 1.1297 +#if defined(__Panda__) 1.1298 + pakhandle_type i_pak, 1.1299 + pakhandle_type i_control, 1.1300 +#else 1.1301 + struct mbuf *i_pak, 1.1302 + struct mbuf *control, 1.1303 +#endif 1.1304 + int flags, 1.1305 + struct sctp_sndrcvinfo *srcv 1.1306 +#if !(defined(__Panda__) || defined(__Userspace__)) 1.1307 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 1.1308 + ,struct thread *p 1.1309 +#elif defined(__Windows__) 1.1310 + , PKTHREAD p 1.1311 +#else 1.1312 + ,struct proc *p 1.1313 +#endif 1.1314 +#endif 1.1315 +); 1.1316 + 1.1317 +int 1.1318 +sctp_sorecvmsg(struct socket *so, 1.1319 + struct uio *uio, 1.1320 +#if defined(__Panda__) 1.1321 + particletype **mp, 1.1322 +#else 1.1323 + struct mbuf **mp, 1.1324 +#endif 1.1325 + struct sockaddr *from, 1.1326 + int fromlen, 1.1327 + int *msg_flags, 1.1328 + struct sctp_sndrcvinfo *sinfo, 1.1329 + int filling_sinfo); 1.1330 +#endif 1.1331 + 1.1332 +/* 1.1333 + * API system calls 1.1334 + */ 1.1335 +#if !(defined(_KERNEL)) && !(defined(__Userspace__)) 1.1336 + 1.1337 +__BEGIN_DECLS 1.1338 +#if defined(__FreeBSD__) && __FreeBSD_version < 902000 1.1339 +int sctp_peeloff __P((int, sctp_assoc_t)); 1.1340 +int sctp_bindx __P((int, struct sockaddr *, int, int)); 1.1341 +int sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *)); 1.1342 +int sctp_getaddrlen __P((sa_family_t)); 1.1343 +int sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **)); 1.1344 +void sctp_freepaddrs __P((struct sockaddr *)); 1.1345 +int sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **)); 1.1346 +void sctp_freeladdrs __P((struct sockaddr *)); 1.1347 +int sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *)); 1.1348 + 1.1349 +/* deprecated */ 1.1350 +ssize_t sctp_sendmsg __P((int, const void *, size_t, const struct sockaddr *, 1.1351 + socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); 1.1352 + 1.1353 +/* deprecated */ 1.1354 +ssize_t sctp_send __P((int, const void *, size_t, 1.1355 + const struct sctp_sndrcvinfo *, int)); 1.1356 + 1.1357 +/* deprecated */ 1.1358 +ssize_t sctp_sendx __P((int, const void *, size_t, struct sockaddr *, 1.1359 + int, struct sctp_sndrcvinfo *, int)); 1.1360 + 1.1361 +/* deprecated */ 1.1362 +ssize_t sctp_sendmsgx __P((int sd, const void *, size_t, struct sockaddr *, 1.1363 + int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t)); 1.1364 + 1.1365 +sctp_assoc_t sctp_getassocid __P((int, struct sockaddr *)); 1.1366 + 1.1367 +/* deprecated */ 1.1368 +ssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *, socklen_t *, 1.1369 + struct sctp_sndrcvinfo *, int *)); 1.1370 + 1.1371 +ssize_t sctp_sendv __P((int, const struct iovec *, int, struct sockaddr *, 1.1372 + int, void *, socklen_t, unsigned int, int)); 1.1373 + 1.1374 +ssize_t sctp_recvv __P((int, const struct iovec *, int, struct sockaddr *, 1.1375 + socklen_t *, void *, socklen_t *, unsigned int *, int *)); 1.1376 +#else 1.1377 +int sctp_peeloff(int, sctp_assoc_t); 1.1378 +int sctp_bindx(int, struct sockaddr *, int, int); 1.1379 +int sctp_connectx(int, const struct sockaddr *, int, sctp_assoc_t *); 1.1380 +int sctp_getaddrlen(sa_family_t); 1.1381 +int sctp_getpaddrs(int, sctp_assoc_t, struct sockaddr **); 1.1382 +void sctp_freepaddrs(struct sockaddr *); 1.1383 +int sctp_getladdrs(int, sctp_assoc_t, struct sockaddr **); 1.1384 +void sctp_freeladdrs(struct sockaddr *); 1.1385 +int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *); 1.1386 + 1.1387 +/* deprecated */ 1.1388 +ssize_t sctp_sendmsg(int, const void *, size_t, const struct sockaddr *, 1.1389 + socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); 1.1390 + 1.1391 +/* deprecated */ 1.1392 +ssize_t sctp_send(int, const void *, size_t, 1.1393 + const struct sctp_sndrcvinfo *, int); 1.1394 + 1.1395 +/* deprecated */ 1.1396 +ssize_t sctp_sendx(int, const void *, size_t, struct sockaddr *, 1.1397 + int, struct sctp_sndrcvinfo *, int); 1.1398 + 1.1399 +/* deprecated */ 1.1400 +ssize_t sctp_sendmsgx(int sd, const void *, size_t, struct sockaddr *, 1.1401 + int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t); 1.1402 + 1.1403 +sctp_assoc_t sctp_getassocid(int, struct sockaddr *); 1.1404 + 1.1405 +/* deprecated */ 1.1406 +ssize_t sctp_recvmsg(int, void *, size_t, struct sockaddr *, socklen_t *, 1.1407 + struct sctp_sndrcvinfo *, int *); 1.1408 + 1.1409 +ssize_t sctp_sendv(int, const struct iovec *, int, struct sockaddr *, 1.1410 + int, void *, socklen_t, unsigned int, int); 1.1411 + 1.1412 +ssize_t sctp_recvv(int, const struct iovec *, int, struct sockaddr *, 1.1413 + socklen_t *, void *, socklen_t *, unsigned int *, int *); 1.1414 +#endif 1.1415 +__END_DECLS 1.1416 + 1.1417 +#endif /* !_KERNEL */ 1.1418 +#endif /* !__sctp_uio_h__ */