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$"); 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 { 49163953Srrs 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 { 57163953Srrs 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 { 63163953Srrs 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 { 70163953Srrs 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 { 81163953Srrs 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" */ 109163953Srrs struct sctp_paramhdr ph;/* a SCTP parameter header */ 110163953Srrs 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 { 134163953Srrs 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; 144163953Srrs uint16_t stream_id; 145163953Srrs uint16_t stream_sequence; 146163953Srrs uint32_t protocol_id; 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 155163953Srrs/* 156163953Srrs * Structures for the control chunks 157163953Srrs */ 158163953Srrs 159163953Srrs/* Initiate (INIT)/Initiate Ack (INIT ACK) */ 160163953Srrsstruct sctp_init { 161163953Srrs uint32_t initiate_tag; /* initiate tag */ 162163953Srrs uint32_t a_rwnd; /* a_rwnd */ 163163953Srrs uint16_t num_outbound_streams; /* OS */ 164163953Srrs uint16_t num_inbound_streams; /* MIS */ 165163953Srrs uint32_t initial_tsn; /* I-TSN */ 166163953Srrs /* optional param's follow */ 167170606Srrs} SCTP_PACKED; 168163953Srrs 169167598Srrs#define SCTP_IDENTIFICATION_SIZE 16 170167598Srrs#define SCTP_ADDRESS_SIZE 4 171170606Srrs#define SCTP_RESERVE_SPACE 6 172163953Srrs/* state cookie header */ 173163953Srrsstruct sctp_state_cookie { /* this is our definition... */ 174167598Srrs uint8_t identification[SCTP_IDENTIFICATION_SIZE]; /* id of who we are */ 175170606Srrs struct timeval time_entered; /* the time I built cookie */ 176163953Srrs uint32_t cookie_life; /* life I will award this cookie */ 177163953Srrs uint32_t tie_tag_my_vtag; /* my tag in old association */ 178170606Srrs 179163953Srrs uint32_t tie_tag_peer_vtag; /* peers tag in old association */ 180163953Srrs uint32_t peers_vtag; /* peers tag in INIT (for quick ref) */ 181170606Srrs 182163953Srrs uint32_t my_vtag; /* my tag in INIT-ACK (for quick ref) */ 183167598Srrs uint32_t address[SCTP_ADDRESS_SIZE]; /* 4 ints/128 bits */ 184163953Srrs uint32_t addr_type; /* address type */ 185167598Srrs uint32_t laddress[SCTP_ADDRESS_SIZE]; /* my local from address */ 186163953Srrs uint32_t laddr_type; /* my local from address type */ 187163953Srrs uint32_t scope_id; /* v6 scope id for link-locals */ 188170606Srrs 189163953Srrs uint16_t peerport; /* port address of the peer in the INIT */ 190163953Srrs uint16_t myport; /* my port address used in the INIT */ 191163953Srrs uint8_t ipv4_addr_legal;/* Are V4 addr legal? */ 192163953Srrs uint8_t ipv6_addr_legal;/* Are V6 addr legal? */ 193163953Srrs uint8_t local_scope; /* IPv6 local scope flag */ 194163953Srrs uint8_t site_scope; /* IPv6 site scope flag */ 195170606Srrs 196163953Srrs uint8_t ipv4_scope; /* IPv4 private addr scope */ 197163953Srrs uint8_t loopback_scope; /* loopback scope information */ 198170606Srrs uint8_t reserved[SCTP_RESERVE_SPACE]; /* Align to 64 bits */ 199163953Srrs /* 200163953Srrs * at the end is tacked on the INIT chunk and the INIT-ACK chunk 201163953Srrs * (minus the cookie). 202163953Srrs */ 203170606Srrs} SCTP_PACKED; 204163953Srrs 205185694Srrs 206185694Srrs/* Used for NAT state error cause */ 207185694Srrsstruct sctp_missing_nat_state { 208185694Srrs uint16_t cause; 209185694Srrs uint16_t length; 210202782Stuexen uint8_t data[]; 211185694Srrs} SCTP_PACKED; 212185694Srrs 213185694Srrs 214163953Srrsstruct sctp_inv_mandatory_param { 215163953Srrs uint16_t cause; 216163953Srrs uint16_t length; 217163953Srrs uint32_t num_param; 218163953Srrs uint16_t param; 219163953Srrs /* 220163953Srrs * We include this to 0 it since only a missing cookie will cause 221163953Srrs * this error. 222163953Srrs */ 223163953Srrs uint16_t resv; 224170606Srrs} SCTP_PACKED; 225163953Srrs 226163953Srrsstruct sctp_unresolv_addr { 227163953Srrs uint16_t cause; 228163953Srrs uint16_t length; 229163953Srrs uint16_t addr_type; 230163953Srrs uint16_t reserved; /* Only one invalid addr type */ 231170606Srrs} SCTP_PACKED; 232163953Srrs 233163953Srrs/* state cookie parameter */ 234163953Srrsstruct sctp_state_cookie_param { 235163953Srrs struct sctp_paramhdr ph; 236163953Srrs struct sctp_state_cookie cookie; 237170606Srrs} SCTP_PACKED; 238163953Srrs 239163953Srrsstruct sctp_init_chunk { 240163953Srrs struct sctp_chunkhdr ch; 241163953Srrs struct sctp_init init; 242170606Srrs} SCTP_PACKED; 243163953Srrs 244163953Srrsstruct sctp_init_msg { 245163953Srrs struct sctphdr sh; 246163953Srrs struct sctp_init_chunk msg; 247170606Srrs} SCTP_PACKED; 248163953Srrs 249163953Srrs/* ... used for both INIT and INIT ACK */ 250163953Srrs#define sctp_init_ack sctp_init 251163953Srrs#define sctp_init_ack_chunk sctp_init_chunk 252163953Srrs#define sctp_init_ack_msg sctp_init_msg 253163953Srrs 254163953Srrs 255163953Srrs/* Selective Ack (SACK) */ 256163953Srrsstruct sctp_gap_ack_block { 257163953Srrs uint16_t start; /* Gap Ack block start */ 258163953Srrs uint16_t end; /* Gap Ack block end */ 259170606Srrs} SCTP_PACKED; 260163953Srrs 261163953Srrsstruct sctp_sack { 262163953Srrs uint32_t cum_tsn_ack; /* cumulative TSN Ack */ 263163953Srrs uint32_t a_rwnd; /* updated a_rwnd of sender */ 264163953Srrs uint16_t num_gap_ack_blks; /* number of Gap Ack blocks */ 265163953Srrs uint16_t num_dup_tsns; /* number of duplicate TSNs */ 266163953Srrs /* struct sctp_gap_ack_block's follow */ 267163953Srrs /* uint32_t duplicate_tsn's follow */ 268170606Srrs} SCTP_PACKED; 269163953Srrs 270163953Srrsstruct sctp_sack_chunk { 271163953Srrs struct sctp_chunkhdr ch; 272163953Srrs struct sctp_sack sack; 273170606Srrs} SCTP_PACKED; 274163953Srrs 275185694Srrsstruct sctp_nr_sack { 276185694Srrs uint32_t cum_tsn_ack; /* cumulative TSN Ack */ 277185694Srrs uint32_t a_rwnd; /* updated a_rwnd of sender */ 278185694Srrs uint16_t num_gap_ack_blks; /* number of Gap Ack blocks */ 279185694Srrs uint16_t num_nr_gap_ack_blks; /* number of NR Gap Ack blocks */ 280185694Srrs uint16_t num_dup_tsns; /* number of duplicate TSNs */ 281185694Srrs uint16_t reserved; /* not currently used */ 282185694Srrs /* struct sctp_gap_ack_block's follow */ 283185694Srrs /* uint32_t duplicate_tsn's follow */ 284185694Srrs} SCTP_PACKED; 285185694Srrs 286185694Srrsstruct sctp_nr_sack_chunk { 287185694Srrs struct sctp_chunkhdr ch; 288185694Srrs struct sctp_nr_sack nr_sack; 289185694Srrs} SCTP_PACKED; 290185694Srrs 291185694Srrs 292163953Srrs/* Heartbeat Request (HEARTBEAT) */ 293163953Srrsstruct sctp_heartbeat { 294163953Srrs struct sctp_heartbeat_info_param hb_info; 295170606Srrs} SCTP_PACKED; 296163953Srrs 297163953Srrsstruct sctp_heartbeat_chunk { 298163953Srrs struct sctp_chunkhdr ch; 299163953Srrs struct sctp_heartbeat heartbeat; 300170606Srrs} SCTP_PACKED; 301163953Srrs 302163953Srrs/* ... used for Heartbeat Ack (HEARTBEAT ACK) */ 303163953Srrs#define sctp_heartbeat_ack sctp_heartbeat 304163953Srrs#define sctp_heartbeat_ack_chunk sctp_heartbeat_chunk 305163953Srrs 306163953Srrs 307163953Srrs/* Abort Asssociation (ABORT) */ 308163953Srrsstruct sctp_abort_chunk { 309163953Srrs struct sctp_chunkhdr ch; 310163953Srrs /* optional error cause may follow */ 311170606Srrs} SCTP_PACKED; 312163953Srrs 313163953Srrsstruct sctp_abort_msg { 314163953Srrs struct sctphdr sh; 315163953Srrs struct sctp_abort_chunk msg; 316170606Srrs} SCTP_PACKED; 317163953Srrs 318163953Srrs 319163953Srrs/* Shutdown Association (SHUTDOWN) */ 320163953Srrsstruct sctp_shutdown_chunk { 321163953Srrs struct sctp_chunkhdr ch; 322163953Srrs uint32_t cumulative_tsn_ack; 323170606Srrs} SCTP_PACKED; 324163953Srrs 325163953Srrs 326163953Srrs/* Shutdown Acknowledgment (SHUTDOWN ACK) */ 327163953Srrsstruct sctp_shutdown_ack_chunk { 328163953Srrs struct sctp_chunkhdr ch; 329170606Srrs} SCTP_PACKED; 330163953Srrs 331163953Srrs 332163953Srrs/* Operation Error (ERROR) */ 333163953Srrsstruct sctp_error_chunk { 334163953Srrs struct sctp_chunkhdr ch; 335163953Srrs /* optional error causes follow */ 336170606Srrs} SCTP_PACKED; 337163953Srrs 338163953Srrs 339163953Srrs/* Cookie Echo (COOKIE ECHO) */ 340163953Srrsstruct sctp_cookie_echo_chunk { 341163953Srrs struct sctp_chunkhdr ch; 342163953Srrs struct sctp_state_cookie cookie; 343170606Srrs} SCTP_PACKED; 344163953Srrs 345163953Srrs/* Cookie Acknowledgment (COOKIE ACK) */ 346163953Srrsstruct sctp_cookie_ack_chunk { 347163953Srrs struct sctp_chunkhdr ch; 348170606Srrs} SCTP_PACKED; 349163953Srrs 350163953Srrs/* Explicit Congestion Notification Echo (ECNE) */ 351218072Srrsstruct old_sctp_ecne_chunk { 352218072Srrs struct sctp_chunkhdr ch; 353218072Srrs uint32_t tsn; 354218072Srrs} SCTP_PACKED; 355218072Srrs 356163953Srrsstruct sctp_ecne_chunk { 357163953Srrs struct sctp_chunkhdr ch; 358163953Srrs uint32_t tsn; 359218072Srrs uint32_t num_pkts_since_cwr; 360170606Srrs} SCTP_PACKED; 361163953Srrs 362163953Srrs/* Congestion Window Reduced (CWR) */ 363163953Srrsstruct sctp_cwr_chunk { 364163953Srrs struct sctp_chunkhdr ch; 365163953Srrs uint32_t tsn; 366170606Srrs} SCTP_PACKED; 367163953Srrs 368163953Srrs/* Shutdown Complete (SHUTDOWN COMPLETE) */ 369163953Srrsstruct sctp_shutdown_complete_chunk { 370163953Srrs struct sctp_chunkhdr ch; 371170606Srrs} SCTP_PACKED; 372163953Srrs 373163953Srrs/* Oper error holding a stale cookie */ 374163953Srrsstruct sctp_stale_cookie_msg { 375163953Srrs struct sctp_paramhdr ph;/* really an error cause */ 376163953Srrs uint32_t time_usec; 377170606Srrs} SCTP_PACKED; 378163953Srrs 379163953Srrsstruct sctp_adaptation_layer_indication { 380163953Srrs struct sctp_paramhdr ph; 381163953Srrs uint32_t indication; 382170606Srrs} SCTP_PACKED; 383163953Srrs 384163953Srrsstruct sctp_cookie_while_shutting_down { 385163953Srrs struct sctphdr sh; 386163953Srrs struct sctp_chunkhdr ch; 387163953Srrs struct sctp_paramhdr ph;/* really an error cause */ 388170606Srrs} SCTP_PACKED; 389163953Srrs 390163953Srrsstruct sctp_shutdown_complete_msg { 391163953Srrs struct sctphdr sh; 392163953Srrs struct sctp_shutdown_complete_chunk shut_cmp; 393170606Srrs} SCTP_PACKED; 394163953Srrs 395163953Srrs/* 396163953Srrs * draft-ietf-tsvwg-addip-sctp 397163953Srrs */ 398163953Srrs/* Address/Stream Configuration Change (ASCONF) */ 399163953Srrsstruct sctp_asconf_chunk { 400163953Srrs struct sctp_chunkhdr ch; 401163953Srrs uint32_t serial_number; 402163953Srrs /* lookup address parameter (mandatory) */ 403163953Srrs /* asconf parameters follow */ 404170606Srrs} SCTP_PACKED; 405163953Srrs 406163953Srrs/* Address/Stream Configuration Acknowledge (ASCONF ACK) */ 407163953Srrsstruct sctp_asconf_ack_chunk { 408163953Srrs struct sctp_chunkhdr ch; 409163953Srrs uint32_t serial_number; 410163953Srrs /* asconf parameters follow */ 411170606Srrs} SCTP_PACKED; 412163953Srrs 413163953Srrs/* draft-ietf-tsvwg-prsctp */ 414163953Srrs/* Forward Cumulative TSN (FORWARD TSN) */ 415163953Srrsstruct sctp_forward_tsn_chunk { 416163953Srrs struct sctp_chunkhdr ch; 417163953Srrs uint32_t new_cumulative_tsn; 418163953Srrs /* stream/sequence pairs (sctp_strseq) follow */ 419170606Srrs} SCTP_PACKED; 420163953Srrs 421163953Srrsstruct sctp_strseq { 422163953Srrs uint16_t stream; 423163953Srrs uint16_t sequence; 424170606Srrs} SCTP_PACKED; 425163953Srrs 426163953Srrsstruct sctp_forward_tsn_msg { 427163953Srrs struct sctphdr sh; 428163953Srrs struct sctp_forward_tsn_chunk msg; 429170606Srrs} SCTP_PACKED; 430163953Srrs 431163953Srrs/* should be a multiple of 4 - 1 aka 3/7/11 etc. */ 432163953Srrs 433163953Srrs#define SCTP_NUM_DB_TO_VERIFY 31 434163953Srrs 435163953Srrsstruct sctp_chunk_desc { 436163953Srrs uint8_t chunk_type; 437163953Srrs uint8_t data_bytes[SCTP_NUM_DB_TO_VERIFY]; 438163953Srrs uint32_t tsn_ifany; 439170606Srrs} SCTP_PACKED; 440163953Srrs 441163953Srrs 442163953Srrsstruct sctp_pktdrop_chunk { 443163953Srrs struct sctp_chunkhdr ch; 444163953Srrs uint32_t bottle_bw; 445163953Srrs uint32_t current_onq; 446163953Srrs uint16_t trunc_len; 447163953Srrs uint16_t reserved; 448202782Stuexen uint8_t data[]; 449170606Srrs} SCTP_PACKED; 450163953Srrs 451163953Srrs/**********STREAM RESET STUFF ******************/ 452163953Srrs 453273303Stuexenstruct sctp_stream_reset_request { 454273303Stuexen struct sctp_paramhdr ph; 455273303Stuexen uint32_t request_seq; 456273303Stuexen} SCTP_PACKED; 457273303Stuexen 458163953Srrsstruct sctp_stream_reset_out_request { 459163953Srrs struct sctp_paramhdr ph; 460163953Srrs uint32_t request_seq; /* monotonically increasing seq no */ 461163953Srrs uint32_t response_seq; /* if a response, the resp seq no */ 462163953Srrs uint32_t send_reset_at_tsn; /* last TSN I assigned outbound */ 463202782Stuexen uint16_t list_of_streams[]; /* if not all list of streams */ 464170606Srrs} SCTP_PACKED; 465163953Srrs 466163953Srrsstruct sctp_stream_reset_in_request { 467163953Srrs struct sctp_paramhdr ph; 468163953Srrs uint32_t request_seq; 469202782Stuexen uint16_t list_of_streams[]; /* if not all list of streams */ 470170606Srrs} SCTP_PACKED; 471163953Srrs 472163953Srrsstruct sctp_stream_reset_tsn_request { 473163953Srrs struct sctp_paramhdr ph; 474163953Srrs uint32_t request_seq; 475170606Srrs} SCTP_PACKED; 476163953Srrs 477163953Srrsstruct sctp_stream_reset_response { 478163953Srrs struct sctp_paramhdr ph; 479163953Srrs uint32_t response_seq; /* if a response, the resp seq no */ 480163953Srrs uint32_t result; 481170606Srrs} SCTP_PACKED; 482163953Srrs 483163953Srrsstruct sctp_stream_reset_response_tsn { 484163953Srrs struct sctp_paramhdr ph; 485163953Srrs uint32_t response_seq; /* if a response, the resp seq no */ 486163953Srrs uint32_t result; 487163953Srrs uint32_t senders_next_tsn; 488163953Srrs uint32_t receivers_next_tsn; 489170606Srrs} SCTP_PACKED; 490163953Srrs 491188854Srrsstruct sctp_stream_reset_add_strm { 492188854Srrs struct sctp_paramhdr ph; 493188854Srrs uint32_t request_seq; 494188854Srrs uint16_t number_of_streams; 495188854Srrs uint16_t reserved; 496203847Stuexen} SCTP_PACKED; 497163953Srrs 498235064Stuexen#define SCTP_STREAM_RESET_RESULT_NOTHING_TO_DO 0x00000000 /* XXX: unused */ 499235064Stuexen#define SCTP_STREAM_RESET_RESULT_PERFORMED 0x00000001 500235064Stuexen#define SCTP_STREAM_RESET_RESULT_DENIED 0x00000002 501235064Stuexen#define SCTP_STREAM_RESET_RESULT_ERR__WRONG_SSN 0x00000003 /* XXX: unused */ 502235064Stuexen#define SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS 0x00000004 503235064Stuexen#define SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO 0x00000005 504235064Stuexen#define SCTP_STREAM_RESET_RESULT_IN_PROGRESS 0x00000006 /* XXX: unused */ 505163953Srrs 506163953Srrs/* 507163953Srrs * convience structures, note that if you are making a request for specific 508163953Srrs * streams then the request will need to be an overlay structure. 509163953Srrs */ 510163953Srrs 511163953Srrsstruct sctp_stream_reset_tsn_req { 512163953Srrs struct sctp_chunkhdr ch; 513163953Srrs struct sctp_stream_reset_tsn_request sr_req; 514170606Srrs} SCTP_PACKED; 515163953Srrs 516163953Srrsstruct sctp_stream_reset_resp { 517163953Srrs struct sctp_chunkhdr ch; 518163953Srrs struct sctp_stream_reset_response sr_resp; 519170606Srrs} SCTP_PACKED; 520163953Srrs 521163953Srrs/* respone only valid with a TSN request */ 522163953Srrsstruct sctp_stream_reset_resp_tsn { 523163953Srrs struct sctp_chunkhdr ch; 524163953Srrs struct sctp_stream_reset_response_tsn sr_resp; 525170606Srrs} SCTP_PACKED; 526163953Srrs 527163953Srrs/****************************************************/ 528163953Srrs 529163953Srrs/* 530163953Srrs * Authenticated chunks support draft-ietf-tsvwg-sctp-auth 531163953Srrs */ 532169208Srrs 533169208Srrs/* Should we make the max be 32? */ 534169208Srrs#define SCTP_RANDOM_MAX_SIZE 256 535163953Srrsstruct sctp_auth_random { 536163953Srrs struct sctp_paramhdr ph;/* type = 0x8002 */ 537202782Stuexen uint8_t random_data[]; 538170606Srrs} SCTP_PACKED; 539163953Srrs 540163953Srrsstruct sctp_auth_chunk_list { 541163953Srrs struct sctp_paramhdr ph;/* type = 0x8003 */ 542202782Stuexen uint8_t chunk_types[]; 543170606Srrs} SCTP_PACKED; 544163953Srrs 545163953Srrsstruct sctp_auth_hmac_algo { 546163953Srrs struct sctp_paramhdr ph;/* type = 0x8004 */ 547202782Stuexen uint16_t hmac_ids[]; 548170606Srrs} SCTP_PACKED; 549163953Srrs 550163953Srrsstruct sctp_auth_chunk { 551163953Srrs struct sctp_chunkhdr ch; 552163953Srrs uint16_t shared_key_id; 553163953Srrs uint16_t hmac_id; 554202782Stuexen uint8_t hmac[]; 555170606Srrs} SCTP_PACKED; 556163953Srrs 557163953Srrsstruct sctp_auth_invalid_hmac { 558163953Srrs struct sctp_paramhdr ph; 559163953Srrs uint16_t hmac_id; 560163953Srrs uint16_t padding; 561170606Srrs} SCTP_PACKED; 562163953Srrs 563163953Srrs/* 564163953Srrs * we pre-reserve enough room for a ECNE or CWR AND a SACK with no missing 565163953Srrs * pieces. If ENCE is missing we could have a couple of blocks. This way we 566163953Srrs * optimize so we MOST likely can bundle a SACK/ECN with the smallest size 567163953Srrs * data chunk I will split into. We could increase throughput slightly by 568163953Srrs * taking out these two but the 24-sack/8-CWR i.e. 32 bytes I pre-reserve I 569163953Srrs * feel is worth it for now. 570163953Srrs */ 571163953Srrs#ifndef SCTP_MAX_OVERHEAD 572167598Srrs#ifdef INET6 573163953Srrs#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 574163953Srrs sizeof(struct sctphdr) + \ 575163953Srrs sizeof(struct sctp_ecne_chunk) + \ 576163953Srrs sizeof(struct sctp_sack_chunk) + \ 577163953Srrs sizeof(struct ip6_hdr)) 578163953Srrs 579163953Srrs#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 580163953Srrs sizeof(struct sctphdr) + \ 581163953Srrs sizeof(struct ip6_hdr)) 582163953Srrs 583163953Srrs 584163953Srrs#define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \ 585163953Srrs sizeof(struct sctphdr)) 586163953Srrs 587163953Srrs#else 588163953Srrs#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 589163953Srrs sizeof(struct sctphdr) + \ 590163953Srrs sizeof(struct sctp_ecne_chunk) + \ 591163953Srrs sizeof(struct sctp_sack_chunk) + \ 592163953Srrs sizeof(struct ip)) 593163953Srrs 594163953Srrs#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 595163953Srrs sizeof(struct sctphdr) + \ 596163953Srrs sizeof(struct ip)) 597163953Srrs 598163953Srrs 599163953Srrs#define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \ 600163953Srrs sizeof(struct sctphdr)) 601163953Srrs 602167598Srrs#endif /* INET6 */ 603163953Srrs#endif /* !SCTP_MAX_OVERHEAD */ 604163953Srrs 605163953Srrs#define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 606163953Srrs sizeof(struct sctphdr) + \ 607163953Srrs sizeof(struct ip)) 608163953Srrs 609163953Srrs#define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \ 610163953Srrs sizeof(struct sctphdr)) 611163953Srrs 612179783Srrs#undef SCTP_PACKED 613163953Srrs#endif /* !__sctp_header_h__ */ 614