1163953Srrs/*- 2169382Srrs * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3235828Stuexen * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 4235828Stuexen * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 5163953Srrs * 6163953Srrs * Redistribution and use in source and binary forms, with or without 7163953Srrs * modification, are permitted provided that the following conditions are met: 8163953Srrs * 9163953Srrs * a) Redistributions of source code must retain the above copyright notice, 10228653Stuexen * this list of conditions and the following disclaimer. 11163953Srrs * 12163953Srrs * b) Redistributions in binary form must reproduce the above copyright 13163953Srrs * notice, this list of conditions and the following disclaimer in 14228653Stuexen * the documentation and/or other materials provided with the distribution. 15163953Srrs * 16163953Srrs * c) Neither the name of Cisco Systems, Inc. nor the names of its 17163953Srrs * contributors may be used to endorse or promote products derived 18163953Srrs * from this software without specific prior written permission. 19163953Srrs * 20163953Srrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21163953Srrs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22163953Srrs * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23163953Srrs * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24163953Srrs * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25163953Srrs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26163953Srrs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27163953Srrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28163953Srrs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29163953Srrs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30163953Srrs * THE POSSIBILITY OF SUCH DAMAGE. 31163953Srrs */ 32163953Srrs 33163953Srrs#include <sys/cdefs.h> 34163953Srrs__FBSDID("$FreeBSD: stable/11/sys/netinet/sctp_header.h 347154 2019-05-05 12:28:39Z tuexen $"); 35163953Srrs 36235828Stuexen#ifndef _NETINET_SCTP_HEADER_H_ 37235828Stuexen#define _NETINET_SCTP_HEADER_H_ 38163953Srrs 39163953Srrs#include <sys/time.h> 40163953Srrs#include <netinet/sctp.h> 41163953Srrs#include <netinet/sctp_constants.h> 42163953Srrs 43179783Srrs#define SCTP_PACKED __attribute__((packed)) 44170606Srrs 45163953Srrs/* 46163953Srrs * Parameter structures 47163953Srrs */ 48163953Srrsstruct sctp_ipv4addr_param { 49347154Stuexen struct sctp_paramhdr ph; /* type=SCTP_IPV4_PARAM_TYPE, len=8 */ 50163953Srrs uint32_t addr; /* IPV4 address */ 51170606Srrs} SCTP_PACKED; 52163953Srrs 53167598Srrs#define SCTP_V6_ADDR_BYTES 16 54167598Srrs 55167598Srrs 56163953Srrsstruct sctp_ipv6addr_param { 57347154Stuexen struct sctp_paramhdr ph; /* type=SCTP_IPV6_PARAM_TYPE, len=20 */ 58167598Srrs uint8_t addr[SCTP_V6_ADDR_BYTES]; /* IPV6 address */ 59170606Srrs} SCTP_PACKED; 60163953Srrs 61163953Srrs/* Cookie Preservative */ 62163953Srrsstruct sctp_cookie_perserve_param { 63347154Stuexen struct sctp_paramhdr ph; /* type=SCTP_COOKIE_PRESERVE, len=8 */ 64163953Srrs uint32_t time; /* time in ms to extend cookie */ 65203847Stuexen} SCTP_PACKED; 66163953Srrs 67167598Srrs#define SCTP_ARRAY_MIN_LEN 1 68163953Srrs/* Host Name Address */ 69163953Srrsstruct sctp_host_name_param { 70347154Stuexen struct sctp_paramhdr ph; /* type=SCTP_HOSTNAME_ADDRESS */ 71167598Srrs char name[SCTP_ARRAY_MIN_LEN]; /* host name */ 72170606Srrs} SCTP_PACKED; 73163953Srrs 74169208Srrs/* 75169208Srrs * This is the maximum padded size of a s-a-p 76169208Srrs * so paramheadr + 3 address types (6 bytes) + 2 byte pad = 12 77169208Srrs */ 78169208Srrs#define SCTP_MAX_ADDR_PARAMS_SIZE 12 79163953Srrs/* supported address type */ 80163953Srrsstruct sctp_supported_addr_param { 81347154Stuexen struct sctp_paramhdr ph; /* type=SCTP_SUPPORTED_ADDRTYPE */ 82228031Stuexen uint16_t addr_type[2]; /* array of supported address types */ 83170606Srrs} SCTP_PACKED; 84163953Srrs 85163953Srrs/* heartbeat info parameter */ 86163953Srrsstruct sctp_heartbeat_info_param { 87163953Srrs struct sctp_paramhdr ph; 88163953Srrs uint32_t time_value_1; 89163953Srrs uint32_t time_value_2; 90163953Srrs uint32_t random_value1; 91163953Srrs uint32_t random_value2; 92163953Srrs uint8_t addr_family; 93163953Srrs uint8_t addr_len; 94224641Stuexen /* make sure that this structure is 4 byte aligned */ 95224641Stuexen uint8_t padding[2]; 96163953Srrs char address[SCTP_ADDRMAX]; 97170606Srrs} SCTP_PACKED; 98163953Srrs 99163953Srrs 100163953Srrs/* draft-ietf-tsvwg-prsctp */ 101163953Srrs/* PR-SCTP supported parameter */ 102163953Srrsstruct sctp_prsctp_supported_param { 103163953Srrs struct sctp_paramhdr ph; 104170606Srrs} SCTP_PACKED; 105163953Srrs 106163953Srrs 107163953Srrs/* draft-ietf-tsvwg-addip-sctp */ 108163953Srrsstruct sctp_asconf_paramhdr { /* an ASCONF "parameter" */ 109347154Stuexen struct sctp_paramhdr ph; /* a SCTP parameter header */ 110347154Stuexen uint32_t correlation_id; /* correlation id for this param */ 111170606Srrs} SCTP_PACKED; 112163953Srrs 113163953Srrsstruct sctp_asconf_addr_param { /* an ASCONF address parameter */ 114163953Srrs struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ 115163953Srrs struct sctp_ipv6addr_param addrp; /* max storage size */ 116170606Srrs} SCTP_PACKED; 117163953Srrs 118185694Srrs 119185694Srrsstruct sctp_asconf_tag_param { /* an ASCONF NAT-Vtag parameter */ 120185694Srrs struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ 121185694Srrs uint32_t local_vtag; 122185694Srrs uint32_t remote_vtag; 123185694Srrs} SCTP_PACKED; 124185694Srrs 125185694Srrs 126163953Srrsstruct sctp_asconf_addrv4_param { /* an ASCONF address (v4) parameter */ 127163953Srrs struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ 128163953Srrs struct sctp_ipv4addr_param addrp; /* max storage size */ 129170606Srrs} SCTP_PACKED; 130163953Srrs 131169208Srrs#define SCTP_MAX_SUPPORTED_EXT 256 132169208Srrs 133163953Srrsstruct sctp_supported_chunk_types_param { 134347154Stuexen struct sctp_paramhdr ph; /* type = 0x8008 len = x */ 135202782Stuexen uint8_t chunk_types[]; 136170606Srrs} SCTP_PACKED; 137163953Srrs 138163953Srrs 139163953Srrs/* 140163953Srrs * Structures for DATA chunks 141163953Srrs */ 142163953Srrsstruct sctp_data { 143163953Srrs uint32_t tsn; 144310219Stuexen uint16_t sid; 145310219Stuexen uint16_t ssn; 146310219Stuexen uint32_t ppid; 147163953Srrs /* user data follows */ 148170606Srrs} SCTP_PACKED; 149163953Srrs 150163953Srrsstruct sctp_data_chunk { 151163953Srrs struct sctp_chunkhdr ch; 152163953Srrs struct sctp_data dp; 153170606Srrs} SCTP_PACKED; 154163953Srrs 155297662Srrsstruct sctp_idata { 156297662Srrs uint32_t tsn; 157310219Stuexen uint16_t sid; 158297662Srrs uint16_t reserved; /* Where does the SSN go? */ 159310219Stuexen uint32_t mid; 160297662Srrs union { 161310219Stuexen uint32_t ppid; 162297662Srrs uint32_t fsn; /* Fragment Sequence Number */ 163298187Stuexen } ppid_fsn; 164297662Srrs /* user data follows */ 165297662Srrs} SCTP_PACKED; 166297662Srrs 167297662Srrsstruct sctp_idata_chunk { 168297662Srrs struct sctp_chunkhdr ch; 169297662Srrs struct sctp_idata dp; 170297662Srrs} SCTP_PACKED; 171297662Srrs 172163953Srrs/* 173163953Srrs * Structures for the control chunks 174163953Srrs */ 175163953Srrs 176163953Srrs/* Initiate (INIT)/Initiate Ack (INIT ACK) */ 177163953Srrsstruct sctp_init { 178163953Srrs uint32_t initiate_tag; /* initiate tag */ 179163953Srrs uint32_t a_rwnd; /* a_rwnd */ 180163953Srrs uint16_t num_outbound_streams; /* OS */ 181163953Srrs uint16_t num_inbound_streams; /* MIS */ 182163953Srrs uint32_t initial_tsn; /* I-TSN */ 183163953Srrs /* optional param's follow */ 184170606Srrs} SCTP_PACKED; 185167598Srrs#define SCTP_IDENTIFICATION_SIZE 16 186167598Srrs#define SCTP_ADDRESS_SIZE 4 187170606Srrs#define SCTP_RESERVE_SPACE 6 188163953Srrs/* state cookie header */ 189163953Srrsstruct sctp_state_cookie { /* this is our definition... */ 190167598Srrs uint8_t identification[SCTP_IDENTIFICATION_SIZE]; /* id of who we are */ 191170606Srrs struct timeval time_entered; /* the time I built cookie */ 192163953Srrs uint32_t cookie_life; /* life I will award this cookie */ 193163953Srrs uint32_t tie_tag_my_vtag; /* my tag in old association */ 194170606Srrs 195163953Srrs uint32_t tie_tag_peer_vtag; /* peers tag in old association */ 196163953Srrs uint32_t peers_vtag; /* peers tag in INIT (for quick ref) */ 197170606Srrs 198163953Srrs uint32_t my_vtag; /* my tag in INIT-ACK (for quick ref) */ 199167598Srrs uint32_t address[SCTP_ADDRESS_SIZE]; /* 4 ints/128 bits */ 200163953Srrs uint32_t addr_type; /* address type */ 201167598Srrs uint32_t laddress[SCTP_ADDRESS_SIZE]; /* my local from address */ 202163953Srrs uint32_t laddr_type; /* my local from address type */ 203163953Srrs uint32_t scope_id; /* v6 scope id for link-locals */ 204170606Srrs 205163953Srrs uint16_t peerport; /* port address of the peer in the INIT */ 206163953Srrs uint16_t myport; /* my port address used in the INIT */ 207347154Stuexen uint8_t ipv4_addr_legal; /* Are V4 addr legal? */ 208347154Stuexen uint8_t ipv6_addr_legal; /* Are V6 addr legal? */ 209163953Srrs uint8_t local_scope; /* IPv6 local scope flag */ 210163953Srrs uint8_t site_scope; /* IPv6 site scope flag */ 211170606Srrs 212163953Srrs uint8_t ipv4_scope; /* IPv4 private addr scope */ 213163953Srrs uint8_t loopback_scope; /* loopback scope information */ 214170606Srrs uint8_t reserved[SCTP_RESERVE_SPACE]; /* Align to 64 bits */ 215163953Srrs /* 216163953Srrs * at the end is tacked on the INIT chunk and the INIT-ACK chunk 217163953Srrs * (minus the cookie). 218163953Srrs */ 219170606Srrs} SCTP_PACKED; 220163953Srrs 221163953Srrs/* state cookie parameter */ 222163953Srrsstruct sctp_state_cookie_param { 223163953Srrs struct sctp_paramhdr ph; 224163953Srrs struct sctp_state_cookie cookie; 225170606Srrs} SCTP_PACKED; 226163953Srrs 227163953Srrsstruct sctp_init_chunk { 228163953Srrs struct sctp_chunkhdr ch; 229163953Srrs struct sctp_init init; 230170606Srrs} SCTP_PACKED; 231163953Srrs 232163953Srrsstruct sctp_init_msg { 233163953Srrs struct sctphdr sh; 234163953Srrs struct sctp_init_chunk msg; 235170606Srrs} SCTP_PACKED; 236163953Srrs 237163953Srrs/* ... used for both INIT and INIT ACK */ 238163953Srrs#define sctp_init_ack sctp_init 239163953Srrs#define sctp_init_ack_chunk sctp_init_chunk 240163953Srrs#define sctp_init_ack_msg sctp_init_msg 241163953Srrs 242163953Srrs 243163953Srrs/* Selective Ack (SACK) */ 244163953Srrsstruct sctp_gap_ack_block { 245163953Srrs uint16_t start; /* Gap Ack block start */ 246163953Srrs uint16_t end; /* Gap Ack block end */ 247170606Srrs} SCTP_PACKED; 248163953Srrs 249163953Srrsstruct sctp_sack { 250163953Srrs uint32_t cum_tsn_ack; /* cumulative TSN Ack */ 251163953Srrs uint32_t a_rwnd; /* updated a_rwnd of sender */ 252163953Srrs uint16_t num_gap_ack_blks; /* number of Gap Ack blocks */ 253163953Srrs uint16_t num_dup_tsns; /* number of duplicate TSNs */ 254163953Srrs /* struct sctp_gap_ack_block's follow */ 255163953Srrs /* uint32_t duplicate_tsn's follow */ 256170606Srrs} SCTP_PACKED; 257163953Srrs 258163953Srrsstruct sctp_sack_chunk { 259163953Srrs struct sctp_chunkhdr ch; 260163953Srrs struct sctp_sack sack; 261170606Srrs} SCTP_PACKED; 262163953Srrs 263185694Srrsstruct sctp_nr_sack { 264185694Srrs uint32_t cum_tsn_ack; /* cumulative TSN Ack */ 265185694Srrs uint32_t a_rwnd; /* updated a_rwnd of sender */ 266185694Srrs uint16_t num_gap_ack_blks; /* number of Gap Ack blocks */ 267185694Srrs uint16_t num_nr_gap_ack_blks; /* number of NR Gap Ack blocks */ 268185694Srrs uint16_t num_dup_tsns; /* number of duplicate TSNs */ 269185694Srrs uint16_t reserved; /* not currently used */ 270185694Srrs /* struct sctp_gap_ack_block's follow */ 271185694Srrs /* uint32_t duplicate_tsn's follow */ 272185694Srrs} SCTP_PACKED; 273185694Srrs 274185694Srrsstruct sctp_nr_sack_chunk { 275185694Srrs struct sctp_chunkhdr ch; 276185694Srrs struct sctp_nr_sack nr_sack; 277185694Srrs} SCTP_PACKED; 278185694Srrs 279185694Srrs 280163953Srrs/* Heartbeat Request (HEARTBEAT) */ 281163953Srrsstruct sctp_heartbeat { 282163953Srrs struct sctp_heartbeat_info_param hb_info; 283170606Srrs} SCTP_PACKED; 284163953Srrs 285163953Srrsstruct sctp_heartbeat_chunk { 286163953Srrs struct sctp_chunkhdr ch; 287163953Srrs struct sctp_heartbeat heartbeat; 288170606Srrs} SCTP_PACKED; 289163953Srrs 290163953Srrs/* ... used for Heartbeat Ack (HEARTBEAT ACK) */ 291163953Srrs#define sctp_heartbeat_ack sctp_heartbeat 292163953Srrs#define sctp_heartbeat_ack_chunk sctp_heartbeat_chunk 293163953Srrs 294163953Srrs 295163953Srrs/* Abort Asssociation (ABORT) */ 296163953Srrsstruct sctp_abort_chunk { 297163953Srrs struct sctp_chunkhdr ch; 298163953Srrs /* optional error cause may follow */ 299170606Srrs} SCTP_PACKED; 300163953Srrs 301163953Srrsstruct sctp_abort_msg { 302163953Srrs struct sctphdr sh; 303163953Srrs struct sctp_abort_chunk msg; 304170606Srrs} SCTP_PACKED; 305163953Srrs 306163953Srrs 307163953Srrs/* Shutdown Association (SHUTDOWN) */ 308163953Srrsstruct sctp_shutdown_chunk { 309163953Srrs struct sctp_chunkhdr ch; 310163953Srrs uint32_t cumulative_tsn_ack; 311170606Srrs} SCTP_PACKED; 312163953Srrs 313163953Srrs 314163953Srrs/* Shutdown Acknowledgment (SHUTDOWN ACK) */ 315163953Srrsstruct sctp_shutdown_ack_chunk { 316163953Srrs struct sctp_chunkhdr ch; 317170606Srrs} SCTP_PACKED; 318163953Srrs 319163953Srrs 320163953Srrs/* Operation Error (ERROR) */ 321163953Srrsstruct sctp_error_chunk { 322163953Srrs struct sctp_chunkhdr ch; 323163953Srrs /* optional error causes follow */ 324170606Srrs} SCTP_PACKED; 325163953Srrs 326163953Srrs 327163953Srrs/* Cookie Echo (COOKIE ECHO) */ 328163953Srrsstruct sctp_cookie_echo_chunk { 329163953Srrs struct sctp_chunkhdr ch; 330163953Srrs struct sctp_state_cookie cookie; 331170606Srrs} SCTP_PACKED; 332163953Srrs 333163953Srrs/* Cookie Acknowledgment (COOKIE ACK) */ 334163953Srrsstruct sctp_cookie_ack_chunk { 335163953Srrs struct sctp_chunkhdr ch; 336170606Srrs} SCTP_PACKED; 337163953Srrs 338163953Srrs/* Explicit Congestion Notification Echo (ECNE) */ 339218072Srrsstruct old_sctp_ecne_chunk { 340218072Srrs struct sctp_chunkhdr ch; 341218072Srrs uint32_t tsn; 342218072Srrs} SCTP_PACKED; 343218072Srrs 344163953Srrsstruct sctp_ecne_chunk { 345163953Srrs struct sctp_chunkhdr ch; 346163953Srrs uint32_t tsn; 347218072Srrs uint32_t num_pkts_since_cwr; 348170606Srrs} SCTP_PACKED; 349163953Srrs 350163953Srrs/* Congestion Window Reduced (CWR) */ 351163953Srrsstruct sctp_cwr_chunk { 352163953Srrs struct sctp_chunkhdr ch; 353163953Srrs uint32_t tsn; 354170606Srrs} SCTP_PACKED; 355163953Srrs 356163953Srrs/* Shutdown Complete (SHUTDOWN COMPLETE) */ 357163953Srrsstruct sctp_shutdown_complete_chunk { 358163953Srrs struct sctp_chunkhdr ch; 359170606Srrs} SCTP_PACKED; 360163953Srrs 361163953Srrsstruct sctp_adaptation_layer_indication { 362163953Srrs struct sctp_paramhdr ph; 363163953Srrs uint32_t indication; 364170606Srrs} SCTP_PACKED; 365163953Srrs 366163953Srrs/* 367163953Srrs * draft-ietf-tsvwg-addip-sctp 368163953Srrs */ 369163953Srrs/* Address/Stream Configuration Change (ASCONF) */ 370163953Srrsstruct sctp_asconf_chunk { 371163953Srrs struct sctp_chunkhdr ch; 372163953Srrs uint32_t serial_number; 373163953Srrs /* lookup address parameter (mandatory) */ 374163953Srrs /* asconf parameters follow */ 375170606Srrs} SCTP_PACKED; 376163953Srrs 377163953Srrs/* Address/Stream Configuration Acknowledge (ASCONF ACK) */ 378163953Srrsstruct sctp_asconf_ack_chunk { 379163953Srrs struct sctp_chunkhdr ch; 380163953Srrs uint32_t serial_number; 381163953Srrs /* asconf parameters follow */ 382170606Srrs} SCTP_PACKED; 383163953Srrs 384163953Srrs/* draft-ietf-tsvwg-prsctp */ 385163953Srrs/* Forward Cumulative TSN (FORWARD TSN) */ 386163953Srrsstruct sctp_forward_tsn_chunk { 387163953Srrs struct sctp_chunkhdr ch; 388163953Srrs uint32_t new_cumulative_tsn; 389163953Srrs /* stream/sequence pairs (sctp_strseq) follow */ 390170606Srrs} SCTP_PACKED; 391163953Srrs 392163953Srrsstruct sctp_strseq { 393310219Stuexen uint16_t sid; 394310219Stuexen uint16_t ssn; 395170606Srrs} SCTP_PACKED; 396163953Srrs 397297662Srrsstruct sctp_strseq_mid { 398310219Stuexen uint16_t sid; 399303267Stuexen uint16_t flags; 400310219Stuexen uint32_t mid; 401297662Srrs}; 402297662Srrs 403163953Srrsstruct sctp_forward_tsn_msg { 404163953Srrs struct sctphdr sh; 405163953Srrs struct sctp_forward_tsn_chunk msg; 406170606Srrs} SCTP_PACKED; 407163953Srrs 408163953Srrs/* should be a multiple of 4 - 1 aka 3/7/11 etc. */ 409163953Srrs 410163953Srrs#define SCTP_NUM_DB_TO_VERIFY 31 411163953Srrs 412163953Srrsstruct sctp_chunk_desc { 413163953Srrs uint8_t chunk_type; 414163953Srrs uint8_t data_bytes[SCTP_NUM_DB_TO_VERIFY]; 415163953Srrs uint32_t tsn_ifany; 416170606Srrs} SCTP_PACKED; 417163953Srrs 418163953Srrs 419163953Srrsstruct sctp_pktdrop_chunk { 420163953Srrs struct sctp_chunkhdr ch; 421163953Srrs uint32_t bottle_bw; 422163953Srrs uint32_t current_onq; 423163953Srrs uint16_t trunc_len; 424163953Srrs uint16_t reserved; 425202782Stuexen uint8_t data[]; 426170606Srrs} SCTP_PACKED; 427163953Srrs 428163953Srrs/**********STREAM RESET STUFF ******************/ 429163953Srrs 430273168Stuexenstruct sctp_stream_reset_request { 431273168Stuexen struct sctp_paramhdr ph; 432273168Stuexen uint32_t request_seq; 433273168Stuexen} SCTP_PACKED; 434273168Stuexen 435163953Srrsstruct sctp_stream_reset_out_request { 436163953Srrs struct sctp_paramhdr ph; 437163953Srrs uint32_t request_seq; /* monotonically increasing seq no */ 438163953Srrs uint32_t response_seq; /* if a response, the resp seq no */ 439163953Srrs uint32_t send_reset_at_tsn; /* last TSN I assigned outbound */ 440202782Stuexen uint16_t list_of_streams[]; /* if not all list of streams */ 441170606Srrs} SCTP_PACKED; 442163953Srrs 443163953Srrsstruct sctp_stream_reset_in_request { 444163953Srrs struct sctp_paramhdr ph; 445163953Srrs uint32_t request_seq; 446202782Stuexen uint16_t list_of_streams[]; /* if not all list of streams */ 447170606Srrs} SCTP_PACKED; 448163953Srrs 449163953Srrsstruct sctp_stream_reset_tsn_request { 450163953Srrs struct sctp_paramhdr ph; 451163953Srrs uint32_t request_seq; 452170606Srrs} SCTP_PACKED; 453163953Srrs 454163953Srrsstruct sctp_stream_reset_response { 455163953Srrs struct sctp_paramhdr ph; 456163953Srrs uint32_t response_seq; /* if a response, the resp seq no */ 457163953Srrs uint32_t result; 458170606Srrs} SCTP_PACKED; 459163953Srrs 460163953Srrsstruct sctp_stream_reset_response_tsn { 461163953Srrs struct sctp_paramhdr ph; 462163953Srrs uint32_t response_seq; /* if a response, the resp seq no */ 463163953Srrs uint32_t result; 464163953Srrs uint32_t senders_next_tsn; 465163953Srrs uint32_t receivers_next_tsn; 466170606Srrs} SCTP_PACKED; 467163953Srrs 468188854Srrsstruct sctp_stream_reset_add_strm { 469188854Srrs struct sctp_paramhdr ph; 470188854Srrs uint32_t request_seq; 471188854Srrs uint16_t number_of_streams; 472188854Srrs uint16_t reserved; 473203847Stuexen} SCTP_PACKED; 474163953Srrs 475235064Stuexen#define SCTP_STREAM_RESET_RESULT_NOTHING_TO_DO 0x00000000 /* XXX: unused */ 476235064Stuexen#define SCTP_STREAM_RESET_RESULT_PERFORMED 0x00000001 477235064Stuexen#define SCTP_STREAM_RESET_RESULT_DENIED 0x00000002 478235064Stuexen#define SCTP_STREAM_RESET_RESULT_ERR__WRONG_SSN 0x00000003 /* XXX: unused */ 479235064Stuexen#define SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS 0x00000004 480235064Stuexen#define SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO 0x00000005 481235064Stuexen#define SCTP_STREAM_RESET_RESULT_IN_PROGRESS 0x00000006 /* XXX: unused */ 482163953Srrs 483163953Srrs/* 484163953Srrs * convience structures, note that if you are making a request for specific 485163953Srrs * streams then the request will need to be an overlay structure. 486163953Srrs */ 487163953Srrs 488163953Srrsstruct sctp_stream_reset_tsn_req { 489163953Srrs struct sctp_chunkhdr ch; 490163953Srrs struct sctp_stream_reset_tsn_request sr_req; 491170606Srrs} SCTP_PACKED; 492163953Srrs 493163953Srrsstruct sctp_stream_reset_resp { 494163953Srrs struct sctp_chunkhdr ch; 495163953Srrs struct sctp_stream_reset_response sr_resp; 496170606Srrs} SCTP_PACKED; 497163953Srrs 498163953Srrs/* respone only valid with a TSN request */ 499163953Srrsstruct sctp_stream_reset_resp_tsn { 500163953Srrs struct sctp_chunkhdr ch; 501163953Srrs struct sctp_stream_reset_response_tsn sr_resp; 502170606Srrs} SCTP_PACKED; 503163953Srrs 504163953Srrs/****************************************************/ 505163953Srrs 506163953Srrs/* 507163953Srrs * Authenticated chunks support draft-ietf-tsvwg-sctp-auth 508163953Srrs */ 509169208Srrs 510169208Srrs/* Should we make the max be 32? */ 511169208Srrs#define SCTP_RANDOM_MAX_SIZE 256 512163953Srrsstruct sctp_auth_random { 513347154Stuexen struct sctp_paramhdr ph; /* type = 0x8002 */ 514202782Stuexen uint8_t random_data[]; 515170606Srrs} SCTP_PACKED; 516163953Srrs 517163953Srrsstruct sctp_auth_chunk_list { 518347154Stuexen struct sctp_paramhdr ph; /* type = 0x8003 */ 519202782Stuexen uint8_t chunk_types[]; 520170606Srrs} SCTP_PACKED; 521163953Srrs 522163953Srrsstruct sctp_auth_hmac_algo { 523347154Stuexen struct sctp_paramhdr ph; /* type = 0x8004 */ 524202782Stuexen uint16_t hmac_ids[]; 525170606Srrs} SCTP_PACKED; 526163953Srrs 527163953Srrsstruct sctp_auth_chunk { 528163953Srrs struct sctp_chunkhdr ch; 529163953Srrs uint16_t shared_key_id; 530163953Srrs uint16_t hmac_id; 531202782Stuexen uint8_t hmac[]; 532170606Srrs} SCTP_PACKED; 533163953Srrs 534163953Srrs/* 535163953Srrs * we pre-reserve enough room for a ECNE or CWR AND a SACK with no missing 536163953Srrs * pieces. If ENCE is missing we could have a couple of blocks. This way we 537163953Srrs * optimize so we MOST likely can bundle a SACK/ECN with the smallest size 538163953Srrs * data chunk I will split into. We could increase throughput slightly by 539163953Srrs * taking out these two but the 24-sack/8-CWR i.e. 32 bytes I pre-reserve I 540163953Srrs * feel is worth it for now. 541163953Srrs */ 542163953Srrs#ifndef SCTP_MAX_OVERHEAD 543167598Srrs#ifdef INET6 544163953Srrs#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 545163953Srrs sizeof(struct sctphdr) + \ 546163953Srrs sizeof(struct sctp_ecne_chunk) + \ 547163953Srrs sizeof(struct sctp_sack_chunk) + \ 548163953Srrs sizeof(struct ip6_hdr)) 549163953Srrs 550163953Srrs#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 551163953Srrs sizeof(struct sctphdr) + \ 552163953Srrs sizeof(struct ip6_hdr)) 553163953Srrs 554163953Srrs 555163953Srrs#define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \ 556163953Srrs sizeof(struct sctphdr)) 557163953Srrs 558163953Srrs#else 559163953Srrs#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 560163953Srrs sizeof(struct sctphdr) + \ 561163953Srrs sizeof(struct sctp_ecne_chunk) + \ 562163953Srrs sizeof(struct sctp_sack_chunk) + \ 563163953Srrs sizeof(struct ip)) 564163953Srrs 565163953Srrs#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 566163953Srrs sizeof(struct sctphdr) + \ 567163953Srrs sizeof(struct ip)) 568163953Srrs 569163953Srrs 570163953Srrs#define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \ 571163953Srrs sizeof(struct sctphdr)) 572163953Srrs 573167598Srrs#endif /* INET6 */ 574163953Srrs#endif /* !SCTP_MAX_OVERHEAD */ 575163953Srrs 576163953Srrs#define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 577163953Srrs sizeof(struct sctphdr) + \ 578163953Srrs sizeof(struct ip)) 579163953Srrs 580163953Srrs#define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \ 581163953Srrs sizeof(struct sctphdr)) 582163953Srrs 583179783Srrs#undef SCTP_PACKED 584163953Srrs#endif /* !__sctp_header_h__ */ 585