xref: /netbsd-src/sys/netinet/sctp_header.h (revision 5e4abe6a3f6b12b3229ab05a50d046d14c92e85a)
18c2654abSrjs /*	$KAME: sctp_header.h,v 1.14 2005/03/06 16:04:17 itojun Exp $	*/
2*5e4abe6aSandvar /*	$NetBSD: sctp_header.h,v 1.4 2023/12/08 21:46:02 andvar Exp $ */
38c2654abSrjs 
48c2654abSrjs #ifndef __SCTP_HEADER_H__
58c2654abSrjs #define __SCTP_HEADER_H__
68c2654abSrjs 
78c2654abSrjs /*
88c2654abSrjs  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
98c2654abSrjs  * All rights reserved.
108c2654abSrjs  *
118c2654abSrjs  * Redistribution and use in source and binary forms, with or without
128c2654abSrjs  * modification, are permitted provided that the following conditions
138c2654abSrjs  * are met:
148c2654abSrjs  * 1. Redistributions of source code must retain the above copyright
158c2654abSrjs  *    notice, this list of conditions and the following disclaimer.
168c2654abSrjs  * 2. Redistributions in binary form must reproduce the above copyright
178c2654abSrjs  *    notice, this list of conditions and the following disclaimer in the
188c2654abSrjs  *    documentation and/or other materials provided with the distribution.
198c2654abSrjs  * 3. All advertising materials mentioning features or use of this software
208c2654abSrjs  *    must display the following acknowledgement:
218c2654abSrjs  *      This product includes software developed by Cisco Systems, Inc.
228c2654abSrjs  * 4. Neither the name of the project nor the names of its contributors
238c2654abSrjs  *    may be used to endorse or promote products derived from this software
248c2654abSrjs  *    without specific prior written permission.
258c2654abSrjs  *
268c2654abSrjs  * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
278c2654abSrjs  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
288c2654abSrjs  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
298c2654abSrjs  * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
308c2654abSrjs  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
318c2654abSrjs  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
328c2654abSrjs  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
338c2654abSrjs  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
348c2654abSrjs  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
358c2654abSrjs  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
368c2654abSrjs  * SUCH DAMAGE.
378c2654abSrjs  */
388c2654abSrjs 
398c2654abSrjs #include <sys/time.h>
408c2654abSrjs #include <netinet/sctp.h>
418c2654abSrjs #include <netinet/sctp_constants.h>
428c2654abSrjs 
438c2654abSrjs /*
448c2654abSrjs  * Parameter structures
458c2654abSrjs  */
468c2654abSrjs struct sctp_ipv4addr_param {
478c2654abSrjs 	struct sctp_paramhdr ph;	/* type=SCTP_IPV4_PARAM_TYPE, len=8 */
488c2654abSrjs 	u_int32_t addr;			/* IPV4 address */
49849d0171Srjs } __packed;
508c2654abSrjs 
518c2654abSrjs struct sctp_ipv6addr_param {
528c2654abSrjs 	struct sctp_paramhdr ph;	/* type=SCTP_IPV6_PARAM_TYPE, len=20 */
538c2654abSrjs 	u_int8_t  addr[16];		/* IPV6 address */
54849d0171Srjs } __packed;
558c2654abSrjs 
568c2654abSrjs /* Cookie Preservative */
578c2654abSrjs struct sctp_cookie_perserve_param {
588c2654abSrjs 	struct sctp_paramhdr ph;	/* type=SCTP_COOKIE_PRESERVE, len=8 */
598c2654abSrjs 	u_int32_t time;			/* time in ms to extend cookie */
60849d0171Srjs } __packed;
618c2654abSrjs 
628c2654abSrjs /* Host Name Address */
638c2654abSrjs struct sctp_host_name_param {
648c2654abSrjs 	struct sctp_paramhdr ph;	/* type=SCTP_HOSTNAME_ADDRESS */
658c2654abSrjs 	char name[1];			/* host name */
66849d0171Srjs } __packed;
678c2654abSrjs 
688c2654abSrjs /* supported address type */
698c2654abSrjs struct sctp_supported_addr_param {
708c2654abSrjs 	struct sctp_paramhdr ph;	/* type=SCTP_SUPPORTED_ADDRTYPE */
718c2654abSrjs 	u_int16_t addr_type[1];		/* array of supported address types */
72849d0171Srjs } __packed;
738c2654abSrjs 
748c2654abSrjs /* ECN parameter */
758c2654abSrjs struct sctp_ecn_supported_param {
768c2654abSrjs 	struct sctp_paramhdr ph;	/* type=SCTP_ECN_CAPABLE */
77849d0171Srjs } __packed;
788c2654abSrjs 
798c2654abSrjs 
808c2654abSrjs /* heartbeat info parameter */
818c2654abSrjs struct sctp_heartbeat_info_param {
828c2654abSrjs 	struct sctp_paramhdr ph;
838c2654abSrjs 	u_int32_t time_value_1;
848c2654abSrjs 	u_int32_t time_value_2;
858c2654abSrjs 	u_int32_t random_value1;
868c2654abSrjs 	u_int32_t random_value2;
878c2654abSrjs 	u_int16_t user_req;
888c2654abSrjs 	u_int8_t addr_family;
898c2654abSrjs 	u_int8_t addr_len;
908c2654abSrjs 	char address[SCTP_ADDRMAX];
91849d0171Srjs } __packed;
928c2654abSrjs 
938c2654abSrjs 
948c2654abSrjs /* draft-ietf-tsvwg-prsctp */
958c2654abSrjs /* PR-SCTP supported parameter */
968c2654abSrjs struct sctp_prsctp_supported_param {
978c2654abSrjs 	struct sctp_paramhdr ph;
98849d0171Srjs } __packed;
998c2654abSrjs 
1008c2654abSrjs 
1018c2654abSrjs /* draft-ietf-tsvwg-addip-sctp */
1028c2654abSrjs struct sctp_asconf_paramhdr {		/* an ASCONF "parameter" */
1038c2654abSrjs 	struct sctp_paramhdr ph;	/* a SCTP parameter header */
1048c2654abSrjs 	u_int32_t correlation_id;	/* correlation id for this param */
105849d0171Srjs } __packed;
1068c2654abSrjs 
1078c2654abSrjs struct sctp_asconf_addr_param {		/* an ASCONF address parameter */
1088c2654abSrjs 	struct sctp_asconf_paramhdr aph;	/* asconf "parameter" */
1098c2654abSrjs 	struct sctp_ipv6addr_param  addrp;	/* max storage size */
110849d0171Srjs } __packed;
1118c2654abSrjs 
1128c2654abSrjs struct sctp_asconf_addrv4_param {		/* an ASCONF address (v4) parameter */
1138c2654abSrjs 	struct sctp_asconf_paramhdr aph;	/* asconf "parameter" */
1148c2654abSrjs 	struct sctp_ipv4addr_param  addrp;	/* max storage size */
115849d0171Srjs } __packed;
1168c2654abSrjs 
1178c2654abSrjs 
1188c2654abSrjs /* ECN Nonce: draft-ladha-sctp-ecn-nonce */
1198c2654abSrjs struct sctp_ecn_nonce_supported_param {
1208c2654abSrjs 	struct sctp_paramhdr ph;	/* type = 0x8001  len = 4 */
121849d0171Srjs } __packed;
1228c2654abSrjs 
1238c2654abSrjs struct sctp_supported_chunk_types_param {
1248c2654abSrjs 	struct sctp_paramhdr ph;	/* type = 0x8002  len = x */
1258c2654abSrjs 	u_int8_t chunk_types[0];
126849d0171Srjs } __packed;
1278c2654abSrjs 
1288c2654abSrjs /*
1298c2654abSrjs  * Structures for DATA chunks
1308c2654abSrjs  */
1318c2654abSrjs struct sctp_data {
1328c2654abSrjs 	u_int32_t tsn;
1338c2654abSrjs 	u_int16_t stream_id;
1348c2654abSrjs 	u_int16_t stream_sequence;
1358c2654abSrjs 	u_int32_t protocol_id;
1368c2654abSrjs 	/* user data follows */
137849d0171Srjs } __packed;
1388c2654abSrjs 
1398c2654abSrjs struct sctp_data_chunk {
1408c2654abSrjs 	struct sctp_chunkhdr ch;
1418c2654abSrjs 	struct sctp_data dp;
142849d0171Srjs } __packed;
1438c2654abSrjs 
1448c2654abSrjs /*
1458c2654abSrjs  * Structures for the control chunks
1468c2654abSrjs  */
1478c2654abSrjs 
1488c2654abSrjs /* Initiate (INIT)/Initiate Ack (INIT ACK) */
1498c2654abSrjs struct sctp_init {
1508c2654abSrjs 	u_int32_t initiate_tag;		/* initiate tag */
1518c2654abSrjs 	u_int32_t a_rwnd;		/* a_rwnd */
1528c2654abSrjs 	u_int16_t num_outbound_streams;	/* OS */
1538c2654abSrjs 	u_int16_t num_inbound_streams;	/* MIS */
1548c2654abSrjs 	u_int32_t initial_tsn;		/* I-TSN */
1558c2654abSrjs 	/* optional param's follow */
156849d0171Srjs } __packed;
1578c2654abSrjs 
1588c2654abSrjs /* state cookie header */
1598c2654abSrjs struct sctp_state_cookie {		/* this is our definition... */
1608c2654abSrjs 	u_int8_t  identification[16];	/* id of who we are */
1618c2654abSrjs 	u_int32_t cookie_life;		/* life I will award this cookie */
1628c2654abSrjs 	u_int32_t tie_tag_my_vtag;	/* my tag in old association */
1638c2654abSrjs 	u_int32_t tie_tag_peer_vtag;	/* peers tag in old association */
1648c2654abSrjs 	u_int32_t peers_vtag;		/* peers tag in INIT (for quick ref) */
1658c2654abSrjs 	u_int32_t my_vtag;		/* my tag in INIT-ACK (for quick ref) */
1668c2654abSrjs 	struct timeval time_entered;	/* the time I built cookie */
1678c2654abSrjs 	u_int32_t address[4];		/* 4 ints/128 bits */
1688c2654abSrjs 	u_int32_t addr_type;		/* address type */
1698c2654abSrjs 	u_int32_t laddress[4];		/* my local from address */
1708c2654abSrjs 	u_int32_t laddr_type;		/* my local from address type */
1718c2654abSrjs 	u_int32_t scope_id;		/* v6 scope id for link-locals */
1728c2654abSrjs 	u_int16_t peerport;		/* port address of the peer in the INIT */
1738c2654abSrjs 	u_int16_t myport;		/* my port address used in the INIT */
1748c2654abSrjs 	u_int8_t ipv4_addr_legal;	/* Are V4 addr legal? */
1758c2654abSrjs 	u_int8_t ipv6_addr_legal;	/* Are V6 addr legal? */
1768c2654abSrjs 	u_int8_t local_scope;		/* IPv6 local scope flag */
1778c2654abSrjs 	u_int8_t site_scope;		/* IPv6 site scope flag */
1788c2654abSrjs 	u_int8_t ipv4_scope;		/* IPv4 private addr scope */
1798c2654abSrjs 	u_int8_t loopback_scope;	/* loopback scope information */
1808c2654abSrjs 	u_int16_t reserved;
1818c2654abSrjs 	/*
1828c2654abSrjs 	 * at the end is tacked on the INIT chunk and the
1838c2654abSrjs 	 * INIT-ACK chunk (minus the cookie).
1848c2654abSrjs 	 */
185849d0171Srjs } __packed;
1868c2654abSrjs 
1878c2654abSrjs struct sctp_inv_mandatory_param {
1888c2654abSrjs 	u_int16_t cause;
1898c2654abSrjs 	u_int16_t length;
1908c2654abSrjs 	u_int32_t num_param;
1918c2654abSrjs 	u_int16_t param;
1928c2654abSrjs 	/*
1938c2654abSrjs 	 * We include this to 0 it since only a missing cookie
1948c2654abSrjs 	 * will cause this error.
1958c2654abSrjs 	 */
1968c2654abSrjs 	u_int16_t resv;
197849d0171Srjs } __packed;
1988c2654abSrjs 
1998c2654abSrjs struct sctp_unresolv_addr {
2008c2654abSrjs 	u_int16_t cause;
2018c2654abSrjs 	u_int16_t length;
2028c2654abSrjs 	u_int16_t addr_type;
2038c2654abSrjs 	u_int16_t reserved;	/* Only one invalid addr type */
204849d0171Srjs } __packed;
2058c2654abSrjs 
2068c2654abSrjs /* state cookie parameter */
2078c2654abSrjs struct sctp_state_cookie_param {
2088c2654abSrjs 	struct sctp_paramhdr ph;
2098c2654abSrjs 	struct sctp_state_cookie cookie;
210849d0171Srjs } __packed;
2118c2654abSrjs 
2128c2654abSrjs struct sctp_init_chunk {
2138c2654abSrjs 	struct sctp_chunkhdr ch;
2148c2654abSrjs 	struct sctp_init init;
215849d0171Srjs } __packed;
2168c2654abSrjs 
2178c2654abSrjs struct sctp_init_msg {
2188c2654abSrjs 	struct sctphdr sh;
2198c2654abSrjs 	struct sctp_init_chunk msg;
220849d0171Srjs } __packed;
2218c2654abSrjs /* ... used for both INIT and INIT ACK */
2228c2654abSrjs #define sctp_init_ack		sctp_init
2238c2654abSrjs #define sctp_init_ack_chunk	sctp_init_chunk
2248c2654abSrjs #define sctp_init_ack_msg	sctp_init_msg
2258c2654abSrjs 
2268c2654abSrjs 
2278c2654abSrjs /* Selective Ack (SACK) */
2288c2654abSrjs struct sctp_gap_ack_block {
2298c2654abSrjs 	u_int16_t start;		/* Gap Ack block start */
2308c2654abSrjs 	u_int16_t end;			/* Gap Ack block end */
231849d0171Srjs } __packed;
2328c2654abSrjs 
2338c2654abSrjs struct sctp_sack {
2348c2654abSrjs 	u_int32_t cum_tsn_ack;		/* cumulative TSN Ack */
2358c2654abSrjs 	u_int32_t a_rwnd;		/* updated a_rwnd of sender */
2368c2654abSrjs 	u_int16_t num_gap_ack_blks;	/* number of Gap Ack blocks */
2378c2654abSrjs 	u_int16_t num_dup_tsns;		/* number of duplicate TSNs */
2388c2654abSrjs 	/* struct sctp_gap_ack_block's follow */
2398c2654abSrjs 	/* u_int32_t duplicate_tsn's follow */
240849d0171Srjs } __packed;
2418c2654abSrjs 
2428c2654abSrjs struct sctp_sack_chunk {
2438c2654abSrjs 	struct sctp_chunkhdr ch;
2448c2654abSrjs 	struct sctp_sack sack;
245849d0171Srjs } __packed;
2468c2654abSrjs 
2478c2654abSrjs 
2488c2654abSrjs /* Heartbeat Request (HEARTBEAT) */
2498c2654abSrjs struct sctp_heartbeat {
2508c2654abSrjs 	struct sctp_heartbeat_info_param hb_info;
251849d0171Srjs } __packed;
2528c2654abSrjs 
2538c2654abSrjs struct sctp_heartbeat_chunk {
2548c2654abSrjs 	struct sctp_chunkhdr ch;
2558c2654abSrjs 	struct sctp_heartbeat heartbeat;
256849d0171Srjs } __packed;
2578c2654abSrjs /* ... used for Heartbeat Ack (HEARTBEAT ACK) */
2588c2654abSrjs #define sctp_heartbeat_ack		sctp_heartbeat
2598c2654abSrjs #define sctp_heartbeat_ack_chunk	sctp_heartbeat_chunk
2608c2654abSrjs 
2618c2654abSrjs 
262*5e4abe6aSandvar /* Abort Association (ABORT) */
2638c2654abSrjs struct sctp_abort_chunk {
2648c2654abSrjs 	struct sctp_chunkhdr ch;
2658c2654abSrjs 	/* optional error cause may follow */
266849d0171Srjs } __packed;
2678c2654abSrjs 
2688c2654abSrjs struct sctp_abort_msg {
2698c2654abSrjs 	struct sctphdr sh;
2708c2654abSrjs 	struct sctp_abort_chunk msg;
271849d0171Srjs } __packed;
2728c2654abSrjs 
2738c2654abSrjs 
2748c2654abSrjs /* Shutdown Association (SHUTDOWN) */
2758c2654abSrjs struct sctp_shutdown_chunk {
2768c2654abSrjs 	struct sctp_chunkhdr ch;
2778c2654abSrjs 	u_int32_t cumulative_tsn_ack;
278849d0171Srjs } __packed;
2798c2654abSrjs 
2808c2654abSrjs 
2818c2654abSrjs /* Shutdown Acknowledgment (SHUTDOWN ACK) */
2828c2654abSrjs struct sctp_shutdown_ack_chunk {
2838c2654abSrjs 	struct sctp_chunkhdr ch;
284849d0171Srjs } __packed;
2858c2654abSrjs 
2868c2654abSrjs 
2878c2654abSrjs /* Operation Error (ERROR) */
2888c2654abSrjs struct sctp_error_chunk {
2898c2654abSrjs 	struct sctp_chunkhdr ch;
2908c2654abSrjs 	/* optional error causes follow */
291849d0171Srjs } __packed;
2928c2654abSrjs 
2938c2654abSrjs 
2948c2654abSrjs /* Cookie Echo (COOKIE ECHO) */
2958c2654abSrjs struct sctp_cookie_echo_chunk {
2968c2654abSrjs 	struct sctp_chunkhdr ch;
2978c2654abSrjs 	struct sctp_state_cookie cookie;
298849d0171Srjs } __packed;
2998c2654abSrjs 
3008c2654abSrjs /* Cookie Acknowledgment (COOKIE ACK) */
3018c2654abSrjs struct sctp_cookie_ack_chunk {
3028c2654abSrjs 	struct sctp_chunkhdr ch;
303849d0171Srjs } __packed;
3048c2654abSrjs 
3058c2654abSrjs /* Explicit Congestion Notification Echo (ECNE) */
3068c2654abSrjs struct sctp_ecne_chunk {
3078c2654abSrjs 	struct sctp_chunkhdr ch;
3088c2654abSrjs 	u_int32_t tsn;
309849d0171Srjs } __packed;
3108c2654abSrjs 
3118c2654abSrjs /* Congestion Window Reduced (CWR) */
3128c2654abSrjs struct sctp_cwr_chunk {
3138c2654abSrjs 	struct sctp_chunkhdr ch;
3148c2654abSrjs 	u_int32_t tsn;
315849d0171Srjs } __packed;
3168c2654abSrjs 
3178c2654abSrjs /* Shutdown Complete (SHUTDOWN COMPLETE) */
3188c2654abSrjs struct sctp_shutdown_complete_chunk {
3198c2654abSrjs 	struct sctp_chunkhdr ch;
320849d0171Srjs } __packed;
3218c2654abSrjs 
3228c2654abSrjs /* Oper error holding a stale cookie */
3238c2654abSrjs struct sctp_stale_cookie_msg {
3248c2654abSrjs 	struct sctp_paramhdr ph;	/* really an error cause */
3258c2654abSrjs 	u_int32_t time_usec;
326849d0171Srjs } __packed;
3278c2654abSrjs 
3288c2654abSrjs struct sctp_adaption_layer_indication {
3298c2654abSrjs 	struct sctp_paramhdr ph;
3308c2654abSrjs 	u_int32_t indication;
331849d0171Srjs } __packed;
3328c2654abSrjs 
3338c2654abSrjs struct sctp_cookie_while_shutting_down {
3348c2654abSrjs 	struct sctphdr sh;
3358c2654abSrjs 	struct sctp_chunkhdr ch;
3368c2654abSrjs 	struct sctp_paramhdr ph;	/* really an error cause */
337849d0171Srjs } __packed;
3388c2654abSrjs 
3398c2654abSrjs struct sctp_shutdown_complete_msg {
3408c2654abSrjs 	struct sctphdr sh;
3418c2654abSrjs 	struct sctp_shutdown_complete_chunk shut_cmp;
342849d0171Srjs } __packed;
3438c2654abSrjs 
3448c2654abSrjs /* draft-ietf-tsvwg-addip-sctp */
3458c2654abSrjs /* Address/Stream Configuration Change (ASCONF) */
3468c2654abSrjs struct sctp_asconf_chunk {
3478c2654abSrjs 	struct sctp_chunkhdr ch;
3488c2654abSrjs 	u_int32_t serial_number;
3498c2654abSrjs 	/* lookup address parameter (mandatory) */
3508c2654abSrjs 	/* asconf parameters follow */
351849d0171Srjs } __packed;
3528c2654abSrjs 
3538c2654abSrjs /* Address/Stream Configuration Acknowledge (ASCONF ACK) */
3548c2654abSrjs struct sctp_asconf_ack_chunk {
3558c2654abSrjs 	struct sctp_chunkhdr ch;
3568c2654abSrjs 	u_int32_t serial_number;
3578c2654abSrjs 	/* asconf parameters follow */
358849d0171Srjs } __packed;
3598c2654abSrjs 
3608c2654abSrjs /* draft-ietf-tsvwg-prsctp */
3618c2654abSrjs /* Forward Cumulative TSN (FORWARD TSN) */
3628c2654abSrjs struct sctp_forward_tsn_chunk {
3638c2654abSrjs 	struct sctp_chunkhdr ch;
3648c2654abSrjs 	u_int32_t new_cumulative_tsn;
3658c2654abSrjs 	/* stream/sequence pairs (sctp_strseq) follow */
366849d0171Srjs } __packed;
3678c2654abSrjs 
3688c2654abSrjs struct sctp_strseq {
3698c2654abSrjs 	u_int16_t stream;
3708c2654abSrjs 	u_int16_t sequence;
371849d0171Srjs } __packed;
3728c2654abSrjs 
3738c2654abSrjs struct sctp_forward_tsn_msg {
3748c2654abSrjs 	struct sctphdr sh;
3758c2654abSrjs 	struct sctp_forward_tsn_chunk msg;
376849d0171Srjs } __packed;
3778c2654abSrjs 
3788c2654abSrjs /* should be a multiple of 4 - 1 aka 3/7/11 etc. */
3798c2654abSrjs 
3808c2654abSrjs #define SCTP_NUM_DB_TO_VERIFY 3
3818c2654abSrjs 
3828c2654abSrjs struct sctp_chunk_desc {
3838c2654abSrjs 	u_int8_t chunk_type;
3848c2654abSrjs 	u_int8_t data_bytes[SCTP_NUM_DB_TO_VERIFY];
3858c2654abSrjs 	u_int32_t tsn_ifany;
386849d0171Srjs } __packed;
3878c2654abSrjs 
3888c2654abSrjs 
3898c2654abSrjs struct sctp_pktdrop_chunk {
3908c2654abSrjs 	struct sctp_chunkhdr ch;
3918c2654abSrjs 	u_int32_t bottle_bw;
3928c2654abSrjs 	u_int32_t current_onq;
3938c2654abSrjs 	u_int16_t trunc_len;
3948c2654abSrjs 	u_int16_t reserved;
3958c2654abSrjs 	u_int8_t data[0];
396849d0171Srjs } __packed;
3978c2654abSrjs 
3988c2654abSrjs #define SCTP_RESET_YOUR  0x01   /* reset your streams and send response */
3998c2654abSrjs #define SCTP_RESET_ALL   0x02   /* reset all of your streams */
4008c2654abSrjs #define SCTP_RECIPRICAL  0x04   /* reset my streams too */
4018c2654abSrjs 
4028c2654abSrjs struct sctp_stream_reset_request {
4038c2654abSrjs 	struct sctp_paramhdr ph;
4048c2654abSrjs 	u_int8_t reset_flags;		   /* actual request */
4058c2654abSrjs 	u_int8_t reset_pad[3];
4068c2654abSrjs 	u_int32_t reset_req_seq;           /* monotonically increasing seq no */
4078c2654abSrjs 	u_int16_t list_of_streams[0];      /* if not all list of streams */
408849d0171Srjs } __packed;
4098c2654abSrjs 
4108c2654abSrjs #define SCTP_RESET_PERFORMED        0x01   /* Peers sending str was reset */
4118c2654abSrjs #define SCTP_RESET_DENIED           0x02   /* Asked for but refused       */
4128c2654abSrjs 
4138c2654abSrjs struct sctp_stream_reset_response {
4148c2654abSrjs 	struct sctp_paramhdr ph;
4158c2654abSrjs 	u_int8_t reset_flags;		   /* actual request */
4168c2654abSrjs 	u_int8_t reset_pad[3];
4178c2654abSrjs 	u_int32_t reset_req_seq_resp;   /* copied from reset_req reset_req_seq */
4188c2654abSrjs 	u_int32_t reset_at_tsn;		/* resetters next TSN to be assigned send wise */
4198c2654abSrjs 	u_int32_t cumulative_tsn;	/* resetters cum-ack point receive wise */
4208c2654abSrjs 	u_int16_t list_of_streams[0];   /* if not all list of streams */
421849d0171Srjs } __packed;
4228c2654abSrjs 
423ca40522aSmsaitoh /* convenience structures, note that if you
4248c2654abSrjs  * are making a request for specific streams
4258c2654abSrjs  * then the request will need to be an overlay
4268c2654abSrjs  * structure.
4278c2654abSrjs  */
4288c2654abSrjs 
4298c2654abSrjs struct sctp_stream_reset_req {
4308c2654abSrjs 	struct sctp_chunkhdr ch;
4318c2654abSrjs 	struct sctp_stream_reset_request sr_req;
432849d0171Srjs } __packed;
4338c2654abSrjs 
4348c2654abSrjs struct sctp_stream_reset_resp {
4358c2654abSrjs 	struct sctp_chunkhdr ch;
4368c2654abSrjs 	struct sctp_stream_reset_response sr_resp;
437849d0171Srjs } __packed;
4388c2654abSrjs 
4398c2654abSrjs 
4408c2654abSrjs /*
4418c2654abSrjs  * we pre-reserve enough room for a ECNE or CWR AND a SACK with no
4428c2654abSrjs  * missing pieces. If ENCE is missing we could have a couple of blocks.
4438c2654abSrjs  * This way we optimize so we MOST likely can bundle a SACK/ECN with
4448c2654abSrjs  * the smallest size data chunk I will split into. We could increase
4458c2654abSrjs  * throughput slightly by taking out these two but the  24-sack/8-CWR
4468c2654abSrjs  * i.e. 32 bytes I pre-reserve I feel is worth it for now.
4478c2654abSrjs  */
4488c2654abSrjs #ifndef SCTP_MAX_OVERHEAD
4498c2654abSrjs #ifdef AF_INET6
4508c2654abSrjs #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
4518c2654abSrjs 			   sizeof(struct sctphdr) + \
4528c2654abSrjs 			   sizeof(struct sctp_ecne_chunk) + \
4538c2654abSrjs 			   sizeof(struct sctp_sack_chunk) + \
4548c2654abSrjs 			   sizeof(struct ip6_hdr))
4558c2654abSrjs 
4568c2654abSrjs #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
4578c2654abSrjs 			   sizeof(struct sctphdr) + \
4588c2654abSrjs 			   sizeof(struct ip6_hdr))
4598c2654abSrjs 
4608c2654abSrjs 
4618c2654abSrjs #define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \
4628c2654abSrjs 			   sizeof(struct sctphdr))
4638c2654abSrjs 
4648c2654abSrjs #else
4658c2654abSrjs #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
4668c2654abSrjs 			   sizeof(struct sctphdr) + \
4678c2654abSrjs 			   sizeof(struct sctp_ecne_chunk) + \
4688c2654abSrjs 			   sizeof(struct sctp_sack_chunk) + \
4698c2654abSrjs 			   sizeof(struct ip))
4708c2654abSrjs 
4718c2654abSrjs #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
4728c2654abSrjs 			   sizeof(struct sctphdr) + \
4738c2654abSrjs 			   sizeof(struct ip))
4748c2654abSrjs 
4758c2654abSrjs 
4768c2654abSrjs #define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \
4778c2654abSrjs 			   sizeof(struct sctphdr))
4788c2654abSrjs 
4798c2654abSrjs #endif /* AF_INET6 */
4808c2654abSrjs #endif /* !SCTP_MAX_OVERHEAD */
4818c2654abSrjs 
4828c2654abSrjs #define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \
4838c2654abSrjs 			      sizeof(struct sctphdr) + \
4848c2654abSrjs 			      sizeof(struct ip))
4858c2654abSrjs 
4868c2654abSrjs #define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \
4878c2654abSrjs 			      sizeof(struct sctphdr))
4888c2654abSrjs 
4898c2654abSrjs #endif /* !__SCTP_HEADER_H__ */
490