sctp_header.h revision 298187
1163953Srrs/*-
2169382Srrs * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
3235828Stuexen * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
4235828Stuexen * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
5163953Srrs *
6163953Srrs * Redistribution and use in source and binary forms, with or without
7163953Srrs * modification, are permitted provided that the following conditions are met:
8163953Srrs *
9163953Srrs * a) Redistributions of source code must retain the above copyright notice,
10228653Stuexen *    this list of conditions and the following disclaimer.
11163953Srrs *
12163953Srrs * b) Redistributions in binary form must reproduce the above copyright
13163953Srrs *    notice, this list of conditions and the following disclaimer in
14228653Stuexen *    the documentation and/or other materials provided with the distribution.
15163953Srrs *
16163953Srrs * c) Neither the name of Cisco Systems, Inc. nor the names of its
17163953Srrs *    contributors may be used to endorse or promote products derived
18163953Srrs *    from this software without specific prior written permission.
19163953Srrs *
20163953Srrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21163953Srrs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22163953Srrs * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23163953Srrs * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24163953Srrs * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25163953Srrs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26163953Srrs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27163953Srrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28163953Srrs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29163953Srrs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30163953Srrs * THE POSSIBILITY OF SUCH DAMAGE.
31163953Srrs */
32163953Srrs
33163953Srrs#include <sys/cdefs.h>
34163953Srrs__FBSDID("$FreeBSD: head/sys/netinet/sctp_header.h 298187 2016-04-18 06:38:53Z tuexen $");
35163953Srrs
36235828Stuexen#ifndef _NETINET_SCTP_HEADER_H_
37235828Stuexen#define _NETINET_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 */
65203847Stuexen}                          SCTP_PACKED;
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 */
82228031Stuexen	uint16_t addr_type[2];	/* array of supported address types */
83170606Srrs}                         SCTP_PACKED;
84163953Srrs
85163953Srrs/* heartbeat info parameter */
86163953Srrsstruct sctp_heartbeat_info_param {
87163953Srrs	struct sctp_paramhdr ph;
88163953Srrs	uint32_t time_value_1;
89163953Srrs	uint32_t time_value_2;
90163953Srrs	uint32_t random_value1;
91163953Srrs	uint32_t random_value2;
92163953Srrs	uint8_t addr_family;
93163953Srrs	uint8_t addr_len;
94224641Stuexen	/* make sure that this structure is 4 byte aligned */
95224641Stuexen	uint8_t padding[2];
96163953Srrs	char address[SCTP_ADDRMAX];
97170606Srrs}                         SCTP_PACKED;
98163953Srrs
99163953Srrs
100163953Srrs/* draft-ietf-tsvwg-prsctp */
101163953Srrs/* PR-SCTP supported parameter */
102163953Srrsstruct sctp_prsctp_supported_param {
103163953Srrs	struct sctp_paramhdr ph;
104170606Srrs}                           SCTP_PACKED;
105163953Srrs
106163953Srrs
107163953Srrs/* draft-ietf-tsvwg-addip-sctp */
108163953Srrsstruct sctp_asconf_paramhdr {	/* an ASCONF "parameter" */
109163953Srrs	struct sctp_paramhdr ph;/* a SCTP parameter header */
110163953Srrs	uint32_t correlation_id;/* correlation id for this param */
111170606Srrs}                    SCTP_PACKED;
112163953Srrs
113163953Srrsstruct sctp_asconf_addr_param {	/* an ASCONF address parameter */
114163953Srrs	struct sctp_asconf_paramhdr aph;	/* asconf "parameter" */
115163953Srrs	struct sctp_ipv6addr_param addrp;	/* max storage size */
116170606Srrs}                      SCTP_PACKED;
117163953Srrs
118185694Srrs
119185694Srrsstruct sctp_asconf_tag_param {	/* an ASCONF NAT-Vtag parameter */
120185694Srrs	struct sctp_asconf_paramhdr aph;	/* asconf "parameter" */
121185694Srrs	uint32_t local_vtag;
122185694Srrs	uint32_t remote_vtag;
123185694Srrs}                     SCTP_PACKED;
124185694Srrs
125185694Srrs
126163953Srrsstruct sctp_asconf_addrv4_param {	/* an ASCONF address (v4) parameter */
127163953Srrs	struct sctp_asconf_paramhdr aph;	/* asconf "parameter" */
128163953Srrs	struct sctp_ipv4addr_param addrp;	/* max storage size */
129170606Srrs}                        SCTP_PACKED;
130163953Srrs
131169208Srrs#define SCTP_MAX_SUPPORTED_EXT 256
132169208Srrs
133163953Srrsstruct sctp_supported_chunk_types_param {
134163953Srrs	struct sctp_paramhdr ph;/* type = 0x8008  len = x */
135202782Stuexen	uint8_t chunk_types[];
136170606Srrs}                                SCTP_PACKED;
137163953Srrs
138163953Srrs
139163953Srrs/*
140163953Srrs * Structures for DATA chunks
141163953Srrs */
142163953Srrsstruct sctp_data {
143163953Srrs	uint32_t tsn;
144163953Srrs	uint16_t stream_id;
145163953Srrs	uint16_t stream_sequence;
146163953Srrs	uint32_t protocol_id;
147163953Srrs	/* user data follows */
148170606Srrs}         SCTP_PACKED;
149163953Srrs
150163953Srrsstruct sctp_data_chunk {
151163953Srrs	struct sctp_chunkhdr ch;
152163953Srrs	struct sctp_data dp;
153170606Srrs}               SCTP_PACKED;
154163953Srrs
155297662Srrsstruct sctp_idata {
156297662Srrs	uint32_t tsn;
157297662Srrs	uint16_t stream_id;
158297662Srrs	uint16_t reserved;	/* Where does the SSN go? */
159297662Srrs	uint32_t msg_id;
160297662Srrs	union {
161297662Srrs		uint32_t protocol_id;
162297662Srrs		uint32_t fsn;	/* Fragment Sequence Number */
163298187Stuexen	}     ppid_fsn;
164297662Srrs	/* user data follows */
165297662Srrs}          SCTP_PACKED;
166297662Srrs
167297662Srrsstruct sctp_idata_chunk {
168297662Srrs	struct sctp_chunkhdr ch;
169297662Srrs	struct sctp_idata dp;
170297662Srrs}                SCTP_PACKED;
171297662Srrs
172163953Srrs/*
173163953Srrs * Structures for the control chunks
174163953Srrs */
175163953Srrs
176163953Srrs/* Initiate (INIT)/Initiate Ack (INIT ACK) */
177163953Srrsstruct sctp_init {
178163953Srrs	uint32_t initiate_tag;	/* initiate tag */
179163953Srrs	uint32_t a_rwnd;	/* a_rwnd */
180163953Srrs	uint16_t num_outbound_streams;	/* OS */
181163953Srrs	uint16_t num_inbound_streams;	/* MIS */
182163953Srrs	uint32_t initial_tsn;	/* I-TSN */
183163953Srrs	/* optional param's follow */
184170606Srrs}         SCTP_PACKED;
185163953Srrs
186167598Srrs#define SCTP_IDENTIFICATION_SIZE 16
187167598Srrs#define SCTP_ADDRESS_SIZE 4
188170606Srrs#define SCTP_RESERVE_SPACE 6
189163953Srrs/* state cookie header */
190163953Srrsstruct sctp_state_cookie {	/* this is our definition... */
191167598Srrs	uint8_t identification[SCTP_IDENTIFICATION_SIZE];	/* id of who we are */
192170606Srrs	struct timeval time_entered;	/* the time I built cookie */
193163953Srrs	uint32_t cookie_life;	/* life I will award this cookie */
194163953Srrs	uint32_t tie_tag_my_vtag;	/* my tag in old association */
195170606Srrs
196163953Srrs	uint32_t tie_tag_peer_vtag;	/* peers tag in old association */
197163953Srrs	uint32_t peers_vtag;	/* peers tag in INIT (for quick ref) */
198170606Srrs
199163953Srrs	uint32_t my_vtag;	/* my tag in INIT-ACK (for quick ref) */
200167598Srrs	uint32_t address[SCTP_ADDRESS_SIZE];	/* 4 ints/128 bits */
201163953Srrs	uint32_t addr_type;	/* address type */
202167598Srrs	uint32_t laddress[SCTP_ADDRESS_SIZE];	/* my local from address */
203163953Srrs	uint32_t laddr_type;	/* my local from address type */
204163953Srrs	uint32_t scope_id;	/* v6 scope id for link-locals */
205170606Srrs
206163953Srrs	uint16_t peerport;	/* port address of the peer in the INIT */
207163953Srrs	uint16_t myport;	/* my port address used in the INIT */
208163953Srrs	uint8_t ipv4_addr_legal;/* Are V4 addr legal? */
209163953Srrs	uint8_t ipv6_addr_legal;/* Are V6 addr legal? */
210163953Srrs	uint8_t local_scope;	/* IPv6 local scope flag */
211163953Srrs	uint8_t site_scope;	/* IPv6 site scope flag */
212170606Srrs
213163953Srrs	uint8_t ipv4_scope;	/* IPv4 private addr scope */
214163953Srrs	uint8_t loopback_scope;	/* loopback scope information */
215170606Srrs	uint8_t reserved[SCTP_RESERVE_SPACE];	/* Align to 64 bits */
216163953Srrs	/*
217163953Srrs	 * at the end is tacked on the INIT chunk and the INIT-ACK chunk
218163953Srrs	 * (minus the cookie).
219163953Srrs	 */
220170606Srrs}                 SCTP_PACKED;
221163953Srrs
222163953Srrs/* state cookie parameter */
223163953Srrsstruct sctp_state_cookie_param {
224163953Srrs	struct sctp_paramhdr ph;
225163953Srrs	struct sctp_state_cookie cookie;
226170606Srrs}                       SCTP_PACKED;
227163953Srrs
228163953Srrsstruct sctp_init_chunk {
229163953Srrs	struct sctp_chunkhdr ch;
230163953Srrs	struct sctp_init init;
231170606Srrs}               SCTP_PACKED;
232163953Srrs
233163953Srrsstruct sctp_init_msg {
234163953Srrs	struct sctphdr sh;
235163953Srrs	struct sctp_init_chunk msg;
236170606Srrs}             SCTP_PACKED;
237163953Srrs
238163953Srrs/* ... used for both INIT and INIT ACK */
239163953Srrs#define sctp_init_ack		sctp_init
240163953Srrs#define sctp_init_ack_chunk	sctp_init_chunk
241163953Srrs#define sctp_init_ack_msg	sctp_init_msg
242163953Srrs
243163953Srrs
244163953Srrs/* Selective Ack (SACK) */
245163953Srrsstruct sctp_gap_ack_block {
246163953Srrs	uint16_t start;		/* Gap Ack block start */
247163953Srrs	uint16_t end;		/* Gap Ack block end */
248170606Srrs}                  SCTP_PACKED;
249163953Srrs
250163953Srrsstruct sctp_sack {
251163953Srrs	uint32_t cum_tsn_ack;	/* cumulative TSN Ack */
252163953Srrs	uint32_t a_rwnd;	/* updated a_rwnd of sender */
253163953Srrs	uint16_t num_gap_ack_blks;	/* number of Gap Ack blocks */
254163953Srrs	uint16_t num_dup_tsns;	/* number of duplicate TSNs */
255163953Srrs	/* struct sctp_gap_ack_block's follow */
256163953Srrs	/* uint32_t duplicate_tsn's follow */
257170606Srrs}         SCTP_PACKED;
258163953Srrs
259163953Srrsstruct sctp_sack_chunk {
260163953Srrs	struct sctp_chunkhdr ch;
261163953Srrs	struct sctp_sack sack;
262170606Srrs}               SCTP_PACKED;
263163953Srrs
264185694Srrsstruct sctp_nr_sack {
265185694Srrs	uint32_t cum_tsn_ack;	/* cumulative TSN Ack */
266185694Srrs	uint32_t a_rwnd;	/* updated a_rwnd of sender */
267185694Srrs	uint16_t num_gap_ack_blks;	/* number of Gap Ack blocks */
268185694Srrs	uint16_t num_nr_gap_ack_blks;	/* number of NR Gap Ack blocks */
269185694Srrs	uint16_t num_dup_tsns;	/* number of duplicate TSNs */
270185694Srrs	uint16_t reserved;	/* not currently used */
271185694Srrs	/* struct sctp_gap_ack_block's follow */
272185694Srrs	/* uint32_t duplicate_tsn's follow */
273185694Srrs}            SCTP_PACKED;
274185694Srrs
275185694Srrsstruct sctp_nr_sack_chunk {
276185694Srrs	struct sctp_chunkhdr ch;
277185694Srrs	struct sctp_nr_sack nr_sack;
278185694Srrs}                  SCTP_PACKED;
279185694Srrs
280185694Srrs
281163953Srrs/* Heartbeat Request (HEARTBEAT) */
282163953Srrsstruct sctp_heartbeat {
283163953Srrs	struct sctp_heartbeat_info_param hb_info;
284170606Srrs}              SCTP_PACKED;
285163953Srrs
286163953Srrsstruct sctp_heartbeat_chunk {
287163953Srrs	struct sctp_chunkhdr ch;
288163953Srrs	struct sctp_heartbeat heartbeat;
289170606Srrs}                    SCTP_PACKED;
290163953Srrs
291163953Srrs/* ... used for Heartbeat Ack (HEARTBEAT ACK) */
292163953Srrs#define sctp_heartbeat_ack		sctp_heartbeat
293163953Srrs#define sctp_heartbeat_ack_chunk	sctp_heartbeat_chunk
294163953Srrs
295163953Srrs
296163953Srrs/* Abort Asssociation (ABORT) */
297163953Srrsstruct sctp_abort_chunk {
298163953Srrs	struct sctp_chunkhdr ch;
299163953Srrs	/* optional error cause may follow */
300170606Srrs}                SCTP_PACKED;
301163953Srrs
302163953Srrsstruct sctp_abort_msg {
303163953Srrs	struct sctphdr sh;
304163953Srrs	struct sctp_abort_chunk msg;
305170606Srrs}              SCTP_PACKED;
306163953Srrs
307163953Srrs
308163953Srrs/* Shutdown Association (SHUTDOWN) */
309163953Srrsstruct sctp_shutdown_chunk {
310163953Srrs	struct sctp_chunkhdr ch;
311163953Srrs	uint32_t cumulative_tsn_ack;
312170606Srrs}                   SCTP_PACKED;
313163953Srrs
314163953Srrs
315163953Srrs/* Shutdown Acknowledgment (SHUTDOWN ACK) */
316163953Srrsstruct sctp_shutdown_ack_chunk {
317163953Srrs	struct sctp_chunkhdr ch;
318170606Srrs}                       SCTP_PACKED;
319163953Srrs
320163953Srrs
321163953Srrs/* Operation Error (ERROR) */
322163953Srrsstruct sctp_error_chunk {
323163953Srrs	struct sctp_chunkhdr ch;
324163953Srrs	/* optional error causes follow */
325170606Srrs}                SCTP_PACKED;
326163953Srrs
327163953Srrs
328163953Srrs/* Cookie Echo (COOKIE ECHO) */
329163953Srrsstruct sctp_cookie_echo_chunk {
330163953Srrs	struct sctp_chunkhdr ch;
331163953Srrs	struct sctp_state_cookie cookie;
332170606Srrs}                      SCTP_PACKED;
333163953Srrs
334163953Srrs/* Cookie Acknowledgment (COOKIE ACK) */
335163953Srrsstruct sctp_cookie_ack_chunk {
336163953Srrs	struct sctp_chunkhdr ch;
337170606Srrs}                     SCTP_PACKED;
338163953Srrs
339163953Srrs/* Explicit Congestion Notification Echo (ECNE) */
340218072Srrsstruct old_sctp_ecne_chunk {
341218072Srrs	struct sctp_chunkhdr ch;
342218072Srrs	uint32_t tsn;
343218072Srrs}                   SCTP_PACKED;
344218072Srrs
345163953Srrsstruct sctp_ecne_chunk {
346163953Srrs	struct sctp_chunkhdr ch;
347163953Srrs	uint32_t tsn;
348218072Srrs	uint32_t num_pkts_since_cwr;
349170606Srrs}               SCTP_PACKED;
350163953Srrs
351163953Srrs/* Congestion Window Reduced (CWR) */
352163953Srrsstruct sctp_cwr_chunk {
353163953Srrs	struct sctp_chunkhdr ch;
354163953Srrs	uint32_t tsn;
355170606Srrs}              SCTP_PACKED;
356163953Srrs
357163953Srrs/* Shutdown Complete (SHUTDOWN COMPLETE) */
358163953Srrsstruct sctp_shutdown_complete_chunk {
359163953Srrs	struct sctp_chunkhdr ch;
360170606Srrs}                            SCTP_PACKED;
361163953Srrs
362163953Srrsstruct sctp_adaptation_layer_indication {
363163953Srrs	struct sctp_paramhdr ph;
364163953Srrs	uint32_t indication;
365170606Srrs}                                SCTP_PACKED;
366163953Srrs
367163953Srrs/*
368163953Srrs * draft-ietf-tsvwg-addip-sctp
369163953Srrs */
370163953Srrs/* Address/Stream Configuration Change (ASCONF) */
371163953Srrsstruct sctp_asconf_chunk {
372163953Srrs	struct sctp_chunkhdr ch;
373163953Srrs	uint32_t serial_number;
374163953Srrs	/* lookup address parameter (mandatory) */
375163953Srrs	/* asconf parameters follow */
376170606Srrs}                 SCTP_PACKED;
377163953Srrs
378163953Srrs/* Address/Stream Configuration Acknowledge (ASCONF ACK) */
379163953Srrsstruct sctp_asconf_ack_chunk {
380163953Srrs	struct sctp_chunkhdr ch;
381163953Srrs	uint32_t serial_number;
382163953Srrs	/* asconf parameters follow */
383170606Srrs}                     SCTP_PACKED;
384163953Srrs
385163953Srrs/* draft-ietf-tsvwg-prsctp */
386163953Srrs/* Forward Cumulative TSN (FORWARD TSN) */
387163953Srrsstruct sctp_forward_tsn_chunk {
388163953Srrs	struct sctp_chunkhdr ch;
389163953Srrs	uint32_t new_cumulative_tsn;
390163953Srrs	/* stream/sequence pairs (sctp_strseq) follow */
391170606Srrs}                      SCTP_PACKED;
392163953Srrs
393163953Srrsstruct sctp_strseq {
394163953Srrs	uint16_t stream;
395163953Srrs	uint16_t sequence;
396170606Srrs}           SCTP_PACKED;
397163953Srrs
398297662Srrsstruct sctp_strseq_mid {
399297662Srrs	uint16_t stream;
400297662Srrs	uint16_t reserved;
401297662Srrs	uint32_t msg_id;
402297662Srrs};
403297662Srrs
404163953Srrsstruct sctp_forward_tsn_msg {
405163953Srrs	struct sctphdr sh;
406163953Srrs	struct sctp_forward_tsn_chunk msg;
407170606Srrs}                    SCTP_PACKED;
408163953Srrs
409163953Srrs/* should be a multiple of 4 - 1 aka 3/7/11 etc. */
410163953Srrs
411163953Srrs#define SCTP_NUM_DB_TO_VERIFY 31
412163953Srrs
413163953Srrsstruct sctp_chunk_desc {
414163953Srrs	uint8_t chunk_type;
415163953Srrs	uint8_t data_bytes[SCTP_NUM_DB_TO_VERIFY];
416163953Srrs	uint32_t tsn_ifany;
417170606Srrs}               SCTP_PACKED;
418163953Srrs
419163953Srrs
420163953Srrsstruct sctp_pktdrop_chunk {
421163953Srrs	struct sctp_chunkhdr ch;
422163953Srrs	uint32_t bottle_bw;
423163953Srrs	uint32_t current_onq;
424163953Srrs	uint16_t trunc_len;
425163953Srrs	uint16_t reserved;
426202782Stuexen	uint8_t data[];
427170606Srrs}                  SCTP_PACKED;
428163953Srrs
429163953Srrs/**********STREAM RESET STUFF ******************/
430163953Srrs
431273168Stuexenstruct sctp_stream_reset_request {
432273168Stuexen	struct sctp_paramhdr ph;
433273168Stuexen	uint32_t request_seq;
434273168Stuexen}                         SCTP_PACKED;
435273168Stuexen
436163953Srrsstruct sctp_stream_reset_out_request {
437163953Srrs	struct sctp_paramhdr ph;
438163953Srrs	uint32_t request_seq;	/* monotonically increasing seq no */
439163953Srrs	uint32_t response_seq;	/* if a response, the resp seq no */
440163953Srrs	uint32_t send_reset_at_tsn;	/* last TSN I assigned outbound */
441202782Stuexen	uint16_t list_of_streams[];	/* if not all list of streams */
442170606Srrs}                             SCTP_PACKED;
443163953Srrs
444163953Srrsstruct sctp_stream_reset_in_request {
445163953Srrs	struct sctp_paramhdr ph;
446163953Srrs	uint32_t request_seq;
447202782Stuexen	uint16_t list_of_streams[];	/* if not all list of streams */
448170606Srrs}                            SCTP_PACKED;
449163953Srrs
450163953Srrsstruct sctp_stream_reset_tsn_request {
451163953Srrs	struct sctp_paramhdr ph;
452163953Srrs	uint32_t request_seq;
453170606Srrs}                             SCTP_PACKED;
454163953Srrs
455163953Srrsstruct sctp_stream_reset_response {
456163953Srrs	struct sctp_paramhdr ph;
457163953Srrs	uint32_t response_seq;	/* if a response, the resp seq no */
458163953Srrs	uint32_t result;
459170606Srrs}                          SCTP_PACKED;
460163953Srrs
461163953Srrsstruct sctp_stream_reset_response_tsn {
462163953Srrs	struct sctp_paramhdr ph;
463163953Srrs	uint32_t response_seq;	/* if a response, the resp seq no */
464163953Srrs	uint32_t result;
465163953Srrs	uint32_t senders_next_tsn;
466163953Srrs	uint32_t receivers_next_tsn;
467170606Srrs}                              SCTP_PACKED;
468163953Srrs
469188854Srrsstruct sctp_stream_reset_add_strm {
470188854Srrs	struct sctp_paramhdr ph;
471188854Srrs	uint32_t request_seq;
472188854Srrs	uint16_t number_of_streams;
473188854Srrs	uint16_t reserved;
474203847Stuexen}                          SCTP_PACKED;
475163953Srrs
476235064Stuexen#define SCTP_STREAM_RESET_RESULT_NOTHING_TO_DO   0x00000000	/* XXX: unused */
477235064Stuexen#define SCTP_STREAM_RESET_RESULT_PERFORMED       0x00000001
478235064Stuexen#define SCTP_STREAM_RESET_RESULT_DENIED          0x00000002
479235064Stuexen#define SCTP_STREAM_RESET_RESULT_ERR__WRONG_SSN  0x00000003	/* XXX: unused */
480235064Stuexen#define SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS 0x00000004
481235064Stuexen#define SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO   0x00000005
482235064Stuexen#define SCTP_STREAM_RESET_RESULT_IN_PROGRESS     0x00000006	/* XXX: unused */
483163953Srrs
484163953Srrs/*
485163953Srrs * convience structures, note that if you are making a request for specific
486163953Srrs * streams then the request will need to be an overlay structure.
487163953Srrs */
488163953Srrs
489163953Srrsstruct sctp_stream_reset_tsn_req {
490163953Srrs	struct sctp_chunkhdr ch;
491163953Srrs	struct sctp_stream_reset_tsn_request sr_req;
492170606Srrs}                         SCTP_PACKED;
493163953Srrs
494163953Srrsstruct sctp_stream_reset_resp {
495163953Srrs	struct sctp_chunkhdr ch;
496163953Srrs	struct sctp_stream_reset_response sr_resp;
497170606Srrs}                      SCTP_PACKED;
498163953Srrs
499163953Srrs/* respone only valid with a TSN request */
500163953Srrsstruct sctp_stream_reset_resp_tsn {
501163953Srrs	struct sctp_chunkhdr ch;
502163953Srrs	struct sctp_stream_reset_response_tsn sr_resp;
503170606Srrs}                          SCTP_PACKED;
504163953Srrs
505163953Srrs/****************************************************/
506163953Srrs
507163953Srrs/*
508163953Srrs * Authenticated chunks support draft-ietf-tsvwg-sctp-auth
509163953Srrs */
510169208Srrs
511169208Srrs/* Should we make the max be 32? */
512169208Srrs#define SCTP_RANDOM_MAX_SIZE 256
513163953Srrsstruct sctp_auth_random {
514163953Srrs	struct sctp_paramhdr ph;/* type = 0x8002 */
515202782Stuexen	uint8_t random_data[];
516170606Srrs}                SCTP_PACKED;
517163953Srrs
518163953Srrsstruct sctp_auth_chunk_list {
519163953Srrs	struct sctp_paramhdr ph;/* type = 0x8003 */
520202782Stuexen	uint8_t chunk_types[];
521170606Srrs}                    SCTP_PACKED;
522163953Srrs
523163953Srrsstruct sctp_auth_hmac_algo {
524163953Srrs	struct sctp_paramhdr ph;/* type = 0x8004 */
525202782Stuexen	uint16_t hmac_ids[];
526170606Srrs}                   SCTP_PACKED;
527163953Srrs
528163953Srrsstruct sctp_auth_chunk {
529163953Srrs	struct sctp_chunkhdr ch;
530163953Srrs	uint16_t shared_key_id;
531163953Srrs	uint16_t hmac_id;
532202782Stuexen	uint8_t hmac[];
533170606Srrs}               SCTP_PACKED;
534163953Srrs
535163953Srrs/*
536163953Srrs * we pre-reserve enough room for a ECNE or CWR AND a SACK with no missing
537163953Srrs * pieces. If ENCE is missing we could have a couple of blocks. This way we
538163953Srrs * optimize so we MOST likely can bundle a SACK/ECN with the smallest size
539163953Srrs * data chunk I will split into. We could increase throughput slightly by
540163953Srrs * taking out these two but the  24-sack/8-CWR i.e. 32 bytes I pre-reserve I
541163953Srrs * feel is worth it for now.
542163953Srrs */
543163953Srrs#ifndef SCTP_MAX_OVERHEAD
544167598Srrs#ifdef INET6
545163953Srrs#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
546163953Srrs			   sizeof(struct sctphdr) + \
547163953Srrs			   sizeof(struct sctp_ecne_chunk) + \
548163953Srrs			   sizeof(struct sctp_sack_chunk) + \
549163953Srrs			   sizeof(struct ip6_hdr))
550163953Srrs
551163953Srrs#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
552163953Srrs			   sizeof(struct sctphdr) + \
553163953Srrs			   sizeof(struct ip6_hdr))
554163953Srrs
555163953Srrs
556163953Srrs#define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \
557163953Srrs			   sizeof(struct sctphdr))
558163953Srrs
559163953Srrs#else
560163953Srrs#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
561163953Srrs			   sizeof(struct sctphdr) + \
562163953Srrs			   sizeof(struct sctp_ecne_chunk) + \
563163953Srrs			   sizeof(struct sctp_sack_chunk) + \
564163953Srrs			   sizeof(struct ip))
565163953Srrs
566163953Srrs#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
567163953Srrs			   sizeof(struct sctphdr) + \
568163953Srrs			   sizeof(struct ip))
569163953Srrs
570163953Srrs
571163953Srrs#define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \
572163953Srrs			   sizeof(struct sctphdr))
573163953Srrs
574167598Srrs#endif				/* INET6 */
575163953Srrs#endif				/* !SCTP_MAX_OVERHEAD */
576163953Srrs
577163953Srrs#define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \
578163953Srrs			      sizeof(struct sctphdr) + \
579163953Srrs			      sizeof(struct ip))
580163953Srrs
581163953Srrs#define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \
582163953Srrs			      sizeof(struct sctphdr))
583163953Srrs
584179783Srrs#undef SCTP_PACKED
585163953Srrs#endif				/* !__sctp_header_h__ */
586