sctp_constants.h revision 235416
1234353Sdim/*- 2234353Sdim * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 3353358Sdim * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. 4353358Sdim * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. 5353358Sdim * 6193323Sed * Redistribution and use in source and binary forms, with or without 7193323Sed * modification, are permitted provided that the following conditions are met: 8193323Sed * 9193323Sed * a) Redistributions of source code must retain the above copyright notice, 10193323Sed * this list of conditions and the following disclaimer. 11193323Sed * 12193323Sed * b) Redistributions in binary form must reproduce the above copyright 13193323Sed * notice, this list of conditions and the following disclaimer in 14193323Sed * the documentation and/or other materials provided with the distribution. 15193323Sed * 16193323Sed * c) Neither the name of Cisco Systems, Inc. nor the names of its 17193323Sed * contributors may be used to endorse or promote products derived 18193323Sed * from this software without specific prior written permission. 19353358Sdim * 20353358Sdim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21353358Sdim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22353358Sdim * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23353358Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24353358Sdim * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25239462Sdim * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26193323Sed * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27193323Sed * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28193323Sed * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29193323Sed * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30218893Sdim * THE POSSIBILITY OF SUCH DAMAGE. 31193323Sed */ 32360784Sdim 33218893Sdim/* $KAME: sctp_constants.h,v 1.17 2005/03/06 16:04:17 itojun Exp $ */ 34193323Sed 35218893Sdim#include <sys/cdefs.h> 36193323Sed__FBSDID("$FreeBSD: head/sys/netinet/sctp_constants.h 235416 2012-05-13 19:32:49Z tuexen $"); 37218893Sdim 38218893Sdim#ifndef __sctp_constants_h__ 39353358Sdim#define __sctp_constants_h__ 40360784Sdim 41353358Sdim/* IANA assigned port number for SCTP over UDP encapsulation */ 42239462Sdim/* For freebsd we cannot bind the port at 43353358Sdim * startup. Otherwise what will happen is 44353358Sdim * we really won't be bound. The user must 45193323Sed * put it into the sysctl... or we need 46218893Sdim * to build a special timer for this to allow 47218893Sdim * us to wait 1 second or so after the system 48193323Sed * comes up. 49353358Sdim */ 50353358Sdim#define SCTP_OVER_UDP_TUNNELING_PORT 0 51353358Sdim/* Number of packets to get before sack sent by default */ 52353358Sdim#define SCTP_DEFAULT_SACK_FREQ 2 53353358Sdim 54353358Sdim/* Address limit - This variable is calculated 55353358Sdim * based on an 65535 byte max ip packet. We take out 100 bytes 56353358Sdim * for the cookie, 40 bytes for a v6 header and 32 57353358Sdim * bytes for the init structure. A second init structure 58353358Sdim * for the init-ack and then finally a third one for the 59353358Sdim * imbedded init. This yeilds 100+40+(3 * 32) = 236 bytes. 60353358Sdim * This leaves 65299 bytes for addresses. We throw out the 299 bytes. 61353358Sdim * Now whatever we send in the INIT() we need to allow to get back in the 62353358Sdim * INIT-ACK plus all the values from INIT and INIT-ACK 63353358Sdim * listed in the cookie. Plus we need some overhead for 64353358Sdim * maybe copied parameters in the COOKIE. If we 65353358Sdim * allow 1080 addresses, and each side has 1080 V6 addresses 66353358Sdim * that will be 21600 bytes. In the INIT-ACK we will 67353358Sdim * see the INIT-ACK 21600 + 43200 in the cookie. This leaves 68353358Sdim * about 500 bytes slack for misc things in the cookie. 69353358Sdim */ 70353358Sdim#define SCTP_ADDRESS_LIMIT 1080 71353358Sdim 72353358Sdim/* We need at least 2k of space for us, inits 73353358Sdim * larger than that lets abort. 74353358Sdim */ 75353358Sdim#define SCTP_LARGEST_INIT_ACCEPTED (65535 - 2048) 76353358Sdim 77353358Sdim/* Number of addresses where we just skip the counting */ 78353358Sdim#define SCTP_COUNT_LIMIT 40 79353358Sdim 80353358Sdim#define SCTP_ZERO_COPY_TICK_DELAY (((100 * hz) + 999) / 1000) 81353358Sdim#define SCTP_ZERO_COPY_SENDQ_TICK_DELAY (((100 * hz) + 999) / 1000) 82353358Sdim 83353358Sdim/* Number of ticks to delay before running 84353358Sdim * iterator on an address change. 85353358Sdim */ 86353358Sdim#define SCTP_ADDRESS_TICK_DELAY 2 87353358Sdim 88353358Sdim#define SCTP_VERSION_STRING "KAME-BSD 1.1" 89353358Sdim/* #define SCTP_AUDITING_ENABLED 1 used for debug/auditing */ 90353358Sdim#define SCTP_AUDIT_SIZE 256 91353358Sdim 92353358Sdim 93353358Sdim#define SCTP_KTRHEAD_NAME "sctp_iterator" 94353358Sdim#define SCTP_KTHREAD_PAGES 0 95353358Sdim 96353358Sdim#define SCTP_MCORE_NAME "sctp_core_worker" 97353358Sdim 98353358Sdim 99353358Sdim/* If you support Multi-VRF how big to 100353358Sdim * make the initial array of VRF's to. 101353358Sdim */ 102353358Sdim#define SCTP_DEFAULT_VRF_SIZE 4 103353358Sdim 104193323Sed/* constants for rto calc */ 105193323Sed#define sctp_align_safe_nocopy 0 106193323Sed#define sctp_align_unsafe_makecopy 1 107193323Sed 108327952Sdim/* JRS - Values defined for the HTCP algorithm */ 109327952Sdim#define ALPHA_BASE (1<<7) /* 1.0 with shift << 7 */ 110193323Sed#define BETA_MIN (1<<6) /* 0.5 with shift << 7 */ 111193323Sed#define BETA_MAX 102 /* 0.8 with shift << 7 */ 112327952Sdim 113327952Sdim/* Places that CWND log can happen from */ 114193323Sed#define SCTP_CWND_LOG_FROM_FR 1 115193323Sed#define SCTP_CWND_LOG_FROM_RTX 2 116327952Sdim#define SCTP_CWND_LOG_FROM_BRST 3 117327952Sdim#define SCTP_CWND_LOG_FROM_SS 4 118193323Sed#define SCTP_CWND_LOG_FROM_CA 5 119193323Sed#define SCTP_CWND_LOG_FROM_SAT 6 120327952Sdim#define SCTP_BLOCK_LOG_INTO_BLK 7 121327952Sdim#define SCTP_BLOCK_LOG_OUTOF_BLK 8 122193323Sed#define SCTP_BLOCK_LOG_CHECK 9 123193323Sed#define SCTP_STR_LOG_FROM_INTO_STRD 10 124327952Sdim#define SCTP_STR_LOG_FROM_IMMED_DEL 11 125353358Sdim#define SCTP_STR_LOG_FROM_INSERT_HD 12 126353358Sdim#define SCTP_STR_LOG_FROM_INSERT_MD 13 127353358Sdim#define SCTP_STR_LOG_FROM_INSERT_TL 14 128218893Sdim#define SCTP_STR_LOG_FROM_MARK_TSN 15 129193323Sed#define SCTP_STR_LOG_FROM_EXPRS_DEL 16 130218893Sdim#define SCTP_FR_LOG_BIGGEST_TSNS 17 131193323Sed#define SCTP_FR_LOG_STRIKE_TEST 18 132218893Sdim#define SCTP_FR_LOG_STRIKE_CHUNK 19 133193323Sed#define SCTP_FR_T3_TIMEOUT 20 134218893Sdim#define SCTP_MAP_PREPARE_SLIDE 21 135193323Sed#define SCTP_MAP_SLIDE_FROM 22 136218893Sdim#define SCTP_MAP_SLIDE_RESULT 23 137193323Sed#define SCTP_MAP_SLIDE_CLEARED 24 138218893Sdim#define SCTP_MAP_SLIDE_NONE 25 139193323Sed#define SCTP_FR_T3_MARK_TIME 26 140218893Sdim#define SCTP_FR_T3_MARKED 27 141193323Sed#define SCTP_FR_T3_STOPPED 28 142218893Sdim#define SCTP_FR_MARKED 30 143193323Sed#define SCTP_CWND_LOG_NOADV_SS 31 144218893Sdim#define SCTP_CWND_LOG_NOADV_CA 32 145193323Sed#define SCTP_MAX_BURST_APPLIED 33 146193323Sed#define SCTP_MAX_IFP_APPLIED 34 147193323Sed#define SCTP_MAX_BURST_ERROR_STOP 35 148193323Sed#define SCTP_INCREASE_PEER_RWND 36 149193323Sed#define SCTP_DECREASE_PEER_RWND 37 150193323Sed#define SCTP_SET_PEER_RWND_VIA_SACK 38 151280031Sdim#define SCTP_LOG_MBCNT_INCREASE 39 152193323Sed#define SCTP_LOG_MBCNT_DECREASE 40 153193323Sed#define SCTP_LOG_MBCNT_CHKSET 41 154193323Sed#define SCTP_LOG_NEW_SACK 42 155193323Sed#define SCTP_LOG_TSN_ACKED 43 156193323Sed#define SCTP_LOG_TSN_REVOKED 44 157193323Sed#define SCTP_LOG_LOCK_TCB 45 158193323Sed#define SCTP_LOG_LOCK_INP 46 159193323Sed#define SCTP_LOG_LOCK_SOCK 47 160280031Sdim#define SCTP_LOG_LOCK_SOCKBUF_R 48 161193323Sed#define SCTP_LOG_LOCK_SOCKBUF_S 49 162193323Sed#define SCTP_LOG_LOCK_CREATE 50 163193323Sed#define SCTP_LOG_INITIAL_RTT 51 164193323Sed#define SCTP_LOG_RTTVAR 52 165193323Sed#define SCTP_LOG_SBALLOC 53 166193323Sed#define SCTP_LOG_SBFREE 54 167212904Sdim#define SCTP_LOG_SBRESULT 55 168193323Sed#define SCTP_FR_DUPED 56 169193323Sed#define SCTP_FR_MARKED_EARLY 57 170193323Sed#define SCTP_FR_CWND_REPORT 58 171341825Sdim#define SCTP_FR_CWND_REPORT_START 59 172341825Sdim#define SCTP_FR_CWND_REPORT_STOP 60 173341825Sdim#define SCTP_CWND_LOG_FROM_SEND 61 174341825Sdim#define SCTP_CWND_INITIALIZATION 62 175193323Sed#define SCTP_CWND_LOG_FROM_T3 63 176193323Sed#define SCTP_CWND_LOG_FROM_SACK 64 177193323Sed#define SCTP_CWND_LOG_NO_CUMACK 65 178193323Sed#define SCTP_CWND_LOG_FROM_RESEND 66 179193323Sed#define SCTP_FR_LOG_CHECK_STRIKE 67 180193323Sed#define SCTP_SEND_NOW_COMPLETES 68 181193323Sed#define SCTP_CWND_LOG_FILL_OUTQ_CALLED 69 182193323Sed#define SCTP_CWND_LOG_FILL_OUTQ_FILLS 70 183193323Sed#define SCTP_LOG_FREE_SENT 71 184193323Sed#define SCTP_NAGLE_APPLIED 72 185193323Sed#define SCTP_NAGLE_SKIPPED 73 186193323Sed#define SCTP_WAKESND_FROM_SACK 74 187193323Sed#define SCTP_WAKESND_FROM_FWDTSN 75 188193323Sed#define SCTP_NOWAKE_FROM_SACK 76 189193323Sed#define SCTP_CWNDLOG_PRESEND 77 190296417Sdim#define SCTP_CWNDLOG_ENDSEND 78 191296417Sdim#define SCTP_AT_END_OF_SACK 79 192193323Sed#define SCTP_REASON_FOR_SC 80 193280031Sdim#define SCTP_BLOCK_LOG_INTO_BLKA 81 194201360Srdivacky#define SCTP_ENTER_USER_RECV 82 195296417Sdim#define SCTP_USER_RECV_SACKS 83 196296417Sdim#define SCTP_SORECV_BLOCKSA 84 197296417Sdim#define SCTP_SORECV_BLOCKSB 85 198296417Sdim#define SCTP_SORECV_DONE 86 199296417Sdim#define SCTP_SACK_RWND_UPDATE 87 200280031Sdim#define SCTP_SORECV_ENTER 88 201201360Srdivacky#define SCTP_SORECV_ENTERPL 89 202296417Sdim#define SCTP_MBUF_INPUT 90 203296417Sdim#define SCTP_MBUF_IALLOC 91 204296417Sdim#define SCTP_MBUF_IFREE 92 205296417Sdim#define SCTP_MBUF_ICOPY 93 206296417Sdim#define SCTP_MBUF_SPLIT 94 207280031Sdim#define SCTP_SORCV_FREECTL 95 208201360Srdivacky#define SCTP_SORCV_DOESCPY 96 209296417Sdim#define SCTP_SORCV_DOESLCK 97 210296417Sdim#define SCTP_SORCV_DOESADJ 98 211296417Sdim#define SCTP_SORCV_BOTWHILE 99 212296417Sdim#define SCTP_SORCV_PASSBF 100 213296417Sdim#define SCTP_SORCV_ADJD 101 214280031Sdim#define SCTP_UNKNOWN_MAX 102 215201360Srdivacky#define SCTP_RANDY_STUFF 103 216296417Sdim#define SCTP_RANDY_STUFF1 104 217296417Sdim#define SCTP_STRMOUT_LOG_ASSIGN 105 218296417Sdim#define SCTP_STRMOUT_LOG_SEND 106 219296417Sdim#define SCTP_FLIGHT_LOG_DOWN_CA 107 220296417Sdim#define SCTP_FLIGHT_LOG_UP 108 221280031Sdim#define SCTP_FLIGHT_LOG_DOWN_GAP 109 222201360Srdivacky#define SCTP_FLIGHT_LOG_DOWN_RSND 110 223296417Sdim#define SCTP_FLIGHT_LOG_UP_RSND 111 224296417Sdim#define SCTP_FLIGHT_LOG_DOWN_RSND_TO 112 225296417Sdim#define SCTP_FLIGHT_LOG_DOWN_WP 113 226296417Sdim#define SCTP_FLIGHT_LOG_UP_REVOKE 114 227296417Sdim#define SCTP_FLIGHT_LOG_DOWN_PDRP 115 228353358Sdim#define SCTP_FLIGHT_LOG_DOWN_PMTU 116 229280031Sdim#define SCTP_SACK_LOG_NORMAL 117 230296417Sdim#define SCTP_SACK_LOG_EXPRESS 118 231353358Sdim#define SCTP_MAP_TSN_ENTERS 119 232280031Sdim#define SCTP_THRESHOLD_CLEAR 120 233296417Sdim#define SCTP_THRESHOLD_INCR 121 234193323Sed#define SCTP_FLIGHT_LOG_DWN_WP_FWD 122 235280031Sdim#define SCTP_FWD_TSN_CHECK 123 236201360Srdivacky#define SCTP_LOG_MAX_TYPES 124 237296417Sdim/* 238296417Sdim * To turn on various logging, you must first enable 'options KTR' and 239353358Sdim * you might want to bump the entires 'options KTR_ENTRIES=80000'. 240296417Sdim * To get something to log you define one of the logging defines. 241353358Sdim * (see LINT). 242280031Sdim * 243201360Srdivacky * This gets the compile in place, but you still need to turn the 244296417Sdim * logging flag on too in the sysctl (see in sctp.h). 245296417Sdim */ 246353358Sdim 247296417Sdim#define SCTP_LOG_EVENT_UNKNOWN 0 248353358Sdim#define SCTP_LOG_EVENT_CWND 1 249280031Sdim#define SCTP_LOG_EVENT_BLOCK 2 250201360Srdivacky#define SCTP_LOG_EVENT_STRM 3 251296417Sdim#define SCTP_LOG_EVENT_FR 4 252296417Sdim#define SCTP_LOG_EVENT_MAP 5 253353358Sdim#define SCTP_LOG_EVENT_MAXBURST 6 254296417Sdim#define SCTP_LOG_EVENT_RWND 7 255353358Sdim#define SCTP_LOG_EVENT_MBCNT 8 256280031Sdim#define SCTP_LOG_EVENT_SACK 9 257201360Srdivacky#define SCTP_LOG_LOCK_EVENT 10 258296417Sdim#define SCTP_LOG_EVENT_RTT 11 259296417Sdim#define SCTP_LOG_EVENT_SB 12 260353358Sdim#define SCTP_LOG_EVENT_NAGLE 13 261296417Sdim#define SCTP_LOG_EVENT_WAKE 14 262353358Sdim#define SCTP_LOG_MISC_EVENT 15 263280031Sdim#define SCTP_LOG_EVENT_CLOSE 16 264296417Sdim#define SCTP_LOG_EVENT_MBUF 17 265296417Sdim#define SCTP_LOG_CHUNK_PROC 18 266296417Sdim#define SCTP_LOG_ERROR_RET 19 267353358Sdim 268296417Sdim#define SCTP_LOG_MAX_EVENT 20 269353358Sdim 270280031Sdim#define SCTP_LOCK_UNKNOWN 2 271296417Sdim 272296417Sdim 273296417Sdim/* number of associations by default for zone allocation */ 274353358Sdim#define SCTP_MAX_NUM_OF_ASOC 40000 275296417Sdim/* how many addresses per assoc remote and local */ 276353358Sdim#define SCTP_SCALE_FOR_ADDR 2 277353358Sdim 278280031Sdim/* default AUTO_ASCONF mode enable(1)/disable(0) value (sysctl) */ 279296417Sdim#define SCTP_DEFAULT_AUTO_ASCONF 1 280353358Sdim 281280031Sdim/* default MULTIPLE_ASCONF mode enable(1)/disable(0) value (sysctl) */ 282296417Sdim#define SCTP_DEFAULT_MULTIPLE_ASCONFS 0 283193323Sed 284193323Sed/* default MOBILITY_BASE mode enable(1)/disable(0) value (sysctl) */ 285360784Sdim#define SCTP_DEFAULT_MOBILITY_BASE 0 286276479Sdim 287276479Sdim/* default MOBILITY_FASTHANDOFF mode enable(1)/disable(0) value (sysctl) */ 288327952Sdim#define SCTP_DEFAULT_MOBILITY_FASTHANDOFF 0 289360784Sdim 290360784Sdim/* 291360784Sdim * Theshold for rwnd updates, we have to read (sb_hiwat >> 292360784Sdim * SCTP_RWND_HIWAT_SHIFT) before we will look to see if we need to send a 293327952Sdim * window update sack. When we look, we compare the last rwnd we sent vs the 294327952Sdim * current rwnd. It too must be greater than this value. Using 3 divdes the 295276479Sdim * hiwat by 8, so for 200k rwnd we need to read 24k. For a 64k rwnd we need 296276479Sdim * to read 8k. This seems about right.. I hope :-D.. we do set a 297360784Sdim * min of a MTU on it so if the rwnd is real small we will insist 298360784Sdim * on a full MTU of 1500 bytes. 299360784Sdim */ 300276479Sdim#define SCTP_RWND_HIWAT_SHIFT 3 301327952Sdim 302276479Sdim/* How much of the rwnd must the 303360784Sdim * message be taking up to start partial delivery. 304276479Sdim * We calculate this by shifing the hi_water (recv_win) 305327952Sdim * left the following .. set to 1, when a message holds 306276479Sdim * 1/2 the rwnd. If we set it to 2 when a message holds 307360784Sdim * 1/4 the rwnd...etc.. 308360784Sdim */ 309239462Sdim 310360784Sdim#define SCTP_PARTIAL_DELIVERY_SHIFT 1 311193323Sed 312276479Sdim/* 313344779Sdim * default HMAC for cookies, etc... use one of the AUTH HMAC id's 314276479Sdim * SCTP_HMAC is the HMAC_ID to use 315344779Sdim * SCTP_SIGNATURE_SIZE is the digest length 316276479Sdim */ 317344779Sdim#define SCTP_HMAC SCTP_AUTH_HMAC_ID_SHA1 318193323Sed#define SCTP_SIGNATURE_SIZE SCTP_AUTH_DIGEST_LEN_SHA1 319193323Sed#define SCTP_SIGNATURE_ALOC_SIZE SCTP_SIGNATURE_SIZE 320193323Sed 321193323Sed/* 322360784Sdim * the SCTP protocol signature this includes the version number encoded in 323344779Sdim * the last 4 bits of the signature. 324344779Sdim */ 325344779Sdim#define PROTO_SIGNATURE_A 0x30000000 326344779Sdim#define SCTP_VERSION_NUMBER 0x3 327344779Sdim 328344779Sdim#define MAX_TSN 0xffffffff 329344779Sdim 330344779Sdim/* how many executions every N tick's */ 331344779Sdim#define SCTP_ITERATOR_MAX_AT_ONCE 20 332341825Sdim 333360784Sdim/* number of clock ticks between iterator executions */ 334327952Sdim#define SCTP_ITERATOR_TICKS 1 335327952Sdim 336276479Sdim/* 337360784Sdim * option: If you comment out the following you will receive the old behavior 338344779Sdim * of obeying cwnd for the fast retransmit algorithm. With this defined a FR 339344779Sdim * happens right away with-out waiting for the flightsize to drop below the 340344779Sdim * cwnd value (which is reduced by the FR to 1/2 the inflight packets). 341276479Sdim */ 342360784Sdim#define SCTP_IGNORE_CWND_ON_FR 1 343344779Sdim 344344779Sdim/* 345344779Sdim * Adds implementors guide behavior to only use newest highest update in SACK 346344779Sdim * gap ack's to figure out if you need to stroke a chunk for FR. 347344779Sdim */ 348344779Sdim#define SCTP_NO_FR_UNLESS_SEGMENT_SMALLER 1 349276479Sdim 350193323Sed/* default max I can burst out after a fast retransmit, 0 disables it */ 351193323Sed#define SCTP_DEF_MAX_BURST 0 352341825Sdim#define SCTP_DEF_HBMAX_BURST 4 353193323Sed#define SCTP_DEF_FRMAX_BURST 4 354341825Sdim 355193323Sed/* RTO calculation flag to say if it 356341825Sdim * is safe to determine local lan or not. 357193323Sed */ 358341825Sdim#define SCTP_RTT_FROM_NON_DATA 0 359341825Sdim#define SCTP_RTT_FROM_DATA 1 360193323Sed 361193323Sed 362341825Sdim/* IP hdr (20/40) + 12+2+2 (enet) + sctp common 12 */ 363341825Sdim#define SCTP_FIRST_MBUF_RESV 68 364341825Sdim/* Packet transmit states in the sent field */ 365276479Sdim#define SCTP_DATAGRAM_UNSENT 0 366193323Sed#define SCTP_DATAGRAM_SENT 1 367360784Sdim#define SCTP_DATAGRAM_RESEND1 2 /* not used (in code, but may 368341825Sdim * hit this value) */ 369360784Sdim#define SCTP_DATAGRAM_RESEND2 3 /* not used (in code, but may 370327952Sdim * hit this value) */ 371341825Sdim#define SCTP_DATAGRAM_RESEND 4 372280031Sdim#define SCTP_DATAGRAM_ACKED 10010 373193323Sed#define SCTP_DATAGRAM_MARKED 20010 374193323Sed#define SCTP_FORWARD_TSN_SKIP 30010 375193323Sed 376327952Sdim/* chunk output send from locations */ 377327952Sdim#define SCTP_OUTPUT_FROM_USR_SEND 0 378341825Sdim#define SCTP_OUTPUT_FROM_T3 1 379327952Sdim#define SCTP_OUTPUT_FROM_INPUT_ERROR 2 380360784Sdim#define SCTP_OUTPUT_FROM_CONTROL_PROC 3 381193323Sed#define SCTP_OUTPUT_FROM_SACK_TMR 4 382198090Srdivacky#define SCTP_OUTPUT_FROM_SHUT_TMR 5 383198090Srdivacky#define SCTP_OUTPUT_FROM_HB_TMR 6 384360784Sdim#define SCTP_OUTPUT_FROM_SHUT_ACK_TMR 7 385207618Srdivacky#define SCTP_OUTPUT_FROM_ASCONF_TMR 8 386207618Srdivacky#define SCTP_OUTPUT_FROM_STRRST_TMR 9 387198090Srdivacky#define SCTP_OUTPUT_FROM_AUTOCLOSE_TMR 10 388327952Sdim#define SCTP_OUTPUT_FROM_EARLY_FR_TMR 11 389327952Sdim#define SCTP_OUTPUT_FROM_STRRST_REQ 12 390198090Srdivacky#define SCTP_OUTPUT_FROM_USR_RCVD 13 391327952Sdim#define SCTP_OUTPUT_FROM_COOKIE_ACK 14 392327952Sdim#define SCTP_OUTPUT_FROM_DRAIN 15 393327952Sdim#define SCTP_OUTPUT_FROM_CLOSING 16 394198090Srdivacky#define SCTP_OUTPUT_FROM_SOCKOPT 17 395198090Srdivacky 396327952Sdim/* SCTP chunk types are moved sctp.h for application (NAT, FW) use */ 397198090Srdivacky 398327952Sdim/* align to 32-bit sizes */ 399360784Sdim#define SCTP_SIZE32(x) ((((x) + 3) >> 2) << 2) 400327952Sdim 401360784Sdim#define IS_SCTP_CONTROL(a) ((a)->chunk_type != SCTP_DATA) 402360784Sdim#define IS_SCTP_DATA(a) ((a)->chunk_type == SCTP_DATA) 403360784Sdim 404360784Sdim 405327952Sdim/* SCTP parameter types */ 406360784Sdim/*************0x0000 series*************/ 407360784Sdim#define SCTP_HEARTBEAT_INFO 0x0001 408198090Srdivacky#define SCTP_IPV4_ADDRESS 0x0005 409360784Sdim#define SCTP_IPV6_ADDRESS 0x0006 410309124Sdim#define SCTP_STATE_COOKIE 0x0007 411198090Srdivacky#define SCTP_UNRECOG_PARAM 0x0008 412296417Sdim#define SCTP_COOKIE_PRESERVE 0x0009 413360784Sdim#define SCTP_HOSTNAME_ADDRESS 0x000b 414309124Sdim#define SCTP_SUPPORTED_ADDRTYPE 0x000c 415327952Sdim 416198090Srdivacky/* draft-ietf-stewart-tsvwg-strreset-xxx */ 417193323Sed#define SCTP_STR_RESET_OUT_REQUEST 0x000d 418341825Sdim#define SCTP_STR_RESET_IN_REQUEST 0x000e 419341825Sdim#define SCTP_STR_RESET_TSN_REQUEST 0x000f 420341825Sdim#define SCTP_STR_RESET_RESPONSE 0x0010 421341825Sdim#define SCTP_STR_RESET_ADD_OUT_STREAMS 0x0011 422205218Srdivacky#define SCTP_STR_RESET_ADD_IN_STREAMS 0x0012 423193323Sed 424205218Srdivacky#define SCTP_MAX_RESET_PARAMS 2 425193323Sed#define SCTP_STREAM_RESET_TSN_DELTA 0x1000 426193323Sed 427341825Sdim/*************0x4000 series*************/ 428205218Srdivacky 429193323Sed/*************0x8000 series*************/ 430193323Sed#define SCTP_ECN_CAPABLE 0x8000 431341825Sdim 432193323Sed/* draft-ietf-tsvwg-auth-xxx */ 433193323Sed#define SCTP_RANDOM 0x8002 434193323Sed#define SCTP_CHUNK_LIST 0x8003 435341825Sdim#define SCTP_HMAC_LIST 0x8004 436205218Srdivacky/* 437193323Sed * draft-ietf-tsvwg-addip-sctp-xx param=0x8008 len=0xNNNN Byte | Byte | Byte 438205218Srdivacky * | Byte Byte | Byte ... 439341825Sdim * 440210299Sed * Where each byte is a chunk type extension supported. For example, to support 441193323Sed * all chunks one would have (in hex): 442193323Sed * 443193323Sed * 80 01 00 09 C0 C1 80 81 82 00 00 00 444193323Sed * 445193323Sed * Has the parameter. C0 = PR-SCTP (RFC3758) C1, 80 = ASCONF (addip draft) 81 446193323Sed * = Packet Drop 82 = Stream Reset 83 = Authentication 447193323Sed */ 448193323Sed#define SCTP_SUPPORTED_CHUNK_EXT 0x8008 449210299Sed 450193323Sed/*************0xC000 series*************/ 451205218Srdivacky#define SCTP_PRSCTP_SUPPORTED 0xc000 452193323Sed/* draft-ietf-tsvwg-addip-sctp */ 453344779Sdim#define SCTP_ADD_IP_ADDRESS 0xc001 454344779Sdim#define SCTP_DEL_IP_ADDRESS 0xc002 455344779Sdim#define SCTP_ERROR_CAUSE_IND 0xc003 456344779Sdim#define SCTP_SET_PRIM_ADDR 0xc004 457344779Sdim#define SCTP_SUCCESS_REPORT 0xc005 458344779Sdim#define SCTP_ULP_ADAPTATION 0xc006 459344779Sdim/* behave-nat-draft */ 460344779Sdim#define SCTP_HAS_NAT_SUPPORT 0xc007 461344779Sdim#define SCTP_NAT_VTAGS 0xc008 462344779Sdim 463344779Sdim/* bits for TOS field */ 464344779Sdim#define SCTP_ECT0_BIT 0x02 465344779Sdim#define SCTP_ECT1_BIT 0x01 466344779Sdim#define SCTP_CE_BITS 0x03 467344779Sdim 468344779Sdim/* below turns off above */ 469205218Srdivacky#define SCTP_FLEXIBLE_ADDRESS 0x20 470327952Sdim#define SCTP_NO_HEARTBEAT 0x40 471193323Sed 472360784Sdim/* mask to get sticky */ 473193323Sed#define SCTP_STICKY_OPTIONS_MASK 0x0c 474353358Sdim 475193323Sed 476193323Sed/* 477193323Sed * SCTP states for internal state machine XXX (should match "user" values) 478353358Sdim */ 479193323Sed#define SCTP_STATE_EMPTY 0x0000 480193323Sed#define SCTP_STATE_INUSE 0x0001 481193323Sed#define SCTP_STATE_COOKIE_WAIT 0x0002 482327952Sdim#define SCTP_STATE_COOKIE_ECHOED 0x0004 483193323Sed#define SCTP_STATE_OPEN 0x0008 484193323Sed#define SCTP_STATE_SHUTDOWN_SENT 0x0010 485193323Sed#define SCTP_STATE_SHUTDOWN_RECEIVED 0x0020 486193323Sed#define SCTP_STATE_SHUTDOWN_ACK_SENT 0x0040 487193323Sed#define SCTP_STATE_SHUTDOWN_PENDING 0x0080 488193323Sed#define SCTP_STATE_CLOSED_SOCKET 0x0100 489360784Sdim#define SCTP_STATE_ABOUT_TO_BE_FREED 0x0200 490193323Sed#define SCTP_STATE_PARTIAL_MSG_LEFT 0x0400 491353358Sdim#define SCTP_STATE_WAS_ABORTED 0x0800 492193323Sed#define SCTP_STATE_IN_ACCEPT_QUEUE 0x1000 493353358Sdim#define SCTP_STATE_MASK 0x007f 494193323Sed 495353358Sdim#define SCTP_GET_STATE(asoc) ((asoc)->state & SCTP_STATE_MASK) 496193323Sed#define SCTP_SET_STATE(asoc, newstate) ((asoc)->state = ((asoc)->state & ~SCTP_STATE_MASK) | newstate) 497353358Sdim#define SCTP_CLEAR_SUBSTATE(asoc, substate) ((asoc)->state &= ~substate) 498193323Sed#define SCTP_ADD_SUBSTATE(asoc, substate) ((asoc)->state |= substate) 499353358Sdim 500193323Sed/* SCTP reachability state for each address */ 501353358Sdim#define SCTP_ADDR_REACHABLE 0x001 502193323Sed#define SCTP_ADDR_NO_PMTUD 0x002 503353358Sdim#define SCTP_ADDR_NOHB 0x004 504193323Sed#define SCTP_ADDR_BEING_DELETED 0x008 505353358Sdim#define SCTP_ADDR_NOT_IN_ASSOC 0x010 506193323Sed#define SCTP_ADDR_OUT_OF_SCOPE 0x080 507353358Sdim#define SCTP_ADDR_UNCONFIRMED 0x200 508360784Sdim#define SCTP_ADDR_REQ_PRIMARY 0x400 509327952Sdim/* JRS 5/13/07 - Added potentially failed state for CMT PF */ 510193323Sed#define SCTP_ADDR_PF 0x800 511343916Sdim 512193323Sed/* bound address types (e.g. valid address types to allow) */ 513193323Sed#define SCTP_BOUND_V6 0x01 514193323Sed#define SCTP_BOUND_V4 0x02 515193323Sed 516193323Sed/* 517193323Sed * what is the default number of mbufs in a chain I allow before switching to 518193323Sed * a cluster 519193323Sed */ 520193323Sed#define SCTP_DEFAULT_MBUFS_IN_CHAIN 5 521193323Sed 522193323Sed/* How long a cookie lives in milli-seconds */ 523193323Sed#define SCTP_DEFAULT_COOKIE_LIFE 60000 524280031Sdim 525193323Sed/* resource limit of streams */ 526193323Sed#define MAX_SCTP_STREAMS 2048 527193323Sed 528193323Sed/* Maximum the mapping array will grow to (TSN mapping array) */ 529193323Sed#define SCTP_MAPPING_ARRAY 512 530327952Sdim 531327952Sdim/* size of the inital malloc on the mapping array */ 532193323Sed#define SCTP_INITIAL_MAPPING_ARRAY 16 533193323Sed/* how much we grow the mapping array each call */ 534327952Sdim#define SCTP_MAPPING_ARRAY_INCR 32 535280031Sdim 536193323Sed/* 537193323Sed * Here we define the timer types used by the implementation as arguments in 538193323Sed * the set/get timer type calls. 539193323Sed */ 540193323Sed#define SCTP_TIMER_INIT 0 541193323Sed#define SCTP_TIMER_RECV 1 542193323Sed#define SCTP_TIMER_SEND 2 543193323Sed#define SCTP_TIMER_HEARTBEAT 3 544193323Sed#define SCTP_TIMER_PMTU 4 545327952Sdim#define SCTP_TIMER_MAXSHUTDOWN 5 546343916Sdim#define SCTP_TIMER_SIGNATURE 6 547193323Sed/* 548353358Sdim * number of timer types in the base SCTP structure used in the set/get and 549341825Sdim * has the base default. 550341825Sdim */ 551341825Sdim#define SCTP_NUM_TMRS 7 552360784Sdim 553341825Sdim/* timer types */ 554341825Sdim#define SCTP_TIMER_TYPE_NONE 0 555341825Sdim#define SCTP_TIMER_TYPE_SEND 1 556193323Sed#define SCTP_TIMER_TYPE_INIT 2 557360784Sdim#define SCTP_TIMER_TYPE_RECV 3 558343916Sdim#define SCTP_TIMER_TYPE_SHUTDOWN 4 559341825Sdim#define SCTP_TIMER_TYPE_HEARTBEAT 5 560341825Sdim#define SCTP_TIMER_TYPE_COOKIE 6 561341825Sdim#define SCTP_TIMER_TYPE_NEWCOOKIE 7 562341825Sdim#define SCTP_TIMER_TYPE_PATHMTURAISE 8 563341825Sdim#define SCTP_TIMER_TYPE_SHUTDOWNACK 9 564341825Sdim#define SCTP_TIMER_TYPE_ASCONF 10 565341825Sdim#define SCTP_TIMER_TYPE_SHUTDOWNGUARD 11 566341825Sdim#define SCTP_TIMER_TYPE_AUTOCLOSE 12 567341825Sdim#define SCTP_TIMER_TYPE_EVENTWAKE 13 568341825Sdim#define SCTP_TIMER_TYPE_STRRESET 14 569193323Sed#define SCTP_TIMER_TYPE_INPKILL 15 570193323Sed#define SCTP_TIMER_TYPE_ASOCKILL 16 571193323Sed#define SCTP_TIMER_TYPE_ADDR_WQ 17 572343916Sdim#define SCTP_TIMER_TYPE_ZERO_COPY 18 573193323Sed#define SCTP_TIMER_TYPE_ZCOPY_SENDQ 19 574234353Sdim#define SCTP_TIMER_TYPE_PRIM_DELETED 20 575193323Sed/* add new timers here - and increment LAST */ 576234353Sdim#define SCTP_TIMER_TYPE_LAST 21 577193323Sed 578234353Sdim#define SCTP_IS_TIMER_TYPE_VALID(t) (((t) > SCTP_TIMER_TYPE_NONE) && \ 579193323Sed ((t) < SCTP_TIMER_TYPE_LAST)) 580234353Sdim 581193323Sed 582234353Sdim 583193323Sed/* max number of TSN's dup'd that I will hold */ 584234353Sdim#define SCTP_MAX_DUP_TSNS 20 585193323Sed 586234353Sdim/* 587193323Sed * Here we define the types used when setting the retry amounts. 588234353Sdim */ 589193323Sed/* How many drop re-attempts we make on INIT/COOKIE-ECHO */ 590234353Sdim#define SCTP_RETRY_DROPPED_THRESH 4 591234353Sdim 592193323Sed/* 593343916Sdim * Maxmium number of chunks a single association can have on it. Note that 594341825Sdim * this is a squishy number since the count can run over this if the user 595341825Sdim * sends a large message down .. the fragmented chunks don't count until 596341825Sdim * AFTER the message is on queue.. it would be the next send that blocks 597193323Sed * things. This number will get tuned up at boot in the sctp_init and use the 598193323Sed * number of clusters as a base. This way high bandwidth environments will 599193323Sed * not get impacted by the lower bandwidth sending a bunch of 1 byte chunks 600353358Sdim */ 601344779Sdim#define SCTP_ASOC_MAX_CHUNKS_ON_QUEUE 512 602344779Sdim 603344779Sdim 604344779Sdim/* The conversion from time to ticks and vice versa is done by rounding 605249423Sdim * upwards. This way we can test in the code the time to be positive and 606193323Sed * know that this corresponds to a positive number of ticks. 607193323Sed */ 608353358Sdim#define MSEC_TO_TICKS(x) ((hz == 1000) ? x : ((((x) * hz) + 999) / 1000)) 609193323Sed#define TICKS_TO_MSEC(x) ((hz == 1000) ? x : ((((x) * 1000) + (hz - 1)) / hz)) 610193323Sed 611193323Sed#define SEC_TO_TICKS(x) ((x) * hz) 612193323Sed#define TICKS_TO_SEC(x) (((x) + (hz - 1)) / hz) 613193323Sed 614193323Sed/* 615193323Sed * Basically the minimum amount of time before I do a early FR. Making this 616193323Sed * value to low will cause duplicate retransmissions. 617193323Sed */ 618193323Sed#define SCTP_MINFR_MSEC_TIMER 250 619193323Sed/* The floor this value is allowed to fall to when starting a timer. */ 620193323Sed#define SCTP_MINFR_MSEC_FLOOR 20 621193323Sed 622193323Sed/* init timer def = 1 sec */ 623353358Sdim#define SCTP_INIT_SEC 1 624341825Sdim 625193323Sed/* send timer def = 1 seconds */ 626353358Sdim#define SCTP_SEND_SEC 1 627341825Sdim 628341825Sdim/* recv timer def = 200ms */ 629360784Sdim#define SCTP_RECV_MSEC 200 630341825Sdim 631341825Sdim/* 30 seconds + RTO (in ms) */ 632341825Sdim#define SCTP_HB_DEFAULT_MSEC 30000 633341825Sdim 634341825Sdim/* Max time I will wait for Shutdown to complete */ 635341825Sdim#define SCTP_DEF_MAX_SHUTDOWN_SEC 180 636341825Sdim 637193323Sed 638343916Sdim/* 639193323Sed * This is how long a secret lives, NOT how long a cookie lives how many 640360784Sdim * ticks the current secret will live. 641193323Sed */ 642360784Sdim#define SCTP_DEFAULT_SECRET_LIFE_SEC 3600 643193323Sed 644360784Sdim#define SCTP_RTO_UPPER_BOUND (60000) /* 60 sec in ms */ 645360784Sdim#define SCTP_RTO_LOWER_BOUND (1000) /* 1 sec is ms */ 646360784Sdim#define SCTP_RTO_INITIAL (3000) /* 3 sec in ms */ 647360784Sdim 648360784Sdim 649360784Sdim#define SCTP_INP_KILL_TIMEOUT 20/* number of ms to retry kill of inpcb */ 650360784Sdim#define SCTP_ASOC_KILL_TIMEOUT 10 /* number of ms to retry kill of inpcb */ 651249423Sdim 652360784Sdim#define SCTP_DEF_MAX_INIT 8 653239462Sdim#define SCTP_DEF_MAX_SEND 10 654360784Sdim#define SCTP_DEF_MAX_PATH_RTX 5 655205407Srdivacky#define SCTP_DEF_PATH_PF_THRESHOLD SCTP_DEF_MAX_PATH_RTX 656360784Sdim 657343916Sdim#define SCTP_DEF_PMTU_RAISE_SEC 600 /* 10 min between raise attempts */ 658360784Sdim 659343916Sdim 660343916Sdim/* How many streams I request initally by default */ 661360784Sdim#define SCTP_OSTREAM_INITIAL 10 662343916Sdim 663193323Sed/* 664360784Sdim * How many smallest_mtu's need to increase before a window update sack is 665343916Sdim * sent (should be a power of 2). 666360784Sdim */ 667360784Sdim/* Send window update (incr * this > hiwat). Should be a power of 2 */ 668360784Sdim#define SCTP_MINIMAL_RWND (4096) /* minimal rwnd */ 669360784Sdim 670360784Sdim#define SCTP_ADDRMAX 16 671360784Sdim 672360784Sdim/* SCTP DEBUG Switch parameters */ 673360784Sdim#define SCTP_DEBUG_TIMER1 0x00000001 674360784Sdim#define SCTP_DEBUG_TIMER2 0x00000002 /* unused */ 675193323Sed#define SCTP_DEBUG_TIMER3 0x00000004 /* unused */ 676193323Sed#define SCTP_DEBUG_TIMER4 0x00000008 677360784Sdim#define SCTP_DEBUG_OUTPUT1 0x00000010 678276479Sdim#define SCTP_DEBUG_OUTPUT2 0x00000020 679344779Sdim#define SCTP_DEBUG_OUTPUT3 0x00000040 680276479Sdim#define SCTP_DEBUG_OUTPUT4 0x00000080 681344779Sdim#define SCTP_DEBUG_UTIL1 0x00000100 682276479Sdim#define SCTP_DEBUG_UTIL2 0x00000200 /* unused */ 683341825Sdim#define SCTP_DEBUG_AUTH1 0x00000400 684239462Sdim#define SCTP_DEBUG_AUTH2 0x00000800 /* unused */ 685193323Sed#define SCTP_DEBUG_INPUT1 0x00001000 686343916Sdim#define SCTP_DEBUG_INPUT2 0x00002000 687276479Sdim#define SCTP_DEBUG_INPUT3 0x00004000 688344779Sdim#define SCTP_DEBUG_INPUT4 0x00008000 /* unused */ 689276479Sdim#define SCTP_DEBUG_ASCONF1 0x00010000 690344779Sdim#define SCTP_DEBUG_ASCONF2 0x00020000 691193323Sed#define SCTP_DEBUG_OUTPUT5 0x00040000 /* unused */ 692344779Sdim#define SCTP_DEBUG_XXX 0x00080000 /* unused */ 693344779Sdim#define SCTP_DEBUG_PCB1 0x00100000 694344779Sdim#define SCTP_DEBUG_PCB2 0x00200000 /* unused */ 695344779Sdim#define SCTP_DEBUG_PCB3 0x00400000 696239462Sdim#define SCTP_DEBUG_PCB4 0x00800000 697249423Sdim#define SCTP_DEBUG_INDATA1 0x01000000 698201360Srdivacky#define SCTP_DEBUG_INDATA2 0x02000000 /* unused */ 699193323Sed#define SCTP_DEBUG_INDATA3 0x04000000 /* unused */ 700249423Sdim#define SCTP_DEBUG_CRCOFFLOAD 0x08000000 /* unused */ 701360784Sdim#define SCTP_DEBUG_USRREQ1 0x10000000 /* unused */ 702276479Sdim#define SCTP_DEBUG_USRREQ2 0x20000000 /* unused */ 703261991Sdim#define SCTP_DEBUG_PEEL1 0x40000000 704341825Sdim#define SCTP_DEBUG_XXXXX 0x80000000 /* unused */ 705343916Sdim#define SCTP_DEBUG_ALL 0x7ff3ffff 706193323Sed#define SCTP_DEBUG_NOISY 0x00040000 707193323Sed 708341825Sdim/* What sender needs to see to avoid SWS or we consider peers rwnd 0 */ 709249423Sdim#define SCTP_SWS_SENDER_DEF 1420 710343916Sdim 711193323Sed/* 712341825Sdim * SWS is scaled to the sb_hiwat of the socket. A value of 2 is hiwat/4, 1 713249423Sdim * would be hiwat/2 etc. 714193323Sed */ 715218893Sdim/* What receiver needs to see in sockbuf or we tell peer its 1 */ 716249423Sdim#define SCTP_SWS_RECEIVER_DEF 3000 717344779Sdim 718344779Sdim#define SCTP_INITIAL_CWND 4380 719321369Sdim 720360784Sdim#define SCTP_DEFAULT_MTU 1500 /* emergency default MTU */ 721360784Sdim/* amount peer is obligated to have in rwnd or I will abort */ 722201360Srdivacky#define SCTP_MIN_RWND 1500 723360784Sdim 724341825Sdim#define SCTP_DEFAULT_MAXSEGMENT 65535 725249423Sdim 726201360Srdivacky#define SCTP_CHUNK_BUFFER_SIZE 512 727341825Sdim#define SCTP_PARAM_BUFFER_SIZE 512 728360784Sdim 729341825Sdim/* small chunk store for looking at chunk_list in auth */ 730341825Sdim#define SCTP_SMALL_CHUNK_STORE 260 731249423Sdim 732327952Sdim#define SCTP_DEFAULT_MINSEGMENT 512 /* MTU size ... if no mtu disc */ 733341825Sdim#define SCTP_HOW_MANY_SECRETS 2 /* how many secrets I keep */ 734341825Sdim 735360784Sdim#define SCTP_NUMBER_OF_SECRETS 8 /* or 8 * 4 = 32 octets */ 736360784Sdim#define SCTP_SECRET_SIZE 32 /* number of octets in a 256 bits */ 737360784Sdim 738341825Sdim 739341825Sdim/* 740341825Sdim * SCTP upper layer notifications 741341825Sdim */ 742341825Sdim#define SCTP_NOTIFY_ASSOC_UP 1 743341825Sdim#define SCTP_NOTIFY_ASSOC_DOWN 2 744341825Sdim#define SCTP_NOTIFY_INTERFACE_DOWN 3 745341825Sdim#define SCTP_NOTIFY_INTERFACE_UP 4 746360784Sdim#define SCTP_NOTIFY_SENT_DG_FAIL 5 747360784Sdim#define SCTP_NOTIFY_UNSENT_DG_FAIL 6 748341825Sdim#define SCTP_NOTIFY_SPECIAL_SP_FAIL 7 749341825Sdim#define SCTP_NOTIFY_ASSOC_LOC_ABORTED 8 750341825Sdim#define SCTP_NOTIFY_ASSOC_REM_ABORTED 9 751341825Sdim#define SCTP_NOTIFY_ASSOC_RESTART 10 752360784Sdim#define SCTP_NOTIFY_PEER_SHUTDOWN 11 753327952Sdim#define SCTP_NOTIFY_ASCONF_ADD_IP 12 754201360Srdivacky#define SCTP_NOTIFY_ASCONF_DELETE_IP 13 755360784Sdim#define SCTP_NOTIFY_ASCONF_SET_PRIMARY 14 756341825Sdim#define SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION 15 757341825Sdim#define SCTP_NOTIFY_INTERFACE_CONFIRMED 16 758327952Sdim#define SCTP_NOTIFY_STR_RESET_RECV 17 759341825Sdim#define SCTP_NOTIFY_STR_RESET_SEND 18 760341825Sdim#define SCTP_NOTIFY_STR_RESET_FAILED_OUT 19 761341825Sdim#define SCTP_NOTIFY_STR_RESET_FAILED_IN 20 762360784Sdim#define SCTP_NOTIFY_STR_RESET_DENIED_OUT 21 763360784Sdim#define SCTP_NOTIFY_STR_RESET_DENIED_IN 22 764360784Sdim#define SCTP_NOTIFY_AUTH_NEW_KEY 23 765341825Sdim#define SCTP_NOTIFY_AUTH_FREE_KEY 24 766341825Sdim#define SCTP_NOTIFY_NO_PEER_AUTH 25 767327952Sdim#define SCTP_NOTIFY_SENDER_DRY 26 768341825Sdim 769341825Sdim/* This is the value for messages that are NOT completely 770341825Sdim * copied down where we will start to split the message. 771360784Sdim * So, with our default, we split only if the piece we 772249423Sdim * want to take will fill up a full MTU (assuming 773201360Srdivacky * a 1500 byte MTU). 774193323Sed */ 775193323Sed#define SCTP_DEFAULT_SPLIT_POINT_MIN 2904 776193323Sed 777193323Sed/* ABORT CODES and other tell-tale location 778193323Sed * codes are generated by adding the below 779353358Sdim * to the instance id. 780360784Sdim */ 781353358Sdim 782360784Sdim/* File defines */ 783360784Sdim#define SCTP_FROM_SCTP_INPUT 0x10000000 784353358Sdim#define SCTP_FROM_SCTP_PCB 0x20000000 785193323Sed#define SCTP_FROM_SCTP_INDATA 0x30000000 786193323Sed#define SCTP_FROM_SCTP_TIMER 0x40000000 787353358Sdim#define SCTP_FROM_SCTP_USRREQ 0x50000000 788353358Sdim#define SCTP_FROM_SCTPUTIL 0x60000000 789353358Sdim#define SCTP_FROM_SCTP6_USRREQ 0x70000000 790353358Sdim#define SCTP_FROM_SCTP_ASCONF 0x80000000 791353358Sdim#define SCTP_FROM_SCTP_OUTPUT 0x90000000 792353358Sdim#define SCTP_FROM_SCTP_PEELOFF 0xa0000000 793193323Sed#define SCTP_FROM_SCTP_PANDA 0xb0000000 794193323Sed#define SCTP_FROM_SCTP_SYSCTL 0xc0000000 795193323Sed 796193323Sed/* Location ID's */ 797193323Sed#define SCTP_LOC_1 0x00000001 798193323Sed#define SCTP_LOC_2 0x00000002 799193323Sed#define SCTP_LOC_3 0x00000003 800193323Sed#define SCTP_LOC_4 0x00000004 801193323Sed#define SCTP_LOC_5 0x00000005 802193323Sed#define SCTP_LOC_6 0x00000006 803353358Sdim#define SCTP_LOC_7 0x00000007 804193323Sed#define SCTP_LOC_8 0x00000008 805353358Sdim#define SCTP_LOC_9 0x00000009 806353358Sdim#define SCTP_LOC_10 0x0000000a 807353358Sdim#define SCTP_LOC_11 0x0000000b 808353358Sdim#define SCTP_LOC_12 0x0000000c 809193323Sed#define SCTP_LOC_13 0x0000000d 810193323Sed#define SCTP_LOC_14 0x0000000e 811360784Sdim#define SCTP_LOC_15 0x0000000f 812193323Sed#define SCTP_LOC_16 0x00000010 813360784Sdim#define SCTP_LOC_17 0x00000011 814193323Sed#define SCTP_LOC_18 0x00000012 815360784Sdim#define SCTP_LOC_19 0x00000013 816193323Sed#define SCTP_LOC_20 0x00000014 817193323Sed#define SCTP_LOC_21 0x00000015 818193323Sed#define SCTP_LOC_22 0x00000016 819193323Sed#define SCTP_LOC_23 0x00000017 820193323Sed#define SCTP_LOC_24 0x00000018 821360784Sdim#define SCTP_LOC_25 0x00000019 822193323Sed#define SCTP_LOC_26 0x0000001a 823360784Sdim#define SCTP_LOC_27 0x0000001b 824193323Sed#define SCTP_LOC_28 0x0000001c 825360784Sdim#define SCTP_LOC_29 0x0000001d 826193323Sed#define SCTP_LOC_30 0x0000001e 827#define SCTP_LOC_31 0x0000001f 828#define SCTP_LOC_32 0x00000020 829#define SCTP_LOC_33 0x00000021 830 831 832/* Free assoc codes */ 833#define SCTP_NORMAL_PROC 0 834#define SCTP_PCBFREE_NOFORCE 1 835#define SCTP_PCBFREE_FORCE 2 836 837/* From codes for adding addresses */ 838#define SCTP_ADDR_IS_CONFIRMED 8 839#define SCTP_ADDR_DYNAMIC_ADDED 6 840#define SCTP_IN_COOKIE_PROC 100 841#define SCTP_ALLOC_ASOC 1 842#define SCTP_LOAD_ADDR_2 2 843#define SCTP_LOAD_ADDR_3 3 844#define SCTP_LOAD_ADDR_4 4 845#define SCTP_LOAD_ADDR_5 5 846 847#define SCTP_DONOT_SETSCOPE 0 848#define SCTP_DO_SETSCOPE 1 849 850 851/* This value determines the default for when 852 * we try to add more on the send queue., if 853 * there is room. This prevents us from cycling 854 * into the copy_resume routine to often if 855 * we have not got enough space to add a decent 856 * enough size message. Note that if we have enough 857 * space to complete the message copy we will always 858 * add to the message, no matter what the size. Its 859 * only when we reach the point that we have some left 860 * to add, there is only room for part of it that we 861 * will use this threshold. Its also a sysctl. 862 */ 863#define SCTP_DEFAULT_ADD_MORE 1452 864 865#ifndef SCTP_PCBHASHSIZE 866/* default number of association hash buckets in each endpoint */ 867#define SCTP_PCBHASHSIZE 256 868#endif 869#ifndef SCTP_TCBHASHSIZE 870#define SCTP_TCBHASHSIZE 1024 871#endif 872 873#ifndef SCTP_CHUNKQUEUE_SCALE 874#define SCTP_CHUNKQUEUE_SCALE 10 875#endif 876 877/* clock variance is 1 ms */ 878#define SCTP_CLOCK_GRANULARITY 1 879#define IP_HDR_SIZE 40 /* we use the size of a IP6 header here this 880 * detracts a small amount for ipv4 but it 881 * simplifies the ipv6 addition */ 882 883/* Argument magic number for sctp_inpcb_free() */ 884 885/* third argument */ 886#define SCTP_CALLED_DIRECTLY_NOCMPSET 0 887#define SCTP_CALLED_AFTER_CMPSET_OFCLOSE 1 888#define SCTP_CALLED_FROM_INPKILL_TIMER 2 889/* second argument */ 890#define SCTP_FREE_SHOULD_USE_ABORT 1 891#define SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE 0 892 893#ifndef IPPROTO_SCTP 894#define IPPROTO_SCTP 132 /* the Official IANA number :-) */ 895#endif /* !IPPROTO_SCTP */ 896 897#define SCTP_MAX_DATA_BUNDLING 256 898 899/* modular comparison */ 900/* See RFC 1982 for details. */ 901#define SCTP_SSN_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \ 902 ((a > b) && ((uint16_t)(a - b) < (1U<<15)))) 903#define SCTP_SSN_GE(a, b) (SCTP_SSN_GT(a, b) || (a == b)) 904#define SCTP_TSN_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \ 905 ((a > b) && ((uint32_t)(a - b) < (1U<<31)))) 906#define SCTP_TSN_GE(a, b) (SCTP_TSN_GT(a, b) || (a == b)) 907 908/* Mapping array manipulation routines */ 909#define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01) 910#define SCTP_SET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] |= (0x01 << ((gap & 0x07)))) 911#define SCTP_UNSET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] &= ((~(0x01 << ((gap & 0x07)))) & 0xff)) 912#define SCTP_CALC_TSN_TO_GAP(gap, tsn, mapping_tsn) do { \ 913 if (tsn >= mapping_tsn) { \ 914 gap = tsn - mapping_tsn; \ 915 } else { \ 916 gap = (MAX_TSN - mapping_tsn) + tsn + 1; \ 917 } \ 918 } while (0) 919 920 921#define SCTP_RETRAN_DONE -1 922#define SCTP_RETRAN_EXIT -2 923 924/* 925 * This value defines the number of vtag block time wait entry's per list 926 * element. Each entry will take 2 4 byte ints (and of course the overhead 927 * of the next pointer as well). Using 15 as an example will yield * ((8 * 928 * 15) + 8) or 128 bytes of overhead for each timewait block that gets 929 * initialized. Increasing it to 31 would yeild 256 bytes per block. 930 */ 931#define SCTP_NUMBER_IN_VTAG_BLOCK 15 932/* 933 * If we use the STACK option, we have an array of this size head pointers. 934 * This array is mod'd the with the size to find which bucket and then all 935 * entries must be searched to see if the tag is in timed wait. If so we 936 * reject it. 937 */ 938#define SCTP_STACK_VTAG_HASH_SIZE 32 939 940/* 941 * Number of seconds of time wait for a vtag. 942 */ 943#define SCTP_TIME_WAIT 60 944 945/* How many micro seconds is the cutoff from 946 * local lan type rtt's 947 */ 948 /* 949 * We allow 900us for the rtt. 950 */ 951#define SCTP_LOCAL_LAN_RTT 900 952#define SCTP_LAN_UNKNOWN 0 953#define SCTP_LAN_LOCAL 1 954#define SCTP_LAN_INTERNET 2 955 956#define SCTP_SEND_BUFFER_SPLITTING 0x00000001 957#define SCTP_RECV_BUFFER_SPLITTING 0x00000002 958 959/* The system retains a cache of free chunks such to 960 * cut down on calls the memory allocation system. There 961 * is a per association limit of free items and a overall 962 * system limit. If either one gets hit then the resource 963 * stops being cached. 964 */ 965 966#define SCTP_DEF_ASOC_RESC_LIMIT 10 967#define SCTP_DEF_SYSTEM_RESC_LIMIT 1000 968 969/*- 970 * defines for socket lock states. 971 * Used by __APPLE__ and SCTP_SO_LOCK_TESTING 972 */ 973#define SCTP_SO_LOCKED 1 974#define SCTP_SO_NOT_LOCKED 0 975 976 977#define SCTP_HOLDS_LOCK 1 978#define SCTP_NOT_LOCKED 0 979 980/*- 981 * For address locks, do we hold the lock? 982 */ 983#define SCTP_ADDR_LOCKED 1 984#define SCTP_ADDR_NOT_LOCKED 0 985 986#define IN4_ISPRIVATE_ADDRESS(a) \ 987 ((((uint8_t *)&(a)->s_addr)[0] == 10) || \ 988 ((((uint8_t *)&(a)->s_addr)[0] == 172) && \ 989 (((uint8_t *)&(a)->s_addr)[1] >= 16) && \ 990 (((uint8_t *)&(a)->s_addr)[1] <= 32)) || \ 991 ((((uint8_t *)&(a)->s_addr)[0] == 192) && \ 992 (((uint8_t *)&(a)->s_addr)[1] == 168))) 993 994#define IN4_ISLOOPBACK_ADDRESS(a) \ 995 ((((uint8_t *)&(a)->s_addr)[0] == 127) && \ 996 (((uint8_t *)&(a)->s_addr)[1] == 0) && \ 997 (((uint8_t *)&(a)->s_addr)[2] == 0) && \ 998 (((uint8_t *)&(a)->s_addr)[3] == 1)) 999 1000 1001#if defined(_KERNEL) 1002#define SCTP_GETTIME_TIMEVAL(x) (getmicrouptime(x)) 1003#define SCTP_GETPTIME_TIMEVAL(x) (microuptime(x)) 1004#endif 1005 1006#if defined(_KERNEL) || defined(__Userspace__) 1007#define sctp_sowwakeup(inp, so) \ 1008do { \ 1009 if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1010 inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \ 1011 } else { \ 1012 sowwakeup(so); \ 1013 } \ 1014} while (0) 1015 1016#define sctp_sowwakeup_locked(inp, so) \ 1017do { \ 1018 if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1019 SOCKBUF_UNLOCK(&((so)->so_snd)); \ 1020 inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \ 1021 } else { \ 1022 sowwakeup_locked(so); \ 1023 } \ 1024} while (0) 1025 1026#define sctp_sorwakeup(inp, so) \ 1027do { \ 1028 if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1029 inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \ 1030 } else { \ 1031 sorwakeup(so); \ 1032 } \ 1033} while (0) 1034 1035#define sctp_sorwakeup_locked(inp, so) \ 1036do { \ 1037 if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1038 inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \ 1039 SOCKBUF_UNLOCK(&((so)->so_rcv)); \ 1040 } else { \ 1041 sorwakeup_locked(so); \ 1042 } \ 1043} while (0) 1044 1045#endif /* _KERNEL || __Userspace__ */ 1046#endif 1047