| 1 | /* $KAME: sctp_uio.h,v 1.11 2005/03/06 16:04:18 itojun Exp $ */ |
| 2 | /* $NetBSD: sctp_uio.h,v 1.4 2018/07/31 13:36:31 rjs Exp $ */ |
| 3 | |
| 4 | #ifndef __SCTP_UIO_H__ |
| 5 | #define __SCTP_UIO_H__ |
| 6 | |
| 7 | /* |
| 8 | * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. |
| 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions |
| 13 | * are met: |
| 14 | * 1. Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer. |
| 16 | * 2. Redistributions in binary form must reproduce the above copyright |
| 17 | * notice, this list of conditions and the following disclaimer in the |
| 18 | * documentation and/or other materials provided with the distribution. |
| 19 | * 3. All advertising materials mentioning features or use of this software |
| 20 | * must display the following acknowledgement: |
| 21 | * This product includes software developed by Cisco Systems, Inc. |
| 22 | * 4. Neither the name of the project nor the names of its contributors |
| 23 | * may be used to endorse or promote products derived from this software |
| 24 | * without specific prior written permission. |
| 25 | * |
| 26 | * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND |
| 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 29 | * ARE DISCLAIMED. IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE |
| 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 36 | * SUCH DAMAGE. |
| 37 | */ |
| 38 | |
| 39 | #include <sys/types.h> |
| 40 | #include <sys/socket.h> |
| 41 | |
| 42 | typedef u_int32_t sctp_assoc_t; |
| 43 | |
| 44 | #define SCTP_FUTURE_ASSOC 0 |
| 45 | #define SCTP_CURRENT_ASSOC 1 |
| 46 | #define SCTP_ALL_ASSOC 2 |
| 47 | |
| 48 | /* On/Off setup for subscription to events */ |
| 49 | struct sctp_event_subscribe { |
| 50 | u_int8_t sctp_data_io_event; |
| 51 | u_int8_t sctp_association_event; |
| 52 | u_int8_t sctp_address_event; |
| 53 | u_int8_t sctp_send_failure_event; |
| 54 | u_int8_t sctp_peer_error_event; |
| 55 | u_int8_t sctp_shutdown_event; |
| 56 | u_int8_t sctp_partial_delivery_event; |
| 57 | u_int8_t sctp_adaption_layer_event; |
| 58 | u_int8_t sctp_stream_reset_events; |
| 59 | } __packed; |
| 60 | |
| 61 | /* ancillary data types */ |
| 62 | #define SCTP_INIT 0x0001 |
| 63 | #define SCTP_SNDRCV 0x0002 |
| 64 | #define SCTP_EXTRCV 0x0003 |
| 65 | #define SCTP_SNDINFO 0x0004 |
| 66 | #define SCTP_RCVINFO 0x0005 |
| 67 | #define SCTP_NXTINFO 0x0006 |
| 68 | #define SCTP_PRINFO 0x0007 |
| 69 | #define SCTP_AUTHINFO 0x0008 |
| 70 | #define SCTP_DSTADDRV4 0x0009 |
| 71 | #define SCTP_DSTADDRV6 0x000a |
| 72 | |
| 73 | struct sctp_event { |
| 74 | sctp_assoc_t se_assoc_id; |
| 75 | u_int16_t se_type; |
| 76 | u_int8_t se_on; |
| 77 | } __packed; |
| 78 | |
| 79 | /* |
| 80 | * ancillary data structures |
| 81 | */ |
| 82 | struct sctp_initmsg { |
| 83 | u_int32_t sinit_num_ostreams; |
| 84 | u_int32_t sinit_max_instreams; |
| 85 | u_int16_t sinit_max_attempts; |
| 86 | u_int16_t sinit_max_init_timeo; |
| 87 | } __packed; |
| 88 | |
| 89 | struct sctp_sndrcvinfo { |
| 90 | u_int16_t sinfo_stream; |
| 91 | u_int16_t sinfo_ssn; |
| 92 | u_int16_t sinfo_flags; |
| 93 | u_int32_t sinfo_ppid; |
| 94 | u_int32_t sinfo_context; |
| 95 | u_int32_t sinfo_timetolive; |
| 96 | u_int32_t sinfo_tsn; |
| 97 | u_int32_t sinfo_cumtsn; |
| 98 | sctp_assoc_t sinfo_assoc_id; |
| 99 | } __packed; |
| 100 | |
| 101 | struct sctp_sndinfo { |
| 102 | u_int16_t snd_sid; |
| 103 | u_int16_t snd_flags; |
| 104 | u_int32_t snd_ppid; |
| 105 | u_int32_t snd_context; |
| 106 | sctp_assoc_t snd_assoc_id; |
| 107 | } __packed; |
| 108 | |
| 109 | struct sctp_rcvinfo { |
| 110 | u_int16_t rcv_sid; |
| 111 | u_int16_t rcv_ssn; |
| 112 | u_int16_t rcv_flags; |
| 113 | u_int32_t rcv_ppid; |
| 114 | u_int32_t rcv_tsn; |
| 115 | u_int32_t rcv_cumtsn; |
| 116 | u_int32_t rcv_context; |
| 117 | sctp_assoc_t rcv_assoc_id; |
| 118 | }; |
| 119 | |
| 120 | struct sctp_nxtinfo { |
| 121 | u_int16_t nxt_sid; |
| 122 | u_int16_t nxt_flags; |
| 123 | u_int32_t nxt_ppid; |
| 124 | u_int32_t nxt_length; |
| 125 | sctp_assoc_t nxt_assoc_id; |
| 126 | } __packed; |
| 127 | |
| 128 | struct sctp_prinfo { |
| 129 | u_int16_t pr_policy; |
| 130 | u_int32_t pr_value; |
| 131 | }; |
| 132 | |
| 133 | struct sctp_authinfo { |
| 134 | u_int16_t auth_keynumber; |
| 135 | } __packed; |
| 136 | |
| 137 | struct sctp_snd_all_completes { |
| 138 | u_int16_t sall_stream; |
| 139 | u_int16_t sall_flags; |
| 140 | u_int32_t sall_ppid; |
| 141 | u_int32_t sall_context; |
| 142 | u_int32_t sall_num_sent; |
| 143 | u_int32_t sall_num_failed; |
| 144 | } __packed; |
| 145 | |
| 146 | /* send/recv flags */ |
| 147 | #define SCTP_SENDALL 0x0200 |
| 148 | #define SCTP_PR_SCTP_TTL 0x0400 /* Partial Reliable on this msg */ |
| 149 | #define SCTP_PR_SCTP_BUF 0x0800 /* Buffer based PR-SCTP */ |
| 150 | #define SCTP_EOF 0x1000 /* Start shutdown procedures */ |
| 151 | #define SCTP_UNORDERED 0x2000 /* Message is un-ordered */ |
| 152 | #define SCTP_ADDR_OVER 0x4000 /* Override the primary-address */ |
| 153 | #define SCTP_ABORT 0x8000 /* Send an ABORT to peer */ |
| 154 | |
| 155 | /* Stat's */ |
| 156 | struct sctp_pcbinfo { |
| 157 | u_int32_t ep_count; |
| 158 | u_int32_t asoc_count; |
| 159 | u_int32_t laddr_count; |
| 160 | u_int32_t raddr_count; |
| 161 | u_int32_t chk_count; |
| 162 | u_int32_t sockq_count; |
| 163 | u_int32_t mbuf_track; |
| 164 | } __packed; |
| 165 | |
| 166 | struct sctp_sockstat { |
| 167 | sctp_assoc_t ss_assoc_id; |
| 168 | u_int32_t ss_total_sndbuf; |
| 169 | u_int32_t ss_total_mbuf_sndbuf; |
| 170 | u_int32_t ss_total_recv_buf; |
| 171 | } __packed; |
| 172 | |
| 173 | /* |
| 174 | * notification event structures |
| 175 | */ |
| 176 | |
| 177 | |
| 178 | /* association change events */ |
| 179 | |
| 180 | struct sctp_assoc_change { |
| 181 | u_int16_t sac_type; |
| 182 | u_int16_t sac_flags; |
| 183 | u_int32_t sac_length; |
| 184 | u_int16_t sac_state; |
| 185 | u_int16_t sac_error; |
| 186 | u_int16_t sac_outbound_streams; |
| 187 | u_int16_t sac_inbound_streams; |
| 188 | sctp_assoc_t sac_assoc_id; |
| 189 | u_int8_t sac_info[0]; |
| 190 | } __packed; |
| 191 | /* sac_state values */ |
| 192 | |
| 193 | #define SCTP_COMM_UP 0x0001 |
| 194 | #define SCTP_COMM_LOST 0x0002 |
| 195 | #define SCTP_RESTART 0x0003 |
| 196 | #define SCTP_SHUTDOWN_COMP 0x0004 |
| 197 | #define SCTP_CANT_STR_ASSOC 0x0005 |
| 198 | |
| 199 | /* sac_info values */ |
| 200 | #define SCTP_ASSOC_SUPPORTS_PR 0x0001 |
| 201 | #define SCTP_ASSOC_SUPPORTS_AUTH 0x0002 |
| 202 | #define SCTP_ASSOC_SUPPORTS_ASCONF 0x0003 |
| 203 | #define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x0004 |
| 204 | |
| 205 | /* Address events */ |
| 206 | struct sctp_paddr_change { |
| 207 | u_int16_t spc_type; |
| 208 | u_int16_t spc_flags; |
| 209 | u_int32_t spc_length; |
| 210 | struct sockaddr_storage spc_aaddr; |
| 211 | u_int32_t spc_state; |
| 212 | u_int32_t spc_error; |
| 213 | sctp_assoc_t spc_assoc_id; |
| 214 | } __packed; |
| 215 | /* paddr state values */ |
| 216 | #define SCTP_ADDR_AVAILABLE 0x0001 |
| 217 | #define SCTP_ADDR_UNREACHABLE 0x0002 |
| 218 | #define SCTP_ADDR_REMOVED 0x0003 |
| 219 | #define SCTP_ADDR_ADDED 0x0004 |
| 220 | #define SCTP_ADDR_MADE_PRIM 0x0005 |
| 221 | #define SCTP_ADDR_CONFIRMED 0x0006 /* XXX */ |
| 222 | |
| 223 | /* |
| 224 | * CAUTION: these are user exposed SCTP addr reachability states |
| 225 | * must be compatible with SCTP_ADDR states in sctp_constants.h |
| 226 | */ |
| 227 | #ifdef SCTP_ACTIVE |
| 228 | #undef SCTP_ACTIVE |
| 229 | #endif |
| 230 | #define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */ |
| 231 | |
| 232 | #ifdef SCTP_INACTIVE |
| 233 | #undef SCTP_INACTIVE |
| 234 | #endif |
| 235 | #define SCTP_INACTIVE 0x0002 /* SCTP_ADDR_NOT_REACHABLE */ |
| 236 | |
| 237 | |
| 238 | #ifdef SCTP_UNCONFIRMED |
| 239 | #undef SCTP_UNCONFIRMED |
| 240 | #endif |
| 241 | #define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */ |
| 242 | |
| 243 | #ifdef SCTP_NOHEARTBEAT |
| 244 | #undef SCTP_NOHEARTBEAT |
| 245 | #endif |
| 246 | #define SCTP_NOHEARTBEAT 0x0040 /* SCTP_ADDR_NOHB */ |
| 247 | |
| 248 | |
| 249 | /* remote error events */ |
| 250 | struct sctp_remote_error { |
| 251 | u_int16_t sre_type; |
| 252 | u_int16_t sre_flags; |
| 253 | u_int32_t sre_length; |
| 254 | u_int16_t sre_error; |
| 255 | sctp_assoc_t sre_assoc_id; |
| 256 | u_int8_t sre_data[4]; |
| 257 | } __packed; |
| 258 | |
| 259 | /* data send failure event */ |
| 260 | struct sctp_send_failed { |
| 261 | u_int16_t ssf_type; |
| 262 | u_int16_t ssf_flags; |
| 263 | u_int32_t ssf_length; |
| 264 | u_int32_t ssf_error; |
| 265 | struct sctp_sndrcvinfo ssf_info; |
| 266 | sctp_assoc_t ssf_assoc_id; |
| 267 | u_int8_t ssf_data[4]; |
| 268 | } __packed; |
| 269 | |
| 270 | /* flag that indicates state of data */ |
| 271 | #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */ |
| 272 | #define SCTP_DATA_SENT 0x0002 /* on wire at failure */ |
| 273 | |
| 274 | /* shutdown event */ |
| 275 | struct sctp_shutdown_event { |
| 276 | u_int16_t sse_type; |
| 277 | u_int16_t sse_flags; |
| 278 | u_int32_t sse_length; |
| 279 | sctp_assoc_t sse_assoc_id; |
| 280 | } __packed; |
| 281 | |
| 282 | /* Adaption layer indication stuff */ |
| 283 | struct sctp_adaption_event { |
| 284 | u_int16_t sai_type; |
| 285 | u_int16_t sai_flags; |
| 286 | u_int32_t sai_length; |
| 287 | u_int32_t sai_adaption_ind; |
| 288 | sctp_assoc_t sai_assoc_id; |
| 289 | } __packed; |
| 290 | |
| 291 | struct sctp_setadaption { |
| 292 | u_int32_t ssb_adaption_ind; |
| 293 | } __packed; |
| 294 | |
| 295 | /* pdapi indications */ |
| 296 | struct sctp_pdapi_event { |
| 297 | u_int16_t pdapi_type; |
| 298 | u_int16_t pdapi_flags; |
| 299 | u_int32_t pdapi_length; |
| 300 | u_int32_t pdapi_indication; |
| 301 | u_int32_t pdapi_stream; |
| 302 | u_int32_t pdapi_seq; |
| 303 | sctp_assoc_t pdapi_assoc_id; |
| 304 | } __packed; |
| 305 | |
| 306 | |
| 307 | #define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001 |
| 308 | |
| 309 | /* sender dry indications */ |
| 310 | struct sctp_sender_dry_event { |
| 311 | u_int16_t sender_dry_type; |
| 312 | u_int16_t sender_dry_flags; |
| 313 | u_int32_t sender_dry_length; |
| 314 | sctp_assoc_t sender_dry_assoc_id; |
| 315 | } __packed; |
| 316 | |
| 317 | /* stream reset stuff */ |
| 318 | |
| 319 | struct sctp_stream_reset_event { |
| 320 | u_int16_t strreset_type; |
| 321 | u_int16_t strreset_flags; |
| 322 | u_int32_t strreset_length; |
| 323 | sctp_assoc_t strreset_assoc_id; |
| 324 | u_int16_t strreset_list[0]; |
| 325 | } __packed; |
| 326 | |
| 327 | /* flags in strreset_flags filed */ |
| 328 | #define SCTP_STRRESET_INBOUND_STR 0x0001 |
| 329 | #define SCTP_STRRESET_OUTBOUND_STR 0x0002 |
| 330 | #define SCTP_STRRESET_ALL_STREAMS 0x0004 |
| 331 | #define SCTP_STRRESET_STREAM_LIST 0x0008 |
| 332 | |
| 333 | #define MAX_ASOC_IDS_RET 255 |
| 334 | |
| 335 | struct sctp_assoc_ids { |
| 336 | u_int16_t asls_assoc_start; /* array of index's start at 0 */ |
| 337 | u_int8_t asls_numb_present; |
| 338 | u_int8_t asls_more_to_get; |
| 339 | sctp_assoc_t asls_assoc_id[MAX_ASOC_IDS_RET]; |
| 340 | } __packed; |
| 341 | |
| 342 | /* notification types */ |
| 343 | #define SCTP_ASSOC_CHANGE 0x0001 |
| 344 | #define SCTP_PEER_ADDR_CHANGE 0x0002 |
| 345 | #define SCTP_REMOTE_ERROR 0x0003 |
| 346 | #define SCTP_SEND_FAILED 0x0004 |
| 347 | #define SCTP_SHUTDOWN_EVENT 0x0005 |
| 348 | #define SCTP_ADAPTION_INDICATION 0x0006 |
| 349 | #define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 |
| 350 | #define SCTP_STREAM_RESET_EVENT 0x0008 /* XXX */ |
| 351 | #define SCTP_AUTHENTICATION_EVENT 0x0009 |
| 352 | #define SCT_SENDER_DRY_EVENT 0x000a |
| 353 | |
| 354 | struct sctp_tlv { |
| 355 | u_int16_t sn_type; |
| 356 | u_int16_t sn_flags; |
| 357 | u_int32_t sn_length; |
| 358 | } __packed; |
| 359 | |
| 360 | |
| 361 | /* notification event */ |
| 362 | union sctp_notification { |
| 363 | struct sctp_tlv ; |
| 364 | struct sctp_assoc_change sn_assoc_change; |
| 365 | struct sctp_paddr_change sn_paddr_change; |
| 366 | struct sctp_remote_error sn_remote_error; |
| 367 | struct sctp_send_failed sn_send_failed; |
| 368 | struct sctp_shutdown_event sn_shutdown_event; |
| 369 | struct sctp_adaption_event sn_adaption_event; |
| 370 | struct sctp_pdapi_event sn_pdapi_event; |
| 371 | struct sctp_stream_reset_event sn_strreset_event; |
| 372 | } __packed; |
| 373 | |
| 374 | /* |
| 375 | * socket option structs |
| 376 | */ |
| 377 | #define SCTP_ISSUE_HB 0xffffffff /* get a on-demand hb */ |
| 378 | #define SCTP_NO_HB 0x0 /* turn off hb's */ |
| 379 | |
| 380 | struct sctp_paddrparams { |
| 381 | sctp_assoc_t spp_assoc_id; |
| 382 | struct sockaddr_storage spp_address; |
| 383 | u_int32_t spp_hbinterval; |
| 384 | u_int16_t spp_pathmaxrxt; |
| 385 | u_int32_t spp_pathmtu; |
| 386 | u_int32_t spp_flags; |
| 387 | u_int32_t spp_ipv6_flowlabel; |
| 388 | u_int8_t spp_dscp; |
| 389 | } __packed; |
| 390 | |
| 391 | #define SPP_HB_ENABLE 0x0001 |
| 392 | #define SPP_HB_DISABLE 0x0002 |
| 393 | #define SPP_HB_DEMAND 0x0004 |
| 394 | #define SPP_HB_TIME_IS_ZERO 0x0008 |
| 395 | #define SPP_PMTUD_ENABLE 0x0010 |
| 396 | #define SPP_PMTUD_DISABLE 0x0020 |
| 397 | #define SPP_IPV6_FLOWLABEL 0x0040 |
| 398 | #define SPP_DSCP 0x0080 |
| 399 | |
| 400 | struct sctp_paddrinfo { |
| 401 | sctp_assoc_t spinfo_assoc_id; |
| 402 | struct sockaddr_storage spinfo_address; |
| 403 | int32_t spinfo_state; |
| 404 | u_int32_t spinfo_cwnd; |
| 405 | u_int32_t spinfo_srtt; |
| 406 | u_int32_t spinfo_rto; |
| 407 | u_int32_t spinfo_mtu; |
| 408 | } __packed; |
| 409 | |
| 410 | struct sctp_rtoinfo { |
| 411 | sctp_assoc_t srto_assoc_id; |
| 412 | u_int32_t srto_initial; |
| 413 | u_int32_t srto_max; |
| 414 | u_int32_t srto_min; |
| 415 | } __packed; |
| 416 | |
| 417 | struct sctp_assocparams { |
| 418 | sctp_assoc_t sasoc_assoc_id; |
| 419 | u_int16_t sasoc_asocmaxrxt; |
| 420 | u_int16_t sasoc_number_peer_destinations; |
| 421 | u_int32_t sasoc_peer_rwnd; |
| 422 | u_int32_t sasoc_local_rwnd; |
| 423 | u_int32_t sasoc_cookie_life; |
| 424 | } __packed; |
| 425 | |
| 426 | struct sctp_setprim { |
| 427 | sctp_assoc_t ssp_assoc_id; |
| 428 | struct sockaddr_storage ssp_addr; |
| 429 | } __packed; |
| 430 | |
| 431 | struct sctp_setpeerprim { |
| 432 | sctp_assoc_t sspp_assoc_id; |
| 433 | struct sockaddr_storage sspp_addr; |
| 434 | } __packed; |
| 435 | |
| 436 | struct sctp_getaddresses { |
| 437 | sctp_assoc_t sget_assoc_id; |
| 438 | /* addr is filled in for N * sockaddr_storage */ |
| 439 | struct sockaddr addr[1]; |
| 440 | } __packed; |
| 441 | |
| 442 | struct sctp_setstrm_timeout { |
| 443 | sctp_assoc_t ssto_assoc_id; |
| 444 | u_int32_t ssto_timeout; |
| 445 | u_int32_t ssto_streamid_start; |
| 446 | u_int32_t ssto_streamid_end; |
| 447 | } __packed; |
| 448 | |
| 449 | struct sctp_status { |
| 450 | sctp_assoc_t sstat_assoc_id; |
| 451 | int32_t sstat_state; |
| 452 | u_int32_t sstat_rwnd; |
| 453 | u_int16_t sstat_unackdata; |
| 454 | u_int16_t sstat_penddata; |
| 455 | u_int16_t sstat_instrms; |
| 456 | u_int16_t sstat_outstrms; |
| 457 | u_int32_t sstat_fragmentation_point; |
| 458 | struct sctp_paddrinfo sstat_primary; |
| 459 | } __packed; |
| 460 | |
| 461 | struct sctp_cwnd_args { |
| 462 | struct sctp_nets *net; /* network to */ |
| 463 | u_int32_t cwnd_new_value; /* cwnd in k */ |
| 464 | u_int32_t inflight; /* flightsize in k */ |
| 465 | int cwnd_augment; /* increment to it */ |
| 466 | } __packed; |
| 467 | |
| 468 | struct sctp_blk_args { |
| 469 | u_int32_t onmb; /* in 1k bytes */ |
| 470 | u_int32_t onsb; /* in 1k bytes */ |
| 471 | u_int16_t maxmb; /* in 1k bytes */ |
| 472 | u_int16_t maxsb; /* in 1k bytes */ |
| 473 | u_int16_t send_sent_qcnt; /* chnk cnt */ |
| 474 | u_int16_t stream_qcnt; /* chnk cnt */ |
| 475 | } __packed; |
| 476 | |
| 477 | /* |
| 478 | * Max we can reset in one setting, note this is dictated not by the |
| 479 | * define but the size of a mbuf cluster so don't change this define |
| 480 | * and think you can specify more. You must do multiple resets if you |
| 481 | * want to reset more than SCTP_MAX_EXPLICIT_STR_RESET. |
| 482 | */ |
| 483 | #define SCTP_MAX_EXPLICT_STR_RESET 1000 |
| 484 | |
| 485 | #define SCTP_RESET_LOCAL_RECV 0x0001 |
| 486 | #define SCTP_RESET_LOCAL_SEND 0x0002 |
| 487 | #define SCTP_RESET_BOTH 0x0003 |
| 488 | |
| 489 | struct sctp_stream_reset { |
| 490 | sctp_assoc_t strrst_assoc_id; |
| 491 | u_int16_t strrst_flags; |
| 492 | u_int16_t strrst_num_streams; /* 0 == ALL */ |
| 493 | u_int16_t strrst_list[0]; /* list if strrst_num_streams is not 0*/ |
| 494 | } __packed; |
| 495 | |
| 496 | |
| 497 | struct sctp_get_nonce_values { |
| 498 | sctp_assoc_t gn_assoc_id; |
| 499 | u_int32_t gn_peers_tag; |
| 500 | u_int32_t gn_local_tag; |
| 501 | } __packed; |
| 502 | |
| 503 | /* Debugging logs */ |
| 504 | struct sctp_str_log{ |
| 505 | u_int32_t n_tsn; |
| 506 | u_int32_t e_tsn; |
| 507 | u_int16_t n_sseq; |
| 508 | u_int16_t e_sseq; |
| 509 | } __packed; |
| 510 | |
| 511 | struct sctp_fr_log { |
| 512 | u_int32_t largest_tsn; |
| 513 | u_int32_t largest_new_tsn; |
| 514 | u_int32_t tsn; |
| 515 | } __packed; |
| 516 | |
| 517 | struct sctp_fr_map { |
| 518 | u_int32_t base; |
| 519 | u_int32_t cum; |
| 520 | u_int32_t high; |
| 521 | } __packed; |
| 522 | |
| 523 | struct sctp_rwnd_log { |
| 524 | u_int32_t rwnd; |
| 525 | u_int32_t send_size; |
| 526 | u_int32_t overhead; |
| 527 | u_int32_t new_rwnd; |
| 528 | } __packed; |
| 529 | |
| 530 | struct sctp_mbcnt_log { |
| 531 | u_int32_t total_queue_size; |
| 532 | u_int32_t size_change; |
| 533 | u_int32_t total_queue_mb_size; |
| 534 | u_int32_t mbcnt_change; |
| 535 | } __packed; |
| 536 | |
| 537 | struct sctp_cwnd_log { |
| 538 | union { |
| 539 | struct sctp_blk_args blk; |
| 540 | struct sctp_cwnd_args cwnd; |
| 541 | struct sctp_str_log strlog; |
| 542 | struct sctp_fr_log fr; |
| 543 | struct sctp_fr_map map; |
| 544 | struct sctp_rwnd_log rwnd; |
| 545 | struct sctp_mbcnt_log mbcnt; |
| 546 | }x; |
| 547 | u_int8_t from; |
| 548 | u_int8_t event_type; |
| 549 | |
| 550 | } __packed; |
| 551 | |
| 552 | struct sctp_cwnd_log_req { |
| 553 | int num_in_log; /* Number in log */ |
| 554 | int num_ret; /* Number returned */ |
| 555 | int start_at; /* start at this one */ |
| 556 | int end_at; /* end at this one */ |
| 557 | struct sctp_cwnd_log log[0]; |
| 558 | } __packed; |
| 559 | |
| 560 | struct sctp_sendv_spa { |
| 561 | u_int32_t sendv_flags; |
| 562 | struct sctp_sndinfo sendv_sndinfo; |
| 563 | struct sctp_prinfo sendv_prinfo; |
| 564 | struct sctp_authinfo sendv_authinfo; |
| 565 | } __packed; |
| 566 | |
| 567 | #define SCTP_SEND_SNDINFO_VALID 0x00000001 |
| 568 | #define SCTP_SEND_PRINFO_VALID 0x00000002 |
| 569 | #define SCTP_SEND_AUTHINFO_VALID 0x00000004 |
| 570 | |
| 571 | #define SCTP_SENDV_NOINFO 0x0000 |
| 572 | #define SCTP_SENDV_SNDINFO 0x0001 |
| 573 | #define SCTP_SENDV_PRINFO 0x0002 |
| 574 | #define SCTP_SENDV_AUTHINFO 0x0003 |
| 575 | #define SCTP_SENDV_SPA 0x0004 |
| 576 | |
| 577 | struct sctp_recvv_rn { |
| 578 | struct sctp_rcvinfo recvv_rcvinfo; |
| 579 | struct sctp_nxtinfo recvv_nxtinfo; |
| 580 | } __packed; |
| 581 | |
| 582 | #define SCTP_RECVV_NOINFO 0x0000 |
| 583 | #define SCTP_RECVV_RCVINFO 0x0001 |
| 584 | #define SCTP_RECVV_NXTINFO 0x0002 |
| 585 | #define SCTP_RECVV_RN 0x0003 |
| 586 | |
| 587 | struct sctp_connectx_addrs { |
| 588 | int cx_num; |
| 589 | int cx_len; |
| 590 | void *cx_addrs; |
| 591 | } __packed; |
| 592 | |
| 593 | #define SIOCCONNECTX _IOWR('s', 11, struct sctp_connectx_addrs) |
| 594 | #define SIOCCONNECTXDEL _IOWR('s', 12, struct sctp_connectx_addrs) |
| 595 | |
| 596 | /* |
| 597 | * API system calls |
| 598 | */ |
| 599 | #if !defined(_KERNEL) |
| 600 | |
| 601 | __BEGIN_DECLS |
| 602 | int sctp_peeloff(int, sctp_assoc_t); |
| 603 | int sctp_bindx(int, struct sockaddr *, int, int); |
| 604 | int sctp_connectx(int, struct sockaddr *, int, sctp_assoc_t *); |
| 605 | int sctp_getpaddrs(int, sctp_assoc_t, struct sockaddr **); |
| 606 | void sctp_freepaddrs(struct sockaddr *); |
| 607 | int sctp_getladdrs(int, sctp_assoc_t, struct sockaddr **); |
| 608 | void sctp_freeladdrs(struct sockaddr *); |
| 609 | int sctp_opt_info(int, sctp_assoc_t, int, void *, socklen_t *); |
| 610 | |
| 611 | ssize_t sctp_sendmsg(int, const void *, size_t, |
| 612 | const struct sockaddr *, |
| 613 | socklen_t, u_int32_t, u_int32_t, u_int16_t, u_int32_t, u_int32_t); |
| 614 | |
| 615 | ssize_t sctp_send(int, const void *, size_t, |
| 616 | const struct sctp_sndrcvinfo *, int); |
| 617 | |
| 618 | ssize_t |
| 619 | sctp_sendx(int, const void *, size_t, struct sockaddr *, int, |
| 620 | struct sctp_sndrcvinfo *, int); |
| 621 | ssize_t |
| 622 | sctp_sendmsgx(int sd, const void *, size_t, |
| 623 | struct sockaddr *, int, |
| 624 | u_int32_t, u_int32_t, u_int16_t, u_int32_t, u_int32_t); |
| 625 | ssize_t sctp_sendv(int, const struct iovec *, int, struct sockaddr *, int, |
| 626 | void *, socklen_t, unsigned int, int); |
| 627 | |
| 628 | sctp_assoc_t |
| 629 | sctp_getassocid(int sd, struct sockaddr *sa); |
| 630 | |
| 631 | ssize_t sctp_recvmsg(int, void *, size_t, struct sockaddr *, |
| 632 | socklen_t *, struct sctp_sndrcvinfo *, int *); |
| 633 | ssize_t sctp_recvv(int, const struct iovec *, int, struct sockaddr *, |
| 634 | socklen_t *, void *, socklen_t *, unsigned int *, |
| 635 | int *); |
| 636 | |
| 637 | __END_DECLS |
| 638 | |
| 639 | #endif /* !_KERNEL */ |
| 640 | #endif /* !__SCTP_UIO_H__ */ |
| 641 | |