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