sctp.h revision 194355
178556Sobrien/*-
278556Sobrien * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
378556Sobrien *
478556Sobrien * Redistribution and use in source and binary forms, with or without
578556Sobrien * modification, are permitted provided that the following conditions are met:
678556Sobrien *
778556Sobrien * a) Redistributions of source code must retain the above copyright notice,
878556Sobrien *   this list of conditions and the following disclaimer.
978556Sobrien *
1078556Sobrien * b) Redistributions in binary form must reproduce the above copyright
1178556Sobrien *    notice, this list of conditions and the following disclaimer in
1278556Sobrien *   the documentation and/or other materials provided with the distribution.
1378556Sobrien *
1478556Sobrien * c) Neither the name of Cisco Systems, Inc. nor the names of its
1578556Sobrien *    contributors may be used to endorse or promote products derived
1678556Sobrien *    from this software without specific prior written permission.
1778556Sobrien *
1878556Sobrien * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1978556Sobrien * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
2078556Sobrien * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2178556Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2278556Sobrien * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2378556Sobrien * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2478556Sobrien * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2578556Sobrien * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2678556Sobrien * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2778556Sobrien * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2878556Sobrien * THE POSSIBILITY OF SUCH DAMAGE.
2978556Sobrien */
3078556Sobrien/* $KAME: sctp.h,v 1.18 2005/03/06 16:04:16 itojun Exp $	 */
3178556Sobrien
3278556Sobrien#include <sys/cdefs.h>
3378556Sobrien__FBSDID("$FreeBSD: head/sys/netinet/sctp.h 194355 2009-06-17 12:34:56Z rrs $");
3478556Sobrien
3578556Sobrien#ifndef _NETINET_SCTP_H_
3678556Sobrien#define _NETINET_SCTP_H_
3778556Sobrien
3878556Sobrien#include <sys/types.h>
3978556Sobrien
4078556Sobrien
4178556Sobrien#define SCTP_PACKED __attribute__((packed))
4278556Sobrien
4378556Sobrien/*
4478556Sobrien * SCTP protocol - RFC2960.
4578556Sobrien */
4678556Sobrienstruct sctphdr {
4778556Sobrien	uint16_t src_port;	/* source port */
4878556Sobrien	uint16_t dest_port;	/* destination port */
4978556Sobrien	uint32_t v_tag;		/* verification tag of packet */
5078556Sobrien	uint32_t checksum;	/* Adler32 C-Sum */
5178556Sobrien	/* chunks follow... */
5278556Sobrien}       SCTP_PACKED;
5378556Sobrien
5478556Sobrien/*
5578556Sobrien * SCTP Chunks
5678556Sobrien */
5778556Sobrienstruct sctp_chunkhdr {
5878556Sobrien	uint8_t chunk_type;	/* chunk type */
5978556Sobrien	uint8_t chunk_flags;	/* chunk flags */
6078556Sobrien	uint16_t chunk_length;	/* chunk length */
6178556Sobrien	/* optional params follow */
6278556Sobrien}             SCTP_PACKED;
6378556Sobrien
6478556Sobrien/*
6578556Sobrien * SCTP chunk parameters
6678556Sobrien */
6778556Sobrienstruct sctp_paramhdr {
6878556Sobrien	uint16_t param_type;	/* parameter type */
6978556Sobrien	uint16_t param_length;	/* parameter length */
7078556Sobrien}             SCTP_PACKED;
7178556Sobrien
7278556Sobrien/*
7378556Sobrien * user socket options: socket API defined
7478556Sobrien */
7578556Sobrien/*
7678556Sobrien * read-write options
7778556Sobrien */
7878556Sobrien#define SCTP_RTOINFO			0x00000001
7978556Sobrien#define SCTP_ASSOCINFO			0x00000002
8078556Sobrien#define SCTP_INITMSG			0x00000003
8178556Sobrien#define SCTP_NODELAY			0x00000004
8278556Sobrien#define SCTP_AUTOCLOSE			0x00000005
8378556Sobrien#define SCTP_SET_PEER_PRIMARY_ADDR	0x00000006
8478556Sobrien#define SCTP_PRIMARY_ADDR		0x00000007
8578556Sobrien#define SCTP_ADAPTATION_LAYER		0x00000008
8678556Sobrien/* same as above */
8778556Sobrien#define SCTP_ADAPTION_LAYER		0x00000008
8878556Sobrien#define SCTP_DISABLE_FRAGMENTS		0x00000009
8978556Sobrien#define SCTP_PEER_ADDR_PARAMS 		0x0000000a
9078556Sobrien#define SCTP_DEFAULT_SEND_PARAM		0x0000000b
9178556Sobrien/* ancillary data/notification interest options */
9278556Sobrien#define SCTP_EVENTS			0x0000000c
9378556Sobrien/* Without this applied we will give V4 and V6 addresses on a V6 socket */
9478556Sobrien#define SCTP_I_WANT_MAPPED_V4_ADDR	0x0000000d
9578556Sobrien#define SCTP_MAXSEG 			0x0000000e
9678556Sobrien#define SCTP_DELAYED_SACK               0x0000000f
9778556Sobrien#define SCTP_FRAGMENT_INTERLEAVE        0x00000010
9878556Sobrien#define SCTP_PARTIAL_DELIVERY_POINT     0x00000011
9978556Sobrien/* authentication support */
10078556Sobrien#define SCTP_AUTH_CHUNK 		0x00000012
10178556Sobrien#define SCTP_AUTH_KEY 			0x00000013
10278556Sobrien#define SCTP_HMAC_IDENT 		0x00000014
10378556Sobrien#define SCTP_AUTH_ACTIVE_KEY 		0x00000015
10478556Sobrien#define SCTP_AUTH_DELETE_KEY 		0x00000016
10578556Sobrien#define SCTP_USE_EXT_RCVINFO		0x00000017
10678556Sobrien#define SCTP_AUTO_ASCONF		0x00000018	/* rw */
10778556Sobrien#define SCTP_MAXBURST			0x00000019	/* rw */
10878556Sobrien#define SCTP_MAX_BURST			0x00000019	/* rw */
10978556Sobrien/* assoc level context */
11078556Sobrien#define SCTP_CONTEXT                    0x0000001a	/* rw */
11178556Sobrien/* explict EOR signalling */
11278556Sobrien#define SCTP_EXPLICIT_EOR               0x0000001b
11378556Sobrien#define SCTP_REUSE_PORT                 0x0000001c	/* rw */
11478556Sobrien#define SCTP_AUTH_DEACTIVATE_KEY	0x0000001d
11578556Sobrien
11678556Sobrien/*
11778556Sobrien * read-only options
11878556Sobrien */
11978556Sobrien#define SCTP_STATUS			0x00000100
12078556Sobrien#define SCTP_GET_PEER_ADDR_INFO		0x00000101
12178556Sobrien/* authentication support */
12278556Sobrien#define SCTP_PEER_AUTH_CHUNKS 		0x00000102
12378556Sobrien#define SCTP_LOCAL_AUTH_CHUNKS 		0x00000103
12478556Sobrien#define SCTP_GET_ASSOC_NUMBER           0x00000104	/* ro */
12578556Sobrien#define SCTP_GET_ASSOC_ID_LIST          0x00000105	/* ro */
12678556Sobrien
12778556Sobrien/*
12878556Sobrien * user socket options: BSD implementation specific
12978556Sobrien */
13078556Sobrien/*
13178556Sobrien * Blocking I/O is enabled on any TCP type socket by default. For the UDP
13278556Sobrien * model if this is turned on then the socket buffer is shared for send
13378556Sobrien * resources amongst all associations.  The default for the UDP model is that
13478556Sobrien * is SS_NBIO is set.  Which means all associations have a seperate send
13578556Sobrien * limit BUT they will NOT ever BLOCK instead you will get an error back
13678556Sobrien * EAGAIN if you try to send to much. If you want the blocking symantics you
13778556Sobrien * set this option at the cost of sharing one socket send buffer size amongst
13878556Sobrien * all associations. Peeled off sockets turn this option off and block. But
13978556Sobrien * since both TCP and peeled off sockets have only one assoc per socket this
14078556Sobrien * is fine. It probably does NOT make sense to set this on SS_NBIO on a TCP
14178556Sobrien * model OR peeled off UDP model, but we do allow you to do so. You just use
14278556Sobrien * the normal syscall to toggle SS_NBIO the way you want.
14378556Sobrien *
14478556Sobrien * Blocking I/O is controled by the SS_NBIO flag on the socket state so_state
14578556Sobrien * field.
14678556Sobrien */
14778556Sobrien
14878556Sobrien/* these should probably go into sockets API */
14978556Sobrien#define SCTP_RESET_STREAMS		0x00001004	/* wo */
15078556Sobrien
15178556Sobrien
15278556Sobrien/* here on down are more implementation specific */
15378556Sobrien#define SCTP_SET_DEBUG_LEVEL		0x00001005
15478556Sobrien#define SCTP_CLR_STAT_LOG               0x00001007
15578556Sobrien/* CMT ON/OFF socket option */
15678556Sobrien#define SCTP_CMT_ON_OFF                 0x00001200
15778556Sobrien#define SCTP_CMT_USE_DAC                0x00001201
15878556Sobrien/* EY - NR_SACK on/off socket option */
15978556Sobrien#define SCTP_NR_SACK_ON_OFF                 0x00001300
16078556Sobrien/* JRS - Pluggable Congestion Control Socket option */
16178556Sobrien#define SCTP_PLUGGABLE_CC				0x00001202
16278556Sobrien
16378556Sobrien/* read only */
16478556Sobrien#define SCTP_GET_SNDBUF_USE		0x00001101
16578556Sobrien#define SCTP_GET_STAT_LOG		0x00001103
16678556Sobrien#define SCTP_PCB_STATUS			0x00001104
16778556Sobrien#define SCTP_GET_NONCE_VALUES           0x00001105
16878556Sobrien
16978556Sobrien
17078556Sobrien/* Special hook for dynamically setting primary for all assoc's,
17178556Sobrien * this is a write only option that requires root privledge.
17278556Sobrien */
17378556Sobrien#define SCTP_SET_DYNAMIC_PRIMARY        0x00002001
17478556Sobrien
17578556Sobrien/* VRF (virtual router feature) and multi-VRF support
17678556Sobrien * options. VRF's provide splits within a router
17778556Sobrien * that give the views of multiple routers. A
17878556Sobrien * standard host, without VRF support, is just
17978556Sobrien * a single VRF. If VRF's are supported then
18078556Sobrien * the transport must be VRF aware. This means
18178556Sobrien * that every socket call coming in must be directed
18278556Sobrien * within the endpoint to one of the VRF's it belongs
18378556Sobrien * to. The endpoint, before binding, may select
18478556Sobrien * the "default" VRF it is in by using a set socket
18578556Sobrien * option with SCTP_VRF_ID. This will also
18678556Sobrien * get propegated to the default VRF. Once the
18778556Sobrien * endpoint binds an address then it CANNOT add
18878556Sobrien * additional VRF's to become a Multi-VRF endpoint.
18978556Sobrien *
19078556Sobrien * Before BINDING additional VRF's can be added with
19178556Sobrien * the SCTP_ADD_VRF_ID call or deleted with
19278556Sobrien * SCTP_DEL_VRF_ID.
19378556Sobrien *
19478556Sobrien * Associations are ALWAYS contained inside a single
19578556Sobrien * VRF. They cannot reside in two (or more) VRF's. Incoming
19678556Sobrien * packets, assuming the router is VRF aware, can always
19778556Sobrien * tell us what VRF they arrived on. A host not supporting
19878556Sobrien * any VRF's will find that the packets always arrived on the
19978556Sobrien * single VRF that the host has.
20078556Sobrien *
20178556Sobrien */
20278556Sobrien
20378556Sobrien#define SCTP_VRF_ID			0x00003001
20478556Sobrien#define SCTP_ADD_VRF_ID			0x00003002
20578556Sobrien#define SCTP_GET_VRF_IDS		0x00003003
20678556Sobrien#define SCTP_GET_ASOC_VRF               0x00003004
20778556Sobrien#define SCTP_DEL_VRF_ID                 0x00003005
20878556Sobrien
20978556Sobrien/*
21078556Sobrien * If you enable packet logging you can get
21178556Sobrien * a poor mans ethereal output in binary
21278556Sobrien * form. Note this is a compile option to
21378556Sobrien * the kernel,  SCTP_PACKET_LOGGING, and
21478556Sobrien * without it in your kernel you
21578556Sobrien * will get a EOPNOTSUPP
21678556Sobrien */
21778556Sobrien#define SCTP_GET_PACKET_LOG             0x00004001
21878556Sobrien
21978556Sobrien/*
22078556Sobrien * hidden implementation specific options these are NOT user visible (should
22178556Sobrien * move out of sctp.h)
22278556Sobrien */
22378556Sobrien/* sctp_bindx() flags as hidden socket options */
22478556Sobrien#define SCTP_BINDX_ADD_ADDR		0x00008001
22578556Sobrien#define SCTP_BINDX_REM_ADDR		0x00008002
22678556Sobrien/* Hidden socket option that gets the addresses */
22778556Sobrien#define SCTP_GET_PEER_ADDRESSES		0x00008003
22878556Sobrien#define SCTP_GET_LOCAL_ADDRESSES	0x00008004
22978556Sobrien/* return the total count in bytes needed to hold all local addresses bound */
23078556Sobrien#define SCTP_GET_LOCAL_ADDR_SIZE	0x00008005
23178556Sobrien/* Return the total count in bytes needed to hold the remote address */
23278556Sobrien#define SCTP_GET_REMOTE_ADDR_SIZE	0x00008006
23378556Sobrien/* hidden option for connectx */
23478556Sobrien#define SCTP_CONNECT_X			0x00008007
23578556Sobrien/* hidden option for connectx_delayed, part of sendx */
23678556Sobrien#define SCTP_CONNECT_X_DELAYED		0x00008008
23778556Sobrien#define SCTP_CONNECT_X_COMPLETE         0x00008009
23878556Sobrien/* hidden socket option based sctp_peeloff */
23978556Sobrien#define SCTP_PEELOFF                    0x0000800a
24078556Sobrien/* the real worker for sctp_getaddrlen() */
24178556Sobrien#define SCTP_GET_ADDR_LEN               0x0000800b
24278556Sobrien/* temporary workaround for Apple listen() issue, no args used */
24378556Sobrien#define SCTP_LISTEN_FIX			0x0000800c
24478556Sobrien/* Debug things that need to be purged */
24578556Sobrien#define SCTP_SET_INITIAL_DBG_SEQ	0x00009f00
24678556Sobrien
24778556Sobrien/* JRS - Supported congestion control modules for pluggable
24878556Sobrien * congestion control
24978556Sobrien */
25078556Sobrien/* Standard TCP Congestion Control */
25178556Sobrien#define SCTP_CC_RFC2581		0x00000000
25278556Sobrien/* High Speed TCP Congestion Control (Floyd) */
25378556Sobrien#define SCTP_CC_HSTCP		0x00000001
25478556Sobrien/* HTCP Congestion Control */
25578556Sobrien#define SCTP_CC_HTCP		0x00000002
25678556Sobrien
25778556Sobrien
25878556Sobrien/* fragment interleave constants
25978556Sobrien * setting must be one of these or
26078556Sobrien * EINVAL returned.
26178556Sobrien */
26278556Sobrien#define SCTP_FRAG_LEVEL_0    0x00000000
26378556Sobrien#define SCTP_FRAG_LEVEL_1    0x00000001
26478556Sobrien#define SCTP_FRAG_LEVEL_2    0x00000002
26578556Sobrien
26678556Sobrien/*
26778556Sobrien * user state values
26878556Sobrien */
26978556Sobrien#define SCTP_CLOSED			0x0000
27078556Sobrien#define SCTP_BOUND			0x1000
27178556Sobrien#define SCTP_LISTEN			0x2000
27278556Sobrien#define SCTP_COOKIE_WAIT		0x0002
27378556Sobrien#define SCTP_COOKIE_ECHOED		0x0004
27478556Sobrien#define SCTP_ESTABLISHED		0x0008
27578556Sobrien#define SCTP_SHUTDOWN_SENT		0x0010
27678556Sobrien#define SCTP_SHUTDOWN_RECEIVED		0x0020
27778556Sobrien#define SCTP_SHUTDOWN_ACK_SENT		0x0040
27878556Sobrien#define SCTP_SHUTDOWN_PENDING		0x0080
27978556Sobrien
28078556Sobrien/*
28178556Sobrien * SCTP operational error codes (user visible)
28278556Sobrien */
28378556Sobrien#define SCTP_CAUSE_NO_ERROR		0x0000
28478556Sobrien#define SCTP_CAUSE_INVALID_STREAM	0x0001
28578556Sobrien#define SCTP_CAUSE_MISSING_PARAM	0x0002
28678556Sobrien#define SCTP_CAUSE_STALE_COOKIE		0x0003
28778556Sobrien#define SCTP_CAUSE_OUT_OF_RESC		0x0004
28878556Sobrien#define SCTP_CAUSE_UNRESOLVABLE_ADDR	0x0005
28978556Sobrien#define SCTP_CAUSE_UNRECOG_CHUNK	0x0006
29078556Sobrien#define SCTP_CAUSE_INVALID_PARAM	0x0007
29178556Sobrien#define SCTP_CAUSE_UNRECOG_PARAM	0x0008
29278556Sobrien#define SCTP_CAUSE_NO_USER_DATA		0x0009
29378556Sobrien#define SCTP_CAUSE_COOKIE_IN_SHUTDOWN	0x000a
29478556Sobrien#define SCTP_CAUSE_RESTART_W_NEWADDR	0x000b
29578556Sobrien#define SCTP_CAUSE_USER_INITIATED_ABT	0x000c
29678556Sobrien#define SCTP_CAUSE_PROTOCOL_VIOLATION	0x000d
29778556Sobrien
29878556Sobrien/* Error causes from RFC5061 */
29978556Sobrien#define SCTP_CAUSE_DELETING_LAST_ADDR	0x00a0
30078556Sobrien#define SCTP_CAUSE_RESOURCE_SHORTAGE	0x00a1
30178556Sobrien#define SCTP_CAUSE_DELETING_SRC_ADDR	0x00a2
30278556Sobrien#define SCTP_CAUSE_ILLEGAL_ASCONF_ACK	0x00a3
30378556Sobrien#define SCTP_CAUSE_REQUEST_REFUSED	0x00a4
30478556Sobrien
30578556Sobrien/* Error causes from nat-draft */
30678556Sobrien#define SCTP_CAUSE_NAT_COLLIDING_STATE  0x00b0
30778556Sobrien#define SCTP_CAUSE_NAT_MISSING_STATE    0x00b1
30878556Sobrien
30978556Sobrien/* Error causes from RFC4895 */
31078556Sobrien#define SCTP_CAUSE_UNSUPPORTED_HMACID	0x0105
31178556Sobrien
31278556Sobrien/*
31378556Sobrien * error cause parameters (user visisble)
31478556Sobrien */
31578556Sobrienstruct sctp_error_cause {
31678556Sobrien	uint16_t code;
31778556Sobrien	uint16_t length;
31878556Sobrien	/* optional cause-specific info may follow */
31978556Sobrien}                SCTP_PACKED;
32078556Sobrien
32178556Sobrienstruct sctp_error_invalid_stream {
32278556Sobrien	struct sctp_error_cause cause;	/* code=SCTP_ERROR_INVALID_STREAM */
32378556Sobrien	uint16_t stream_id;	/* stream id of the DATA in error */
32478556Sobrien	uint16_t reserved;
32578556Sobrien}                         SCTP_PACKED;
32678556Sobrien
32778556Sobrienstruct sctp_error_missing_param {
32878556Sobrien	struct sctp_error_cause cause;	/* code=SCTP_ERROR_MISSING_PARAM */
32978556Sobrien	uint32_t num_missing_params;	/* number of missing parameters */
33078556Sobrien	/* uint16_t param_type's follow */
33178556Sobrien}                        SCTP_PACKED;
33278556Sobrien
33378556Sobrienstruct sctp_error_stale_cookie {
33478556Sobrien	struct sctp_error_cause cause;	/* code=SCTP_ERROR_STALE_COOKIE */
33578556Sobrien	uint32_t stale_time;	/* time in usec of staleness */
33678556Sobrien}                       SCTP_PACKED;
33778556Sobrien
33878556Sobrienstruct sctp_error_out_of_resource {
33978556Sobrien	struct sctp_error_cause cause;	/* code=SCTP_ERROR_OUT_OF_RESOURCES */
34078556Sobrien}                          SCTP_PACKED;
34178556Sobrien
34278556Sobrienstruct sctp_error_unresolv_addr {
34378556Sobrien	struct sctp_error_cause cause;	/* code=SCTP_ERROR_UNRESOLVABLE_ADDR */
34478556Sobrien
34578556Sobrien}                        SCTP_PACKED;
34678556Sobrien
34778556Sobrienstruct sctp_error_unrecognized_chunk {
34878556Sobrien	struct sctp_error_cause cause;	/* code=SCTP_ERROR_UNRECOG_CHUNK */
34978556Sobrien	struct sctp_chunkhdr ch;/* header from chunk in error */
35078556Sobrien}                             SCTP_PACKED;
35178556Sobrien
35278556Sobrien/*
35378556Sobrien * Main SCTP chunk types we place these here so natd and f/w's in user land
35478556Sobrien * can find them.
35578556Sobrien */
35678556Sobrien/************0x00 series ***********/
35778556Sobrien#define SCTP_DATA		0x00
35878556Sobrien#define SCTP_INITIATION		0x01
35978556Sobrien#define SCTP_INITIATION_ACK	0x02
36078556Sobrien#define SCTP_SELECTIVE_ACK	0x03
36178556Sobrien#define SCTP_HEARTBEAT_REQUEST	0x04
36278556Sobrien#define SCTP_HEARTBEAT_ACK	0x05
36378556Sobrien#define SCTP_ABORT_ASSOCIATION	0x06
36478556Sobrien#define SCTP_SHUTDOWN		0x07
36578556Sobrien#define SCTP_SHUTDOWN_ACK	0x08
36678556Sobrien#define SCTP_OPERATION_ERROR	0x09
36778556Sobrien#define SCTP_COOKIE_ECHO	0x0a
36878556Sobrien#define SCTP_COOKIE_ACK		0x0b
36978556Sobrien#define SCTP_ECN_ECHO		0x0c
37078556Sobrien#define SCTP_ECN_CWR		0x0d
37178556Sobrien#define SCTP_SHUTDOWN_COMPLETE	0x0e
37278556Sobrien/* RFC4895 */
37378556Sobrien#define SCTP_AUTHENTICATION     0x0f
37478556Sobrien/* EY nr_sack chunk id*/
37578556Sobrien#define SCTP_NR_SELECTIVE_ACK 0x10
37678556Sobrien/************0x40 series ***********/
37778556Sobrien/************0x80 series ***********/
37878556Sobrien/* RFC5061 */
37978556Sobrien#define	SCTP_ASCONF_ACK		0x80
38078556Sobrien/* draft-ietf-stewart-pktdrpsctp */
38178556Sobrien#define SCTP_PACKET_DROPPED	0x81
38278556Sobrien/* draft-ietf-stewart-strreset-xxx */
38378556Sobrien#define SCTP_STREAM_RESET       0x82
38478556Sobrien
38578556Sobrien/* RFC4820                         */
38678556Sobrien#define SCTP_PAD_CHUNK          0x84
38778556Sobrien/************0xc0 series ***********/
38878556Sobrien/* RFC3758 */
38978556Sobrien#define SCTP_FORWARD_CUM_TSN	0xc0
39078556Sobrien/* RFC5061 */
39178556Sobrien#define SCTP_ASCONF		0xc1
39278556Sobrien
39378556Sobrien
39478556Sobrien/* ABORT and SHUTDOWN COMPLETE FLAG */
39578556Sobrien#define SCTP_HAD_NO_TCB		0x01
39678556Sobrien
39778556Sobrien/* Packet dropped flags */
39878556Sobrien#define SCTP_FROM_MIDDLE_BOX	SCTP_HAD_NO_TCB
39978556Sobrien#define SCTP_BADCRC		0x02
40078556Sobrien#define SCTP_PACKET_TRUNCATED	0x04
40178556Sobrien
40278556Sobrien#define SCTP_SAT_NETWORK_MIN	400	/* min ms for RTT to set satellite
40378556Sobrien					 * time */
40478556Sobrien#define SCTP_SAT_NETWORK_BURST_INCR  2	/* how many times to multiply maxburst
40578556Sobrien					 * in sat */
40678556Sobrien
40778556Sobrien/* Data Chuck Specific Flags */
40878556Sobrien#define SCTP_DATA_FRAG_MASK        0x03
40978556Sobrien#define SCTP_DATA_MIDDLE_FRAG      0x00
41078556Sobrien#define SCTP_DATA_LAST_FRAG        0x01
41178556Sobrien#define SCTP_DATA_FIRST_FRAG       0x02
41278556Sobrien#define SCTP_DATA_NOT_FRAG         0x03
41378556Sobrien#define SCTP_DATA_UNORDERED        0x04
41478556Sobrien#define SCTP_DATA_SACK_IMMEDIATELY 0x08
41578556Sobrien/* ECN Nonce: SACK Chunk Specific Flags */
41678556Sobrien#define SCTP_SACK_NONCE_SUM        0x01
41778556Sobrien
41878556Sobrien/* CMT DAC algorithm SACK flag */
41978556Sobrien#define SCTP_SACK_CMT_DAC          0x80
42078556Sobrien
42178556Sobrien/*
42278556Sobrien * PCB flags (in sctp_flags bitmask).
42378556Sobrien * Note the features and flags are meant
42478556Sobrien * for use by netstat.
42578556Sobrien */
42678556Sobrien#define SCTP_PCB_FLAGS_UDPTYPE		0x00000001
42778556Sobrien#define SCTP_PCB_FLAGS_TCPTYPE		0x00000002
42878556Sobrien#define SCTP_PCB_FLAGS_BOUNDALL		0x00000004
42978556Sobrien#define SCTP_PCB_FLAGS_ACCEPTING	0x00000008
43078556Sobrien#define SCTP_PCB_FLAGS_UNBOUND		0x00000010
43178556Sobrien#define SCTP_PCB_FLAGS_CLOSE_IP         0x00040000
43278556Sobrien#define SCTP_PCB_FLAGS_WAS_CONNECTED    0x00080000
43378556Sobrien#define SCTP_PCB_FLAGS_WAS_ABORTED      0x00100000
43478556Sobrien/* TCP model support */
43578556Sobrien
43678556Sobrien#define SCTP_PCB_FLAGS_CONNECTED	0x00200000
43778556Sobrien#define SCTP_PCB_FLAGS_IN_TCPPOOL	0x00400000
43878556Sobrien#define SCTP_PCB_FLAGS_DONT_WAKE	0x00800000
43978556Sobrien#define SCTP_PCB_FLAGS_WAKEOUTPUT	0x01000000
44078556Sobrien#define SCTP_PCB_FLAGS_WAKEINPUT	0x02000000
44178556Sobrien#define SCTP_PCB_FLAGS_BOUND_V6		0x04000000
44278556Sobrien#define SCTP_PCB_FLAGS_BLOCKING_IO	0x08000000
44378556Sobrien#define SCTP_PCB_FLAGS_SOCKET_GONE	0x10000000
44478556Sobrien#define SCTP_PCB_FLAGS_SOCKET_ALLGONE	0x20000000
44578556Sobrien/* flags to copy to new PCB */
44678556Sobrien#define SCTP_PCB_COPY_FLAGS		(SCTP_PCB_FLAGS_BOUNDALL|\
44778556Sobrien					 SCTP_PCB_FLAGS_WAKEINPUT|\
44878556Sobrien					 SCTP_PCB_FLAGS_BOUND_V6)
44978556Sobrien
45078556Sobrien
45178556Sobrien/*
45278556Sobrien * PCB Features (in sctp_features bitmask)
45378556Sobrien */
45478556Sobrien#define SCTP_PCB_FLAGS_EXT_RCVINFO      0x00000002
45578556Sobrien#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT  0x00000004
45678556Sobrien#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE  0x00000008
45778556Sobrien#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS	0x00000010
45878556Sobrien#define SCTP_PCB_FLAGS_DO_ASCONF	0x00000020
45978556Sobrien#define SCTP_PCB_FLAGS_AUTO_ASCONF	0x00000040
46078556Sobrien#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080
46178556Sobrien/* socket options */
46278556Sobrien#define SCTP_PCB_FLAGS_NODELAY		0x00000100
46378556Sobrien#define SCTP_PCB_FLAGS_AUTOCLOSE	0x00000200
46478556Sobrien#define SCTP_PCB_FLAGS_RECVDATAIOEVNT	0x00000400
46578556Sobrien#define SCTP_PCB_FLAGS_RECVASSOCEVNT	0x00000800
46678556Sobrien#define SCTP_PCB_FLAGS_RECVPADDREVNT	0x00001000
46778556Sobrien#define SCTP_PCB_FLAGS_RECVPEERERR	0x00002000
46878556Sobrien#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT	0x00004000
46978556Sobrien#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT	0x00008000
47078556Sobrien#define SCTP_PCB_FLAGS_ADAPTATIONEVNT	0x00010000
47178556Sobrien#define SCTP_PCB_FLAGS_PDAPIEVNT	0x00020000
47278556Sobrien#define SCTP_PCB_FLAGS_AUTHEVNT		0x00040000
47378556Sobrien#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000
47478556Sobrien#define SCTP_PCB_FLAGS_NO_FRAGMENT	0x00100000
47578556Sobrien#define SCTP_PCB_FLAGS_EXPLICIT_EOR     0x00400000
47678556Sobrien#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4	0x00800000
47778556Sobrien#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS	0x01000000
47878556Sobrien#define SCTP_PCB_FLAGS_PORTREUSE        0x02000000
47978556Sobrien#define SCTP_PCB_FLAGS_DRYEVNT          0x04000000
48078556Sobrien/*-
48178556Sobrien * mobility_features parameters (by micchie).Note
48278556Sobrien * these features are applied against the
48378556Sobrien * sctp_mobility_features flags.. not the sctp_features
48478556Sobrien * flags.
48578556Sobrien */
48678556Sobrien#define SCTP_MOBILITY_BASE		0x00000001
48778556Sobrien#define SCTP_MOBILITY_FASTHANDOFF	0x00000002
48878556Sobrien#define SCTP_MOBILITY_PRIM_DELETED	0x00000004
48978556Sobrien
49078556Sobrien
49178556Sobrien#define SCTP_SMALLEST_PMTU 512	/* smallest pmtu allowed when disabling PMTU
49278556Sobrien				 * discovery */
49378556Sobrien
49478556Sobrien#include <netinet/sctp_uio.h>
49578556Sobrien
49678556Sobrien/* This dictates the size of the packet
49778556Sobrien * collection buffer. This only applies
49878556Sobrien * if SCTP_PACKET_LOGGING is enabled in
49978556Sobrien * your config.
50078556Sobrien */
50178556Sobrien#define SCTP_PACKET_LOG_SIZE 65536
50278556Sobrien
50378556Sobrien/* Maximum delays and such a user can set for options that
50478556Sobrien * take ms.
50578556Sobrien */
50678556Sobrien#define SCTP_MAX_SACK_DELAY 500	/* per RFC4960 */
50778556Sobrien#define SCTP_MAX_HB_INTERVAL 14400000	/* 4 hours in ms */
50878556Sobrien#define SCTP_MAX_COOKIE_LIFE  3600000	/* 1 hour in ms */
50978556Sobrien
51078556Sobrien
51178556Sobrien/* Types of logging/KTR tracing  that can be enabled via the
51278556Sobrien * sysctl net.inet.sctp.sctp_logging. You must also enable
51378556Sobrien * SUBSYS tracing.
51478556Sobrien * Note that you must have the SCTP option in the kernel
51578556Sobrien * to enable these as well.
51678556Sobrien */
51778556Sobrien#define SCTP_BLK_LOGGING_ENABLE				0x00000001
51878556Sobrien#define SCTP_CWND_MONITOR_ENABLE			0x00000002
51978556Sobrien#define SCTP_CWND_LOGGING_ENABLE			0x00000004
52078556Sobrien#define SCTP_EARLYFR_LOGGING_ENABLE			0x00000010
52178556Sobrien#define SCTP_FLIGHT_LOGGING_ENABLE			0x00000020
52278556Sobrien#define SCTP_FR_LOGGING_ENABLE				0x00000040
52378556Sobrien#define SCTP_LOCK_LOGGING_ENABLE			0x00000080
52478556Sobrien#define SCTP_MAP_LOGGING_ENABLE				0x00000100
52578556Sobrien#define SCTP_MBCNT_LOGGING_ENABLE			0x00000200
52678556Sobrien#define SCTP_MBUF_LOGGING_ENABLE			0x00000400
52778556Sobrien#define SCTP_NAGLE_LOGGING_ENABLE			0x00000800
52878556Sobrien#define SCTP_RECV_RWND_LOGGING_ENABLE		0x00001000
52978556Sobrien#define SCTP_RTTVAR_LOGGING_ENABLE			0x00002000
53078556Sobrien#define SCTP_SACK_LOGGING_ENABLE			0x00004000
53178556Sobrien#define SCTP_SACK_RWND_LOGGING_ENABLE		0x00008000
53278556Sobrien#define SCTP_SB_LOGGING_ENABLE				0x00010000
53378556Sobrien#define SCTP_STR_LOGGING_ENABLE				0x00020000
53478556Sobrien#define SCTP_WAKE_LOGGING_ENABLE			0x00040000
53578556Sobrien#define SCTP_LOG_MAXBURST_ENABLE			0x00080000
53678556Sobrien#define SCTP_LOG_RWND_ENABLE    			0x00100000
53778556Sobrien#define SCTP_LOG_SACK_ARRIVALS_ENABLE       0x00200000
53878556Sobrien#define SCTP_LTRACE_CHUNK_ENABLE            0x00400000
53978556Sobrien#define SCTP_LTRACE_ERROR_ENABLE            0x00800000
54078556Sobrien#define SCTP_LAST_PACKET_TRACING            0x01000000
54178556Sobrien#define SCTP_THRESHOLD_LOGGING              0x02000000
54278556Sobrien#define SCTP_LOG_AT_SEND_2_SCTP             0x04000000
54378556Sobrien#define SCTP_LOG_AT_SEND_2_OUTQ             0x08000000
54478556Sobrien#define SCTP_LOG_TRY_ADVANCE                0x10000000
54578556Sobrien
54678556Sobrien
54778556Sobrien#undef SCTP_PACKED
54878556Sobrien
54978556Sobrien#endif				/* !_NETINET_SCTP_H_ */
55078556Sobrien