/*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * b) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE.
*/
#endif /* IANA assigned port number for SCTP over UDP encapsulation */ #define SCTP_OVER_UDP_TUNNELING_PORT 9899
/* Number of packets to get before sack sent by default */ #define SCTP_DEFAULT_SACK_FREQ 2
/* Address limit - This variable is calculated * based on an 65535 byte max ip packet. We take out 100 bytes * for the cookie, 40 bytes for a v6 header and 32 * bytes for the init structure. A second init structure * for the init-ack and then finally a third one for the * imbedded init. This yeilds 100+40+(3 * 32) = 236 bytes. * This leaves 65299 bytes for addresses. We throw out the 299 bytes. * Now whatever we send in the INIT() we need to allow to get back in the * INIT-ACK plus all the values from INIT and INIT-ACK * listed in the cookie. Plus we need some overhead for * maybe copied parameters in the COOKIE. If we * allow 1080 addresses, and each side has 1080 V6 addresses * that will be 21600 bytes. In the INIT-ACK we will * see the INIT-ACK 21600 + 43200 in the cookie. This leaves * about 500 bytes slack for misc things in the cookie.
*/ #define SCTP_ADDRESS_LIMIT 1080
/* We need at least 2k of space for us, inits * larger than that lets abort.
*/ #define SCTP_LARGEST_INIT_ACCEPTED (65535 - 2048)
/* Largest length of a chunk */ #define SCTP_MAX_CHUNK_LENGTH 0xffff /* Largest length of an error cause */ #define SCTP_MAX_CAUSE_LENGTH 0xffff /* Number of addresses where we just skip the counting */ #define SCTP_COUNT_LIMIT 40
/* number of associations by default for zone allocation */ #define SCTP_MAX_NUM_OF_ASOC 40000 /* how many addresses per assoc remote and local */ #define SCTP_SCALE_FOR_ADDR 2
/* * Threshold for rwnd updates, we have to read (sb_hiwat >> * SCTP_RWND_HIWAT_SHIFT) before we will look to see if we need to send a * window update sack. When we look, we compare the last rwnd we sent vs the * current rwnd. It too must be greater than this value. Using 3 divdes the * hiwat by 8, so for 200k rwnd we need to read 24k. For a 64k rwnd we need * to read 8k. This seems about right.. I hope :-D.. we do set a * min of a MTU on it so if the rwnd is real small we will insist * on a full MTU of 1500 bytes.
*/ #define SCTP_RWND_HIWAT_SHIFT 3
/* How much of the rwnd must the * message be taking up to start partial delivery. * We calculate this by shifing the hi_water (recv_win) * left the following .. set to 1, when a message holds * 1/2 the rwnd. If we set it to 2 when a message holds * 1/4 the rwnd...etc..
*/
#define SCTP_PARTIAL_DELIVERY_SHIFT 1
/* * default HMAC for cookies, etc... use one of the AUTH HMAC id's * SCTP_HMAC is the HMAC_ID to use * SCTP_SIGNATURE_SIZE is the digest length
*/ #define SCTP_HMAC SCTP_AUTH_HMAC_ID_SHA1 #define SCTP_SIGNATURE_SIZE SCTP_AUTH_DIGEST_LEN_SHA1 #define SCTP_SIGNATURE_ALOC_SIZE SCTP_SIGNATURE_SIZE
/* * the SCTP protocol signature this includes the version number encoded in * the last 4 bits of the signature.
*/ #define PROTO_SIGNATURE_A 0x30000000 #define SCTP_VERSION_NUMBER 0x3
#define MAX_TSN 0xffffffff
/* how many executions every N tick's */ #define SCTP_ITERATOR_MAX_AT_ONCE 20
/* number of clock ticks between iterator executions */ #define SCTP_ITERATOR_TICKS 1
/* * option: If you comment out the following you will receive the old behavior * of obeying cwnd for the fast retransmit algorithm. With this defined a FR * happens right away with-out waiting for the flightsize to drop below the * cwnd value (which is reduced by the FR to 1/2 the inflight packets).
*/ #define SCTP_IGNORE_CWND_ON_FR 1
/* * Adds implementors guide behavior to only use newest highest update in SACK * gap ack's to figure out if you need to stroke a chunk for FR.
*/ #define SCTP_NO_FR_UNLESS_SEGMENT_SMALLER 1
/* default max I can burst out after a fast retransmit, 0 disables it */ #define SCTP_DEF_MAX_BURST 4 #define SCTP_DEF_HBMAX_BURST 4 #define SCTP_DEF_FRMAX_BURST 4
/* RTO calculation flag to say if it * is safe to determine local lan or not.
*/ #define SCTP_RTT_FROM_NON_DATA 0 #define SCTP_RTT_FROM_DATA 1
#define PR_SCTP_UNORDERED_FLAG 0x0001
/* IP hdr (20/40) + 12+2+2 (enet) + sctp common 12 */ #define SCTP_FIRST_MBUF_RESV 68 /* Packet transmit states in the sent field */ #define SCTP_DATAGRAM_UNSENT 0 #define SCTP_DATAGRAM_SENT 1 #define SCTP_DATAGRAM_RESEND1 2 /* not used (in code, but may
* hit this value) */ #define SCTP_DATAGRAM_RESEND2 3 /* not used (in code, but may
* hit this value) */ #define SCTP_DATAGRAM_RESEND 4 #define SCTP_DATAGRAM_ACKED 10010 #define SCTP_DATAGRAM_MARKED 20010 #define SCTP_FORWARD_TSN_SKIP 30010 #define SCTP_DATAGRAM_NR_ACKED 40010
/* * what is the default number of mbufs in a chain I allow before switching to * a cluster
*/ #define SCTP_DEFAULT_MBUFS_IN_CHAIN 5
/* How long a cookie lives in milli-seconds */ #define SCTP_DEFAULT_COOKIE_LIFE 60000
/* Maximum the mapping array will grow to (TSN mapping array) */ #define SCTP_MAPPING_ARRAY 512
/* size of the initial malloc on the mapping array */ #define SCTP_INITIAL_MAPPING_ARRAY 16 /* how much we grow the mapping array each call */ #define SCTP_MAPPING_ARRAY_INCR 32
/* * Here we define the timer types used by the implementation as arguments in * the set/get timer type calls.
*/ #define SCTP_TIMER_INIT 0 #define SCTP_TIMER_RECV 1 #define SCTP_TIMER_SEND 2 #define SCTP_TIMER_HEARTBEAT 3 #define SCTP_TIMER_PMTU 4 #define SCTP_TIMER_MAXSHUTDOWN 5 #define SCTP_TIMER_SIGNATURE 6 /* * number of timer types in the base SCTP structure used in the set/get and * has the base default.
*/ #define SCTP_NUM_TMRS 7
#ifdefined(__APPLE__) && !defined(__Userspace__) /* Number of ticks to run the main timer at in msec */ #define SCTP_MAIN_TIMER_DEFAULT 10
#endif /* max number of TSN's dup'd that I will hold */ #define SCTP_MAX_DUP_TSNS 20
/* * Here we define the types used when setting the retry amounts.
*/ /* How many drop re-attempts we make on INIT/COOKIE-ECHO */ #define SCTP_RETRY_DROPPED_THRESH 4
/* * Maxmium number of chunks a single association can have on it. Note that * this is a squishy number since the count can run over this if the user * sends a large message down .. the fragmented chunks don't count until * AFTER the message is on queue.. it would be the next send that blocks * things. This number will get tuned up at boot in the sctp_init and use the * number of clusters as a base. This way high bandwidth environments will * not get impacted by the lower bandwidth sending a bunch of 1 byte chunks
*/ #define SCTP_ASOC_MAX_CHUNKS_ON_QUEUE 512
/* * Basically the minimum amount of time before I do a early FR. Making this * value to low will cause duplicate retransmissions.
*/ #define SCTP_MINFR_MSEC_TIMER 250 /* The floor this value is allowed to fall to when starting a timer. */ #define SCTP_MINFR_MSEC_FLOOR 20
/* * This is how long a secret lives, NOT how long a cookie lives how many * ticks the current secret will live.
*/ #define SCTP_DEFAULT_SECRET_LIFE_SEC 3600
#define SCTP_RTO_UPPER_BOUND (60000) /* 60 sec in ms */ #define SCTP_RTO_LOWER_BOUND (1000) /* 1 sec is ms */ #define SCTP_RTO_INITIAL (1000) /* 1 sec in ms */
#define SCTP_INP_KILL_TIMEOUT 20 /* number of ms to retry kill of inpcb */ #define SCTP_ASOC_KILL_TIMEOUT 10 /* number of ms to retry kill of inpcb */
#define SCTP_DEF_PMTU_RAISE_SEC 600 /* 10 min between raise attempts */
/* How many streams I request initially by default */ #define SCTP_OSTREAM_INITIAL 10 #define SCTP_ISTREAM_INITIAL 2048
/* * How many smallest_mtu's need to increase before a window update sack is * sent (should be a power of 2).
*/ /* Send window update (incr * this > hiwat). Should be a power of 2 */ #define SCTP_MINIMAL_RWND (4096) /* minimal rwnd */
/* What sender needs to see to avoid SWS or we consider peers rwnd 0 */ #define SCTP_SWS_SENDER_DEF 1420
/* * SWS is scaled to the sb_hiwat of the socket. A value of 2 is hiwat/4, 1 * would be hiwat/2 etc.
*/ /* What receiver needs to see in sockbuf or we tell peer its 1 */ #define SCTP_SWS_RECEIVER_DEF 3000
#define SCTP_INITIAL_CWND 4380
#define SCTP_DEFAULT_MTU 1500 /* emergency default MTU */ /* amount peer is obligated to have in rwnd or I will abort */ #define SCTP_MIN_RWND 1500
/* This is the value for messages that are NOT completely * copied down where we will start to split the message. * So, with our default, we split only if the piece we * want to take will fill up a full MTU (assuming * a 1500 byte MTU).
*/ #define SCTP_DEFAULT_SPLIT_POINT_MIN 2904
/* Maximum length of diagnostic information in error causes */ #ifdefined(__Userspace__) #define SCTP_DIAG_INFO_LEN 256 #else #define SCTP_DIAG_INFO_LEN 128 #endif
/* ABORT CODES and other tell-tale location * codes are generated by adding the below * to the instance id.
*/
/* This value determines the default for when * we try to add more on the send queue., if * there is room. This prevents us from cycling * into the copy_resume routine to often if * we have not got enough space to add a decent * enough size message. Note that if we have enough * space to complete the message copy we will always * add to the message, no matter what the size. Its * only when we reach the point that we have some left * to add, there is only room for part of it that we * will use this threshold. Its also a sysctl.
*/ #define SCTP_DEFAULT_ADD_MORE 1452
#ifndef SCTP_PCBHASHSIZE /* default number of association hash buckets in each endpoint */ #define SCTP_PCBHASHSIZE 256 #endif #ifndef SCTP_TCBHASHSIZE #define SCTP_TCBHASHSIZE 1024 #endif
#ifdefined(__FreeBSD__) && !defined(__Userspace__) /* clock variance is 1 ms */ #define SCTP_CLOCK_GRANULARITY 1 #else /* clock variance is 10 ms */ #define SCTP_CLOCK_GRANULARITY 10 #endif #define IP_HDR_SIZE 40 /* we use the size of a IP6 header here this * detracts a small amount for ipv4 but it
* simplifies the ipv6 addition */
#ifndef IPPROTO_SCTP #define IPPROTO_SCTP 132 /* the Official IANA number :-) */ #endif/* !IPPROTO_SCTP */
#define SCTP_MAX_DATA_BUNDLING 256
/* modular comparison */ /* See RFC 1982 for details. */ #define SCTP_UINT16_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \
((a > b) && ((uint16_t)(a - b) < (1U<<15)))) #define SCTP_UINT16_GE(a, b) (SCTP_UINT16_GT(a, b) || (a == b)) #define SCTP_UINT32_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \
((a > b) && ((uint32_t)(a - b) < (1U<<31)))) #define SCTP_UINT32_GE(a, b) (SCTP_UINT32_GT(a, b) || (a == b))
#define SCTP_SSN_GT(a, b) SCTP_UINT16_GT(a, b) #define SCTP_SSN_GE(a, b) SCTP_UINT16_GE(a, b) #define SCTP_TSN_GT(a, b) SCTP_UINT32_GT(a, b) #define SCTP_TSN_GE(a, b) SCTP_UINT32_GE(a, b) #define SCTP_MID_GT(i, a, b) (((i) == 1) ? SCTP_UINT32_GT(a, b) : SCTP_UINT16_GT((uint16_t)a, (uint16_t)b)) #define SCTP_MID_GE(i, a, b) (((i) == 1) ? SCTP_UINT32_GE(a, b) : SCTP_UINT16_GE((uint16_t)a, (uint16_t)b)) #define SCTP_MID_EQ(i, a, b) (((i) == 1) ? a == b : (uint16_t)a == (uint16_t)b)
/* * This value defines the number of vtag block time wait entry's per list * element. Each entry will take 2 4 byte ints (and of course the overhead * of the next pointer as well). Using 15 as an example will yield * ((8 * * 15) + 8) or 128 bytes of overhead for each timewait block that gets * initialized. Increasing it to 31 would yield 256 bytes per block.
*/ #define SCTP_NUMBER_IN_VTAG_BLOCK 15 /* * If we use the STACK option, we have an array of this size head pointers. * This array is mod'd the with the size to find which bucket and then all * entries must be searched to see if the tag is in timed wait. If so we * reject it.
*/ #define SCTP_STACK_VTAG_HASH_SIZE 32
/* * Number of seconds of time wait for a vtag.
*/ #define SCTP_TIME_WAIT 60
/* How many micro seconds is the cutoff from * local lan type rtt's
*/ /* * We allow 900us for the rtt.
*/ #define SCTP_LOCAL_LAN_RTT 900 #define SCTP_LAN_UNKNOWN 0 #define SCTP_LAN_LOCAL 1 #define SCTP_LAN_INTERNET 2
/* The system retains a cache of free chunks such to * cut down on calls the memory allocation system. There * is a per association limit of free items and a overall * system limit. If either one gets hit then the resource * stops being cached.
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.