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