sctp.h revision 215410
1100894Srwatson/*-
2100894Srwatson * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
3100894Srwatson *
4100894Srwatson * Redistribution and use in source and binary forms, with or without
5100894Srwatson * modification, are permitted provided that the following conditions are met:
6100894Srwatson *
7100894Srwatson * a) Redistributions of source code must retain the above copyright notice,
8100894Srwatson *   this list of conditions and the following disclaimer.
9100894Srwatson *
10100894Srwatson * b) Redistributions in binary form must reproduce the above copyright
11100894Srwatson *    notice, this list of conditions and the following disclaimer in
12100894Srwatson *   the documentation and/or other materials provided with the distribution.
13100894Srwatson *
14100894Srwatson * c) Neither the name of Cisco Systems, Inc. nor the names of its
15100894Srwatson *    contributors may be used to endorse or promote products derived
16100894Srwatson *    from this software without specific prior written permission.
17100894Srwatson *
18100894Srwatson * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19100894Srwatson * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20100894Srwatson * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21100894Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22100894Srwatson * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23100894Srwatson * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24100894Srwatson * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25100894Srwatson * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26100894Srwatson * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27100894Srwatson * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28100894Srwatson * THE POSSIBILITY OF SUCH DAMAGE.
29100894Srwatson */
30100894Srwatson/* $KAME: sctp.h,v 1.18 2005/03/06 16:04:16 itojun Exp $	 */
31100894Srwatson
32100894Srwatson#include <sys/cdefs.h>
33100894Srwatson__FBSDID("$FreeBSD: head/sys/netinet/sctp.h 215410 2010-11-16 22:16:38Z tuexen $");
34100894Srwatson
35100894Srwatson#ifndef _NETINET_SCTP_H_
36100894Srwatson#define _NETINET_SCTP_H_
37100894Srwatson
38100894Srwatson#include <sys/types.h>
39100894Srwatson
40100894Srwatson
41100894Srwatson#define SCTP_PACKED __attribute__((packed))
42100894Srwatson
43100894Srwatson/*
44100894Srwatson * SCTP protocol - RFC2960.
45100894Srwatson */
46100894Srwatsonstruct sctphdr {
47100894Srwatson	uint16_t src_port;	/* source port */
48100894Srwatson	uint16_t dest_port;	/* destination port */
49104300Sphk	uint32_t v_tag;		/* verification tag of packet */
50101173Srwatson	uint32_t checksum;	/* Adler32 C-Sum */
51100894Srwatson	/* chunks follow... */
52100979Srwatson}       SCTP_PACKED;
53100979Srwatson
54100979Srwatson/*
55102949Sbde * SCTP Chunks
56100979Srwatson */
57100979Srwatsonstruct sctp_chunkhdr {
58101712Srwatson	uint8_t chunk_type;	/* chunk type */
59100979Srwatson	uint8_t chunk_flags;	/* chunk flags */
60100979Srwatson	uint16_t chunk_length;	/* chunk length */
61100894Srwatson	/* optional params follow */
62100894Srwatson}             SCTP_PACKED;
63100979Srwatson
64100979Srwatson/*
65100979Srwatson * SCTP chunk parameters
66100979Srwatson */
67100979Srwatsonstruct sctp_paramhdr {
68100979Srwatson	uint16_t param_type;	/* parameter type */
69100979Srwatson	uint16_t param_length;	/* parameter length */
70100979Srwatson}             SCTP_PACKED;
71100894Srwatson
72100979Srwatson/*
73100979Srwatson * user socket options: socket API defined
74100979Srwatson */
75100979Srwatson/*
76100979Srwatson * read-write options
77100979Srwatson */
78100979Srwatson#define SCTP_RTOINFO			0x00000001
79100979Srwatson#define SCTP_ASSOCINFO			0x00000002
80100979Srwatson#define SCTP_INITMSG			0x00000003
81100979Srwatson#define SCTP_NODELAY			0x00000004
82100979Srwatson#define SCTP_AUTOCLOSE			0x00000005
83100979Srwatson#define SCTP_SET_PEER_PRIMARY_ADDR	0x00000006
84100979Srwatson#define SCTP_PRIMARY_ADDR		0x00000007
85100979Srwatson#define SCTP_ADAPTATION_LAYER		0x00000008
86100979Srwatson/* same as above */
87100979Srwatson#define SCTP_ADAPTION_LAYER		0x00000008
88100979Srwatson#define SCTP_DISABLE_FRAGMENTS		0x00000009
89100979Srwatson#define SCTP_PEER_ADDR_PARAMS 		0x0000000a
90101712Srwatson#define SCTP_DEFAULT_SEND_PARAM		0x0000000b
91101712Srwatson/* ancillary data/notification interest options */
92101712Srwatson#define SCTP_EVENTS			0x0000000c
93101712Srwatson/* Without this applied we will give V4 and V6 addresses on a V6 socket */
94101712Srwatson#define SCTP_I_WANT_MAPPED_V4_ADDR	0x0000000d
95101712Srwatson#define SCTP_MAXSEG 			0x0000000e
96101712Srwatson#define SCTP_DELAYED_SACK               0x0000000f
97100979Srwatson#define SCTP_FRAGMENT_INTERLEAVE        0x00000010
98100979Srwatson#define SCTP_PARTIAL_DELIVERY_POINT     0x00000011
99100979Srwatson/* authentication support */
100100979Srwatson#define SCTP_AUTH_CHUNK 		0x00000012
101100979Srwatson#define SCTP_AUTH_KEY 			0x00000013
102100979Srwatson#define SCTP_HMAC_IDENT 		0x00000014
103100979Srwatson#define SCTP_AUTH_ACTIVE_KEY 		0x00000015
104100979Srwatson#define SCTP_AUTH_DELETE_KEY 		0x00000016
105100979Srwatson#define SCTP_USE_EXT_RCVINFO		0x00000017
106100979Srwatson#define SCTP_AUTO_ASCONF		0x00000018	/* rw */
107100979Srwatson#define SCTP_MAXBURST			0x00000019	/* rw */
108100979Srwatson#define SCTP_MAX_BURST			0x00000019	/* rw */
109100979Srwatson/* assoc level context */
110100979Srwatson#define SCTP_CONTEXT                    0x0000001a	/* rw */
111100979Srwatson/* explicit EOR signalling */
112100979Srwatson#define SCTP_EXPLICIT_EOR               0x0000001b
113100979Srwatson#define SCTP_REUSE_PORT                 0x0000001c	/* rw */
114100979Srwatson#define SCTP_AUTH_DEACTIVATE_KEY	0x0000001d
115100979Srwatson
116100979Srwatson/*
117100979Srwatson * read-only options
118100979Srwatson */
119100979Srwatson#define SCTP_STATUS			0x00000100
120100979Srwatson#define SCTP_GET_PEER_ADDR_INFO		0x00000101
121100979Srwatson/* authentication support */
122100979Srwatson#define SCTP_PEER_AUTH_CHUNKS 		0x00000102
123100979Srwatson#define SCTP_LOCAL_AUTH_CHUNKS 		0x00000103
124103513Srwatson#define SCTP_GET_ASSOC_NUMBER           0x00000104	/* ro */
125103513Srwatson#define SCTP_GET_ASSOC_ID_LIST          0x00000105	/* ro */
126103513Srwatson#define SCTP_TIMEOUTS                   0x00000106
127104236Srwatson
128103513Srwatson/*
129100979Srwatson * user socket options: BSD implementation specific
130100979Srwatson */
131100979Srwatson/*
132100979Srwatson * Blocking I/O is enabled on any TCP type socket by default. For the UDP
133100979Srwatson * model if this is turned on then the socket buffer is shared for send
134100979Srwatson * resources amongst all associations.  The default for the UDP model is that
135100979Srwatson * is SS_NBIO is set.  Which means all associations have a separate send
136100979Srwatson * limit BUT they will NOT ever BLOCK instead you will get an error back
137100979Srwatson * EAGAIN if you try to send too much. If you want the blocking semantics you
138100979Srwatson * set this option at the cost of sharing one socket send buffer size amongst
139103514Srwatson * all associations. Peeled off sockets turn this option off and block. But
140103514Srwatson * since both TCP and peeled off sockets have only one assoc per socket this
141103514Srwatson * is fine. It probably does NOT make sense to set this on SS_NBIO on a TCP
142104236Srwatson * model OR peeled off UDP model, but we do allow you to do so. You just use
143103514Srwatson * the normal syscall to toggle SS_NBIO the way you want.
144100979Srwatson *
145100979Srwatson * Blocking I/O is controlled by the SS_NBIO flag on the socket state so_state
146100979Srwatson * field.
147100979Srwatson */
148100979Srwatson
149100979Srwatson/* these should probably go into sockets API */
150100979Srwatson#define SCTP_RESET_STREAMS		0x00001004	/* wo */
151100979Srwatson
152100979Srwatson
153100979Srwatson/* here on down are more implementation specific */
154100979Srwatson#define SCTP_SET_DEBUG_LEVEL		0x00001005
155100979Srwatson#define SCTP_CLR_STAT_LOG               0x00001007
156100979Srwatson/* CMT ON/OFF socket option */
157100979Srwatson#define SCTP_CMT_ON_OFF                 0x00001200
158100979Srwatson#define SCTP_CMT_USE_DAC                0x00001201
159100979Srwatson/* JRS - Pluggable Congestion Control Socket option */
160103136Srwatson#define SCTP_PLUGGABLE_CC               0x00001202
161103136Srwatson
162103136Srwatson/* read only */
163103136Srwatson#define SCTP_GET_SNDBUF_USE		0x00001101
164103136Srwatson#define SCTP_GET_STAT_LOG		0x00001103
165101892Srwatson#define SCTP_PCB_STATUS			0x00001104
166100979Srwatson#define SCTP_GET_NONCE_VALUES           0x00001105
167100979Srwatson
168100979Srwatson
169100979Srwatson/* Special hook for dynamically setting primary for all assoc's,
170101988Srwatson * this is a write only option that requires root privilege.
171104268Srwatson */
172104268Srwatson#define SCTP_SET_DYNAMIC_PRIMARY        0x00002001
173104268Srwatson
174104268Srwatson/* VRF (virtual router feature) and multi-VRF support
175104268Srwatson * options. VRF's provide splits within a router
176104268Srwatson * that give the views of multiple routers. A
177104268Srwatson * standard host, without VRF support, is just
178104268Srwatson * a single VRF. If VRF's are supported then
179104268Srwatson * the transport must be VRF aware. This means
180104268Srwatson * that every socket call coming in must be directed
181100979Srwatson * within the endpoint to one of the VRF's it belongs
182100979Srwatson * to. The endpoint, before binding, may select
183100979Srwatson * the "default" VRF it is in by using a set socket
184100979Srwatson * option with SCTP_VRF_ID. This will also
185100979Srwatson * get propagated to the default VRF. Once the
186100979Srwatson * endpoint binds an address then it CANNOT add
187100979Srwatson * additional VRF's to become a Multi-VRF endpoint.
188100979Srwatson *
189100979Srwatson * Before BINDING additional VRF's can be added with
190100979Srwatson * the SCTP_ADD_VRF_ID call or deleted with
191100979Srwatson * SCTP_DEL_VRF_ID.
192100979Srwatson *
193100979Srwatson * Associations are ALWAYS contained inside a single
194100979Srwatson * VRF. They cannot reside in two (or more) VRF's. Incoming
195100979Srwatson * packets, assuming the router is VRF aware, can always
196100979Srwatson * tell us what VRF they arrived on. A host not supporting
197100979Srwatson * any VRF's will find that the packets always arrived on the
198100979Srwatson * single VRF that the host has.
199100979Srwatson *
200100979Srwatson */
201100979Srwatson
202100979Srwatson#define SCTP_VRF_ID			0x00003001
203100979Srwatson#define SCTP_ADD_VRF_ID			0x00003002
204100979Srwatson#define SCTP_GET_VRF_IDS		0x00003003
205100979Srwatson#define SCTP_GET_ASOC_VRF               0x00003004
206101988Srwatson#define SCTP_DEL_VRF_ID                 0x00003005
207100979Srwatson
208100979Srwatson/*
209100979Srwatson * If you enable packet logging you can get
210100979Srwatson * a poor mans ethereal output in binary
211100979Srwatson * form. Note this is a compile option to
212100979Srwatson * the kernel,  SCTP_PACKET_LOGGING, and
213100979Srwatson * without it in your kernel you
214100979Srwatson * will get a EOPNOTSUPP
215100979Srwatson */
216100979Srwatson#define SCTP_GET_PACKET_LOG             0x00004001
217100979Srwatson
218100979Srwatson/*
219100979Srwatson * hidden implementation specific options these are NOT user visible (should
220100979Srwatson * move out of sctp.h)
221100979Srwatson */
222100979Srwatson/* sctp_bindx() flags as hidden socket options */
223100979Srwatson#define SCTP_BINDX_ADD_ADDR		0x00008001
224100979Srwatson#define SCTP_BINDX_REM_ADDR		0x00008002
225100979Srwatson/* Hidden socket option that gets the addresses */
226100979Srwatson#define SCTP_GET_PEER_ADDRESSES		0x00008003
227100979Srwatson#define SCTP_GET_LOCAL_ADDRESSES	0x00008004
228100979Srwatson/* return the total count in bytes needed to hold all local addresses bound */
229100979Srwatson#define SCTP_GET_LOCAL_ADDR_SIZE	0x00008005
230100979Srwatson/* Return the total count in bytes needed to hold the remote address */
231100979Srwatson#define SCTP_GET_REMOTE_ADDR_SIZE	0x00008006
232100979Srwatson/* hidden option for connectx */
233100979Srwatson#define SCTP_CONNECT_X			0x00008007
234100979Srwatson/* hidden option for connectx_delayed, part of sendx */
235100979Srwatson#define SCTP_CONNECT_X_DELAYED		0x00008008
236100979Srwatson#define SCTP_CONNECT_X_COMPLETE         0x00008009
237100979Srwatson/* hidden socket option based sctp_peeloff */
238100979Srwatson#define SCTP_PEELOFF                    0x0000800a
239100979Srwatson/* the real worker for sctp_getaddrlen() */
240100979Srwatson#define SCTP_GET_ADDR_LEN               0x0000800b
241100979Srwatson/* temporary workaround for Apple listen() issue, no args used */
242100979Srwatson#define SCTP_LISTEN_FIX			0x0000800c
243100979Srwatson/* Debug things that need to be purged */
244100979Srwatson#define SCTP_SET_INITIAL_DBG_SEQ	0x00009f00
245100979Srwatson
246100979Srwatson/* JRS - Supported congestion control modules for pluggable
247100979Srwatson * congestion control
248100979Srwatson */
249100979Srwatson/* Standard TCP Congestion Control */
250100979Srwatson#define SCTP_CC_RFC2581		0x00000000
251100979Srwatson/* High Speed TCP Congestion Control (Floyd) */
252100979Srwatson#define SCTP_CC_HSTCP		0x00000001
253100979Srwatson/* HTCP Congestion Control */
254100979Srwatson#define SCTP_CC_HTCP		0x00000002
255100979Srwatson
256100979Srwatson
257100979Srwatson/* fragment interleave constants
258100979Srwatson * setting must be one of these or
259100979Srwatson * EINVAL returned.
260100979Srwatson */
261100979Srwatson#define SCTP_FRAG_LEVEL_0    0x00000000
262100979Srwatson#define SCTP_FRAG_LEVEL_1    0x00000001
263100979Srwatson#define SCTP_FRAG_LEVEL_2    0x00000002
264100979Srwatson
265100979Srwatson/*
266100979Srwatson * user state values
267100979Srwatson */
268100979Srwatson#define SCTP_CLOSED			0x0000
269100979Srwatson#define SCTP_BOUND			0x1000
270100979Srwatson#define SCTP_LISTEN			0x2000
271100979Srwatson#define SCTP_COOKIE_WAIT		0x0002
272100979Srwatson#define SCTP_COOKIE_ECHOED		0x0004
273100979Srwatson#define SCTP_ESTABLISHED		0x0008
274100979Srwatson#define SCTP_SHUTDOWN_SENT		0x0010
275100979Srwatson#define SCTP_SHUTDOWN_RECEIVED		0x0020
276100979Srwatson#define SCTP_SHUTDOWN_ACK_SENT		0x0040
277100979Srwatson#define SCTP_SHUTDOWN_PENDING		0x0080
278100979Srwatson
279100979Srwatson/*
280100979Srwatson * SCTP operational error codes (user visible)
281100979Srwatson */
282100979Srwatson#define SCTP_CAUSE_NO_ERROR		0x0000
283100979Srwatson#define SCTP_CAUSE_INVALID_STREAM	0x0001
284100979Srwatson#define SCTP_CAUSE_MISSING_PARAM	0x0002
285100979Srwatson#define SCTP_CAUSE_STALE_COOKIE		0x0003
286100979Srwatson#define SCTP_CAUSE_OUT_OF_RESC		0x0004
287100979Srwatson#define SCTP_CAUSE_UNRESOLVABLE_ADDR	0x0005
288100979Srwatson#define SCTP_CAUSE_UNRECOG_CHUNK	0x0006
289100979Srwatson#define SCTP_CAUSE_INVALID_PARAM	0x0007
290100979Srwatson#define SCTP_CAUSE_UNRECOG_PARAM	0x0008
291100979Srwatson#define SCTP_CAUSE_NO_USER_DATA		0x0009
292100979Srwatson#define SCTP_CAUSE_COOKIE_IN_SHUTDOWN	0x000a
293100979Srwatson#define SCTP_CAUSE_RESTART_W_NEWADDR	0x000b
294100979Srwatson#define SCTP_CAUSE_USER_INITIATED_ABT	0x000c
295100979Srwatson#define SCTP_CAUSE_PROTOCOL_VIOLATION	0x000d
296100979Srwatson
297100979Srwatson/* Error causes from RFC5061 */
298100979Srwatson#define SCTP_CAUSE_DELETING_LAST_ADDR	0x00a0
299100979Srwatson#define SCTP_CAUSE_RESOURCE_SHORTAGE	0x00a1
300100979Srwatson#define SCTP_CAUSE_DELETING_SRC_ADDR	0x00a2
301100979Srwatson#define SCTP_CAUSE_ILLEGAL_ASCONF_ACK	0x00a3
302100979Srwatson#define SCTP_CAUSE_REQUEST_REFUSED	0x00a4
303100979Srwatson
304100979Srwatson/* Error causes from nat-draft */
305100979Srwatson#define SCTP_CAUSE_NAT_COLLIDING_STATE  0x00b0
306100979Srwatson#define SCTP_CAUSE_NAT_MISSING_STATE    0x00b1
307100979Srwatson
308100979Srwatson/* Error causes from RFC4895 */
309100979Srwatson#define SCTP_CAUSE_UNSUPPORTED_HMACID	0x0105
310100979Srwatson
311100979Srwatson/*
312100979Srwatson * error cause parameters (user visible)
313100979Srwatson */
314100979Srwatsonstruct sctp_error_cause {
315100979Srwatson	uint16_t code;
316100979Srwatson	uint16_t length;
317100979Srwatson	/* optional cause-specific info may follow */
318100979Srwatson}                SCTP_PACKED;
319100979Srwatson
320100979Srwatsonstruct sctp_error_invalid_stream {
321100979Srwatson	struct sctp_error_cause cause;	/* code=SCTP_ERROR_INVALID_STREAM */
322100979Srwatson	uint16_t stream_id;	/* stream id of the DATA in error */
323100979Srwatson	uint16_t reserved;
324100979Srwatson}                         SCTP_PACKED;
325100979Srwatson
326100979Srwatsonstruct sctp_error_missing_param {
327100979Srwatson	struct sctp_error_cause cause;	/* code=SCTP_ERROR_MISSING_PARAM */
328100979Srwatson	uint32_t num_missing_params;	/* number of missing parameters */
329100979Srwatson	/* uint16_t param_type's follow */
330100979Srwatson}                        SCTP_PACKED;
331100979Srwatson
332100979Srwatsonstruct sctp_error_stale_cookie {
333100894Srwatson	struct sctp_error_cause cause;	/* code=SCTP_ERROR_STALE_COOKIE */
334100979Srwatson	uint32_t stale_time;	/* time in usec of staleness */
335100979Srwatson}                       SCTP_PACKED;
336100979Srwatson
337100979Srwatsonstruct sctp_error_out_of_resource {
338100979Srwatson	struct sctp_error_cause cause;	/* code=SCTP_ERROR_OUT_OF_RESOURCES */
339100979Srwatson}                          SCTP_PACKED;
340100979Srwatson
341100979Srwatsonstruct sctp_error_unresolv_addr {
342100979Srwatson	struct sctp_error_cause cause;	/* code=SCTP_ERROR_UNRESOLVABLE_ADDR */
343100979Srwatson
344100979Srwatson}                        SCTP_PACKED;
345100979Srwatson
346100979Srwatsonstruct sctp_error_unrecognized_chunk {
347100979Srwatson	struct sctp_error_cause cause;	/* code=SCTP_ERROR_UNRECOG_CHUNK */
348100979Srwatson	struct sctp_chunkhdr ch;/* header from chunk in error */
349100979Srwatson}                             SCTP_PACKED;
350100979Srwatson
351100979Srwatson/*
352100979Srwatson * Main SCTP chunk types we place these here so natd and f/w's in user land
353100979Srwatson * can find them.
354100979Srwatson */
355100979Srwatson/************0x00 series ***********/
356100979Srwatson#define SCTP_DATA		0x00
357100979Srwatson#define SCTP_INITIATION		0x01
358100979Srwatson#define SCTP_INITIATION_ACK	0x02
359100979Srwatson#define SCTP_SELECTIVE_ACK	0x03
360100979Srwatson#define SCTP_HEARTBEAT_REQUEST	0x04
361100979Srwatson#define SCTP_HEARTBEAT_ACK	0x05
362100979Srwatson#define SCTP_ABORT_ASSOCIATION	0x06
363100979Srwatson#define SCTP_SHUTDOWN		0x07
364100979Srwatson#define SCTP_SHUTDOWN_ACK	0x08
365100979Srwatson#define SCTP_OPERATION_ERROR	0x09
366100979Srwatson#define SCTP_COOKIE_ECHO	0x0a
367100979Srwatson#define SCTP_COOKIE_ACK		0x0b
368100979Srwatson#define SCTP_ECN_ECHO		0x0c
369100979Srwatson#define SCTP_ECN_CWR		0x0d
370100979Srwatson#define SCTP_SHUTDOWN_COMPLETE	0x0e
371100979Srwatson/* RFC4895 */
372100979Srwatson#define SCTP_AUTHENTICATION     0x0f
373100979Srwatson/* EY nr_sack chunk id*/
374100979Srwatson#define SCTP_NR_SELECTIVE_ACK 0x10
375103570Srwatson/************0x40 series ***********/
376103570Srwatson/************0x80 series ***********/
377100979Srwatson/* RFC5061 */
378100979Srwatson#define	SCTP_ASCONF_ACK		0x80
379100979Srwatson/* draft-ietf-stewart-pktdrpsctp */
380100979Srwatson#define SCTP_PACKET_DROPPED	0x81
381100979Srwatson/* draft-ietf-stewart-strreset-xxx */
382100979Srwatson#define SCTP_STREAM_RESET       0x82
383100979Srwatson
384100979Srwatson/* RFC4820                         */
385100979Srwatson#define SCTP_PAD_CHUNK          0x84
386100979Srwatson/************0xc0 series ***********/
387100979Srwatson/* RFC3758 */
388100979Srwatson#define SCTP_FORWARD_CUM_TSN	0xc0
389100979Srwatson/* RFC5061 */
390100979Srwatson#define SCTP_ASCONF		0xc1
391100979Srwatson
392100979Srwatson
393102123Srwatson/* ABORT and SHUTDOWN COMPLETE FLAG */
394102123Srwatson#define SCTP_HAD_NO_TCB		0x01
395102123Srwatson
396102123Srwatson/* Packet dropped flags */
397104514Srwatson#define SCTP_FROM_MIDDLE_BOX	SCTP_HAD_NO_TCB
398104514Srwatson#define SCTP_BADCRC		0x02
399100979Srwatson#define SCTP_PACKET_TRUNCATED	0x04
400100979Srwatson
401104514Srwatson#define SCTP_SAT_NETWORK_MIN	400	/* min ms for RTT to set satellite
402104514Srwatson					 * time */
403100979Srwatson#define SCTP_SAT_NETWORK_BURST_INCR  2	/* how many times to multiply maxburst
404100979Srwatson					 * in sat */
405104514Srwatson
406104514Srwatson/* Data Chuck Specific Flags */
407100979Srwatson#define SCTP_DATA_FRAG_MASK        0x03
408100979Srwatson#define SCTP_DATA_MIDDLE_FRAG      0x00
409104514Srwatson#define SCTP_DATA_LAST_FRAG        0x01
410104514Srwatson#define SCTP_DATA_FIRST_FRAG       0x02
411100979Srwatson#define SCTP_DATA_NOT_FRAG         0x03
412100979Srwatson#define SCTP_DATA_UNORDERED        0x04
413104514Srwatson#define SCTP_DATA_SACK_IMMEDIATELY 0x08
414104514Srwatson/* ECN Nonce: SACK Chunk Specific Flags */
415100979Srwatson#define SCTP_SACK_NONCE_SUM        0x01
416100979Srwatson
417104514Srwatson/* CMT DAC algorithm SACK flag */
418104514Srwatson#define SCTP_SACK_CMT_DAC          0x80
419100979Srwatson
420100979Srwatson/*
421104514Srwatson * PCB flags (in sctp_flags bitmask).
422104514Srwatson * Note the features and flags are meant
423100979Srwatson * for use by netstat.
424100979Srwatson */
425104514Srwatson#define SCTP_PCB_FLAGS_UDPTYPE		0x00000001
426104514Srwatson#define SCTP_PCB_FLAGS_TCPTYPE		0x00000002
427100979Srwatson#define SCTP_PCB_FLAGS_BOUNDALL		0x00000004
428100979Srwatson#define SCTP_PCB_FLAGS_ACCEPTING	0x00000008
429104514Srwatson#define SCTP_PCB_FLAGS_UNBOUND		0x00000010
430104514Srwatson#define SCTP_PCB_FLAGS_CLOSE_IP         0x00040000
431100979Srwatson#define SCTP_PCB_FLAGS_WAS_CONNECTED    0x00080000
432100979Srwatson#define SCTP_PCB_FLAGS_WAS_ABORTED      0x00100000
433104514Srwatson/* TCP model support */
434104514Srwatson
435100979Srwatson#define SCTP_PCB_FLAGS_CONNECTED	0x00200000
436100979Srwatson#define SCTP_PCB_FLAGS_IN_TCPPOOL	0x00400000
437104514Srwatson#define SCTP_PCB_FLAGS_DONT_WAKE	0x00800000
438104514Srwatson#define SCTP_PCB_FLAGS_WAKEOUTPUT	0x01000000
439100979Srwatson#define SCTP_PCB_FLAGS_WAKEINPUT	0x02000000
440100979Srwatson#define SCTP_PCB_FLAGS_BOUND_V6		0x04000000
441104514Srwatson#define SCTP_PCB_FLAGS_BLOCKING_IO	0x08000000
442104514Srwatson#define SCTP_PCB_FLAGS_SOCKET_GONE	0x10000000
443100979Srwatson#define SCTP_PCB_FLAGS_SOCKET_ALLGONE	0x20000000
444100979Srwatson#define SCTP_PCB_FLAGS_SOCKET_CANT_READ	0x40000000
445104514Srwatson/* flags to copy to new PCB */
446104514Srwatson#define SCTP_PCB_COPY_FLAGS		(SCTP_PCB_FLAGS_BOUNDALL|\
447100979Srwatson					 SCTP_PCB_FLAGS_WAKEINPUT|\
448100979Srwatson					 SCTP_PCB_FLAGS_BOUND_V6)
449104514Srwatson
450104514Srwatson
451100979Srwatson/*
452100979Srwatson * PCB Features (in sctp_features bitmask)
453104514Srwatson */
454104514Srwatson#define SCTP_PCB_FLAGS_EXT_RCVINFO      0x00000002
455100979Srwatson#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT  0x00000004
456100979Srwatson#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE  0x00000008
457104514Srwatson#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS	0x00000010
458104514Srwatson#define SCTP_PCB_FLAGS_DO_ASCONF	0x00000020
459100979Srwatson#define SCTP_PCB_FLAGS_AUTO_ASCONF	0x00000040
460100979Srwatson#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080
461104514Srwatson/* socket options */
462104514Srwatson#define SCTP_PCB_FLAGS_NODELAY		0x00000100
463100979Srwatson#define SCTP_PCB_FLAGS_AUTOCLOSE	0x00000200
464100979Srwatson#define SCTP_PCB_FLAGS_RECVDATAIOEVNT	0x00000400
465104514Srwatson#define SCTP_PCB_FLAGS_RECVASSOCEVNT	0x00000800
466104514Srwatson#define SCTP_PCB_FLAGS_RECVPADDREVNT	0x00001000
467100979Srwatson#define SCTP_PCB_FLAGS_RECVPEERERR	0x00002000
468100979Srwatson#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT	0x00004000
469104514Srwatson#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT	0x00008000
470104514Srwatson#define SCTP_PCB_FLAGS_ADAPTATIONEVNT	0x00010000
471100979Srwatson#define SCTP_PCB_FLAGS_PDAPIEVNT	0x00020000
472100979Srwatson#define SCTP_PCB_FLAGS_AUTHEVNT		0x00040000
473104514Srwatson#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000
474104514Srwatson#define SCTP_PCB_FLAGS_NO_FRAGMENT	0x00100000
475100979Srwatson#define SCTP_PCB_FLAGS_EXPLICIT_EOR     0x00400000
476100979Srwatson#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4	0x00800000
477104514Srwatson#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS	0x01000000
478104514Srwatson#define SCTP_PCB_FLAGS_PORTREUSE        0x02000000
479100979Srwatson#define SCTP_PCB_FLAGS_DRYEVNT          0x04000000
480100979Srwatson/*-
481104514Srwatson * mobility_features parameters (by micchie).Note
482104514Srwatson * these features are applied against the
483100979Srwatson * sctp_mobility_features flags.. not the sctp_features
484100979Srwatson * flags.
485104514Srwatson */
486104514Srwatson#define SCTP_MOBILITY_BASE		0x00000001
487104514Srwatson#define SCTP_MOBILITY_FASTHANDOFF	0x00000002
488104514Srwatson#define SCTP_MOBILITY_PRIM_DELETED	0x00000004
489104514Srwatson
490104514Srwatson
491104514Srwatson#define SCTP_SMALLEST_PMTU 512	/* smallest pmtu allowed when disabling PMTU
492104514Srwatson				 * discovery */
493104514Srwatson
494104514Srwatson#include <netinet/sctp_uio.h>
495104514Srwatson
496104514Srwatson/* This dictates the size of the packet
497104514Srwatson * collection buffer. This only applies
498104514Srwatson * if SCTP_PACKET_LOGGING is enabled in
499104514Srwatson * your config.
500104514Srwatson */
501100979Srwatson#define SCTP_PACKET_LOG_SIZE 65536
502100979Srwatson
503100979Srwatson/* Maximum delays and such a user can set for options that
504100979Srwatson * take ms.
505100979Srwatson */
506100979Srwatson#define SCTP_MAX_SACK_DELAY 500	/* per RFC4960 */
507100979Srwatson#define SCTP_MAX_HB_INTERVAL 14400000	/* 4 hours in ms */
508100979Srwatson#define SCTP_MAX_COOKIE_LIFE  3600000	/* 1 hour in ms */
509100979Srwatson
510100979Srwatson
511100979Srwatson/* Types of logging/KTR tracing  that can be enabled via the
512100979Srwatson * sysctl net.inet.sctp.sctp_logging. You must also enable
513100979Srwatson * SUBSYS tracing.
514100979Srwatson * Note that you must have the SCTP option in the kernel
515100979Srwatson * to enable these as well.
516100979Srwatson */
517100979Srwatson#define SCTP_BLK_LOGGING_ENABLE				0x00000001
518100979Srwatson#define SCTP_CWND_MONITOR_ENABLE			0x00000002
519100979Srwatson#define SCTP_CWND_LOGGING_ENABLE			0x00000004
520100979Srwatson#define SCTP_EARLYFR_LOGGING_ENABLE			0x00000010
521100979Srwatson#define SCTP_FLIGHT_LOGGING_ENABLE			0x00000020
522100979Srwatson#define SCTP_FR_LOGGING_ENABLE				0x00000040
523100979Srwatson#define SCTP_LOCK_LOGGING_ENABLE			0x00000080
524100979Srwatson#define SCTP_MAP_LOGGING_ENABLE				0x00000100
525100979Srwatson#define SCTP_MBCNT_LOGGING_ENABLE			0x00000200
526100979Srwatson#define SCTP_MBUF_LOGGING_ENABLE			0x00000400
527100979Srwatson#define SCTP_NAGLE_LOGGING_ENABLE			0x00000800
528100979Srwatson#define SCTP_RECV_RWND_LOGGING_ENABLE		0x00001000
529100979Srwatson#define SCTP_RTTVAR_LOGGING_ENABLE			0x00002000
530100979Srwatson#define SCTP_SACK_LOGGING_ENABLE			0x00004000
531100979Srwatson#define SCTP_SACK_RWND_LOGGING_ENABLE		0x00008000
532100979Srwatson#define SCTP_SB_LOGGING_ENABLE				0x00010000
533100979Srwatson#define SCTP_STR_LOGGING_ENABLE				0x00020000
534100979Srwatson#define SCTP_WAKE_LOGGING_ENABLE			0x00040000
535100979Srwatson#define SCTP_LOG_MAXBURST_ENABLE			0x00080000
536100979Srwatson#define SCTP_LOG_RWND_ENABLE    			0x00100000
537100979Srwatson#define SCTP_LOG_SACK_ARRIVALS_ENABLE       0x00200000
538100979Srwatson#define SCTP_LTRACE_CHUNK_ENABLE            0x00400000
539100979Srwatson#define SCTP_LTRACE_ERROR_ENABLE            0x00800000
540100979Srwatson#define SCTP_LAST_PACKET_TRACING            0x01000000
541100979Srwatson#define SCTP_THRESHOLD_LOGGING              0x02000000
542100979Srwatson#define SCTP_LOG_AT_SEND_2_SCTP             0x04000000
543100979Srwatson#define SCTP_LOG_AT_SEND_2_OUTQ             0x08000000
544100979Srwatson#define SCTP_LOG_TRY_ADVANCE                0x10000000
545100979Srwatson
546100979Srwatson
547100979Srwatson#undef SCTP_PACKED
548100979Srwatson
549100979Srwatson#endif				/* !_NETINET_SCTP_H_ */
550100979Srwatson