1f8829a4aSRandall Stewart /*- 251369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 351369649SPedro F. Giffuni * 4b1006367SRandall Stewart * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 5807aad63SMichael Tuexen * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 6807aad63SMichael Tuexen * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 7f8829a4aSRandall Stewart * 8f8829a4aSRandall Stewart * Redistribution and use in source and binary forms, with or without 9f8829a4aSRandall Stewart * modification, are permitted provided that the following conditions are met: 10f8829a4aSRandall Stewart * 11f8829a4aSRandall Stewart * a) Redistributions of source code must retain the above copyright notice, 12f8829a4aSRandall Stewart * this list of conditions and the following disclaimer. 13f8829a4aSRandall Stewart * 14f8829a4aSRandall Stewart * b) Redistributions in binary form must reproduce the above copyright 15f8829a4aSRandall Stewart * notice, this list of conditions and the following disclaimer in 16f8829a4aSRandall Stewart * the documentation and/or other materials provided with the distribution. 17f8829a4aSRandall Stewart * 18f8829a4aSRandall Stewart * c) Neither the name of Cisco Systems, Inc. nor the names of its 19f8829a4aSRandall Stewart * contributors may be used to endorse or promote products derived 20f8829a4aSRandall Stewart * from this software without specific prior written permission. 21f8829a4aSRandall Stewart * 22f8829a4aSRandall Stewart * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23f8829a4aSRandall Stewart * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24f8829a4aSRandall Stewart * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25f8829a4aSRandall Stewart * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26f8829a4aSRandall Stewart * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27f8829a4aSRandall Stewart * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28f8829a4aSRandall Stewart * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29f8829a4aSRandall Stewart * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30f8829a4aSRandall Stewart * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31f8829a4aSRandall Stewart * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 32f8829a4aSRandall Stewart * THE POSSIBILITY OF SUCH DAMAGE. 33f8829a4aSRandall Stewart */ 34f8829a4aSRandall Stewart 35807aad63SMichael Tuexen #ifndef _NETINET_SCTP_HEADER_H_ 36807aad63SMichael Tuexen #define _NETINET_SCTP_HEADER_H_ 37f8829a4aSRandall Stewart 38f8829a4aSRandall Stewart #include <sys/time.h> 39f8829a4aSRandall Stewart #include <netinet/sctp.h> 40f8829a4aSRandall Stewart #include <netinet/sctp_constants.h> 41f8829a4aSRandall Stewart 42b3f1ea41SRandall Stewart #define SCTP_PACKED __attribute__((packed)) 4335918f85SRandall Stewart 44f8829a4aSRandall Stewart /* 45f8829a4aSRandall Stewart * Parameter structures 46f8829a4aSRandall Stewart */ 47f8829a4aSRandall Stewart struct sctp_ipv4addr_param { 48f8829a4aSRandall Stewart struct sctp_paramhdr ph; /* type=SCTP_IPV4_PARAM_TYPE, len=8 */ 49f8829a4aSRandall Stewart uint32_t addr; /* IPV4 address */ 5035918f85SRandall Stewart } SCTP_PACKED; 51f8829a4aSRandall Stewart 5242551e99SRandall Stewart #define SCTP_V6_ADDR_BYTES 16 5342551e99SRandall Stewart 54f8829a4aSRandall Stewart struct sctp_ipv6addr_param { 55f8829a4aSRandall Stewart struct sctp_paramhdr ph; /* type=SCTP_IPV6_PARAM_TYPE, len=20 */ 5642551e99SRandall Stewart uint8_t addr[SCTP_V6_ADDR_BYTES]; /* IPV6 address */ 5735918f85SRandall Stewart } SCTP_PACKED; 58f8829a4aSRandall Stewart 59f8829a4aSRandall Stewart /* Cookie Preservative */ 60f8829a4aSRandall Stewart struct sctp_cookie_perserve_param { 61f8829a4aSRandall Stewart struct sctp_paramhdr ph; /* type=SCTP_COOKIE_PRESERVE, len=8 */ 62f8829a4aSRandall Stewart uint32_t time; /* time in ms to extend cookie */ 638d9d0613SMichael Tuexen } SCTP_PACKED; 64f8829a4aSRandall Stewart 6542551e99SRandall Stewart #define SCTP_ARRAY_MIN_LEN 1 66f8829a4aSRandall Stewart /* Host Name Address */ 67f8829a4aSRandall Stewart struct sctp_host_name_param { 68f8829a4aSRandall Stewart struct sctp_paramhdr ph; /* type=SCTP_HOSTNAME_ADDRESS */ 6942551e99SRandall Stewart char name[SCTP_ARRAY_MIN_LEN]; /* host name */ 7035918f85SRandall Stewart } SCTP_PACKED; 71f8829a4aSRandall Stewart 72d06c82f1SRandall Stewart /* 73d06c82f1SRandall Stewart * This is the maximum padded size of a s-a-p 74d06c82f1SRandall Stewart * so paramheadr + 3 address types (6 bytes) + 2 byte pad = 12 75d06c82f1SRandall Stewart */ 76d06c82f1SRandall Stewart #define SCTP_MAX_ADDR_PARAMS_SIZE 12 77f8829a4aSRandall Stewart /* supported address type */ 78f8829a4aSRandall Stewart struct sctp_supported_addr_param { 79f8829a4aSRandall Stewart struct sctp_paramhdr ph; /* type=SCTP_SUPPORTED_ADDRTYPE */ 8070acddf1SMichael Tuexen uint16_t addr_type[2]; /* array of supported address types */ 8135918f85SRandall Stewart } SCTP_PACKED; 82f8829a4aSRandall Stewart 83f8829a4aSRandall Stewart /* heartbeat info parameter */ 84f8829a4aSRandall Stewart struct sctp_heartbeat_info_param { 85f8829a4aSRandall Stewart struct sctp_paramhdr ph; 86*b67716ddSMichael Tuexen time_t time_value_1; 87f8829a4aSRandall Stewart uint32_t time_value_2; 88f8829a4aSRandall Stewart uint32_t random_value1; 89f8829a4aSRandall Stewart uint32_t random_value2; 90f8829a4aSRandall Stewart uint8_t addr_family; 91f8829a4aSRandall Stewart uint8_t addr_len; 92ca85e948SMichael Tuexen /* make sure that this structure is 4 byte aligned */ 93ca85e948SMichael Tuexen uint8_t padding[2]; 94f8829a4aSRandall Stewart char address[SCTP_ADDRMAX]; 9535918f85SRandall Stewart } SCTP_PACKED; 96f8829a4aSRandall Stewart 97f8829a4aSRandall Stewart /* draft-ietf-tsvwg-prsctp */ 98f8829a4aSRandall Stewart /* PR-SCTP supported parameter */ 99f8829a4aSRandall Stewart struct sctp_prsctp_supported_param { 100f8829a4aSRandall Stewart struct sctp_paramhdr ph; 10135918f85SRandall Stewart } SCTP_PACKED; 102f8829a4aSRandall Stewart 103f8829a4aSRandall Stewart /* draft-ietf-tsvwg-addip-sctp */ 104f8829a4aSRandall Stewart struct sctp_asconf_paramhdr { /* an ASCONF "parameter" */ 105f8829a4aSRandall Stewart struct sctp_paramhdr ph; /* a SCTP parameter header */ 106f8829a4aSRandall Stewart uint32_t correlation_id; /* correlation id for this param */ 10735918f85SRandall Stewart } SCTP_PACKED; 108f8829a4aSRandall Stewart 109f8829a4aSRandall Stewart struct sctp_asconf_addr_param { /* an ASCONF address parameter */ 110f8829a4aSRandall Stewart struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ 111f8829a4aSRandall Stewart struct sctp_ipv6addr_param addrp; /* max storage size */ 11235918f85SRandall Stewart } SCTP_PACKED; 113f8829a4aSRandall Stewart 114830d754dSRandall Stewart struct sctp_asconf_tag_param { /* an ASCONF NAT-Vtag parameter */ 115830d754dSRandall Stewart struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ 116830d754dSRandall Stewart uint32_t local_vtag; 117830d754dSRandall Stewart uint32_t remote_vtag; 118830d754dSRandall Stewart } SCTP_PACKED; 119830d754dSRandall Stewart 120f8829a4aSRandall Stewart struct sctp_asconf_addrv4_param { /* an ASCONF address (v4) parameter */ 121f8829a4aSRandall Stewart struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ 122f8829a4aSRandall Stewart struct sctp_ipv4addr_param addrp; /* max storage size */ 12335918f85SRandall Stewart } SCTP_PACKED; 124f8829a4aSRandall Stewart 125d06c82f1SRandall Stewart #define SCTP_MAX_SUPPORTED_EXT 256 126d06c82f1SRandall Stewart 127f8829a4aSRandall Stewart struct sctp_supported_chunk_types_param { 128f8829a4aSRandall Stewart struct sctp_paramhdr ph; /* type = 0x8008 len = x */ 129663fdad8SMichael Tuexen uint8_t chunk_types[]; 13035918f85SRandall Stewart } SCTP_PACKED; 131f8829a4aSRandall Stewart 132f8829a4aSRandall Stewart /* 133f8829a4aSRandall Stewart * Structures for DATA chunks 134f8829a4aSRandall Stewart */ 135f8829a4aSRandall Stewart struct sctp_data { 136f8829a4aSRandall Stewart uint32_t tsn; 13749656eefSMichael Tuexen uint16_t sid; 13849656eefSMichael Tuexen uint16_t ssn; 13949656eefSMichael Tuexen uint32_t ppid; 140f8829a4aSRandall Stewart /* user data follows */ 14135918f85SRandall Stewart } SCTP_PACKED; 142f8829a4aSRandall Stewart 143f8829a4aSRandall Stewart struct sctp_data_chunk { 144f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 145f8829a4aSRandall Stewart struct sctp_data dp; 14635918f85SRandall Stewart } SCTP_PACKED; 147f8829a4aSRandall Stewart 14844249214SRandall Stewart struct sctp_idata { 14944249214SRandall Stewart uint32_t tsn; 15049656eefSMichael Tuexen uint16_t sid; 15144249214SRandall Stewart uint16_t reserved; /* Where does the SSN go? */ 15249656eefSMichael Tuexen uint32_t mid; 15344249214SRandall Stewart union { 15449656eefSMichael Tuexen uint32_t ppid; 15544249214SRandall Stewart uint32_t fsn; /* Fragment Sequence Number */ 156e187bac2SMichael Tuexen } ppid_fsn; 15744249214SRandall Stewart /* user data follows */ 15844249214SRandall Stewart } SCTP_PACKED; 15944249214SRandall Stewart 16044249214SRandall Stewart struct sctp_idata_chunk { 16144249214SRandall Stewart struct sctp_chunkhdr ch; 16244249214SRandall Stewart struct sctp_idata dp; 16344249214SRandall Stewart } SCTP_PACKED; 16444249214SRandall Stewart 165f8829a4aSRandall Stewart /* 166f8829a4aSRandall Stewart * Structures for the control chunks 167f8829a4aSRandall Stewart */ 168f8829a4aSRandall Stewart 169f8829a4aSRandall Stewart /* Initiate (INIT)/Initiate Ack (INIT ACK) */ 170f8829a4aSRandall Stewart struct sctp_init { 171f8829a4aSRandall Stewart uint32_t initiate_tag; /* initiate tag */ 172f8829a4aSRandall Stewart uint32_t a_rwnd; /* a_rwnd */ 173f8829a4aSRandall Stewart uint16_t num_outbound_streams; /* OS */ 174f8829a4aSRandall Stewart uint16_t num_inbound_streams; /* MIS */ 175f8829a4aSRandall Stewart uint32_t initial_tsn; /* I-TSN */ 176f8829a4aSRandall Stewart /* optional param's follow */ 17735918f85SRandall Stewart } SCTP_PACKED; 17842551e99SRandall Stewart #define SCTP_IDENTIFICATION_SIZE 16 17942551e99SRandall Stewart #define SCTP_ADDRESS_SIZE 4 1806026b45aSMichael Tuexen #define SCTP_RESERVE_SPACE 5 181f8829a4aSRandall Stewart /* state cookie header */ 182f8829a4aSRandall Stewart struct sctp_state_cookie { /* this is our definition... */ 18342551e99SRandall Stewart uint8_t identification[SCTP_IDENTIFICATION_SIZE]; /* id of who we are */ 18435918f85SRandall Stewart struct timeval time_entered; /* the time I built cookie */ 185f8829a4aSRandall Stewart uint32_t cookie_life; /* life I will award this cookie */ 186f8829a4aSRandall Stewart uint32_t tie_tag_my_vtag; /* my tag in old association */ 18735918f85SRandall Stewart 188f8829a4aSRandall Stewart uint32_t tie_tag_peer_vtag; /* peers tag in old association */ 189f8829a4aSRandall Stewart uint32_t peers_vtag; /* peers tag in INIT (for quick ref) */ 19035918f85SRandall Stewart 191f8829a4aSRandall Stewart uint32_t my_vtag; /* my tag in INIT-ACK (for quick ref) */ 19242551e99SRandall Stewart uint32_t address[SCTP_ADDRESS_SIZE]; /* 4 ints/128 bits */ 193f8829a4aSRandall Stewart uint32_t addr_type; /* address type */ 19442551e99SRandall Stewart uint32_t laddress[SCTP_ADDRESS_SIZE]; /* my local from address */ 195f8829a4aSRandall Stewart uint32_t laddr_type; /* my local from address type */ 196f8829a4aSRandall Stewart uint32_t scope_id; /* v6 scope id for link-locals */ 19735918f85SRandall Stewart 198f8829a4aSRandall Stewart uint16_t peerport; /* port address of the peer in the INIT */ 199f8829a4aSRandall Stewart uint16_t myport; /* my port address used in the INIT */ 200f8829a4aSRandall Stewart uint8_t ipv4_addr_legal; /* Are V4 addr legal? */ 201f8829a4aSRandall Stewart uint8_t ipv6_addr_legal; /* Are V6 addr legal? */ 202f8829a4aSRandall Stewart uint8_t local_scope; /* IPv6 local scope flag */ 203f8829a4aSRandall Stewart uint8_t site_scope; /* IPv6 site scope flag */ 20435918f85SRandall Stewart 205f8829a4aSRandall Stewart uint8_t ipv4_scope; /* IPv4 private addr scope */ 206f8829a4aSRandall Stewart uint8_t loopback_scope; /* loopback scope information */ 20752640d61SMichael Tuexen uint8_t rcv_edmid; /* copy of the inp value */ 20835918f85SRandall Stewart uint8_t reserved[SCTP_RESERVE_SPACE]; /* Align to 64 bits */ 209f8829a4aSRandall Stewart /* 210f8829a4aSRandall Stewart * at the end is tacked on the INIT chunk and the INIT-ACK chunk 211f8829a4aSRandall Stewart * (minus the cookie). 212f8829a4aSRandall Stewart */ 21335918f85SRandall Stewart } SCTP_PACKED; 214f8829a4aSRandall Stewart 215f8829a4aSRandall Stewart /* state cookie parameter */ 216f8829a4aSRandall Stewart struct sctp_state_cookie_param { 217f8829a4aSRandall Stewart struct sctp_paramhdr ph; 218f8829a4aSRandall Stewart struct sctp_state_cookie cookie; 21935918f85SRandall Stewart } SCTP_PACKED; 220f8829a4aSRandall Stewart 221f8829a4aSRandall Stewart struct sctp_init_chunk { 222f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 223f8829a4aSRandall Stewart struct sctp_init init; 22435918f85SRandall Stewart } SCTP_PACKED; 225f8829a4aSRandall Stewart 226f8829a4aSRandall Stewart struct sctp_init_msg { 227f8829a4aSRandall Stewart struct sctphdr sh; 228f8829a4aSRandall Stewart struct sctp_init_chunk msg; 22935918f85SRandall Stewart } SCTP_PACKED; 230f8829a4aSRandall Stewart 231f8829a4aSRandall Stewart /* ... used for both INIT and INIT ACK */ 232f8829a4aSRandall Stewart #define sctp_init_ack sctp_init 233f8829a4aSRandall Stewart #define sctp_init_ack_chunk sctp_init_chunk 234f8829a4aSRandall Stewart #define sctp_init_ack_msg sctp_init_msg 235f8829a4aSRandall Stewart 236f8829a4aSRandall Stewart /* Selective Ack (SACK) */ 237f8829a4aSRandall Stewart struct sctp_gap_ack_block { 238f8829a4aSRandall Stewart uint16_t start; /* Gap Ack block start */ 239f8829a4aSRandall Stewart uint16_t end; /* Gap Ack block end */ 24035918f85SRandall Stewart } SCTP_PACKED; 241f8829a4aSRandall Stewart 242f8829a4aSRandall Stewart struct sctp_sack { 243f8829a4aSRandall Stewart uint32_t cum_tsn_ack; /* cumulative TSN Ack */ 244f8829a4aSRandall Stewart uint32_t a_rwnd; /* updated a_rwnd of sender */ 245f8829a4aSRandall Stewart uint16_t num_gap_ack_blks; /* number of Gap Ack blocks */ 246f8829a4aSRandall Stewart uint16_t num_dup_tsns; /* number of duplicate TSNs */ 247f8829a4aSRandall Stewart /* struct sctp_gap_ack_block's follow */ 248f8829a4aSRandall Stewart /* uint32_t duplicate_tsn's follow */ 24935918f85SRandall Stewart } SCTP_PACKED; 250f8829a4aSRandall Stewart 251f8829a4aSRandall Stewart struct sctp_sack_chunk { 252f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 253f8829a4aSRandall Stewart struct sctp_sack sack; 25435918f85SRandall Stewart } SCTP_PACKED; 255f8829a4aSRandall Stewart 256830d754dSRandall Stewart struct sctp_nr_sack { 257830d754dSRandall Stewart uint32_t cum_tsn_ack; /* cumulative TSN Ack */ 258830d754dSRandall Stewart uint32_t a_rwnd; /* updated a_rwnd of sender */ 259830d754dSRandall Stewart uint16_t num_gap_ack_blks; /* number of Gap Ack blocks */ 260830d754dSRandall Stewart uint16_t num_nr_gap_ack_blks; /* number of NR Gap Ack blocks */ 261830d754dSRandall Stewart uint16_t num_dup_tsns; /* number of duplicate TSNs */ 262830d754dSRandall Stewart uint16_t reserved; /* not currently used */ 263830d754dSRandall Stewart /* struct sctp_gap_ack_block's follow */ 264830d754dSRandall Stewart /* uint32_t duplicate_tsn's follow */ 265830d754dSRandall Stewart } SCTP_PACKED; 266830d754dSRandall Stewart 267830d754dSRandall Stewart struct sctp_nr_sack_chunk { 268830d754dSRandall Stewart struct sctp_chunkhdr ch; 269830d754dSRandall Stewart struct sctp_nr_sack nr_sack; 270830d754dSRandall Stewart } SCTP_PACKED; 271830d754dSRandall Stewart 272f8829a4aSRandall Stewart /* Heartbeat Request (HEARTBEAT) */ 273f8829a4aSRandall Stewart struct sctp_heartbeat { 274f8829a4aSRandall Stewart struct sctp_heartbeat_info_param hb_info; 27535918f85SRandall Stewart } SCTP_PACKED; 276f8829a4aSRandall Stewart 277f8829a4aSRandall Stewart struct sctp_heartbeat_chunk { 278f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 279f8829a4aSRandall Stewart struct sctp_heartbeat heartbeat; 28035918f85SRandall Stewart } SCTP_PACKED; 281f8829a4aSRandall Stewart 282f8829a4aSRandall Stewart /* ... used for Heartbeat Ack (HEARTBEAT ACK) */ 283f8829a4aSRandall Stewart #define sctp_heartbeat_ack sctp_heartbeat 284f8829a4aSRandall Stewart #define sctp_heartbeat_ack_chunk sctp_heartbeat_chunk 285f8829a4aSRandall Stewart 286f8829a4aSRandall Stewart /* Abort Asssociation (ABORT) */ 287f8829a4aSRandall Stewart struct sctp_abort_chunk { 288f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 289f8829a4aSRandall Stewart /* optional error cause may follow */ 29035918f85SRandall Stewart } SCTP_PACKED; 291f8829a4aSRandall Stewart 292f8829a4aSRandall Stewart struct sctp_abort_msg { 293f8829a4aSRandall Stewart struct sctphdr sh; 294f8829a4aSRandall Stewart struct sctp_abort_chunk msg; 29535918f85SRandall Stewart } SCTP_PACKED; 296f8829a4aSRandall Stewart 297f8829a4aSRandall Stewart /* Shutdown Association (SHUTDOWN) */ 298f8829a4aSRandall Stewart struct sctp_shutdown_chunk { 299f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 300f8829a4aSRandall Stewart uint32_t cumulative_tsn_ack; 30135918f85SRandall Stewart } SCTP_PACKED; 302f8829a4aSRandall Stewart 303f8829a4aSRandall Stewart /* Shutdown Acknowledgment (SHUTDOWN ACK) */ 304f8829a4aSRandall Stewart struct sctp_shutdown_ack_chunk { 305f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 30635918f85SRandall Stewart } SCTP_PACKED; 307f8829a4aSRandall Stewart 308f8829a4aSRandall Stewart /* Operation Error (ERROR) */ 309f8829a4aSRandall Stewart struct sctp_error_chunk { 310f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 311f8829a4aSRandall Stewart /* optional error causes follow */ 31235918f85SRandall Stewart } SCTP_PACKED; 313f8829a4aSRandall Stewart 314f8829a4aSRandall Stewart /* Cookie Echo (COOKIE ECHO) */ 315f8829a4aSRandall Stewart struct sctp_cookie_echo_chunk { 316f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 317f8829a4aSRandall Stewart struct sctp_state_cookie cookie; 31835918f85SRandall Stewart } SCTP_PACKED; 319f8829a4aSRandall Stewart 320f8829a4aSRandall Stewart /* Cookie Acknowledgment (COOKIE ACK) */ 321f8829a4aSRandall Stewart struct sctp_cookie_ack_chunk { 322f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 32335918f85SRandall Stewart } SCTP_PACKED; 324f8829a4aSRandall Stewart 325f8829a4aSRandall Stewart /* Explicit Congestion Notification Echo (ECNE) */ 326a21779f0SRandall Stewart struct old_sctp_ecne_chunk { 327a21779f0SRandall Stewart struct sctp_chunkhdr ch; 328a21779f0SRandall Stewart uint32_t tsn; 329a21779f0SRandall Stewart } SCTP_PACKED; 330a21779f0SRandall Stewart 331f8829a4aSRandall Stewart struct sctp_ecne_chunk { 332f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 333f8829a4aSRandall Stewart uint32_t tsn; 334a21779f0SRandall Stewart uint32_t num_pkts_since_cwr; 33535918f85SRandall Stewart } SCTP_PACKED; 336f8829a4aSRandall Stewart 337f8829a4aSRandall Stewart /* Congestion Window Reduced (CWR) */ 338f8829a4aSRandall Stewart struct sctp_cwr_chunk { 339f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 340f8829a4aSRandall Stewart uint32_t tsn; 34135918f85SRandall Stewart } SCTP_PACKED; 342f8829a4aSRandall Stewart 343f8829a4aSRandall Stewart /* Shutdown Complete (SHUTDOWN COMPLETE) */ 344f8829a4aSRandall Stewart struct sctp_shutdown_complete_chunk { 345f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 34635918f85SRandall Stewart } SCTP_PACKED; 347f8829a4aSRandall Stewart 348f8829a4aSRandall Stewart struct sctp_adaptation_layer_indication { 349f8829a4aSRandall Stewart struct sctp_paramhdr ph; 350f8829a4aSRandall Stewart uint32_t indication; 35135918f85SRandall Stewart } SCTP_PACKED; 352f8829a4aSRandall Stewart 353f8829a4aSRandall Stewart /* 354f8829a4aSRandall Stewart * draft-ietf-tsvwg-addip-sctp 355f8829a4aSRandall Stewart */ 356f8829a4aSRandall Stewart /* Address/Stream Configuration Change (ASCONF) */ 357f8829a4aSRandall Stewart struct sctp_asconf_chunk { 358f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 359f8829a4aSRandall Stewart uint32_t serial_number; 360f8829a4aSRandall Stewart /* lookup address parameter (mandatory) */ 361f8829a4aSRandall Stewart /* asconf parameters follow */ 36235918f85SRandall Stewart } SCTP_PACKED; 363f8829a4aSRandall Stewart 364f8829a4aSRandall Stewart /* Address/Stream Configuration Acknowledge (ASCONF ACK) */ 365f8829a4aSRandall Stewart struct sctp_asconf_ack_chunk { 366f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 367f8829a4aSRandall Stewart uint32_t serial_number; 368f8829a4aSRandall Stewart /* asconf parameters follow */ 36935918f85SRandall Stewart } SCTP_PACKED; 370f8829a4aSRandall Stewart 371f8829a4aSRandall Stewart /* draft-ietf-tsvwg-prsctp */ 372f8829a4aSRandall Stewart /* Forward Cumulative TSN (FORWARD TSN) */ 373f8829a4aSRandall Stewart struct sctp_forward_tsn_chunk { 374f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 375f8829a4aSRandall Stewart uint32_t new_cumulative_tsn; 376f8829a4aSRandall Stewart /* stream/sequence pairs (sctp_strseq) follow */ 37735918f85SRandall Stewart } SCTP_PACKED; 378f8829a4aSRandall Stewart 379f8829a4aSRandall Stewart struct sctp_strseq { 38049656eefSMichael Tuexen uint16_t sid; 38149656eefSMichael Tuexen uint16_t ssn; 38235918f85SRandall Stewart } SCTP_PACKED; 383f8829a4aSRandall Stewart 38444249214SRandall Stewart struct sctp_strseq_mid { 38549656eefSMichael Tuexen uint16_t sid; 3868e1b295fSMichael Tuexen uint16_t flags; 38749656eefSMichael Tuexen uint32_t mid; 38844249214SRandall Stewart }; 38944249214SRandall Stewart 390f8829a4aSRandall Stewart struct sctp_forward_tsn_msg { 391f8829a4aSRandall Stewart struct sctphdr sh; 392f8829a4aSRandall Stewart struct sctp_forward_tsn_chunk msg; 39335918f85SRandall Stewart } SCTP_PACKED; 394f8829a4aSRandall Stewart 395f8829a4aSRandall Stewart /* should be a multiple of 4 - 1 aka 3/7/11 etc. */ 396f8829a4aSRandall Stewart 397f8829a4aSRandall Stewart #define SCTP_NUM_DB_TO_VERIFY 31 398f8829a4aSRandall Stewart 399f8829a4aSRandall Stewart struct sctp_chunk_desc { 400f8829a4aSRandall Stewart uint8_t chunk_type; 401f8829a4aSRandall Stewart uint8_t data_bytes[SCTP_NUM_DB_TO_VERIFY]; 402f8829a4aSRandall Stewart uint32_t tsn_ifany; 40335918f85SRandall Stewart } SCTP_PACKED; 404f8829a4aSRandall Stewart 405f8829a4aSRandall Stewart struct sctp_pktdrop_chunk { 406f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 407f8829a4aSRandall Stewart uint32_t bottle_bw; 408f8829a4aSRandall Stewart uint32_t current_onq; 409f8829a4aSRandall Stewart uint16_t trunc_len; 410f8829a4aSRandall Stewart uint16_t reserved; 411663fdad8SMichael Tuexen uint8_t data[]; 41235918f85SRandall Stewart } SCTP_PACKED; 413f8829a4aSRandall Stewart 414f8829a4aSRandall Stewart /**********STREAM RESET STUFF ******************/ 415f8829a4aSRandall Stewart 41684f3b49aSMichael Tuexen struct sctp_stream_reset_request { 41784f3b49aSMichael Tuexen struct sctp_paramhdr ph; 41884f3b49aSMichael Tuexen uint32_t request_seq; 41984f3b49aSMichael Tuexen } SCTP_PACKED; 42084f3b49aSMichael Tuexen 421f8829a4aSRandall Stewart struct sctp_stream_reset_out_request { 422f8829a4aSRandall Stewart struct sctp_paramhdr ph; 423f8829a4aSRandall Stewart uint32_t request_seq; /* monotonically increasing seq no */ 424f8829a4aSRandall Stewart uint32_t response_seq; /* if a response, the resp seq no */ 425f8829a4aSRandall Stewart uint32_t send_reset_at_tsn; /* last TSN I assigned outbound */ 426663fdad8SMichael Tuexen uint16_t list_of_streams[]; /* if not all list of streams */ 42735918f85SRandall Stewart } SCTP_PACKED; 428f8829a4aSRandall Stewart 429f8829a4aSRandall Stewart struct sctp_stream_reset_in_request { 430f8829a4aSRandall Stewart struct sctp_paramhdr ph; 431f8829a4aSRandall Stewart uint32_t request_seq; 432663fdad8SMichael Tuexen uint16_t list_of_streams[]; /* if not all list of streams */ 43335918f85SRandall Stewart } SCTP_PACKED; 434f8829a4aSRandall Stewart 435f8829a4aSRandall Stewart struct sctp_stream_reset_tsn_request { 436f8829a4aSRandall Stewart struct sctp_paramhdr ph; 437f8829a4aSRandall Stewart uint32_t request_seq; 43835918f85SRandall Stewart } SCTP_PACKED; 439f8829a4aSRandall Stewart 440f8829a4aSRandall Stewart struct sctp_stream_reset_response { 441f8829a4aSRandall Stewart struct sctp_paramhdr ph; 442f8829a4aSRandall Stewart uint32_t response_seq; /* if a response, the resp seq no */ 443f8829a4aSRandall Stewart uint32_t result; 44435918f85SRandall Stewart } SCTP_PACKED; 445f8829a4aSRandall Stewart 446f8829a4aSRandall Stewart struct sctp_stream_reset_response_tsn { 447f8829a4aSRandall Stewart struct sctp_paramhdr ph; 448f8829a4aSRandall Stewart uint32_t response_seq; /* if a response, the resp seq no */ 449f8829a4aSRandall Stewart uint32_t result; 450f8829a4aSRandall Stewart uint32_t senders_next_tsn; 451f8829a4aSRandall Stewart uint32_t receivers_next_tsn; 45235918f85SRandall Stewart } SCTP_PACKED; 453f8829a4aSRandall Stewart 454ea44232bSRandall Stewart struct sctp_stream_reset_add_strm { 455ea44232bSRandall Stewart struct sctp_paramhdr ph; 456ea44232bSRandall Stewart uint32_t request_seq; 457ea44232bSRandall Stewart uint16_t number_of_streams; 458ea44232bSRandall Stewart uint16_t reserved; 4598d9d0613SMichael Tuexen } SCTP_PACKED; 460f8829a4aSRandall Stewart 461f3ebe64cSMichael Tuexen #define SCTP_STREAM_RESET_RESULT_NOTHING_TO_DO 0x00000000 /* XXX: unused */ 462f3ebe64cSMichael Tuexen #define SCTP_STREAM_RESET_RESULT_PERFORMED 0x00000001 463f3ebe64cSMichael Tuexen #define SCTP_STREAM_RESET_RESULT_DENIED 0x00000002 464f3ebe64cSMichael Tuexen #define SCTP_STREAM_RESET_RESULT_ERR__WRONG_SSN 0x00000003 /* XXX: unused */ 465f3ebe64cSMichael Tuexen #define SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS 0x00000004 466f3ebe64cSMichael Tuexen #define SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO 0x00000005 467f3ebe64cSMichael Tuexen #define SCTP_STREAM_RESET_RESULT_IN_PROGRESS 0x00000006 /* XXX: unused */ 468f8829a4aSRandall Stewart 469f8829a4aSRandall Stewart /* 470f8829a4aSRandall Stewart * convience structures, note that if you are making a request for specific 471f8829a4aSRandall Stewart * streams then the request will need to be an overlay structure. 472f8829a4aSRandall Stewart */ 473f8829a4aSRandall Stewart 474f8829a4aSRandall Stewart struct sctp_stream_reset_tsn_req { 475f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 476f8829a4aSRandall Stewart struct sctp_stream_reset_tsn_request sr_req; 47735918f85SRandall Stewart } SCTP_PACKED; 478f8829a4aSRandall Stewart 479f8829a4aSRandall Stewart struct sctp_stream_reset_resp { 480f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 481f8829a4aSRandall Stewart struct sctp_stream_reset_response sr_resp; 48235918f85SRandall Stewart } SCTP_PACKED; 483f8829a4aSRandall Stewart 484f8829a4aSRandall Stewart /* respone only valid with a TSN request */ 485f8829a4aSRandall Stewart struct sctp_stream_reset_resp_tsn { 486f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 487f8829a4aSRandall Stewart struct sctp_stream_reset_response_tsn sr_resp; 48835918f85SRandall Stewart } SCTP_PACKED; 489f8829a4aSRandall Stewart 490f8829a4aSRandall Stewart /****************************************************/ 491f8829a4aSRandall Stewart 492f8829a4aSRandall Stewart /* 493f8829a4aSRandall Stewart * Authenticated chunks support draft-ietf-tsvwg-sctp-auth 494f8829a4aSRandall Stewart */ 495d06c82f1SRandall Stewart 496d06c82f1SRandall Stewart /* Should we make the max be 32? */ 497d06c82f1SRandall Stewart #define SCTP_RANDOM_MAX_SIZE 256 498f8829a4aSRandall Stewart struct sctp_auth_random { 499f8829a4aSRandall Stewart struct sctp_paramhdr ph; /* type = 0x8002 */ 500663fdad8SMichael Tuexen uint8_t random_data[]; 50135918f85SRandall Stewart } SCTP_PACKED; 502f8829a4aSRandall Stewart 503f8829a4aSRandall Stewart struct sctp_auth_chunk_list { 504f8829a4aSRandall Stewart struct sctp_paramhdr ph; /* type = 0x8003 */ 505663fdad8SMichael Tuexen uint8_t chunk_types[]; 50635918f85SRandall Stewart } SCTP_PACKED; 507f8829a4aSRandall Stewart 508f8829a4aSRandall Stewart struct sctp_auth_hmac_algo { 509f8829a4aSRandall Stewart struct sctp_paramhdr ph; /* type = 0x8004 */ 510663fdad8SMichael Tuexen uint16_t hmac_ids[]; 51135918f85SRandall Stewart } SCTP_PACKED; 512f8829a4aSRandall Stewart 513f8829a4aSRandall Stewart struct sctp_auth_chunk { 514f8829a4aSRandall Stewart struct sctp_chunkhdr ch; 515f8829a4aSRandall Stewart uint16_t shared_key_id; 516f8829a4aSRandall Stewart uint16_t hmac_id; 517663fdad8SMichael Tuexen uint8_t hmac[]; 51835918f85SRandall Stewart } SCTP_PACKED; 519f8829a4aSRandall Stewart 52052640d61SMichael Tuexen /* Zero checksum support draft-ietf-tsvwg-sctp-zero-checksum */ 52152640d61SMichael Tuexen 52252640d61SMichael Tuexen struct sctp_zero_checksum_acceptable { 52352640d61SMichael Tuexen struct sctp_paramhdr ph; 52452640d61SMichael Tuexen uint32_t edmid; 52552640d61SMichael Tuexen } SCTP_PACKED; 52652640d61SMichael Tuexen 527f8829a4aSRandall Stewart /* 528f8829a4aSRandall Stewart * we pre-reserve enough room for a ECNE or CWR AND a SACK with no missing 529f8829a4aSRandall Stewart * pieces. If ENCE is missing we could have a couple of blocks. This way we 530f8829a4aSRandall Stewart * optimize so we MOST likely can bundle a SACK/ECN with the smallest size 531f8829a4aSRandall Stewart * data chunk I will split into. We could increase throughput slightly by 532f8829a4aSRandall Stewart * taking out these two but the 24-sack/8-CWR i.e. 32 bytes I pre-reserve I 533f8829a4aSRandall Stewart * feel is worth it for now. 534f8829a4aSRandall Stewart */ 535f8829a4aSRandall Stewart #ifndef SCTP_MAX_OVERHEAD 53642551e99SRandall Stewart #ifdef INET6 537f8829a4aSRandall Stewart #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 538f8829a4aSRandall Stewart sizeof(struct sctphdr) + \ 539f8829a4aSRandall Stewart sizeof(struct sctp_ecne_chunk) + \ 540f8829a4aSRandall Stewart sizeof(struct sctp_sack_chunk) + \ 541f8829a4aSRandall Stewart sizeof(struct ip6_hdr)) 542f8829a4aSRandall Stewart 543f8829a4aSRandall Stewart #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 544f8829a4aSRandall Stewart sizeof(struct sctphdr) + \ 545f8829a4aSRandall Stewart sizeof(struct ip6_hdr)) 546f8829a4aSRandall Stewart 547f8829a4aSRandall Stewart #define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \ 548f8829a4aSRandall Stewart sizeof(struct sctphdr)) 549f8829a4aSRandall Stewart 550f8829a4aSRandall Stewart #else 551f8829a4aSRandall Stewart #define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 552f8829a4aSRandall Stewart sizeof(struct sctphdr) + \ 553f8829a4aSRandall Stewart sizeof(struct sctp_ecne_chunk) + \ 554f8829a4aSRandall Stewart sizeof(struct sctp_sack_chunk) + \ 555f8829a4aSRandall Stewart sizeof(struct ip)) 556f8829a4aSRandall Stewart 557f8829a4aSRandall Stewart #define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 558f8829a4aSRandall Stewart sizeof(struct sctphdr) + \ 559f8829a4aSRandall Stewart sizeof(struct ip)) 560f8829a4aSRandall Stewart 561f8829a4aSRandall Stewart #define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \ 562f8829a4aSRandall Stewart sizeof(struct sctphdr)) 563f8829a4aSRandall Stewart 56442551e99SRandall Stewart #endif /* INET6 */ 565f8829a4aSRandall Stewart #endif /* !SCTP_MAX_OVERHEAD */ 566f8829a4aSRandall Stewart 567f8829a4aSRandall Stewart #define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 568f8829a4aSRandall Stewart sizeof(struct sctphdr) + \ 569f8829a4aSRandall Stewart sizeof(struct ip)) 570f8829a4aSRandall Stewart 571f8829a4aSRandall Stewart #define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \ 572f8829a4aSRandall Stewart sizeof(struct sctphdr)) 573f8829a4aSRandall Stewart 574b3f1ea41SRandall Stewart #undef SCTP_PACKED 575f8829a4aSRandall Stewart #endif /* !__sctp_header_h__ */ 576