1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/sctp/src/netinet/sctp_header.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,639 @@ 1.4 +/*- 1.5 + * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 1.6 + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 1.7 + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 1.8 + * 1.9 + * Redistribution and use in source and binary forms, with or without 1.10 + * modification, are permitted provided that the following conditions are met: 1.11 + * 1.12 + * a) Redistributions of source code must retain the above copyright notice, 1.13 + * this list of conditions and the following disclaimer. 1.14 + * 1.15 + * b) Redistributions in binary form must reproduce the above copyright 1.16 + * notice, this list of conditions and the following disclaimer in 1.17 + * the documentation and/or other materials provided with the distribution. 1.18 + * 1.19 + * c) Neither the name of Cisco Systems, Inc. nor the names of its 1.20 + * contributors may be used to endorse or promote products derived 1.21 + * from this software without specific prior written permission. 1.22 + * 1.23 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.24 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 1.25 + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.26 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 1.27 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1.28 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1.29 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1.30 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1.31 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.32 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 1.33 + * THE POSSIBILITY OF SUCH DAMAGE. 1.34 + */ 1.35 + 1.36 +#ifdef __FreeBSD__ 1.37 +#include <sys/cdefs.h> 1.38 +__FBSDID("$FreeBSD: head/sys/netinet/sctp_header.h 240198 2012-09-07 13:36:42Z tuexen $"); 1.39 +#endif 1.40 + 1.41 +#ifndef _NETINET_SCTP_HEADER_H_ 1.42 +#define _NETINET_SCTP_HEADER_H_ 1.43 + 1.44 +#if defined(__Windows__) && !defined(__Userspace_os_Windows) 1.45 +#include <packon.h> 1.46 +#endif 1.47 +#if !defined(__Userspace_os_Windows) 1.48 +#include <sys/time.h> 1.49 +#endif 1.50 +#include <netinet/sctp.h> 1.51 +#include <netinet/sctp_constants.h> 1.52 + 1.53 +#if !defined(__Userspace_os_Windows) 1.54 +#define SCTP_PACKED __attribute__((packed)) 1.55 +#else 1.56 +#pragma pack (push, 1) 1.57 +#define SCTP_PACKED 1.58 +#endif 1.59 + 1.60 +/* 1.61 + * Parameter structures 1.62 + */ 1.63 +struct sctp_ipv4addr_param { 1.64 + struct sctp_paramhdr ph;/* type=SCTP_IPV4_PARAM_TYPE, len=8 */ 1.65 + uint32_t addr; /* IPV4 address */ 1.66 +} SCTP_PACKED; 1.67 + 1.68 +#define SCTP_V6_ADDR_BYTES 16 1.69 + 1.70 + 1.71 +struct sctp_ipv6addr_param { 1.72 + struct sctp_paramhdr ph;/* type=SCTP_IPV6_PARAM_TYPE, len=20 */ 1.73 + uint8_t addr[SCTP_V6_ADDR_BYTES]; /* IPV6 address */ 1.74 +} SCTP_PACKED; 1.75 + 1.76 +/* Cookie Preservative */ 1.77 +struct sctp_cookie_perserve_param { 1.78 + struct sctp_paramhdr ph;/* type=SCTP_COOKIE_PRESERVE, len=8 */ 1.79 + uint32_t time; /* time in ms to extend cookie */ 1.80 +} SCTP_PACKED; 1.81 + 1.82 +#define SCTP_ARRAY_MIN_LEN 1 1.83 +/* Host Name Address */ 1.84 +struct sctp_host_name_param { 1.85 + struct sctp_paramhdr ph;/* type=SCTP_HOSTNAME_ADDRESS */ 1.86 + char name[SCTP_ARRAY_MIN_LEN]; /* host name */ 1.87 +} SCTP_PACKED; 1.88 + 1.89 +/* 1.90 + * This is the maximum padded size of a s-a-p 1.91 + * so paramheadr + 3 address types (6 bytes) + 2 byte pad = 12 1.92 + */ 1.93 +#define SCTP_MAX_ADDR_PARAMS_SIZE 12 1.94 +/* supported address type */ 1.95 +struct sctp_supported_addr_param { 1.96 + struct sctp_paramhdr ph;/* type=SCTP_SUPPORTED_ADDRTYPE */ 1.97 + uint16_t addr_type[2]; /* array of supported address types */ 1.98 +} SCTP_PACKED; 1.99 + 1.100 +/* ECN parameter */ 1.101 +struct sctp_ecn_supported_param { 1.102 + struct sctp_paramhdr ph;/* type=SCTP_ECN_CAPABLE */ 1.103 +} SCTP_PACKED; 1.104 + 1.105 + 1.106 +/* heartbeat info parameter */ 1.107 +struct sctp_heartbeat_info_param { 1.108 + struct sctp_paramhdr ph; 1.109 + uint32_t time_value_1; 1.110 + uint32_t time_value_2; 1.111 + uint32_t random_value1; 1.112 + uint32_t random_value2; 1.113 + uint8_t addr_family; 1.114 + uint8_t addr_len; 1.115 + /* make sure that this structure is 4 byte aligned */ 1.116 + uint8_t padding[2]; 1.117 + char address[SCTP_ADDRMAX]; 1.118 +} SCTP_PACKED; 1.119 + 1.120 + 1.121 +/* draft-ietf-tsvwg-prsctp */ 1.122 +/* PR-SCTP supported parameter */ 1.123 +struct sctp_prsctp_supported_param { 1.124 + struct sctp_paramhdr ph; 1.125 +} SCTP_PACKED; 1.126 + 1.127 + 1.128 +/* draft-ietf-tsvwg-addip-sctp */ 1.129 +struct sctp_asconf_paramhdr { /* an ASCONF "parameter" */ 1.130 + struct sctp_paramhdr ph;/* a SCTP parameter header */ 1.131 + uint32_t correlation_id;/* correlation id for this param */ 1.132 +} SCTP_PACKED; 1.133 + 1.134 +struct sctp_asconf_addr_param { /* an ASCONF address parameter */ 1.135 + struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ 1.136 + struct sctp_ipv6addr_param addrp; /* max storage size */ 1.137 +} SCTP_PACKED; 1.138 + 1.139 + 1.140 +struct sctp_asconf_tag_param { /* an ASCONF NAT-Vtag parameter */ 1.141 + struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ 1.142 + uint32_t local_vtag; 1.143 + uint32_t remote_vtag; 1.144 +} SCTP_PACKED; 1.145 + 1.146 + 1.147 +struct sctp_asconf_addrv4_param { /* an ASCONF address (v4) parameter */ 1.148 + struct sctp_asconf_paramhdr aph; /* asconf "parameter" */ 1.149 + struct sctp_ipv4addr_param addrp; /* max storage size */ 1.150 +} SCTP_PACKED; 1.151 + 1.152 +#define SCTP_MAX_SUPPORTED_EXT 256 1.153 + 1.154 +struct sctp_supported_chunk_types_param { 1.155 + struct sctp_paramhdr ph;/* type = 0x8008 len = x */ 1.156 + uint8_t chunk_types[]; 1.157 +} SCTP_PACKED; 1.158 + 1.159 + 1.160 +/* 1.161 + * Structures for DATA chunks 1.162 + */ 1.163 +struct sctp_data { 1.164 + uint32_t tsn; 1.165 + uint16_t stream_id; 1.166 + uint16_t stream_sequence; 1.167 + uint32_t protocol_id; 1.168 + /* user data follows */ 1.169 +} SCTP_PACKED; 1.170 + 1.171 +struct sctp_data_chunk { 1.172 + struct sctp_chunkhdr ch; 1.173 + struct sctp_data dp; 1.174 +} SCTP_PACKED; 1.175 + 1.176 +/* 1.177 + * Structures for the control chunks 1.178 + */ 1.179 + 1.180 +/* Initiate (INIT)/Initiate Ack (INIT ACK) */ 1.181 +struct sctp_init { 1.182 + uint32_t initiate_tag; /* initiate tag */ 1.183 + uint32_t a_rwnd; /* a_rwnd */ 1.184 + uint16_t num_outbound_streams; /* OS */ 1.185 + uint16_t num_inbound_streams; /* MIS */ 1.186 + uint32_t initial_tsn; /* I-TSN */ 1.187 + /* optional param's follow */ 1.188 +} SCTP_PACKED; 1.189 +#define SCTP_IDENTIFICATION_SIZE 16 1.190 +#define SCTP_ADDRESS_SIZE 4 1.191 +#if defined(__Userspace__) 1.192 +#define SCTP_RESERVE_SPACE 5 1.193 +#else 1.194 +#define SCTP_RESERVE_SPACE 6 1.195 +#endif 1.196 +/* state cookie header */ 1.197 +struct sctp_state_cookie { /* this is our definition... */ 1.198 + uint8_t identification[SCTP_IDENTIFICATION_SIZE];/* id of who we are */ 1.199 + struct timeval time_entered; /* the time I built cookie */ 1.200 + uint32_t cookie_life; /* life I will award this cookie */ 1.201 + uint32_t tie_tag_my_vtag; /* my tag in old association */ 1.202 + 1.203 + uint32_t tie_tag_peer_vtag; /* peers tag in old association */ 1.204 + uint32_t peers_vtag; /* peers tag in INIT (for quick ref) */ 1.205 + 1.206 + uint32_t my_vtag; /* my tag in INIT-ACK (for quick ref) */ 1.207 + uint32_t address[SCTP_ADDRESS_SIZE]; /* 4 ints/128 bits */ 1.208 + uint32_t addr_type; /* address type */ 1.209 + uint32_t laddress[SCTP_ADDRESS_SIZE]; /* my local from address */ 1.210 + uint32_t laddr_type; /* my local from address type */ 1.211 + uint32_t scope_id; /* v6 scope id for link-locals */ 1.212 + 1.213 + uint16_t peerport; /* port address of the peer in the INIT */ 1.214 + uint16_t myport; /* my port address used in the INIT */ 1.215 + uint8_t ipv4_addr_legal;/* Are V4 addr legal? */ 1.216 + uint8_t ipv6_addr_legal;/* Are V6 addr legal? */ 1.217 +#if defined(__Userspace__) 1.218 + uint8_t conn_addr_legal; 1.219 +#endif 1.220 + uint8_t local_scope; /* IPv6 local scope flag */ 1.221 + uint8_t site_scope; /* IPv6 site scope flag */ 1.222 + 1.223 + uint8_t ipv4_scope; /* IPv4 private addr scope */ 1.224 + uint8_t loopback_scope; /* loopback scope information */ 1.225 + uint8_t reserved[SCTP_RESERVE_SPACE]; /* Align to 64 bits */ 1.226 + /* 1.227 + * at the end is tacked on the INIT chunk and the INIT-ACK chunk 1.228 + * (minus the cookie). 1.229 + */ 1.230 +} SCTP_PACKED; 1.231 + 1.232 + 1.233 +/* Used for NAT state error cause */ 1.234 +struct sctp_missing_nat_state { 1.235 + uint16_t cause; 1.236 + uint16_t length; 1.237 + uint8_t data[]; 1.238 +} SCTP_PACKED; 1.239 + 1.240 + 1.241 +struct sctp_inv_mandatory_param { 1.242 + uint16_t cause; 1.243 + uint16_t length; 1.244 + uint32_t num_param; 1.245 + uint16_t param; 1.246 + /* 1.247 + * We include this to 0 it since only a missing cookie will cause 1.248 + * this error. 1.249 + */ 1.250 + uint16_t resv; 1.251 +} SCTP_PACKED; 1.252 + 1.253 +struct sctp_unresolv_addr { 1.254 + uint16_t cause; 1.255 + uint16_t length; 1.256 + uint16_t addr_type; 1.257 + uint16_t reserved; /* Only one invalid addr type */ 1.258 +} SCTP_PACKED; 1.259 + 1.260 +/* state cookie parameter */ 1.261 +struct sctp_state_cookie_param { 1.262 + struct sctp_paramhdr ph; 1.263 + struct sctp_state_cookie cookie; 1.264 +} SCTP_PACKED; 1.265 + 1.266 +struct sctp_init_chunk { 1.267 + struct sctp_chunkhdr ch; 1.268 + struct sctp_init init; 1.269 +} SCTP_PACKED; 1.270 + 1.271 +struct sctp_init_msg { 1.272 + struct sctphdr sh; 1.273 + struct sctp_init_chunk msg; 1.274 +} SCTP_PACKED; 1.275 + 1.276 +/* ... used for both INIT and INIT ACK */ 1.277 +#define sctp_init_ack sctp_init 1.278 +#define sctp_init_ack_chunk sctp_init_chunk 1.279 +#define sctp_init_ack_msg sctp_init_msg 1.280 + 1.281 + 1.282 +/* Selective Ack (SACK) */ 1.283 +struct sctp_gap_ack_block { 1.284 + uint16_t start; /* Gap Ack block start */ 1.285 + uint16_t end; /* Gap Ack block end */ 1.286 +} SCTP_PACKED; 1.287 + 1.288 +struct sctp_sack { 1.289 + uint32_t cum_tsn_ack; /* cumulative TSN Ack */ 1.290 + uint32_t a_rwnd; /* updated a_rwnd of sender */ 1.291 + uint16_t num_gap_ack_blks; /* number of Gap Ack blocks */ 1.292 + uint16_t num_dup_tsns; /* number of duplicate TSNs */ 1.293 + /* struct sctp_gap_ack_block's follow */ 1.294 + /* uint32_t duplicate_tsn's follow */ 1.295 +} SCTP_PACKED; 1.296 + 1.297 +struct sctp_sack_chunk { 1.298 + struct sctp_chunkhdr ch; 1.299 + struct sctp_sack sack; 1.300 +} SCTP_PACKED; 1.301 + 1.302 +struct sctp_nr_sack { 1.303 + uint32_t cum_tsn_ack; /* cumulative TSN Ack */ 1.304 + uint32_t a_rwnd; /* updated a_rwnd of sender */ 1.305 + uint16_t num_gap_ack_blks; /* number of Gap Ack blocks */ 1.306 + uint16_t num_nr_gap_ack_blks; /* number of NR Gap Ack blocks */ 1.307 + uint16_t num_dup_tsns; /* number of duplicate TSNs */ 1.308 + uint16_t reserved; /* not currently used*/ 1.309 + /* struct sctp_gap_ack_block's follow */ 1.310 + /* uint32_t duplicate_tsn's follow */ 1.311 +} SCTP_PACKED; 1.312 + 1.313 +struct sctp_nr_sack_chunk { 1.314 + struct sctp_chunkhdr ch; 1.315 + struct sctp_nr_sack nr_sack; 1.316 +} SCTP_PACKED; 1.317 + 1.318 + 1.319 +/* Heartbeat Request (HEARTBEAT) */ 1.320 +struct sctp_heartbeat { 1.321 + struct sctp_heartbeat_info_param hb_info; 1.322 +} SCTP_PACKED; 1.323 + 1.324 +struct sctp_heartbeat_chunk { 1.325 + struct sctp_chunkhdr ch; 1.326 + struct sctp_heartbeat heartbeat; 1.327 +} SCTP_PACKED; 1.328 + 1.329 +/* ... used for Heartbeat Ack (HEARTBEAT ACK) */ 1.330 +#define sctp_heartbeat_ack sctp_heartbeat 1.331 +#define sctp_heartbeat_ack_chunk sctp_heartbeat_chunk 1.332 + 1.333 + 1.334 +/* Abort Asssociation (ABORT) */ 1.335 +struct sctp_abort_chunk { 1.336 + struct sctp_chunkhdr ch; 1.337 + /* optional error cause may follow */ 1.338 +} SCTP_PACKED; 1.339 + 1.340 +struct sctp_abort_msg { 1.341 + struct sctphdr sh; 1.342 + struct sctp_abort_chunk msg; 1.343 +} SCTP_PACKED; 1.344 + 1.345 + 1.346 +/* Shutdown Association (SHUTDOWN) */ 1.347 +struct sctp_shutdown_chunk { 1.348 + struct sctp_chunkhdr ch; 1.349 + uint32_t cumulative_tsn_ack; 1.350 +} SCTP_PACKED; 1.351 + 1.352 + 1.353 +/* Shutdown Acknowledgment (SHUTDOWN ACK) */ 1.354 +struct sctp_shutdown_ack_chunk { 1.355 + struct sctp_chunkhdr ch; 1.356 +} SCTP_PACKED; 1.357 + 1.358 + 1.359 +/* Operation Error (ERROR) */ 1.360 +struct sctp_error_chunk { 1.361 + struct sctp_chunkhdr ch; 1.362 + /* optional error causes follow */ 1.363 +} SCTP_PACKED; 1.364 + 1.365 + 1.366 +/* Cookie Echo (COOKIE ECHO) */ 1.367 +struct sctp_cookie_echo_chunk { 1.368 + struct sctp_chunkhdr ch; 1.369 + struct sctp_state_cookie cookie; 1.370 +} SCTP_PACKED; 1.371 + 1.372 +/* Cookie Acknowledgment (COOKIE ACK) */ 1.373 +struct sctp_cookie_ack_chunk { 1.374 + struct sctp_chunkhdr ch; 1.375 +} SCTP_PACKED; 1.376 + 1.377 +/* Explicit Congestion Notification Echo (ECNE) */ 1.378 +struct old_sctp_ecne_chunk { 1.379 + struct sctp_chunkhdr ch; 1.380 + uint32_t tsn; 1.381 +} SCTP_PACKED; 1.382 + 1.383 +struct sctp_ecne_chunk { 1.384 + struct sctp_chunkhdr ch; 1.385 + uint32_t tsn; 1.386 + uint32_t num_pkts_since_cwr; 1.387 +} SCTP_PACKED; 1.388 + 1.389 +/* Congestion Window Reduced (CWR) */ 1.390 +struct sctp_cwr_chunk { 1.391 + struct sctp_chunkhdr ch; 1.392 + uint32_t tsn; 1.393 +} SCTP_PACKED; 1.394 + 1.395 +/* Shutdown Complete (SHUTDOWN COMPLETE) */ 1.396 +struct sctp_shutdown_complete_chunk { 1.397 + struct sctp_chunkhdr ch; 1.398 +} SCTP_PACKED; 1.399 + 1.400 +/* Oper error holding a stale cookie */ 1.401 +struct sctp_stale_cookie_msg { 1.402 + struct sctp_paramhdr ph;/* really an error cause */ 1.403 + uint32_t time_usec; 1.404 +} SCTP_PACKED; 1.405 + 1.406 +struct sctp_adaptation_layer_indication { 1.407 + struct sctp_paramhdr ph; 1.408 + uint32_t indication; 1.409 +} SCTP_PACKED; 1.410 + 1.411 +struct sctp_cookie_while_shutting_down { 1.412 + struct sctphdr sh; 1.413 + struct sctp_chunkhdr ch; 1.414 + struct sctp_paramhdr ph;/* really an error cause */ 1.415 +} SCTP_PACKED; 1.416 + 1.417 +struct sctp_shutdown_complete_msg { 1.418 + struct sctphdr sh; 1.419 + struct sctp_shutdown_complete_chunk shut_cmp; 1.420 +} SCTP_PACKED; 1.421 + 1.422 +/* 1.423 + * draft-ietf-tsvwg-addip-sctp 1.424 + */ 1.425 +/* Address/Stream Configuration Change (ASCONF) */ 1.426 +struct sctp_asconf_chunk { 1.427 + struct sctp_chunkhdr ch; 1.428 + uint32_t serial_number; 1.429 + /* lookup address parameter (mandatory) */ 1.430 + /* asconf parameters follow */ 1.431 +} SCTP_PACKED; 1.432 + 1.433 +/* Address/Stream Configuration Acknowledge (ASCONF ACK) */ 1.434 +struct sctp_asconf_ack_chunk { 1.435 + struct sctp_chunkhdr ch; 1.436 + uint32_t serial_number; 1.437 + /* asconf parameters follow */ 1.438 +} SCTP_PACKED; 1.439 + 1.440 +/* draft-ietf-tsvwg-prsctp */ 1.441 +/* Forward Cumulative TSN (FORWARD TSN) */ 1.442 +struct sctp_forward_tsn_chunk { 1.443 + struct sctp_chunkhdr ch; 1.444 + uint32_t new_cumulative_tsn; 1.445 + /* stream/sequence pairs (sctp_strseq) follow */ 1.446 +} SCTP_PACKED; 1.447 + 1.448 +struct sctp_strseq { 1.449 + uint16_t stream; 1.450 + uint16_t sequence; 1.451 +} SCTP_PACKED; 1.452 + 1.453 +struct sctp_forward_tsn_msg { 1.454 + struct sctphdr sh; 1.455 + struct sctp_forward_tsn_chunk msg; 1.456 +} SCTP_PACKED; 1.457 + 1.458 +/* should be a multiple of 4 - 1 aka 3/7/11 etc. */ 1.459 + 1.460 +#define SCTP_NUM_DB_TO_VERIFY 31 1.461 + 1.462 +struct sctp_chunk_desc { 1.463 + uint8_t chunk_type; 1.464 + uint8_t data_bytes[SCTP_NUM_DB_TO_VERIFY]; 1.465 + uint32_t tsn_ifany; 1.466 +} SCTP_PACKED; 1.467 + 1.468 + 1.469 +struct sctp_pktdrop_chunk { 1.470 + struct sctp_chunkhdr ch; 1.471 + uint32_t bottle_bw; 1.472 + uint32_t current_onq; 1.473 + uint16_t trunc_len; 1.474 + uint16_t reserved; 1.475 + uint8_t data[]; 1.476 +} SCTP_PACKED; 1.477 + 1.478 +/**********STREAM RESET STUFF ******************/ 1.479 + 1.480 +struct sctp_stream_reset_out_request { 1.481 + struct sctp_paramhdr ph; 1.482 + uint32_t request_seq; /* monotonically increasing seq no */ 1.483 + uint32_t response_seq; /* if a response, the resp seq no */ 1.484 + uint32_t send_reset_at_tsn; /* last TSN I assigned outbound */ 1.485 + uint16_t list_of_streams[]; /* if not all list of streams */ 1.486 +} SCTP_PACKED; 1.487 + 1.488 +struct sctp_stream_reset_in_request { 1.489 + struct sctp_paramhdr ph; 1.490 + uint32_t request_seq; 1.491 + uint16_t list_of_streams[]; /* if not all list of streams */ 1.492 +} SCTP_PACKED; 1.493 + 1.494 + 1.495 +struct sctp_stream_reset_tsn_request { 1.496 + struct sctp_paramhdr ph; 1.497 + uint32_t request_seq; 1.498 +} SCTP_PACKED; 1.499 + 1.500 +struct sctp_stream_reset_response { 1.501 + struct sctp_paramhdr ph; 1.502 + uint32_t response_seq; /* if a response, the resp seq no */ 1.503 + uint32_t result; 1.504 +} SCTP_PACKED; 1.505 + 1.506 +struct sctp_stream_reset_response_tsn { 1.507 + struct sctp_paramhdr ph; 1.508 + uint32_t response_seq; /* if a response, the resp seq no */ 1.509 + uint32_t result; 1.510 + uint32_t senders_next_tsn; 1.511 + uint32_t receivers_next_tsn; 1.512 +} SCTP_PACKED; 1.513 + 1.514 +struct sctp_stream_reset_add_strm { 1.515 + struct sctp_paramhdr ph; 1.516 + uint32_t request_seq; 1.517 + uint16_t number_of_streams; 1.518 + uint16_t reserved; 1.519 +} SCTP_PACKED; 1.520 + 1.521 +#define SCTP_STREAM_RESET_RESULT_NOTHING_TO_DO 0x00000000 /* XXX: unused */ 1.522 +#define SCTP_STREAM_RESET_RESULT_PERFORMED 0x00000001 1.523 +#define SCTP_STREAM_RESET_RESULT_DENIED 0x00000002 1.524 +#define SCTP_STREAM_RESET_RESULT_ERR__WRONG_SSN 0x00000003 /* XXX: unused */ 1.525 +#define SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS 0x00000004 1.526 +#define SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO 0x00000005 1.527 +#define SCTP_STREAM_RESET_RESULT_IN_PROGRESS 0x00000006 /* XXX: unused */ 1.528 + 1.529 +/* 1.530 + * convience structures, note that if you are making a request for specific 1.531 + * streams then the request will need to be an overlay structure. 1.532 + */ 1.533 + 1.534 +struct sctp_stream_reset_tsn_req { 1.535 + struct sctp_chunkhdr ch; 1.536 + struct sctp_stream_reset_tsn_request sr_req; 1.537 +} SCTP_PACKED; 1.538 + 1.539 +struct sctp_stream_reset_resp { 1.540 + struct sctp_chunkhdr ch; 1.541 + struct sctp_stream_reset_response sr_resp; 1.542 +} SCTP_PACKED; 1.543 + 1.544 +/* respone only valid with a TSN request */ 1.545 +struct sctp_stream_reset_resp_tsn { 1.546 + struct sctp_chunkhdr ch; 1.547 + struct sctp_stream_reset_response_tsn sr_resp; 1.548 +} SCTP_PACKED; 1.549 + 1.550 +/****************************************************/ 1.551 + 1.552 +/* 1.553 + * Authenticated chunks support draft-ietf-tsvwg-sctp-auth 1.554 + */ 1.555 + 1.556 +/* Should we make the max be 32? */ 1.557 +#define SCTP_RANDOM_MAX_SIZE 256 1.558 +struct sctp_auth_random { 1.559 + struct sctp_paramhdr ph;/* type = 0x8002 */ 1.560 + uint8_t random_data[]; 1.561 +} SCTP_PACKED; 1.562 + 1.563 +struct sctp_auth_chunk_list { 1.564 + struct sctp_paramhdr ph;/* type = 0x8003 */ 1.565 + uint8_t chunk_types[]; 1.566 +} SCTP_PACKED; 1.567 + 1.568 +struct sctp_auth_hmac_algo { 1.569 + struct sctp_paramhdr ph;/* type = 0x8004 */ 1.570 + uint16_t hmac_ids[]; 1.571 +} SCTP_PACKED; 1.572 + 1.573 +struct sctp_auth_chunk { 1.574 + struct sctp_chunkhdr ch; 1.575 + uint16_t shared_key_id; 1.576 + uint16_t hmac_id; 1.577 + uint8_t hmac[]; 1.578 +} SCTP_PACKED; 1.579 + 1.580 +struct sctp_auth_invalid_hmac { 1.581 + struct sctp_paramhdr ph; 1.582 + uint16_t hmac_id; 1.583 + uint16_t padding; 1.584 +} SCTP_PACKED; 1.585 + 1.586 +/* 1.587 + * we pre-reserve enough room for a ECNE or CWR AND a SACK with no missing 1.588 + * pieces. If ENCE is missing we could have a couple of blocks. This way we 1.589 + * optimize so we MOST likely can bundle a SACK/ECN with the smallest size 1.590 + * data chunk I will split into. We could increase throughput slightly by 1.591 + * taking out these two but the 24-sack/8-CWR i.e. 32 bytes I pre-reserve I 1.592 + * feel is worth it for now. 1.593 + */ 1.594 +#ifndef SCTP_MAX_OVERHEAD 1.595 +#ifdef INET6 1.596 +#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 1.597 + sizeof(struct sctphdr) + \ 1.598 + sizeof(struct sctp_ecne_chunk) + \ 1.599 + sizeof(struct sctp_sack_chunk) + \ 1.600 + sizeof(struct ip6_hdr)) 1.601 + 1.602 +#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 1.603 + sizeof(struct sctphdr) + \ 1.604 + sizeof(struct ip6_hdr)) 1.605 + 1.606 + 1.607 +#define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \ 1.608 + sizeof(struct sctphdr)) 1.609 + 1.610 +#else 1.611 +#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 1.612 + sizeof(struct sctphdr) + \ 1.613 + sizeof(struct sctp_ecne_chunk) + \ 1.614 + sizeof(struct sctp_sack_chunk) + \ 1.615 + sizeof(struct ip)) 1.616 + 1.617 +#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 1.618 + sizeof(struct sctphdr) + \ 1.619 + sizeof(struct ip)) 1.620 + 1.621 + 1.622 +#define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \ 1.623 + sizeof(struct sctphdr)) 1.624 + 1.625 +#endif /* INET6 */ 1.626 +#endif /* !SCTP_MAX_OVERHEAD */ 1.627 + 1.628 +#define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \ 1.629 + sizeof(struct sctphdr) + \ 1.630 + sizeof(struct ip)) 1.631 + 1.632 +#define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \ 1.633 + sizeof(struct sctphdr)) 1.634 + 1.635 +#if defined(__Windows__) 1.636 +#include <packoff.h> 1.637 +#endif 1.638 +#if defined(__Userspace_os_Windows) 1.639 +#pragma pack () 1.640 +#endif 1.641 +#undef SCTP_PACKED 1.642 +#endif /* !__sctp_header_h__ */