/* SPDX-License-Identifier: GPL-2.0-or-later */ /* SCTP kernel implementation * (C) Copyright IBM Corp. 2001, 2004 * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2001 Intel Corp. * * This file is part of the SCTP kernel implementation * * Please send any bug reports or fixes you make to the * email address(es): * lksctp developers <[email protected]> * * Written or modified by: * La Monte H.P. Yarroll <[email protected]> * Karl Knutson <[email protected]> * Randall Stewart <[email protected]> * Ken Morneau <[email protected]> * Qiaobing Xie <[email protected]> * Xingang Guo <[email protected]> * Sridhar Samudrala <[email protected]> * Daisy Chang <[email protected]> */ #ifndef __sctp_constants_h__ #define __sctp_constants_h__ #include <linux/sctp.h> #include <linux/ipv6.h> /* For ipv6hdr. */ #include <net/tcp_states.h> /* For TCP states used in enum sctp_sock_state */ /* Value used for stream negotiation. */ enum { … }; enum { … }; enum { … }; /* Since CIDs are sparse, we need all four of the following * symbols. CIDs are dense through SCTP_CID_BASE_MAX. */ #define SCTP_CID_BASE_MAX … #define SCTP_NUM_BASE_CHUNK_TYPES … #define SCTP_NUM_ADDIP_CHUNK_TYPES … #define SCTP_NUM_PRSCTP_CHUNK_TYPES … #define SCTP_NUM_RECONF_CHUNK_TYPES … #define SCTP_NUM_AUTH_CHUNK_TYPES … #define SCTP_NUM_CHUNK_TYPES … /* These are the different flavours of event. */ enum sctp_event_type { … }; /* As a convenience for the state machine, we append SCTP_EVENT_* and * SCTP_ULP_* to the list of possible chunks. */ enum sctp_event_timeout { … }; #define SCTP_EVENT_TIMEOUT_MAX … #define SCTP_NUM_TIMEOUT_TYPES … enum sctp_event_other { … }; #define SCTP_EVENT_OTHER_MAX … #define SCTP_NUM_OTHER_TYPES … /* These are primitive requests from the ULP. */ enum sctp_event_primitive { … }; #define SCTP_EVENT_PRIMITIVE_MAX … #define SCTP_NUM_PRIMITIVE_TYPES … /* We define here a utility type for manipulating subtypes. * The subtype constructors all work like this: * * union sctp_subtype foo = SCTP_ST_CHUNK(SCTP_CID_INIT); */ sctp_subtype; #define SCTP_SUBTYPE_CONSTRUCTOR(_name, _type, _elt) … SCTP_SUBTYPE_CONSTRUCTOR(…) … SCTP_SUBTYPE_CONSTRUCTOR(…) … SCTP_SUBTYPE_CONSTRUCTOR(…) … SCTP_SUBTYPE_CONSTRUCTOR(…) … #define sctp_chunk_is_data(a) … /* Internal error codes */ enum sctp_ierror { … }; /* SCTP state defines for internal state machine */ enum sctp_state { … }; #define SCTP_STATE_MAX … #define SCTP_STATE_NUM_STATES … /* These are values for sk->state. * For a UDP-style SCTP socket, the states are defined as follows * - A socket in SCTP_SS_CLOSED state indicates that it is not willing to * accept new associations, but it can initiate the creation of new ones. * - A socket in SCTP_SS_LISTENING state indicates that it is willing to * accept new associations and can initiate the creation of new ones. * - A socket in SCTP_SS_ESTABLISHED state indicates that it is a peeled off * socket with one association. * For a TCP-style SCTP socket, the states are defined as follows * - A socket in SCTP_SS_CLOSED state indicates that it is not willing to * accept new associations, but it can initiate the creation of new ones. * - A socket in SCTP_SS_LISTENING state indicates that it is willing to * accept new associations, but cannot initiate the creation of new ones. * - A socket in SCTP_SS_ESTABLISHED state indicates that it has a single * association. */ enum sctp_sock_state { … }; enum sctp_plpmtud_state { … }; #define SCTP_BASE_PLPMTU … #define SCTP_MAX_PLPMTU … #define SCTP_MIN_PLPMTU … #define SCTP_MAX_PROBES … #define SCTP_PL_BIG_STEP … #define SCTP_PL_MIN_STEP … /* These functions map various type to printable names. */ const char *sctp_cname(const union sctp_subtype id); /* chunk types */ const char *sctp_oname(const union sctp_subtype id); /* other events */ const char *sctp_tname(const union sctp_subtype id); /* timeouts */ const char *sctp_pname(const union sctp_subtype id); /* primitives */ /* This is a table of printable names of sctp_state_t's. */ extern const char *const sctp_state_tbl[]; extern const char *const sctp_evttype_tbl[]; extern const char *const sctp_status_tbl[]; /* Maximum chunk length considering padding requirements. */ enum { … }; /* Encourage Cookie-Echo bundling by pre-fragmenting chunks a little * harder (until reaching ESTABLISHED state). */ enum { … }; /* Guess at how big to make the TSN mapping array. * We guarantee that we can handle at least this big a gap between the * cumulative ACK and the highest TSN. In practice, we can often * handle up to twice this value. * * NEVER make this more than 32767 (2^15-1). The Gap Ack Blocks in a * SACK (see section 3.3.4) are only 16 bits, so 2*SCTP_TSN_MAP_SIZE * must be less than 65535 (2^16 - 1), or we will have overflow * problems creating SACK's. */ #define SCTP_TSN_MAP_INITIAL … #define SCTP_TSN_MAP_INCREMENT … #define SCTP_TSN_MAP_SIZE … /* We will not record more than this many duplicate TSNs between two * SACKs. The minimum PMTU is 512. Remove all the headers and there * is enough room for 117 duplicate reports. Round down to the * nearest power of 2. */ enum { … }; enum { … }; /* Heartbeat interval - 30 secs */ #define SCTP_DEFAULT_TIMEOUT_HEARTBEAT … /* Delayed sack timer - 200ms */ #define SCTP_DEFAULT_TIMEOUT_SACK … /* RTO.Initial - 3 seconds * RTO.Min - 1 second * RTO.Max - 60 seconds * RTO.Alpha - 1/8 * RTO.Beta - 1/4 */ #define SCTP_RTO_INITIAL … #define SCTP_RTO_MIN … #define SCTP_RTO_MAX … #define SCTP_RTO_ALPHA … #define SCTP_RTO_BETA … /* Maximum number of new data packets that can be sent in a burst. */ #define SCTP_DEFAULT_MAX_BURST … #define SCTP_CLOCK_GRANULARITY … #define SCTP_DEFAULT_COOKIE_LIFE … #define SCTP_DEFAULT_MINWINDOW … #define SCTP_DEFAULT_MAXWINDOW … #define SCTP_DEFAULT_RWND_SHIFT … #define SCTP_DEFAULT_MAXSEGMENT … #define SCTP_DEFAULT_MINSEGMENT … #define SCTP_SECRET_SIZE … #define SCTP_SIGNATURE_SIZE … #define SCTP_COOKIE_MULTIPLE … #define SCTP_DEFAULT_UDP_PORT … /* These are the values for pf exposure, UNUSED is to keep compatible with old * applications by default. */ enum { … }; #define SCTP_PF_EXPOSE_MAX … #define SCTP_PS_RETRANS_MAX … /* These return values describe the success or failure of a number of * routines which form the lower interface to SCTP_outqueue. */ enum sctp_xmit { … }; /* These are the commands for manipulating transports. */ enum sctp_transport_cmd { … }; /* These are the address scopes defined mainly for IPv4 addresses * based on draft of SCTP IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>. * These scopes are hopefully generic enough to be used on scoping both * IPv4 and IPv6 addresses in SCTP. * At this point, the IPv6 scopes will be mapped to these internal scopes * as much as possible. */ enum sctp_scope { … }; enum { … }; #define SCTP_SCOPE_POLICY_MAX … /* Based on IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>, * SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 192.88.99.0/24. * Also, RFC 8.4, non-unicast addresses are not considered valid SCTP * addresses. */ #define IS_IPV4_UNUSABLE_ADDRESS(a) … /* Flags used for the bind address copy functions. */ #define SCTP_ADDR4_ALLOWED … #define SCTP_ADDR6_ALLOWED … #define SCTP_ADDR4_PEERSUPP … #define SCTP_ADDR6_PEERSUPP … /* Reasons to retransmit. */ enum sctp_retransmit_reason { … }; /* Reasons to lower cwnd. */ enum sctp_lower_cwnd { … }; /* SCTP-AUTH Necessary constants */ /* SCTP-AUTH, Section 3.3 * * The following Table 2 shows the currently defined values for HMAC * identifiers. * * +-----------------+--------------------------+ * | HMAC Identifier | Message Digest Algorithm | * +-----------------+--------------------------+ * | 0 | Reserved | * | 1 | SHA-1 defined in [8] | * | 2 | Reserved | * | 3 | SHA-256 defined in [8] | * +-----------------+--------------------------+ */ enum { … }; #define SCTP_AUTH_HMAC_ID_MAX … #define SCTP_AUTH_NUM_HMACS … #define SCTP_SHA1_SIG_SIZE … #define SCTP_SHA256_SIG_SIZE … /* SCTP-AUTH, Section 3.2 * The chunk types for INIT, INIT-ACK, SHUTDOWN-COMPLETE and AUTH chunks * MUST NOT be listed in the CHUNKS parameter */ #define SCTP_NUM_NOAUTH_CHUNKS … #define SCTP_AUTH_MAX_CHUNKS … /* SCTP-AUTH Section 6.1 * The RANDOM parameter MUST contain a 32 byte random number. */ #define SCTP_AUTH_RANDOM_LENGTH … #define SCTP_PROBE_TIMER_MIN … #endif /* __sctp_constants_h__ */