Home | History | Annotate | Line # | Download | only in netinet
      1  1.1      rjs /*	$KAME: sctp_header.h,v 1.14 2005/03/06 16:04:17 itojun Exp $	*/
      2  1.4   andvar /*	$NetBSD: sctp_header.h,v 1.4 2023/12/08 21:46:02 andvar Exp $ */
      3  1.1      rjs 
      4  1.1      rjs #ifndef __SCTP_HEADER_H__
      5  1.1      rjs #define __SCTP_HEADER_H__
      6  1.1      rjs 
      7  1.1      rjs /*
      8  1.1      rjs  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
      9  1.1      rjs  * All rights reserved.
     10  1.1      rjs  *
     11  1.1      rjs  * Redistribution and use in source and binary forms, with or without
     12  1.1      rjs  * modification, are permitted provided that the following conditions
     13  1.1      rjs  * are met:
     14  1.1      rjs  * 1. Redistributions of source code must retain the above copyright
     15  1.1      rjs  *    notice, this list of conditions and the following disclaimer.
     16  1.1      rjs  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.1      rjs  *    notice, this list of conditions and the following disclaimer in the
     18  1.1      rjs  *    documentation and/or other materials provided with the distribution.
     19  1.1      rjs  * 3. All advertising materials mentioning features or use of this software
     20  1.1      rjs  *    must display the following acknowledgement:
     21  1.1      rjs  *      This product includes software developed by Cisco Systems, Inc.
     22  1.1      rjs  * 4. Neither the name of the project nor the names of its contributors
     23  1.1      rjs  *    may be used to endorse or promote products derived from this software
     24  1.1      rjs  *    without specific prior written permission.
     25  1.1      rjs  *
     26  1.1      rjs  * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
     27  1.1      rjs  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28  1.1      rjs  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29  1.1      rjs  * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
     30  1.1      rjs  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31  1.1      rjs  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32  1.1      rjs  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33  1.1      rjs  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34  1.1      rjs  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35  1.1      rjs  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36  1.1      rjs  * SUCH DAMAGE.
     37  1.1      rjs  */
     38  1.1      rjs 
     39  1.1      rjs #include <sys/time.h>
     40  1.1      rjs #include <netinet/sctp.h>
     41  1.1      rjs #include <netinet/sctp_constants.h>
     42  1.1      rjs 
     43  1.1      rjs /*
     44  1.1      rjs  * Parameter structures
     45  1.1      rjs  */
     46  1.1      rjs struct sctp_ipv4addr_param {
     47  1.1      rjs 	struct sctp_paramhdr ph;	/* type=SCTP_IPV4_PARAM_TYPE, len=8 */
     48  1.1      rjs 	u_int32_t addr;			/* IPV4 address */
     49  1.2      rjs } __packed;
     50  1.1      rjs 
     51  1.1      rjs struct sctp_ipv6addr_param {
     52  1.1      rjs 	struct sctp_paramhdr ph;	/* type=SCTP_IPV6_PARAM_TYPE, len=20 */
     53  1.1      rjs 	u_int8_t  addr[16];		/* IPV6 address */
     54  1.2      rjs } __packed;
     55  1.1      rjs 
     56  1.1      rjs /* Cookie Preservative */
     57  1.1      rjs struct sctp_cookie_perserve_param {
     58  1.1      rjs 	struct sctp_paramhdr ph;	/* type=SCTP_COOKIE_PRESERVE, len=8 */
     59  1.1      rjs 	u_int32_t time;			/* time in ms to extend cookie */
     60  1.2      rjs } __packed;
     61  1.1      rjs 
     62  1.1      rjs /* Host Name Address */
     63  1.1      rjs struct sctp_host_name_param {
     64  1.1      rjs 	struct sctp_paramhdr ph;	/* type=SCTP_HOSTNAME_ADDRESS */
     65  1.1      rjs 	char name[1];			/* host name */
     66  1.2      rjs } __packed;
     67  1.1      rjs 
     68  1.1      rjs /* supported address type */
     69  1.1      rjs struct sctp_supported_addr_param {
     70  1.1      rjs 	struct sctp_paramhdr ph;	/* type=SCTP_SUPPORTED_ADDRTYPE */
     71  1.1      rjs 	u_int16_t addr_type[1];		/* array of supported address types */
     72  1.2      rjs } __packed;
     73  1.1      rjs 
     74  1.1      rjs /* ECN parameter */
     75  1.1      rjs struct sctp_ecn_supported_param {
     76  1.1      rjs 	struct sctp_paramhdr ph;	/* type=SCTP_ECN_CAPABLE */
     77  1.2      rjs } __packed;
     78  1.1      rjs 
     79  1.1      rjs 
     80  1.1      rjs /* heartbeat info parameter */
     81  1.1      rjs struct sctp_heartbeat_info_param {
     82  1.1      rjs 	struct sctp_paramhdr ph;
     83  1.1      rjs 	u_int32_t time_value_1;
     84  1.1      rjs 	u_int32_t time_value_2;
     85  1.1      rjs 	u_int32_t random_value1;
     86  1.1      rjs 	u_int32_t random_value2;
     87  1.1      rjs 	u_int16_t user_req;
     88  1.1      rjs 	u_int8_t addr_family;
     89  1.1      rjs 	u_int8_t addr_len;
     90  1.1      rjs 	char address[SCTP_ADDRMAX];
     91  1.2      rjs } __packed;
     92  1.1      rjs 
     93  1.1      rjs 
     94  1.1      rjs /* draft-ietf-tsvwg-prsctp */
     95  1.1      rjs /* PR-SCTP supported parameter */
     96  1.1      rjs struct sctp_prsctp_supported_param {
     97  1.1      rjs 	struct sctp_paramhdr ph;
     98  1.2      rjs } __packed;
     99  1.1      rjs 
    100  1.1      rjs 
    101  1.1      rjs /* draft-ietf-tsvwg-addip-sctp */
    102  1.1      rjs struct sctp_asconf_paramhdr {		/* an ASCONF "parameter" */
    103  1.1      rjs 	struct sctp_paramhdr ph;	/* a SCTP parameter header */
    104  1.1      rjs 	u_int32_t correlation_id;	/* correlation id for this param */
    105  1.2      rjs } __packed;
    106  1.1      rjs 
    107  1.1      rjs struct sctp_asconf_addr_param {		/* an ASCONF address parameter */
    108  1.1      rjs 	struct sctp_asconf_paramhdr aph;	/* asconf "parameter" */
    109  1.1      rjs 	struct sctp_ipv6addr_param  addrp;	/* max storage size */
    110  1.2      rjs } __packed;
    111  1.1      rjs 
    112  1.1      rjs struct sctp_asconf_addrv4_param {		/* an ASCONF address (v4) parameter */
    113  1.1      rjs 	struct sctp_asconf_paramhdr aph;	/* asconf "parameter" */
    114  1.1      rjs 	struct sctp_ipv4addr_param  addrp;	/* max storage size */
    115  1.2      rjs } __packed;
    116  1.1      rjs 
    117  1.1      rjs 
    118  1.1      rjs /* ECN Nonce: draft-ladha-sctp-ecn-nonce */
    119  1.1      rjs struct sctp_ecn_nonce_supported_param {
    120  1.1      rjs 	struct sctp_paramhdr ph;	/* type = 0x8001  len = 4 */
    121  1.2      rjs } __packed;
    122  1.1      rjs 
    123  1.1      rjs struct sctp_supported_chunk_types_param {
    124  1.1      rjs 	struct sctp_paramhdr ph;	/* type = 0x8002  len = x */
    125  1.1      rjs 	u_int8_t chunk_types[0];
    126  1.2      rjs } __packed;
    127  1.1      rjs 
    128  1.1      rjs /*
    129  1.1      rjs  * Structures for DATA chunks
    130  1.1      rjs  */
    131  1.1      rjs struct sctp_data {
    132  1.1      rjs 	u_int32_t tsn;
    133  1.1      rjs 	u_int16_t stream_id;
    134  1.1      rjs 	u_int16_t stream_sequence;
    135  1.1      rjs 	u_int32_t protocol_id;
    136  1.1      rjs 	/* user data follows */
    137  1.2      rjs } __packed;
    138  1.1      rjs 
    139  1.1      rjs struct sctp_data_chunk {
    140  1.1      rjs 	struct sctp_chunkhdr ch;
    141  1.1      rjs 	struct sctp_data dp;
    142  1.2      rjs } __packed;
    143  1.1      rjs 
    144  1.1      rjs /*
    145  1.1      rjs  * Structures for the control chunks
    146  1.1      rjs  */
    147  1.1      rjs 
    148  1.1      rjs /* Initiate (INIT)/Initiate Ack (INIT ACK) */
    149  1.1      rjs struct sctp_init {
    150  1.1      rjs 	u_int32_t initiate_tag;		/* initiate tag */
    151  1.1      rjs 	u_int32_t a_rwnd;		/* a_rwnd */
    152  1.1      rjs 	u_int16_t num_outbound_streams;	/* OS */
    153  1.1      rjs 	u_int16_t num_inbound_streams;	/* MIS */
    154  1.1      rjs 	u_int32_t initial_tsn;		/* I-TSN */
    155  1.1      rjs 	/* optional param's follow */
    156  1.2      rjs } __packed;
    157  1.1      rjs 
    158  1.1      rjs /* state cookie header */
    159  1.1      rjs struct sctp_state_cookie {		/* this is our definition... */
    160  1.1      rjs 	u_int8_t  identification[16];	/* id of who we are */
    161  1.1      rjs 	u_int32_t cookie_life;		/* life I will award this cookie */
    162  1.1      rjs 	u_int32_t tie_tag_my_vtag;	/* my tag in old association */
    163  1.1      rjs 	u_int32_t tie_tag_peer_vtag;	/* peers tag in old association */
    164  1.1      rjs 	u_int32_t peers_vtag;		/* peers tag in INIT (for quick ref) */
    165  1.1      rjs 	u_int32_t my_vtag;		/* my tag in INIT-ACK (for quick ref) */
    166  1.1      rjs 	struct timeval time_entered;	/* the time I built cookie */
    167  1.1      rjs 	u_int32_t address[4];		/* 4 ints/128 bits */
    168  1.1      rjs 	u_int32_t addr_type;		/* address type */
    169  1.1      rjs 	u_int32_t laddress[4];		/* my local from address */
    170  1.1      rjs 	u_int32_t laddr_type;		/* my local from address type */
    171  1.1      rjs 	u_int32_t scope_id;		/* v6 scope id for link-locals */
    172  1.1      rjs 	u_int16_t peerport;		/* port address of the peer in the INIT */
    173  1.1      rjs 	u_int16_t myport;		/* my port address used in the INIT */
    174  1.1      rjs 	u_int8_t ipv4_addr_legal;	/* Are V4 addr legal? */
    175  1.1      rjs 	u_int8_t ipv6_addr_legal;	/* Are V6 addr legal? */
    176  1.1      rjs 	u_int8_t local_scope;		/* IPv6 local scope flag */
    177  1.1      rjs 	u_int8_t site_scope;		/* IPv6 site scope flag */
    178  1.1      rjs 	u_int8_t ipv4_scope;		/* IPv4 private addr scope */
    179  1.1      rjs 	u_int8_t loopback_scope;	/* loopback scope information */
    180  1.1      rjs 	u_int16_t reserved;
    181  1.1      rjs 	/*
    182  1.1      rjs 	 * at the end is tacked on the INIT chunk and the
    183  1.1      rjs 	 * INIT-ACK chunk (minus the cookie).
    184  1.1      rjs 	 */
    185  1.2      rjs } __packed;
    186  1.1      rjs 
    187  1.1      rjs struct sctp_inv_mandatory_param {
    188  1.1      rjs 	u_int16_t cause;
    189  1.1      rjs 	u_int16_t length;
    190  1.1      rjs 	u_int32_t num_param;
    191  1.1      rjs 	u_int16_t param;
    192  1.1      rjs 	/*
    193  1.1      rjs 	 * We include this to 0 it since only a missing cookie
    194  1.1      rjs 	 * will cause this error.
    195  1.1      rjs 	 */
    196  1.1      rjs 	u_int16_t resv;
    197  1.2      rjs } __packed;
    198  1.1      rjs 
    199  1.1      rjs struct sctp_unresolv_addr {
    200  1.1      rjs 	u_int16_t cause;
    201  1.1      rjs 	u_int16_t length;
    202  1.1      rjs 	u_int16_t addr_type;
    203  1.1      rjs 	u_int16_t reserved;	/* Only one invalid addr type */
    204  1.2      rjs } __packed;
    205  1.1      rjs 
    206  1.1      rjs /* state cookie parameter */
    207  1.1      rjs struct sctp_state_cookie_param {
    208  1.1      rjs 	struct sctp_paramhdr ph;
    209  1.1      rjs 	struct sctp_state_cookie cookie;
    210  1.2      rjs } __packed;
    211  1.1      rjs 
    212  1.1      rjs struct sctp_init_chunk {
    213  1.1      rjs 	struct sctp_chunkhdr ch;
    214  1.1      rjs 	struct sctp_init init;
    215  1.2      rjs } __packed;
    216  1.1      rjs 
    217  1.1      rjs struct sctp_init_msg {
    218  1.1      rjs 	struct sctphdr sh;
    219  1.1      rjs 	struct sctp_init_chunk msg;
    220  1.2      rjs } __packed;
    221  1.1      rjs /* ... used for both INIT and INIT ACK */
    222  1.1      rjs #define sctp_init_ack		sctp_init
    223  1.1      rjs #define sctp_init_ack_chunk	sctp_init_chunk
    224  1.1      rjs #define sctp_init_ack_msg	sctp_init_msg
    225  1.1      rjs 
    226  1.1      rjs 
    227  1.1      rjs /* Selective Ack (SACK) */
    228  1.1      rjs struct sctp_gap_ack_block {
    229  1.1      rjs 	u_int16_t start;		/* Gap Ack block start */
    230  1.1      rjs 	u_int16_t end;			/* Gap Ack block end */
    231  1.2      rjs } __packed;
    232  1.1      rjs 
    233  1.1      rjs struct sctp_sack {
    234  1.1      rjs 	u_int32_t cum_tsn_ack;		/* cumulative TSN Ack */
    235  1.1      rjs 	u_int32_t a_rwnd;		/* updated a_rwnd of sender */
    236  1.1      rjs 	u_int16_t num_gap_ack_blks;	/* number of Gap Ack blocks */
    237  1.1      rjs 	u_int16_t num_dup_tsns;		/* number of duplicate TSNs */
    238  1.1      rjs 	/* struct sctp_gap_ack_block's follow */
    239  1.1      rjs 	/* u_int32_t duplicate_tsn's follow */
    240  1.2      rjs } __packed;
    241  1.1      rjs 
    242  1.1      rjs struct sctp_sack_chunk {
    243  1.1      rjs 	struct sctp_chunkhdr ch;
    244  1.1      rjs 	struct sctp_sack sack;
    245  1.2      rjs } __packed;
    246  1.1      rjs 
    247  1.1      rjs 
    248  1.1      rjs /* Heartbeat Request (HEARTBEAT) */
    249  1.1      rjs struct sctp_heartbeat {
    250  1.1      rjs 	struct sctp_heartbeat_info_param hb_info;
    251  1.2      rjs } __packed;
    252  1.1      rjs 
    253  1.1      rjs struct sctp_heartbeat_chunk {
    254  1.1      rjs 	struct sctp_chunkhdr ch;
    255  1.1      rjs 	struct sctp_heartbeat heartbeat;
    256  1.2      rjs } __packed;
    257  1.1      rjs /* ... used for Heartbeat Ack (HEARTBEAT ACK) */
    258  1.1      rjs #define sctp_heartbeat_ack		sctp_heartbeat
    259  1.1      rjs #define sctp_heartbeat_ack_chunk	sctp_heartbeat_chunk
    260  1.1      rjs 
    261  1.1      rjs 
    262  1.4   andvar /* Abort Association (ABORT) */
    263  1.1      rjs struct sctp_abort_chunk {
    264  1.1      rjs 	struct sctp_chunkhdr ch;
    265  1.1      rjs 	/* optional error cause may follow */
    266  1.2      rjs } __packed;
    267  1.1      rjs 
    268  1.1      rjs struct sctp_abort_msg {
    269  1.1      rjs 	struct sctphdr sh;
    270  1.1      rjs 	struct sctp_abort_chunk msg;
    271  1.2      rjs } __packed;
    272  1.1      rjs 
    273  1.1      rjs 
    274  1.1      rjs /* Shutdown Association (SHUTDOWN) */
    275  1.1      rjs struct sctp_shutdown_chunk {
    276  1.1      rjs 	struct sctp_chunkhdr ch;
    277  1.1      rjs 	u_int32_t cumulative_tsn_ack;
    278  1.2      rjs } __packed;
    279  1.1      rjs 
    280  1.1      rjs 
    281  1.1      rjs /* Shutdown Acknowledgment (SHUTDOWN ACK) */
    282  1.1      rjs struct sctp_shutdown_ack_chunk {
    283  1.1      rjs 	struct sctp_chunkhdr ch;
    284  1.2      rjs } __packed;
    285  1.1      rjs 
    286  1.1      rjs 
    287  1.1      rjs /* Operation Error (ERROR) */
    288  1.1      rjs struct sctp_error_chunk {
    289  1.1      rjs 	struct sctp_chunkhdr ch;
    290  1.1      rjs 	/* optional error causes follow */
    291  1.2      rjs } __packed;
    292  1.1      rjs 
    293  1.1      rjs 
    294  1.1      rjs /* Cookie Echo (COOKIE ECHO) */
    295  1.1      rjs struct sctp_cookie_echo_chunk {
    296  1.1      rjs 	struct sctp_chunkhdr ch;
    297  1.1      rjs 	struct sctp_state_cookie cookie;
    298  1.2      rjs } __packed;
    299  1.1      rjs 
    300  1.1      rjs /* Cookie Acknowledgment (COOKIE ACK) */
    301  1.1      rjs struct sctp_cookie_ack_chunk {
    302  1.1      rjs 	struct sctp_chunkhdr ch;
    303  1.2      rjs } __packed;
    304  1.1      rjs 
    305  1.1      rjs /* Explicit Congestion Notification Echo (ECNE) */
    306  1.1      rjs struct sctp_ecne_chunk {
    307  1.1      rjs 	struct sctp_chunkhdr ch;
    308  1.1      rjs 	u_int32_t tsn;
    309  1.2      rjs } __packed;
    310  1.1      rjs 
    311  1.1      rjs /* Congestion Window Reduced (CWR) */
    312  1.1      rjs struct sctp_cwr_chunk {
    313  1.1      rjs 	struct sctp_chunkhdr ch;
    314  1.1      rjs 	u_int32_t tsn;
    315  1.2      rjs } __packed;
    316  1.1      rjs 
    317  1.1      rjs /* Shutdown Complete (SHUTDOWN COMPLETE) */
    318  1.1      rjs struct sctp_shutdown_complete_chunk {
    319  1.1      rjs 	struct sctp_chunkhdr ch;
    320  1.2      rjs } __packed;
    321  1.1      rjs 
    322  1.1      rjs /* Oper error holding a stale cookie */
    323  1.1      rjs struct sctp_stale_cookie_msg {
    324  1.1      rjs 	struct sctp_paramhdr ph;	/* really an error cause */
    325  1.1      rjs 	u_int32_t time_usec;
    326  1.2      rjs } __packed;
    327  1.1      rjs 
    328  1.1      rjs struct sctp_adaption_layer_indication {
    329  1.1      rjs 	struct sctp_paramhdr ph;
    330  1.1      rjs 	u_int32_t indication;
    331  1.2      rjs } __packed;
    332  1.1      rjs 
    333  1.1      rjs struct sctp_cookie_while_shutting_down {
    334  1.1      rjs 	struct sctphdr sh;
    335  1.1      rjs 	struct sctp_chunkhdr ch;
    336  1.1      rjs 	struct sctp_paramhdr ph;	/* really an error cause */
    337  1.2      rjs } __packed;
    338  1.1      rjs 
    339  1.1      rjs struct sctp_shutdown_complete_msg {
    340  1.1      rjs 	struct sctphdr sh;
    341  1.1      rjs 	struct sctp_shutdown_complete_chunk shut_cmp;
    342  1.2      rjs } __packed;
    343  1.1      rjs 
    344  1.1      rjs /* draft-ietf-tsvwg-addip-sctp */
    345  1.1      rjs /* Address/Stream Configuration Change (ASCONF) */
    346  1.1      rjs struct sctp_asconf_chunk {
    347  1.1      rjs 	struct sctp_chunkhdr ch;
    348  1.1      rjs 	u_int32_t serial_number;
    349  1.1      rjs 	/* lookup address parameter (mandatory) */
    350  1.1      rjs 	/* asconf parameters follow */
    351  1.2      rjs } __packed;
    352  1.1      rjs 
    353  1.1      rjs /* Address/Stream Configuration Acknowledge (ASCONF ACK) */
    354  1.1      rjs struct sctp_asconf_ack_chunk {
    355  1.1      rjs 	struct sctp_chunkhdr ch;
    356  1.1      rjs 	u_int32_t serial_number;
    357  1.1      rjs 	/* asconf parameters follow */
    358  1.2      rjs } __packed;
    359  1.1      rjs 
    360  1.1      rjs /* draft-ietf-tsvwg-prsctp */
    361  1.1      rjs /* Forward Cumulative TSN (FORWARD TSN) */
    362  1.1      rjs struct sctp_forward_tsn_chunk {
    363  1.1      rjs 	struct sctp_chunkhdr ch;
    364  1.1      rjs 	u_int32_t new_cumulative_tsn;
    365  1.1      rjs 	/* stream/sequence pairs (sctp_strseq) follow */
    366  1.2      rjs } __packed;
    367  1.1      rjs 
    368  1.1      rjs struct sctp_strseq {
    369  1.1      rjs 	u_int16_t stream;
    370  1.1      rjs 	u_int16_t sequence;
    371  1.2      rjs } __packed;
    372  1.1      rjs 
    373  1.1      rjs struct sctp_forward_tsn_msg {
    374  1.1      rjs 	struct sctphdr sh;
    375  1.1      rjs 	struct sctp_forward_tsn_chunk msg;
    376  1.2      rjs } __packed;
    377  1.1      rjs 
    378  1.1      rjs /* should be a multiple of 4 - 1 aka 3/7/11 etc. */
    379  1.1      rjs 
    380  1.1      rjs #define SCTP_NUM_DB_TO_VERIFY 3
    381  1.1      rjs 
    382  1.1      rjs struct sctp_chunk_desc {
    383  1.1      rjs 	u_int8_t chunk_type;
    384  1.1      rjs 	u_int8_t data_bytes[SCTP_NUM_DB_TO_VERIFY];
    385  1.1      rjs 	u_int32_t tsn_ifany;
    386  1.2      rjs } __packed;
    387  1.1      rjs 
    388  1.1      rjs 
    389  1.1      rjs struct sctp_pktdrop_chunk {
    390  1.1      rjs 	struct sctp_chunkhdr ch;
    391  1.1      rjs 	u_int32_t bottle_bw;
    392  1.1      rjs 	u_int32_t current_onq;
    393  1.1      rjs 	u_int16_t trunc_len;
    394  1.1      rjs 	u_int16_t reserved;
    395  1.1      rjs 	u_int8_t data[0];
    396  1.2      rjs } __packed;
    397  1.1      rjs 
    398  1.1      rjs #define SCTP_RESET_YOUR  0x01   /* reset your streams and send response */
    399  1.1      rjs #define SCTP_RESET_ALL   0x02   /* reset all of your streams */
    400  1.1      rjs #define SCTP_RECIPRICAL  0x04   /* reset my streams too */
    401  1.1      rjs 
    402  1.1      rjs struct sctp_stream_reset_request {
    403  1.1      rjs 	struct sctp_paramhdr ph;
    404  1.1      rjs 	u_int8_t reset_flags;		   /* actual request */
    405  1.1      rjs 	u_int8_t reset_pad[3];
    406  1.1      rjs 	u_int32_t reset_req_seq;           /* monotonically increasing seq no */
    407  1.1      rjs 	u_int16_t list_of_streams[0];      /* if not all list of streams */
    408  1.2      rjs } __packed;
    409  1.1      rjs 
    410  1.1      rjs #define SCTP_RESET_PERFORMED        0x01   /* Peers sending str was reset */
    411  1.1      rjs #define SCTP_RESET_DENIED           0x02   /* Asked for but refused       */
    412  1.1      rjs 
    413  1.1      rjs struct sctp_stream_reset_response {
    414  1.1      rjs 	struct sctp_paramhdr ph;
    415  1.1      rjs 	u_int8_t reset_flags;		   /* actual request */
    416  1.1      rjs 	u_int8_t reset_pad[3];
    417  1.1      rjs 	u_int32_t reset_req_seq_resp;   /* copied from reset_req reset_req_seq */
    418  1.1      rjs 	u_int32_t reset_at_tsn;		/* resetters next TSN to be assigned send wise */
    419  1.1      rjs 	u_int32_t cumulative_tsn;	/* resetters cum-ack point receive wise */
    420  1.1      rjs 	u_int16_t list_of_streams[0];   /* if not all list of streams */
    421  1.2      rjs } __packed;
    422  1.1      rjs 
    423  1.3  msaitoh /* convenience structures, note that if you
    424  1.1      rjs  * are making a request for specific streams
    425  1.1      rjs  * then the request will need to be an overlay
    426  1.1      rjs  * structure.
    427  1.1      rjs  */
    428  1.1      rjs 
    429  1.1      rjs struct sctp_stream_reset_req {
    430  1.1      rjs 	struct sctp_chunkhdr ch;
    431  1.1      rjs 	struct sctp_stream_reset_request sr_req;
    432  1.2      rjs } __packed;
    433  1.1      rjs 
    434  1.1      rjs struct sctp_stream_reset_resp {
    435  1.1      rjs 	struct sctp_chunkhdr ch;
    436  1.1      rjs 	struct sctp_stream_reset_response sr_resp;
    437  1.2      rjs } __packed;
    438  1.1      rjs 
    439  1.1      rjs 
    440  1.1      rjs /*
    441  1.1      rjs  * we pre-reserve enough room for a ECNE or CWR AND a SACK with no
    442  1.1      rjs  * missing pieces. If ENCE is missing we could have a couple of blocks.
    443  1.1      rjs  * This way we optimize so we MOST likely can bundle a SACK/ECN with
    444  1.1      rjs  * the smallest size data chunk I will split into. We could increase
    445  1.1      rjs  * throughput slightly by taking out these two but the  24-sack/8-CWR
    446  1.1      rjs  * i.e. 32 bytes I pre-reserve I feel is worth it for now.
    447  1.1      rjs  */
    448  1.1      rjs #ifndef SCTP_MAX_OVERHEAD
    449  1.1      rjs #ifdef AF_INET6
    450  1.1      rjs #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
    451  1.1      rjs 			   sizeof(struct sctphdr) + \
    452  1.1      rjs 			   sizeof(struct sctp_ecne_chunk) + \
    453  1.1      rjs 			   sizeof(struct sctp_sack_chunk) + \
    454  1.1      rjs 			   sizeof(struct ip6_hdr))
    455  1.1      rjs 
    456  1.1      rjs #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
    457  1.1      rjs 			   sizeof(struct sctphdr) + \
    458  1.1      rjs 			   sizeof(struct ip6_hdr))
    459  1.1      rjs 
    460  1.1      rjs 
    461  1.1      rjs #define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \
    462  1.1      rjs 			   sizeof(struct sctphdr))
    463  1.1      rjs 
    464  1.1      rjs #else
    465  1.1      rjs #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
    466  1.1      rjs 			   sizeof(struct sctphdr) + \
    467  1.1      rjs 			   sizeof(struct sctp_ecne_chunk) + \
    468  1.1      rjs 			   sizeof(struct sctp_sack_chunk) + \
    469  1.1      rjs 			   sizeof(struct ip))
    470  1.1      rjs 
    471  1.1      rjs #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
    472  1.1      rjs 			   sizeof(struct sctphdr) + \
    473  1.1      rjs 			   sizeof(struct ip))
    474  1.1      rjs 
    475  1.1      rjs 
    476  1.1      rjs #define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \
    477  1.1      rjs 			   sizeof(struct sctphdr))
    478  1.1      rjs 
    479  1.1      rjs #endif /* AF_INET6 */
    480  1.1      rjs #endif /* !SCTP_MAX_OVERHEAD */
    481  1.1      rjs 
    482  1.1      rjs #define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \
    483  1.1      rjs 			      sizeof(struct sctphdr) + \
    484  1.1      rjs 			      sizeof(struct ip))
    485  1.1      rjs 
    486  1.1      rjs #define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \
    487  1.1      rjs 			      sizeof(struct sctphdr))
    488  1.1      rjs 
    489  1.1      rjs #endif /* !__SCTP_HEADER_H__ */
    490