sctp_header.h revision 188854
1163953Srrs/*-
2169382Srrs * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3163953Srrs *
4163953Srrs * Redistribution and use in source and binary forms, with or without
5163953Srrs * modification, are permitted provided that the following conditions are met:
6163953Srrs *
7163953Srrs * a) Redistributions of source code must retain the above copyright notice,
8163953Srrs *   this list of conditions and the following disclaimer.
9163953Srrs *
10163953Srrs * b) Redistributions in binary form must reproduce the above copyright
11163953Srrs *    notice, this list of conditions and the following disclaimer in
12163953Srrs *   the documentation and/or other materials provided with the distribution.
13163953Srrs *
14163953Srrs * c) Neither the name of Cisco Systems, Inc. nor the names of its
15163953Srrs *    contributors may be used to endorse or promote products derived
16163953Srrs *    from this software without specific prior written permission.
17163953Srrs *
18163953Srrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19163953Srrs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20163953Srrs * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21163953Srrs * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22163953Srrs * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23163953Srrs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24163953Srrs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25163953Srrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26163953Srrs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27163953Srrs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28163953Srrs * THE POSSIBILITY OF SUCH DAMAGE.
29163953Srrs */
30163953Srrs
31163953Srrs/* $KAME: sctp_header.h,v 1.14 2005/03/06 16:04:17 itojun Exp $	 */
32163953Srrs
33163953Srrs#include <sys/cdefs.h>
34163953Srrs__FBSDID("$FreeBSD: head/sys/netinet/sctp_header.h 188854 2009-02-20 15:03:54Z rrs $");
35163953Srrs
36163953Srrs#ifndef __sctp_header_h__
37163953Srrs#define __sctp_header_h__
38163953Srrs
39163953Srrs#include <sys/time.h>
40163953Srrs#include <netinet/sctp.h>
41163953Srrs#include <netinet/sctp_constants.h>
42163953Srrs
43179783Srrs#define SCTP_PACKED __attribute__((packed))
44170606Srrs
45163953Srrs/*
46163953Srrs * Parameter structures
47163953Srrs */
48163953Srrsstruct sctp_ipv4addr_param {
49163953Srrs	struct sctp_paramhdr ph;/* type=SCTP_IPV4_PARAM_TYPE, len=8 */
50163953Srrs	uint32_t addr;		/* IPV4 address */
51170606Srrs}                   SCTP_PACKED;
52163953Srrs
53167598Srrs#define SCTP_V6_ADDR_BYTES 16
54167598Srrs
55167598Srrs
56163953Srrsstruct sctp_ipv6addr_param {
57163953Srrs	struct sctp_paramhdr ph;/* type=SCTP_IPV6_PARAM_TYPE, len=20 */
58167598Srrs	uint8_t addr[SCTP_V6_ADDR_BYTES];	/* IPV6 address */
59170606Srrs}                   SCTP_PACKED;
60163953Srrs
61163953Srrs/* Cookie Preservative */
62163953Srrsstruct sctp_cookie_perserve_param {
63163953Srrs	struct sctp_paramhdr ph;/* type=SCTP_COOKIE_PRESERVE, len=8 */
64163953Srrs	uint32_t time;		/* time in ms to extend cookie */
65163953Srrs};
66163953Srrs
67167598Srrs#define SCTP_ARRAY_MIN_LEN 1
68163953Srrs/* Host Name Address */
69163953Srrsstruct sctp_host_name_param {
70163953Srrs	struct sctp_paramhdr ph;/* type=SCTP_HOSTNAME_ADDRESS */
71167598Srrs	char name[SCTP_ARRAY_MIN_LEN];	/* host name */
72170606Srrs}                    SCTP_PACKED;
73163953Srrs
74169208Srrs/*
75169208Srrs * This is the maximum padded size of a s-a-p
76169208Srrs * so paramheadr + 3 address types (6 bytes) + 2 byte pad = 12
77169208Srrs */
78169208Srrs#define SCTP_MAX_ADDR_PARAMS_SIZE 12
79163953Srrs/* supported address type */
80163953Srrsstruct sctp_supported_addr_param {
81163953Srrs	struct sctp_paramhdr ph;/* type=SCTP_SUPPORTED_ADDRTYPE */
82167598Srrs	uint16_t addr_type[SCTP_ARRAY_MIN_LEN];	/* array of supported address
83167598Srrs						 * types */
84170606Srrs}                         SCTP_PACKED;
85163953Srrs
86163953Srrs/* ECN parameter */
87163953Srrsstruct sctp_ecn_supported_param {
88163953Srrs	struct sctp_paramhdr ph;/* type=SCTP_ECN_CAPABLE */
89170606Srrs}                        SCTP_PACKED;
90163953Srrs
91163953Srrs
92163953Srrs/* heartbeat info parameter */
93163953Srrsstruct sctp_heartbeat_info_param {
94163953Srrs	struct sctp_paramhdr ph;
95163953Srrs	uint32_t time_value_1;
96163953Srrs	uint32_t time_value_2;
97163953Srrs	uint32_t random_value1;
98163953Srrs	uint32_t random_value2;
99163953Srrs	uint16_t user_req;
100163953Srrs	uint8_t addr_family;
101163953Srrs	uint8_t addr_len;
102163953Srrs	char address[SCTP_ADDRMAX];
103170606Srrs}                         SCTP_PACKED;
104163953Srrs
105163953Srrs
106163953Srrs/* draft-ietf-tsvwg-prsctp */
107163953Srrs/* PR-SCTP supported parameter */
108163953Srrsstruct sctp_prsctp_supported_param {
109163953Srrs	struct sctp_paramhdr ph;
110170606Srrs}                           SCTP_PACKED;
111163953Srrs
112163953Srrs
113163953Srrs/* draft-ietf-tsvwg-addip-sctp */
114163953Srrsstruct sctp_asconf_paramhdr {	/* an ASCONF "parameter" */
115163953Srrs	struct sctp_paramhdr ph;/* a SCTP parameter header */
116163953Srrs	uint32_t correlation_id;/* correlation id for this param */
117170606Srrs}                    SCTP_PACKED;
118163953Srrs
119163953Srrsstruct sctp_asconf_addr_param {	/* an ASCONF address parameter */
120163953Srrs	struct sctp_asconf_paramhdr aph;	/* asconf "parameter" */
121163953Srrs	struct sctp_ipv6addr_param addrp;	/* max storage size */
122170606Srrs}                      SCTP_PACKED;
123163953Srrs
124185694Srrs
125185694Srrsstruct sctp_asconf_tag_param {	/* an ASCONF NAT-Vtag parameter */
126185694Srrs	struct sctp_asconf_paramhdr aph;	/* asconf "parameter" */
127185694Srrs	uint32_t local_vtag;
128185694Srrs	uint32_t remote_vtag;
129185694Srrs}                     SCTP_PACKED;
130185694Srrs
131185694Srrs
132163953Srrsstruct sctp_asconf_addrv4_param {	/* an ASCONF address (v4) parameter */
133163953Srrs	struct sctp_asconf_paramhdr aph;	/* asconf "parameter" */
134163953Srrs	struct sctp_ipv4addr_param addrp;	/* max storage size */
135170606Srrs}                        SCTP_PACKED;
136163953Srrs
137169208Srrs#define SCTP_MAX_SUPPORTED_EXT 256
138169208Srrs
139163953Srrsstruct sctp_supported_chunk_types_param {
140163953Srrs	struct sctp_paramhdr ph;/* type = 0x8008  len = x */
141163953Srrs	uint8_t chunk_types[0];
142170606Srrs}                                SCTP_PACKED;
143163953Srrs
144163953Srrs
145163953Srrs/* ECN Nonce: draft-ladha-sctp-ecn-nonce */
146163953Srrsstruct sctp_ecn_nonce_supported_param {
147163953Srrs	struct sctp_paramhdr ph;/* type = 0x8001  len = 4 */
148170606Srrs}                              SCTP_PACKED;
149163953Srrs
150163953Srrs
151163953Srrs/*
152163953Srrs * Structures for DATA chunks
153163953Srrs */
154163953Srrsstruct sctp_data {
155163953Srrs	uint32_t tsn;
156163953Srrs	uint16_t stream_id;
157163953Srrs	uint16_t stream_sequence;
158163953Srrs	uint32_t protocol_id;
159163953Srrs	/* user data follows */
160170606Srrs}         SCTP_PACKED;
161163953Srrs
162163953Srrsstruct sctp_data_chunk {
163163953Srrs	struct sctp_chunkhdr ch;
164163953Srrs	struct sctp_data dp;
165170606Srrs}               SCTP_PACKED;
166163953Srrs
167163953Srrs/*
168163953Srrs * Structures for the control chunks
169163953Srrs */
170163953Srrs
171163953Srrs/* Initiate (INIT)/Initiate Ack (INIT ACK) */
172163953Srrsstruct sctp_init {
173163953Srrs	uint32_t initiate_tag;	/* initiate tag */
174163953Srrs	uint32_t a_rwnd;	/* a_rwnd */
175163953Srrs	uint16_t num_outbound_streams;	/* OS */
176163953Srrs	uint16_t num_inbound_streams;	/* MIS */
177163953Srrs	uint32_t initial_tsn;	/* I-TSN */
178163953Srrs	/* optional param's follow */
179170606Srrs}         SCTP_PACKED;
180163953Srrs
181167598Srrs#define SCTP_IDENTIFICATION_SIZE 16
182167598Srrs#define SCTP_ADDRESS_SIZE 4
183170606Srrs#define SCTP_RESERVE_SPACE 6
184163953Srrs/* state cookie header */
185163953Srrsstruct sctp_state_cookie {	/* this is our definition... */
186167598Srrs	uint8_t identification[SCTP_IDENTIFICATION_SIZE];	/* id of who we are */
187170606Srrs	struct timeval time_entered;	/* the time I built cookie */
188163953Srrs	uint32_t cookie_life;	/* life I will award this cookie */
189163953Srrs	uint32_t tie_tag_my_vtag;	/* my tag in old association */
190170606Srrs
191163953Srrs	uint32_t tie_tag_peer_vtag;	/* peers tag in old association */
192163953Srrs	uint32_t peers_vtag;	/* peers tag in INIT (for quick ref) */
193170606Srrs
194163953Srrs	uint32_t my_vtag;	/* my tag in INIT-ACK (for quick ref) */
195167598Srrs	uint32_t address[SCTP_ADDRESS_SIZE];	/* 4 ints/128 bits */
196163953Srrs	uint32_t addr_type;	/* address type */
197167598Srrs	uint32_t laddress[SCTP_ADDRESS_SIZE];	/* my local from address */
198163953Srrs	uint32_t laddr_type;	/* my local from address type */
199163953Srrs	uint32_t scope_id;	/* v6 scope id for link-locals */
200170606Srrs
201163953Srrs	uint16_t peerport;	/* port address of the peer in the INIT */
202163953Srrs	uint16_t myport;	/* my port address used in the INIT */
203163953Srrs	uint8_t ipv4_addr_legal;/* Are V4 addr legal? */
204163953Srrs	uint8_t ipv6_addr_legal;/* Are V6 addr legal? */
205163953Srrs	uint8_t local_scope;	/* IPv6 local scope flag */
206163953Srrs	uint8_t site_scope;	/* IPv6 site scope flag */
207170606Srrs
208163953Srrs	uint8_t ipv4_scope;	/* IPv4 private addr scope */
209163953Srrs	uint8_t loopback_scope;	/* loopback scope information */
210170606Srrs	uint8_t reserved[SCTP_RESERVE_SPACE];	/* Align to 64 bits */
211163953Srrs	/*
212163953Srrs	 * at the end is tacked on the INIT chunk and the INIT-ACK chunk
213163953Srrs	 * (minus the cookie).
214163953Srrs	 */
215170606Srrs}                 SCTP_PACKED;
216163953Srrs
217185694Srrs
218185694Srrs/* Used for NAT state error cause */
219185694Srrsstruct sctp_missing_nat_state {
220185694Srrs	uint16_t cause;
221185694Srrs	uint16_t length;
222185694Srrs	uint8_t data[0];
223185694Srrs}                      SCTP_PACKED;
224185694Srrs
225185694Srrs
226163953Srrsstruct sctp_inv_mandatory_param {
227163953Srrs	uint16_t cause;
228163953Srrs	uint16_t length;
229163953Srrs	uint32_t num_param;
230163953Srrs	uint16_t param;
231163953Srrs	/*
232163953Srrs	 * We include this to 0 it since only a missing cookie will cause
233163953Srrs	 * this error.
234163953Srrs	 */
235163953Srrs	uint16_t resv;
236170606Srrs}                        SCTP_PACKED;
237163953Srrs
238163953Srrsstruct sctp_unresolv_addr {
239163953Srrs	uint16_t cause;
240163953Srrs	uint16_t length;
241163953Srrs	uint16_t addr_type;
242163953Srrs	uint16_t reserved;	/* Only one invalid addr type */
243170606Srrs}                  SCTP_PACKED;
244163953Srrs
245163953Srrs/* state cookie parameter */
246163953Srrsstruct sctp_state_cookie_param {
247163953Srrs	struct sctp_paramhdr ph;
248163953Srrs	struct sctp_state_cookie cookie;
249170606Srrs}                       SCTP_PACKED;
250163953Srrs
251163953Srrsstruct sctp_init_chunk {
252163953Srrs	struct sctp_chunkhdr ch;
253163953Srrs	struct sctp_init init;
254170606Srrs}               SCTP_PACKED;
255163953Srrs
256163953Srrsstruct sctp_init_msg {
257163953Srrs	struct sctphdr sh;
258163953Srrs	struct sctp_init_chunk msg;
259170606Srrs}             SCTP_PACKED;
260163953Srrs
261163953Srrs/* ... used for both INIT and INIT ACK */
262163953Srrs#define sctp_init_ack		sctp_init
263163953Srrs#define sctp_init_ack_chunk	sctp_init_chunk
264163953Srrs#define sctp_init_ack_msg	sctp_init_msg
265163953Srrs
266163953Srrs
267163953Srrs/* Selective Ack (SACK) */
268163953Srrsstruct sctp_gap_ack_block {
269163953Srrs	uint16_t start;		/* Gap Ack block start */
270163953Srrs	uint16_t end;		/* Gap Ack block end */
271170606Srrs}                  SCTP_PACKED;
272163953Srrs
273163953Srrsstruct sctp_sack {
274163953Srrs	uint32_t cum_tsn_ack;	/* cumulative TSN Ack */
275163953Srrs	uint32_t a_rwnd;	/* updated a_rwnd of sender */
276163953Srrs	uint16_t num_gap_ack_blks;	/* number of Gap Ack blocks */
277163953Srrs	uint16_t num_dup_tsns;	/* number of duplicate TSNs */
278163953Srrs	/* struct sctp_gap_ack_block's follow */
279163953Srrs	/* uint32_t duplicate_tsn's follow */
280170606Srrs}         SCTP_PACKED;
281163953Srrs
282163953Srrsstruct sctp_sack_chunk {
283163953Srrs	struct sctp_chunkhdr ch;
284163953Srrs	struct sctp_sack sack;
285170606Srrs}               SCTP_PACKED;
286163953Srrs
287163953Srrs
288185694Srrs/* EY Following 3 structs define NR Selective Ack (NR_SACK) chunk */
289185694Srrsstruct sctp_nr_gap_ack_block {
290185694Srrs	uint16_t start;		/* NR Gap Ack block start */
291185694Srrs	uint16_t end;		/* NR Gap Ack block end */
292185694Srrs}                     SCTP_PACKED;
293185694Srrs
294185694Srrsstruct sctp_nr_sack {
295185694Srrs	uint32_t cum_tsn_ack;	/* cumulative TSN Ack */
296185694Srrs	uint32_t a_rwnd;	/* updated a_rwnd of sender */
297185694Srrs	uint16_t num_gap_ack_blks;	/* number of Gap Ack blocks */
298185694Srrs	uint16_t num_nr_gap_ack_blks;	/* number of NR Gap Ack blocks */
299185694Srrs	uint16_t num_dup_tsns;	/* number of duplicate TSNs */
300185694Srrs	uint16_t reserved;	/* not currently used */
301185694Srrs	/* struct sctp_gap_ack_block's follow */
302185694Srrs	/* struct sctp_nr_gap_ack_block's follow */
303185694Srrs	/* uint32_t duplicate_tsn's follow */
304185694Srrs}            SCTP_PACKED;
305185694Srrs
306185694Srrsstruct sctp_nr_sack_chunk {
307185694Srrs	struct sctp_chunkhdr ch;
308185694Srrs	struct sctp_nr_sack nr_sack;
309185694Srrs}                  SCTP_PACKED;
310185694Srrs
311185694Srrs
312163953Srrs/* Heartbeat Request (HEARTBEAT) */
313163953Srrsstruct sctp_heartbeat {
314163953Srrs	struct sctp_heartbeat_info_param hb_info;
315170606Srrs}              SCTP_PACKED;
316163953Srrs
317163953Srrsstruct sctp_heartbeat_chunk {
318163953Srrs	struct sctp_chunkhdr ch;
319163953Srrs	struct sctp_heartbeat heartbeat;
320170606Srrs}                    SCTP_PACKED;
321163953Srrs
322163953Srrs/* ... used for Heartbeat Ack (HEARTBEAT ACK) */
323163953Srrs#define sctp_heartbeat_ack		sctp_heartbeat
324163953Srrs#define sctp_heartbeat_ack_chunk	sctp_heartbeat_chunk
325163953Srrs
326163953Srrs
327163953Srrs/* Abort Asssociation (ABORT) */
328163953Srrsstruct sctp_abort_chunk {
329163953Srrs	struct sctp_chunkhdr ch;
330163953Srrs	/* optional error cause may follow */
331170606Srrs}                SCTP_PACKED;
332163953Srrs
333163953Srrsstruct sctp_abort_msg {
334163953Srrs	struct sctphdr sh;
335163953Srrs	struct sctp_abort_chunk msg;
336170606Srrs}              SCTP_PACKED;
337163953Srrs
338163953Srrs
339163953Srrs/* Shutdown Association (SHUTDOWN) */
340163953Srrsstruct sctp_shutdown_chunk {
341163953Srrs	struct sctp_chunkhdr ch;
342163953Srrs	uint32_t cumulative_tsn_ack;
343170606Srrs}                   SCTP_PACKED;
344163953Srrs
345163953Srrs
346163953Srrs/* Shutdown Acknowledgment (SHUTDOWN ACK) */
347163953Srrsstruct sctp_shutdown_ack_chunk {
348163953Srrs	struct sctp_chunkhdr ch;
349170606Srrs}                       SCTP_PACKED;
350163953Srrs
351163953Srrs
352163953Srrs/* Operation Error (ERROR) */
353163953Srrsstruct sctp_error_chunk {
354163953Srrs	struct sctp_chunkhdr ch;
355163953Srrs	/* optional error causes follow */
356170606Srrs}                SCTP_PACKED;
357163953Srrs
358163953Srrs
359163953Srrs/* Cookie Echo (COOKIE ECHO) */
360163953Srrsstruct sctp_cookie_echo_chunk {
361163953Srrs	struct sctp_chunkhdr ch;
362163953Srrs	struct sctp_state_cookie cookie;
363170606Srrs}                      SCTP_PACKED;
364163953Srrs
365163953Srrs/* Cookie Acknowledgment (COOKIE ACK) */
366163953Srrsstruct sctp_cookie_ack_chunk {
367163953Srrs	struct sctp_chunkhdr ch;
368170606Srrs}                     SCTP_PACKED;
369163953Srrs
370163953Srrs/* Explicit Congestion Notification Echo (ECNE) */
371163953Srrsstruct sctp_ecne_chunk {
372163953Srrs	struct sctp_chunkhdr ch;
373163953Srrs	uint32_t tsn;
374170606Srrs}               SCTP_PACKED;
375163953Srrs
376163953Srrs/* Congestion Window Reduced (CWR) */
377163953Srrsstruct sctp_cwr_chunk {
378163953Srrs	struct sctp_chunkhdr ch;
379163953Srrs	uint32_t tsn;
380170606Srrs}              SCTP_PACKED;
381163953Srrs
382163953Srrs/* Shutdown Complete (SHUTDOWN COMPLETE) */
383163953Srrsstruct sctp_shutdown_complete_chunk {
384163953Srrs	struct sctp_chunkhdr ch;
385170606Srrs}                            SCTP_PACKED;
386163953Srrs
387163953Srrs/* Oper error holding a stale cookie */
388163953Srrsstruct sctp_stale_cookie_msg {
389163953Srrs	struct sctp_paramhdr ph;/* really an error cause */
390163953Srrs	uint32_t time_usec;
391170606Srrs}                     SCTP_PACKED;
392163953Srrs
393163953Srrsstruct sctp_adaptation_layer_indication {
394163953Srrs	struct sctp_paramhdr ph;
395163953Srrs	uint32_t indication;
396170606Srrs}                                SCTP_PACKED;
397163953Srrs
398163953Srrsstruct sctp_cookie_while_shutting_down {
399163953Srrs	struct sctphdr sh;
400163953Srrs	struct sctp_chunkhdr ch;
401163953Srrs	struct sctp_paramhdr ph;/* really an error cause */
402170606Srrs}                               SCTP_PACKED;
403163953Srrs
404163953Srrsstruct sctp_shutdown_complete_msg {
405163953Srrs	struct sctphdr sh;
406163953Srrs	struct sctp_shutdown_complete_chunk shut_cmp;
407170606Srrs}                          SCTP_PACKED;
408163953Srrs
409163953Srrs/*
410163953Srrs * draft-ietf-tsvwg-addip-sctp
411163953Srrs */
412163953Srrs/* Address/Stream Configuration Change (ASCONF) */
413163953Srrsstruct sctp_asconf_chunk {
414163953Srrs	struct sctp_chunkhdr ch;
415163953Srrs	uint32_t serial_number;
416163953Srrs	/* lookup address parameter (mandatory) */
417163953Srrs	/* asconf parameters follow */
418170606Srrs}                 SCTP_PACKED;
419163953Srrs
420163953Srrs/* Address/Stream Configuration Acknowledge (ASCONF ACK) */
421163953Srrsstruct sctp_asconf_ack_chunk {
422163953Srrs	struct sctp_chunkhdr ch;
423163953Srrs	uint32_t serial_number;
424163953Srrs	/* asconf parameters follow */
425170606Srrs}                     SCTP_PACKED;
426163953Srrs
427163953Srrs/* draft-ietf-tsvwg-prsctp */
428163953Srrs/* Forward Cumulative TSN (FORWARD TSN) */
429163953Srrsstruct sctp_forward_tsn_chunk {
430163953Srrs	struct sctp_chunkhdr ch;
431163953Srrs	uint32_t new_cumulative_tsn;
432163953Srrs	/* stream/sequence pairs (sctp_strseq) follow */
433170606Srrs}                      SCTP_PACKED;
434163953Srrs
435163953Srrsstruct sctp_strseq {
436163953Srrs	uint16_t stream;
437163953Srrs	uint16_t sequence;
438170606Srrs}           SCTP_PACKED;
439163953Srrs
440163953Srrsstruct sctp_forward_tsn_msg {
441163953Srrs	struct sctphdr sh;
442163953Srrs	struct sctp_forward_tsn_chunk msg;
443170606Srrs}                    SCTP_PACKED;
444163953Srrs
445163953Srrs/* should be a multiple of 4 - 1 aka 3/7/11 etc. */
446163953Srrs
447163953Srrs#define SCTP_NUM_DB_TO_VERIFY 31
448163953Srrs
449163953Srrsstruct sctp_chunk_desc {
450163953Srrs	uint8_t chunk_type;
451163953Srrs	uint8_t data_bytes[SCTP_NUM_DB_TO_VERIFY];
452163953Srrs	uint32_t tsn_ifany;
453170606Srrs}               SCTP_PACKED;
454163953Srrs
455163953Srrs
456163953Srrsstruct sctp_pktdrop_chunk {
457163953Srrs	struct sctp_chunkhdr ch;
458163953Srrs	uint32_t bottle_bw;
459163953Srrs	uint32_t current_onq;
460163953Srrs	uint16_t trunc_len;
461163953Srrs	uint16_t reserved;
462163953Srrs	uint8_t data[0];
463170606Srrs}                  SCTP_PACKED;
464163953Srrs
465163953Srrs/**********STREAM RESET STUFF ******************/
466163953Srrs
467163953Srrsstruct sctp_stream_reset_out_request {
468163953Srrs	struct sctp_paramhdr ph;
469163953Srrs	uint32_t request_seq;	/* monotonically increasing seq no */
470163953Srrs	uint32_t response_seq;	/* if a response, the resp seq no */
471163953Srrs	uint32_t send_reset_at_tsn;	/* last TSN I assigned outbound */
472163953Srrs	uint16_t list_of_streams[0];	/* if not all list of streams */
473170606Srrs}                             SCTP_PACKED;
474163953Srrs
475163953Srrsstruct sctp_stream_reset_in_request {
476163953Srrs	struct sctp_paramhdr ph;
477163953Srrs	uint32_t request_seq;
478163953Srrs	uint16_t list_of_streams[0];	/* if not all list of streams */
479170606Srrs}                            SCTP_PACKED;
480163953Srrs
481163953Srrs
482163953Srrsstruct sctp_stream_reset_tsn_request {
483163953Srrs	struct sctp_paramhdr ph;
484163953Srrs	uint32_t request_seq;
485170606Srrs}                             SCTP_PACKED;
486163953Srrs
487163953Srrsstruct sctp_stream_reset_response {
488163953Srrs	struct sctp_paramhdr ph;
489163953Srrs	uint32_t response_seq;	/* if a response, the resp seq no */
490163953Srrs	uint32_t result;
491170606Srrs}                          SCTP_PACKED;
492163953Srrs
493163953Srrsstruct sctp_stream_reset_response_tsn {
494163953Srrs	struct sctp_paramhdr ph;
495163953Srrs	uint32_t response_seq;	/* if a response, the resp seq no */
496163953Srrs	uint32_t result;
497163953Srrs	uint32_t senders_next_tsn;
498163953Srrs	uint32_t receivers_next_tsn;
499170606Srrs}                              SCTP_PACKED;
500163953Srrs
501188854Srrsstruct sctp_stream_reset_add_strm {
502188854Srrs	struct sctp_paramhdr ph;
503188854Srrs	uint32_t request_seq;
504188854Srrs	uint16_t number_of_streams;
505188854Srrs	uint16_t reserved;
506188854Srrs};
507163953Srrs
508163953Srrs#define SCTP_STREAM_RESET_NOTHING   0x00000000	/* Nothing for me to do */
509163953Srrs#define SCTP_STREAM_RESET_PERFORMED 0x00000001	/* Did it */
510163953Srrs#define SCTP_STREAM_RESET_DENIED    0x00000002	/* refused to do it */
511163953Srrs#define SCTP_STREAM_RESET_ERROR_STR 0x00000003	/* bad Stream no */
512163953Srrs#define SCTP_STREAM_RESET_TRY_LATER 0x00000004	/* collision, try again */
513163953Srrs#define SCTP_STREAM_RESET_BAD_SEQNO 0x00000005	/* bad str-reset seq no */
514163953Srrs
515163953Srrs/*
516163953Srrs * convience structures, note that if you are making a request for specific
517163953Srrs * streams then the request will need to be an overlay structure.
518163953Srrs */
519163953Srrs
520163953Srrsstruct sctp_stream_reset_out_req {
521163953Srrs	struct sctp_chunkhdr ch;
522163953Srrs	struct sctp_stream_reset_out_request sr_req;
523170606Srrs}                         SCTP_PACKED;
524163953Srrs
525163953Srrsstruct sctp_stream_reset_in_req {
526163953Srrs	struct sctp_chunkhdr ch;
527163953Srrs	struct sctp_stream_reset_in_request sr_req;
528170606Srrs}                        SCTP_PACKED;
529163953Srrs
530163953Srrsstruct sctp_stream_reset_tsn_req {
531163953Srrs	struct sctp_chunkhdr ch;
532163953Srrs	struct sctp_stream_reset_tsn_request sr_req;
533170606Srrs}                         SCTP_PACKED;
534163953Srrs
535163953Srrsstruct sctp_stream_reset_resp {
536163953Srrs	struct sctp_chunkhdr ch;
537163953Srrs	struct sctp_stream_reset_response sr_resp;
538170606Srrs}                      SCTP_PACKED;
539163953Srrs
540163953Srrs/* respone only valid with a TSN request */
541163953Srrsstruct sctp_stream_reset_resp_tsn {
542163953Srrs	struct sctp_chunkhdr ch;
543163953Srrs	struct sctp_stream_reset_response_tsn sr_resp;
544170606Srrs}                          SCTP_PACKED;
545163953Srrs
546163953Srrs/****************************************************/
547163953Srrs
548163953Srrs/*
549163953Srrs * Authenticated chunks support draft-ietf-tsvwg-sctp-auth
550163953Srrs */
551169208Srrs
552169208Srrs/* Should we make the max be 32? */
553169208Srrs#define SCTP_RANDOM_MAX_SIZE 256
554163953Srrsstruct sctp_auth_random {
555163953Srrs	struct sctp_paramhdr ph;/* type = 0x8002 */
556163953Srrs	uint8_t random_data[0];
557170606Srrs}                SCTP_PACKED;
558163953Srrs
559163953Srrsstruct sctp_auth_chunk_list {
560163953Srrs	struct sctp_paramhdr ph;/* type = 0x8003 */
561163953Srrs	uint8_t chunk_types[0];
562170606Srrs}                    SCTP_PACKED;
563163953Srrs
564163953Srrsstruct sctp_auth_hmac_algo {
565163953Srrs	struct sctp_paramhdr ph;/* type = 0x8004 */
566163953Srrs	uint16_t hmac_ids[0];
567170606Srrs}                   SCTP_PACKED;
568163953Srrs
569163953Srrsstruct sctp_auth_chunk {
570163953Srrs	struct sctp_chunkhdr ch;
571163953Srrs	uint16_t shared_key_id;
572163953Srrs	uint16_t hmac_id;
573163953Srrs	uint8_t hmac[0];
574170606Srrs}               SCTP_PACKED;
575163953Srrs
576163953Srrsstruct sctp_auth_invalid_hmac {
577163953Srrs	struct sctp_paramhdr ph;
578163953Srrs	uint16_t hmac_id;
579163953Srrs	uint16_t padding;
580170606Srrs}                      SCTP_PACKED;
581163953Srrs
582163953Srrs/*
583163953Srrs * we pre-reserve enough room for a ECNE or CWR AND a SACK with no missing
584163953Srrs * pieces. If ENCE is missing we could have a couple of blocks. This way we
585163953Srrs * optimize so we MOST likely can bundle a SACK/ECN with the smallest size
586163953Srrs * data chunk I will split into. We could increase throughput slightly by
587163953Srrs * taking out these two but the  24-sack/8-CWR i.e. 32 bytes I pre-reserve I
588163953Srrs * feel is worth it for now.
589163953Srrs */
590163953Srrs#ifndef SCTP_MAX_OVERHEAD
591167598Srrs#ifdef INET6
592163953Srrs#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
593163953Srrs			   sizeof(struct sctphdr) + \
594163953Srrs			   sizeof(struct sctp_ecne_chunk) + \
595163953Srrs			   sizeof(struct sctp_sack_chunk) + \
596163953Srrs			   sizeof(struct ip6_hdr))
597163953Srrs
598163953Srrs#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
599163953Srrs			   sizeof(struct sctphdr) + \
600163953Srrs			   sizeof(struct ip6_hdr))
601163953Srrs
602163953Srrs
603163953Srrs#define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \
604163953Srrs			   sizeof(struct sctphdr))
605163953Srrs
606163953Srrs#else
607163953Srrs#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
608163953Srrs			   sizeof(struct sctphdr) + \
609163953Srrs			   sizeof(struct sctp_ecne_chunk) + \
610163953Srrs			   sizeof(struct sctp_sack_chunk) + \
611163953Srrs			   sizeof(struct ip))
612163953Srrs
613163953Srrs#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
614163953Srrs			   sizeof(struct sctphdr) + \
615163953Srrs			   sizeof(struct ip))
616163953Srrs
617163953Srrs
618163953Srrs#define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \
619163953Srrs			   sizeof(struct sctphdr))
620163953Srrs
621167598Srrs#endif				/* INET6 */
622163953Srrs#endif				/* !SCTP_MAX_OVERHEAD */
623163953Srrs
624163953Srrs#define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \
625163953Srrs			      sizeof(struct sctphdr) + \
626163953Srrs			      sizeof(struct ip))
627163953Srrs
628163953Srrs#define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \
629163953Srrs			      sizeof(struct sctphdr))
630163953Srrs
631179783Srrs#undef SCTP_PACKED
632163953Srrs#endif				/* !__sctp_header_h__ */
633