sctp_constants.h revision 171943
1163953Srrs/*- 2169382Srrs * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3163953Srrs * 4163953Srrs * Redistribution and use in source and binary forms, with or without 5163953Srrs * modification, are permitted provided that the following conditions are met: 6163953Srrs * 7163953Srrs * a) Redistributions of source code must retain the above copyright notice, 8163953Srrs * this list of conditions and the following disclaimer. 9163953Srrs * 10163953Srrs * b) Redistributions in binary form must reproduce the above copyright 11163953Srrs * notice, this list of conditions and the following disclaimer in 12163953Srrs * the documentation and/or other materials provided with the distribution. 13163953Srrs * 14163953Srrs * c) Neither the name of Cisco Systems, Inc. nor the names of its 15163953Srrs * contributors may be used to endorse or promote products derived 16163953Srrs * from this software without specific prior written permission. 17163953Srrs * 18163953Srrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19163953Srrs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20163953Srrs * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21163953Srrs * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22163953Srrs * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23163953Srrs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24163953Srrs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25163953Srrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26163953Srrs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27163953Srrs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28163953Srrs * THE POSSIBILITY OF SUCH DAMAGE. 29163953Srrs */ 30163953Srrs 31163953Srrs/* $KAME: sctp_constants.h,v 1.17 2005/03/06 16:04:17 itojun Exp $ */ 32163953Srrs 33163953Srrs#include <sys/cdefs.h> 34163953Srrs__FBSDID("$FreeBSD: head/sys/netinet/sctp_constants.h 171943 2007-08-24 00:53:53Z rrs $"); 35163953Srrs 36163953Srrs#ifndef __sctp_constants_h__ 37163953Srrs#define __sctp_constants_h__ 38163953Srrs 39167598Srrs/* Number of packets to get before sack sent by default */ 40167598Srrs#define SCTP_DEFAULT_SACK_FREQ 2 41163953Srrs 42167598Srrs/* Address limit - This variable is calculated 43168299Srrs * based on an 65535 byte max ip packet. We take out 100 bytes 44167598Srrs * for the cookie, 40 bytes for a v6 header and 32 45167598Srrs * bytes for the init structure. A second init structure 46167598Srrs * for the init-ack and then finally a third one for the 47167598Srrs * imbedded init. This yeilds 100+40+(3 * 32) = 236 bytes. 48168299Srrs * This leaves 65299 bytes for addresses. We throw out the 299 bytes. 49168299Srrs * Now whatever we send in the INIT() we need to allow to get back in the 50167598Srrs * INIT-ACK plus all the values from INIT and INIT-ACK 51167598Srrs * listed in the cookie. Plus we need some overhead for 52167598Srrs * maybe copied parameters in the COOKIE. If we 53168299Srrs * allow 1080 addresses, and each side has 1080 V6 addresses 54168299Srrs * that will be 21600 bytes. In the INIT-ACK we will 55168299Srrs * see the INIT-ACK 21600 + 43200 in the cookie. This leaves 56168299Srrs * about 500 bytes slack for misc things in the cookie. 57167598Srrs */ 58168299Srrs#define SCTP_ADDRESS_LIMIT 1080 59167598Srrs 60167598Srrs/* Number of addresses where we just skip the counting */ 61167598Srrs#define SCTP_COUNT_LIMIT 40 62167598Srrs 63170056Srrs#define SCTP_ZERO_COPY_TICK_DELAY (((100 * hz) + 999) / 1000) 64170181Srrs#define SCTP_ZERO_COPY_SENDQ_TICK_DELAY (((100 * hz) + 999) / 1000) 65170056Srrs 66167598Srrs/* Number of ticks to delay before running 67167598Srrs * iterator on an address change. 68167598Srrs */ 69167598Srrs#define SCTP_ADDRESS_TICK_DELAY 2 70167598Srrs 71163953Srrs#define SCTP_VERSION_STRING "KAME-BSD 1.1" 72163953Srrs/* #define SCTP_AUDITING_ENABLED 1 used for debug/auditing */ 73163953Srrs#define SCTP_AUDIT_SIZE 256 74163953Srrs 75167598Srrs#define SCTP_USE_THREAD_BASED_ITERATOR 1 76167598Srrs 77167598Srrs#define SCTP_KTRHEAD_NAME "sctp_iterator" 78167598Srrs#define SCTP_KTHREAD_PAGES 2 79167598Srrs 80167598Srrs 81167598Srrs/* If you support Multi-VRF how big to 82167598Srrs * make the initial array of VRF's to. 83167598Srrs */ 84167598Srrs#define SCTP_DEFAULT_VRF_SIZE 4 85167598Srrs 86171477Srrs/* constants for rto calc */ 87171477Srrs#define sctp_align_safe_nocopy 0 88171477Srrs#define sctp_align_unsafe_makecopy 1 89171477Srrs 90171440Srrs/* JRS - Values defined for the HTCP algorithm */ 91171440Srrs#define ALPHA_BASE (1<<7) /* 1.0 with shift << 7 */ 92171440Srrs#define BETA_MIN (1<<6) /* 0.5 with shift << 7 */ 93171440Srrs#define BETA_MAX 102 /* 0.8 with shift << 7 */ 94171440Srrs 95163953Srrs/* Places that CWND log can happen from */ 96163953Srrs#define SCTP_CWND_LOG_FROM_FR 1 97163953Srrs#define SCTP_CWND_LOG_FROM_RTX 2 98163953Srrs#define SCTP_CWND_LOG_FROM_BRST 3 99163953Srrs#define SCTP_CWND_LOG_FROM_SS 4 100163953Srrs#define SCTP_CWND_LOG_FROM_CA 5 101163953Srrs#define SCTP_CWND_LOG_FROM_SAT 6 102163953Srrs#define SCTP_BLOCK_LOG_INTO_BLK 7 103163953Srrs#define SCTP_BLOCK_LOG_OUTOF_BLK 8 104163953Srrs#define SCTP_BLOCK_LOG_CHECK 9 105163953Srrs#define SCTP_STR_LOG_FROM_INTO_STRD 10 106163953Srrs#define SCTP_STR_LOG_FROM_IMMED_DEL 11 107163953Srrs#define SCTP_STR_LOG_FROM_INSERT_HD 12 108163953Srrs#define SCTP_STR_LOG_FROM_INSERT_MD 13 109163953Srrs#define SCTP_STR_LOG_FROM_INSERT_TL 14 110163953Srrs#define SCTP_STR_LOG_FROM_MARK_TSN 15 111163953Srrs#define SCTP_STR_LOG_FROM_EXPRS_DEL 16 112163953Srrs#define SCTP_FR_LOG_BIGGEST_TSNS 17 113163953Srrs#define SCTP_FR_LOG_STRIKE_TEST 18 114163953Srrs#define SCTP_FR_LOG_STRIKE_CHUNK 19 115163953Srrs#define SCTP_FR_T3_TIMEOUT 20 116163953Srrs#define SCTP_MAP_PREPARE_SLIDE 21 117163953Srrs#define SCTP_MAP_SLIDE_FROM 22 118163953Srrs#define SCTP_MAP_SLIDE_RESULT 23 119163953Srrs#define SCTP_MAP_SLIDE_CLEARED 24 120163953Srrs#define SCTP_MAP_SLIDE_NONE 25 121163953Srrs#define SCTP_FR_T3_MARK_TIME 26 122163953Srrs#define SCTP_FR_T3_MARKED 27 123163953Srrs#define SCTP_FR_T3_STOPPED 28 124163953Srrs#define SCTP_FR_MARKED 30 125163953Srrs#define SCTP_CWND_LOG_NOADV_SS 31 126163953Srrs#define SCTP_CWND_LOG_NOADV_CA 32 127163953Srrs#define SCTP_MAX_BURST_APPLIED 33 128163953Srrs#define SCTP_MAX_IFP_APPLIED 34 129163953Srrs#define SCTP_MAX_BURST_ERROR_STOP 35 130163953Srrs#define SCTP_INCREASE_PEER_RWND 36 131163953Srrs#define SCTP_DECREASE_PEER_RWND 37 132163953Srrs#define SCTP_SET_PEER_RWND_VIA_SACK 38 133163953Srrs#define SCTP_LOG_MBCNT_INCREASE 39 134163953Srrs#define SCTP_LOG_MBCNT_DECREASE 40 135163953Srrs#define SCTP_LOG_MBCNT_CHKSET 41 136163953Srrs#define SCTP_LOG_NEW_SACK 42 137163953Srrs#define SCTP_LOG_TSN_ACKED 43 138163953Srrs#define SCTP_LOG_TSN_REVOKED 44 139163953Srrs#define SCTP_LOG_LOCK_TCB 45 140163953Srrs#define SCTP_LOG_LOCK_INP 46 141163953Srrs#define SCTP_LOG_LOCK_SOCK 47 142163953Srrs#define SCTP_LOG_LOCK_SOCKBUF_R 48 143163953Srrs#define SCTP_LOG_LOCK_SOCKBUF_S 49 144163953Srrs#define SCTP_LOG_LOCK_CREATE 50 145163953Srrs#define SCTP_LOG_INITIAL_RTT 51 146163953Srrs#define SCTP_LOG_RTTVAR 52 147163953Srrs#define SCTP_LOG_SBALLOC 53 148163953Srrs#define SCTP_LOG_SBFREE 54 149163953Srrs#define SCTP_LOG_SBRESULT 55 150163953Srrs#define SCTP_FR_DUPED 56 151163953Srrs#define SCTP_FR_MARKED_EARLY 57 152163953Srrs#define SCTP_FR_CWND_REPORT 58 153163953Srrs#define SCTP_FR_CWND_REPORT_START 59 154163953Srrs#define SCTP_FR_CWND_REPORT_STOP 60 155163953Srrs#define SCTP_CWND_LOG_FROM_SEND 61 156163953Srrs#define SCTP_CWND_INITIALIZATION 62 157163953Srrs#define SCTP_CWND_LOG_FROM_T3 63 158163953Srrs#define SCTP_CWND_LOG_FROM_SACK 64 159163953Srrs#define SCTP_CWND_LOG_NO_CUMACK 65 160163953Srrs#define SCTP_CWND_LOG_FROM_RESEND 66 161163953Srrs#define SCTP_FR_LOG_CHECK_STRIKE 67 162163953Srrs#define SCTP_SEND_NOW_COMPLETES 68 163163953Srrs#define SCTP_CWND_LOG_FILL_OUTQ_CALLED 69 164163953Srrs#define SCTP_CWND_LOG_FILL_OUTQ_FILLS 70 165163953Srrs#define SCTP_LOG_FREE_SENT 71 166163953Srrs#define SCTP_NAGLE_APPLIED 72 167163953Srrs#define SCTP_NAGLE_SKIPPED 73 168163953Srrs#define SCTP_WAKESND_FROM_SACK 74 169163953Srrs#define SCTP_WAKESND_FROM_FWDTSN 75 170163953Srrs#define SCTP_NOWAKE_FROM_SACK 76 171163953Srrs#define SCTP_CWNDLOG_PRESEND 77 172163953Srrs#define SCTP_CWNDLOG_ENDSEND 78 173163953Srrs#define SCTP_AT_END_OF_SACK 79 174163953Srrs#define SCTP_REASON_FOR_SC 80 175163953Srrs#define SCTP_BLOCK_LOG_INTO_BLKA 81 176163953Srrs#define SCTP_ENTER_USER_RECV 82 177163953Srrs#define SCTP_USER_RECV_SACKS 83 178163953Srrs#define SCTP_SORECV_BLOCKSA 84 179163953Srrs#define SCTP_SORECV_BLOCKSB 85 180163953Srrs#define SCTP_SORECV_DONE 86 181163953Srrs#define SCTP_SACK_RWND_UPDATE 87 182163953Srrs#define SCTP_SORECV_ENTER 88 183163953Srrs#define SCTP_SORECV_ENTERPL 89 184163953Srrs#define SCTP_MBUF_INPUT 90 185163953Srrs#define SCTP_MBUF_IALLOC 91 186163953Srrs#define SCTP_MBUF_IFREE 92 187163953Srrs#define SCTP_MBUF_ICOPY 93 188163953Srrs#define SCTP_SORCV_FREECTL 94 189163953Srrs#define SCTP_SORCV_DOESCPY 95 190163953Srrs#define SCTP_SORCV_DOESLCK 96 191163953Srrs#define SCTP_SORCV_DOESADJ 97 192163953Srrs#define SCTP_SORCV_BOTWHILE 98 193163953Srrs#define SCTP_SORCV_PASSBF 99 194163953Srrs#define SCTP_SORCV_ADJD 100 195163953Srrs#define SCTP_UNKNOWN_MAX 101 196163953Srrs#define SCTP_RANDY_STUFF 102 197163953Srrs#define SCTP_RANDY_STUFF1 103 198164181Srrs#define SCTP_STRMOUT_LOG_ASSIGN 104 199164181Srrs#define SCTP_STRMOUT_LOG_SEND 105 200168709Srrs#define SCTP_FLIGHT_LOG_DOWN_CA 106 201165220Srrs#define SCTP_FLIGHT_LOG_UP 107 202168709Srrs#define SCTP_FLIGHT_LOG_DOWN_GAP 108 203168709Srrs#define SCTP_FLIGHT_LOG_DOWN_RSND 109 204168709Srrs#define SCTP_FLIGHT_LOG_UP_RSND 110 205168709Srrs#define SCTP_FLIGHT_LOG_DOWN_RSND_TO 111 206168709Srrs#define SCTP_FLIGHT_LOG_DOWN_WP 112 207168709Srrs#define SCTP_FLIGHT_LOG_UP_REVOKE 113 208168709Srrs#define SCTP_FLIGHT_LOG_DOWN_PDRP 114 209168709Srrs#define SCTP_FLIGHT_LOG_DOWN_PMTU 115 210169208Srrs#define SCTP_SACK_LOG_NORMAL 116 211169208Srrs#define SCTP_SACK_LOG_EXPRESS 117 212171943Srrs#define SCTP_MAP_TSN_ENTERS 118 213171943Srrs#define SCTP_THRESHOLD_CLEAR 119 214171943Srrs#define SCTP_THRESHOLD_INCR 120 215169208Srrs 216171943Srrs#define SCTP_LOG_MAX_TYPES 121 217163953Srrs/* 218170744Srrs * To turn on various logging, you must first enable 'options KTR' and 219170744Srrs * you might want to bump the entires 'options KTR_ENTRIES=80000'. 220170744Srrs * To get something to log you define one of the logging defines. 221170744Srrs * (see LINT). 222163953Srrs * 223170744Srrs * This gets the compile in place, but you still need to turn the 224170744Srrs * logging flag on too in the sysctl (see in sctp.h). 225163953Srrs */ 226171943Srrs 227171943Srrs/* For SCTP only logging */ 228171943Srrs#define SCTP_MAX_LOGGING_SIZE 30000 229171943Srrs#define SCTP_TRACE_PARAMS 6 230171943Srrs 231171943Srrs 232163953Srrs#define SCTP_LOG_EVENT_UNKNOWN 0 233163953Srrs#define SCTP_LOG_EVENT_CWND 1 234163953Srrs#define SCTP_LOG_EVENT_BLOCK 2 235163953Srrs#define SCTP_LOG_EVENT_STRM 3 236163953Srrs#define SCTP_LOG_EVENT_FR 4 237163953Srrs#define SCTP_LOG_EVENT_MAP 5 238163953Srrs#define SCTP_LOG_EVENT_MAXBURST 6 239163953Srrs#define SCTP_LOG_EVENT_RWND 7 240163953Srrs#define SCTP_LOG_EVENT_MBCNT 8 241163953Srrs#define SCTP_LOG_EVENT_SACK 9 242163953Srrs#define SCTP_LOG_LOCK_EVENT 10 243163953Srrs#define SCTP_LOG_EVENT_RTT 11 244163953Srrs#define SCTP_LOG_EVENT_SB 12 245163953Srrs#define SCTP_LOG_EVENT_NAGLE 13 246163953Srrs#define SCTP_LOG_EVENT_WAKE 14 247163953Srrs#define SCTP_LOG_MISC_EVENT 15 248163953Srrs#define SCTP_LOG_EVENT_CLOSE 16 249163953Srrs#define SCTP_LOG_EVENT_MBUF 17 250170744Srrs#define SCTP_LOG_CHUNK_PROC 18 251170744Srrs#define SCTP_LOG_ERROR_RET 19 252163953Srrs 253170744Srrs#define SCTP_LOG_MAX_EVENT 20 254163953Srrs 255163953Srrs#define SCTP_LOCK_UNKNOWN 2 256163953Srrs 257163953Srrs 258163953Srrs/* number of associations by default for zone allocation */ 259163953Srrs#define SCTP_MAX_NUM_OF_ASOC 40000 260163953Srrs/* how many addresses per assoc remote and local */ 261163953Srrs#define SCTP_SCALE_FOR_ADDR 2 262163953Srrs 263163953Srrs/* default AUTO_ASCONF mode enable(1)/disable(0) value (sysctl) */ 264167598Srrs#if defined (__APPLE__) && !defined(SCTP_APPLE_AUTO_ASCONF) 265167598Srrs#define SCTP_DEFAULT_AUTO_ASCONF 0 266167598Srrs#else 267167598Srrs#define SCTP_DEFAULT_AUTO_ASCONF 1 268167598Srrs#endif 269163953Srrs 270163953Srrs/* 271163953Srrs * Theshold for rwnd updates, we have to read (sb_hiwat >> 272163953Srrs * SCTP_RWND_HIWAT_SHIFT) before we will look to see if we need to send a 273163953Srrs * window update sack. When we look, we compare the last rwnd we sent vs the 274163953Srrs * current rwnd. It too must be greater than this value. Using 3 divdes the 275163953Srrs * hiwat by 8, so for 200k rwnd we need to read 24k. For a 64k rwnd we need 276163953Srrs * to read 8k. This seems about right.. I hope :-D.. we do set a 277163953Srrs * min of a MTU on it so if the rwnd is real small we will insist 278163953Srrs * on a full MTU of 1500 bytes. 279163953Srrs */ 280163953Srrs#define SCTP_RWND_HIWAT_SHIFT 3 281163953Srrs 282163953Srrs/* How much of the rwnd must the 283163953Srrs * message be taking up to start partial delivery. 284163953Srrs * We calculate this by shifing the hi_water (recv_win) 285163953Srrs * left the following .. set to 1, when a message holds 286163953Srrs * 1/2 the rwnd. If we set it to 2 when a message holds 287163953Srrs * 1/4 the rwnd...etc.. 288163953Srrs */ 289163953Srrs 290163953Srrs#define SCTP_PARTIAL_DELIVERY_SHIFT 1 291163953Srrs 292163953Srrs/* Minimum number of bytes read by user before we 293163953Srrs * condsider doing a rwnd update 294163953Srrs */ 295163953Srrs#define SCTP_MIN_READ_BEFORE_CONSIDERING 3000 296163953Srrs 297163953Srrs/* 298163953Srrs * default HMAC for cookies, etc... use one of the AUTH HMAC id's 299163953Srrs * SCTP_HMAC is the HMAC_ID to use 300163953Srrs * SCTP_SIGNATURE_SIZE is the digest length 301163953Srrs */ 302163953Srrs#define SCTP_HMAC SCTP_AUTH_HMAC_ID_SHA1 303163953Srrs#define SCTP_SIGNATURE_SIZE SCTP_AUTH_DIGEST_LEN_SHA1 304163953Srrs#define SCTP_SIGNATURE_ALOC_SIZE SCTP_SIGNATURE_SIZE 305163953Srrs 306163953Srrs/* DEFINE HERE WHAT CRC YOU WANT TO USE */ 307163953Srrs#define SCTP_USECRC_RFC2960 1 308163953Srrs/* #define SCTP_USECRC_FLETCHER 1 */ 309163953Srrs/* #define SCTP_USECRC_SSHCRC32 1 */ 310163953Srrs/* #define SCTP_USECRC_FASTCRC32 1 */ 311163953Srrs/* #define SCTP_USECRC_CRC32 1 */ 312163953Srrs/* #define SCTP_USECRC_TCP32 1 */ 313163953Srrs/* #define SCTP_USECRC_CRC16SMAL 1 */ 314163953Srrs/* #define SCTP_USECRC_CRC16 1 */ 315163953Srrs/* #define SCTP_USECRC_MODADLER 1 */ 316163953Srrs 317163953Srrs#ifndef SCTP_ADLER32_BASE 318163953Srrs#define SCTP_ADLER32_BASE 65521 319163953Srrs#endif 320163953Srrs 321163953Srrs/* 322163953Srrs * the SCTP protocol signature this includes the version number encoded in 323163953Srrs * the last 4 bits of the signature. 324163953Srrs */ 325163953Srrs#define PROTO_SIGNATURE_A 0x30000000 326163953Srrs#define SCTP_VERSION_NUMBER 0x3 327163953Srrs 328163953Srrs#define MAX_TSN 0xffffffff 329163953Srrs#define MAX_SEQ 0xffff 330163953Srrs 331163953Srrs/* how many executions every N tick's */ 332163953Srrs#define SCTP_ITERATOR_MAX_AT_ONCE 20 333163953Srrs 334163953Srrs/* number of clock ticks between iterator executions */ 335163953Srrs#define SCTP_ITERATOR_TICKS 1 336163953Srrs 337163953Srrs/* 338163953Srrs * option: If you comment out the following you will receive the old behavior 339163953Srrs * of obeying cwnd for the fast retransmit algorithm. With this defined a FR 340163953Srrs * happens right away with-out waiting for the flightsize to drop below the 341163953Srrs * cwnd value (which is reduced by the FR to 1/2 the inflight packets). 342163953Srrs */ 343163953Srrs#define SCTP_IGNORE_CWND_ON_FR 1 344163953Srrs 345163953Srrs/* 346163953Srrs * Adds implementors guide behavior to only use newest highest update in SACK 347163953Srrs * gap ack's to figure out if you need to stroke a chunk for FR. 348163953Srrs */ 349163953Srrs#define SCTP_NO_FR_UNLESS_SEGMENT_SMALLER 1 350163953Srrs 351163953Srrs/* default max I can burst out after a fast retransmit */ 352163953Srrs#define SCTP_DEF_MAX_BURST 4 353163953Srrs/* IP hdr (20/40) + 12+2+2 (enet) + sctp common 12 */ 354163953Srrs#define SCTP_FIRST_MBUF_RESV 68 355163953Srrs/* Packet transmit states in the sent field */ 356163953Srrs#define SCTP_DATAGRAM_UNSENT 0 357163953Srrs#define SCTP_DATAGRAM_SENT 1 358163953Srrs#define SCTP_DATAGRAM_RESEND1 2 /* not used (in code, but may 359163953Srrs * hit this value) */ 360163953Srrs#define SCTP_DATAGRAM_RESEND2 3 /* not used (in code, but may 361163953Srrs * hit this value) */ 362163953Srrs#define SCTP_DATAGRAM_RESEND 4 363163953Srrs#define SCTP_DATAGRAM_ACKED 10010 364163953Srrs#define SCTP_DATAGRAM_INBOUND 10011 365163953Srrs#define SCTP_READY_TO_TRANSMIT 10012 366163953Srrs#define SCTP_DATAGRAM_MARKED 20010 367163953Srrs#define SCTP_FORWARD_TSN_SKIP 30010 368163953Srrs 369163953Srrs/* chunk output send from locations */ 370163953Srrs#define SCTP_OUTPUT_FROM_USR_SEND 0 371163953Srrs#define SCTP_OUTPUT_FROM_T3 1 372163953Srrs#define SCTP_OUTPUT_FROM_INPUT_ERROR 2 373163953Srrs#define SCTP_OUTPUT_FROM_CONTROL_PROC 3 374163953Srrs#define SCTP_OUTPUT_FROM_SACK_TMR 4 375163953Srrs#define SCTP_OUTPUT_FROM_SHUT_TMR 5 376163953Srrs#define SCTP_OUTPUT_FROM_HB_TMR 6 377163953Srrs#define SCTP_OUTPUT_FROM_SHUT_ACK_TMR 7 378163953Srrs#define SCTP_OUTPUT_FROM_ASCONF_TMR 8 379163953Srrs#define SCTP_OUTPUT_FROM_STRRST_TMR 9 380163953Srrs#define SCTP_OUTPUT_FROM_AUTOCLOSE_TMR 10 381163953Srrs#define SCTP_OUTPUT_FROM_EARLY_FR_TMR 11 382163953Srrs#define SCTP_OUTPUT_FROM_STRRST_REQ 12 383163953Srrs#define SCTP_OUTPUT_FROM_USR_RCVD 13 384164205Srrs#define SCTP_OUTPUT_FROM_COOKIE_ACK 14 385167598Srrs#define SCTP_OUTPUT_FROM_DRAIN 15 386163953Srrs/* SCTP chunk types are moved sctp.h for application (NAT, FW) use */ 387163953Srrs 388163953Srrs/* align to 32-bit sizes */ 389163953Srrs#define SCTP_SIZE32(x) ((((x)+3) >> 2) << 2) 390163953Srrs 391163953Srrs#define IS_SCTP_CONTROL(a) ((a)->chunk_type != SCTP_DATA) 392163953Srrs#define IS_SCTP_DATA(a) ((a)->chunk_type == SCTP_DATA) 393163953Srrs 394163953Srrs 395163953Srrs/* SCTP parameter types */ 396163953Srrs/*************0x0000 series*************/ 397163953Srrs#define SCTP_HEARTBEAT_INFO 0x0001 398163953Srrs#define SCTP_IPV4_ADDRESS 0x0005 399163953Srrs#define SCTP_IPV6_ADDRESS 0x0006 400163953Srrs#define SCTP_STATE_COOKIE 0x0007 401163953Srrs#define SCTP_UNRECOG_PARAM 0x0008 402163953Srrs#define SCTP_COOKIE_PRESERVE 0x0009 403163953Srrs#define SCTP_HOSTNAME_ADDRESS 0x000b 404163953Srrs#define SCTP_SUPPORTED_ADDRTYPE 0x000c 405163953Srrs 406163953Srrs/* draft-ietf-stewart-strreset-xxx */ 407163953Srrs#define SCTP_STR_RESET_OUT_REQUEST 0x000d 408163953Srrs#define SCTP_STR_RESET_IN_REQUEST 0x000e 409163953Srrs#define SCTP_STR_RESET_TSN_REQUEST 0x000f 410163953Srrs#define SCTP_STR_RESET_RESPONSE 0x0010 411163953Srrs 412163953Srrs#define SCTP_MAX_RESET_PARAMS 2 413163953Srrs#define SCTP_STREAM_RESET_TSN_DELTA 0x1000 414163953Srrs 415163953Srrs/*************0x4000 series*************/ 416163953Srrs 417163953Srrs/*************0x8000 series*************/ 418163953Srrs#define SCTP_ECN_CAPABLE 0x8000 419163953Srrs/* ECN Nonce: draft-ladha-sctp-ecn-nonce */ 420163953Srrs#define SCTP_ECN_NONCE_SUPPORTED 0x8001 421163953Srrs/* draft-ietf-tsvwg-auth-xxx */ 422163953Srrs#define SCTP_RANDOM 0x8002 423163953Srrs#define SCTP_CHUNK_LIST 0x8003 424163953Srrs#define SCTP_HMAC_LIST 0x8004 425163953Srrs/* 426163953Srrs * draft-ietf-tsvwg-addip-sctp-xx param=0x8008 len=0xNNNN Byte | Byte | Byte 427163953Srrs * | Byte Byte | Byte ... 428163953Srrs * 429163953Srrs * Where each byte is a chunk type extension supported. For example, to support 430163953Srrs * all chunks one would have (in hex): 431163953Srrs * 432163953Srrs * 80 01 00 09 C0 C1 80 81 82 00 00 00 433163953Srrs * 434163953Srrs * Has the parameter. C0 = PR-SCTP (RFC3758) C1, 80 = ASCONF (addip draft) 81 435163953Srrs * = Packet Drop 82 = Stream Reset 83 = Authentication 436163953Srrs */ 437163953Srrs#define SCTP_SUPPORTED_CHUNK_EXT 0x8008 438163953Srrs 439163953Srrs/*************0xC000 series*************/ 440163953Srrs#define SCTP_PRSCTP_SUPPORTED 0xc000 441163953Srrs/* draft-ietf-tsvwg-addip-sctp */ 442163953Srrs#define SCTP_ADD_IP_ADDRESS 0xc001 443163953Srrs#define SCTP_DEL_IP_ADDRESS 0xc002 444163953Srrs#define SCTP_ERROR_CAUSE_IND 0xc003 445163953Srrs#define SCTP_SET_PRIM_ADDR 0xc004 446163953Srrs#define SCTP_SUCCESS_REPORT 0xc005 447163953Srrs#define SCTP_ULP_ADAPTATION 0xc006 448163953Srrs 449163953Srrs/* Notification error codes */ 450163953Srrs#define SCTP_NOTIFY_DATAGRAM_UNSENT 0x0001 451163953Srrs#define SCTP_NOTIFY_DATAGRAM_SENT 0x0002 452163953Srrs#define SCTP_FAILED_THRESHOLD 0x0004 453163953Srrs#define SCTP_HEARTBEAT_SUCCESS 0x0008 454163953Srrs#define SCTP_RESPONSE_TO_USER_REQ 0x000f 455163953Srrs#define SCTP_INTERNAL_ERROR 0x0010 456163953Srrs#define SCTP_SHUTDOWN_GUARD_EXPIRES 0x0020 457163953Srrs#define SCTP_RECEIVED_SACK 0x0040 458163953Srrs#define SCTP_PEER_FAULTY 0x0080 459163953Srrs 460163953Srrs/* bits for TOS field */ 461163953Srrs#define SCTP_ECT0_BIT 0x02 462163953Srrs#define SCTP_ECT1_BIT 0x01 463163953Srrs#define SCTP_CE_BITS 0x03 464163953Srrs 465163953Srrs/* below turns off above */ 466163953Srrs#define SCTP_FLEXIBLE_ADDRESS 0x20 467163953Srrs#define SCTP_NO_HEARTBEAT 0x40 468163953Srrs 469163953Srrs/* mask to get sticky */ 470163953Srrs#define SCTP_STICKY_OPTIONS_MASK 0x0c 471163953Srrs 472163953Srrs 473163953Srrs/* 474163953Srrs * SCTP states for internal state machine XXX (should match "user" values) 475163953Srrs */ 476163953Srrs#define SCTP_STATE_EMPTY 0x0000 477163953Srrs#define SCTP_STATE_INUSE 0x0001 478163953Srrs#define SCTP_STATE_COOKIE_WAIT 0x0002 479163953Srrs#define SCTP_STATE_COOKIE_ECHOED 0x0004 480163953Srrs#define SCTP_STATE_OPEN 0x0008 481163953Srrs#define SCTP_STATE_SHUTDOWN_SENT 0x0010 482163953Srrs#define SCTP_STATE_SHUTDOWN_RECEIVED 0x0020 483163953Srrs#define SCTP_STATE_SHUTDOWN_ACK_SENT 0x0040 484163953Srrs#define SCTP_STATE_SHUTDOWN_PENDING 0x0080 485163953Srrs#define SCTP_STATE_CLOSED_SOCKET 0x0100 486163953Srrs#define SCTP_STATE_ABOUT_TO_BE_FREED 0x0200 487163953Srrs#define SCTP_STATE_PARTIAL_MSG_LEFT 0x0400 488171745Srrs#define SCTP_STATE_WAS_ABORTED 0x0800 489163953Srrs#define SCTP_STATE_MASK 0x007f 490163953Srrs 491163953Srrs#define SCTP_GET_STATE(asoc) ((asoc)->state & SCTP_STATE_MASK) 492171943Srrs#define SCTP_SET_STATE(asoc, newstate) ((asoc)->state = ((asoc)->state & ~SCTP_STATE_MASK) | newstate) 493163953Srrs 494163953Srrs/* SCTP reachability state for each address */ 495163953Srrs#define SCTP_ADDR_REACHABLE 0x001 496163953Srrs#define SCTP_ADDR_NOT_REACHABLE 0x002 497163953Srrs#define SCTP_ADDR_NOHB 0x004 498163953Srrs#define SCTP_ADDR_BEING_DELETED 0x008 499163953Srrs#define SCTP_ADDR_NOT_IN_ASSOC 0x010 500163953Srrs#define SCTP_ADDR_WAS_PRIMARY 0x020 501163953Srrs#define SCTP_ADDR_SWITCH_PRIMARY 0x040 502163953Srrs#define SCTP_ADDR_OUT_OF_SCOPE 0x080 503163953Srrs#define SCTP_ADDR_DOUBLE_SWITCH 0x100 504163953Srrs#define SCTP_ADDR_UNCONFIRMED 0x200 505167598Srrs#define SCTP_ADDR_REQ_PRIMARY 0x400 506171440Srrs/* JRS 5/13/07 - Added potentially failed state for CMT PF */ 507171440Srrs#define SCTP_ADDR_PF 0x800 508163953Srrs#define SCTP_REACHABLE_MASK 0x203 509163953Srrs 510163953Srrs/* bound address types (e.g. valid address types to allow) */ 511163953Srrs#define SCTP_BOUND_V6 0x01 512163953Srrs#define SCTP_BOUND_V4 0x02 513163953Srrs 514163953Srrs/* 515163953Srrs * what is the default number of mbufs in a chain I allow before switching to 516163953Srrs * a cluster 517163953Srrs */ 518163953Srrs#define SCTP_DEFAULT_MBUFS_IN_CHAIN 5 519163953Srrs 520169655Srrs/* How long a cookie lives in milli-seconds */ 521169655Srrs#define SCTP_DEFAULT_COOKIE_LIFE 60000 522163953Srrs 523163953Srrs/* resource limit of streams */ 524163953Srrs#define MAX_SCTP_STREAMS 2048 525163953Srrs 526163953Srrs/* Maximum the mapping array will grow to (TSN mapping array) */ 527163953Srrs#define SCTP_MAPPING_ARRAY 512 528163953Srrs 529163953Srrs/* size of the inital malloc on the mapping array */ 530163953Srrs#define SCTP_INITIAL_MAPPING_ARRAY 16 531163953Srrs/* how much we grow the mapping array each call */ 532163953Srrs#define SCTP_MAPPING_ARRAY_INCR 32 533163953Srrs 534163953Srrs/* 535163953Srrs * Here we define the timer types used by the implementation as arguments in 536163953Srrs * the set/get timer type calls. 537163953Srrs */ 538163953Srrs#define SCTP_TIMER_INIT 0 539163953Srrs#define SCTP_TIMER_RECV 1 540163953Srrs#define SCTP_TIMER_SEND 2 541163953Srrs#define SCTP_TIMER_HEARTBEAT 3 542163953Srrs#define SCTP_TIMER_PMTU 4 543163953Srrs#define SCTP_TIMER_MAXSHUTDOWN 5 544163953Srrs#define SCTP_TIMER_SIGNATURE 6 545163953Srrs/* 546163953Srrs * number of timer types in the base SCTP structure used in the set/get and 547163953Srrs * has the base default. 548163953Srrs */ 549163953Srrs#define SCTP_NUM_TMRS 7 550163953Srrs 551163953Srrs/* timer types */ 552163953Srrs#define SCTP_TIMER_TYPE_NONE 0 553163953Srrs#define SCTP_TIMER_TYPE_SEND 1 554163953Srrs#define SCTP_TIMER_TYPE_INIT 2 555163953Srrs#define SCTP_TIMER_TYPE_RECV 3 556163953Srrs#define SCTP_TIMER_TYPE_SHUTDOWN 4 557163953Srrs#define SCTP_TIMER_TYPE_HEARTBEAT 5 558163953Srrs#define SCTP_TIMER_TYPE_COOKIE 6 559163953Srrs#define SCTP_TIMER_TYPE_NEWCOOKIE 7 560163953Srrs#define SCTP_TIMER_TYPE_PATHMTURAISE 8 561163953Srrs#define SCTP_TIMER_TYPE_SHUTDOWNACK 9 562163953Srrs#define SCTP_TIMER_TYPE_ASCONF 10 563163953Srrs#define SCTP_TIMER_TYPE_SHUTDOWNGUARD 11 564163953Srrs#define SCTP_TIMER_TYPE_AUTOCLOSE 12 565163953Srrs#define SCTP_TIMER_TYPE_EVENTWAKE 13 566163953Srrs#define SCTP_TIMER_TYPE_STRRESET 14 567163953Srrs#define SCTP_TIMER_TYPE_INPKILL 15 568163953Srrs#define SCTP_TIMER_TYPE_ITERATOR 16 569163953Srrs#define SCTP_TIMER_TYPE_EARLYFR 17 570163953Srrs#define SCTP_TIMER_TYPE_ASOCKILL 18 571163953Srrs#define SCTP_TIMER_TYPE_ADDR_WQ 19 572170056Srrs#define SCTP_TIMER_TYPE_ZERO_COPY 20 573170181Srrs#define SCTP_TIMER_TYPE_ZCOPY_SENDQ 21 574163953Srrs/* add new timers here - and increment LAST */ 575170181Srrs#define SCTP_TIMER_TYPE_LAST 22 576163953Srrs 577163953Srrs#define SCTP_IS_TIMER_TYPE_VALID(t) (((t) > SCTP_TIMER_TYPE_NONE) && \ 578163953Srrs ((t) < SCTP_TIMER_TYPE_LAST)) 579163953Srrs 580163953Srrs 581163953Srrs 582163953Srrs/* 583163953Srrs * Number of ticks before the soxwakeup() event that is delayed is sent AFTER 584163953Srrs * the accept() call 585163953Srrs */ 586163953Srrs#define SCTP_EVENTWAKEUP_WAIT_TICKS 3000 587163953Srrs 588163953Srrs/* 589163953Srrs * Of course we really don't collect stale cookies, being folks of decerning 590163953Srrs * taste. However we do count them, if we get too many before the association 591163953Srrs * comes up.. we give up. Below is the constant that dictates when we give it 592163953Srrs * up...this is a implemenation dependent treatment. In ours we do not ask 593163953Srrs * for a extension of time, but just retry this many times... 594163953Srrs */ 595163953Srrs#define SCTP_MAX_STALE_COOKIES_I_COLLECT 10 596163953Srrs 597163953Srrs/* max number of TSN's dup'd that I will hold */ 598163953Srrs#define SCTP_MAX_DUP_TSNS 20 599163953Srrs 600163953Srrs/* 601163953Srrs * Here we define the types used when setting the retry amounts. 602163953Srrs */ 603163953Srrs/* constants for type of set */ 604163953Srrs#define SCTP_MAXATTEMPT_INIT 2 605163953Srrs#define SCTP_MAXATTEMPT_SEND 3 606163953Srrs 607163953Srrs/* Maximum TSN's we will summarize in a drop report */ 608163953Srrs#define SCTP_MAX_DROP_REPORT 16 609163953Srrs 610163953Srrs/* How many drop re-attempts we make on INIT/COOKIE-ECHO */ 611163953Srrs#define SCTP_RETRY_DROPPED_THRESH 4 612163953Srrs 613163953Srrs/* 614163953Srrs * And the max we will keep a history of in the tcb which MUST be lower than 615163953Srrs * 256. 616163953Srrs */ 617163953Srrs#define SCTP_MAX_DROP_SAVE_REPORT 16 618163953Srrs 619163953Srrs/* 620163953Srrs * Here we define the default timers and the default number of attemts we 621163953Srrs * make for each respective side (send/init). 622163953Srrs */ 623163953Srrs 624163953Srrs/* 625163953Srrs * Maxmium number of chunks a single association can have on it. Note that 626163953Srrs * this is a squishy number since the count can run over this if the user 627163953Srrs * sends a large message down .. the fragmented chunks don't count until 628163953Srrs * AFTER the message is on queue.. it would be the next send that blocks 629163953Srrs * things. This number will get tuned up at boot in the sctp_init and use the 630163953Srrs * number of clusters as a base. This way high bandwidth environments will 631163953Srrs * not get impacted by the lower bandwidth sending a bunch of 1 byte chunks 632163953Srrs */ 633163953Srrs#define SCTP_ASOC_MAX_CHUNKS_ON_QUEUE 512 634163953Srrs 635167598Srrs/* The conversion from time to ticks and vice versa is done by rounding 636167598Srrs * upwards. This way we can test in the code the time to be positive and 637167598Srrs * know that this corresponds to a positive number of ticks. 638167598Srrs */ 639167598Srrs#define MSEC_TO_TICKS(x) ((hz == 1000) ? x : ((((x) * hz) + 999) / 1000)) 640167598Srrs#define TICKS_TO_MSEC(x) ((hz == 1000) ? x : ((((x) * 1000) + (hz - 1)) / hz)) 641163953Srrs 642163953Srrs#define SEC_TO_TICKS(x) ((x) * hz) 643167598Srrs#define TICKS_TO_SEC(x) (((x) + (hz - 1)) / hz) 644163953Srrs 645163953Srrs/* 646163953Srrs * Basically the minimum amount of time before I do a early FR. Making this 647163953Srrs * value to low will cause duplicate retransmissions. 648163953Srrs */ 649163953Srrs#define SCTP_MINFR_MSEC_TIMER 250 650163953Srrs/* The floor this value is allowed to fall to when starting a timer. */ 651163953Srrs#define SCTP_MINFR_MSEC_FLOOR 20 652163953Srrs 653163953Srrs/* init timer def = 1 sec */ 654163953Srrs#define SCTP_INIT_SEC 1 655163953Srrs 656163953Srrs/* send timer def = 1 seconds */ 657163953Srrs#define SCTP_SEND_SEC 1 658163953Srrs 659163953Srrs/* recv timer def = 200ms */ 660163953Srrs#define SCTP_RECV_MSEC 200 661163953Srrs 662163953Srrs/* 30 seconds + RTO (in ms) */ 663163953Srrs#define SCTP_HB_DEFAULT_MSEC 30000 664163953Srrs 665163953Srrs/* Max time I will wait for Shutdown to complete */ 666163953Srrs#define SCTP_DEF_MAX_SHUTDOWN_SEC 180 667163953Srrs 668163953Srrs 669163953Srrs/* 670163953Srrs * This is how long a secret lives, NOT how long a cookie lives how many 671163953Srrs * ticks the current secret will live. 672163953Srrs */ 673163953Srrs#define SCTP_DEFAULT_SECRET_LIFE_SEC 3600 674163953Srrs 675163953Srrs#define SCTP_RTO_UPPER_BOUND (60000) /* 60 sec in ms */ 676163953Srrs#define SCTP_RTO_UPPER_BOUND_SEC 60 /* for the init timer */ 677163953Srrs#define SCTP_RTO_LOWER_BOUND (1000) /* 1 sec in ms */ 678163953Srrs#define SCTP_RTO_INITIAL (3000) /* 3 sec in ms */ 679163953Srrs 680163953Srrs 681163953Srrs#define SCTP_INP_KILL_TIMEOUT 20/* number of ms to retry kill of inpcb */ 682163953Srrs#define SCTP_ASOC_KILL_TIMEOUT 10 /* number of ms to retry kill of inpcb */ 683163953Srrs 684163953Srrs#define SCTP_DEF_MAX_INIT 8 685163953Srrs#define SCTP_DEF_MAX_SEND 10 686170056Srrs#define SCTP_DEF_MAX_PATH_RTX 5 687163953Srrs 688163953Srrs#define SCTP_DEF_PMTU_RAISE_SEC 600 /* 10 min between raise attempts */ 689163953Srrs#define SCTP_DEF_PMTU_MIN 600 690163953Srrs 691170056Srrs 692163953Srrs#define SCTP_MSEC_IN_A_SEC 1000 693163953Srrs#define SCTP_USEC_IN_A_SEC 1000000 694163953Srrs#define SCTP_NSEC_IN_A_SEC 1000000000 695163953Srrs 696163953Srrs#define SCTP_MAX_OUTSTANDING_DG 10000 697163953Srrs 698163953Srrs/* How many streams I request initally by default */ 699163953Srrs#define SCTP_OSTREAM_INITIAL 10 700163953Srrs 701163953Srrs/* 702163953Srrs * How many smallest_mtu's need to increase before a window update sack is 703163953Srrs * sent (should be a power of 2). 704163953Srrs */ 705163953Srrs#define SCTP_SEG_TO_RWND_UPD 32 706163953Srrs/* Send window update (incr * this > hiwat). Should be a power of 2 */ 707163953Srrs#define SCTP_SCALE_OF_RWND_TO_UPD 4 708163953Srrs#define SCTP_MINIMAL_RWND (4096) /* minimal rwnd */ 709163953Srrs 710170606Srrs#define SCTP_ADDRMAX 24 711163953Srrs 712163953Srrs/* SCTP DEBUG Switch parameters */ 713163953Srrs#define SCTP_DEBUG_TIMER1 0x00000001 714170181Srrs#define SCTP_DEBUG_TIMER2 0x00000002 /* unused */ 715170181Srrs#define SCTP_DEBUG_TIMER3 0x00000004 /* unused */ 716163953Srrs#define SCTP_DEBUG_TIMER4 0x00000008 717163953Srrs#define SCTP_DEBUG_OUTPUT1 0x00000010 718163953Srrs#define SCTP_DEBUG_OUTPUT2 0x00000020 719163953Srrs#define SCTP_DEBUG_OUTPUT3 0x00000040 720163953Srrs#define SCTP_DEBUG_OUTPUT4 0x00000080 721163953Srrs#define SCTP_DEBUG_UTIL1 0x00000100 722170181Srrs#define SCTP_DEBUG_UTIL2 0x00000200 /* unused */ 723163953Srrs#define SCTP_DEBUG_AUTH1 0x00000400 724170181Srrs#define SCTP_DEBUG_AUTH2 0x00000800 /* unused */ 725163953Srrs#define SCTP_DEBUG_INPUT1 0x00001000 726163953Srrs#define SCTP_DEBUG_INPUT2 0x00002000 727163953Srrs#define SCTP_DEBUG_INPUT3 0x00004000 728170181Srrs#define SCTP_DEBUG_INPUT4 0x00008000 /* unused */ 729163953Srrs#define SCTP_DEBUG_ASCONF1 0x00010000 730163953Srrs#define SCTP_DEBUG_ASCONF2 0x00020000 731170181Srrs#define SCTP_DEBUG_OUTPUT5 0x00040000 /* unused */ 732170181Srrs#define SCTP_DEBUG_XXX 0x00080000 /* unused */ 733163953Srrs#define SCTP_DEBUG_PCB1 0x00100000 734170181Srrs#define SCTP_DEBUG_PCB2 0x00200000 /* unused */ 735163953Srrs#define SCTP_DEBUG_PCB3 0x00400000 736170181Srrs#define SCTP_DEBUG_PCB4 0x00800000 /* unused */ 737163953Srrs#define SCTP_DEBUG_INDATA1 0x01000000 738170181Srrs#define SCTP_DEBUG_INDATA2 0x02000000 /* unused */ 739170181Srrs#define SCTP_DEBUG_INDATA3 0x04000000 /* unused */ 740170181Srrs#define SCTP_DEBUG_INDATA4 0x08000000 /* unused */ 741170181Srrs#define SCTP_DEBUG_USRREQ1 0x10000000 /* unused */ 742170181Srrs#define SCTP_DEBUG_USRREQ2 0x20000000 /* unused */ 743163953Srrs#define SCTP_DEBUG_PEEL1 0x40000000 744170181Srrs#define SCTP_DEBUG_XXXXX 0x80000000 /* unused */ 745163953Srrs#define SCTP_DEBUG_ALL 0x7ff3ffff 746163953Srrs#define SCTP_DEBUG_NOISY 0x00040000 747163953Srrs 748163953Srrs/* What sender needs to see to avoid SWS or we consider peers rwnd 0 */ 749163953Srrs#define SCTP_SWS_SENDER_DEF 1420 750163953Srrs 751163953Srrs/* 752163953Srrs * SWS is scaled to the sb_hiwat of the socket. A value of 2 is hiwat/4, 1 753163953Srrs * would be hiwat/2 etc. 754163953Srrs */ 755163953Srrs/* What receiver needs to see in sockbuf or we tell peer its 1 */ 756163953Srrs#define SCTP_SWS_RECEIVER_DEF 3000 757163953Srrs 758163953Srrs#define SCTP_INITIAL_CWND 4380 759163953Srrs 760169352Srrs#define SCTP_DEFAULT_MTU 1500 /* emegency default MTU */ 761163953Srrs/* amount peer is obligated to have in rwnd or I will abort */ 762163953Srrs#define SCTP_MIN_RWND 1500 763163953Srrs 764163953Srrs#define SCTP_WINDOW_MIN 1500 /* smallest rwnd can be */ 765163953Srrs#define SCTP_WINDOW_MAX 1048576 /* biggest I can grow rwnd to My playing 766163953Srrs * around suggests a value greater than 64k 767163953Srrs * does not do much, I guess via the kernel 768163953Srrs * limitations on the stream/socket. */ 769163953Srrs 770163953Srrs/* I can handle a 1meg re-assembly */ 771163953Srrs#define SCTP_DEFAULT_MAXMSGREASM 1048576 772163953Srrs 773163953Srrs#define SCTP_DEFAULT_MAXSEGMENT 65535 774163953Srrs 775170642Srrs#define SCTP_CHUNK_BUFFER_SIZE 512 776166675Srrs#define SCTP_PARAM_BUFFER_SIZE 512 777163953Srrs 778163953Srrs#define SCTP_DEFAULT_MINSEGMENT 512 /* MTU size ... if no mtu disc */ 779163953Srrs#define SCTP_HOW_MANY_SECRETS 2 /* how many secrets I keep */ 780163953Srrs 781163953Srrs#define SCTP_NUMBER_OF_SECRETS 8 /* or 8 * 4 = 32 octets */ 782163953Srrs#define SCTP_SECRET_SIZE 32 /* number of octets in a 256 bits */ 783163953Srrs 784163953Srrs 785163953Srrs/* 786163953Srrs * SCTP upper layer notifications 787163953Srrs */ 788163953Srrs#define SCTP_NOTIFY_ASSOC_UP 1 789163953Srrs#define SCTP_NOTIFY_ASSOC_DOWN 2 790163953Srrs#define SCTP_NOTIFY_INTERFACE_DOWN 3 791163953Srrs#define SCTP_NOTIFY_INTERFACE_UP 4 792163953Srrs#define SCTP_NOTIFY_DG_FAIL 5 793163953Srrs#define SCTP_NOTIFY_STRDATA_ERR 6 794163953Srrs#define SCTP_NOTIFY_ASSOC_ABORTED 7 795163953Srrs#define SCTP_NOTIFY_PEER_OPENED_STREAM 8 796163953Srrs#define SCTP_NOTIFY_STREAM_OPENED_OK 9 797163953Srrs#define SCTP_NOTIFY_ASSOC_RESTART 10 798163953Srrs#define SCTP_NOTIFY_HB_RESP 11 799163953Srrs#define SCTP_NOTIFY_ASCONF_SUCCESS 12 800163953Srrs#define SCTP_NOTIFY_ASCONF_FAILED 13 801163953Srrs#define SCTP_NOTIFY_PEER_SHUTDOWN 14 802163953Srrs#define SCTP_NOTIFY_ASCONF_ADD_IP 15 803163953Srrs#define SCTP_NOTIFY_ASCONF_DELETE_IP 16 804163953Srrs#define SCTP_NOTIFY_ASCONF_SET_PRIMARY 17 805163953Srrs#define SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION 18 806163953Srrs#define SCTP_NOTIFY_ADAPTATION_INDICATION 19 807163953Srrs/* same as above */ 808163953Srrs#define SCTP_NOTIFY_ADAPTION_INDICATION 19 809163953Srrs#define SCTP_NOTIFY_INTERFACE_CONFIRMED 20 810163953Srrs#define SCTP_NOTIFY_STR_RESET_RECV 21 811163953Srrs#define SCTP_NOTIFY_STR_RESET_SEND 22 812163953Srrs#define SCTP_NOTIFY_STR_RESET_FAILED_OUT 23 813163953Srrs#define SCTP_NOTIFY_STR_RESET_FAILED_IN 24 814163953Srrs#define SCTP_NOTIFY_AUTH_NEW_KEY 25 815163953Srrs#define SCTP_NOTIFY_AUTH_KEY_CONFLICT 26 816163953Srrs#define SCTP_NOTIFY_SPECIAL_SP_FAIL 27 817163953Srrs#define SCTP_NOTIFY_MAX 27 818163953Srrs 819163953Srrs/* This is the value for messages that are NOT completely 820163953Srrs * copied down where we will start to split the message. 821163953Srrs * So, with our default, we split only if the piece we 822163953Srrs * want to take will fill up a full MTU (assuming 823163953Srrs * a 1500 byte MTU). 824163953Srrs */ 825168124Srrs#define SCTP_DEFAULT_SPLIT_POINT_MIN 2904 826163953Srrs 827165220Srrs/* ABORT CODES and other tell-tale location 828165220Srrs * codes are generated by adding the below 829165220Srrs * to the instance id. 830165220Srrs */ 831165220Srrs 832165220Srrs/* File defines */ 833165220Srrs#define SCTP_FROM_SCTP_INPUT 0x10000000 834165220Srrs#define SCTP_FROM_SCTP_PCB 0x20000000 835165220Srrs#define SCTP_FROM_SCTP_INDATA 0x30000000 836165220Srrs#define SCTP_FROM_SCTP_TIMER 0x40000000 837165220Srrs#define SCTP_FROM_SCTP_USRREQ 0x50000000 838165220Srrs#define SCTP_FROM_SCTPUTIL 0x60000000 839165220Srrs#define SCTP_FROM_SCTP6_USRREQ 0x70000000 840165220Srrs#define SCTP_FROM_SCTP_ASCONF 0x80000000 841165220Srrs#define SCTP_FROM_SCTP_OUTPUT 0x90000000 842165220Srrs#define SCTP_FROM_SCTP_PEELOFF 0xa0000000 843170056Srrs#define SCTP_FROM_SCTP_PANDA 0xb0000000 844171943Srrs#define SCTP_FROM_SCTP_SYSCTL 0xc0000000 845165220Srrs 846165220Srrs/* Location ID's */ 847165220Srrs#define SCTP_LOC_1 0x00000001 848165220Srrs#define SCTP_LOC_2 0x00000002 849165220Srrs#define SCTP_LOC_3 0x00000003 850165220Srrs#define SCTP_LOC_4 0x00000004 851165220Srrs#define SCTP_LOC_5 0x00000005 852165220Srrs#define SCTP_LOC_6 0x00000006 853165220Srrs#define SCTP_LOC_7 0x00000007 854165220Srrs#define SCTP_LOC_8 0x00000008 855165220Srrs#define SCTP_LOC_9 0x00000009 856165220Srrs#define SCTP_LOC_10 0x0000000a 857165220Srrs#define SCTP_LOC_11 0x0000000b 858165220Srrs#define SCTP_LOC_12 0x0000000c 859165220Srrs#define SCTP_LOC_13 0x0000000d 860165220Srrs#define SCTP_LOC_14 0x0000000e 861165220Srrs#define SCTP_LOC_15 0x0000000f 862165220Srrs#define SCTP_LOC_16 0x00000010 863165220Srrs#define SCTP_LOC_17 0x00000011 864165220Srrs#define SCTP_LOC_18 0x00000012 865165220Srrs#define SCTP_LOC_19 0x00000013 866165220Srrs#define SCTP_LOC_20 0x00000014 867165220Srrs#define SCTP_LOC_21 0x00000015 868165220Srrs#define SCTP_LOC_22 0x00000016 869165220Srrs#define SCTP_LOC_23 0x00000017 870165220Srrs#define SCTP_LOC_24 0x00000018 871165220Srrs#define SCTP_LOC_25 0x00000019 872165220Srrs#define SCTP_LOC_26 0x0000001a 873165220Srrs#define SCTP_LOC_27 0x0000001b 874165220Srrs#define SCTP_LOC_28 0x0000001c 875165220Srrs#define SCTP_LOC_29 0x0000001d 876165220Srrs#define SCTP_LOC_30 0x0000001e 877165220Srrs#define SCTP_LOC_31 0x0000001f 878165220Srrs#define SCTP_LOC_32 0x00000020 879169352Srrs#define SCTP_LOC_33 0x00000021 880165220Srrs 881165220Srrs 882165220Srrs/* Free assoc codes */ 883165220Srrs#define SCTP_NORMAL_PROC 0 884165220Srrs#define SCTP_PCBFREE_NOFORCE 1 885165220Srrs#define SCTP_PCBFREE_FORCE 2 886165220Srrs 887165220Srrs/* From codes for adding addresses */ 888165220Srrs#define SCTP_ADDR_IS_CONFIRMED 8 889165220Srrs#define SCTP_ADDR_DYNAMIC_ADDED 6 890165220Srrs#define SCTP_IN_COOKIE_PROC 100 891165220Srrs#define SCTP_ALLOC_ASOC 1 892165220Srrs#define SCTP_LOAD_ADDR_2 2 893165220Srrs#define SCTP_LOAD_ADDR_3 3 894165220Srrs#define SCTP_LOAD_ADDR_4 4 895165220Srrs#define SCTP_LOAD_ADDR_5 5 896165220Srrs 897165220Srrs#define SCTP_DONOT_SETSCOPE 0 898165220Srrs#define SCTP_DO_SETSCOPE 1 899165220Srrs 900165220Srrs 901163953Srrs/* This value determines the default for when 902163953Srrs * we try to add more on the send queue., if 903163953Srrs * there is room. This prevents us from cycling 904163953Srrs * into the copy_resume routine to often if 905163953Srrs * we have not got enough space to add a decent 906163953Srrs * enough size message. Note that if we have enough 907163953Srrs * space to complete the message copy we will always 908163953Srrs * add to the message, no matter what the size. Its 909163953Srrs * only when we reach the point that we have some left 910163953Srrs * to add, there is only room for part of it that we 911163953Srrs * will use this threshold. Its also a sysctl. 912163953Srrs */ 913163953Srrs#define SCTP_DEFAULT_ADD_MORE 1452 914163953Srrs 915163953Srrs#ifndef SCTP_PCBHASHSIZE 916163953Srrs/* default number of association hash buckets in each endpoint */ 917163953Srrs#define SCTP_PCBHASHSIZE 256 918163953Srrs#endif 919163953Srrs#ifndef SCTP_TCBHASHSIZE 920163953Srrs#define SCTP_TCBHASHSIZE 1024 921163953Srrs#endif 922163953Srrs 923163953Srrs#ifndef SCTP_CHUNKQUEUE_SCALE 924163953Srrs#define SCTP_CHUNKQUEUE_SCALE 10 925163953Srrs#endif 926163953Srrs 927163953Srrs/* clock variance is 1 ms */ 928163953Srrs#define SCTP_CLOCK_GRANULARITY 1 929163953Srrs#define IP_HDR_SIZE 40 /* we use the size of a IP6 header here this 930163953Srrs * detracts a small amount for ipv4 but it 931163953Srrs * simplifies the ipv6 addition */ 932163953Srrs 933169380Srrs/* Argument magic number for sctp_inpcb_free() */ 934169380Srrs 935169380Srrs/* third argument */ 936169380Srrs#define SCTP_CALLED_DIRECTLY_NOCMPSET 0 937169380Srrs#define SCTP_CALLED_AFTER_CMPSET_OFCLOSE 1 938169380Srrs 939169380Srrs/* second argument */ 940169380Srrs#define SCTP_FREE_SHOULD_USE_ABORT 1 941169380Srrs#define SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE 0 942169380Srrs 943163953Srrs#ifndef IPPROTO_SCTP 944163953Srrs#define IPPROTO_SCTP 132 /* the Official IANA number :-) */ 945163953Srrs#endif /* !IPPROTO_SCTP */ 946163953Srrs 947163953Srrs#define SCTP_MAX_DATA_BUNDLING 256 948163953Srrs#define SCTP_MAX_CONTROL_BUNDLING 20 949163953Srrs 950163953Srrs/* modular comparison */ 951163953Srrs/* True if a > b (mod = M) */ 952163953Srrs#define compare_with_wrap(a, b, M) (((a > b) && ((a - b) < ((M >> 1) + 1))) || \ 953163953Srrs ((b > a) && ((b - a) > ((M >> 1) + 1)))) 954163953Srrs 955163953Srrs 956163953Srrs/* Mapping array manipulation routines */ 957163953Srrs#define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01) 958163953Srrs#define SCTP_SET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] |= (0x01 << ((gap & 0x07)))) 959163953Srrs#define SCTP_UNSET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] &= ((~(0x01 << ((gap & 0x07)))) & 0xff)) 960163953Srrs 961163953Srrs 962168124Srrs#define SCTP_RETRAN_DONE -1 963168124Srrs#define SCTP_RETRAN_EXIT -2 964168124Srrs 965163953Srrs/* 966163953Srrs * This value defines the number of vtag block time wait entry's per list 967163953Srrs * element. Each entry will take 2 4 byte ints (and of course the overhead 968163953Srrs * of the next pointer as well). Using 15 as an example will yield * ((8 * 969163953Srrs * 15) + 8) or 128 bytes of overhead for each timewait block that gets 970163953Srrs * initialized. Increasing it to 31 would yeild 256 bytes per block. 971163953Srrs */ 972163953Srrs#define SCTP_NUMBER_IN_VTAG_BLOCK 15 973163953Srrs/* 974163953Srrs * If we use the STACK option, we have an array of this size head pointers. 975163953Srrs * This array is mod'd the with the size to find which bucket and then all 976163953Srrs * entries must be searched to see if the tag is in timed wait. If so we 977163953Srrs * reject it. 978163953Srrs */ 979170138Srrs#define SCTP_STACK_VTAG_HASH_SIZE 31 980170138Srrs#define SCTP_STACK_VTAG_HASH_SIZE_A 32 981163953Srrs 982170138Srrs 983163953Srrs/* 984163953Srrs * If we use the per-endpoint model than we do not have a hash table of 985163953Srrs * entries but instead have a single head pointer and we must crawl through 986163953Srrs * the entire list. 987163953Srrs */ 988163953Srrs 989163953Srrs/* 990163953Srrs * Number of seconds of time wait, tied to MSL value (2 minutes), so 2 * MSL 991163953Srrs * = 4 minutes or 480 seconds. 992163953Srrs */ 993163953Srrs#define SCTP_TIME_WAIT 480 994163953Srrs 995166023Srrs/* This time wait is the same as the default cookie life 996166023Srrs * since we now enter a tag in every time we send a cookie. 997166023Srrs * We want this shorter to avoid vtag depletion. 998166023Srrs */ 999166023Srrs#define SCTP_TIME_WAIT_SHORT 60 1000166023Srrs 1001163953Srrs/* The system retains a cache of free chunks such to 1002163953Srrs * cut down on calls the memory allocation system. There 1003163953Srrs * is a per association limit of free items and a overall 1004163953Srrs * system limit. If either one gets hit then the resource 1005163953Srrs * stops being cached. 1006163953Srrs */ 1007163953Srrs 1008163953Srrs#define SCTP_DEF_ASOC_RESC_LIMIT 10 1009163953Srrs#define SCTP_DEF_SYSTEM_RESC_LIMIT 1000 1010163953Srrs 1011163953Srrs 1012163953Srrs#define IN4_ISPRIVATE_ADDRESS(a) \ 1013166675Srrs ((((uint8_t *)&(a)->s_addr)[0] == 10) || \ 1014166675Srrs ((((uint8_t *)&(a)->s_addr)[0] == 172) && \ 1015166675Srrs (((uint8_t *)&(a)->s_addr)[1] >= 16) && \ 1016166675Srrs (((uint8_t *)&(a)->s_addr)[1] <= 32)) || \ 1017166675Srrs ((((uint8_t *)&(a)->s_addr)[0] == 192) && \ 1018166675Srrs (((uint8_t *)&(a)->s_addr)[1] == 168))) 1019163953Srrs 1020163953Srrs#define IN4_ISLOOPBACK_ADDRESS(a) \ 1021166675Srrs ((((uint8_t *)&(a)->s_addr)[0] == 127) && \ 1022166675Srrs (((uint8_t *)&(a)->s_addr)[1] == 0) && \ 1023166675Srrs (((uint8_t *)&(a)->s_addr)[2] == 0) && \ 1024166675Srrs (((uint8_t *)&(a)->s_addr)[3] == 1)) 1025163953Srrs 1026163953Srrs 1027163953Srrs#if defined(_KERNEL) 1028163953Srrs 1029163953Srrs#define SCTP_GETTIME_TIMEVAL(x) (getmicrouptime(x)) 1030163953Srrs#define SCTP_GETPTIME_TIMEVAL(x) (microuptime(x)) 1031163953Srrs/*#if defined(__FreeBSD__) || defined(__APPLE__)*/ 1032163953Srrs/*#define SCTP_GETTIME_TIMEVAL(x) { \*/ 1033163953Srrs/* (x)->tv_sec = ticks / 1000; \*/ 1034163953Srrs/* (x)->tv_usec = (ticks % 1000) * 1000; \*/ 1035163953Srrs/*}*/ 1036163953Srrs 1037163953Srrs/*#else*/ 1038163953Srrs/*#define SCTP_GETTIME_TIMEVAL(x) (microtime(x))*/ 1039163953Srrs/*#endif __FreeBSD__ */ 1040163953Srrs 1041163953Srrs#define sctp_sowwakeup(inp, so) \ 1042163953Srrsdo { \ 1043163953Srrs if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1044163953Srrs inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \ 1045163953Srrs } else { \ 1046163953Srrs sowwakeup(so); \ 1047163953Srrs } \ 1048163953Srrs} while (0) 1049163953Srrs 1050163953Srrs#define sctp_sowwakeup_locked(inp, so) \ 1051163953Srrsdo { \ 1052163953Srrs if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1053163953Srrs SOCKBUF_UNLOCK(&((so)->so_snd)); \ 1054163953Srrs inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \ 1055163953Srrs } else { \ 1056163953Srrs sowwakeup_locked(so); \ 1057163953Srrs } \ 1058163953Srrs} while (0) 1059163953Srrs 1060163953Srrs#define sctp_sorwakeup(inp, so) \ 1061163953Srrsdo { \ 1062163953Srrs if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1063163953Srrs inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \ 1064163953Srrs } else { \ 1065163953Srrs sorwakeup(so); \ 1066163953Srrs } \ 1067163953Srrs} while (0) 1068163953Srrs 1069163953Srrs#define sctp_sorwakeup_locked(inp, so) \ 1070163953Srrsdo { \ 1071163953Srrs if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1072163953Srrs inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \ 1073163953Srrs SOCKBUF_UNLOCK(&((so)->so_rcv)); \ 1074163953Srrs } else { \ 1075163953Srrs sorwakeup_locked(so); \ 1076163953Srrs } \ 1077163953Srrs} while (0) 1078163953Srrs 1079163953Srrs#endif /* _KERNEL */ 1080163953Srrs#endif 1081