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