sctp.h revision 235828
117680Spst/*-
239300Sfenner * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
317680Spst * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
417680Spst * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
517680Spst *
617680Spst * Redistribution and use in source and binary forms, with or without
717680Spst * modification, are permitted provided that the following conditions are met:
817680Spst *
917680Spst * a) Redistributions of source code must retain the above copyright notice,
1017680Spst *    this list of conditions and the following disclaimer.
1117680Spst *
1217680Spst * b) Redistributions in binary form must reproduce the above copyright
1317680Spst *    notice, this list of conditions and the following disclaimer in
1417680Spst *    the documentation and/or other materials provided with the distribution.
1517680Spst *
1617680Spst * c) Neither the name of Cisco Systems, Inc. nor the names of its
1717680Spst *    contributors may be used to endorse or promote products derived
1817680Spst *    from this software without specific prior written permission.
1917680Spst *
2056896Sfenner * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2156896Sfenner * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
2217680Spst * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2317680Spst * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2417680Spst * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25127675Sbms * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26190207Srpaulo * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2717680Spst * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2817680Spst * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2956896Sfenner * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
3056896Sfenner * THE POSSIBILITY OF SUCH DAMAGE.
3156896Sfenner */
3256896Sfenner
33127675Sbms#include <sys/cdefs.h>
3417680Spst__FBSDID("$FreeBSD: head/sys/netinet/sctp.h 235828 2012-05-23 11:26:28Z tuexen $");
3517680Spst
3617680Spst#ifndef _NETINET_SCTP_H_
3717680Spst#define _NETINET_SCTP_H_
3817680Spst
3917680Spst
4017680Spst#include <sys/types.h>
4117680Spst
4217680Spst
4375118Sfenner#define SCTP_PACKED __attribute__((packed))
44127675Sbms
4575118Sfenner/*
46146778Ssam * SCTP protocol - RFC2960.
47146778Ssam */
48146778Ssamstruct sctphdr {
49146778Ssam	uint16_t src_port;	/* source port */
50146778Ssam	uint16_t dest_port;	/* destination port */
51146778Ssam	uint32_t v_tag;		/* verification tag of packet */
52146778Ssam	uint32_t checksum;	/* Adler32 C-Sum */
53146778Ssam	/* chunks follow... */
54146778Ssam}       SCTP_PACKED;
55172686Smlaier
56146778Ssam/*
57146778Ssam * SCTP Chunks
58146778Ssam */
5917680Spststruct sctp_chunkhdr {
6017680Spst	uint8_t chunk_type;	/* chunk type */
6117680Spst	uint8_t chunk_flags;	/* chunk flags */
6217680Spst	uint16_t chunk_length;	/* chunk length */
63146778Ssam	/* optional params follow */
6417680Spst}             SCTP_PACKED;
65127675Sbms
6617680Spst/*
6717680Spst * SCTP chunk parameters
68127675Sbms */
69127675Sbmsstruct sctp_paramhdr {
70127675Sbms	uint16_t param_type;	/* parameter type */
71127675Sbms	uint16_t param_length;	/* parameter length */
7217680Spst}             SCTP_PACKED;
73127675Sbms
74127675Sbms/*
7517680Spst * user socket options: socket API defined
76127675Sbms */
7717680Spst/*
7817680Spst * read-write options
79172686Smlaier */
80146778Ssam#define SCTP_RTOINFO			0x00000001
81172686Smlaier#define SCTP_ASSOCINFO			0x00000002
8217680Spst#define SCTP_INITMSG			0x00000003
8317680Spst#define SCTP_NODELAY			0x00000004
8417680Spst#define SCTP_AUTOCLOSE			0x00000005
85127675Sbms#define SCTP_SET_PEER_PRIMARY_ADDR	0x00000006
86146778Ssam#define SCTP_PRIMARY_ADDR		0x00000007
87127675Sbms#define SCTP_ADAPTATION_LAYER		0x00000008
88127675Sbms/* same as above */
89127675Sbms#define SCTP_ADAPTION_LAYER		0x00000008
90127675Sbms#define SCTP_DISABLE_FRAGMENTS		0x00000009
91127675Sbms#define SCTP_PEER_ADDR_PARAMS 		0x0000000a
92235530Sdelphij#define SCTP_DEFAULT_SEND_PARAM		0x0000000b
93127675Sbms/* ancillary data/notification interest options */
94127675Sbms#define SCTP_EVENTS			0x0000000c	/* deprecated */
95127675Sbms/* Without this applied we will give V4 and V6 addresses on a V6 socket */
96127675Sbms#define SCTP_I_WANT_MAPPED_V4_ADDR	0x0000000d
97127675Sbms#define SCTP_MAXSEG 			0x0000000e
98127675Sbms#define SCTP_DELAYED_SACK               0x0000000f
99127675Sbms#define SCTP_FRAGMENT_INTERLEAVE        0x00000010
100127675Sbms#define SCTP_PARTIAL_DELIVERY_POINT     0x00000011
101127675Sbms/* authentication support */
102127675Sbms#define SCTP_AUTH_CHUNK 		0x00000012
103127675Sbms#define SCTP_AUTH_KEY 			0x00000013
104127675Sbms#define SCTP_HMAC_IDENT 		0x00000014
105127675Sbms#define SCTP_AUTH_ACTIVE_KEY 		0x00000015
106127675Sbms#define SCTP_AUTH_DELETE_KEY 		0x00000016
107127675Sbms#define SCTP_USE_EXT_RCVINFO		0x00000017
108146778Ssam#define SCTP_AUTO_ASCONF		0x00000018	/* rw */
109146778Ssam#define SCTP_MAXBURST			0x00000019	/* rw */
110146778Ssam#define SCTP_MAX_BURST			0x00000019	/* rw */
111127675Sbms/* assoc level context */
112127675Sbms#define SCTP_CONTEXT                    0x0000001a	/* rw */
113127675Sbms/* explicit EOR signalling */
114127675Sbms#define SCTP_EXPLICIT_EOR               0x0000001b
115146778Ssam#define SCTP_REUSE_PORT                 0x0000001c	/* rw */
116146778Ssam#define SCTP_AUTH_DEACTIVATE_KEY	0x0000001d
117127675Sbms#define SCTP_EVENT                      0x0000001e
118127675Sbms#define SCTP_RECVRCVINFO                0x0000001f
119127675Sbms#define SCTP_RECVNXTINFO                0x00000020
120127675Sbms#define SCTP_DEFAULT_SNDINFO            0x00000021
121127675Sbms#define SCTP_DEFAULT_PRINFO             0x00000022
122127675Sbms#define SCTP_PEER_ADDR_THLDS            0x00000023
123127675Sbms#define SCTP_REMOTE_UDP_ENCAPS_PORT     0x00000024
124146778Ssam
125127675Sbms/*
126127675Sbms * read-only options
127127675Sbms */
128127675Sbms#define SCTP_STATUS			0x00000100
129127675Sbms#define SCTP_GET_PEER_ADDR_INFO		0x00000101
130146778Ssam/* authentication support */
131146778Ssam#define SCTP_PEER_AUTH_CHUNKS 		0x00000102
132127675Sbms#define SCTP_LOCAL_AUTH_CHUNKS 		0x00000103
133127675Sbms#define SCTP_GET_ASSOC_NUMBER           0x00000104	/* ro */
134235530Sdelphij#define SCTP_GET_ASSOC_ID_LIST          0x00000105	/* ro */
135235530Sdelphij#define SCTP_TIMEOUTS                   0x00000106
136235530Sdelphij
137235530Sdelphij/*
138235530Sdelphij * user socket options: BSD implementation specific
139235530Sdelphij */
140235530Sdelphij/*
141235530Sdelphij * Blocking I/O is enabled on any TCP type socket by default. For the UDP
142235530Sdelphij * model if this is turned on then the socket buffer is shared for send
143235530Sdelphij * resources amongst all associations.  The default for the UDP model is that
144235530Sdelphij * is SS_NBIO is set.  Which means all associations have a separate send
145235530Sdelphij * limit BUT they will NOT ever BLOCK instead you will get an error back
146235530Sdelphij * EAGAIN if you try to send too much. If you want the blocking semantics you
147235530Sdelphij * set this option at the cost of sharing one socket send buffer size amongst
148235530Sdelphij * all associations. Peeled off sockets turn this option off and block. But
149235530Sdelphij * since both TCP and peeled off sockets have only one assoc per socket this
150235530Sdelphij * is fine. It probably does NOT make sense to set this on SS_NBIO on a TCP
151235530Sdelphij * model OR peeled off UDP model, but we do allow you to do so. You just use
152235530Sdelphij * the normal syscall to toggle SS_NBIO the way you want.
153235530Sdelphij *
154235530Sdelphij * Blocking I/O is controlled by the SS_NBIO flag on the socket state so_state
155235530Sdelphij * field.
156235530Sdelphij */
157235530Sdelphij
158235530Sdelphij#define SCTP_ENABLE_STREAM_RESET	0x00000900	/* struct
159235530Sdelphij							 * sctp_assoc_value */
160235530Sdelphij#define SCTP_RESET_STREAMS		0x00000901	/* struct
161235530Sdelphij							 * sctp_reset_streams */
162235530Sdelphij#define SCTP_RESET_ASSOC		0x00000902	/* sctp_assoc_t */
163235530Sdelphij#define SCTP_ADD_STREAMS		0x00000903	/* struct
164235530Sdelphij							 * sctp_add_streams */
165235530Sdelphij
166235530Sdelphij/* For enable stream reset */
16756896Sfenner#define SCTP_ENABLE_RESET_STREAM_REQ 	0x00000001
16856896Sfenner#define SCTP_ENABLE_RESET_ASSOC_REQ 	0x00000002
16956896Sfenner#define SCTP_ENABLE_CHANGE_ASSOC_REQ 	0x00000004
170127675Sbms#define SCTP_ENABLE_VALUE_MASK		0x00000007
171127675Sbms/* For reset streams */
17256896Sfenner#define SCTP_STREAM_RESET_INCOMING	0x00000001
173127675Sbms#define SCTP_STREAM_RESET_OUTGOING	0x00000002
17456896Sfenner
175127675Sbms
176172686Smlaier/* here on down are more implementation specific */
177127675Sbms#define SCTP_SET_DEBUG_LEVEL		0x00001005
178127675Sbms#define SCTP_CLR_STAT_LOG               0x00001007
17956896Sfenner/* CMT ON/OFF socket option */
18056896Sfenner#define SCTP_CMT_ON_OFF                 0x00001200
18156896Sfenner#define SCTP_CMT_USE_DAC                0x00001201
182172686Smlaier/* JRS - Pluggable Congestion Control Socket option */
183127675Sbms#define SCTP_PLUGGABLE_CC               0x00001202
184127675Sbms/* RS - Pluggable Stream Scheduling Socket option */
18556896Sfenner#define SCTP_PLUGGABLE_SS		0x00001203
186172686Smlaier#define SCTP_SS_VALUE			0x00001204
18756896Sfenner#define SCTP_CC_OPTION			0x00001205	/* Options for CC
18856896Sfenner							 * modules */
18956896Sfenner/* read only */
19056896Sfenner#define SCTP_GET_SNDBUF_USE		0x00001101
19156896Sfenner#define SCTP_GET_STAT_LOG		0x00001103
19256896Sfenner#define SCTP_PCB_STATUS			0x00001104
19356896Sfenner#define SCTP_GET_NONCE_VALUES           0x00001105
19456896Sfenner
19556896Sfenner
19656896Sfenner/* Special hook for dynamically setting primary for all assoc's,
19756896Sfenner * this is a write only option that requires root privilege.
19856896Sfenner */
19956896Sfenner#define SCTP_SET_DYNAMIC_PRIMARY        0x00002001
20056896Sfenner
20156896Sfenner/* VRF (virtual router feature) and multi-VRF support
20256896Sfenner * options. VRF's provide splits within a router
20356896Sfenner * that give the views of multiple routers. A
20456896Sfenner * standard host, without VRF support, is just
20556896Sfenner * a single VRF. If VRF's are supported then
206127675Sbms * the transport must be VRF aware. This means
20756896Sfenner * that every socket call coming in must be directed
20856896Sfenner * within the endpoint to one of the VRF's it belongs
20956896Sfenner * to. The endpoint, before binding, may select
21056896Sfenner * the "default" VRF it is in by using a set socket
21156896Sfenner * option with SCTP_VRF_ID. This will also
21256896Sfenner * get propagated to the default VRF. Once the
21356896Sfenner * endpoint binds an address then it CANNOT add
21456896Sfenner * additional VRF's to become a Multi-VRF endpoint.
21556896Sfenner *
21656896Sfenner * Before BINDING additional VRF's can be added with
21756896Sfenner * the SCTP_ADD_VRF_ID call or deleted with
21856896Sfenner * SCTP_DEL_VRF_ID.
21956896Sfenner *
22056896Sfenner * Associations are ALWAYS contained inside a single
22156896Sfenner * VRF. They cannot reside in two (or more) VRF's. Incoming
22256896Sfenner * packets, assuming the router is VRF aware, can always
22356896Sfenner * tell us what VRF they arrived on. A host not supporting
22456896Sfenner * any VRF's will find that the packets always arrived on the
22556896Sfenner * single VRF that the host has.
22656896Sfenner *
22756896Sfenner */
22856896Sfenner
22917680Spst#define SCTP_VRF_ID			0x00003001
23017680Spst#define SCTP_ADD_VRF_ID			0x00003002
23117680Spst#define SCTP_GET_VRF_IDS		0x00003003
23217680Spst#define SCTP_GET_ASOC_VRF               0x00003004
23317680Spst#define SCTP_DEL_VRF_ID                 0x00003005
23417680Spst
235146778Ssam/*
236172686Smlaier * If you enable packet logging you can get
23717680Spst * a poor mans ethereal output in binary
238146778Ssam * form. Note this is a compile option to
239146778Ssam * the kernel,  SCTP_PACKET_LOGGING, and
24017680Spst * without it in your kernel you
241172686Smlaier * will get a EOPNOTSUPP
242172686Smlaier */
243172686Smlaier#define SCTP_GET_PACKET_LOG             0x00004001
244127675Sbms
245146778Ssam/*
246146778Ssam * hidden implementation specific options these are NOT user visible (should
247172686Smlaier * move out of sctp.h)
248172686Smlaier */
249172686Smlaier/* sctp_bindx() flags as hidden socket options */
250146778Ssam#define SCTP_BINDX_ADD_ADDR		0x00008001
251146778Ssam#define SCTP_BINDX_REM_ADDR		0x00008002
252146778Ssam/* Hidden socket option that gets the addresses */
253146778Ssam#define SCTP_GET_PEER_ADDRESSES		0x00008003
25475118Sfenner#define SCTP_GET_LOCAL_ADDRESSES	0x00008004
255127675Sbms/* return the total count in bytes needed to hold all local addresses bound */
256172686Smlaier#define SCTP_GET_LOCAL_ADDR_SIZE	0x00008005
257172686Smlaier/* Return the total count in bytes needed to hold the remote address */
258172686Smlaier#define SCTP_GET_REMOTE_ADDR_SIZE	0x00008006
259172686Smlaier/* hidden option for connectx */
260172686Smlaier#define SCTP_CONNECT_X			0x00008007
26175118Sfenner/* hidden option for connectx_delayed, part of sendx */
26217680Spst#define SCTP_CONNECT_X_DELAYED		0x00008008
263172686Smlaier#define SCTP_CONNECT_X_COMPLETE         0x00008009
264172686Smlaier/* hidden socket option based sctp_peeloff */
265172686Smlaier#define SCTP_PEELOFF                    0x0000800a
266172686Smlaier/* the real worker for sctp_getaddrlen() */
267146778Ssam#define SCTP_GET_ADDR_LEN               0x0000800b
268146778Ssam/* Debug things that need to be purged */
269146778Ssam#define SCTP_SET_INITIAL_DBG_SEQ	0x00009f00
270146778Ssam
27117680Spst/* JRS - Supported congestion control modules for pluggable
27217680Spst * congestion control
27317680Spst */
27417680Spst/* Standard TCP Congestion Control */
275146778Ssam#define SCTP_CC_RFC2581		0x00000000
27617680Spst/* High Speed TCP Congestion Control (Floyd) */
27717680Spst#define SCTP_CC_HSTCP		0x00000001
278146778Ssam/* HTCP Congestion Control */
27917680Spst#define SCTP_CC_HTCP		0x00000002
28017680Spst/* RTCC Congestion Control - RFC2581 plus */
281172686Smlaier#define SCTP_CC_RTCC            0x00000003
28217680Spst
28317680Spst#define SCTP_CC_OPT_RTCC_SETMODE	0x00002000
28417691Spst#define SCTP_CC_OPT_USE_DCCC_ECN	0x00002001
285172686Smlaier#define SCTP_CC_OPT_STEADY_STEP         0x00002002
286172686Smlaier
287172686Smlaier#define SCTP_CMT_OFF            0
288172686Smlaier#define SCTP_CMT_BASE           1
289146778Ssam#define SCTP_CMT_RPV1           2
290146778Ssam#define SCTP_CMT_RPV2           3
291172686Smlaier#define SCTP_CMT_MPTCP          4
29298527Sfenner#define SCTP_CMT_MAX            SCTP_CMT_MPTCP
29317691Spst
294146778Ssam/* RS - Supported stream scheduling modules for pluggable
295146778Ssam * stream scheduling
29617680Spst */
29717680Spst/* Default simple round-robin */
29817680Spst#define SCTP_SS_DEFAULT			0x00000000
29917680Spst/* Real round-robin */
300127675Sbms#define SCTP_SS_ROUND_ROBIN		0x00000001
301127675Sbms/* Real round-robin per packet */
302127675Sbms#define SCTP_SS_ROUND_ROBIN_PACKET	0x00000002
303127675Sbms/* Priority */
30417680Spst#define SCTP_SS_PRIORITY		0x00000003
30517680Spst/* Fair Bandwidth */
306127675Sbms#define SCTP_SS_FAIR_BANDWITH		0x00000004
307127675Sbms/* First-come, first-serve */
308127675Sbms#define SCTP_SS_FIRST_COME		0x00000005
309127675Sbms
310127675Sbms
311127675Sbms/* fragment interleave constants
312127675Sbms * setting must be one of these or
313127675Sbms * EINVAL returned.
314127675Sbms */
315146778Ssam#define SCTP_FRAG_LEVEL_0    0x00000000
316146778Ssam#define SCTP_FRAG_LEVEL_1    0x00000001
317146778Ssam#define SCTP_FRAG_LEVEL_2    0x00000002
318146778Ssam
319146778Ssam/*
320146778Ssam * user state values
321146778Ssam */
322146778Ssam#define SCTP_CLOSED			0x0000
323146778Ssam#define SCTP_BOUND			0x1000
324146778Ssam#define SCTP_LISTEN			0x2000
325146778Ssam#define SCTP_COOKIE_WAIT		0x0002
326146778Ssam#define SCTP_COOKIE_ECHOED		0x0004
327146778Ssam#define SCTP_ESTABLISHED		0x0008
328235530Sdelphij#define SCTP_SHUTDOWN_SENT		0x0010
329146778Ssam#define SCTP_SHUTDOWN_RECEIVED		0x0020
330146778Ssam#define SCTP_SHUTDOWN_ACK_SENT		0x0040
331146778Ssam#define SCTP_SHUTDOWN_PENDING		0x0080
332146778Ssam
333146778Ssam/*
334146778Ssam * SCTP operational error codes (user visible)
335146778Ssam */
336146778Ssam#define SCTP_CAUSE_NO_ERROR		0x0000
337146778Ssam#define SCTP_CAUSE_INVALID_STREAM	0x0001
338146778Ssam#define SCTP_CAUSE_MISSING_PARAM	0x0002
339146778Ssam#define SCTP_CAUSE_STALE_COOKIE		0x0003
340146778Ssam#define SCTP_CAUSE_OUT_OF_RESC		0x0004
341146778Ssam#define SCTP_CAUSE_UNRESOLVABLE_ADDR	0x0005
342146778Ssam#define SCTP_CAUSE_UNRECOG_CHUNK	0x0006
343146778Ssam#define SCTP_CAUSE_INVALID_PARAM	0x0007
344146778Ssam#define SCTP_CAUSE_UNRECOG_PARAM	0x0008
345146778Ssam#define SCTP_CAUSE_NO_USER_DATA		0x0009
346146778Ssam#define SCTP_CAUSE_COOKIE_IN_SHUTDOWN	0x000a
347146778Ssam#define SCTP_CAUSE_RESTART_W_NEWADDR	0x000b
348146778Ssam#define SCTP_CAUSE_USER_INITIATED_ABT	0x000c
349146778Ssam#define SCTP_CAUSE_PROTOCOL_VIOLATION	0x000d
350146778Ssam
351146778Ssam/* Error causes from RFC5061 */
352146778Ssam#define SCTP_CAUSE_DELETING_LAST_ADDR	0x00a0
353146778Ssam#define SCTP_CAUSE_RESOURCE_SHORTAGE	0x00a1
354146778Ssam#define SCTP_CAUSE_DELETING_SRC_ADDR	0x00a2
355146778Ssam#define SCTP_CAUSE_ILLEGAL_ASCONF_ACK	0x00a3
356146778Ssam#define SCTP_CAUSE_REQUEST_REFUSED	0x00a4
357146778Ssam
358146778Ssam/* Error causes from nat-draft */
359146778Ssam#define SCTP_CAUSE_NAT_COLLIDING_STATE  0x00b0
360146778Ssam#define SCTP_CAUSE_NAT_MISSING_STATE    0x00b1
361146778Ssam
362146778Ssam/* Error causes from RFC4895 */
363146778Ssam#define SCTP_CAUSE_UNSUPPORTED_HMACID	0x0105
364146778Ssam
365146778Ssam/*
366146778Ssam * error cause parameters (user visible)
367146778Ssam */
368146778Ssamstruct sctp_error_cause {
369146778Ssam	uint16_t code;
370146778Ssam	uint16_t length;
371162021Ssam	/* optional cause-specific info may follow */
372162021Ssam}                SCTP_PACKED;
373162021Ssam
374162021Ssamstruct sctp_error_invalid_stream {
375146778Ssam	struct sctp_error_cause cause;	/* code=SCTP_ERROR_INVALID_STREAM */
376146778Ssam	uint16_t stream_id;	/* stream id of the DATA in error */
377172686Smlaier	uint16_t reserved;
378146778Ssam}                         SCTP_PACKED;
379172686Smlaier
380146778Ssamstruct sctp_error_missing_param {
381146778Ssam	struct sctp_error_cause cause;	/* code=SCTP_ERROR_MISSING_PARAM */
382146778Ssam	uint32_t num_missing_params;	/* number of missing parameters */
383172686Smlaier	/* uint16_t param_type's follow */
384146778Ssam}                        SCTP_PACKED;
385172686Smlaier
386146778Ssamstruct sctp_error_stale_cookie {
387146778Ssam	struct sctp_error_cause cause;	/* code=SCTP_ERROR_STALE_COOKIE */
388146778Ssam	uint32_t stale_time;	/* time in usec of staleness */
389146778Ssam}                       SCTP_PACKED;
390146778Ssam
391172686Smlaierstruct sctp_error_out_of_resource {
392146778Ssam	struct sctp_error_cause cause;	/* code=SCTP_ERROR_OUT_OF_RESOURCES */
393146778Ssam}                          SCTP_PACKED;
394146778Ssam
395146778Ssamstruct sctp_error_unresolv_addr {
396146778Ssam	struct sctp_error_cause cause;	/* code=SCTP_ERROR_UNRESOLVABLE_ADDR */
397146778Ssam
398146778Ssam}                        SCTP_PACKED;
399146778Ssam
400146778Ssamstruct sctp_error_unrecognized_chunk {
401146778Ssam	struct sctp_error_cause cause;	/* code=SCTP_ERROR_UNRECOG_CHUNK */
402146778Ssam	struct sctp_chunkhdr ch;/* header from chunk in error */
403146778Ssam}                             SCTP_PACKED;
404146778Ssam
405146778Ssam/*
406146778Ssam * Main SCTP chunk types we place these here so natd and f/w's in user land
407146778Ssam * can find them.
408146778Ssam */
409146778Ssam/************0x00 series ***********/
410146778Ssam#define SCTP_DATA		0x00
411146778Ssam#define SCTP_INITIATION		0x01
412146778Ssam#define SCTP_INITIATION_ACK	0x02
413146778Ssam#define SCTP_SELECTIVE_ACK	0x03
414146778Ssam#define SCTP_HEARTBEAT_REQUEST	0x04
415146778Ssam#define SCTP_HEARTBEAT_ACK	0x05
416146778Ssam#define SCTP_ABORT_ASSOCIATION	0x06
417146778Ssam#define SCTP_SHUTDOWN		0x07
418146778Ssam#define SCTP_SHUTDOWN_ACK	0x08
419146778Ssam#define SCTP_OPERATION_ERROR	0x09
420146778Ssam#define SCTP_COOKIE_ECHO	0x0a
421146778Ssam#define SCTP_COOKIE_ACK		0x0b
422146778Ssam#define SCTP_ECN_ECHO		0x0c
423146778Ssam#define SCTP_ECN_CWR		0x0d
424146778Ssam#define SCTP_SHUTDOWN_COMPLETE	0x0e
425146778Ssam/* RFC4895 */
426146778Ssam#define SCTP_AUTHENTICATION     0x0f
427146778Ssam/* EY nr_sack chunk id*/
428146778Ssam#define SCTP_NR_SELECTIVE_ACK 0x10
429146778Ssam/************0x40 series ***********/
430146778Ssam/************0x80 series ***********/
431146778Ssam/* RFC5061 */
432146778Ssam#define	SCTP_ASCONF_ACK		0x80
433235530Sdelphij/* draft-ietf-stewart-pktdrpsctp */
434146778Ssam#define SCTP_PACKET_DROPPED	0x81
435146778Ssam/* draft-ietf-stewart-strreset-xxx */
436146778Ssam#define SCTP_STREAM_RESET       0x82
437146778Ssam
438146778Ssam/* RFC4820                         */
439146778Ssam#define SCTP_PAD_CHUNK          0x84
440146778Ssam/************0xc0 series ***********/
441146778Ssam/* RFC3758 */
442146778Ssam#define SCTP_FORWARD_CUM_TSN	0xc0
443235530Sdelphij/* RFC5061 */
444146778Ssam#define SCTP_ASCONF		0xc1
445146778Ssam
446146778Ssam
447146778Ssam/* ABORT and SHUTDOWN COMPLETE FLAG */
448146778Ssam#define SCTP_HAD_NO_TCB		0x01
449146778Ssam
450146778Ssam/* Packet dropped flags */
451146778Ssam#define SCTP_FROM_MIDDLE_BOX	SCTP_HAD_NO_TCB
452146778Ssam#define SCTP_BADCRC		0x02
453146778Ssam#define SCTP_PACKET_TRUNCATED	0x04
454146778Ssam
455146778Ssam/* Flag for ECN -CWR */
456146778Ssam#define SCTP_CWR_REDUCE_OVERRIDE 0x01
457146778Ssam#define SCTP_CWR_IN_SAME_WINDOW  0x02
458146778Ssam
459146778Ssam#define SCTP_SAT_NETWORK_MIN	400	/* min ms for RTT to set satellite
460146778Ssam					 * time */
461235530Sdelphij#define SCTP_SAT_NETWORK_BURST_INCR  2	/* how many times to multiply maxburst
462235530Sdelphij					 * in sat */
463235530Sdelphij
464146778Ssam/* Data Chuck Specific Flags */
465146778Ssam#define SCTP_DATA_FRAG_MASK        0x03
466146778Ssam#define SCTP_DATA_MIDDLE_FRAG      0x00
467235530Sdelphij#define SCTP_DATA_LAST_FRAG        0x01
468235530Sdelphij#define SCTP_DATA_FIRST_FRAG       0x02
469235530Sdelphij#define SCTP_DATA_NOT_FRAG         0x03
470235530Sdelphij#define SCTP_DATA_UNORDERED        0x04
471235530Sdelphij#define SCTP_DATA_SACK_IMMEDIATELY 0x08
472235530Sdelphij/* ECN Nonce: SACK Chunk Specific Flags */
473235530Sdelphij#define SCTP_SACK_NONCE_SUM        0x01
474235530Sdelphij
475235530Sdelphij/* CMT DAC algorithm SACK flag */
476235530Sdelphij#define SCTP_SACK_CMT_DAC          0x80
477235530Sdelphij
478235530Sdelphij/*
479235530Sdelphij * PCB flags (in sctp_flags bitmask).
480146778Ssam * Note the features and flags are meant
481146778Ssam * for use by netstat.
482147904Ssam */
483147904Ssam#define SCTP_PCB_FLAGS_UDPTYPE		0x00000001
484147904Ssam#define SCTP_PCB_FLAGS_TCPTYPE		0x00000002
485147904Ssam#define SCTP_PCB_FLAGS_BOUNDALL		0x00000004
486241221Sglebius#define SCTP_PCB_FLAGS_ACCEPTING	0x00000008
487241221Sglebius#define SCTP_PCB_FLAGS_UNBOUND		0x00000010
488241221Sglebius#define SCTP_PCB_FLAGS_CLOSE_IP         0x00040000
489241221Sglebius#define SCTP_PCB_FLAGS_WAS_CONNECTED    0x00080000
490146778Ssam#define SCTP_PCB_FLAGS_WAS_ABORTED      0x00100000
491146778Ssam/* TCP model support */
492146778Ssam
493146778Ssam#define SCTP_PCB_FLAGS_CONNECTED	0x00200000
494146778Ssam#define SCTP_PCB_FLAGS_IN_TCPPOOL	0x00400000
495146778Ssam#define SCTP_PCB_FLAGS_DONT_WAKE	0x00800000
496146778Ssam#define SCTP_PCB_FLAGS_WAKEOUTPUT	0x01000000
497146778Ssam#define SCTP_PCB_FLAGS_WAKEINPUT	0x02000000
498146778Ssam#define SCTP_PCB_FLAGS_BOUND_V6		0x04000000
499146778Ssam#define SCTP_PCB_FLAGS_BLOCKING_IO	0x08000000
500146778Ssam#define SCTP_PCB_FLAGS_SOCKET_GONE	0x10000000
501146778Ssam#define SCTP_PCB_FLAGS_SOCKET_ALLGONE	0x20000000
502146778Ssam#define SCTP_PCB_FLAGS_SOCKET_CANT_READ	0x40000000
503146778Ssam/* flags to copy to new PCB */
504146778Ssam#define SCTP_PCB_COPY_FLAGS		(SCTP_PCB_FLAGS_BOUNDALL|\
505146778Ssam					 SCTP_PCB_FLAGS_WAKEINPUT|\
506146778Ssam					 SCTP_PCB_FLAGS_BOUND_V6)
507146778Ssam
508146778Ssam
509146778Ssam/*
510146778Ssam * PCB Features (in sctp_features bitmask)
511146778Ssam */
512146778Ssam#define SCTP_PCB_FLAGS_DO_NOT_PMTUD      0x00000001
513146778Ssam#define SCTP_PCB_FLAGS_EXT_RCVINFO       0x00000002	/* deprecated */
514146778Ssam#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT   0x00000004
515146778Ssam#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE   0x00000008
516146778Ssam#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS  0x00000010
517146778Ssam#define SCTP_PCB_FLAGS_DO_ASCONF         0x00000020
518146778Ssam#define SCTP_PCB_FLAGS_AUTO_ASCONF       0x00000040
519127675Sbms#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE  0x00000080
52017680Spst/* socket options */
52117680Spst#define SCTP_PCB_FLAGS_NODELAY           0x00000100
52217680Spst#define SCTP_PCB_FLAGS_AUTOCLOSE         0x00000200
523146778Ssam#define SCTP_PCB_FLAGS_RECVDATAIOEVNT    0x00000400	/* deprecated */
524146778Ssam#define SCTP_PCB_FLAGS_RECVASSOCEVNT     0x00000800
525146778Ssam#define SCTP_PCB_FLAGS_RECVPADDREVNT     0x00001000
52617680Spst#define SCTP_PCB_FLAGS_RECVPEERERR       0x00002000
527146778Ssam#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT  0x00004000	/* deprecated */
528146778Ssam#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT  0x00008000
529127675Sbms#define SCTP_PCB_FLAGS_ADAPTATIONEVNT    0x00010000
530146778Ssam#define SCTP_PCB_FLAGS_PDAPIEVNT         0x00020000
531235530Sdelphij#define SCTP_PCB_FLAGS_AUTHEVNT          0x00040000
532146778Ssam#define SCTP_PCB_FLAGS_STREAM_RESETEVNT  0x00080000
533111729Sfenner#define SCTP_PCB_FLAGS_NO_FRAGMENT       0x00100000
53417680Spst#define SCTP_PCB_FLAGS_EXPLICIT_EOR      0x00400000
535146778Ssam#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4   0x00800000
536146778Ssam#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS  0x01000000
537146778Ssam#define SCTP_PCB_FLAGS_PORTREUSE         0x02000000
538146778Ssam#define SCTP_PCB_FLAGS_DRYEVNT           0x04000000
539127675Sbms#define SCTP_PCB_FLAGS_RECVRCVINFO       0x08000000
540127675Sbms#define SCTP_PCB_FLAGS_RECVNXTINFO       0x10000000
541146778Ssam#define SCTP_PCB_FLAGS_ASSOC_RESETEVNT   0x20000000
542127675Sbms#define SCTP_PCB_FLAGS_STREAM_CHANGEEVNT 0x40000000
54317680Spst#define SCTP_PCB_FLAGS_RECVNSENDFAILEVNT 0x80000000
544235530Sdelphij
54517680Spst/*-
54617680Spst * mobility_features parameters (by micchie).Note
54717680Spst * these features are applied against the
54817680Spst * sctp_mobility_features flags.. not the sctp_features
549146778Ssam * flags.
55017680Spst */
55117680Spst#define SCTP_MOBILITY_BASE               0x00000001
552146778Ssam#define SCTP_MOBILITY_FASTHANDOFF        0x00000002
55375118Sfenner#define SCTP_MOBILITY_PRIM_DELETED       0x00000004
554127675Sbms
55575118Sfenner
55675118Sfenner#define SCTP_SMALLEST_PMTU 512	/* smallest pmtu allowed when disabling PMTU
55717680Spst				 * discovery */
558146778Ssam
559146778Ssam#include <netinet/sctp_uio.h>
560127675Sbms
561146778Ssam/* This dictates the size of the packet
562146778Ssam * collection buffer. This only applies
563146778Ssam * if SCTP_PACKET_LOGGING is enabled in
564146778Ssam * your config.
565146778Ssam */
566146778Ssam#define SCTP_PACKET_LOG_SIZE 65536
567146778Ssam
568146778Ssam/* Maximum delays and such a user can set for options that
569146778Ssam * take ms.
570146778Ssam */
571146778Ssam#define SCTP_MAX_SACK_DELAY 500	/* per RFC4960 */
572146778Ssam#define SCTP_MAX_HB_INTERVAL 14400000	/* 4 hours in ms */
573146778Ssam#define SCTP_MAX_COOKIE_LIFE  3600000	/* 1 hour in ms */
574146778Ssam
575146778Ssam
576127675Sbms/* Types of logging/KTR tracing  that can be enabled via the
577127675Sbms * sysctl net.inet.sctp.sctp_logging. You must also enable
578127675Sbms * SUBSYS tracing.
579127675Sbms * Note that you must have the SCTP option in the kernel
580127675Sbms * to enable these as well.
581146778Ssam */
582235530Sdelphij#define SCTP_BLK_LOGGING_ENABLE				0x00000001
583235530Sdelphij#define SCTP_CWND_MONITOR_ENABLE			0x00000002
584127675Sbms#define SCTP_CWND_LOGGING_ENABLE			0x00000004
585146778Ssam#define SCTP_FLIGHT_LOGGING_ENABLE			0x00000020
58617680Spst#define SCTP_FR_LOGGING_ENABLE				0x00000040
587146778Ssam#define SCTP_LOCK_LOGGING_ENABLE			0x00000080
588127675Sbms#define SCTP_MAP_LOGGING_ENABLE				0x00000100
589127675Sbms#define SCTP_MBCNT_LOGGING_ENABLE			0x00000200
590146778Ssam#define SCTP_MBUF_LOGGING_ENABLE			0x00000400
591127675Sbms#define SCTP_NAGLE_LOGGING_ENABLE			0x00000800
592146778Ssam#define SCTP_RECV_RWND_LOGGING_ENABLE			0x00001000
593146778Ssam#define SCTP_RTTVAR_LOGGING_ENABLE			0x00002000
594127675Sbms#define SCTP_SACK_LOGGING_ENABLE			0x00004000
595127675Sbms#define SCTP_SACK_RWND_LOGGING_ENABLE			0x00008000
596127675Sbms#define SCTP_SB_LOGGING_ENABLE				0x00010000
597127675Sbms#define SCTP_STR_LOGGING_ENABLE				0x00020000
598127675Sbms#define SCTP_WAKE_LOGGING_ENABLE			0x00040000
599127675Sbms#define SCTP_LOG_MAXBURST_ENABLE			0x00080000
600127675Sbms#define SCTP_LOG_RWND_ENABLE    			0x00100000
601127675Sbms#define SCTP_LOG_SACK_ARRIVALS_ENABLE			0x00200000
602127675Sbms#define SCTP_LTRACE_CHUNK_ENABLE			0x00400000
603127675Sbms#define SCTP_LTRACE_ERROR_ENABLE			0x00800000
604127675Sbms#define SCTP_LAST_PACKET_TRACING			0x01000000
605146778Ssam#define SCTP_THRESHOLD_LOGGING				0x02000000
606172686Smlaier#define SCTP_LOG_AT_SEND_2_SCTP				0x04000000
607127675Sbms#define SCTP_LOG_AT_SEND_2_OUTQ				0x08000000
608127675Sbms#define SCTP_LOG_TRY_ADVANCE				0x10000000
609127675Sbms
610127675Sbms
611127675Sbms#undef SCTP_PACKED
612127675Sbms
613127675Sbms#endif				/* !_NETINET_SCTP_H_ */
614172686Smlaier