1163953Srrs/*- 2185694Srrs * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 3237896Stuexen * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 4237896Stuexen * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 5163953Srrs * 6163953Srrs * Redistribution and use in source and binary forms, with or without 7163953Srrs * modification, are permitted provided that the following conditions are met: 8163953Srrs * 9163953Srrs * a) Redistributions of source code must retain the above copyright notice, 10231038Stuexen * this list of conditions and the following disclaimer. 11163953Srrs * 12163953Srrs * b) Redistributions in binary form must reproduce the above copyright 13163953Srrs * notice, this list of conditions and the following disclaimer in 14231038Stuexen * the documentation and/or other materials provided with the distribution. 15163953Srrs * 16163953Srrs * c) Neither the name of Cisco Systems, Inc. nor the names of its 17163953Srrs * contributors may be used to endorse or promote products derived 18163953Srrs * from this software without specific prior written permission. 19163953Srrs * 20163953Srrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21163953Srrs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22163953Srrs * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23163953Srrs * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24163953Srrs * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25163953Srrs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26163953Srrs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27163953Srrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28163953Srrs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29163953Srrs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30163953Srrs * THE POSSIBILITY OF SUCH DAMAGE. 31163953Srrs */ 32163953Srrs 33163953Srrs#include <sys/cdefs.h> 34163953Srrs__FBSDID("$FreeBSD$"); 35163953Srrs 36163953Srrs#ifndef _NETINET_SCTP_H_ 37163953Srrs#define _NETINET_SCTP_H_ 38163953Srrs 39237896Stuexen 40163953Srrs#include <sys/types.h> 41163953Srrs 42179783Srrs 43179783Srrs#define SCTP_PACKED __attribute__((packed)) 44179783Srrs 45163953Srrs/* 46266080Stuexen * SCTP protocol - RFC4960. 47163953Srrs */ 48163953Srrsstruct sctphdr { 49163953Srrs uint16_t src_port; /* source port */ 50163953Srrs uint16_t dest_port; /* destination port */ 51163953Srrs uint32_t v_tag; /* verification tag of packet */ 52266080Stuexen uint32_t checksum; /* CRC32C checksum */ 53163953Srrs /* chunks follow... */ 54179783Srrs} SCTP_PACKED; 55163953Srrs 56163953Srrs/* 57163953Srrs * SCTP Chunks 58163953Srrs */ 59179783Srrsstruct sctp_chunkhdr { 60179783Srrs uint8_t chunk_type; /* chunk type */ 61179783Srrs uint8_t chunk_flags; /* chunk flags */ 62179783Srrs uint16_t chunk_length; /* chunk length */ 63179783Srrs /* optional params follow */ 64179783Srrs} SCTP_PACKED; 65163953Srrs 66163953Srrs/* 67163953Srrs * SCTP chunk parameters 68163953Srrs */ 69179783Srrsstruct sctp_paramhdr { 70179783Srrs uint16_t param_type; /* parameter type */ 71179783Srrs uint16_t param_length; /* parameter length */ 72179783Srrs} SCTP_PACKED; 73163953Srrs 74163953Srrs/* 75163953Srrs * user socket options: socket API defined 76163953Srrs */ 77163953Srrs/* 78163953Srrs * read-write options 79163953Srrs */ 80163953Srrs#define SCTP_RTOINFO 0x00000001 81163953Srrs#define SCTP_ASSOCINFO 0x00000002 82163953Srrs#define SCTP_INITMSG 0x00000003 83163953Srrs#define SCTP_NODELAY 0x00000004 84163953Srrs#define SCTP_AUTOCLOSE 0x00000005 85163953Srrs#define SCTP_SET_PEER_PRIMARY_ADDR 0x00000006 86163953Srrs#define SCTP_PRIMARY_ADDR 0x00000007 87163953Srrs#define SCTP_ADAPTATION_LAYER 0x00000008 88163953Srrs/* same as above */ 89163953Srrs#define SCTP_ADAPTION_LAYER 0x00000008 90163953Srrs#define SCTP_DISABLE_FRAGMENTS 0x00000009 91163953Srrs#define SCTP_PEER_ADDR_PARAMS 0x0000000a 92163953Srrs#define SCTP_DEFAULT_SEND_PARAM 0x0000000b 93163953Srrs/* ancillary data/notification interest options */ 94223132Stuexen#define SCTP_EVENTS 0x0000000c /* deprecated */ 95163953Srrs/* Without this applied we will give V4 and V6 addresses on a V6 socket */ 96163953Srrs#define SCTP_I_WANT_MAPPED_V4_ADDR 0x0000000d 97163953Srrs#define SCTP_MAXSEG 0x0000000e 98170056Srrs#define SCTP_DELAYED_SACK 0x0000000f 99163953Srrs#define SCTP_FRAGMENT_INTERLEAVE 0x00000010 100163953Srrs#define SCTP_PARTIAL_DELIVERY_POINT 0x00000011 101163953Srrs/* authentication support */ 102163953Srrs#define SCTP_AUTH_CHUNK 0x00000012 103163953Srrs#define SCTP_AUTH_KEY 0x00000013 104163953Srrs#define SCTP_HMAC_IDENT 0x00000014 105163953Srrs#define SCTP_AUTH_ACTIVE_KEY 0x00000015 106163953Srrs#define SCTP_AUTH_DELETE_KEY 0x00000016 107163953Srrs#define SCTP_USE_EXT_RCVINFO 0x00000017 108163953Srrs#define SCTP_AUTO_ASCONF 0x00000018 /* rw */ 109163953Srrs#define SCTP_MAXBURST 0x00000019 /* rw */ 110170056Srrs#define SCTP_MAX_BURST 0x00000019 /* rw */ 111163953Srrs/* assoc level context */ 112163953Srrs#define SCTP_CONTEXT 0x0000001a /* rw */ 113215034Sbrucec/* explicit EOR signalling */ 114163953Srrs#define SCTP_EXPLICIT_EOR 0x0000001b 115181054Srrs#define SCTP_REUSE_PORT 0x0000001c /* rw */ 116185694Srrs#define SCTP_AUTH_DEACTIVATE_KEY 0x0000001d 117223132Stuexen#define SCTP_EVENT 0x0000001e 118223132Stuexen#define SCTP_RECVRCVINFO 0x0000001f 119223132Stuexen#define SCTP_RECVNXTINFO 0x00000020 120223132Stuexen#define SCTP_DEFAULT_SNDINFO 0x00000021 121223162Stuexen#define SCTP_DEFAULT_PRINFO 0x00000022 122224641Stuexen#define SCTP_PEER_ADDR_THLDS 0x00000023 123231070Stuexen#define SCTP_REMOTE_UDP_ENCAPS_PORT 0x00000024 124163953Srrs 125163953Srrs/* 126163953Srrs * read-only options 127163953Srrs */ 128163953Srrs#define SCTP_STATUS 0x00000100 129163953Srrs#define SCTP_GET_PEER_ADDR_INFO 0x00000101 130163953Srrs/* authentication support */ 131163953Srrs#define SCTP_PEER_AUTH_CHUNKS 0x00000102 132163953Srrs#define SCTP_LOCAL_AUTH_CHUNKS 0x00000103 133169655Srrs#define SCTP_GET_ASSOC_NUMBER 0x00000104 /* ro */ 134169655Srrs#define SCTP_GET_ASSOC_ID_LIST 0x00000105 /* ro */ 135215410Stuexen#define SCTP_TIMEOUTS 0x00000106 136163953Srrs 137163953Srrs/* 138163953Srrs * user socket options: BSD implementation specific 139163953Srrs */ 140163953Srrs/* 141163953Srrs * Blocking I/O is enabled on any TCP type socket by default. For the UDP 142163953Srrs * model if this is turned on then the socket buffer is shared for send 143163953Srrs * resources amongst all associations. The default for the UDP model is that 144215034Sbrucec * is SS_NBIO is set. Which means all associations have a separate send 145163953Srrs * limit BUT they will NOT ever BLOCK instead you will get an error back 146215034Sbrucec * EAGAIN if you try to send too much. If you want the blocking semantics you 147163953Srrs * set this option at the cost of sharing one socket send buffer size amongst 148163953Srrs * all associations. Peeled off sockets turn this option off and block. But 149163953Srrs * since both TCP and peeled off sockets have only one assoc per socket this 150163953Srrs * is fine. It probably does NOT make sense to set this on SS_NBIO on a TCP 151163953Srrs * model OR peeled off UDP model, but we do allow you to do so. You just use 152163953Srrs * the normal syscall to toggle SS_NBIO the way you want. 153163953Srrs * 154215034Sbrucec * Blocking I/O is controlled by the SS_NBIO flag on the socket state so_state 155163953Srrs * field. 156163953Srrs */ 157163953Srrs 158234790Stuexen#define SCTP_ENABLE_STREAM_RESET 0x00000900 /* struct 159234790Stuexen * sctp_assoc_value */ 160234790Stuexen#define SCTP_RESET_STREAMS 0x00000901 /* struct 161234790Stuexen * sctp_reset_streams */ 162234790Stuexen#define SCTP_RESET_ASSOC 0x00000902 /* sctp_assoc_t */ 163234790Stuexen#define SCTP_ADD_STREAMS 0x00000903 /* struct 164234790Stuexen * sctp_add_streams */ 165163953Srrs 166234790Stuexen/* For enable stream reset */ 167234790Stuexen#define SCTP_ENABLE_RESET_STREAM_REQ 0x00000001 168234790Stuexen#define SCTP_ENABLE_RESET_ASSOC_REQ 0x00000002 169234790Stuexen#define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x00000004 170234790Stuexen#define SCTP_ENABLE_VALUE_MASK 0x00000007 171234790Stuexen/* For reset streams */ 172234790Stuexen#define SCTP_STREAM_RESET_INCOMING 0x00000001 173234790Stuexen#define SCTP_STREAM_RESET_OUTGOING 0x00000002 174163953Srrs 175234790Stuexen 176163953Srrs/* here on down are more implementation specific */ 177163953Srrs#define SCTP_SET_DEBUG_LEVEL 0x00001005 178163953Srrs#define SCTP_CLR_STAT_LOG 0x00001007 179163953Srrs/* CMT ON/OFF socket option */ 180163953Srrs#define SCTP_CMT_ON_OFF 0x00001200 181163953Srrs#define SCTP_CMT_USE_DAC 0x00001201 182171440Srrs/* JRS - Pluggable Congestion Control Socket option */ 183211944Stuexen#define SCTP_PLUGGABLE_CC 0x00001202 184217760Stuexen/* RS - Pluggable Stream Scheduling Socket option */ 185219057Srrs#define SCTP_PLUGGABLE_SS 0x00001203 186219057Srrs#define SCTP_SS_VALUE 0x00001204 187219057Srrs#define SCTP_CC_OPTION 0x00001205 /* Options for CC 188219057Srrs * modules */ 189163953Srrs/* read only */ 190163953Srrs#define SCTP_GET_SNDBUF_USE 0x00001101 191163953Srrs#define SCTP_GET_STAT_LOG 0x00001103 192169655Srrs#define SCTP_PCB_STATUS 0x00001104 193169655Srrs#define SCTP_GET_NONCE_VALUES 0x00001105 194163953Srrs 195170091Srrs 196167598Srrs/* Special hook for dynamically setting primary for all assoc's, 197215034Sbrucec * this is a write only option that requires root privilege. 198167598Srrs */ 199167598Srrs#define SCTP_SET_DYNAMIC_PRIMARY 0x00002001 200163953Srrs 201167598Srrs/* VRF (virtual router feature) and multi-VRF support 202167598Srrs * options. VRF's provide splits within a router 203167598Srrs * that give the views of multiple routers. A 204167598Srrs * standard host, without VRF support, is just 205167598Srrs * a single VRF. If VRF's are supported then 206167598Srrs * the transport must be VRF aware. This means 207167598Srrs * that every socket call coming in must be directed 208167598Srrs * within the endpoint to one of the VRF's it belongs 209167598Srrs * to. The endpoint, before binding, may select 210167598Srrs * the "default" VRF it is in by using a set socket 211167598Srrs * option with SCTP_VRF_ID. This will also 212215034Sbrucec * get propagated to the default VRF. Once the 213167598Srrs * endpoint binds an address then it CANNOT add 214167598Srrs * additional VRF's to become a Multi-VRF endpoint. 215167598Srrs * 216167598Srrs * Before BINDING additional VRF's can be added with 217167598Srrs * the SCTP_ADD_VRF_ID call or deleted with 218167598Srrs * SCTP_DEL_VRF_ID. 219167598Srrs * 220167598Srrs * Associations are ALWAYS contained inside a single 221167598Srrs * VRF. They cannot reside in two (or more) VRF's. Incoming 222167598Srrs * packets, assuming the router is VRF aware, can always 223167598Srrs * tell us what VRF they arrived on. A host not supporting 224167598Srrs * any VRF's will find that the packets always arrived on the 225167598Srrs * single VRF that the host has. 226167598Srrs * 227167598Srrs */ 228167598Srrs 229167598Srrs#define SCTP_VRF_ID 0x00003001 230167598Srrs#define SCTP_ADD_VRF_ID 0x00003002 231167598Srrs#define SCTP_GET_VRF_IDS 0x00003003 232167598Srrs#define SCTP_GET_ASOC_VRF 0x00003004 233167598Srrs#define SCTP_DEL_VRF_ID 0x00003005 234170091Srrs 235163953Srrs/* 236170091Srrs * If you enable packet logging you can get 237170091Srrs * a poor mans ethereal output in binary 238170091Srrs * form. Note this is a compile option to 239170091Srrs * the kernel, SCTP_PACKET_LOGGING, and 240170091Srrs * without it in your kernel you 241170094Srrs * will get a EOPNOTSUPP 242170091Srrs */ 243170091Srrs#define SCTP_GET_PACKET_LOG 0x00004001 244170091Srrs 245170091Srrs/* 246163953Srrs * hidden implementation specific options these are NOT user visible (should 247163953Srrs * move out of sctp.h) 248163953Srrs */ 249163953Srrs/* sctp_bindx() flags as hidden socket options */ 250163953Srrs#define SCTP_BINDX_ADD_ADDR 0x00008001 251163953Srrs#define SCTP_BINDX_REM_ADDR 0x00008002 252163953Srrs/* Hidden socket option that gets the addresses */ 253163953Srrs#define SCTP_GET_PEER_ADDRESSES 0x00008003 254163953Srrs#define SCTP_GET_LOCAL_ADDRESSES 0x00008004 255163953Srrs/* return the total count in bytes needed to hold all local addresses bound */ 256163953Srrs#define SCTP_GET_LOCAL_ADDR_SIZE 0x00008005 257163953Srrs/* Return the total count in bytes needed to hold the remote address */ 258163953Srrs#define SCTP_GET_REMOTE_ADDR_SIZE 0x00008006 259163953Srrs/* hidden option for connectx */ 260163953Srrs#define SCTP_CONNECT_X 0x00008007 261163953Srrs/* hidden option for connectx_delayed, part of sendx */ 262163953Srrs#define SCTP_CONNECT_X_DELAYED 0x00008008 263163953Srrs#define SCTP_CONNECT_X_COMPLETE 0x00008009 264163953Srrs/* hidden socket option based sctp_peeloff */ 265163953Srrs#define SCTP_PEELOFF 0x0000800a 266163953Srrs/* the real worker for sctp_getaddrlen() */ 267163953Srrs#define SCTP_GET_ADDR_LEN 0x0000800b 268163953Srrs/* Debug things that need to be purged */ 269163953Srrs#define SCTP_SET_INITIAL_DBG_SEQ 0x00009f00 270163953Srrs 271171440Srrs/* JRS - Supported congestion control modules for pluggable 272171440Srrs * congestion control 273171440Srrs */ 274171440Srrs/* Standard TCP Congestion Control */ 275171440Srrs#define SCTP_CC_RFC2581 0x00000000 276171440Srrs/* High Speed TCP Congestion Control (Floyd) */ 277171440Srrs#define SCTP_CC_HSTCP 0x00000001 278171440Srrs/* HTCP Congestion Control */ 279171440Srrs#define SCTP_CC_HTCP 0x00000002 280219120Srrs/* RTCC Congestion Control - RFC2581 plus */ 281219120Srrs#define SCTP_CC_RTCC 0x00000003 282168943Srrs 283219120Srrs#define SCTP_CC_OPT_RTCC_SETMODE 0x00002000 284219120Srrs#define SCTP_CC_OPT_USE_DCCC_ECN 0x00002001 285219397Srrs#define SCTP_CC_OPT_STEADY_STEP 0x00002002 286219120Srrs 287221460Stuexen#define SCTP_CMT_OFF 0 288221460Stuexen#define SCTP_CMT_BASE 1 289221460Stuexen#define SCTP_CMT_RPV1 2 290221460Stuexen#define SCTP_CMT_RPV2 3 291221460Stuexen#define SCTP_CMT_MPTCP 4 292221460Stuexen#define SCTP_CMT_MAX SCTP_CMT_MPTCP 293221460Stuexen 294217760Stuexen/* RS - Supported stream scheduling modules for pluggable 295217760Stuexen * stream scheduling 296217760Stuexen */ 297217760Stuexen/* Default simple round-robin */ 298217760Stuexen#define SCTP_SS_DEFAULT 0x00000000 299217760Stuexen/* Real round-robin */ 300217760Stuexen#define SCTP_SS_ROUND_ROBIN 0x00000001 301217760Stuexen/* Real round-robin per packet */ 302217760Stuexen#define SCTP_SS_ROUND_ROBIN_PACKET 0x00000002 303217760Stuexen/* Priority */ 304217760Stuexen#define SCTP_SS_PRIORITY 0x00000003 305217760Stuexen/* Fair Bandwidth */ 306217760Stuexen#define SCTP_SS_FAIR_BANDWITH 0x00000004 307217760Stuexen/* First-come, first-serve */ 308217760Stuexen#define SCTP_SS_FIRST_COME 0x00000005 309171440Srrs 310217760Stuexen 311168943Srrs/* fragment interleave constants 312168943Srrs * setting must be one of these or 313168943Srrs * EINVAL returned. 314168943Srrs */ 315168943Srrs#define SCTP_FRAG_LEVEL_0 0x00000000 316168943Srrs#define SCTP_FRAG_LEVEL_1 0x00000001 317168943Srrs#define SCTP_FRAG_LEVEL_2 0x00000002 318168943Srrs 319163953Srrs/* 320163953Srrs * user state values 321163953Srrs */ 322163953Srrs#define SCTP_CLOSED 0x0000 323163953Srrs#define SCTP_BOUND 0x1000 324163953Srrs#define SCTP_LISTEN 0x2000 325163953Srrs#define SCTP_COOKIE_WAIT 0x0002 326163953Srrs#define SCTP_COOKIE_ECHOED 0x0004 327163953Srrs#define SCTP_ESTABLISHED 0x0008 328163953Srrs#define SCTP_SHUTDOWN_SENT 0x0010 329163953Srrs#define SCTP_SHUTDOWN_RECEIVED 0x0020 330163953Srrs#define SCTP_SHUTDOWN_ACK_SENT 0x0040 331163953Srrs#define SCTP_SHUTDOWN_PENDING 0x0080 332163953Srrs 333163953Srrs/* 334163953Srrs * SCTP operational error codes (user visible) 335163953Srrs */ 336163953Srrs#define SCTP_CAUSE_NO_ERROR 0x0000 337163953Srrs#define SCTP_CAUSE_INVALID_STREAM 0x0001 338163953Srrs#define SCTP_CAUSE_MISSING_PARAM 0x0002 339163953Srrs#define SCTP_CAUSE_STALE_COOKIE 0x0003 340163953Srrs#define SCTP_CAUSE_OUT_OF_RESC 0x0004 341163953Srrs#define SCTP_CAUSE_UNRESOLVABLE_ADDR 0x0005 342163953Srrs#define SCTP_CAUSE_UNRECOG_CHUNK 0x0006 343163953Srrs#define SCTP_CAUSE_INVALID_PARAM 0x0007 344163953Srrs#define SCTP_CAUSE_UNRECOG_PARAM 0x0008 345163953Srrs#define SCTP_CAUSE_NO_USER_DATA 0x0009 346163953Srrs#define SCTP_CAUSE_COOKIE_IN_SHUTDOWN 0x000a 347163953Srrs#define SCTP_CAUSE_RESTART_W_NEWADDR 0x000b 348163953Srrs#define SCTP_CAUSE_USER_INITIATED_ABT 0x000c 349163953Srrs#define SCTP_CAUSE_PROTOCOL_VIOLATION 0x000d 350163953Srrs 351172190Srrs/* Error causes from RFC5061 */ 352185694Srrs#define SCTP_CAUSE_DELETING_LAST_ADDR 0x00a0 353185694Srrs#define SCTP_CAUSE_RESOURCE_SHORTAGE 0x00a1 354185694Srrs#define SCTP_CAUSE_DELETING_SRC_ADDR 0x00a2 355185694Srrs#define SCTP_CAUSE_ILLEGAL_ASCONF_ACK 0x00a3 356185694Srrs#define SCTP_CAUSE_REQUEST_REFUSED 0x00a4 357163953Srrs 358185694Srrs/* Error causes from nat-draft */ 359185694Srrs#define SCTP_CAUSE_NAT_COLLIDING_STATE 0x00b0 360185694Srrs#define SCTP_CAUSE_NAT_MISSING_STATE 0x00b1 361185694Srrs 362172190Srrs/* Error causes from RFC4895 */ 363163953Srrs#define SCTP_CAUSE_UNSUPPORTED_HMACID 0x0105 364163953Srrs 365163953Srrs/* 366215034Sbrucec * error cause parameters (user visible) 367163953Srrs */ 368266181Stuexenstruct sctp_gen_error_cause { 369266181Stuexen uint16_t code; 370266181Stuexen uint16_t length; 371266181Stuexen uint8_t info[]; 372266181Stuexen} SCTP_PACKED; 373266181Stuexen 374179783Srrsstruct sctp_error_cause { 375179783Srrs uint16_t code; 376179783Srrs uint16_t length; 377179783Srrs /* optional cause-specific info may follow */ 378179783Srrs} SCTP_PACKED; 379163953Srrs 380179783Srrsstruct sctp_error_invalid_stream { 381179783Srrs struct sctp_error_cause cause; /* code=SCTP_ERROR_INVALID_STREAM */ 382179783Srrs uint16_t stream_id; /* stream id of the DATA in error */ 383179783Srrs uint16_t reserved; 384179783Srrs} SCTP_PACKED; 385163953Srrs 386179783Srrsstruct sctp_error_missing_param { 387179783Srrs struct sctp_error_cause cause; /* code=SCTP_ERROR_MISSING_PARAM */ 388179783Srrs uint32_t num_missing_params; /* number of missing parameters */ 389179783Srrs /* uint16_t param_type's follow */ 390179783Srrs} SCTP_PACKED; 391163953Srrs 392179783Srrsstruct sctp_error_stale_cookie { 393179783Srrs struct sctp_error_cause cause; /* code=SCTP_ERROR_STALE_COOKIE */ 394179783Srrs uint32_t stale_time; /* time in usec of staleness */ 395179783Srrs} SCTP_PACKED; 396163953Srrs 397179783Srrsstruct sctp_error_out_of_resource { 398179783Srrs struct sctp_error_cause cause; /* code=SCTP_ERROR_OUT_OF_RESOURCES */ 399179783Srrs} SCTP_PACKED; 400163953Srrs 401179783Srrsstruct sctp_error_unresolv_addr { 402179783Srrs struct sctp_error_cause cause; /* code=SCTP_ERROR_UNRESOLVABLE_ADDR */ 403163953Srrs 404179783Srrs} SCTP_PACKED; 405163953Srrs 406179783Srrsstruct sctp_error_unrecognized_chunk { 407179783Srrs struct sctp_error_cause cause; /* code=SCTP_ERROR_UNRECOG_CHUNK */ 408179783Srrs struct sctp_chunkhdr ch;/* header from chunk in error */ 409179783Srrs} SCTP_PACKED; 410163953Srrs 411266186Stuexenstruct sctp_error_no_user_data { 412266186Stuexen struct sctp_error_cause cause; /* code=SCTP_CAUSE_NO_USER_DATA */ 413266186Stuexen uint32_t tsn; /* TSN of the empty data chunk */ 414266186Stuexen} SCTP_PACKED; 415266186Stuexen 416163953Srrs/* 417163953Srrs * Main SCTP chunk types we place these here so natd and f/w's in user land 418163953Srrs * can find them. 419163953Srrs */ 420163953Srrs/************0x00 series ***********/ 421163953Srrs#define SCTP_DATA 0x00 422163953Srrs#define SCTP_INITIATION 0x01 423163953Srrs#define SCTP_INITIATION_ACK 0x02 424163953Srrs#define SCTP_SELECTIVE_ACK 0x03 425163953Srrs#define SCTP_HEARTBEAT_REQUEST 0x04 426163953Srrs#define SCTP_HEARTBEAT_ACK 0x05 427163953Srrs#define SCTP_ABORT_ASSOCIATION 0x06 428163953Srrs#define SCTP_SHUTDOWN 0x07 429163953Srrs#define SCTP_SHUTDOWN_ACK 0x08 430163953Srrs#define SCTP_OPERATION_ERROR 0x09 431163953Srrs#define SCTP_COOKIE_ECHO 0x0a 432163953Srrs#define SCTP_COOKIE_ACK 0x0b 433163953Srrs#define SCTP_ECN_ECHO 0x0c 434163953Srrs#define SCTP_ECN_CWR 0x0d 435163953Srrs#define SCTP_SHUTDOWN_COMPLETE 0x0e 436172190Srrs/* RFC4895 */ 437163953Srrs#define SCTP_AUTHENTICATION 0x0f 438185694Srrs/* EY nr_sack chunk id*/ 439265958Stuexen#define SCTP_NR_SELECTIVE_ACK 0x10 440163953Srrs/************0x40 series ***********/ 441163953Srrs/************0x80 series ***********/ 442172190Srrs/* RFC5061 */ 443163953Srrs#define SCTP_ASCONF_ACK 0x80 444163953Srrs/* draft-ietf-stewart-pktdrpsctp */ 445163953Srrs#define SCTP_PACKET_DROPPED 0x81 446163953Srrs/* draft-ietf-stewart-strreset-xxx */ 447163953Srrs#define SCTP_STREAM_RESET 0x82 448170642Srrs 449170642Srrs/* RFC4820 */ 450170642Srrs#define SCTP_PAD_CHUNK 0x84 451163953Srrs/************0xc0 series ***********/ 452163953Srrs/* RFC3758 */ 453163953Srrs#define SCTP_FORWARD_CUM_TSN 0xc0 454172190Srrs/* RFC5061 */ 455163953Srrs#define SCTP_ASCONF 0xc1 456163953Srrs 457163953Srrs 458163953Srrs/* ABORT and SHUTDOWN COMPLETE FLAG */ 459163953Srrs#define SCTP_HAD_NO_TCB 0x01 460163953Srrs 461163953Srrs/* Packet dropped flags */ 462163953Srrs#define SCTP_FROM_MIDDLE_BOX SCTP_HAD_NO_TCB 463163953Srrs#define SCTP_BADCRC 0x02 464163953Srrs#define SCTP_PACKET_TRUNCATED 0x04 465163953Srrs 466218072Srrs/* Flag for ECN -CWR */ 467218072Srrs#define SCTP_CWR_REDUCE_OVERRIDE 0x01 468218072Srrs#define SCTP_CWR_IN_SAME_WINDOW 0x02 469218072Srrs 470163953Srrs#define SCTP_SAT_NETWORK_MIN 400 /* min ms for RTT to set satellite 471163953Srrs * time */ 472163953Srrs#define SCTP_SAT_NETWORK_BURST_INCR 2 /* how many times to multiply maxburst 473163953Srrs * in sat */ 474163953Srrs 475163953Srrs/* Data Chuck Specific Flags */ 476179783Srrs#define SCTP_DATA_FRAG_MASK 0x03 477179783Srrs#define SCTP_DATA_MIDDLE_FRAG 0x00 478179783Srrs#define SCTP_DATA_LAST_FRAG 0x01 479179783Srrs#define SCTP_DATA_FIRST_FRAG 0x02 480179783Srrs#define SCTP_DATA_NOT_FRAG 0x03 481179783Srrs#define SCTP_DATA_UNORDERED 0x04 482179783Srrs#define SCTP_DATA_SACK_IMMEDIATELY 0x08 483163953Srrs/* ECN Nonce: SACK Chunk Specific Flags */ 484179783Srrs#define SCTP_SACK_NONCE_SUM 0x01 485163953Srrs 486163953Srrs/* CMT DAC algorithm SACK flag */ 487179783Srrs#define SCTP_SACK_CMT_DAC 0x80 488163953Srrs 489168945Srrs/* 490168945Srrs * PCB flags (in sctp_flags bitmask). 491168945Srrs * Note the features and flags are meant 492168945Srrs * for use by netstat. 493168945Srrs */ 494168945Srrs#define SCTP_PCB_FLAGS_UDPTYPE 0x00000001 495168945Srrs#define SCTP_PCB_FLAGS_TCPTYPE 0x00000002 496168945Srrs#define SCTP_PCB_FLAGS_BOUNDALL 0x00000004 497168945Srrs#define SCTP_PCB_FLAGS_ACCEPTING 0x00000008 498168945Srrs#define SCTP_PCB_FLAGS_UNBOUND 0x00000010 499168945Srrs#define SCTP_PCB_FLAGS_CLOSE_IP 0x00040000 500168945Srrs#define SCTP_PCB_FLAGS_WAS_CONNECTED 0x00080000 501168945Srrs#define SCTP_PCB_FLAGS_WAS_ABORTED 0x00100000 502168945Srrs/* TCP model support */ 503168945Srrs 504168945Srrs#define SCTP_PCB_FLAGS_CONNECTED 0x00200000 505168945Srrs#define SCTP_PCB_FLAGS_IN_TCPPOOL 0x00400000 506168945Srrs#define SCTP_PCB_FLAGS_DONT_WAKE 0x00800000 507168945Srrs#define SCTP_PCB_FLAGS_WAKEOUTPUT 0x01000000 508168945Srrs#define SCTP_PCB_FLAGS_WAKEINPUT 0x02000000 509168945Srrs#define SCTP_PCB_FLAGS_BOUND_V6 0x04000000 510179141Srrs#define SCTP_PCB_FLAGS_BLOCKING_IO 0x08000000 511179141Srrs#define SCTP_PCB_FLAGS_SOCKET_GONE 0x10000000 512179141Srrs#define SCTP_PCB_FLAGS_SOCKET_ALLGONE 0x20000000 513209289Stuexen#define SCTP_PCB_FLAGS_SOCKET_CANT_READ 0x40000000 514252961Stuexen 515168945Srrs/* flags to copy to new PCB */ 516179141Srrs#define SCTP_PCB_COPY_FLAGS (SCTP_PCB_FLAGS_BOUNDALL|\ 517179141Srrs SCTP_PCB_FLAGS_WAKEINPUT|\ 518179141Srrs SCTP_PCB_FLAGS_BOUND_V6) 519168945Srrs 520168945Srrs/* 521168945Srrs * PCB Features (in sctp_features bitmask) 522168945Srrs */ 523265958Stuexen#define SCTP_PCB_FLAGS_DO_NOT_PMTUD 0x0000000000000001 524265958Stuexen#define SCTP_PCB_FLAGS_EXT_RCVINFO 0x0000000000000002 /* deprecated */ 525265958Stuexen#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT 0x0000000000000004 526265958Stuexen#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE 0x0000000000000008 527265958Stuexen#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS 0x0000000000000010 528265958Stuexen#define SCTP_PCB_FLAGS_DO_ASCONF 0x0000000000000020 529265958Stuexen#define SCTP_PCB_FLAGS_AUTO_ASCONF 0x0000000000000040 530265958Stuexen#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x0000000000000080 531168945Srrs/* socket options */ 532265958Stuexen#define SCTP_PCB_FLAGS_NODELAY 0x0000000000000100 533265958Stuexen#define SCTP_PCB_FLAGS_AUTOCLOSE 0x0000000000000200 534265958Stuexen#define SCTP_PCB_FLAGS_RECVDATAIOEVNT 0x0000000000000400 /* deprecated */ 535265958Stuexen#define SCTP_PCB_FLAGS_RECVASSOCEVNT 0x0000000000000800 536265958Stuexen#define SCTP_PCB_FLAGS_RECVPADDREVNT 0x0000000000001000 537265958Stuexen#define SCTP_PCB_FLAGS_RECVPEERERR 0x0000000000002000 538265958Stuexen#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT 0x0000000000004000 /* deprecated */ 539265958Stuexen#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT 0x0000000000008000 540265958Stuexen#define SCTP_PCB_FLAGS_ADAPTATIONEVNT 0x0000000000010000 541265958Stuexen#define SCTP_PCB_FLAGS_PDAPIEVNT 0x0000000000020000 542265958Stuexen#define SCTP_PCB_FLAGS_AUTHEVNT 0x0000000000040000 543265958Stuexen#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x0000000000080000 544265958Stuexen#define SCTP_PCB_FLAGS_NO_FRAGMENT 0x0000000000100000 545265958Stuexen#define SCTP_PCB_FLAGS_EXPLICIT_EOR 0x0000000000400000 546265958Stuexen#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 0x0000000000800000 547265958Stuexen#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS 0x0000000001000000 548265958Stuexen#define SCTP_PCB_FLAGS_PORTREUSE 0x0000000002000000 549265958Stuexen#define SCTP_PCB_FLAGS_DRYEVNT 0x0000000004000000 550265958Stuexen#define SCTP_PCB_FLAGS_RECVRCVINFO 0x0000000008000000 551265958Stuexen#define SCTP_PCB_FLAGS_RECVNXTINFO 0x0000000010000000 552265958Stuexen#define SCTP_PCB_FLAGS_ASSOC_RESETEVNT 0x0000000020000000 553265958Stuexen#define SCTP_PCB_FLAGS_STREAM_CHANGEEVNT 0x0000000040000000 554265958Stuexen#define SCTP_PCB_FLAGS_RECVNSENDFAILEVNT 0x0000000080000000 555223132Stuexen 556171990Srrs/*- 557171990Srrs * mobility_features parameters (by micchie).Note 558171990Srrs * these features are applied against the 559171990Srrs * sctp_mobility_features flags.. not the sctp_features 560171990Srrs * flags. 561171990Srrs */ 562235167Stuexen#define SCTP_MOBILITY_BASE 0x00000001 563235167Stuexen#define SCTP_MOBILITY_FASTHANDOFF 0x00000002 564235167Stuexen#define SCTP_MOBILITY_PRIM_DELETED 0x00000004 565171990Srrs 566171990Srrs 567170056Srrs#define SCTP_SMALLEST_PMTU 512 /* smallest pmtu allowed when disabling PMTU 568170056Srrs * discovery */ 569170056Srrs 570237898Stuexen#undef SCTP_PACKED 571237898Stuexen 572163953Srrs#include <netinet/sctp_uio.h> 573163953Srrs 574170744Srrs/* This dictates the size of the packet 575170744Srrs * collection buffer. This only applies 576170744Srrs * if SCTP_PACKET_LOGGING is enabled in 577170744Srrs * your config. 578170744Srrs */ 579170091Srrs#define SCTP_PACKET_LOG_SIZE 65536 580170091Srrs 581171477Srrs/* Maximum delays and such a user can set for options that 582171477Srrs * take ms. 583171477Srrs */ 584171477Srrs#define SCTP_MAX_SACK_DELAY 500 /* per RFC4960 */ 585171477Srrs#define SCTP_MAX_HB_INTERVAL 14400000 /* 4 hours in ms */ 586171477Srrs#define SCTP_MAX_COOKIE_LIFE 3600000 /* 1 hour in ms */ 587171477Srrs 588171477Srrs 589170744Srrs/* Types of logging/KTR tracing that can be enabled via the 590170744Srrs * sysctl net.inet.sctp.sctp_logging. You must also enable 591170744Srrs * SUBSYS tracing. 592170744Srrs * Note that you must have the SCTP option in the kernel 593170744Srrs * to enable these as well. 594170744Srrs */ 595170744Srrs#define SCTP_BLK_LOGGING_ENABLE 0x00000001 596170744Srrs#define SCTP_CWND_MONITOR_ENABLE 0x00000002 597170744Srrs#define SCTP_CWND_LOGGING_ENABLE 0x00000004 598170744Srrs#define SCTP_FLIGHT_LOGGING_ENABLE 0x00000020 599170744Srrs#define SCTP_FR_LOGGING_ENABLE 0x00000040 600170744Srrs#define SCTP_LOCK_LOGGING_ENABLE 0x00000080 601170744Srrs#define SCTP_MAP_LOGGING_ENABLE 0x00000100 602170744Srrs#define SCTP_MBCNT_LOGGING_ENABLE 0x00000200 603170744Srrs#define SCTP_MBUF_LOGGING_ENABLE 0x00000400 604170744Srrs#define SCTP_NAGLE_LOGGING_ENABLE 0x00000800 605224641Stuexen#define SCTP_RECV_RWND_LOGGING_ENABLE 0x00001000 606170744Srrs#define SCTP_RTTVAR_LOGGING_ENABLE 0x00002000 607170744Srrs#define SCTP_SACK_LOGGING_ENABLE 0x00004000 608224641Stuexen#define SCTP_SACK_RWND_LOGGING_ENABLE 0x00008000 609170744Srrs#define SCTP_SB_LOGGING_ENABLE 0x00010000 610170744Srrs#define SCTP_STR_LOGGING_ENABLE 0x00020000 611170744Srrs#define SCTP_WAKE_LOGGING_ENABLE 0x00040000 612170744Srrs#define SCTP_LOG_MAXBURST_ENABLE 0x00080000 613170744Srrs#define SCTP_LOG_RWND_ENABLE 0x00100000 614224641Stuexen#define SCTP_LOG_SACK_ARRIVALS_ENABLE 0x00200000 615224641Stuexen#define SCTP_LTRACE_CHUNK_ENABLE 0x00400000 616224641Stuexen#define SCTP_LTRACE_ERROR_ENABLE 0x00800000 617224641Stuexen#define SCTP_LAST_PACKET_TRACING 0x01000000 618224641Stuexen#define SCTP_THRESHOLD_LOGGING 0x02000000 619224641Stuexen#define SCTP_LOG_AT_SEND_2_SCTP 0x04000000 620224641Stuexen#define SCTP_LOG_AT_SEND_2_OUTQ 0x08000000 621224641Stuexen#define SCTP_LOG_TRY_ADVANCE 0x10000000 622170091Srrs 623163953Srrs#endif /* !_NETINET_SCTP_H_ */ 624