1163953Srrs/*- 2185694Srrs * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 3235828Stuexen * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 4235828Stuexen * 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, 10228653Stuexen * 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 14228653Stuexen * 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 39235828Stuexen 40163953Srrs#include <sys/types.h> 41163953Srrs 42179783Srrs 43179783Srrs#define SCTP_PACKED __attribute__((packed)) 44179783Srrs 45163953Srrs/* 46267721Stuexen * 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 */ 52267721Stuexen 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 123227755Stuexen#define SCTP_REMOTE_UDP_ENCAPS_PORT 0x00000024 124270356Stuexen#define SCTP_ECN_SUPPORTED 0x00000025 125270357Stuexen#define SCTP_PR_SUPPORTED 0x00000026 126270362Stuexen#define SCTP_AUTH_SUPPORTED 0x00000027 127270362Stuexen#define SCTP_ASCONF_SUPPORTED 0x00000028 128270361Stuexen#define SCTP_RECONFIG_SUPPORTED 0x00000029 129270362Stuexen#define SCTP_NRSACK_SUPPORTED 0x00000030 130270362Stuexen#define SCTP_PKTDROP_SUPPORTED 0x00000031 131283724Stuexen#define SCTP_MAX_CWND 0x00000032 132163953Srrs 133163953Srrs/* 134163953Srrs * read-only options 135163953Srrs */ 136163953Srrs#define SCTP_STATUS 0x00000100 137163953Srrs#define SCTP_GET_PEER_ADDR_INFO 0x00000101 138163953Srrs/* authentication support */ 139163953Srrs#define SCTP_PEER_AUTH_CHUNKS 0x00000102 140163953Srrs#define SCTP_LOCAL_AUTH_CHUNKS 0x00000103 141169655Srrs#define SCTP_GET_ASSOC_NUMBER 0x00000104 /* ro */ 142169655Srrs#define SCTP_GET_ASSOC_ID_LIST 0x00000105 /* ro */ 143215410Stuexen#define SCTP_TIMEOUTS 0x00000106 144270363Stuexen#define SCTP_PR_STREAM_STATUS 0x00000107 145270363Stuexen#define SCTP_PR_ASSOC_STATUS 0x00000108 146163953Srrs 147163953Srrs/* 148163953Srrs * user socket options: BSD implementation specific 149163953Srrs */ 150163953Srrs/* 151163953Srrs * Blocking I/O is enabled on any TCP type socket by default. For the UDP 152163953Srrs * model if this is turned on then the socket buffer is shared for send 153163953Srrs * resources amongst all associations. The default for the UDP model is that 154215034Sbrucec * is SS_NBIO is set. Which means all associations have a separate send 155163953Srrs * limit BUT they will NOT ever BLOCK instead you will get an error back 156215034Sbrucec * EAGAIN if you try to send too much. If you want the blocking semantics you 157163953Srrs * set this option at the cost of sharing one socket send buffer size amongst 158163953Srrs * all associations. Peeled off sockets turn this option off and block. But 159163953Srrs * since both TCP and peeled off sockets have only one assoc per socket this 160163953Srrs * is fine. It probably does NOT make sense to set this on SS_NBIO on a TCP 161163953Srrs * model OR peeled off UDP model, but we do allow you to do so. You just use 162163953Srrs * the normal syscall to toggle SS_NBIO the way you want. 163163953Srrs * 164215034Sbrucec * Blocking I/O is controlled by the SS_NBIO flag on the socket state so_state 165163953Srrs * field. 166163953Srrs */ 167163953Srrs 168233660Srrs#define SCTP_ENABLE_STREAM_RESET 0x00000900 /* struct 169233660Srrs * sctp_assoc_value */ 170233660Srrs#define SCTP_RESET_STREAMS 0x00000901 /* struct 171233660Srrs * sctp_reset_streams */ 172233660Srrs#define SCTP_RESET_ASSOC 0x00000902 /* sctp_assoc_t */ 173233660Srrs#define SCTP_ADD_STREAMS 0x00000903 /* struct 174233660Srrs * sctp_add_streams */ 175163953Srrs 176233660Srrs/* For enable stream reset */ 177233660Srrs#define SCTP_ENABLE_RESET_STREAM_REQ 0x00000001 178233660Srrs#define SCTP_ENABLE_RESET_ASSOC_REQ 0x00000002 179233660Srrs#define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x00000004 180233660Srrs#define SCTP_ENABLE_VALUE_MASK 0x00000007 181233660Srrs/* For reset streams */ 182233660Srrs#define SCTP_STREAM_RESET_INCOMING 0x00000001 183233660Srrs#define SCTP_STREAM_RESET_OUTGOING 0x00000002 184163953Srrs 185233660Srrs 186163953Srrs/* here on down are more implementation specific */ 187163953Srrs#define SCTP_SET_DEBUG_LEVEL 0x00001005 188163953Srrs#define SCTP_CLR_STAT_LOG 0x00001007 189163953Srrs/* CMT ON/OFF socket option */ 190163953Srrs#define SCTP_CMT_ON_OFF 0x00001200 191163953Srrs#define SCTP_CMT_USE_DAC 0x00001201 192171440Srrs/* JRS - Pluggable Congestion Control Socket option */ 193211944Stuexen#define SCTP_PLUGGABLE_CC 0x00001202 194217760Stuexen/* RS - Pluggable Stream Scheduling Socket option */ 195219057Srrs#define SCTP_PLUGGABLE_SS 0x00001203 196219057Srrs#define SCTP_SS_VALUE 0x00001204 197219057Srrs#define SCTP_CC_OPTION 0x00001205 /* Options for CC 198219057Srrs * modules */ 199163953Srrs/* read only */ 200163953Srrs#define SCTP_GET_SNDBUF_USE 0x00001101 201163953Srrs#define SCTP_GET_STAT_LOG 0x00001103 202169655Srrs#define SCTP_PCB_STATUS 0x00001104 203169655Srrs#define SCTP_GET_NONCE_VALUES 0x00001105 204163953Srrs 205170091Srrs 206167598Srrs/* Special hook for dynamically setting primary for all assoc's, 207215034Sbrucec * this is a write only option that requires root privilege. 208167598Srrs */ 209167598Srrs#define SCTP_SET_DYNAMIC_PRIMARY 0x00002001 210163953Srrs 211167598Srrs/* VRF (virtual router feature) and multi-VRF support 212167598Srrs * options. VRF's provide splits within a router 213167598Srrs * that give the views of multiple routers. A 214167598Srrs * standard host, without VRF support, is just 215167598Srrs * a single VRF. If VRF's are supported then 216167598Srrs * the transport must be VRF aware. This means 217167598Srrs * that every socket call coming in must be directed 218167598Srrs * within the endpoint to one of the VRF's it belongs 219167598Srrs * to. The endpoint, before binding, may select 220167598Srrs * the "default" VRF it is in by using a set socket 221167598Srrs * option with SCTP_VRF_ID. This will also 222215034Sbrucec * get propagated to the default VRF. Once the 223167598Srrs * endpoint binds an address then it CANNOT add 224167598Srrs * additional VRF's to become a Multi-VRF endpoint. 225167598Srrs * 226167598Srrs * Before BINDING additional VRF's can be added with 227167598Srrs * the SCTP_ADD_VRF_ID call or deleted with 228167598Srrs * SCTP_DEL_VRF_ID. 229167598Srrs * 230167598Srrs * Associations are ALWAYS contained inside a single 231167598Srrs * VRF. They cannot reside in two (or more) VRF's. Incoming 232167598Srrs * packets, assuming the router is VRF aware, can always 233167598Srrs * tell us what VRF they arrived on. A host not supporting 234167598Srrs * any VRF's will find that the packets always arrived on the 235167598Srrs * single VRF that the host has. 236167598Srrs * 237167598Srrs */ 238167598Srrs 239167598Srrs#define SCTP_VRF_ID 0x00003001 240167598Srrs#define SCTP_ADD_VRF_ID 0x00003002 241167598Srrs#define SCTP_GET_VRF_IDS 0x00003003 242167598Srrs#define SCTP_GET_ASOC_VRF 0x00003004 243167598Srrs#define SCTP_DEL_VRF_ID 0x00003005 244170091Srrs 245163953Srrs/* 246170091Srrs * If you enable packet logging you can get 247170091Srrs * a poor mans ethereal output in binary 248170091Srrs * form. Note this is a compile option to 249170091Srrs * the kernel, SCTP_PACKET_LOGGING, and 250170091Srrs * without it in your kernel you 251170094Srrs * will get a EOPNOTSUPP 252170091Srrs */ 253170091Srrs#define SCTP_GET_PACKET_LOG 0x00004001 254170091Srrs 255170091Srrs/* 256163953Srrs * hidden implementation specific options these are NOT user visible (should 257163953Srrs * move out of sctp.h) 258163953Srrs */ 259163953Srrs/* sctp_bindx() flags as hidden socket options */ 260163953Srrs#define SCTP_BINDX_ADD_ADDR 0x00008001 261163953Srrs#define SCTP_BINDX_REM_ADDR 0x00008002 262163953Srrs/* Hidden socket option that gets the addresses */ 263163953Srrs#define SCTP_GET_PEER_ADDRESSES 0x00008003 264163953Srrs#define SCTP_GET_LOCAL_ADDRESSES 0x00008004 265163953Srrs/* return the total count in bytes needed to hold all local addresses bound */ 266163953Srrs#define SCTP_GET_LOCAL_ADDR_SIZE 0x00008005 267163953Srrs/* Return the total count in bytes needed to hold the remote address */ 268163953Srrs#define SCTP_GET_REMOTE_ADDR_SIZE 0x00008006 269163953Srrs/* hidden option for connectx */ 270163953Srrs#define SCTP_CONNECT_X 0x00008007 271163953Srrs/* hidden option for connectx_delayed, part of sendx */ 272163953Srrs#define SCTP_CONNECT_X_DELAYED 0x00008008 273163953Srrs#define SCTP_CONNECT_X_COMPLETE 0x00008009 274163953Srrs/* hidden socket option based sctp_peeloff */ 275163953Srrs#define SCTP_PEELOFF 0x0000800a 276163953Srrs/* the real worker for sctp_getaddrlen() */ 277163953Srrs#define SCTP_GET_ADDR_LEN 0x0000800b 278163953Srrs/* Debug things that need to be purged */ 279163953Srrs#define SCTP_SET_INITIAL_DBG_SEQ 0x00009f00 280163953Srrs 281171440Srrs/* JRS - Supported congestion control modules for pluggable 282171440Srrs * congestion control 283171440Srrs */ 284171440Srrs/* Standard TCP Congestion Control */ 285171440Srrs#define SCTP_CC_RFC2581 0x00000000 286171440Srrs/* High Speed TCP Congestion Control (Floyd) */ 287171440Srrs#define SCTP_CC_HSTCP 0x00000001 288171440Srrs/* HTCP Congestion Control */ 289171440Srrs#define SCTP_CC_HTCP 0x00000002 290219120Srrs/* RTCC Congestion Control - RFC2581 plus */ 291219120Srrs#define SCTP_CC_RTCC 0x00000003 292168943Srrs 293219120Srrs#define SCTP_CC_OPT_RTCC_SETMODE 0x00002000 294219120Srrs#define SCTP_CC_OPT_USE_DCCC_ECN 0x00002001 295219397Srrs#define SCTP_CC_OPT_STEADY_STEP 0x00002002 296219120Srrs 297221460Stuexen#define SCTP_CMT_OFF 0 298221460Stuexen#define SCTP_CMT_BASE 1 299221460Stuexen#define SCTP_CMT_RPV1 2 300221460Stuexen#define SCTP_CMT_RPV2 3 301221460Stuexen#define SCTP_CMT_MPTCP 4 302221460Stuexen#define SCTP_CMT_MAX SCTP_CMT_MPTCP 303221460Stuexen 304217760Stuexen/* RS - Supported stream scheduling modules for pluggable 305217760Stuexen * stream scheduling 306217760Stuexen */ 307217760Stuexen/* Default simple round-robin */ 308217760Stuexen#define SCTP_SS_DEFAULT 0x00000000 309217760Stuexen/* Real round-robin */ 310217760Stuexen#define SCTP_SS_ROUND_ROBIN 0x00000001 311217760Stuexen/* Real round-robin per packet */ 312217760Stuexen#define SCTP_SS_ROUND_ROBIN_PACKET 0x00000002 313217760Stuexen/* Priority */ 314217760Stuexen#define SCTP_SS_PRIORITY 0x00000003 315217760Stuexen/* Fair Bandwidth */ 316217760Stuexen#define SCTP_SS_FAIR_BANDWITH 0x00000004 317217760Stuexen/* First-come, first-serve */ 318217760Stuexen#define SCTP_SS_FIRST_COME 0x00000005 319171440Srrs 320217760Stuexen 321168943Srrs/* fragment interleave constants 322168943Srrs * setting must be one of these or 323168943Srrs * EINVAL returned. 324168943Srrs */ 325168943Srrs#define SCTP_FRAG_LEVEL_0 0x00000000 326168943Srrs#define SCTP_FRAG_LEVEL_1 0x00000001 327168943Srrs#define SCTP_FRAG_LEVEL_2 0x00000002 328168943Srrs 329163953Srrs/* 330163953Srrs * user state values 331163953Srrs */ 332163953Srrs#define SCTP_CLOSED 0x0000 333163953Srrs#define SCTP_BOUND 0x1000 334163953Srrs#define SCTP_LISTEN 0x2000 335163953Srrs#define SCTP_COOKIE_WAIT 0x0002 336163953Srrs#define SCTP_COOKIE_ECHOED 0x0004 337163953Srrs#define SCTP_ESTABLISHED 0x0008 338163953Srrs#define SCTP_SHUTDOWN_SENT 0x0010 339163953Srrs#define SCTP_SHUTDOWN_RECEIVED 0x0020 340163953Srrs#define SCTP_SHUTDOWN_ACK_SENT 0x0040 341163953Srrs#define SCTP_SHUTDOWN_PENDING 0x0080 342163953Srrs 343163953Srrs/* 344163953Srrs * SCTP operational error codes (user visible) 345163953Srrs */ 346163953Srrs#define SCTP_CAUSE_NO_ERROR 0x0000 347163953Srrs#define SCTP_CAUSE_INVALID_STREAM 0x0001 348163953Srrs#define SCTP_CAUSE_MISSING_PARAM 0x0002 349163953Srrs#define SCTP_CAUSE_STALE_COOKIE 0x0003 350163953Srrs#define SCTP_CAUSE_OUT_OF_RESC 0x0004 351163953Srrs#define SCTP_CAUSE_UNRESOLVABLE_ADDR 0x0005 352163953Srrs#define SCTP_CAUSE_UNRECOG_CHUNK 0x0006 353163953Srrs#define SCTP_CAUSE_INVALID_PARAM 0x0007 354163953Srrs#define SCTP_CAUSE_UNRECOG_PARAM 0x0008 355163953Srrs#define SCTP_CAUSE_NO_USER_DATA 0x0009 356163953Srrs#define SCTP_CAUSE_COOKIE_IN_SHUTDOWN 0x000a 357163953Srrs#define SCTP_CAUSE_RESTART_W_NEWADDR 0x000b 358163953Srrs#define SCTP_CAUSE_USER_INITIATED_ABT 0x000c 359163953Srrs#define SCTP_CAUSE_PROTOCOL_VIOLATION 0x000d 360163953Srrs 361172190Srrs/* Error causes from RFC5061 */ 362185694Srrs#define SCTP_CAUSE_DELETING_LAST_ADDR 0x00a0 363185694Srrs#define SCTP_CAUSE_RESOURCE_SHORTAGE 0x00a1 364185694Srrs#define SCTP_CAUSE_DELETING_SRC_ADDR 0x00a2 365185694Srrs#define SCTP_CAUSE_ILLEGAL_ASCONF_ACK 0x00a3 366185694Srrs#define SCTP_CAUSE_REQUEST_REFUSED 0x00a4 367163953Srrs 368185694Srrs/* Error causes from nat-draft */ 369185694Srrs#define SCTP_CAUSE_NAT_COLLIDING_STATE 0x00b0 370185694Srrs#define SCTP_CAUSE_NAT_MISSING_STATE 0x00b1 371185694Srrs 372172190Srrs/* Error causes from RFC4895 */ 373163953Srrs#define SCTP_CAUSE_UNSUPPORTED_HMACID 0x0105 374163953Srrs 375163953Srrs/* 376215034Sbrucec * error cause parameters (user visible) 377163953Srrs */ 378267723Stuexenstruct sctp_gen_error_cause { 379267723Stuexen uint16_t code; 380267723Stuexen uint16_t length; 381267723Stuexen uint8_t info[]; 382267723Stuexen} SCTP_PACKED; 383267723Stuexen 384179783Srrsstruct sctp_error_cause { 385179783Srrs uint16_t code; 386179783Srrs uint16_t length; 387179783Srrs /* optional cause-specific info may follow */ 388179783Srrs} SCTP_PACKED; 389163953Srrs 390179783Srrsstruct sctp_error_invalid_stream { 391294158Stuexen struct sctp_error_cause cause; /* code=SCTP_CAUSE_INVALID_STREAM */ 392179783Srrs uint16_t stream_id; /* stream id of the DATA in error */ 393179783Srrs uint16_t reserved; 394179783Srrs} SCTP_PACKED; 395163953Srrs 396179783Srrsstruct sctp_error_missing_param { 397294158Stuexen struct sctp_error_cause cause; /* code=SCTP_CAUSE_MISSING_PARAM */ 398179783Srrs uint32_t num_missing_params; /* number of missing parameters */ 399294158Stuexen uint16_t type[]; 400179783Srrs} SCTP_PACKED; 401163953Srrs 402179783Srrsstruct sctp_error_stale_cookie { 403294158Stuexen struct sctp_error_cause cause; /* code=SCTP_CAUSE_STALE_COOKIE */ 404179783Srrs uint32_t stale_time; /* time in usec of staleness */ 405179783Srrs} SCTP_PACKED; 406163953Srrs 407179783Srrsstruct sctp_error_out_of_resource { 408294158Stuexen struct sctp_error_cause cause; /* code=SCTP_CAUSE_OUT_OF_RESOURCES */ 409179783Srrs} SCTP_PACKED; 410163953Srrs 411179783Srrsstruct sctp_error_unresolv_addr { 412294158Stuexen struct sctp_error_cause cause; /* code=SCTP_CAUSE_UNRESOLVABLE_ADDR */ 413179783Srrs} SCTP_PACKED; 414163953Srrs 415179783Srrsstruct sctp_error_unrecognized_chunk { 416294158Stuexen struct sctp_error_cause cause; /* code=SCTP_CAUSE_UNRECOG_CHUNK */ 417179783Srrs struct sctp_chunkhdr ch;/* header from chunk in error */ 418179783Srrs} SCTP_PACKED; 419163953Srrs 420267729Stuexenstruct sctp_error_no_user_data { 421267729Stuexen struct sctp_error_cause cause; /* code=SCTP_CAUSE_NO_USER_DATA */ 422267729Stuexen uint32_t tsn; /* TSN of the empty data chunk */ 423267729Stuexen} SCTP_PACKED; 424267729Stuexen 425294158Stuexenstruct sctp_error_auth_invalid_hmac { 426294158Stuexen struct sctp_error_cause cause; /* code=SCTP_CAUSE_UNSUPPORTED_HMACID */ 427294158Stuexen uint16_t hmac_id; 428294158Stuexen} SCTP_PACKED; 429294158Stuexen 430163953Srrs/* 431163953Srrs * Main SCTP chunk types we place these here so natd and f/w's in user land 432163953Srrs * can find them. 433163953Srrs */ 434163953Srrs/************0x00 series ***********/ 435163953Srrs#define SCTP_DATA 0x00 436163953Srrs#define SCTP_INITIATION 0x01 437163953Srrs#define SCTP_INITIATION_ACK 0x02 438163953Srrs#define SCTP_SELECTIVE_ACK 0x03 439163953Srrs#define SCTP_HEARTBEAT_REQUEST 0x04 440163953Srrs#define SCTP_HEARTBEAT_ACK 0x05 441163953Srrs#define SCTP_ABORT_ASSOCIATION 0x06 442163953Srrs#define SCTP_SHUTDOWN 0x07 443163953Srrs#define SCTP_SHUTDOWN_ACK 0x08 444163953Srrs#define SCTP_OPERATION_ERROR 0x09 445163953Srrs#define SCTP_COOKIE_ECHO 0x0a 446163953Srrs#define SCTP_COOKIE_ACK 0x0b 447163953Srrs#define SCTP_ECN_ECHO 0x0c 448163953Srrs#define SCTP_ECN_CWR 0x0d 449163953Srrs#define SCTP_SHUTDOWN_COMPLETE 0x0e 450172190Srrs/* RFC4895 */ 451163953Srrs#define SCTP_AUTHENTICATION 0x0f 452185694Srrs/* EY nr_sack chunk id*/ 453254248Stuexen#define SCTP_NR_SELECTIVE_ACK 0x10 454163953Srrs/************0x40 series ***********/ 455163953Srrs/************0x80 series ***********/ 456172190Srrs/* RFC5061 */ 457163953Srrs#define SCTP_ASCONF_ACK 0x80 458163953Srrs/* draft-ietf-stewart-pktdrpsctp */ 459163953Srrs#define SCTP_PACKET_DROPPED 0x81 460163953Srrs/* draft-ietf-stewart-strreset-xxx */ 461163953Srrs#define SCTP_STREAM_RESET 0x82 462170642Srrs 463170642Srrs/* RFC4820 */ 464170642Srrs#define SCTP_PAD_CHUNK 0x84 465163953Srrs/************0xc0 series ***********/ 466163953Srrs/* RFC3758 */ 467163953Srrs#define SCTP_FORWARD_CUM_TSN 0xc0 468172190Srrs/* RFC5061 */ 469163953Srrs#define SCTP_ASCONF 0xc1 470163953Srrs 471163953Srrs 472163953Srrs/* ABORT and SHUTDOWN COMPLETE FLAG */ 473163953Srrs#define SCTP_HAD_NO_TCB 0x01 474163953Srrs 475163953Srrs/* Packet dropped flags */ 476163953Srrs#define SCTP_FROM_MIDDLE_BOX SCTP_HAD_NO_TCB 477163953Srrs#define SCTP_BADCRC 0x02 478163953Srrs#define SCTP_PACKET_TRUNCATED 0x04 479163953Srrs 480218072Srrs/* Flag for ECN -CWR */ 481218072Srrs#define SCTP_CWR_REDUCE_OVERRIDE 0x01 482218072Srrs#define SCTP_CWR_IN_SAME_WINDOW 0x02 483218072Srrs 484163953Srrs#define SCTP_SAT_NETWORK_MIN 400 /* min ms for RTT to set satellite 485163953Srrs * time */ 486163953Srrs#define SCTP_SAT_NETWORK_BURST_INCR 2 /* how many times to multiply maxburst 487163953Srrs * in sat */ 488163953Srrs 489163953Srrs/* Data Chuck Specific Flags */ 490179783Srrs#define SCTP_DATA_FRAG_MASK 0x03 491179783Srrs#define SCTP_DATA_MIDDLE_FRAG 0x00 492179783Srrs#define SCTP_DATA_LAST_FRAG 0x01 493179783Srrs#define SCTP_DATA_FIRST_FRAG 0x02 494179783Srrs#define SCTP_DATA_NOT_FRAG 0x03 495179783Srrs#define SCTP_DATA_UNORDERED 0x04 496179783Srrs#define SCTP_DATA_SACK_IMMEDIATELY 0x08 497163953Srrs/* ECN Nonce: SACK Chunk Specific Flags */ 498179783Srrs#define SCTP_SACK_NONCE_SUM 0x01 499163953Srrs 500163953Srrs/* CMT DAC algorithm SACK flag */ 501179783Srrs#define SCTP_SACK_CMT_DAC 0x80 502163953Srrs 503168945Srrs/* 504168945Srrs * PCB flags (in sctp_flags bitmask). 505168945Srrs * Note the features and flags are meant 506168945Srrs * for use by netstat. 507168945Srrs */ 508168945Srrs#define SCTP_PCB_FLAGS_UDPTYPE 0x00000001 509168945Srrs#define SCTP_PCB_FLAGS_TCPTYPE 0x00000002 510168945Srrs#define SCTP_PCB_FLAGS_BOUNDALL 0x00000004 511168945Srrs#define SCTP_PCB_FLAGS_ACCEPTING 0x00000008 512168945Srrs#define SCTP_PCB_FLAGS_UNBOUND 0x00000010 513168945Srrs#define SCTP_PCB_FLAGS_CLOSE_IP 0x00040000 514168945Srrs#define SCTP_PCB_FLAGS_WAS_CONNECTED 0x00080000 515168945Srrs#define SCTP_PCB_FLAGS_WAS_ABORTED 0x00100000 516168945Srrs/* TCP model support */ 517168945Srrs 518168945Srrs#define SCTP_PCB_FLAGS_CONNECTED 0x00200000 519168945Srrs#define SCTP_PCB_FLAGS_IN_TCPPOOL 0x00400000 520168945Srrs#define SCTP_PCB_FLAGS_DONT_WAKE 0x00800000 521168945Srrs#define SCTP_PCB_FLAGS_WAKEOUTPUT 0x01000000 522168945Srrs#define SCTP_PCB_FLAGS_WAKEINPUT 0x02000000 523168945Srrs#define SCTP_PCB_FLAGS_BOUND_V6 0x04000000 524179141Srrs#define SCTP_PCB_FLAGS_BLOCKING_IO 0x08000000 525179141Srrs#define SCTP_PCB_FLAGS_SOCKET_GONE 0x10000000 526179141Srrs#define SCTP_PCB_FLAGS_SOCKET_ALLGONE 0x20000000 527209289Stuexen#define SCTP_PCB_FLAGS_SOCKET_CANT_READ 0x40000000 528246595Stuexen 529168945Srrs/* flags to copy to new PCB */ 530179141Srrs#define SCTP_PCB_COPY_FLAGS (SCTP_PCB_FLAGS_BOUNDALL|\ 531179141Srrs SCTP_PCB_FLAGS_WAKEINPUT|\ 532179141Srrs SCTP_PCB_FLAGS_BOUND_V6) 533168945Srrs 534168945Srrs/* 535168945Srrs * PCB Features (in sctp_features bitmask) 536168945Srrs */ 537254248Stuexen#define SCTP_PCB_FLAGS_DO_NOT_PMTUD 0x0000000000000001 538254248Stuexen#define SCTP_PCB_FLAGS_EXT_RCVINFO 0x0000000000000002 /* deprecated */ 539254248Stuexen#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT 0x0000000000000004 540254248Stuexen#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE 0x0000000000000008 541254248Stuexen#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS 0x0000000000000010 542254248Stuexen#define SCTP_PCB_FLAGS_DO_ASCONF 0x0000000000000020 543254248Stuexen#define SCTP_PCB_FLAGS_AUTO_ASCONF 0x0000000000000040 544254248Stuexen#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x0000000000000080 545168945Srrs/* socket options */ 546254248Stuexen#define SCTP_PCB_FLAGS_NODELAY 0x0000000000000100 547254248Stuexen#define SCTP_PCB_FLAGS_AUTOCLOSE 0x0000000000000200 548254248Stuexen#define SCTP_PCB_FLAGS_RECVDATAIOEVNT 0x0000000000000400 /* deprecated */ 549254248Stuexen#define SCTP_PCB_FLAGS_RECVASSOCEVNT 0x0000000000000800 550254248Stuexen#define SCTP_PCB_FLAGS_RECVPADDREVNT 0x0000000000001000 551254248Stuexen#define SCTP_PCB_FLAGS_RECVPEERERR 0x0000000000002000 552254248Stuexen#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT 0x0000000000004000 /* deprecated */ 553254248Stuexen#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT 0x0000000000008000 554254248Stuexen#define SCTP_PCB_FLAGS_ADAPTATIONEVNT 0x0000000000010000 555254248Stuexen#define SCTP_PCB_FLAGS_PDAPIEVNT 0x0000000000020000 556254248Stuexen#define SCTP_PCB_FLAGS_AUTHEVNT 0x0000000000040000 557254248Stuexen#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x0000000000080000 558254248Stuexen#define SCTP_PCB_FLAGS_NO_FRAGMENT 0x0000000000100000 559254248Stuexen#define SCTP_PCB_FLAGS_EXPLICIT_EOR 0x0000000000400000 560254248Stuexen#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 0x0000000000800000 561254248Stuexen#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS 0x0000000001000000 562254248Stuexen#define SCTP_PCB_FLAGS_PORTREUSE 0x0000000002000000 563254248Stuexen#define SCTP_PCB_FLAGS_DRYEVNT 0x0000000004000000 564254248Stuexen#define SCTP_PCB_FLAGS_RECVRCVINFO 0x0000000008000000 565254248Stuexen#define SCTP_PCB_FLAGS_RECVNXTINFO 0x0000000010000000 566254248Stuexen#define SCTP_PCB_FLAGS_ASSOC_RESETEVNT 0x0000000020000000 567254248Stuexen#define SCTP_PCB_FLAGS_STREAM_CHANGEEVNT 0x0000000040000000 568254248Stuexen#define SCTP_PCB_FLAGS_RECVNSENDFAILEVNT 0x0000000080000000 569223132Stuexen 570171990Srrs/*- 571171990Srrs * mobility_features parameters (by micchie).Note 572171990Srrs * these features are applied against the 573171990Srrs * sctp_mobility_features flags.. not the sctp_features 574171990Srrs * flags. 575171990Srrs */ 576235009Stuexen#define SCTP_MOBILITY_BASE 0x00000001 577235009Stuexen#define SCTP_MOBILITY_FASTHANDOFF 0x00000002 578235009Stuexen#define SCTP_MOBILITY_PRIM_DELETED 0x00000004 579171990Srrs 580171990Srrs 581170056Srrs#define SCTP_SMALLEST_PMTU 512 /* smallest pmtu allowed when disabling PMTU 582170056Srrs * discovery */ 583170056Srrs 584235990Stuexen#undef SCTP_PACKED 585235990Stuexen 586163953Srrs#include <netinet/sctp_uio.h> 587163953Srrs 588170744Srrs/* This dictates the size of the packet 589170744Srrs * collection buffer. This only applies 590170744Srrs * if SCTP_PACKET_LOGGING is enabled in 591170744Srrs * your config. 592170744Srrs */ 593170091Srrs#define SCTP_PACKET_LOG_SIZE 65536 594170091Srrs 595171477Srrs/* Maximum delays and such a user can set for options that 596171477Srrs * take ms. 597171477Srrs */ 598171477Srrs#define SCTP_MAX_SACK_DELAY 500 /* per RFC4960 */ 599171477Srrs#define SCTP_MAX_HB_INTERVAL 14400000 /* 4 hours in ms */ 600171477Srrs#define SCTP_MAX_COOKIE_LIFE 3600000 /* 1 hour in ms */ 601171477Srrs 602171477Srrs 603170744Srrs/* Types of logging/KTR tracing that can be enabled via the 604170744Srrs * sysctl net.inet.sctp.sctp_logging. You must also enable 605170744Srrs * SUBSYS tracing. 606170744Srrs * Note that you must have the SCTP option in the kernel 607170744Srrs * to enable these as well. 608170744Srrs */ 609170744Srrs#define SCTP_BLK_LOGGING_ENABLE 0x00000001 610170744Srrs#define SCTP_CWND_MONITOR_ENABLE 0x00000002 611170744Srrs#define SCTP_CWND_LOGGING_ENABLE 0x00000004 612170744Srrs#define SCTP_FLIGHT_LOGGING_ENABLE 0x00000020 613170744Srrs#define SCTP_FR_LOGGING_ENABLE 0x00000040 614170744Srrs#define SCTP_LOCK_LOGGING_ENABLE 0x00000080 615170744Srrs#define SCTP_MAP_LOGGING_ENABLE 0x00000100 616170744Srrs#define SCTP_MBCNT_LOGGING_ENABLE 0x00000200 617170744Srrs#define SCTP_MBUF_LOGGING_ENABLE 0x00000400 618170744Srrs#define SCTP_NAGLE_LOGGING_ENABLE 0x00000800 619224641Stuexen#define SCTP_RECV_RWND_LOGGING_ENABLE 0x00001000 620170744Srrs#define SCTP_RTTVAR_LOGGING_ENABLE 0x00002000 621170744Srrs#define SCTP_SACK_LOGGING_ENABLE 0x00004000 622224641Stuexen#define SCTP_SACK_RWND_LOGGING_ENABLE 0x00008000 623170744Srrs#define SCTP_SB_LOGGING_ENABLE 0x00010000 624170744Srrs#define SCTP_STR_LOGGING_ENABLE 0x00020000 625170744Srrs#define SCTP_WAKE_LOGGING_ENABLE 0x00040000 626170744Srrs#define SCTP_LOG_MAXBURST_ENABLE 0x00080000 627170744Srrs#define SCTP_LOG_RWND_ENABLE 0x00100000 628224641Stuexen#define SCTP_LOG_SACK_ARRIVALS_ENABLE 0x00200000 629224641Stuexen#define SCTP_LTRACE_CHUNK_ENABLE 0x00400000 630224641Stuexen#define SCTP_LTRACE_ERROR_ENABLE 0x00800000 631224641Stuexen#define SCTP_LAST_PACKET_TRACING 0x01000000 632224641Stuexen#define SCTP_THRESHOLD_LOGGING 0x02000000 633224641Stuexen#define SCTP_LOG_AT_SEND_2_SCTP 0x04000000 634224641Stuexen#define SCTP_LOG_AT_SEND_2_OUTQ 0x08000000 635224641Stuexen#define SCTP_LOG_TRY_ADVANCE 0x10000000 636170091Srrs 637163953Srrs#endif /* !_NETINET_SCTP_H_ */ 638