sctp.h revision 219057
1231200Smm/*-
2231200Smm * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
3231200Smm * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
4231200Smm * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
5231200Smm *
6231200Smm * Redistribution and use in source and binary forms, with or without
7231200Smm * modification, are permitted provided that the following conditions are met:
8231200Smm *
9231200Smm * a) Redistributions of source code must retain the above copyright notice,
10231200Smm *   this list of conditions and the following disclaimer.
11231200Smm *
12231200Smm * b) Redistributions in binary form must reproduce the above copyright
13231200Smm *    notice, this list of conditions and the following disclaimer in
14231200Smm *   the documentation and/or other materials provided with the distribution.
15231200Smm *
16231200Smm * c) Neither the name of Cisco Systems, Inc. nor the names of its
17231200Smm *    contributors may be used to endorse or promote products derived
18231200Smm *    from this software without specific prior written permission.
19231200Smm *
20231200Smm * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21231200Smm * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22231200Smm * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23231200Smm * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24231200Smm * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25231200Smm * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26231200Smm * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27231200Smm * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28231200Smm * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29231200Smm * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30231200Smm * THE POSSIBILITY OF SUCH DAMAGE.
31231200Smm */
32231200Smm/* $KAME: sctp.h,v 1.18 2005/03/06 16:04:16 itojun Exp $	 */
33231200Smm
34231200Smm#include <sys/cdefs.h>
35231200Smm__FBSDID("$FreeBSD: head/sys/netinet/sctp.h 219057 2011-02-26 15:23:46Z rrs $");
36231200Smm
37231200Smm#ifndef _NETINET_SCTP_H_
38231200Smm#define _NETINET_SCTP_H_
39231200Smm
40231200Smm#include <sys/types.h>
41231200Smm
42231200Smm
43231200Smm#define SCTP_PACKED __attribute__((packed))
44231200Smm
45231200Smm/*
46231200Smm * SCTP protocol - RFC2960.
47231200Smm */
48231200Smmstruct sctphdr {
49231200Smm	uint16_t src_port;	/* source port */
50231200Smm	uint16_t dest_port;	/* destination port */
51231200Smm	uint32_t v_tag;		/* verification tag of packet */
52231200Smm	uint32_t checksum;	/* Adler32 C-Sum */
53231200Smm	/* chunks follow... */
54231200Smm}       SCTP_PACKED;
55231200Smm
56231200Smm/*
57231200Smm * SCTP Chunks
58231200Smm */
59231200Smmstruct sctp_chunkhdr {
60231200Smm	uint8_t chunk_type;	/* chunk type */
61231200Smm	uint8_t chunk_flags;	/* chunk flags */
62231200Smm	uint16_t chunk_length;	/* chunk length */
63231200Smm	/* optional params follow */
64231200Smm}             SCTP_PACKED;
65231200Smm
66231200Smm/*
67231200Smm * SCTP chunk parameters
68231200Smm */
69231200Smmstruct sctp_paramhdr {
70231200Smm	uint16_t param_type;	/* parameter type */
71231200Smm	uint16_t param_length;	/* parameter length */
72231200Smm}             SCTP_PACKED;
73231200Smm
74231200Smm/*
75231200Smm * user socket options: socket API defined
76231200Smm */
77231200Smm/*
78231200Smm * read-write options
79231200Smm */
80231200Smm#define SCTP_RTOINFO			0x00000001
81231200Smm#define SCTP_ASSOCINFO			0x00000002
82231200Smm#define SCTP_INITMSG			0x00000003
83231200Smm#define SCTP_NODELAY			0x00000004
84231200Smm#define SCTP_AUTOCLOSE			0x00000005
85231200Smm#define SCTP_SET_PEER_PRIMARY_ADDR	0x00000006
86231200Smm#define SCTP_PRIMARY_ADDR		0x00000007
87231200Smm#define SCTP_ADAPTATION_LAYER		0x00000008
88231200Smm/* same as above */
89231200Smm#define SCTP_ADAPTION_LAYER		0x00000008
90231200Smm#define SCTP_DISABLE_FRAGMENTS		0x00000009
91231200Smm#define SCTP_PEER_ADDR_PARAMS 		0x0000000a
92231200Smm#define SCTP_DEFAULT_SEND_PARAM		0x0000000b
93231200Smm/* ancillary data/notification interest options */
94231200Smm#define SCTP_EVENTS			0x0000000c
95231200Smm/* Without this applied we will give V4 and V6 addresses on a V6 socket */
96231200Smm#define SCTP_I_WANT_MAPPED_V4_ADDR	0x0000000d
97231200Smm#define SCTP_MAXSEG 			0x0000000e
98231200Smm#define SCTP_DELAYED_SACK               0x0000000f
99231200Smm#define SCTP_FRAGMENT_INTERLEAVE        0x00000010
100231200Smm#define SCTP_PARTIAL_DELIVERY_POINT     0x00000011
101231200Smm/* authentication support */
102231200Smm#define SCTP_AUTH_CHUNK 		0x00000012
103231200Smm#define SCTP_AUTH_KEY 			0x00000013
104231200Smm#define SCTP_HMAC_IDENT 		0x00000014
105231200Smm#define SCTP_AUTH_ACTIVE_KEY 		0x00000015
106231200Smm#define SCTP_AUTH_DELETE_KEY 		0x00000016
107231200Smm#define SCTP_USE_EXT_RCVINFO		0x00000017
108231200Smm#define SCTP_AUTO_ASCONF		0x00000018	/* rw */
109231200Smm#define SCTP_MAXBURST			0x00000019	/* rw */
110231200Smm#define SCTP_MAX_BURST			0x00000019	/* rw */
111231200Smm/* assoc level context */
112231200Smm#define SCTP_CONTEXT                    0x0000001a	/* rw */
113231200Smm/* explicit EOR signalling */
114231200Smm#define SCTP_EXPLICIT_EOR               0x0000001b
115231200Smm#define SCTP_REUSE_PORT                 0x0000001c	/* rw */
116231200Smm#define SCTP_AUTH_DEACTIVATE_KEY	0x0000001d
117231200Smm
118231200Smm/*
119231200Smm * read-only options
120231200Smm */
121231200Smm#define SCTP_STATUS			0x00000100
122231200Smm#define SCTP_GET_PEER_ADDR_INFO		0x00000101
123231200Smm/* authentication support */
124231200Smm#define SCTP_PEER_AUTH_CHUNKS 		0x00000102
125231200Smm#define SCTP_LOCAL_AUTH_CHUNKS 		0x00000103
126231200Smm#define SCTP_GET_ASSOC_NUMBER           0x00000104	/* ro */
127231200Smm#define SCTP_GET_ASSOC_ID_LIST          0x00000105	/* ro */
128231200Smm#define SCTP_TIMEOUTS                   0x00000106
129231200Smm
130231200Smm/*
131231200Smm * user socket options: BSD implementation specific
132231200Smm */
133231200Smm/*
134231200Smm * Blocking I/O is enabled on any TCP type socket by default. For the UDP
135231200Smm * model if this is turned on then the socket buffer is shared for send
136231200Smm * resources amongst all associations.  The default for the UDP model is that
137231200Smm * is SS_NBIO is set.  Which means all associations have a separate send
138231200Smm * limit BUT they will NOT ever BLOCK instead you will get an error back
139231200Smm * EAGAIN if you try to send too much. If you want the blocking semantics you
140231200Smm * set this option at the cost of sharing one socket send buffer size amongst
141231200Smm * all associations. Peeled off sockets turn this option off and block. But
142231200Smm * since both TCP and peeled off sockets have only one assoc per socket this
143231200Smm * is fine. It probably does NOT make sense to set this on SS_NBIO on a TCP
144231200Smm * model OR peeled off UDP model, but we do allow you to do so. You just use
145231200Smm * the normal syscall to toggle SS_NBIO the way you want.
146231200Smm *
147231200Smm * Blocking I/O is controlled by the SS_NBIO flag on the socket state so_state
148231200Smm * field.
149231200Smm */
150231200Smm
151231200Smm/* these should probably go into sockets API */
152231200Smm#define SCTP_RESET_STREAMS		0x00001004	/* wo */
153231200Smm
154231200Smm
155231200Smm/* here on down are more implementation specific */
156231200Smm#define SCTP_SET_DEBUG_LEVEL		0x00001005
157231200Smm#define SCTP_CLR_STAT_LOG               0x00001007
158231200Smm/* CMT ON/OFF socket option */
159231200Smm#define SCTP_CMT_ON_OFF                 0x00001200
160231200Smm#define SCTP_CMT_USE_DAC                0x00001201
161231200Smm/* JRS - Pluggable Congestion Control Socket option */
162231200Smm#define SCTP_PLUGGABLE_CC               0x00001202
163231200Smm/* RS - Pluggable Stream Scheduling Socket option */
164231200Smm#define SCTP_PLUGGABLE_SS		0x00001203
165231200Smm#define SCTP_SS_VALUE			0x00001204
166231200Smm#define SCTP_CC_OPTION			0x00001205	/* Options for CC
167231200Smm							 * modules */
168231200Smm/* read only */
169231200Smm#define SCTP_GET_SNDBUF_USE		0x00001101
170231200Smm#define SCTP_GET_STAT_LOG		0x00001103
171231200Smm#define SCTP_PCB_STATUS			0x00001104
172231200Smm#define SCTP_GET_NONCE_VALUES           0x00001105
173231200Smm
174231200Smm
175231200Smm/* Special hook for dynamically setting primary for all assoc's,
176231200Smm * this is a write only option that requires root privilege.
177231200Smm */
178231200Smm#define SCTP_SET_DYNAMIC_PRIMARY        0x00002001
179231200Smm
180231200Smm/* VRF (virtual router feature) and multi-VRF support
181231200Smm * options. VRF's provide splits within a router
182231200Smm * that give the views of multiple routers. A
183231200Smm * standard host, without VRF support, is just
184231200Smm * a single VRF. If VRF's are supported then
185231200Smm * the transport must be VRF aware. This means
186231200Smm * that every socket call coming in must be directed
187231200Smm * within the endpoint to one of the VRF's it belongs
188231200Smm * to. The endpoint, before binding, may select
189231200Smm * the "default" VRF it is in by using a set socket
190231200Smm * option with SCTP_VRF_ID. This will also
191231200Smm * get propagated to the default VRF. Once the
192231200Smm * endpoint binds an address then it CANNOT add
193231200Smm * additional VRF's to become a Multi-VRF endpoint.
194231200Smm *
195231200Smm * Before BINDING additional VRF's can be added with
196231200Smm * the SCTP_ADD_VRF_ID call or deleted with
197231200Smm * SCTP_DEL_VRF_ID.
198231200Smm *
199231200Smm * Associations are ALWAYS contained inside a single
200231200Smm * VRF. They cannot reside in two (or more) VRF's. Incoming
201231200Smm * packets, assuming the router is VRF aware, can always
202231200Smm * tell us what VRF they arrived on. A host not supporting
203231200Smm * any VRF's will find that the packets always arrived on the
204231200Smm * single VRF that the host has.
205231200Smm *
206231200Smm */
207231200Smm
208231200Smm#define SCTP_VRF_ID			0x00003001
209231200Smm#define SCTP_ADD_VRF_ID			0x00003002
210231200Smm#define SCTP_GET_VRF_IDS		0x00003003
211231200Smm#define SCTP_GET_ASOC_VRF               0x00003004
212231200Smm#define SCTP_DEL_VRF_ID                 0x00003005
213231200Smm
214231200Smm/*
215231200Smm * If you enable packet logging you can get
216231200Smm * a poor mans ethereal output in binary
217231200Smm * form. Note this is a compile option to
218231200Smm * the kernel,  SCTP_PACKET_LOGGING, and
219231200Smm * without it in your kernel you
220231200Smm * will get a EOPNOTSUPP
221231200Smm */
222231200Smm#define SCTP_GET_PACKET_LOG             0x00004001
223231200Smm
224231200Smm/*
225231200Smm * hidden implementation specific options these are NOT user visible (should
226231200Smm * move out of sctp.h)
227231200Smm */
228231200Smm/* sctp_bindx() flags as hidden socket options */
229231200Smm#define SCTP_BINDX_ADD_ADDR		0x00008001
230231200Smm#define SCTP_BINDX_REM_ADDR		0x00008002
231231200Smm/* Hidden socket option that gets the addresses */
232231200Smm#define SCTP_GET_PEER_ADDRESSES		0x00008003
233231200Smm#define SCTP_GET_LOCAL_ADDRESSES	0x00008004
234231200Smm/* return the total count in bytes needed to hold all local addresses bound */
235231200Smm#define SCTP_GET_LOCAL_ADDR_SIZE	0x00008005
236231200Smm/* Return the total count in bytes needed to hold the remote address */
237231200Smm#define SCTP_GET_REMOTE_ADDR_SIZE	0x00008006
238231200Smm/* hidden option for connectx */
239231200Smm#define SCTP_CONNECT_X			0x00008007
240231200Smm/* hidden option for connectx_delayed, part of sendx */
241231200Smm#define SCTP_CONNECT_X_DELAYED		0x00008008
242231200Smm#define SCTP_CONNECT_X_COMPLETE         0x00008009
243231200Smm/* hidden socket option based sctp_peeloff */
244231200Smm#define SCTP_PEELOFF                    0x0000800a
245231200Smm/* the real worker for sctp_getaddrlen() */
246231200Smm#define SCTP_GET_ADDR_LEN               0x0000800b
247231200Smm/* temporary workaround for Apple listen() issue, no args used */
248231200Smm#define SCTP_LISTEN_FIX			0x0000800c
249231200Smm/* Debug things that need to be purged */
250231200Smm#define SCTP_SET_INITIAL_DBG_SEQ	0x00009f00
251231200Smm
252231200Smm/* JRS - Supported congestion control modules for pluggable
253231200Smm * congestion control
254231200Smm */
255231200Smm/* Standard TCP Congestion Control */
256231200Smm#define SCTP_CC_RFC2581		0x00000000
257231200Smm/* High Speed TCP Congestion Control (Floyd) */
258231200Smm#define SCTP_CC_HSTCP		0x00000001
259231200Smm/* HTCP Congestion Control */
260231200Smm#define SCTP_CC_HTCP		0x00000002
261231200Smm
262231200Smm/* RS - Supported stream scheduling modules for pluggable
263231200Smm * stream scheduling
264231200Smm */
265231200Smm/* Default simple round-robin */
266231200Smm#define SCTP_SS_DEFAULT			0x00000000
267231200Smm/* Real round-robin */
268231200Smm#define SCTP_SS_ROUND_ROBIN		0x00000001
269231200Smm/* Real round-robin per packet */
270231200Smm#define SCTP_SS_ROUND_ROBIN_PACKET	0x00000002
271231200Smm/* Priority */
272231200Smm#define SCTP_SS_PRIORITY		0x00000003
273231200Smm/* Fair Bandwidth */
274231200Smm#define SCTP_SS_FAIR_BANDWITH		0x00000004
275231200Smm/* First-come, first-serve */
276231200Smm#define SCTP_SS_FIRST_COME		0x00000005
277231200Smm
278231200Smm
279231200Smm/* fragment interleave constants
280231200Smm * setting must be one of these or
281231200Smm * EINVAL returned.
282231200Smm */
283231200Smm#define SCTP_FRAG_LEVEL_0    0x00000000
284231200Smm#define SCTP_FRAG_LEVEL_1    0x00000001
285231200Smm#define SCTP_FRAG_LEVEL_2    0x00000002
286231200Smm
287231200Smm/*
288231200Smm * user state values
289231200Smm */
290231200Smm#define SCTP_CLOSED			0x0000
291231200Smm#define SCTP_BOUND			0x1000
292231200Smm#define SCTP_LISTEN			0x2000
293231200Smm#define SCTP_COOKIE_WAIT		0x0002
294231200Smm#define SCTP_COOKIE_ECHOED		0x0004
295231200Smm#define SCTP_ESTABLISHED		0x0008
296231200Smm#define SCTP_SHUTDOWN_SENT		0x0010
297231200Smm#define SCTP_SHUTDOWN_RECEIVED		0x0020
298231200Smm#define SCTP_SHUTDOWN_ACK_SENT		0x0040
299231200Smm#define SCTP_SHUTDOWN_PENDING		0x0080
300231200Smm
301231200Smm/*
302231200Smm * SCTP operational error codes (user visible)
303231200Smm */
304231200Smm#define SCTP_CAUSE_NO_ERROR		0x0000
305231200Smm#define SCTP_CAUSE_INVALID_STREAM	0x0001
306231200Smm#define SCTP_CAUSE_MISSING_PARAM	0x0002
307231200Smm#define SCTP_CAUSE_STALE_COOKIE		0x0003
308231200Smm#define SCTP_CAUSE_OUT_OF_RESC		0x0004
309231200Smm#define SCTP_CAUSE_UNRESOLVABLE_ADDR	0x0005
310231200Smm#define SCTP_CAUSE_UNRECOG_CHUNK	0x0006
311231200Smm#define SCTP_CAUSE_INVALID_PARAM	0x0007
312231200Smm#define SCTP_CAUSE_UNRECOG_PARAM	0x0008
313231200Smm#define SCTP_CAUSE_NO_USER_DATA		0x0009
314231200Smm#define SCTP_CAUSE_COOKIE_IN_SHUTDOWN	0x000a
315231200Smm#define SCTP_CAUSE_RESTART_W_NEWADDR	0x000b
316231200Smm#define SCTP_CAUSE_USER_INITIATED_ABT	0x000c
317231200Smm#define SCTP_CAUSE_PROTOCOL_VIOLATION	0x000d
318231200Smm
319231200Smm/* Error causes from RFC5061 */
320231200Smm#define SCTP_CAUSE_DELETING_LAST_ADDR	0x00a0
321231200Smm#define SCTP_CAUSE_RESOURCE_SHORTAGE	0x00a1
322231200Smm#define SCTP_CAUSE_DELETING_SRC_ADDR	0x00a2
323231200Smm#define SCTP_CAUSE_ILLEGAL_ASCONF_ACK	0x00a3
324231200Smm#define SCTP_CAUSE_REQUEST_REFUSED	0x00a4
325231200Smm
326231200Smm/* Error causes from nat-draft */
327231200Smm#define SCTP_CAUSE_NAT_COLLIDING_STATE  0x00b0
328231200Smm#define SCTP_CAUSE_NAT_MISSING_STATE    0x00b1
329231200Smm
330231200Smm/* Error causes from RFC4895 */
331231200Smm#define SCTP_CAUSE_UNSUPPORTED_HMACID	0x0105
332231200Smm
333231200Smm/*
334231200Smm * error cause parameters (user visible)
335231200Smm */
336231200Smmstruct sctp_error_cause {
337231200Smm	uint16_t code;
338231200Smm	uint16_t length;
339231200Smm	/* optional cause-specific info may follow */
340231200Smm}                SCTP_PACKED;
341231200Smm
342231200Smmstruct sctp_error_invalid_stream {
343231200Smm	struct sctp_error_cause cause;	/* code=SCTP_ERROR_INVALID_STREAM */
344231200Smm	uint16_t stream_id;	/* stream id of the DATA in error */
345231200Smm	uint16_t reserved;
346231200Smm}                         SCTP_PACKED;
347231200Smm
348231200Smmstruct sctp_error_missing_param {
349231200Smm	struct sctp_error_cause cause;	/* code=SCTP_ERROR_MISSING_PARAM */
350231200Smm	uint32_t num_missing_params;	/* number of missing parameters */
351231200Smm	/* uint16_t param_type's follow */
352231200Smm}                        SCTP_PACKED;
353231200Smm
354231200Smmstruct sctp_error_stale_cookie {
355231200Smm	struct sctp_error_cause cause;	/* code=SCTP_ERROR_STALE_COOKIE */
356231200Smm	uint32_t stale_time;	/* time in usec of staleness */
357231200Smm}                       SCTP_PACKED;
358231200Smm
359231200Smmstruct sctp_error_out_of_resource {
360231200Smm	struct sctp_error_cause cause;	/* code=SCTP_ERROR_OUT_OF_RESOURCES */
361231200Smm}                          SCTP_PACKED;
362231200Smm
363231200Smmstruct sctp_error_unresolv_addr {
364231200Smm	struct sctp_error_cause cause;	/* code=SCTP_ERROR_UNRESOLVABLE_ADDR */
365231200Smm
366231200Smm}                        SCTP_PACKED;
367231200Smm
368231200Smmstruct sctp_error_unrecognized_chunk {
369231200Smm	struct sctp_error_cause cause;	/* code=SCTP_ERROR_UNRECOG_CHUNK */
370231200Smm	struct sctp_chunkhdr ch;/* header from chunk in error */
371231200Smm}                             SCTP_PACKED;
372231200Smm
373231200Smm/*
374231200Smm * Main SCTP chunk types we place these here so natd and f/w's in user land
375231200Smm * can find them.
376231200Smm */
377231200Smm/************0x00 series ***********/
378231200Smm#define SCTP_DATA		0x00
379231200Smm#define SCTP_INITIATION		0x01
380231200Smm#define SCTP_INITIATION_ACK	0x02
381231200Smm#define SCTP_SELECTIVE_ACK	0x03
382231200Smm#define SCTP_HEARTBEAT_REQUEST	0x04
383231200Smm#define SCTP_HEARTBEAT_ACK	0x05
384231200Smm#define SCTP_ABORT_ASSOCIATION	0x06
385231200Smm#define SCTP_SHUTDOWN		0x07
386231200Smm#define SCTP_SHUTDOWN_ACK	0x08
387231200Smm#define SCTP_OPERATION_ERROR	0x09
388231200Smm#define SCTP_COOKIE_ECHO	0x0a
389231200Smm#define SCTP_COOKIE_ACK		0x0b
390231200Smm#define SCTP_ECN_ECHO		0x0c
391231200Smm#define SCTP_ECN_CWR		0x0d
392231200Smm#define SCTP_SHUTDOWN_COMPLETE	0x0e
393231200Smm/* RFC4895 */
394231200Smm#define SCTP_AUTHENTICATION     0x0f
395231200Smm/* EY nr_sack chunk id*/
396231200Smm#define SCTP_NR_SELECTIVE_ACK 0x10
397231200Smm/************0x40 series ***********/
398231200Smm/************0x80 series ***********/
399231200Smm/* RFC5061 */
400231200Smm#define	SCTP_ASCONF_ACK		0x80
401231200Smm/* draft-ietf-stewart-pktdrpsctp */
402231200Smm#define SCTP_PACKET_DROPPED	0x81
403231200Smm/* draft-ietf-stewart-strreset-xxx */
404231200Smm#define SCTP_STREAM_RESET       0x82
405231200Smm
406231200Smm/* RFC4820                         */
407231200Smm#define SCTP_PAD_CHUNK          0x84
408231200Smm/************0xc0 series ***********/
409231200Smm/* RFC3758 */
410231200Smm#define SCTP_FORWARD_CUM_TSN	0xc0
411231200Smm/* RFC5061 */
412231200Smm#define SCTP_ASCONF		0xc1
413231200Smm
414231200Smm
415231200Smm/* ABORT and SHUTDOWN COMPLETE FLAG */
416231200Smm#define SCTP_HAD_NO_TCB		0x01
417231200Smm
418231200Smm/* Packet dropped flags */
419231200Smm#define SCTP_FROM_MIDDLE_BOX	SCTP_HAD_NO_TCB
420231200Smm#define SCTP_BADCRC		0x02
421231200Smm#define SCTP_PACKET_TRUNCATED	0x04
422231200Smm
423231200Smm/* Flag for ECN -CWR */
424231200Smm#define SCTP_CWR_REDUCE_OVERRIDE 0x01
425231200Smm#define SCTP_CWR_IN_SAME_WINDOW  0x02
426231200Smm
427231200Smm#define SCTP_SAT_NETWORK_MIN	400	/* min ms for RTT to set satellite
428231200Smm					 * time */
429231200Smm#define SCTP_SAT_NETWORK_BURST_INCR  2	/* how many times to multiply maxburst
430231200Smm					 * in sat */
431231200Smm
432231200Smm/* Data Chuck Specific Flags */
433231200Smm#define SCTP_DATA_FRAG_MASK        0x03
434231200Smm#define SCTP_DATA_MIDDLE_FRAG      0x00
435231200Smm#define SCTP_DATA_LAST_FRAG        0x01
436231200Smm#define SCTP_DATA_FIRST_FRAG       0x02
437231200Smm#define SCTP_DATA_NOT_FRAG         0x03
438231200Smm#define SCTP_DATA_UNORDERED        0x04
439231200Smm#define SCTP_DATA_SACK_IMMEDIATELY 0x08
440231200Smm/* ECN Nonce: SACK Chunk Specific Flags */
441231200Smm#define SCTP_SACK_NONCE_SUM        0x01
442231200Smm
443231200Smm/* CMT DAC algorithm SACK flag */
444231200Smm#define SCTP_SACK_CMT_DAC          0x80
445231200Smm
446231200Smm/*
447231200Smm * PCB flags (in sctp_flags bitmask).
448231200Smm * Note the features and flags are meant
449231200Smm * for use by netstat.
450231200Smm */
451231200Smm#define SCTP_PCB_FLAGS_UDPTYPE		0x00000001
452231200Smm#define SCTP_PCB_FLAGS_TCPTYPE		0x00000002
453231200Smm#define SCTP_PCB_FLAGS_BOUNDALL		0x00000004
454231200Smm#define SCTP_PCB_FLAGS_ACCEPTING	0x00000008
455231200Smm#define SCTP_PCB_FLAGS_UNBOUND		0x00000010
456231200Smm#define SCTP_PCB_FLAGS_CLOSE_IP         0x00040000
457231200Smm#define SCTP_PCB_FLAGS_WAS_CONNECTED    0x00080000
458231200Smm#define SCTP_PCB_FLAGS_WAS_ABORTED      0x00100000
459231200Smm/* TCP model support */
460231200Smm
461231200Smm#define SCTP_PCB_FLAGS_CONNECTED	0x00200000
462231200Smm#define SCTP_PCB_FLAGS_IN_TCPPOOL	0x00400000
463231200Smm#define SCTP_PCB_FLAGS_DONT_WAKE	0x00800000
464231200Smm#define SCTP_PCB_FLAGS_WAKEOUTPUT	0x01000000
465231200Smm#define SCTP_PCB_FLAGS_WAKEINPUT	0x02000000
466231200Smm#define SCTP_PCB_FLAGS_BOUND_V6		0x04000000
467231200Smm#define SCTP_PCB_FLAGS_BLOCKING_IO	0x08000000
468231200Smm#define SCTP_PCB_FLAGS_SOCKET_GONE	0x10000000
469231200Smm#define SCTP_PCB_FLAGS_SOCKET_ALLGONE	0x20000000
470231200Smm#define SCTP_PCB_FLAGS_SOCKET_CANT_READ	0x40000000
471231200Smm/* flags to copy to new PCB */
472231200Smm#define SCTP_PCB_COPY_FLAGS		(SCTP_PCB_FLAGS_BOUNDALL|\
473231200Smm					 SCTP_PCB_FLAGS_WAKEINPUT|\
474231200Smm					 SCTP_PCB_FLAGS_BOUND_V6)
475231200Smm
476231200Smm
477231200Smm/*
478231200Smm * PCB Features (in sctp_features bitmask)
479231200Smm */
480231200Smm#define SCTP_PCB_FLAGS_EXT_RCVINFO      0x00000002
481231200Smm#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT  0x00000004
482231200Smm#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE  0x00000008
483231200Smm#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS	0x00000010
484231200Smm#define SCTP_PCB_FLAGS_DO_ASCONF	0x00000020
485231200Smm#define SCTP_PCB_FLAGS_AUTO_ASCONF	0x00000040
486231200Smm#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080
487231200Smm/* socket options */
488231200Smm#define SCTP_PCB_FLAGS_NODELAY		0x00000100
489231200Smm#define SCTP_PCB_FLAGS_AUTOCLOSE	0x00000200
490231200Smm#define SCTP_PCB_FLAGS_RECVDATAIOEVNT	0x00000400
491231200Smm#define SCTP_PCB_FLAGS_RECVASSOCEVNT	0x00000800
492231200Smm#define SCTP_PCB_FLAGS_RECVPADDREVNT	0x00001000
493231200Smm#define SCTP_PCB_FLAGS_RECVPEERERR	0x00002000
494231200Smm#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT	0x00004000
495231200Smm#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT	0x00008000
496231200Smm#define SCTP_PCB_FLAGS_ADAPTATIONEVNT	0x00010000
497231200Smm#define SCTP_PCB_FLAGS_PDAPIEVNT	0x00020000
498231200Smm#define SCTP_PCB_FLAGS_AUTHEVNT		0x00040000
499231200Smm#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000
500231200Smm#define SCTP_PCB_FLAGS_NO_FRAGMENT	0x00100000
501231200Smm#define SCTP_PCB_FLAGS_EXPLICIT_EOR     0x00400000
502231200Smm#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4	0x00800000
503231200Smm#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS	0x01000000
504231200Smm#define SCTP_PCB_FLAGS_PORTREUSE        0x02000000
505231200Smm#define SCTP_PCB_FLAGS_DRYEVNT          0x04000000
506231200Smm/*-
507231200Smm * mobility_features parameters (by micchie).Note
508231200Smm * these features are applied against the
509231200Smm * sctp_mobility_features flags.. not the sctp_features
510231200Smm * flags.
511231200Smm */
512231200Smm#define SCTP_MOBILITY_BASE		0x00000001
513231200Smm#define SCTP_MOBILITY_FASTHANDOFF	0x00000002
514231200Smm#define SCTP_MOBILITY_PRIM_DELETED	0x00000004
515231200Smm
516231200Smm
517231200Smm#define SCTP_SMALLEST_PMTU 512	/* smallest pmtu allowed when disabling PMTU
518231200Smm				 * discovery */
519231200Smm
520231200Smm#include <netinet/sctp_uio.h>
521231200Smm
522231200Smm/* This dictates the size of the packet
523231200Smm * collection buffer. This only applies
524231200Smm * if SCTP_PACKET_LOGGING is enabled in
525231200Smm * your config.
526231200Smm */
527231200Smm#define SCTP_PACKET_LOG_SIZE 65536
528231200Smm
529231200Smm/* Maximum delays and such a user can set for options that
530231200Smm * take ms.
531231200Smm */
532231200Smm#define SCTP_MAX_SACK_DELAY 500	/* per RFC4960 */
533231200Smm#define SCTP_MAX_HB_INTERVAL 14400000	/* 4 hours in ms */
534231200Smm#define SCTP_MAX_COOKIE_LIFE  3600000	/* 1 hour in ms */
535231200Smm
536231200Smm
537231200Smm/* Types of logging/KTR tracing  that can be enabled via the
538231200Smm * sysctl net.inet.sctp.sctp_logging. You must also enable
539231200Smm * SUBSYS tracing.
540231200Smm * Note that you must have the SCTP option in the kernel
541231200Smm * to enable these as well.
542231200Smm */
543231200Smm#define SCTP_BLK_LOGGING_ENABLE				0x00000001
544231200Smm#define SCTP_CWND_MONITOR_ENABLE			0x00000002
545231200Smm#define SCTP_CWND_LOGGING_ENABLE			0x00000004
546231200Smm#define SCTP_EARLYFR_LOGGING_ENABLE			0x00000010
547231200Smm#define SCTP_FLIGHT_LOGGING_ENABLE			0x00000020
548231200Smm#define SCTP_FR_LOGGING_ENABLE				0x00000040
549231200Smm#define SCTP_LOCK_LOGGING_ENABLE			0x00000080
550231200Smm#define SCTP_MAP_LOGGING_ENABLE				0x00000100
551231200Smm#define SCTP_MBCNT_LOGGING_ENABLE			0x00000200
552231200Smm#define SCTP_MBUF_LOGGING_ENABLE			0x00000400
553231200Smm#define SCTP_NAGLE_LOGGING_ENABLE			0x00000800
554231200Smm#define SCTP_RECV_RWND_LOGGING_ENABLE		0x00001000
555231200Smm#define SCTP_RTTVAR_LOGGING_ENABLE			0x00002000
556231200Smm#define SCTP_SACK_LOGGING_ENABLE			0x00004000
557231200Smm#define SCTP_SACK_RWND_LOGGING_ENABLE		0x00008000
558231200Smm#define SCTP_SB_LOGGING_ENABLE				0x00010000
559231200Smm#define SCTP_STR_LOGGING_ENABLE				0x00020000
560231200Smm#define SCTP_WAKE_LOGGING_ENABLE			0x00040000
561231200Smm#define SCTP_LOG_MAXBURST_ENABLE			0x00080000
562231200Smm#define SCTP_LOG_RWND_ENABLE    			0x00100000
563231200Smm#define SCTP_LOG_SACK_ARRIVALS_ENABLE       0x00200000
564231200Smm#define SCTP_LTRACE_CHUNK_ENABLE            0x00400000
565231200Smm#define SCTP_LTRACE_ERROR_ENABLE            0x00800000
566231200Smm#define SCTP_LAST_PACKET_TRACING            0x01000000
567231200Smm#define SCTP_THRESHOLD_LOGGING              0x02000000
568231200Smm#define SCTP_LOG_AT_SEND_2_SCTP             0x04000000
569231200Smm#define SCTP_LOG_AT_SEND_2_OUTQ             0x08000000
570231200Smm#define SCTP_LOG_TRY_ADVANCE                0x10000000
571231200Smm
572231200Smm
573231200Smm#undef SCTP_PACKED
574231200Smm
575231200Smm#endif				/* !_NETINET_SCTP_H_ */
576231200Smm