| 1 |
/*- |
| 2 |
* Copyright (c) 2009-2010 Brad Penoff |
| 3 |
* Copyright (c) 2009-2010 Humaira Kamal |
| 4 |
* Copyright (c) 2011-2012 Irene Ruengeler |
| 5 |
* Copyright (c) 2011-2012 Michael Tuexen |
| 6 |
* |
| 7 |
* All rights reserved. |
| 8 |
* |
| 9 |
* Redistribution and use in source and binary forms, with or without |
| 10 |
* modification, are permitted provided that the following conditions |
| 11 |
* are met: |
| 12 |
* 1. Redistributions of source code must retain the above copyright |
| 13 |
* notice, this list of conditions and the following disclaimer. |
| 14 |
* 2. Redistributions in binary form must reproduce the above copyright |
| 15 |
* notice, this list of conditions and the following disclaimer in the |
| 16 |
* documentation and/or other materials provided with the distribution. |
| 17 |
* |
| 18 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 19 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 22 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 23 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 24 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 25 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 26 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 27 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 |
* SUCH DAMAGE. |
| 29 |
*/ |
| 30 |
|
| 31 |
#ifndef __USRSCTP_H__ |
| 32 |
#define __USRSCTP_H__ |
| 33 |
|
| 34 |
#ifdef __cplusplus |
| 35 |
extern "C" { |
| 36 |
#endif |
| 37 |
|
| 38 |
#include <errno.h> |
| 39 |
#include <sys/types.h> |
| 40 |
#ifdef _WIN32 |
| 41 |
#ifdef _MSC_VER |
| 42 |
#pragma warning(disable: 4200) |
| 43 |
#endif |
| 44 |
#include <winsock2.h> |
| 45 |
#include <ws2tcpip.h> |
| 46 |
#else |
| 47 |
#include <sys/socket.h> |
| 48 |
#include <netinet/in.h> |
| 49 |
#endif |
| 50 |
|
| 51 |
#ifndef MSG_NOTIFICATION |
| 52 |
/* This definition MUST be in sync with usrsctplib/user_socketvar.h */ |
| 53 |
#define MSG_NOTIFICATION 0x2000 |
| 54 |
#endif |
| 55 |
|
| 56 |
#ifndef IPPROTO_SCTP |
| 57 |
/* This is the IANA assigned protocol number of SCTP. */ |
| 58 |
#define IPPROTO_SCTP 132 |
| 59 |
#endif |
| 60 |
|
| 61 |
#ifdef _WIN32 |
| 62 |
#if defined(_MSC_VER) && _MSC_VER >= 1600 |
| 63 |
#include <stdint.h> |
| 64 |
#elif defined(SCTP_STDINT_INCLUDE) |
| 65 |
#include SCTP_STDINT_INCLUDE |
| 66 |
#else |
| 67 |
#define uint8_t unsigned __int8 |
| 68 |
#define uint16_t unsigned __int16 |
| 69 |
#define uint32_t unsigned __int32 |
| 70 |
#define uint64_t unsigned __int64 |
| 71 |
#define int16_t __int16 |
| 72 |
#define int32_t __int32 |
| 73 |
#endif |
| 74 |
|
| 75 |
#ifndef ssize_t |
| 76 |
#ifdef _WIN64 |
| 77 |
#define ssize_t __int64 |
| 78 |
#elif defined _WIN32 |
| 79 |
#define ssize_t int |
| 80 |
#else |
| 81 |
#error "Unknown platform!" |
| 82 |
#endif |
| 83 |
#endif |
| 84 |
|
| 85 |
#define MSG_EOR 0x8 |
| 86 |
#ifndef EWOULDBLOCK |
| 87 |
#define EWOULDBLOCK WSAEWOULDBLOCK |
| 88 |
#endif |
| 89 |
#ifndef EINPROGRESS |
| 90 |
#define EINPROGRESS WSAEINPROGRESS |
| 91 |
#endif |
| 92 |
#define SHUT_RD 1 |
| 93 |
#define SHUT_WR 2 |
| 94 |
#define SHUT_RDWR 3 |
| 95 |
#endif |
| 96 |
|
| 97 |
typedef uint32_t sctp_assoc_t; |
| 98 |
|
| 99 |
#if defined(_WIN32) && defined(_MSC_VER) |
| 100 |
#pragma pack (push, 1) |
| 101 |
#define SCTP_PACKED |
| 102 |
#else |
| 103 |
#define SCTP_PACKED __attribute__((packed)) |
| 104 |
#endif |
| 105 |
|
| 106 |
struct sctp_common_header { |
| 107 |
uint16_t source_port; |
| 108 |
uint16_t destination_port; |
| 109 |
uint32_t verification_tag; |
| 110 |
uint32_t crc32c; |
| 111 |
} SCTP_PACKED; |
| 112 |
|
| 113 |
#if defined(_WIN32) && defined(_MSC_VER) |
| 114 |
#pragma pack(pop) |
| 115 |
#endif |
| 116 |
#undef SCTP_PACKED |
| 117 |
|
| 118 |
#define AF_CONN 123 |
| 119 |
/* The definition of struct sockaddr_conn MUST be in |
| 120 |
* tune with other sockaddr_* structures. |
| 121 |
*/ |
| 122 |
#if defined(__APPLE__) || defined(__Bitrig__) || defined(__DragonFly__) || \ |
| 123 |
defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) |
| 124 |
struct sockaddr_conn { |
| 125 |
uint8_t sconn_len; |
| 126 |
uint8_t sconn_family; |
| 127 |
uint16_t sconn_port; |
| 128 |
void *sconn_addr; |
| 129 |
}; |
| 130 |
#else |
| 131 |
struct sockaddr_conn { |
| 132 |
uint16_t sconn_family; |
| 133 |
uint16_t sconn_port; |
| 134 |
void *sconn_addr; |
| 135 |
}; |
| 136 |
#endif |
| 137 |
|
| 138 |
union sctp_sockstore { |
| 139 |
struct sockaddr_in sin; |
| 140 |
struct sockaddr_in6 sin6; |
| 141 |
struct sockaddr_conn sconn; |
| 142 |
struct sockaddr sa; |
| 143 |
}; |
| 144 |
|
| 145 |
#define SCTP_FUTURE_ASSOC 0 |
| 146 |
#define SCTP_CURRENT_ASSOC 1 |
| 147 |
#define SCTP_ALL_ASSOC 2 |
| 148 |
|
| 149 |
#define SCTP_EVENT_READ 0x0001 |
| 150 |
#define SCTP_EVENT_WRITE 0x0002 |
| 151 |
#define SCTP_EVENT_ERROR 0x0004 |
| 152 |
|
| 153 |
/*** Structures and definitions to use the socket API ***/ |
| 154 |
|
| 155 |
#define SCTP_ALIGN_RESV_PAD 92 |
| 156 |
#define SCTP_ALIGN_RESV_PAD_SHORT 76 |
| 157 |
|
| 158 |
struct sctp_rcvinfo { |
| 159 |
uint16_t rcv_sid; |
| 160 |
uint16_t rcv_ssn; |
| 161 |
uint16_t rcv_flags; |
| 162 |
uint32_t rcv_ppid; |
| 163 |
uint32_t rcv_tsn; |
| 164 |
uint32_t rcv_cumtsn; |
| 165 |
uint32_t rcv_context; |
| 166 |
sctp_assoc_t rcv_assoc_id; |
| 167 |
}; |
| 168 |
|
| 169 |
struct sctp_nxtinfo { |
| 170 |
uint16_t nxt_sid; |
| 171 |
uint16_t nxt_flags; |
| 172 |
uint32_t nxt_ppid; |
| 173 |
uint32_t nxt_length; |
| 174 |
sctp_assoc_t nxt_assoc_id; |
| 175 |
}; |
| 176 |
|
| 177 |
#define SCTP_NO_NEXT_MSG 0x0000 |
| 178 |
#define SCTP_NEXT_MSG_AVAIL 0x0001 |
| 179 |
#define SCTP_NEXT_MSG_ISCOMPLETE 0x0002 |
| 180 |
#define SCTP_NEXT_MSG_IS_UNORDERED 0x0004 |
| 181 |
#define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008 |
| 182 |
|
| 183 |
struct sctp_recvv_rn { |
| 184 |
struct sctp_rcvinfo recvv_rcvinfo; |
| 185 |
struct sctp_nxtinfo recvv_nxtinfo; |
| 186 |
}; |
| 187 |
|
| 188 |
#define SCTP_RECVV_NOINFO 0 |
| 189 |
#define SCTP_RECVV_RCVINFO 1 |
| 190 |
#define SCTP_RECVV_NXTINFO 2 |
| 191 |
#define SCTP_RECVV_RN 3 |
| 192 |
|
| 193 |
#define SCTP_SENDV_NOINFO 0 |
| 194 |
#define SCTP_SENDV_SNDINFO 1 |
| 195 |
#define SCTP_SENDV_PRINFO 2 |
| 196 |
#define SCTP_SENDV_AUTHINFO 3 |
| 197 |
#define SCTP_SENDV_SPA 4 |
| 198 |
|
| 199 |
#define SCTP_SEND_SNDINFO_VALID 0x00000001 |
| 200 |
#define SCTP_SEND_PRINFO_VALID 0x00000002 |
| 201 |
#define SCTP_SEND_AUTHINFO_VALID 0x00000004 |
| 202 |
|
| 203 |
struct sctp_snd_all_completes { |
| 204 |
uint16_t sall_stream; |
| 205 |
uint16_t sall_flags; |
| 206 |
uint32_t sall_ppid; |
| 207 |
uint32_t sall_context; |
| 208 |
uint32_t sall_num_sent; |
| 209 |
uint32_t sall_num_failed; |
| 210 |
}; |
| 211 |
|
| 212 |
struct sctp_sndinfo { |
| 213 |
uint16_t snd_sid; |
| 214 |
uint16_t snd_flags; |
| 215 |
uint32_t snd_ppid; |
| 216 |
uint32_t snd_context; |
| 217 |
sctp_assoc_t snd_assoc_id; |
| 218 |
}; |
| 219 |
|
| 220 |
struct sctp_prinfo { |
| 221 |
uint16_t pr_policy; |
| 222 |
uint32_t pr_value; |
| 223 |
}; |
| 224 |
|
| 225 |
struct sctp_authinfo { |
| 226 |
uint16_t auth_keynumber; |
| 227 |
}; |
| 228 |
|
| 229 |
struct sctp_sendv_spa { |
| 230 |
uint32_t sendv_flags; |
| 231 |
struct sctp_sndinfo sendv_sndinfo; |
| 232 |
struct sctp_prinfo sendv_prinfo; |
| 233 |
struct sctp_authinfo sendv_authinfo; |
| 234 |
}; |
| 235 |
|
| 236 |
struct sctp_udpencaps { |
| 237 |
struct sockaddr_storage sue_address; |
| 238 |
uint32_t sue_assoc_id; |
| 239 |
uint16_t sue_port; |
| 240 |
}; |
| 241 |
|
| 242 |
/******** Notifications **************/ |
| 243 |
|
| 244 |
/* notification types */ |
| 245 |
#define SCTP_ASSOC_CHANGE 0x0001 |
| 246 |
#define SCTP_PEER_ADDR_CHANGE 0x0002 |
| 247 |
#define SCTP_REMOTE_ERROR 0x0003 |
| 248 |
#define SCTP_SEND_FAILED 0x0004 |
| 249 |
#define SCTP_SHUTDOWN_EVENT 0x0005 |
| 250 |
#define SCTP_ADAPTATION_INDICATION 0x0006 |
| 251 |
#define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 |
| 252 |
#define SCTP_AUTHENTICATION_EVENT 0x0008 |
| 253 |
#define SCTP_STREAM_RESET_EVENT 0x0009 |
| 254 |
#define SCTP_SENDER_DRY_EVENT 0x000a |
| 255 |
#define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b |
| 256 |
#define SCTP_ASSOC_RESET_EVENT 0x000c |
| 257 |
#define SCTP_STREAM_CHANGE_EVENT 0x000d |
| 258 |
#define SCTP_SEND_FAILED_EVENT 0x000e |
| 259 |
|
| 260 |
/* notification event structures */ |
| 261 |
|
| 262 |
|
| 263 |
/* association change event */ |
| 264 |
struct sctp_assoc_change { |
| 265 |
uint16_t sac_type; |
| 266 |
uint16_t sac_flags; |
| 267 |
uint32_t sac_length; |
| 268 |
uint16_t sac_state; |
| 269 |
uint16_t sac_error; |
| 270 |
uint16_t sac_outbound_streams; |
| 271 |
uint16_t sac_inbound_streams; |
| 272 |
sctp_assoc_t sac_assoc_id; |
| 273 |
uint8_t sac_info[]; /* not available yet */ |
| 274 |
}; |
| 275 |
|
| 276 |
/* sac_state values */ |
| 277 |
#define SCTP_COMM_UP 0x0001 |
| 278 |
#define SCTP_COMM_LOST 0x0002 |
| 279 |
#define SCTP_RESTART 0x0003 |
| 280 |
#define SCTP_SHUTDOWN_COMP 0x0004 |
| 281 |
#define SCTP_CANT_STR_ASSOC 0x0005 |
| 282 |
|
| 283 |
/* sac_info values */ |
| 284 |
#define SCTP_ASSOC_SUPPORTS_PR 0x01 |
| 285 |
#define SCTP_ASSOC_SUPPORTS_AUTH 0x02 |
| 286 |
#define SCTP_ASSOC_SUPPORTS_ASCONF 0x03 |
| 287 |
#define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x04 |
| 288 |
#define SCTP_ASSOC_SUPPORTS_RE_CONFIG 0x05 |
| 289 |
#define SCTP_ASSOC_SUPPORTS_INTERLEAVING 0x06 |
| 290 |
#define SCTP_ASSOC_SUPPORTS_MAX 0x06 |
| 291 |
|
| 292 |
/* Address event */ |
| 293 |
struct sctp_paddr_change { |
| 294 |
uint16_t spc_type; |
| 295 |
uint16_t spc_flags; |
| 296 |
uint32_t spc_length; |
| 297 |
struct sockaddr_storage spc_aaddr; |
| 298 |
uint32_t spc_state; |
| 299 |
uint32_t spc_error; |
| 300 |
sctp_assoc_t spc_assoc_id; |
| 301 |
uint8_t spc_padding[4]; |
| 302 |
}; |
| 303 |
|
| 304 |
/* paddr state values */ |
| 305 |
#define SCTP_ADDR_AVAILABLE 0x0001 |
| 306 |
#define SCTP_ADDR_UNREACHABLE 0x0002 |
| 307 |
#define SCTP_ADDR_REMOVED 0x0003 |
| 308 |
#define SCTP_ADDR_ADDED 0x0004 |
| 309 |
#define SCTP_ADDR_MADE_PRIM 0x0005 |
| 310 |
#define SCTP_ADDR_CONFIRMED 0x0006 |
| 311 |
|
| 312 |
/* remote error events */ |
| 313 |
struct sctp_remote_error { |
| 314 |
uint16_t sre_type; |
| 315 |
uint16_t sre_flags; |
| 316 |
uint32_t sre_length; |
| 317 |
uint16_t sre_error; |
| 318 |
sctp_assoc_t sre_assoc_id; |
| 319 |
uint8_t sre_data[]; |
| 320 |
}; |
| 321 |
|
| 322 |
/* shutdown event */ |
| 323 |
struct sctp_shutdown_event { |
| 324 |
uint16_t sse_type; |
| 325 |
uint16_t sse_flags; |
| 326 |
uint32_t sse_length; |
| 327 |
sctp_assoc_t sse_assoc_id; |
| 328 |
}; |
| 329 |
|
| 330 |
/* Adaptation layer indication */ |
| 331 |
struct sctp_adaptation_event { |
| 332 |
uint16_t sai_type; |
| 333 |
uint16_t sai_flags; |
| 334 |
uint32_t sai_length; |
| 335 |
uint32_t sai_adaptation_ind; |
| 336 |
sctp_assoc_t sai_assoc_id; |
| 337 |
}; |
| 338 |
|
| 339 |
/* Partial delivery event */ |
| 340 |
struct sctp_pdapi_event { |
| 341 |
uint16_t pdapi_type; |
| 342 |
uint16_t pdapi_flags; |
| 343 |
uint32_t pdapi_length; |
| 344 |
uint32_t pdapi_indication; |
| 345 |
uint32_t pdapi_stream; |
| 346 |
uint32_t pdapi_seq; |
| 347 |
sctp_assoc_t pdapi_assoc_id; |
| 348 |
}; |
| 349 |
|
| 350 |
/* indication values */ |
| 351 |
#define SCTP_PARTIAL_DELIVERY_ABORTED 0x0001 |
| 352 |
|
| 353 |
/* SCTP authentication event */ |
| 354 |
struct sctp_authkey_event { |
| 355 |
uint16_t auth_type; |
| 356 |
uint16_t auth_flags; |
| 357 |
uint32_t auth_length; |
| 358 |
uint16_t auth_keynumber; |
| 359 |
uint32_t auth_indication; |
| 360 |
sctp_assoc_t auth_assoc_id; |
| 361 |
}; |
| 362 |
|
| 363 |
/* indication values */ |
| 364 |
#define SCTP_AUTH_NEW_KEY 0x0001 |
| 365 |
#define SCTP_AUTH_NO_AUTH 0x0002 |
| 366 |
#define SCTP_AUTH_FREE_KEY 0x0003 |
| 367 |
|
| 368 |
/* SCTP sender dry event */ |
| 369 |
struct sctp_sender_dry_event { |
| 370 |
uint16_t sender_dry_type; |
| 371 |
uint16_t sender_dry_flags; |
| 372 |
uint32_t sender_dry_length; |
| 373 |
sctp_assoc_t sender_dry_assoc_id; |
| 374 |
}; |
| 375 |
|
| 376 |
|
| 377 |
/* Stream reset event - subscribe to SCTP_STREAM_RESET_EVENT */ |
| 378 |
struct sctp_stream_reset_event { |
| 379 |
uint16_t strreset_type; |
| 380 |
uint16_t strreset_flags; |
| 381 |
uint32_t strreset_length; |
| 382 |
sctp_assoc_t strreset_assoc_id; |
| 383 |
uint16_t strreset_stream_list[]; |
| 384 |
}; |
| 385 |
|
| 386 |
/* flags in stream_reset_event (strreset_flags) */ |
| 387 |
#define SCTP_STREAM_RESET_INCOMING_SSN 0x0001 |
| 388 |
#define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 |
| 389 |
#define SCTP_STREAM_RESET_DENIED 0x0004 /* SCTP_STRRESET_FAILED */ |
| 390 |
#define SCTP_STREAM_RESET_FAILED 0x0008 /* SCTP_STRRESET_FAILED */ |
| 391 |
#define SCTP_STREAM_CHANGED_DENIED 0x0010 |
| 392 |
|
| 393 |
#define SCTP_STREAM_RESET_INCOMING 0x00000001 |
| 394 |
#define SCTP_STREAM_RESET_OUTGOING 0x00000002 |
| 395 |
|
| 396 |
|
| 397 |
/* Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT */ |
| 398 |
struct sctp_assoc_reset_event { |
| 399 |
uint16_t assocreset_type; |
| 400 |
uint16_t assocreset_flags; |
| 401 |
uint32_t assocreset_length; |
| 402 |
sctp_assoc_t assocreset_assoc_id; |
| 403 |
uint32_t assocreset_local_tsn; |
| 404 |
uint32_t assocreset_remote_tsn; |
| 405 |
}; |
| 406 |
|
| 407 |
#define SCTP_ASSOC_RESET_DENIED 0x0004 |
| 408 |
#define SCTP_ASSOC_RESET_FAILED 0x0008 |
| 409 |
|
| 410 |
|
| 411 |
/* Stream change event - subscribe to SCTP_STREAM_CHANGE_EVENT */ |
| 412 |
struct sctp_stream_change_event { |
| 413 |
uint16_t strchange_type; |
| 414 |
uint16_t strchange_flags; |
| 415 |
uint32_t strchange_length; |
| 416 |
sctp_assoc_t strchange_assoc_id; |
| 417 |
uint16_t strchange_instrms; |
| 418 |
uint16_t strchange_outstrms; |
| 419 |
}; |
| 420 |
|
| 421 |
#define SCTP_STREAM_CHANGE_DENIED 0x0004 |
| 422 |
#define SCTP_STREAM_CHANGE_FAILED 0x0008 |
| 423 |
|
| 424 |
|
| 425 |
/* SCTP send failed event */ |
| 426 |
struct sctp_send_failed_event { |
| 427 |
uint16_t ssfe_type; |
| 428 |
uint16_t ssfe_flags; |
| 429 |
uint32_t ssfe_length; |
| 430 |
uint32_t ssfe_error; |
| 431 |
struct sctp_sndinfo ssfe_info; |
| 432 |
sctp_assoc_t ssfe_assoc_id; |
| 433 |
uint8_t ssfe_data[]; |
| 434 |
}; |
| 435 |
|
| 436 |
/* flag that indicates state of data */ |
| 437 |
#define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */ |
| 438 |
#define SCTP_DATA_SENT 0x0002 /* on wire at failure */ |
| 439 |
|
| 440 |
/* SCTP event option */ |
| 441 |
struct sctp_event { |
| 442 |
sctp_assoc_t se_assoc_id; |
| 443 |
uint16_t se_type; |
| 444 |
uint8_t se_on; |
| 445 |
}; |
| 446 |
|
| 447 |
union sctp_notification { |
| 448 |
struct sctp_tlv { |
| 449 |
uint16_t sn_type; |
| 450 |
uint16_t sn_flags; |
| 451 |
uint32_t sn_length; |
| 452 |
} sn_header; |
| 453 |
struct sctp_assoc_change sn_assoc_change; |
| 454 |
struct sctp_paddr_change sn_paddr_change; |
| 455 |
struct sctp_remote_error sn_remote_error; |
| 456 |
struct sctp_shutdown_event sn_shutdown_event; |
| 457 |
struct sctp_adaptation_event sn_adaptation_event; |
| 458 |
struct sctp_pdapi_event sn_pdapi_event; |
| 459 |
struct sctp_authkey_event sn_auth_event; |
| 460 |
struct sctp_sender_dry_event sn_sender_dry_event; |
| 461 |
struct sctp_send_failed_event sn_send_failed_event; |
| 462 |
struct sctp_stream_reset_event sn_strreset_event; |
| 463 |
struct sctp_assoc_reset_event sn_assocreset_event; |
| 464 |
struct sctp_stream_change_event sn_strchange_event; |
| 465 |
}; |
| 466 |
|
| 467 |
struct sctp_event_subscribe { |
| 468 |
uint8_t sctp_data_io_event; |
| 469 |
uint8_t sctp_association_event; |
| 470 |
uint8_t sctp_address_event; |
| 471 |
uint8_t sctp_send_failure_event; |
| 472 |
uint8_t sctp_peer_error_event; |
| 473 |
uint8_t sctp_shutdown_event; |
| 474 |
uint8_t sctp_partial_delivery_event; |
| 475 |
uint8_t sctp_adaptation_layer_event; |
| 476 |
uint8_t sctp_authentication_event; |
| 477 |
uint8_t sctp_sender_dry_event; |
| 478 |
uint8_t sctp_stream_reset_event; |
| 479 |
}; |
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
/* Flags that go into the sinfo->sinfo_flags field */ |
| 484 |
#define SCTP_DATA_LAST_FRAG 0x0001 /* tail part of the message could not be sent */ |
| 485 |
#define SCTP_DATA_NOT_FRAG 0x0003 /* complete message could not be sent */ |
| 486 |
#define SCTP_NOTIFICATION 0x0010 /* next message is a notification */ |
| 487 |
#define SCTP_COMPLETE 0x0020 /* next message is complete */ |
| 488 |
#define SCTP_EOF 0x0100 /* Start shutdown procedures */ |
| 489 |
#define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ |
| 490 |
#define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ |
| 491 |
#define SCTP_ADDR_OVER 0x0800 /* Override the primary-address */ |
| 492 |
#define SCTP_SENDALL 0x1000 /* Send this on all associations */ |
| 493 |
#define SCTP_EOR 0x2000 /* end of message signal */ |
| 494 |
#define SCTP_SACK_IMMEDIATELY 0x4000 /* Set I-Bit */ |
| 495 |
|
| 496 |
#define INVALID_SINFO_FLAG(x) (((x) & 0xfffffff0 \ |
| 497 |
& ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\ |
| 498 |
SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR |\ |
| 499 |
SCTP_SACK_IMMEDIATELY)) != 0) |
| 500 |
/* for the endpoint */ |
| 501 |
|
| 502 |
/* The lower byte is an enumeration of PR-SCTP policies */ |
| 503 |
#define SCTP_PR_SCTP_NONE 0x0000 /* Reliable transfer */ |
| 504 |
#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ |
| 505 |
#define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ |
| 506 |
#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ |
| 507 |
|
| 508 |
#define PR_SCTP_POLICY(x) ((x) & 0x0f) |
| 509 |
#define PR_SCTP_ENABLED(x) (PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE) |
| 510 |
#define PR_SCTP_TTL_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL) |
| 511 |
#define PR_SCTP_BUF_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF) |
| 512 |
#define PR_SCTP_RTX_ENABLED(x) (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX) |
| 513 |
#define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX) |
| 514 |
|
| 515 |
|
| 516 |
/* |
| 517 |
* user socket options: socket API defined |
| 518 |
*/ |
| 519 |
/* |
| 520 |
* read-write options |
| 521 |
*/ |
| 522 |
#define SCTP_RTOINFO 0x00000001 |
| 523 |
#define SCTP_ASSOCINFO 0x00000002 |
| 524 |
#define SCTP_INITMSG 0x00000003 |
| 525 |
#define SCTP_NODELAY 0x00000004 |
| 526 |
#define SCTP_AUTOCLOSE 0x00000005 |
| 527 |
#define SCTP_PRIMARY_ADDR 0x00000007 |
| 528 |
#define SCTP_ADAPTATION_LAYER 0x00000008 |
| 529 |
#define SCTP_DISABLE_FRAGMENTS 0x00000009 |
| 530 |
#define SCTP_PEER_ADDR_PARAMS 0x0000000a |
| 531 |
/* ancillary data/notification interest options */ |
| 532 |
/* Without this applied we will give V4 and V6 addresses on a V6 socket */ |
| 533 |
#define SCTP_I_WANT_MAPPED_V4_ADDR 0x0000000d |
| 534 |
#define SCTP_MAXSEG 0x0000000e |
| 535 |
#define SCTP_DELAYED_SACK 0x0000000f |
| 536 |
#define SCTP_FRAGMENT_INTERLEAVE 0x00000010 |
| 537 |
#define SCTP_PARTIAL_DELIVERY_POINT 0x00000011 |
| 538 |
/* authentication support */ |
| 539 |
#define SCTP_HMAC_IDENT 0x00000014 |
| 540 |
#define SCTP_AUTH_ACTIVE_KEY 0x00000015 |
| 541 |
#define SCTP_AUTO_ASCONF 0x00000018 |
| 542 |
#define SCTP_MAX_BURST 0x00000019 |
| 543 |
/* assoc level context */ |
| 544 |
#define SCTP_CONTEXT 0x0000001a |
| 545 |
/* explicit EOR signalling */ |
| 546 |
#define SCTP_EXPLICIT_EOR 0x0000001b |
| 547 |
#define SCTP_REUSE_PORT 0x0000001c |
| 548 |
|
| 549 |
#define SCTP_EVENT 0x0000001e |
| 550 |
#define SCTP_RECVRCVINFO 0x0000001f |
| 551 |
#define SCTP_RECVNXTINFO 0x00000020 |
| 552 |
#define SCTP_DEFAULT_SNDINFO 0x00000021 |
| 553 |
#define SCTP_DEFAULT_PRINFO 0x00000022 |
| 554 |
#define SCTP_REMOTE_UDP_ENCAPS_PORT 0x00000024 |
| 555 |
#define SCTP_ECN_SUPPORTED 0x00000025 |
| 556 |
#define SCTP_PR_SUPPORTED 0x00000026 |
| 557 |
#define SCTP_AUTH_SUPPORTED 0x00000027 |
| 558 |
#define SCTP_ASCONF_SUPPORTED 0x00000028 |
| 559 |
#define SCTP_RECONFIG_SUPPORTED 0x00000029 |
| 560 |
#define SCTP_NRSACK_SUPPORTED 0x00000030 |
| 561 |
#define SCTP_PKTDROP_SUPPORTED 0x00000031 |
| 562 |
#define SCTP_MAX_CWND 0x00000032 |
| 563 |
|
| 564 |
#define SCTP_ENABLE_STREAM_RESET 0x00000900 /* struct sctp_assoc_value */ |
| 565 |
|
| 566 |
/* Pluggable Stream Scheduling Socket option */ |
| 567 |
#define SCTP_PLUGGABLE_SS 0x00001203 |
| 568 |
#define SCTP_SS_VALUE 0x00001204 |
| 569 |
|
| 570 |
/* |
| 571 |
* read-only options |
| 572 |
*/ |
| 573 |
#define SCTP_STATUS 0x00000100 |
| 574 |
#define SCTP_GET_PEER_ADDR_INFO 0x00000101 |
| 575 |
/* authentication support */ |
| 576 |
#define SCTP_PEER_AUTH_CHUNKS 0x00000102 |
| 577 |
#define SCTP_LOCAL_AUTH_CHUNKS 0x00000103 |
| 578 |
#define SCTP_GET_ASSOC_NUMBER 0x00000104 |
| 579 |
#define SCTP_GET_ASSOC_ID_LIST 0x00000105 |
| 580 |
#define SCTP_TIMEOUTS 0x00000106 |
| 581 |
#define SCTP_PR_STREAM_STATUS 0x00000107 |
| 582 |
#define SCTP_PR_ASSOC_STATUS 0x00000108 |
| 583 |
|
| 584 |
/* |
| 585 |
* write-only options |
| 586 |
*/ |
| 587 |
#define SCTP_SET_PEER_PRIMARY_ADDR 0x00000006 |
| 588 |
#define SCTP_AUTH_CHUNK 0x00000012 |
| 589 |
#define SCTP_AUTH_KEY 0x00000013 |
| 590 |
#define SCTP_AUTH_DEACTIVATE_KEY 0x0000001d |
| 591 |
#define SCTP_AUTH_DELETE_KEY 0x00000016 |
| 592 |
#define SCTP_RESET_STREAMS 0x00000901 /* struct sctp_reset_streams */ |
| 593 |
#define SCTP_RESET_ASSOC 0x00000902 /* sctp_assoc_t */ |
| 594 |
#define SCTP_ADD_STREAMS 0x00000903 /* struct sctp_add_streams */ |
| 595 |
|
| 596 |
struct sctp_initmsg { |
| 597 |
uint16_t sinit_num_ostreams; |
| 598 |
uint16_t sinit_max_instreams; |
| 599 |
uint16_t sinit_max_attempts; |
| 600 |
uint16_t sinit_max_init_timeo; |
| 601 |
}; |
| 602 |
|
| 603 |
struct sctp_rtoinfo { |
| 604 |
sctp_assoc_t srto_assoc_id; |
| 605 |
uint32_t srto_initial; |
| 606 |
uint32_t srto_max; |
| 607 |
uint32_t srto_min; |
| 608 |
}; |
| 609 |
|
| 610 |
struct sctp_assocparams { |
| 611 |
sctp_assoc_t sasoc_assoc_id; |
| 612 |
uint32_t sasoc_peer_rwnd; |
| 613 |
uint32_t sasoc_local_rwnd; |
| 614 |
uint32_t sasoc_cookie_life; |
| 615 |
uint16_t sasoc_asocmaxrxt; |
| 616 |
uint16_t sasoc_number_peer_destinations; |
| 617 |
}; |
| 618 |
|
| 619 |
struct sctp_setprim { |
| 620 |
struct sockaddr_storage ssp_addr; |
| 621 |
sctp_assoc_t ssp_assoc_id; |
| 622 |
uint8_t ssp_padding[4]; |
| 623 |
}; |
| 624 |
|
| 625 |
struct sctp_setadaptation { |
| 626 |
uint32_t ssb_adaptation_ind; |
| 627 |
}; |
| 628 |
|
| 629 |
struct sctp_paddrparams { |
| 630 |
struct sockaddr_storage spp_address; |
| 631 |
sctp_assoc_t spp_assoc_id; |
| 632 |
uint32_t spp_hbinterval; |
| 633 |
uint32_t spp_pathmtu; |
| 634 |
uint32_t spp_flags; |
| 635 |
uint32_t spp_ipv6_flowlabel; |
| 636 |
uint16_t spp_pathmaxrxt; |
| 637 |
uint8_t spp_dscp; |
| 638 |
}; |
| 639 |
|
| 640 |
#define SPP_HB_ENABLE 0x00000001 |
| 641 |
#define SPP_HB_DISABLE 0x00000002 |
| 642 |
#define SPP_HB_DEMAND 0x00000004 |
| 643 |
#define SPP_PMTUD_ENABLE 0x00000008 |
| 644 |
#define SPP_PMTUD_DISABLE 0x00000010 |
| 645 |
#define SPP_HB_TIME_IS_ZERO 0x00000080 |
| 646 |
#define SPP_IPV6_FLOWLABEL 0x00000100 |
| 647 |
#define SPP_DSCP 0x00000200 |
| 648 |
|
| 649 |
/* Used for SCTP_MAXSEG, SCTP_MAX_BURST, SCTP_ENABLE_STREAM_RESET, and SCTP_CONTEXT */ |
| 650 |
struct sctp_assoc_value { |
| 651 |
sctp_assoc_t assoc_id; |
| 652 |
uint32_t assoc_value; |
| 653 |
}; |
| 654 |
|
| 655 |
/* To enable stream reset */ |
| 656 |
#define SCTP_ENABLE_RESET_STREAM_REQ 0x00000001 |
| 657 |
#define SCTP_ENABLE_RESET_ASSOC_REQ 0x00000002 |
| 658 |
#define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x00000004 |
| 659 |
#define SCTP_ENABLE_VALUE_MASK 0x00000007 |
| 660 |
|
| 661 |
struct sctp_reset_streams { |
| 662 |
sctp_assoc_t srs_assoc_id; |
| 663 |
uint16_t srs_flags; |
| 664 |
uint16_t srs_number_streams; /* 0 == ALL */ |
| 665 |
uint16_t srs_stream_list[]; /* list if strrst_num_streams is not 0 */ |
| 666 |
}; |
| 667 |
|
| 668 |
struct sctp_add_streams { |
| 669 |
sctp_assoc_t sas_assoc_id; |
| 670 |
uint16_t sas_instrms; |
| 671 |
uint16_t sas_outstrms; |
| 672 |
}; |
| 673 |
|
| 674 |
struct sctp_hmacalgo { |
| 675 |
uint32_t shmac_number_of_idents; |
| 676 |
uint16_t shmac_idents[]; |
| 677 |
}; |
| 678 |
|
| 679 |
/* AUTH hmac_id */ |
| 680 |
#define SCTP_AUTH_HMAC_ID_RSVD 0x0000 |
| 681 |
#define SCTP_AUTH_HMAC_ID_SHA1 0x0001 /* default, mandatory */ |
| 682 |
#define SCTP_AUTH_HMAC_ID_SHA256 0x0003 |
| 683 |
#define SCTP_AUTH_HMAC_ID_SHA224 0x0004 |
| 684 |
#define SCTP_AUTH_HMAC_ID_SHA384 0x0005 |
| 685 |
#define SCTP_AUTH_HMAC_ID_SHA512 0x0006 |
| 686 |
|
| 687 |
|
| 688 |
struct sctp_sack_info { |
| 689 |
sctp_assoc_t sack_assoc_id; |
| 690 |
uint32_t sack_delay; |
| 691 |
uint32_t sack_freq; |
| 692 |
}; |
| 693 |
|
| 694 |
struct sctp_default_prinfo { |
| 695 |
uint16_t pr_policy; |
| 696 |
uint32_t pr_value; |
| 697 |
sctp_assoc_t pr_assoc_id; |
| 698 |
}; |
| 699 |
|
| 700 |
struct sctp_paddrinfo { |
| 701 |
struct sockaddr_storage spinfo_address; |
| 702 |
sctp_assoc_t spinfo_assoc_id; |
| 703 |
int32_t spinfo_state; |
| 704 |
uint32_t spinfo_cwnd; |
| 705 |
uint32_t spinfo_srtt; |
| 706 |
uint32_t spinfo_rto; |
| 707 |
uint32_t spinfo_mtu; |
| 708 |
}; |
| 709 |
|
| 710 |
struct sctp_status { |
| 711 |
sctp_assoc_t sstat_assoc_id; |
| 712 |
int32_t sstat_state; |
| 713 |
uint32_t sstat_rwnd; |
| 714 |
uint16_t sstat_unackdata; |
| 715 |
uint16_t sstat_penddata; |
| 716 |
uint16_t sstat_instrms; |
| 717 |
uint16_t sstat_outstrms; |
| 718 |
uint32_t sstat_fragmentation_point; |
| 719 |
struct sctp_paddrinfo sstat_primary; |
| 720 |
}; |
| 721 |
|
| 722 |
/* |
| 723 |
* user state values |
| 724 |
*/ |
| 725 |
#define SCTP_CLOSED 0x0000 |
| 726 |
#define SCTP_BOUND 0x1000 |
| 727 |
#define SCTP_LISTEN 0x2000 |
| 728 |
#define SCTP_COOKIE_WAIT 0x0002 |
| 729 |
#define SCTP_COOKIE_ECHOED 0x0004 |
| 730 |
#define SCTP_ESTABLISHED 0x0008 |
| 731 |
#define SCTP_SHUTDOWN_SENT 0x0010 |
| 732 |
#define SCTP_SHUTDOWN_RECEIVED 0x0020 |
| 733 |
#define SCTP_SHUTDOWN_ACK_SENT 0x0040 |
| 734 |
#define SCTP_SHUTDOWN_PENDING 0x0080 |
| 735 |
|
| 736 |
|
| 737 |
#define SCTP_ACTIVE 0x0001 /* SCTP_ADDR_REACHABLE */ |
| 738 |
#define SCTP_INACTIVE 0x0002 /* neither SCTP_ADDR_REACHABLE |
| 739 |
nor SCTP_ADDR_UNCONFIRMED */ |
| 740 |
#define SCTP_UNCONFIRMED 0x0200 /* SCTP_ADDR_UNCONFIRMED */ |
| 741 |
|
| 742 |
struct sctp_authchunks { |
| 743 |
sctp_assoc_t gauth_assoc_id; |
| 744 |
/* uint32_t gauth_number_of_chunks; not available */ |
| 745 |
uint8_t gauth_chunks[]; |
| 746 |
}; |
| 747 |
|
| 748 |
struct sctp_assoc_ids { |
| 749 |
uint32_t gaids_number_of_ids; |
| 750 |
sctp_assoc_t gaids_assoc_id[]; |
| 751 |
}; |
| 752 |
|
| 753 |
struct sctp_setpeerprim { |
| 754 |
struct sockaddr_storage sspp_addr; |
| 755 |
sctp_assoc_t sspp_assoc_id; |
| 756 |
uint8_t sspp_padding[4]; |
| 757 |
}; |
| 758 |
|
| 759 |
struct sctp_authchunk { |
| 760 |
uint8_t sauth_chunk; |
| 761 |
}; |
| 762 |
|
| 763 |
|
| 764 |
struct sctp_get_nonce_values { |
| 765 |
sctp_assoc_t gn_assoc_id; |
| 766 |
uint32_t gn_peers_tag; |
| 767 |
uint32_t gn_local_tag; |
| 768 |
}; |
| 769 |
|
| 770 |
|
| 771 |
/* |
| 772 |
* Main SCTP chunk types |
| 773 |
*/ |
| 774 |
/************0x00 series ***********/ |
| 775 |
#define SCTP_DATA 0x00 |
| 776 |
#define SCTP_INITIATION 0x01 |
| 777 |
#define SCTP_INITIATION_ACK 0x02 |
| 778 |
#define SCTP_SELECTIVE_ACK 0x03 |
| 779 |
#define SCTP_HEARTBEAT_REQUEST 0x04 |
| 780 |
#define SCTP_HEARTBEAT_ACK 0x05 |
| 781 |
#define SCTP_ABORT_ASSOCIATION 0x06 |
| 782 |
#define SCTP_SHUTDOWN 0x07 |
| 783 |
#define SCTP_SHUTDOWN_ACK 0x08 |
| 784 |
#define SCTP_OPERATION_ERROR 0x09 |
| 785 |
#define SCTP_COOKIE_ECHO 0x0a |
| 786 |
#define SCTP_COOKIE_ACK 0x0b |
| 787 |
#define SCTP_ECN_ECHO 0x0c |
| 788 |
#define SCTP_ECN_CWR 0x0d |
| 789 |
#define SCTP_SHUTDOWN_COMPLETE 0x0e |
| 790 |
/* RFC4895 */ |
| 791 |
#define SCTP_AUTHENTICATION 0x0f |
| 792 |
/* EY nr_sack chunk id*/ |
| 793 |
#define SCTP_NR_SELECTIVE_ACK 0x10 |
| 794 |
/************0x40 series ***********/ |
| 795 |
/************0x80 series ***********/ |
| 796 |
/* RFC5061 */ |
| 797 |
#define SCTP_ASCONF_ACK 0x80 |
| 798 |
/* draft-ietf-stewart-pktdrpsctp */ |
| 799 |
#define SCTP_PACKET_DROPPED 0x81 |
| 800 |
/* draft-ietf-stewart-strreset-xxx */ |
| 801 |
#define SCTP_STREAM_RESET 0x82 |
| 802 |
|
| 803 |
/* RFC4820 */ |
| 804 |
#define SCTP_PAD_CHUNK 0x84 |
| 805 |
/************0xc0 series ***********/ |
| 806 |
/* RFC3758 */ |
| 807 |
#define SCTP_FORWARD_CUM_TSN 0xc0 |
| 808 |
/* RFC5061 */ |
| 809 |
#define SCTP_ASCONF 0xc1 |
| 810 |
|
| 811 |
struct sctp_authkey { |
| 812 |
sctp_assoc_t sca_assoc_id; |
| 813 |
uint16_t sca_keynumber; |
| 814 |
uint16_t sca_keylength; |
| 815 |
uint8_t sca_key[]; |
| 816 |
}; |
| 817 |
|
| 818 |
struct sctp_authkeyid { |
| 819 |
sctp_assoc_t scact_assoc_id; |
| 820 |
uint16_t scact_keynumber; |
| 821 |
}; |
| 822 |
|
| 823 |
struct sctp_cc_option { |
| 824 |
int option; |
| 825 |
struct sctp_assoc_value aid_value; |
| 826 |
}; |
| 827 |
|
| 828 |
struct sctp_stream_value { |
| 829 |
sctp_assoc_t assoc_id; |
| 830 |
uint16_t stream_id; |
| 831 |
uint16_t stream_value; |
| 832 |
}; |
| 833 |
|
| 834 |
struct sctp_timeouts { |
| 835 |
sctp_assoc_t stimo_assoc_id; |
| 836 |
uint32_t stimo_init; |
| 837 |
uint32_t stimo_data; |
| 838 |
uint32_t stimo_sack; |
| 839 |
uint32_t stimo_shutdown; |
| 840 |
uint32_t stimo_heartbeat; |
| 841 |
uint32_t stimo_cookie; |
| 842 |
uint32_t stimo_shutdownack; |
| 843 |
}; |
| 844 |
|
| 845 |
struct sctp_prstatus { |
| 846 |
sctp_assoc_t sprstat_assoc_id; |
| 847 |
uint16_t sprstat_sid; |
| 848 |
uint16_t sprstat_policy; |
| 849 |
uint64_t sprstat_abandoned_unsent; |
| 850 |
uint64_t sprstat_abandoned_sent; |
| 851 |
}; |
| 852 |
|
| 853 |
/* Standard TCP Congestion Control */ |
| 854 |
#define SCTP_CC_RFC2581 0x00000000 |
| 855 |
/* High Speed TCP Congestion Control (Floyd) */ |
| 856 |
#define SCTP_CC_HSTCP 0x00000001 |
| 857 |
/* HTCP Congestion Control */ |
| 858 |
#define SCTP_CC_HTCP 0x00000002 |
| 859 |
/* RTCC Congestion Control - RFC2581 plus */ |
| 860 |
#define SCTP_CC_RTCC 0x00000003 |
| 861 |
|
| 862 |
#define SCTP_CC_OPT_RTCC_SETMODE 0x00002000 |
| 863 |
#define SCTP_CC_OPT_USE_DCCC_EC 0x00002001 |
| 864 |
#define SCTP_CC_OPT_STEADY_STEP 0x00002002 |
| 865 |
|
| 866 |
#define SCTP_CMT_OFF 0 |
| 867 |
#define SCTP_CMT_BASE 1 |
| 868 |
#define SCTP_CMT_RPV1 2 |
| 869 |
#define SCTP_CMT_RPV2 3 |
| 870 |
#define SCTP_CMT_MPTCP 4 |
| 871 |
#define SCTP_CMT_MAX SCTP_CMT_MPTCP |
| 872 |
|
| 873 |
/* RS - Supported stream scheduling modules for pluggable |
| 874 |
* stream scheduling |
| 875 |
*/ |
| 876 |
/* Default simple round-robin */ |
| 877 |
#define SCTP_SS_DEFAULT 0x00000000 |
| 878 |
/* Real round-robin */ |
| 879 |
#define SCTP_SS_ROUND_ROBIN 0x00000001 |
| 880 |
/* Real round-robin per packet */ |
| 881 |
#define SCTP_SS_ROUND_ROBIN_PACKET 0x00000002 |
| 882 |
/* Priority */ |
| 883 |
#define SCTP_SS_PRIORITY 0x00000003 |
| 884 |
/* Fair Bandwidth */ |
| 885 |
#define SCTP_SS_FAIR_BANDWITH 0x00000004 |
| 886 |
/* First-come, first-serve */ |
| 887 |
#define SCTP_SS_FIRST_COME 0x00000005 |
| 888 |
|
| 889 |
/******************** System calls *************/ |
| 890 |
|
| 891 |
struct socket; |
| 892 |
|
| 893 |
void |
| 894 |
usrsctp_init(uint16_t, |
| 895 |
int (*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df), |
| 896 |
void (*)(const char *format, ...)); |
| 897 |
|
| 898 |
void |
| 899 |
usrsctp_init_nothreads(uint16_t, |
| 900 |
int (*)(void *addr, void *buffer, size_t length, uint8_t tos, uint8_t set_df), |
| 901 |
void (*)(const char *format, ...)); |
| 902 |
|
| 903 |
struct socket * |
| 904 |
usrsctp_socket(int domain, int type, int protocol, |
| 905 |
int (*receive_cb)(struct socket *sock, union sctp_sockstore addr, void *data, |
| 906 |
size_t datalen, struct sctp_rcvinfo, int flags, void *ulp_info), |
| 907 |
int (*send_cb)(struct socket *sock, uint32_t sb_free), |
| 908 |
uint32_t sb_threshold, |
| 909 |
void *ulp_info); |
| 910 |
|
| 911 |
int |
| 912 |
usrsctp_setsockopt(struct socket *so, |
| 913 |
int level, |
| 914 |
int option_name, |
| 915 |
const void *option_value, |
| 916 |
socklen_t option_len); |
| 917 |
|
| 918 |
int |
| 919 |
usrsctp_getsockopt(struct socket *so, |
| 920 |
int level, |
| 921 |
int option_name, |
| 922 |
void *option_value, |
| 923 |
socklen_t *option_len); |
| 924 |
|
| 925 |
int |
| 926 |
usrsctp_opt_info(struct socket *so, |
| 927 |
sctp_assoc_t id, |
| 928 |
int opt, |
| 929 |
void *arg, |
| 930 |
socklen_t *size); |
| 931 |
|
| 932 |
int |
| 933 |
usrsctp_getpaddrs(struct socket *so, |
| 934 |
sctp_assoc_t id, |
| 935 |
struct sockaddr **raddrs); |
| 936 |
|
| 937 |
void |
| 938 |
usrsctp_freepaddrs(struct sockaddr *addrs); |
| 939 |
|
| 940 |
int |
| 941 |
usrsctp_getladdrs(struct socket *so, |
| 942 |
sctp_assoc_t id, |
| 943 |
struct sockaddr **raddrs); |
| 944 |
|
| 945 |
void |
| 946 |
usrsctp_freeladdrs(struct sockaddr *addrs); |
| 947 |
|
| 948 |
ssize_t |
| 949 |
usrsctp_sendv(struct socket *so, |
| 950 |
const void *data, |
| 951 |
size_t len, |
| 952 |
struct sockaddr *to, |
| 953 |
int addrcnt, |
| 954 |
void *info, |
| 955 |
socklen_t infolen, |
| 956 |
unsigned int infotype, |
| 957 |
int flags); |
| 958 |
|
| 959 |
ssize_t |
| 960 |
usrsctp_recvv(struct socket *so, |
| 961 |
void *dbuf, |
| 962 |
size_t len, |
| 963 |
struct sockaddr *from, |
| 964 |
socklen_t * fromlen, |
| 965 |
void *info, |
| 966 |
socklen_t *infolen, |
| 967 |
unsigned int *infotype, |
| 968 |
int *msg_flags); |
| 969 |
|
| 970 |
int |
| 971 |
usrsctp_bind(struct socket *so, |
| 972 |
struct sockaddr *name, |
| 973 |
socklen_t namelen); |
| 974 |
|
| 975 |
#define SCTP_BINDX_ADD_ADDR 0x00008001 |
| 976 |
#define SCTP_BINDX_REM_ADDR 0x00008002 |
| 977 |
|
| 978 |
int |
| 979 |
usrsctp_bindx(struct socket *so, |
| 980 |
struct sockaddr *addrs, |
| 981 |
int addrcnt, |
| 982 |
int flags); |
| 983 |
|
| 984 |
int |
| 985 |
usrsctp_listen(struct socket *so, |
| 986 |
int backlog); |
| 987 |
|
| 988 |
struct socket * |
| 989 |
usrsctp_accept(struct socket *so, |
| 990 |
struct sockaddr * aname, |
| 991 |
socklen_t * anamelen); |
| 992 |
|
| 993 |
struct socket * |
| 994 |
usrsctp_peeloff(struct socket *, sctp_assoc_t); |
| 995 |
|
| 996 |
int |
| 997 |
usrsctp_connect(struct socket *so, |
| 998 |
struct sockaddr *name, |
| 999 |
socklen_t namelen); |
| 1000 |
|
| 1001 |
int |
| 1002 |
usrsctp_connectx(struct socket *so, |
| 1003 |
const struct sockaddr *addrs, int addrcnt, |
| 1004 |
sctp_assoc_t *id); |
| 1005 |
|
| 1006 |
void |
| 1007 |
usrsctp_close(struct socket *so); |
| 1008 |
|
| 1009 |
sctp_assoc_t |
| 1010 |
usrsctp_getassocid(struct socket *, struct sockaddr *); |
| 1011 |
|
| 1012 |
int |
| 1013 |
usrsctp_finish(void); |
| 1014 |
|
| 1015 |
int |
| 1016 |
usrsctp_shutdown(struct socket *so, int how); |
| 1017 |
|
| 1018 |
void |
| 1019 |
usrsctp_conninput(void *, const void *, size_t, uint8_t); |
| 1020 |
|
| 1021 |
int |
| 1022 |
usrsctp_set_non_blocking(struct socket *, int); |
| 1023 |
|
| 1024 |
int |
| 1025 |
usrsctp_get_non_blocking(struct socket *); |
| 1026 |
|
| 1027 |
void |
| 1028 |
usrsctp_register_address(void *); |
| 1029 |
|
| 1030 |
void |
| 1031 |
usrsctp_deregister_address(void *); |
| 1032 |
|
| 1033 |
int |
| 1034 |
usrsctp_set_ulpinfo(struct socket *, void *); |
| 1035 |
|
| 1036 |
int |
| 1037 |
usrsctp_get_ulpinfo(struct socket *, void **); |
| 1038 |
|
| 1039 |
int |
| 1040 |
usrsctp_set_upcall(struct socket *so, |
| 1041 |
void (*upcall)(struct socket *, void *, int), |
| 1042 |
void *arg); |
| 1043 |
|
| 1044 |
int |
| 1045 |
usrsctp_get_events(struct socket *so); |
| 1046 |
|
| 1047 |
|
| 1048 |
void |
| 1049 |
usrsctp_handle_timers(uint32_t elapsed_milliseconds); |
| 1050 |
|
| 1051 |
#define SCTP_DUMP_OUTBOUND 1 |
| 1052 |
#define SCTP_DUMP_INBOUND 0 |
| 1053 |
|
| 1054 |
char * |
| 1055 |
usrsctp_dumppacket(const void *, size_t, int); |
| 1056 |
|
| 1057 |
void |
| 1058 |
usrsctp_freedumpbuffer(char *); |
| 1059 |
|
| 1060 |
void |
| 1061 |
usrsctp_enable_crc32c_offload(void); |
| 1062 |
|
| 1063 |
void |
| 1064 |
usrsctp_disable_crc32c_offload(void); |
| 1065 |
|
| 1066 |
uint32_t |
| 1067 |
usrsctp_crc32c(void *, size_t); |
| 1068 |
|
| 1069 |
#define USRSCTP_TUNABLE_DECL(__field) \ |
| 1070 |
int usrsctp_tunable_set_ ## __field(uint32_t value);\ |
| 1071 |
uint32_t usrsctp_sysctl_get_ ## __field(void); |
| 1072 |
|
| 1073 |
USRSCTP_TUNABLE_DECL(sctp_hashtblsize) |
| 1074 |
USRSCTP_TUNABLE_DECL(sctp_pcbtblsize) |
| 1075 |
USRSCTP_TUNABLE_DECL(sctp_chunkscale) |
| 1076 |
|
| 1077 |
#define USRSCTP_SYSCTL_DECL(__field) \ |
| 1078 |
int usrsctp_sysctl_set_ ## __field(uint32_t value);\ |
| 1079 |
uint32_t usrsctp_sysctl_get_ ## __field(void); |
| 1080 |
|
| 1081 |
USRSCTP_SYSCTL_DECL(sctp_sendspace) |
| 1082 |
USRSCTP_SYSCTL_DECL(sctp_recvspace) |
| 1083 |
USRSCTP_SYSCTL_DECL(sctp_auto_asconf) |
| 1084 |
USRSCTP_SYSCTL_DECL(sctp_multiple_asconfs) |
| 1085 |
USRSCTP_SYSCTL_DECL(sctp_ecn_enable) |
| 1086 |
USRSCTP_SYSCTL_DECL(sctp_pr_enable) |
| 1087 |
USRSCTP_SYSCTL_DECL(sctp_auth_enable) |
| 1088 |
USRSCTP_SYSCTL_DECL(sctp_asconf_enable) |
| 1089 |
USRSCTP_SYSCTL_DECL(sctp_reconfig_enable) |
| 1090 |
USRSCTP_SYSCTL_DECL(sctp_nrsack_enable) |
| 1091 |
USRSCTP_SYSCTL_DECL(sctp_pktdrop_enable) |
| 1092 |
USRSCTP_SYSCTL_DECL(sctp_no_csum_on_loopback) |
| 1093 |
USRSCTP_SYSCTL_DECL(sctp_peer_chunk_oh) |
| 1094 |
USRSCTP_SYSCTL_DECL(sctp_max_burst_default) |
| 1095 |
USRSCTP_SYSCTL_DECL(sctp_max_chunks_on_queue) |
| 1096 |
USRSCTP_SYSCTL_DECL(sctp_min_split_point) |
| 1097 |
USRSCTP_SYSCTL_DECL(sctp_delayed_sack_time_default) |
| 1098 |
USRSCTP_SYSCTL_DECL(sctp_sack_freq_default) |
| 1099 |
USRSCTP_SYSCTL_DECL(sctp_system_free_resc_limit) |
| 1100 |
USRSCTP_SYSCTL_DECL(sctp_asoc_free_resc_limit) |
| 1101 |
USRSCTP_SYSCTL_DECL(sctp_heartbeat_interval_default) |
| 1102 |
USRSCTP_SYSCTL_DECL(sctp_pmtu_raise_time_default) |
| 1103 |
USRSCTP_SYSCTL_DECL(sctp_shutdown_guard_time_default) |
| 1104 |
USRSCTP_SYSCTL_DECL(sctp_secret_lifetime_default) |
| 1105 |
USRSCTP_SYSCTL_DECL(sctp_rto_max_default) |
| 1106 |
USRSCTP_SYSCTL_DECL(sctp_rto_min_default) |
| 1107 |
USRSCTP_SYSCTL_DECL(sctp_rto_initial_default) |
| 1108 |
USRSCTP_SYSCTL_DECL(sctp_init_rto_max_default) |
| 1109 |
USRSCTP_SYSCTL_DECL(sctp_valid_cookie_life_default) |
| 1110 |
USRSCTP_SYSCTL_DECL(sctp_init_rtx_max_default) |
| 1111 |
USRSCTP_SYSCTL_DECL(sctp_assoc_rtx_max_default) |
| 1112 |
USRSCTP_SYSCTL_DECL(sctp_path_rtx_max_default) |
| 1113 |
USRSCTP_SYSCTL_DECL(sctp_add_more_threshold) |
| 1114 |
USRSCTP_SYSCTL_DECL(sctp_nr_incoming_streams_default) |
| 1115 |
USRSCTP_SYSCTL_DECL(sctp_nr_outgoing_streams_default) |
| 1116 |
USRSCTP_SYSCTL_DECL(sctp_cmt_on_off) |
| 1117 |
USRSCTP_SYSCTL_DECL(sctp_cmt_use_dac) |
| 1118 |
USRSCTP_SYSCTL_DECL(sctp_use_cwnd_based_maxburst) |
| 1119 |
USRSCTP_SYSCTL_DECL(sctp_nat_friendly) |
| 1120 |
USRSCTP_SYSCTL_DECL(sctp_L2_abc_variable) |
| 1121 |
USRSCTP_SYSCTL_DECL(sctp_mbuf_threshold_count) |
| 1122 |
USRSCTP_SYSCTL_DECL(sctp_do_drain) |
| 1123 |
USRSCTP_SYSCTL_DECL(sctp_hb_maxburst) |
| 1124 |
USRSCTP_SYSCTL_DECL(sctp_abort_if_one_2_one_hits_limit) |
| 1125 |
USRSCTP_SYSCTL_DECL(sctp_min_residual) |
| 1126 |
USRSCTP_SYSCTL_DECL(sctp_max_retran_chunk) |
| 1127 |
USRSCTP_SYSCTL_DECL(sctp_logging_level) |
| 1128 |
USRSCTP_SYSCTL_DECL(sctp_default_cc_module) |
| 1129 |
USRSCTP_SYSCTL_DECL(sctp_default_frag_interleave) |
| 1130 |
USRSCTP_SYSCTL_DECL(sctp_mobility_base) |
| 1131 |
USRSCTP_SYSCTL_DECL(sctp_mobility_fasthandoff) |
| 1132 |
USRSCTP_SYSCTL_DECL(sctp_inits_include_nat_friendly) |
| 1133 |
USRSCTP_SYSCTL_DECL(sctp_udp_tunneling_port) |
| 1134 |
USRSCTP_SYSCTL_DECL(sctp_enable_sack_immediately) |
| 1135 |
USRSCTP_SYSCTL_DECL(sctp_vtag_time_wait) |
| 1136 |
USRSCTP_SYSCTL_DECL(sctp_blackhole) |
| 1137 |
USRSCTP_SYSCTL_DECL(sctp_sendall_limit) |
| 1138 |
USRSCTP_SYSCTL_DECL(sctp_diag_info_code) |
| 1139 |
USRSCTP_SYSCTL_DECL(sctp_fr_max_burst_default) |
| 1140 |
USRSCTP_SYSCTL_DECL(sctp_path_pf_threshold) |
| 1141 |
USRSCTP_SYSCTL_DECL(sctp_default_ss_module) |
| 1142 |
USRSCTP_SYSCTL_DECL(sctp_rttvar_bw) |
| 1143 |
USRSCTP_SYSCTL_DECL(sctp_rttvar_rtt) |
| 1144 |
USRSCTP_SYSCTL_DECL(sctp_rttvar_eqret) |
| 1145 |
USRSCTP_SYSCTL_DECL(sctp_steady_step) |
| 1146 |
USRSCTP_SYSCTL_DECL(sctp_use_dccc_ecn) |
| 1147 |
USRSCTP_SYSCTL_DECL(sctp_buffer_splitting) |
| 1148 |
USRSCTP_SYSCTL_DECL(sctp_initial_cwnd) |
| 1149 |
#ifdef SCTP_DEBUG |
| 1150 |
USRSCTP_SYSCTL_DECL(sctp_debug_on) |
| 1151 |
/* More specific values can be found in sctp_constants, but |
| 1152 |
* are not considered to be part of the API. |
| 1153 |
*/ |
| 1154 |
#define SCTP_DEBUG_NONE 0x00000000 |
| 1155 |
#define SCTP_DEBUG_ALL 0xffffffff |
| 1156 |
#endif |
| 1157 |
#undef USRSCTP_SYSCTL_DECL |
| 1158 |
struct sctp_timeval { |
| 1159 |
uint32_t tv_sec; |
| 1160 |
uint32_t tv_usec; |
| 1161 |
}; |
| 1162 |
|
| 1163 |
struct sctpstat { |
| 1164 |
struct sctp_timeval sctps_discontinuitytime; /* sctpStats 18 (TimeStamp) */ |
| 1165 |
/* MIB according to RFC 3873 */ |
| 1166 |
uint32_t sctps_currestab; /* sctpStats 1 (Gauge32) */ |
| 1167 |
uint32_t sctps_activeestab; /* sctpStats 2 (Counter32) */ |
| 1168 |
uint32_t sctps_restartestab; |
| 1169 |
uint32_t sctps_collisionestab; |
| 1170 |
uint32_t sctps_passiveestab; /* sctpStats 3 (Counter32) */ |
| 1171 |
uint32_t sctps_aborted; /* sctpStats 4 (Counter32) */ |
| 1172 |
uint32_t sctps_shutdown; /* sctpStats 5 (Counter32) */ |
| 1173 |
uint32_t sctps_outoftheblue; /* sctpStats 6 (Counter32) */ |
| 1174 |
uint32_t sctps_checksumerrors; /* sctpStats 7 (Counter32) */ |
| 1175 |
uint32_t sctps_outcontrolchunks; /* sctpStats 8 (Counter64) */ |
| 1176 |
uint32_t sctps_outorderchunks; /* sctpStats 9 (Counter64) */ |
| 1177 |
uint32_t sctps_outunorderchunks; /* sctpStats 10 (Counter64) */ |
| 1178 |
uint32_t sctps_incontrolchunks; /* sctpStats 11 (Counter64) */ |
| 1179 |
uint32_t sctps_inorderchunks; /* sctpStats 12 (Counter64) */ |
| 1180 |
uint32_t sctps_inunorderchunks; /* sctpStats 13 (Counter64) */ |
| 1181 |
uint32_t sctps_fragusrmsgs; /* sctpStats 14 (Counter64) */ |
| 1182 |
uint32_t sctps_reasmusrmsgs; /* sctpStats 15 (Counter64) */ |
| 1183 |
uint32_t sctps_outpackets; /* sctpStats 16 (Counter64) */ |
| 1184 |
uint32_t sctps_inpackets; /* sctpStats 17 (Counter64) */ |
| 1185 |
|
| 1186 |
/* input statistics: */ |
| 1187 |
uint32_t sctps_recvpackets; /* total input packets */ |
| 1188 |
uint32_t sctps_recvdatagrams; /* total input datagrams */ |
| 1189 |
uint32_t sctps_recvpktwithdata; /* total packets that had data */ |
| 1190 |
uint32_t sctps_recvsacks; /* total input SACK chunks */ |
| 1191 |
uint32_t sctps_recvdata; /* total input DATA chunks */ |
| 1192 |
uint32_t sctps_recvdupdata; /* total input duplicate DATA chunks */ |
| 1193 |
uint32_t sctps_recvheartbeat; /* total input HB chunks */ |
| 1194 |
uint32_t sctps_recvheartbeatack; /* total input HB-ACK chunks */ |
| 1195 |
uint32_t sctps_recvecne; /* total input ECNE chunks */ |
| 1196 |
uint32_t sctps_recvauth; /* total input AUTH chunks */ |
| 1197 |
uint32_t sctps_recvauthmissing; /* total input chunks missing AUTH */ |
| 1198 |
uint32_t sctps_recvivalhmacid; /* total number of invalid HMAC ids received */ |
| 1199 |
uint32_t sctps_recvivalkeyid; /* total number of invalid secret ids received */ |
| 1200 |
uint32_t sctps_recvauthfailed; /* total number of auth failed */ |
| 1201 |
uint32_t sctps_recvexpress; /* total fast path receives all one chunk */ |
| 1202 |
uint32_t sctps_recvexpressm; /* total fast path multi-part data */ |
| 1203 |
uint32_t sctps_recv_spare; /* formerly sctps_recvnocrc */ |
| 1204 |
uint32_t sctps_recvswcrc; |
| 1205 |
uint32_t sctps_recvhwcrc; |
| 1206 |
|
| 1207 |
/* output statistics: */ |
| 1208 |
uint32_t sctps_sendpackets; /* total output packets */ |
| 1209 |
uint32_t sctps_sendsacks; /* total output SACKs */ |
| 1210 |
uint32_t sctps_senddata; /* total output DATA chunks */ |
| 1211 |
uint32_t sctps_sendretransdata; /* total output retransmitted DATA chunks */ |
| 1212 |
uint32_t sctps_sendfastretrans; /* total output fast retransmitted DATA chunks */ |
| 1213 |
uint32_t sctps_sendmultfastretrans; /* total FR's that happened more than once |
| 1214 |
* to same chunk (u-del multi-fr algo). |
| 1215 |
*/ |
| 1216 |
uint32_t sctps_sendheartbeat; /* total output HB chunks */ |
| 1217 |
uint32_t sctps_sendecne; /* total output ECNE chunks */ |
| 1218 |
uint32_t sctps_sendauth; /* total output AUTH chunks FIXME */ |
| 1219 |
uint32_t sctps_senderrors; /* ip_output error counter */ |
| 1220 |
uint32_t sctps_send_spare; /* formerly sctps_sendnocrc */ |
| 1221 |
uint32_t sctps_sendswcrc; |
| 1222 |
uint32_t sctps_sendhwcrc; |
| 1223 |
/* PCKDROPREP statistics: */ |
| 1224 |
uint32_t sctps_pdrpfmbox; /* Packet drop from middle box */ |
| 1225 |
uint32_t sctps_pdrpfehos; /* P-drop from end host */ |
| 1226 |
uint32_t sctps_pdrpmbda; /* P-drops with data */ |
| 1227 |
uint32_t sctps_pdrpmbct; /* P-drops, non-data, non-endhost */ |
| 1228 |
uint32_t sctps_pdrpbwrpt; /* P-drop, non-endhost, bandwidth rep only */ |
| 1229 |
uint32_t sctps_pdrpcrupt; /* P-drop, not enough for chunk header */ |
| 1230 |
uint32_t sctps_pdrpnedat; /* P-drop, not enough data to confirm */ |
| 1231 |
uint32_t sctps_pdrppdbrk; /* P-drop, where process_chunk_drop said break */ |
| 1232 |
uint32_t sctps_pdrptsnnf; /* P-drop, could not find TSN */ |
| 1233 |
uint32_t sctps_pdrpdnfnd; /* P-drop, attempt reverse TSN lookup */ |
| 1234 |
uint32_t sctps_pdrpdiwnp; /* P-drop, e-host confirms zero-rwnd */ |
| 1235 |
uint32_t sctps_pdrpdizrw; /* P-drop, midbox confirms no space */ |
| 1236 |
uint32_t sctps_pdrpbadd; /* P-drop, data did not match TSN */ |
| 1237 |
uint32_t sctps_pdrpmark; /* P-drop, TSN's marked for Fast Retran */ |
| 1238 |
/* timeouts */ |
| 1239 |
uint32_t sctps_timoiterator; /* Number of iterator timers that fired */ |
| 1240 |
uint32_t sctps_timodata; /* Number of T3 data time outs */ |
| 1241 |
uint32_t sctps_timowindowprobe; /* Number of window probe (T3) timers that fired */ |
| 1242 |
uint32_t sctps_timoinit; /* Number of INIT timers that fired */ |
| 1243 |
uint32_t sctps_timosack; /* Number of sack timers that fired */ |
| 1244 |
uint32_t sctps_timoshutdown; /* Number of shutdown timers that fired */ |
| 1245 |
uint32_t sctps_timoheartbeat; /* Number of heartbeat timers that fired */ |
| 1246 |
uint32_t sctps_timocookie; /* Number of times a cookie timeout fired */ |
| 1247 |
uint32_t sctps_timosecret; /* Number of times an endpoint changed its cookie secret*/ |
| 1248 |
uint32_t sctps_timopathmtu; /* Number of PMTU timers that fired */ |
| 1249 |
uint32_t sctps_timoshutdownack; /* Number of shutdown ack timers that fired */ |
| 1250 |
uint32_t sctps_timoshutdownguard; /* Number of shutdown guard timers that fired */ |
| 1251 |
uint32_t sctps_timostrmrst; /* Number of stream reset timers that fired */ |
| 1252 |
uint32_t sctps_timoearlyfr; /* Number of early FR timers that fired */ |
| 1253 |
uint32_t sctps_timoasconf; /* Number of times an asconf timer fired */ |
| 1254 |
uint32_t sctps_timodelprim; /* Number of times a prim_deleted timer fired */ |
| 1255 |
uint32_t sctps_timoautoclose; /* Number of times auto close timer fired */ |
| 1256 |
uint32_t sctps_timoassockill; /* Number of asoc free timers expired */ |
| 1257 |
uint32_t sctps_timoinpkill; /* Number of inp free timers expired */ |
| 1258 |
/* former early FR counters */ |
| 1259 |
uint32_t sctps_spare[11]; |
| 1260 |
/* others */ |
| 1261 |
uint32_t sctps_hdrops; /* packet shorter than header */ |
| 1262 |
uint32_t sctps_badsum; /* checksum error */ |
| 1263 |
uint32_t sctps_noport; /* no endpoint for port */ |
| 1264 |
uint32_t sctps_badvtag; /* bad v-tag */ |
| 1265 |
uint32_t sctps_badsid; /* bad SID */ |
| 1266 |
uint32_t sctps_nomem; /* no memory */ |
| 1267 |
uint32_t sctps_fastretransinrtt; /* number of multiple FR in a RTT window */ |
| 1268 |
uint32_t sctps_markedretrans; |
| 1269 |
uint32_t sctps_naglesent; /* nagle allowed sending */ |
| 1270 |
uint32_t sctps_naglequeued; /* nagle doesn't allow sending */ |
| 1271 |
uint32_t sctps_maxburstqueued; /* max burst doesn't allow sending */ |
| 1272 |
uint32_t sctps_ifnomemqueued; /* look ahead tells us no memory in |
| 1273 |
* interface ring buffer OR we had a |
| 1274 |
* send error and are queuing one send. |
| 1275 |
*/ |
| 1276 |
uint32_t sctps_windowprobed; /* total number of window probes sent */ |
| 1277 |
uint32_t sctps_lowlevelerr; /* total times an output error causes us |
| 1278 |
* to clamp down on next user send. |
| 1279 |
*/ |
| 1280 |
uint32_t sctps_lowlevelerrusr; /* total times sctp_senderrors were caused from |
| 1281 |
* a user send from a user invoked send not |
| 1282 |
* a sack response |
| 1283 |
*/ |
| 1284 |
uint32_t sctps_datadropchklmt; /* Number of in data drops due to chunk limit reached */ |
| 1285 |
uint32_t sctps_datadroprwnd; /* Number of in data drops due to rwnd limit reached */ |
| 1286 |
uint32_t sctps_ecnereducedcwnd; /* Number of times a ECN reduced the cwnd */ |
| 1287 |
uint32_t sctps_vtagexpress; /* Used express lookup via vtag */ |
| 1288 |
uint32_t sctps_vtagbogus; /* Collision in express lookup. */ |
| 1289 |
uint32_t sctps_primary_randry; /* Number of times the sender ran dry of user data on primary */ |
| 1290 |
uint32_t sctps_cmt_randry; /* Same for above */ |
| 1291 |
uint32_t sctps_slowpath_sack; /* Sacks the slow way */ |
| 1292 |
uint32_t sctps_wu_sacks_sent; /* Window Update only sacks sent */ |
| 1293 |
uint32_t sctps_sends_with_flags; /* number of sends with sinfo_flags !=0 */ |
| 1294 |
uint32_t sctps_sends_with_unord; /* number of unordered sends */ |
| 1295 |
uint32_t sctps_sends_with_eof; /* number of sends with EOF flag set */ |
| 1296 |
uint32_t sctps_sends_with_abort; /* number of sends with ABORT flag set */ |
| 1297 |
uint32_t sctps_protocol_drain_calls;/* number of times protocol drain called */ |
| 1298 |
uint32_t sctps_protocol_drains_done;/* number of times we did a protocol drain */ |
| 1299 |
uint32_t sctps_read_peeks; /* Number of times recv was called with peek */ |
| 1300 |
uint32_t sctps_cached_chk; /* Number of cached chunks used */ |
| 1301 |
uint32_t sctps_cached_strmoq; /* Number of cached stream oq's used */ |
| 1302 |
uint32_t sctps_left_abandon; /* Number of unread messages abandoned by close */ |
| 1303 |
uint32_t sctps_send_burst_avoid; /* Unused */ |
| 1304 |
uint32_t sctps_send_cwnd_avoid; /* Send cwnd full avoidance, already max burst inflight to net */ |
| 1305 |
uint32_t sctps_fwdtsn_map_over; /* number of map array over-runs via fwd-tsn's */ |
| 1306 |
uint32_t sctps_queue_upd_ecne; /* Number of times we queued or updated an ECN chunk on send queue */ |
| 1307 |
uint32_t sctps_reserved[31]; /* Future ABI compat - remove int's from here when adding new */ |
| 1308 |
}; |
| 1309 |
|
| 1310 |
void |
| 1311 |
usrsctp_get_stat(struct sctpstat *); |
| 1312 |
|
| 1313 |
#ifdef _WIN32 |
| 1314 |
#ifdef _MSC_VER |
| 1315 |
#pragma warning(default: 4200) |
| 1316 |
#endif |
| 1317 |
#endif |
| 1318 |
#ifdef __cplusplus |
| 1319 |
} |
| 1320 |
#endif |
| 1321 |
#endif |