xref: /freebsd/sys/netinet/sctp.h (revision 830d754d52dd67ff5faaae2ed2034e92ea490715)
1f8829a4aSRandall Stewart /*-
2830d754dSRandall Stewart  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
3f8829a4aSRandall Stewart  *
4f8829a4aSRandall Stewart  * Redistribution and use in source and binary forms, with or without
5f8829a4aSRandall Stewart  * modification, are permitted provided that the following conditions are met:
6f8829a4aSRandall Stewart  *
7f8829a4aSRandall Stewart  * a) Redistributions of source code must retain the above copyright notice,
8f8829a4aSRandall Stewart  *   this list of conditions and the following disclaimer.
9f8829a4aSRandall Stewart  *
10f8829a4aSRandall Stewart  * b) Redistributions in binary form must reproduce the above copyright
11f8829a4aSRandall Stewart  *    notice, this list of conditions and the following disclaimer in
12f8829a4aSRandall Stewart  *   the documentation and/or other materials provided with the distribution.
13f8829a4aSRandall Stewart  *
14f8829a4aSRandall Stewart  * c) Neither the name of Cisco Systems, Inc. nor the names of its
15f8829a4aSRandall Stewart  *    contributors may be used to endorse or promote products derived
16f8829a4aSRandall Stewart  *    from this software without specific prior written permission.
17f8829a4aSRandall Stewart  *
18f8829a4aSRandall Stewart  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19f8829a4aSRandall Stewart  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20f8829a4aSRandall Stewart  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21f8829a4aSRandall Stewart  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22f8829a4aSRandall Stewart  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23f8829a4aSRandall Stewart  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24f8829a4aSRandall Stewart  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25f8829a4aSRandall Stewart  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26f8829a4aSRandall Stewart  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27f8829a4aSRandall Stewart  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28f8829a4aSRandall Stewart  * THE POSSIBILITY OF SUCH DAMAGE.
29f8829a4aSRandall Stewart  */
30f8829a4aSRandall Stewart /* $KAME: sctp.h,v 1.18 2005/03/06 16:04:16 itojun Exp $	 */
31f8829a4aSRandall Stewart 
32f8829a4aSRandall Stewart #include <sys/cdefs.h>
33f8829a4aSRandall Stewart __FBSDID("$FreeBSD$");
34f8829a4aSRandall Stewart 
35f8829a4aSRandall Stewart #ifndef _NETINET_SCTP_H_
36f8829a4aSRandall Stewart #define _NETINET_SCTP_H_
37f8829a4aSRandall Stewart 
38f8829a4aSRandall Stewart #include <sys/types.h>
39f8829a4aSRandall Stewart 
40b3f1ea41SRandall Stewart 
41b3f1ea41SRandall Stewart #define SCTP_PACKED __attribute__((packed))
42b3f1ea41SRandall Stewart 
43f8829a4aSRandall Stewart /*
44f8829a4aSRandall Stewart  * SCTP protocol - RFC2960.
45f8829a4aSRandall Stewart  */
46f8829a4aSRandall Stewart struct sctphdr {
47f8829a4aSRandall Stewart 	uint16_t src_port;	/* source port */
48f8829a4aSRandall Stewart 	uint16_t dest_port;	/* destination port */
49f8829a4aSRandall Stewart 	uint32_t v_tag;		/* verification tag of packet */
50f8829a4aSRandall Stewart 	uint32_t checksum;	/* Adler32 C-Sum */
51f8829a4aSRandall Stewart 	/* chunks follow... */
52b3f1ea41SRandall Stewart }       SCTP_PACKED;
53f8829a4aSRandall Stewart 
54f8829a4aSRandall Stewart /*
55f8829a4aSRandall Stewart  * SCTP Chunks
56f8829a4aSRandall Stewart  */
57f8829a4aSRandall Stewart struct sctp_chunkhdr {
58f8829a4aSRandall Stewart 	uint8_t chunk_type;	/* chunk type */
59f8829a4aSRandall Stewart 	uint8_t chunk_flags;	/* chunk flags */
60f8829a4aSRandall Stewart 	uint16_t chunk_length;	/* chunk length */
61f8829a4aSRandall Stewart 	/* optional params follow */
62b3f1ea41SRandall Stewart }             SCTP_PACKED;
63f8829a4aSRandall Stewart 
64f8829a4aSRandall Stewart /*
65f8829a4aSRandall Stewart  * SCTP chunk parameters
66f8829a4aSRandall Stewart  */
67f8829a4aSRandall Stewart struct sctp_paramhdr {
68f8829a4aSRandall Stewart 	uint16_t param_type;	/* parameter type */
69f8829a4aSRandall Stewart 	uint16_t param_length;	/* parameter length */
70b3f1ea41SRandall Stewart }             SCTP_PACKED;
71f8829a4aSRandall Stewart 
72f8829a4aSRandall Stewart /*
73f8829a4aSRandall Stewart  * user socket options: socket API defined
74f8829a4aSRandall Stewart  */
75f8829a4aSRandall Stewart /*
76f8829a4aSRandall Stewart  * read-write options
77f8829a4aSRandall Stewart  */
78f8829a4aSRandall Stewart #define SCTP_RTOINFO			0x00000001
79f8829a4aSRandall Stewart #define SCTP_ASSOCINFO			0x00000002
80f8829a4aSRandall Stewart #define SCTP_INITMSG			0x00000003
81f8829a4aSRandall Stewart #define SCTP_NODELAY			0x00000004
82f8829a4aSRandall Stewart #define SCTP_AUTOCLOSE			0x00000005
83f8829a4aSRandall Stewart #define SCTP_SET_PEER_PRIMARY_ADDR	0x00000006
84f8829a4aSRandall Stewart #define SCTP_PRIMARY_ADDR		0x00000007
85f8829a4aSRandall Stewart #define SCTP_ADAPTATION_LAYER		0x00000008
86f8829a4aSRandall Stewart /* same as above */
87f8829a4aSRandall Stewart #define SCTP_ADAPTION_LAYER		0x00000008
88f8829a4aSRandall Stewart #define SCTP_DISABLE_FRAGMENTS		0x00000009
89f8829a4aSRandall Stewart #define SCTP_PEER_ADDR_PARAMS 		0x0000000a
90f8829a4aSRandall Stewart #define SCTP_DEFAULT_SEND_PARAM		0x0000000b
91f8829a4aSRandall Stewart /* ancillary data/notification interest options */
92f8829a4aSRandall Stewart #define SCTP_EVENTS			0x0000000c
93f8829a4aSRandall Stewart /* Without this applied we will give V4 and V6 addresses on a V6 socket */
94f8829a4aSRandall Stewart #define SCTP_I_WANT_MAPPED_V4_ADDR	0x0000000d
95f8829a4aSRandall Stewart #define SCTP_MAXSEG 			0x0000000e
96d61a0ae0SRandall Stewart #define SCTP_DELAYED_SACK               0x0000000f
97f8829a4aSRandall Stewart #define SCTP_FRAGMENT_INTERLEAVE        0x00000010
98f8829a4aSRandall Stewart #define SCTP_PARTIAL_DELIVERY_POINT     0x00000011
99f8829a4aSRandall Stewart /* authentication support */
100f8829a4aSRandall Stewart #define SCTP_AUTH_CHUNK 		0x00000012
101f8829a4aSRandall Stewart #define SCTP_AUTH_KEY 			0x00000013
102f8829a4aSRandall Stewart #define SCTP_HMAC_IDENT 		0x00000014
103f8829a4aSRandall Stewart #define SCTP_AUTH_ACTIVE_KEY 		0x00000015
104f8829a4aSRandall Stewart #define SCTP_AUTH_DELETE_KEY 		0x00000016
105f8829a4aSRandall Stewart #define SCTP_USE_EXT_RCVINFO		0x00000017
106f8829a4aSRandall Stewart #define SCTP_AUTO_ASCONF		0x00000018	/* rw */
107f8829a4aSRandall Stewart #define SCTP_MAXBURST			0x00000019	/* rw */
108d61a0ae0SRandall Stewart #define SCTP_MAX_BURST			0x00000019	/* rw */
109f8829a4aSRandall Stewart /* assoc level context */
110f8829a4aSRandall Stewart #define SCTP_CONTEXT                    0x0000001a	/* rw */
111f8829a4aSRandall Stewart /* explict EOR signalling */
112f8829a4aSRandall Stewart #define SCTP_EXPLICIT_EOR               0x0000001b
1136d9e8f2bSRandall Stewart #define SCTP_REUSE_PORT                 0x0000001c	/* rw */
114830d754dSRandall Stewart #define SCTP_AUTH_DEACTIVATE_KEY	0x0000001d
115f8829a4aSRandall Stewart 
116f8829a4aSRandall Stewart /*
117f8829a4aSRandall Stewart  * read-only options
118f8829a4aSRandall Stewart  */
119f8829a4aSRandall Stewart #define SCTP_STATUS			0x00000100
120f8829a4aSRandall Stewart #define SCTP_GET_PEER_ADDR_INFO		0x00000101
121f8829a4aSRandall Stewart /* authentication support */
122f8829a4aSRandall Stewart #define SCTP_PEER_AUTH_CHUNKS 		0x00000102
123f8829a4aSRandall Stewart #define SCTP_LOCAL_AUTH_CHUNKS 		0x00000103
1243c503c28SRandall Stewart #define SCTP_GET_ASSOC_NUMBER           0x00000104	/* ro */
1253c503c28SRandall Stewart #define SCTP_GET_ASSOC_ID_LIST          0x00000105	/* ro */
126f8829a4aSRandall Stewart 
127f8829a4aSRandall Stewart /*
128f8829a4aSRandall Stewart  * user socket options: BSD implementation specific
129f8829a4aSRandall Stewart  */
130f8829a4aSRandall Stewart /*
131f8829a4aSRandall Stewart  * Blocking I/O is enabled on any TCP type socket by default. For the UDP
132f8829a4aSRandall Stewart  * model if this is turned on then the socket buffer is shared for send
133f8829a4aSRandall Stewart  * resources amongst all associations.  The default for the UDP model is that
134f8829a4aSRandall Stewart  * is SS_NBIO is set.  Which means all associations have a seperate send
135f8829a4aSRandall Stewart  * limit BUT they will NOT ever BLOCK instead you will get an error back
136f8829a4aSRandall Stewart  * EAGAIN if you try to send to much. If you want the blocking symantics you
137f8829a4aSRandall Stewart  * set this option at the cost of sharing one socket send buffer size amongst
138f8829a4aSRandall Stewart  * all associations. Peeled off sockets turn this option off and block. But
139f8829a4aSRandall Stewart  * since both TCP and peeled off sockets have only one assoc per socket this
140f8829a4aSRandall Stewart  * is fine. It probably does NOT make sense to set this on SS_NBIO on a TCP
141f8829a4aSRandall Stewart  * model OR peeled off UDP model, but we do allow you to do so. You just use
142f8829a4aSRandall Stewart  * the normal syscall to toggle SS_NBIO the way you want.
143f8829a4aSRandall Stewart  *
144f8829a4aSRandall Stewart  * Blocking I/O is controled by the SS_NBIO flag on the socket state so_state
145f8829a4aSRandall Stewart  * field.
146f8829a4aSRandall Stewart  */
147f8829a4aSRandall Stewart 
148f8829a4aSRandall Stewart /* these should probably go into sockets API */
149f8829a4aSRandall Stewart #define SCTP_RESET_STREAMS		0x00001004	/* wo */
150f8829a4aSRandall Stewart 
151f8829a4aSRandall Stewart 
152f8829a4aSRandall Stewart /* here on down are more implementation specific */
153f8829a4aSRandall Stewart #define SCTP_SET_DEBUG_LEVEL		0x00001005
154f8829a4aSRandall Stewart #define SCTP_CLR_STAT_LOG               0x00001007
155f8829a4aSRandall Stewart /* CMT ON/OFF socket option */
156f8829a4aSRandall Stewart #define SCTP_CMT_ON_OFF                 0x00001200
157f8829a4aSRandall Stewart #define SCTP_CMT_USE_DAC                0x00001201
158830d754dSRandall Stewart /* EY - NR_SACK on/off socket option */
159830d754dSRandall Stewart #define SCTP_NR_SACK_ON_OFF                 0x00001300
160b54d3a6cSRandall Stewart /* JRS - Pluggable Congestion Control Socket option */
161b54d3a6cSRandall Stewart #define SCTP_PLUGGABLE_CC				0x00001202
162f8829a4aSRandall Stewart 
163f8829a4aSRandall Stewart /* read only */
164f8829a4aSRandall Stewart #define SCTP_GET_SNDBUF_USE		0x00001101
165f8829a4aSRandall Stewart #define SCTP_GET_STAT_LOG		0x00001103
1663c503c28SRandall Stewart #define SCTP_PCB_STATUS			0x00001104
1673c503c28SRandall Stewart #define SCTP_GET_NONCE_VALUES           0x00001105
168f8829a4aSRandall Stewart 
169207304d4SRandall Stewart 
17042551e99SRandall Stewart /* Special hook for dynamically setting primary for all assoc's,
17142551e99SRandall Stewart  * this is a write only option that requires root privledge.
17242551e99SRandall Stewart  */
17342551e99SRandall Stewart #define SCTP_SET_DYNAMIC_PRIMARY        0x00002001
174f8829a4aSRandall Stewart 
17542551e99SRandall Stewart /* VRF (virtual router feature) and multi-VRF support
17642551e99SRandall Stewart  * options. VRF's provide splits within a router
17742551e99SRandall Stewart  * that give the views of multiple routers. A
17842551e99SRandall Stewart  * standard host, without VRF support, is just
17942551e99SRandall Stewart  * a single VRF. If VRF's are supported then
18042551e99SRandall Stewart  * the transport must be VRF aware. This means
18142551e99SRandall Stewart  * that every socket call coming in must be directed
18242551e99SRandall Stewart  * within the endpoint to one of the VRF's it belongs
18342551e99SRandall Stewart  * to. The endpoint, before binding, may select
18442551e99SRandall Stewart  * the "default" VRF it is in by using a set socket
18542551e99SRandall Stewart  * option with SCTP_VRF_ID. This will also
18642551e99SRandall Stewart  * get propegated to the default VRF. Once the
18742551e99SRandall Stewart  * endpoint binds an address then it CANNOT add
18842551e99SRandall Stewart  * additional VRF's to become a Multi-VRF endpoint.
18942551e99SRandall Stewart  *
19042551e99SRandall Stewart  * Before BINDING additional VRF's can be added with
19142551e99SRandall Stewart  * the SCTP_ADD_VRF_ID call or deleted with
19242551e99SRandall Stewart  * SCTP_DEL_VRF_ID.
19342551e99SRandall Stewart  *
19442551e99SRandall Stewart  * Associations are ALWAYS contained inside a single
19542551e99SRandall Stewart  * VRF. They cannot reside in two (or more) VRF's. Incoming
19642551e99SRandall Stewart  * packets, assuming the router is VRF aware, can always
19742551e99SRandall Stewart  * tell us what VRF they arrived on. A host not supporting
19842551e99SRandall Stewart  * any VRF's will find that the packets always arrived on the
19942551e99SRandall Stewart  * single VRF that the host has.
20042551e99SRandall Stewart  *
20142551e99SRandall Stewart  */
20242551e99SRandall Stewart 
20342551e99SRandall Stewart #define SCTP_VRF_ID			0x00003001
20442551e99SRandall Stewart #define SCTP_ADD_VRF_ID			0x00003002
20542551e99SRandall Stewart #define SCTP_GET_VRF_IDS		0x00003003
20642551e99SRandall Stewart #define SCTP_GET_ASOC_VRF               0x00003004
20742551e99SRandall Stewart #define SCTP_DEL_VRF_ID                 0x00003005
208207304d4SRandall Stewart 
209207304d4SRandall Stewart /*
210207304d4SRandall Stewart  * If you enable packet logging you can get
211207304d4SRandall Stewart  * a poor mans ethereal output in binary
212207304d4SRandall Stewart  * form. Note this is a compile option to
213207304d4SRandall Stewart  * the kernel,  SCTP_PACKET_LOGGING, and
214207304d4SRandall Stewart  * without it in your kernel you
2156b4ae356SRandall Stewart  * will get a EOPNOTSUPP
216207304d4SRandall Stewart  */
217207304d4SRandall Stewart #define SCTP_GET_PACKET_LOG             0x00004001
218207304d4SRandall Stewart 
219f8829a4aSRandall Stewart /*
220f8829a4aSRandall Stewart  * hidden implementation specific options these are NOT user visible (should
221f8829a4aSRandall Stewart  * move out of sctp.h)
222f8829a4aSRandall Stewart  */
223f8829a4aSRandall Stewart /* sctp_bindx() flags as hidden socket options */
224f8829a4aSRandall Stewart #define SCTP_BINDX_ADD_ADDR		0x00008001
225f8829a4aSRandall Stewart #define SCTP_BINDX_REM_ADDR		0x00008002
226f8829a4aSRandall Stewart /* Hidden socket option that gets the addresses */
227f8829a4aSRandall Stewart #define SCTP_GET_PEER_ADDRESSES		0x00008003
228f8829a4aSRandall Stewart #define SCTP_GET_LOCAL_ADDRESSES	0x00008004
229f8829a4aSRandall Stewart /* return the total count in bytes needed to hold all local addresses bound */
230f8829a4aSRandall Stewart #define SCTP_GET_LOCAL_ADDR_SIZE	0x00008005
231f8829a4aSRandall Stewart /* Return the total count in bytes needed to hold the remote address */
232f8829a4aSRandall Stewart #define SCTP_GET_REMOTE_ADDR_SIZE	0x00008006
233f8829a4aSRandall Stewart /* hidden option for connectx */
234f8829a4aSRandall Stewart #define SCTP_CONNECT_X			0x00008007
235f8829a4aSRandall Stewart /* hidden option for connectx_delayed, part of sendx */
236f8829a4aSRandall Stewart #define SCTP_CONNECT_X_DELAYED		0x00008008
237f8829a4aSRandall Stewart #define SCTP_CONNECT_X_COMPLETE         0x00008009
238f8829a4aSRandall Stewart /* hidden socket option based sctp_peeloff */
239f8829a4aSRandall Stewart #define SCTP_PEELOFF                    0x0000800a
240f8829a4aSRandall Stewart /* the real worker for sctp_getaddrlen() */
241f8829a4aSRandall Stewart #define SCTP_GET_ADDR_LEN               0x0000800b
242f8829a4aSRandall Stewart /* temporary workaround for Apple listen() issue, no args used */
243f8829a4aSRandall Stewart #define SCTP_LISTEN_FIX			0x0000800c
244f8829a4aSRandall Stewart /* Debug things that need to be purged */
245f8829a4aSRandall Stewart #define SCTP_SET_INITIAL_DBG_SEQ	0x00009f00
246f8829a4aSRandall Stewart 
247b54d3a6cSRandall Stewart /* JRS - Supported congestion control modules for pluggable
248b54d3a6cSRandall Stewart  * congestion control
249b54d3a6cSRandall Stewart  */
250b54d3a6cSRandall Stewart /* Standard TCP Congestion Control */
251b54d3a6cSRandall Stewart #define SCTP_CC_RFC2581		0x00000000
252b54d3a6cSRandall Stewart /* High Speed TCP Congestion Control (Floyd) */
253b54d3a6cSRandall Stewart #define SCTP_CC_HSTCP		0x00000001
254b54d3a6cSRandall Stewart /* HTCP Congestion Control */
255b54d3a6cSRandall Stewart #define SCTP_CC_HTCP		0x00000002
256b54d3a6cSRandall Stewart 
2579a6142d8SRandall Stewart 
2589a6142d8SRandall Stewart /* fragment interleave constants
2599a6142d8SRandall Stewart  * setting must be one of these or
2609a6142d8SRandall Stewart  * EINVAL returned.
2619a6142d8SRandall Stewart  */
2629a6142d8SRandall Stewart #define SCTP_FRAG_LEVEL_0    0x00000000
2639a6142d8SRandall Stewart #define SCTP_FRAG_LEVEL_1    0x00000001
2649a6142d8SRandall Stewart #define SCTP_FRAG_LEVEL_2    0x00000002
2659a6142d8SRandall Stewart 
266f8829a4aSRandall Stewart /*
267f8829a4aSRandall Stewart  * user state values
268f8829a4aSRandall Stewart  */
269f8829a4aSRandall Stewart #define SCTP_CLOSED			0x0000
270f8829a4aSRandall Stewart #define SCTP_BOUND			0x1000
271f8829a4aSRandall Stewart #define SCTP_LISTEN			0x2000
272f8829a4aSRandall Stewart #define SCTP_COOKIE_WAIT		0x0002
273f8829a4aSRandall Stewart #define SCTP_COOKIE_ECHOED		0x0004
274f8829a4aSRandall Stewart #define SCTP_ESTABLISHED		0x0008
275f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_SENT		0x0010
276f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_RECEIVED		0x0020
277f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_ACK_SENT		0x0040
278f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_PENDING		0x0080
279f8829a4aSRandall Stewart 
280f8829a4aSRandall Stewart /*
281f8829a4aSRandall Stewart  * SCTP operational error codes (user visible)
282f8829a4aSRandall Stewart  */
283f8829a4aSRandall Stewart #define SCTP_CAUSE_NO_ERROR		0x0000
284f8829a4aSRandall Stewart #define SCTP_CAUSE_INVALID_STREAM	0x0001
285f8829a4aSRandall Stewart #define SCTP_CAUSE_MISSING_PARAM	0x0002
286f8829a4aSRandall Stewart #define SCTP_CAUSE_STALE_COOKIE		0x0003
287f8829a4aSRandall Stewart #define SCTP_CAUSE_OUT_OF_RESC		0x0004
288f8829a4aSRandall Stewart #define SCTP_CAUSE_UNRESOLVABLE_ADDR	0x0005
289f8829a4aSRandall Stewart #define SCTP_CAUSE_UNRECOG_CHUNK	0x0006
290f8829a4aSRandall Stewart #define SCTP_CAUSE_INVALID_PARAM	0x0007
291f8829a4aSRandall Stewart #define SCTP_CAUSE_UNRECOG_PARAM	0x0008
292f8829a4aSRandall Stewart #define SCTP_CAUSE_NO_USER_DATA		0x0009
293f8829a4aSRandall Stewart #define SCTP_CAUSE_COOKIE_IN_SHUTDOWN	0x000a
294f8829a4aSRandall Stewart #define SCTP_CAUSE_RESTART_W_NEWADDR	0x000b
295f8829a4aSRandall Stewart #define SCTP_CAUSE_USER_INITIATED_ABT	0x000c
296f8829a4aSRandall Stewart #define SCTP_CAUSE_PROTOCOL_VIOLATION	0x000d
297f8829a4aSRandall Stewart 
2983232788eSRandall Stewart /* Error causes from RFC5061 */
299830d754dSRandall Stewart #define SCTP_CAUSE_DELETING_LAST_ADDR	0x00a0
300830d754dSRandall Stewart #define SCTP_CAUSE_RESOURCE_SHORTAGE	0x00a1
301830d754dSRandall Stewart #define SCTP_CAUSE_DELETING_SRC_ADDR	0x00a2
302830d754dSRandall Stewart #define SCTP_CAUSE_ILLEGAL_ASCONF_ACK	0x00a3
303830d754dSRandall Stewart #define SCTP_CAUSE_REQUEST_REFUSED	0x00a4
304830d754dSRandall Stewart 
305830d754dSRandall Stewart /* Error causes from nat-draft */
306830d754dSRandall Stewart #define SCTP_CAUSE_NAT_COLLIDING_STATE  0x00b0
307830d754dSRandall Stewart #define SCTP_CAUSE_NAT_MISSING_STATE    0x00b1
308f8829a4aSRandall Stewart 
3093232788eSRandall Stewart /* Error causes from RFC4895 */
310f8829a4aSRandall Stewart #define SCTP_CAUSE_UNSUPPORTED_HMACID	0x0105
311f8829a4aSRandall Stewart 
312f8829a4aSRandall Stewart /*
313f8829a4aSRandall Stewart  * error cause parameters (user visisble)
314f8829a4aSRandall Stewart  */
315f8829a4aSRandall Stewart struct sctp_error_cause {
316f8829a4aSRandall Stewart 	uint16_t code;
317f8829a4aSRandall Stewart 	uint16_t length;
318f8829a4aSRandall Stewart 	/* optional cause-specific info may follow */
319b3f1ea41SRandall Stewart }                SCTP_PACKED;
320f8829a4aSRandall Stewart 
321f8829a4aSRandall Stewart struct sctp_error_invalid_stream {
322b3f1ea41SRandall Stewart 	struct sctp_error_cause cause;	/* code=SCTP_ERROR_INVALID_STREAM */
323f8829a4aSRandall Stewart 	uint16_t stream_id;	/* stream id of the DATA in error */
324f8829a4aSRandall Stewart 	uint16_t reserved;
325b3f1ea41SRandall Stewart }                         SCTP_PACKED;
326f8829a4aSRandall Stewart 
327f8829a4aSRandall Stewart struct sctp_error_missing_param {
328b3f1ea41SRandall Stewart 	struct sctp_error_cause cause;	/* code=SCTP_ERROR_MISSING_PARAM */
329b3f1ea41SRandall Stewart 	uint32_t num_missing_params;	/* number of missing parameters */
330f8829a4aSRandall Stewart 	/* uint16_t param_type's follow */
331b3f1ea41SRandall Stewart }                        SCTP_PACKED;
332f8829a4aSRandall Stewart 
333f8829a4aSRandall Stewart struct sctp_error_stale_cookie {
334b3f1ea41SRandall Stewart 	struct sctp_error_cause cause;	/* code=SCTP_ERROR_STALE_COOKIE */
335f8829a4aSRandall Stewart 	uint32_t stale_time;	/* time in usec of staleness */
336b3f1ea41SRandall Stewart }                       SCTP_PACKED;
337f8829a4aSRandall Stewart 
338f8829a4aSRandall Stewart struct sctp_error_out_of_resource {
339b3f1ea41SRandall Stewart 	struct sctp_error_cause cause;	/* code=SCTP_ERROR_OUT_OF_RESOURCES */
340b3f1ea41SRandall Stewart }                          SCTP_PACKED;
341f8829a4aSRandall Stewart 
342f8829a4aSRandall Stewart struct sctp_error_unresolv_addr {
343b3f1ea41SRandall Stewart 	struct sctp_error_cause cause;	/* code=SCTP_ERROR_UNRESOLVABLE_ADDR */
344f8829a4aSRandall Stewart 
345b3f1ea41SRandall Stewart }                        SCTP_PACKED;
346f8829a4aSRandall Stewart 
347f8829a4aSRandall Stewart struct sctp_error_unrecognized_chunk {
348b3f1ea41SRandall Stewart 	struct sctp_error_cause cause;	/* code=SCTP_ERROR_UNRECOG_CHUNK */
349f8829a4aSRandall Stewart 	struct sctp_chunkhdr ch;/* header from chunk in error */
350b3f1ea41SRandall Stewart }                             SCTP_PACKED;
351f8829a4aSRandall Stewart 
352f8829a4aSRandall Stewart /*
353f8829a4aSRandall Stewart  * Main SCTP chunk types we place these here so natd and f/w's in user land
354f8829a4aSRandall Stewart  * can find them.
355f8829a4aSRandall Stewart  */
356f8829a4aSRandall Stewart /************0x00 series ***********/
357f8829a4aSRandall Stewart #define SCTP_DATA		0x00
358f8829a4aSRandall Stewart #define SCTP_INITIATION		0x01
359f8829a4aSRandall Stewart #define SCTP_INITIATION_ACK	0x02
360f8829a4aSRandall Stewart #define SCTP_SELECTIVE_ACK	0x03
361f8829a4aSRandall Stewart #define SCTP_HEARTBEAT_REQUEST	0x04
362f8829a4aSRandall Stewart #define SCTP_HEARTBEAT_ACK	0x05
363f8829a4aSRandall Stewart #define SCTP_ABORT_ASSOCIATION	0x06
364f8829a4aSRandall Stewart #define SCTP_SHUTDOWN		0x07
365f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_ACK	0x08
366f8829a4aSRandall Stewart #define SCTP_OPERATION_ERROR	0x09
367f8829a4aSRandall Stewart #define SCTP_COOKIE_ECHO	0x0a
368f8829a4aSRandall Stewart #define SCTP_COOKIE_ACK		0x0b
369f8829a4aSRandall Stewart #define SCTP_ECN_ECHO		0x0c
370f8829a4aSRandall Stewart #define SCTP_ECN_CWR		0x0d
371f8829a4aSRandall Stewart #define SCTP_SHUTDOWN_COMPLETE	0x0e
3723232788eSRandall Stewart /* RFC4895 */
373f8829a4aSRandall Stewart #define SCTP_AUTHENTICATION     0x0f
374830d754dSRandall Stewart /* EY nr_sack chunk id*/
375830d754dSRandall Stewart #define SCTP_NR_SELECTIVE_ACK 0x10
376f8829a4aSRandall Stewart /************0x40 series ***********/
377f8829a4aSRandall Stewart /************0x80 series ***********/
3783232788eSRandall Stewart /* RFC5061 */
379f8829a4aSRandall Stewart #define	SCTP_ASCONF_ACK		0x80
380f8829a4aSRandall Stewart /* draft-ietf-stewart-pktdrpsctp */
381f8829a4aSRandall Stewart #define SCTP_PACKET_DROPPED	0x81
382f8829a4aSRandall Stewart /* draft-ietf-stewart-strreset-xxx */
383f8829a4aSRandall Stewart #define SCTP_STREAM_RESET       0x82
3849a972525SRandall Stewart 
3859a972525SRandall Stewart /* RFC4820                         */
3869a972525SRandall Stewart #define SCTP_PAD_CHUNK          0x84
387f8829a4aSRandall Stewart /************0xc0 series ***********/
388f8829a4aSRandall Stewart /* RFC3758 */
389f8829a4aSRandall Stewart #define SCTP_FORWARD_CUM_TSN	0xc0
3903232788eSRandall Stewart /* RFC5061 */
391f8829a4aSRandall Stewart #define SCTP_ASCONF		0xc1
392f8829a4aSRandall Stewart 
393f8829a4aSRandall Stewart 
394f8829a4aSRandall Stewart /* ABORT and SHUTDOWN COMPLETE FLAG */
395f8829a4aSRandall Stewart #define SCTP_HAD_NO_TCB		0x01
396f8829a4aSRandall Stewart 
397f8829a4aSRandall Stewart /* Packet dropped flags */
398f8829a4aSRandall Stewart #define SCTP_FROM_MIDDLE_BOX	SCTP_HAD_NO_TCB
399f8829a4aSRandall Stewart #define SCTP_BADCRC		0x02
400f8829a4aSRandall Stewart #define SCTP_PACKET_TRUNCATED	0x04
401f8829a4aSRandall Stewart 
402f8829a4aSRandall Stewart #define SCTP_SAT_NETWORK_MIN	400	/* min ms for RTT to set satellite
403f8829a4aSRandall Stewart 					 * time */
404f8829a4aSRandall Stewart #define SCTP_SAT_NETWORK_BURST_INCR  2	/* how many times to multiply maxburst
405f8829a4aSRandall Stewart 					 * in sat */
406f8829a4aSRandall Stewart 
407f8829a4aSRandall Stewart /* Data Chuck Specific Flags */
408f8829a4aSRandall Stewart #define SCTP_DATA_FRAG_MASK        0x03
409f8829a4aSRandall Stewart #define SCTP_DATA_MIDDLE_FRAG      0x00
410f8829a4aSRandall Stewart #define SCTP_DATA_LAST_FRAG        0x01
411f8829a4aSRandall Stewart #define SCTP_DATA_FIRST_FRAG       0x02
412f8829a4aSRandall Stewart #define SCTP_DATA_NOT_FRAG         0x03
413f8829a4aSRandall Stewart #define SCTP_DATA_UNORDERED        0x04
414b3f1ea41SRandall Stewart #define SCTP_DATA_SACK_IMMEDIATELY 0x08
415f8829a4aSRandall Stewart /* ECN Nonce: SACK Chunk Specific Flags */
416f8829a4aSRandall Stewart #define SCTP_SACK_NONCE_SUM        0x01
417f8829a4aSRandall Stewart 
418830d754dSRandall Stewart /* EY nr_sack all bit - All bit is the 2nd LSB of nr_sack chunk flags*/
419830d754dSRandall Stewart /* if All bit is set in an nr-sack chunk, then all nr gap acks gap acks*/
420830d754dSRandall Stewart #define SCTP_NR_SACK_ALL_BIT	0x02
421f8829a4aSRandall Stewart /* CMT DAC algorithm SACK flag */
422f8829a4aSRandall Stewart #define SCTP_SACK_CMT_DAC          0x80
423f8829a4aSRandall Stewart 
42458967d8dSRandall Stewart /*
42558967d8dSRandall Stewart  * PCB flags (in sctp_flags bitmask).
42658967d8dSRandall Stewart  * Note the features and flags are meant
42758967d8dSRandall Stewart  * for use by netstat.
42858967d8dSRandall Stewart  */
42958967d8dSRandall Stewart #define SCTP_PCB_FLAGS_UDPTYPE		0x00000001
43058967d8dSRandall Stewart #define SCTP_PCB_FLAGS_TCPTYPE		0x00000002
43158967d8dSRandall Stewart #define SCTP_PCB_FLAGS_BOUNDALL		0x00000004
43258967d8dSRandall Stewart #define SCTP_PCB_FLAGS_ACCEPTING	0x00000008
43358967d8dSRandall Stewart #define SCTP_PCB_FLAGS_UNBOUND		0x00000010
43458967d8dSRandall Stewart #define SCTP_PCB_FLAGS_CLOSE_IP         0x00040000
43558967d8dSRandall Stewart #define SCTP_PCB_FLAGS_WAS_CONNECTED    0x00080000
43658967d8dSRandall Stewart #define SCTP_PCB_FLAGS_WAS_ABORTED      0x00100000
43758967d8dSRandall Stewart /* TCP model support */
43858967d8dSRandall Stewart 
43958967d8dSRandall Stewart #define SCTP_PCB_FLAGS_CONNECTED	0x00200000
44058967d8dSRandall Stewart #define SCTP_PCB_FLAGS_IN_TCPPOOL	0x00400000
44158967d8dSRandall Stewart #define SCTP_PCB_FLAGS_DONT_WAKE	0x00800000
44258967d8dSRandall Stewart #define SCTP_PCB_FLAGS_WAKEOUTPUT	0x01000000
44358967d8dSRandall Stewart #define SCTP_PCB_FLAGS_WAKEINPUT	0x02000000
44458967d8dSRandall Stewart #define SCTP_PCB_FLAGS_BOUND_V6		0x04000000
445bfefd190SRandall Stewart #define SCTP_PCB_FLAGS_BLOCKING_IO	0x08000000
446bfefd190SRandall Stewart #define SCTP_PCB_FLAGS_SOCKET_GONE	0x10000000
447bfefd190SRandall Stewart #define SCTP_PCB_FLAGS_SOCKET_ALLGONE	0x20000000
44858967d8dSRandall Stewart /* flags to copy to new PCB */
449bfefd190SRandall Stewart #define SCTP_PCB_COPY_FLAGS		(SCTP_PCB_FLAGS_BOUNDALL|\
450bfefd190SRandall Stewart 					 SCTP_PCB_FLAGS_WAKEINPUT|\
451bfefd190SRandall Stewart 					 SCTP_PCB_FLAGS_BOUND_V6)
45258967d8dSRandall Stewart 
45358967d8dSRandall Stewart 
45458967d8dSRandall Stewart /*
45558967d8dSRandall Stewart  * PCB Features (in sctp_features bitmask)
45658967d8dSRandall Stewart  */
45758967d8dSRandall Stewart #define SCTP_PCB_FLAGS_EXT_RCVINFO      0x00000002
45858967d8dSRandall Stewart #define SCTP_PCB_FLAGS_DONOT_HEARTBEAT  0x00000004
45958967d8dSRandall Stewart #define SCTP_PCB_FLAGS_FRAG_INTERLEAVE  0x00000008
46058967d8dSRandall Stewart #define SCTP_PCB_FLAGS_INTERLEAVE_STRMS	0x00000010
46158967d8dSRandall Stewart #define SCTP_PCB_FLAGS_DO_ASCONF	0x00000020
46258967d8dSRandall Stewart #define SCTP_PCB_FLAGS_AUTO_ASCONF	0x00000040
46317205eccSRandall Stewart #define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080
46458967d8dSRandall Stewart /* socket options */
46558967d8dSRandall Stewart #define SCTP_PCB_FLAGS_NODELAY		0x00000100
46658967d8dSRandall Stewart #define SCTP_PCB_FLAGS_AUTOCLOSE	0x00000200
46758967d8dSRandall Stewart #define SCTP_PCB_FLAGS_RECVDATAIOEVNT	0x00000400
46858967d8dSRandall Stewart #define SCTP_PCB_FLAGS_RECVASSOCEVNT	0x00000800
46958967d8dSRandall Stewart #define SCTP_PCB_FLAGS_RECVPADDREVNT	0x00001000
47058967d8dSRandall Stewart #define SCTP_PCB_FLAGS_RECVPEERERR	0x00002000
47158967d8dSRandall Stewart #define SCTP_PCB_FLAGS_RECVSENDFAILEVNT	0x00004000
47258967d8dSRandall Stewart #define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT	0x00008000
47358967d8dSRandall Stewart #define SCTP_PCB_FLAGS_ADAPTATIONEVNT	0x00010000
47458967d8dSRandall Stewart #define SCTP_PCB_FLAGS_PDAPIEVNT	0x00020000
47558967d8dSRandall Stewart #define SCTP_PCB_FLAGS_AUTHEVNT		0x00040000
47658967d8dSRandall Stewart #define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000
47758967d8dSRandall Stewart #define SCTP_PCB_FLAGS_NO_FRAGMENT	0x00100000
47858967d8dSRandall Stewart #define SCTP_PCB_FLAGS_EXPLICIT_EOR     0x00400000
479bfefd190SRandall Stewart #define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4	0x00800000
480c54a18d2SRandall Stewart #define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS	0x01000000
4816d9e8f2bSRandall Stewart #define SCTP_PCB_FLAGS_PORTREUSE        0x02000000
482830d754dSRandall Stewart #define SCTP_PCB_FLAGS_DRYEVNT          0x04000000
4832afb3e84SRandall Stewart /*-
4842afb3e84SRandall Stewart  * mobility_features parameters (by micchie).Note
4852afb3e84SRandall Stewart  * these features are applied against the
4862afb3e84SRandall Stewart  * sctp_mobility_features flags.. not the sctp_features
4872afb3e84SRandall Stewart  * flags.
4882afb3e84SRandall Stewart  */
4892afb3e84SRandall Stewart #define SCTP_MOBILITY_BASE		0x00000001
4902afb3e84SRandall Stewart #define SCTP_MOBILITY_FASTHANDOFF	0x00000002
491851b7298SRandall Stewart #define SCTP_MOBILITY_PRIM_DELETED	0x00000004
4922afb3e84SRandall Stewart 
4932afb3e84SRandall Stewart 
494d61a0ae0SRandall Stewart #define SCTP_SMALLEST_PMTU 512	/* smallest pmtu allowed when disabling PMTU
495d61a0ae0SRandall Stewart 				 * discovery */
496d61a0ae0SRandall Stewart 
497f8829a4aSRandall Stewart #include <netinet/sctp_uio.h>
498f8829a4aSRandall Stewart 
49980fefe0aSRandall Stewart /* This dictates the size of the packet
50080fefe0aSRandall Stewart  * collection buffer. This only applies
50180fefe0aSRandall Stewart  * if SCTP_PACKET_LOGGING is enabled in
50280fefe0aSRandall Stewart  * your config.
50380fefe0aSRandall Stewart  */
504207304d4SRandall Stewart #define SCTP_PACKET_LOG_SIZE 65536
505207304d4SRandall Stewart 
50618e198d3SRandall Stewart /* Maximum delays and such a user can set for options that
50718e198d3SRandall Stewart  * take ms.
50818e198d3SRandall Stewart  */
50918e198d3SRandall Stewart #define SCTP_MAX_SACK_DELAY 500	/* per RFC4960 */
51018e198d3SRandall Stewart #define SCTP_MAX_HB_INTERVAL 14400000	/* 4 hours in ms */
51118e198d3SRandall Stewart #define SCTP_MAX_COOKIE_LIFE  3600000	/* 1 hour in ms */
51218e198d3SRandall Stewart 
51318e198d3SRandall Stewart 
51480fefe0aSRandall Stewart /* Types of logging/KTR tracing  that can be enabled via the
51580fefe0aSRandall Stewart  * sysctl net.inet.sctp.sctp_logging. You must also enable
51680fefe0aSRandall Stewart  * SUBSYS tracing.
51780fefe0aSRandall Stewart  * Note that you must have the SCTP option in the kernel
51880fefe0aSRandall Stewart  * to enable these as well.
51980fefe0aSRandall Stewart  */
52080fefe0aSRandall Stewart #define SCTP_BLK_LOGGING_ENABLE				0x00000001
52180fefe0aSRandall Stewart #define SCTP_CWND_MONITOR_ENABLE			0x00000002
52280fefe0aSRandall Stewart #define SCTP_CWND_LOGGING_ENABLE			0x00000004
52380fefe0aSRandall Stewart #define SCTP_EARLYFR_LOGGING_ENABLE			0x00000010
52480fefe0aSRandall Stewart #define SCTP_FLIGHT_LOGGING_ENABLE			0x00000020
52580fefe0aSRandall Stewart #define SCTP_FR_LOGGING_ENABLE				0x00000040
52680fefe0aSRandall Stewart #define SCTP_LOCK_LOGGING_ENABLE			0x00000080
52780fefe0aSRandall Stewart #define SCTP_MAP_LOGGING_ENABLE				0x00000100
52880fefe0aSRandall Stewart #define SCTP_MBCNT_LOGGING_ENABLE			0x00000200
52980fefe0aSRandall Stewart #define SCTP_MBUF_LOGGING_ENABLE			0x00000400
53080fefe0aSRandall Stewart #define SCTP_NAGLE_LOGGING_ENABLE			0x00000800
53180fefe0aSRandall Stewart #define SCTP_RECV_RWND_LOGGING_ENABLE		0x00001000
53280fefe0aSRandall Stewart #define SCTP_RTTVAR_LOGGING_ENABLE			0x00002000
53380fefe0aSRandall Stewart #define SCTP_SACK_LOGGING_ENABLE			0x00004000
53480fefe0aSRandall Stewart #define SCTP_SACK_RWND_LOGGING_ENABLE		0x00008000
53580fefe0aSRandall Stewart #define SCTP_SB_LOGGING_ENABLE				0x00010000
53680fefe0aSRandall Stewart #define SCTP_STR_LOGGING_ENABLE				0x00020000
53780fefe0aSRandall Stewart #define SCTP_WAKE_LOGGING_ENABLE			0x00040000
53880fefe0aSRandall Stewart #define SCTP_LOG_MAXBURST_ENABLE			0x00080000
53980fefe0aSRandall Stewart #define SCTP_LOG_RWND_ENABLE    			0x00100000
54080fefe0aSRandall Stewart #define SCTP_LOG_SACK_ARRIVALS_ENABLE       0x00200000
54180fefe0aSRandall Stewart #define SCTP_LTRACE_CHUNK_ENABLE            0x00400000
54280fefe0aSRandall Stewart #define SCTP_LTRACE_ERROR_ENABLE            0x00800000
543d95ddf02SRandall Stewart #define SCTP_LAST_PACKET_TRACING            0x01000000
544c4739e2fSRandall Stewart #define SCTP_THRESHOLD_LOGGING              0x02000000
5459f22f500SRandall Stewart #define SCTP_LOG_AT_SEND_2_SCTP             0x04000000
5469f22f500SRandall Stewart #define SCTP_LOG_AT_SEND_2_OUTQ             0x08000000
547c4739e2fSRandall Stewart 
548207304d4SRandall Stewart 
5492afb3e84SRandall Stewart 
550b3f1ea41SRandall Stewart #undef SCTP_PACKED
551b3f1ea41SRandall Stewart 
552f8829a4aSRandall Stewart #endif				/* !_NETINET_SCTP_H_ */
553