sctp_structs.h (40700B)
1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 5 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 6 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are met: 10 * 11 * a) Redistributions of source code must retain the above copyright notice, 12 * this list of conditions and the following disclaimer. 13 * 14 * b) Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in 16 * the documentation and/or other materials provided with the distribution. 17 * 18 * c) Neither the name of Cisco Systems, Inc. nor the names of its 19 * contributors may be used to endorse or promote products derived 20 * from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 32 * THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34 35 #ifndef _NETINET_SCTP_STRUCTS_H_ 36 #define _NETINET_SCTP_STRUCTS_H_ 37 38 #include <netinet/sctp_os.h> 39 #include <netinet/sctp_header.h> 40 #include <netinet/sctp_auth.h> 41 42 struct sctp_timer { 43 sctp_os_timer_t timer; 44 45 int type; 46 /* 47 * Depending on the timer type these will be setup and cast with the 48 * appropriate entity. 49 */ 50 void *ep; 51 void *tcb; 52 void *net; 53 #if defined(__FreeBSD__) && !defined(__Userspace__) 54 void *vnet; 55 #endif 56 57 /* for sanity checking */ 58 void *self; 59 uint32_t ticks; 60 uint32_t stopped_from; 61 }; 62 63 struct sctp_foo_stuff { 64 struct sctp_inpcb *inp; 65 uint32_t lineno; 66 uint32_t ticks; 67 int updown; 68 }; 69 70 /* 71 * This is the information we track on each interface that we know about from 72 * the distant end. 73 */ 74 TAILQ_HEAD(sctpnetlisthead, sctp_nets); 75 76 struct sctp_stream_reset_list { 77 TAILQ_ENTRY(sctp_stream_reset_list) next_resp; 78 uint32_t seq; 79 uint32_t tsn; 80 uint32_t number_entries; 81 uint16_t list_of_streams[]; 82 }; 83 84 TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list); 85 86 /* 87 * Users of the iterator need to malloc a iterator with a call to 88 * sctp_initiate_iterator(inp_func, assoc_func, inp_func, pcb_flags, pcb_features, 89 * asoc_state, void-ptr-arg, uint32-arg, end_func, inp); 90 * 91 * Use the following two defines if you don't care what pcb flags are on the EP 92 * and/or you don't care what state the association is in. 93 * 94 * Note that if you specify an INP as the last argument then ONLY each 95 * association of that single INP will be executed upon. Note that the pcb 96 * flags STILL apply so if the inp you specify has different pcb_flags then 97 * what you put in pcb_flags nothing will happen. use SCTP_PCB_ANY_FLAGS to 98 * assure the inp you specify gets treated. 99 */ 100 #define SCTP_PCB_ANY_FLAGS 0x00000000 101 #define SCTP_PCB_ANY_FEATURES 0x00000000 102 #define SCTP_ASOC_ANY_STATE 0x00000000 103 104 typedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr, 105 uint32_t val); 106 typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val); 107 typedef void (*end_func) (void *ptr, uint32_t val); 108 109 #if defined(__FreeBSD__) && !defined(__Userspace__) 110 #if defined(SCTP_MCORE_INPUT) && defined(SMP) 111 /* whats on the mcore control struct */ 112 struct sctp_mcore_queue { 113 TAILQ_ENTRY(sctp_mcore_queue) next; 114 struct vnet *vn; 115 struct mbuf *m; 116 int off; 117 int v6; 118 }; 119 120 TAILQ_HEAD(sctp_mcore_qhead, sctp_mcore_queue); 121 122 struct sctp_mcore_ctrl { 123 SCTP_PROCESS_STRUCT thread_proc; 124 struct sctp_mcore_qhead que; 125 struct mtx core_mtx; 126 struct mtx que_mtx; 127 int running; 128 int cpuid; 129 }; 130 #endif 131 #endif 132 133 /* This struct is here to cut out the compatiabilty 134 * pad that bulks up both the inp and stcb. The non 135 * pad portion MUST stay in complete sync with 136 * sctp_sndrcvinfo... i.e. if sinfo_xxxx is added 137 * this must be done here too. 138 */ 139 struct sctp_nonpad_sndrcvinfo { 140 uint16_t sinfo_stream; 141 uint16_t sinfo_ssn; 142 uint16_t sinfo_flags; 143 uint32_t sinfo_ppid; 144 uint32_t sinfo_context; 145 uint32_t sinfo_timetolive; 146 uint32_t sinfo_tsn; 147 uint32_t sinfo_cumtsn; 148 sctp_assoc_t sinfo_assoc_id; 149 uint16_t sinfo_keynumber; 150 uint16_t sinfo_keynumber_valid; 151 }; 152 153 struct sctp_iterator { 154 TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr; 155 #if defined(__FreeBSD__) && !defined(__Userspace__) 156 struct vnet *vn; 157 #endif 158 struct sctp_timer tmr; 159 struct sctp_inpcb *inp; /* current endpoint */ 160 struct sctp_tcb *stcb; /* current* assoc */ 161 struct sctp_inpcb *next_inp; /* special hook to skip to */ 162 asoc_func function_assoc; /* per assoc function */ 163 inp_func function_inp; /* per endpoint function */ 164 inp_func function_inp_end; /* end INP function */ 165 end_func function_atend; /* iterator completion function */ 166 void *pointer; /* pointer for apply func to use */ 167 uint32_t val; /* value for apply func to use */ 168 uint32_t pcb_flags; /* endpoint flags being checked */ 169 uint32_t pcb_features; /* endpoint features being checked */ 170 uint32_t asoc_state; /* assoc state being checked */ 171 uint32_t iterator_flags; 172 uint8_t no_chunk_output; 173 uint8_t done_current_ep; 174 }; 175 /* iterator_flags values */ 176 #define SCTP_ITERATOR_DO_ALL_INP 0x00000001 177 #define SCTP_ITERATOR_DO_SINGLE_INP 0x00000002 178 179 TAILQ_HEAD(sctpiterators, sctp_iterator); 180 181 struct sctp_copy_all { 182 struct sctp_inpcb *inp; /* ep */ 183 struct mbuf *m; 184 struct sctp_nonpad_sndrcvinfo sndrcv; 185 ssize_t sndlen; 186 int cnt_sent; 187 int cnt_failed; 188 }; 189 190 struct sctp_asconf_iterator { 191 struct sctpladdr list_of_work; 192 int cnt; 193 }; 194 195 struct iterator_control { 196 #if defined(__FreeBSD__) && !defined(__Userspace__) 197 struct mtx ipi_iterator_wq_mtx; 198 struct mtx it_mtx; 199 #elif defined(__APPLE__) && !defined(__Userspace__) 200 lck_mtx_t *ipi_iterator_wq_mtx; 201 lck_mtx_t *it_mtx; 202 #elif defined(SCTP_PROCESS_LEVEL_LOCKS) 203 #if defined(__Userspace__) 204 userland_mutex_t ipi_iterator_wq_mtx; 205 userland_mutex_t it_mtx; 206 userland_cond_t iterator_wakeup; 207 #else 208 pthread_mutex_t ipi_iterator_wq_mtx; 209 pthread_mutex_t it_mtx; 210 pthread_cond_t iterator_wakeup; 211 #endif 212 #elif defined(_WIN32) && !defined(__Userspace__) 213 struct spinlock it_lock; 214 struct spinlock ipi_iterator_wq_lock; 215 KEVENT iterator_wakeup[2]; 216 PFILE_OBJECT iterator_thread_obj; 217 #else 218 void *it_mtx; 219 #endif 220 #if !(defined(_WIN32) && !defined(__Userspace__)) 221 #if !defined(__Userspace__) 222 SCTP_PROCESS_STRUCT thread_proc; 223 #else 224 userland_thread_t thread_proc; 225 #endif 226 #endif 227 struct sctpiterators iteratorhead; 228 struct sctp_iterator *cur_it; 229 uint32_t iterator_running; 230 uint32_t iterator_flags; 231 }; 232 #if !(defined(__FreeBSD__) && !defined(__Userspace__)) 233 #define SCTP_ITERATOR_MUST_EXIT 0x00000001 234 #define SCTP_ITERATOR_EXITED 0x00000002 235 #endif 236 #define SCTP_ITERATOR_STOP_CUR_IT 0x00000004 237 #define SCTP_ITERATOR_STOP_CUR_INP 0x00000008 238 239 struct sctp_net_route { 240 #if defined(__FreeBSD__) && !defined(__Userspace__) 241 struct nhop_object *ro_nh; 242 struct llentry *ro_lle; 243 char *ro_prepend; 244 uint16_t ro_plen; 245 uint16_t ro_flags; 246 uint16_t ro_mtu; 247 uint16_t spare; 248 #else 249 sctp_rtentry_t *ro_rt; 250 #endif 251 #if defined(__APPLE__) && !defined(__Userspace__) 252 #if !defined(APPLE_LEOPARD) && !defined(APPLE_SNOWLEOPARD) && !defined(APPLE_LION) && !defined(APPLE_MOUNTAINLION) && !defined(APPLE_ELCAPITAN) 253 struct llentry *ro_lle; 254 #endif 255 #if !defined(APPLE_LEOPARD) && !defined(APPLE_SNOWLEOPARD) && !defined(APPLE_LION) && !defined(APPLE_MOUNTAINLION) 256 struct ifaddr *ro_srcia; 257 #endif 258 #if !defined(APPLE_LEOPARD) 259 uint32_t ro_flags; 260 #endif 261 #endif 262 union sctp_sockstore _l_addr; /* remote peer addr */ 263 struct sctp_ifa *_s_addr; /* our selected src addr */ 264 }; 265 266 struct htcp { 267 uint16_t alpha; /* Fixed point arith, << 7 */ 268 uint8_t beta; /* Fixed point arith, << 7 */ 269 uint8_t modeswitch; /* Delay modeswitch until we had at least one congestion event */ 270 uint32_t last_cong; /* Time since last congestion event end */ 271 uint32_t undo_last_cong; 272 uint16_t bytes_acked; 273 uint32_t bytecount; 274 uint32_t minRTT; 275 uint32_t maxRTT; 276 277 uint32_t undo_maxRTT; 278 uint32_t undo_old_maxB; 279 280 /* Bandwidth estimation */ 281 uint32_t minB; 282 uint32_t maxB; 283 uint32_t old_maxB; 284 uint32_t Bi; 285 uint32_t lasttime; 286 }; 287 288 struct rtcc_cc { 289 struct timeval tls; /* The time we started the sending */ 290 uint64_t lbw; /* Our last estimated bw */ 291 uint64_t lbw_rtt; /* RTT at bw estimate */ 292 uint64_t bw_bytes; /* The total bytes since this sending began */ 293 uint64_t bw_tot_time; /* The total time since sending began */ 294 uint64_t new_tot_time; /* temp holding the new value */ 295 uint64_t bw_bytes_at_last_rttc; /* What bw_bytes was at last rtt calc */ 296 uint32_t cwnd_at_bw_set; /* Cwnd at last bw saved - lbw */ 297 uint32_t vol_reduce; /* cnt of voluntary reductions */ 298 uint16_t steady_step; /* The number required to be in steady state*/ 299 uint16_t step_cnt; /* The current number */ 300 uint8_t ret_from_eq; /* When all things are equal what do I return 0/1 - 1 no cc advance */ 301 uint8_t use_dccc_ecn; /* Flag to enable DCCC ECN */ 302 uint8_t tls_needs_set; /* Flag to indicate we need to set tls 0 or 1 means set at send 2 not */ 303 uint8_t last_step_state; /* Last state if steady state stepdown is on */ 304 uint8_t rtt_set_this_sack; /* Flag saying this sack had RTT calc on it */ 305 uint8_t last_inst_ind; /* Last saved inst indication */ 306 }; 307 308 struct sctp_nets { 309 TAILQ_ENTRY(sctp_nets) sctp_next; /* next link */ 310 311 /* 312 * Things on the top half may be able to be split into a common 313 * structure shared by all. 314 */ 315 struct sctp_timer pmtu_timer; 316 struct sctp_timer hb_timer; 317 318 /* 319 * The following two in combination equate to a route entry for v6 320 * or v4. 321 */ 322 struct sctp_net_route ro; 323 324 /* mtu discovered so far */ 325 uint32_t mtu; 326 uint32_t ssthresh; /* not sure about this one for split */ 327 uint32_t last_cwr_tsn; 328 uint32_t cwr_window_tsn; 329 uint32_t ecn_ce_pkt_cnt; 330 uint32_t lost_cnt; 331 /* smoothed average things for RTT and RTO itself */ 332 int lastsa; 333 int lastsv; 334 uint64_t rtt; /* last measured rtt value in us */ 335 uint32_t RTO; 336 337 /* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */ 338 struct sctp_timer rxt_timer; 339 340 /* last time in seconds I sent to it */ 341 struct timeval last_sent_time; 342 union cc_control_data { 343 struct htcp htcp_ca; /* JRS - struct used in HTCP algorithm */ 344 struct rtcc_cc rtcc; /* rtcc module cc stuff */ 345 } cc_mod; 346 int ref_count; 347 348 /* Congestion stats per destination */ 349 /* 350 * flight size variables and such, sorry Vern, I could not avoid 351 * this if I wanted performance :> 352 */ 353 uint32_t flight_size; 354 uint32_t cwnd; /* actual cwnd */ 355 uint32_t prev_cwnd; /* cwnd before any processing */ 356 uint32_t ecn_prev_cwnd; /* ECN prev cwnd at first ecn_echo seen in new window */ 357 uint32_t partial_bytes_acked; /* in CA tracks when to incr a MTU */ 358 /* tracking variables to avoid the aloc/free in sack processing */ 359 unsigned int net_ack; 360 unsigned int net_ack2; 361 362 /* 363 * JRS - 5/8/07 - Variable to track last time 364 * a destination was active for CMT PF 365 */ 366 uint32_t last_active; 367 368 /* 369 * CMT variables (iyengar@cis.udel.edu) 370 */ 371 uint32_t this_sack_highest_newack; /* tracks highest TSN newly 372 * acked for a given dest in 373 * the current SACK. Used in 374 * SFR and HTNA algos */ 375 uint32_t pseudo_cumack; /* CMT CUC algorithm. Maintains next expected 376 * pseudo-cumack for this destination */ 377 uint32_t rtx_pseudo_cumack; /* CMT CUC algorithm. Maintains next 378 * expected pseudo-cumack for this 379 * destination */ 380 381 /* CMT fast recovery variables */ 382 uint32_t fast_recovery_tsn; 383 uint32_t heartbeat_random1; 384 uint32_t heartbeat_random2; 385 #ifdef INET6 386 uint32_t flowlabel; 387 #endif 388 uint8_t dscp; 389 390 struct timeval start_time; /* time when this net was created */ 391 uint32_t marked_retrans; /* number or DATA chunks marked for 392 timer based retransmissions */ 393 uint32_t marked_fastretrans; 394 uint32_t heart_beat_delay; /* Heart Beat delay in ms */ 395 396 /* if this guy is ok or not ... status */ 397 uint16_t dest_state; 398 /* number of timeouts to consider the destination unreachable */ 399 uint16_t failure_threshold; 400 /* number of timeouts to consider the destination potentially failed */ 401 uint16_t pf_threshold; 402 /* error stats on the destination */ 403 uint16_t error_count; 404 /* UDP port number in case of UDP tunneling */ 405 uint16_t port; 406 407 uint8_t fast_retran_loss_recovery; 408 uint8_t will_exit_fast_recovery; 409 /* Flags that probably can be combined into dest_state */ 410 uint8_t fast_retran_ip; /* fast retransmit in progress */ 411 uint8_t hb_responded; 412 uint8_t saw_newack; /* CMT's SFR algorithm flag */ 413 uint8_t src_addr_selected; /* if we split we move */ 414 uint8_t indx_of_eligible_next_to_use; 415 uint8_t addr_is_local; /* its a local address (if known) could move 416 * in split */ 417 418 /* 419 * CMT variables (iyengar@cis.udel.edu) 420 */ 421 uint8_t find_pseudo_cumack; /* CMT CUC algorithm. Flag used to 422 * find a new pseudocumack. This flag 423 * is set after a new pseudo-cumack 424 * has been received and indicates 425 * that the sender should find the 426 * next pseudo-cumack expected for 427 * this destination */ 428 uint8_t find_rtx_pseudo_cumack; /* CMT CUCv2 algorithm. Flag used to 429 * find a new rtx-pseudocumack. This 430 * flag is set after a new 431 * rtx-pseudo-cumack has been received 432 * and indicates that the sender 433 * should find the next 434 * rtx-pseudo-cumack expected for this 435 * destination */ 436 uint8_t new_pseudo_cumack; /* CMT CUC algorithm. Flag used to 437 * indicate if a new pseudo-cumack or 438 * rtx-pseudo-cumack has been received */ 439 uint8_t window_probe; /* Doing a window probe? */ 440 uint8_t RTO_measured; /* Have we done the first measure */ 441 uint8_t last_hs_used; /* index into the last HS table entry we used */ 442 uint8_t lan_type; 443 uint8_t rto_needed; 444 #if defined(__FreeBSD__) && !defined(__Userspace__) 445 uint32_t flowid; 446 uint8_t flowtype; 447 #endif 448 }; 449 450 struct sctp_data_chunkrec { 451 uint32_t tsn; /* the TSN of this transmit */ 452 uint32_t mid; /* the message identifier of this transmit */ 453 uint16_t sid; /* the stream number of this guy */ 454 uint32_t ppid; 455 uint32_t context; /* from send */ 456 uint32_t cwnd_at_send; 457 /* 458 * part of the Highest sacked algorithm to be able to stroke counts 459 * on ones that are FR'd. 460 */ 461 uint32_t fast_retran_tsn; /* sending_seq at the time of FR */ 462 struct timeval timetodrop; /* time we drop it from queue */ 463 uint32_t fsn; /* Fragment Sequence Number */ 464 uint8_t doing_fast_retransmit; 465 uint8_t rcv_flags; /* flags pulled from data chunk on inbound for 466 * outbound holds sending flags for PR-SCTP. 467 */ 468 uint8_t state_flags; 469 uint8_t chunk_was_revoked; 470 uint8_t fwd_tsn_cnt; 471 }; 472 473 TAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk); 474 475 /* The lower byte is used to enumerate PR_SCTP policies */ 476 #define CHUNK_FLAGS_PR_SCTP_TTL SCTP_PR_SCTP_TTL 477 #define CHUNK_FLAGS_PR_SCTP_BUF SCTP_PR_SCTP_BUF 478 #define CHUNK_FLAGS_PR_SCTP_RTX SCTP_PR_SCTP_RTX 479 480 /* The upper byte is used as a bit mask */ 481 #define CHUNK_FLAGS_FRAGMENT_OK 0x0100 482 483 struct chk_id { 484 uint8_t id; 485 uint8_t can_take_data; 486 }; 487 488 struct sctp_tmit_chunk { 489 union { 490 struct sctp_data_chunkrec data; 491 struct chk_id chunk_id; 492 } rec; 493 struct sctp_association *asoc; /* bp to asoc this belongs to */ 494 struct timeval sent_rcv_time; /* filled in if RTT being calculated */ 495 struct mbuf *data; /* pointer to mbuf chain of data */ 496 struct mbuf *last_mbuf; /* pointer to last mbuf in chain */ 497 struct sctp_nets *whoTo; 498 TAILQ_ENTRY(sctp_tmit_chunk) sctp_next; /* next link */ 499 int32_t sent; /* the send status */ 500 uint16_t snd_count; /* number of times I sent */ 501 uint16_t flags; /* flags, such as FRAGMENT_OK */ 502 uint16_t send_size; 503 uint16_t book_size; 504 uint16_t mbcnt; 505 uint16_t auth_keyid; 506 uint8_t holds_key_ref; /* flag if auth keyid refcount is held */ 507 uint8_t pad_inplace; 508 uint8_t do_rtt; 509 uint8_t book_size_scale; 510 uint8_t no_fr_allowed; 511 uint8_t copy_by_ref; 512 uint8_t window_probe; 513 }; 514 515 struct sctp_queued_to_read { /* sinfo structure Pluse more */ 516 uint16_t sinfo_stream; /* off the wire */ 517 uint16_t sinfo_flags; /* SCTP_UNORDERED from wire use SCTP_EOF for 518 * EOR */ 519 uint32_t sinfo_ppid; /* off the wire */ 520 uint32_t sinfo_context; /* pick this up from assoc def context? */ 521 uint32_t sinfo_timetolive; /* not used by kernel */ 522 uint32_t sinfo_tsn; /* Use this in reassembly as first TSN */ 523 uint32_t sinfo_cumtsn; /* Use this in reassembly as last TSN */ 524 sctp_assoc_t sinfo_assoc_id; /* our assoc id */ 525 /* Non sinfo stuff */ 526 uint32_t mid; /* Fragment Index */ 527 uint32_t length; /* length of data */ 528 uint32_t held_length; /* length held in sb */ 529 uint32_t top_fsn; /* Highest FSN in queue */ 530 uint32_t fsn_included; /* Highest FSN in *data portion */ 531 struct sctp_nets *whoFrom; /* where it came from */ 532 struct mbuf *data; /* front of the mbuf chain of data with 533 * PKT_HDR */ 534 struct mbuf *tail_mbuf; /* used for multi-part data */ 535 struct mbuf *aux_data; /* used to hold/cache control if o/s does not take it from us */ 536 struct sctp_tcb *stcb; /* assoc, used for window update */ 537 TAILQ_ENTRY(sctp_queued_to_read) next; 538 TAILQ_ENTRY(sctp_queued_to_read) next_instrm; 539 struct sctpchunk_listhead reasm; 540 uint16_t port_from; 541 uint16_t spec_flags; /* Flags to hold the notification field */ 542 uint8_t do_not_ref_stcb; 543 uint8_t end_added; 544 uint8_t pdapi_aborted; 545 uint8_t pdapi_started; 546 uint8_t some_taken; 547 uint8_t last_frag_seen; 548 uint8_t first_frag_seen; 549 uint8_t on_read_q; 550 uint8_t on_strm_q; 551 }; 552 553 #define SCTP_ON_ORDERED 1 554 #define SCTP_ON_UNORDERED 2 555 556 /* This data structure will be on the outbound 557 * stream queues. Data will be pulled off from 558 * the front of the mbuf data and chunk-ified 559 * by the output routines. We will custom 560 * fit every chunk we pull to the send/sent 561 * queue to make up the next full packet 562 * if we can. An entry cannot be removed 563 * from the stream_out queue until 564 * the msg_is_complete flag is set. This 565 * means at times data/tail_mbuf MIGHT 566 * be NULL.. If that occurs it happens 567 * for one of two reasons. Either the user 568 * is blocked on a send() call and has not 569 * awoken to copy more data down... OR 570 * the user is in the explict MSG_EOR mode 571 * and wrote some data, but has not completed 572 * sending. 573 * ss_next and scheduled are only used by the FCFS stream scheduler. 574 */ 575 struct sctp_stream_queue_pending { 576 struct mbuf *data; 577 struct mbuf *tail_mbuf; 578 struct timeval ts; 579 struct sctp_nets *net; 580 TAILQ_ENTRY (sctp_stream_queue_pending) next; 581 TAILQ_ENTRY (sctp_stream_queue_pending) ss_next; 582 uint32_t fsn; 583 uint32_t length; 584 uint32_t timetolive; 585 uint32_t ppid; 586 uint32_t context; 587 uint16_t sinfo_flags; 588 uint16_t sid; 589 uint16_t act_flags; 590 uint16_t auth_keyid; 591 uint8_t holds_key_ref; 592 uint8_t msg_is_complete; 593 uint8_t some_taken; 594 uint8_t sender_all_done; 595 uint8_t put_last_out; 596 uint8_t discard_rest; 597 uint8_t processing; 598 bool scheduled; 599 }; 600 601 /* 602 * this struct contains info that is used to track inbound stream data and 603 * help with ordering. 604 */ 605 TAILQ_HEAD(sctpwheelunrel_listhead, sctp_stream_in); 606 struct sctp_stream_in { 607 struct sctp_readhead inqueue; 608 struct sctp_readhead uno_inqueue; 609 uint32_t last_mid_delivered; /* used for re-order */ 610 uint16_t sid; 611 uint8_t delivery_started; 612 uint8_t pd_api_started; 613 }; 614 615 TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out); 616 TAILQ_HEAD(sctplist_listhead, sctp_stream_queue_pending); 617 618 /* 619 * This union holds all data necessary for 620 * different stream schedulers. 621 */ 622 struct scheduling_data { 623 struct sctp_stream_out *locked_on_sending; 624 /* circular looking for output selection */ 625 struct sctp_stream_out *last_out_stream; 626 union { 627 struct sctpwheel_listhead wheel; 628 struct sctplist_listhead list; 629 } out; 630 }; 631 632 /* Round-robin schedulers */ 633 struct ss_rr { 634 /* next link in wheel */ 635 TAILQ_ENTRY(sctp_stream_out) next_spoke; 636 }; 637 638 /* Priority scheduler */ 639 struct ss_prio { 640 /* next link in wheel */ 641 TAILQ_ENTRY(sctp_stream_out) next_spoke; 642 /* priority id */ 643 uint16_t priority; 644 }; 645 646 /* Fair Bandwidth scheduler */ 647 struct ss_fb { 648 /* next link in wheel */ 649 TAILQ_ENTRY(sctp_stream_out) next_spoke; 650 /* stores message size */ 651 int32_t rounds; 652 }; 653 654 /* 655 * This union holds all parameters per stream 656 * necessary for different stream schedulers. 657 */ 658 struct scheduling_parameters { 659 union { 660 struct ss_rr rr; 661 struct ss_prio prio; 662 struct ss_fb fb; 663 } ss; 664 bool scheduled; 665 }; 666 667 /* States for outgoing streams */ 668 #define SCTP_STREAM_CLOSED 0x00 669 #define SCTP_STREAM_OPENING 0x01 670 #define SCTP_STREAM_OPEN 0x02 671 #define SCTP_STREAM_RESET_PENDING 0x03 672 #define SCTP_STREAM_RESET_IN_FLIGHT 0x04 673 674 /* This struct is used to track the traffic on outbound streams */ 675 struct sctp_stream_out { 676 struct sctp_streamhead outqueue; 677 struct scheduling_parameters ss_params; 678 uint32_t chunks_on_queues; /* send queue and sent queue */ 679 #if defined(SCTP_DETAILED_STR_STATS) 680 uint32_t abandoned_unsent[SCTP_PR_SCTP_MAX + 1]; 681 uint32_t abandoned_sent[SCTP_PR_SCTP_MAX + 1]; 682 #else 683 /* Only the aggregation */ 684 uint32_t abandoned_unsent[1]; 685 uint32_t abandoned_sent[1]; 686 #endif 687 /* For associations using DATA chunks, the lower 16-bit of 688 * next_mid_ordered are used as the next SSN. 689 */ 690 uint32_t next_mid_ordered; 691 uint32_t next_mid_unordered; 692 uint16_t sid; 693 uint8_t last_msg_incomplete; 694 uint8_t state; 695 }; 696 697 #define SCTP_MAX_STREAMS_AT_ONCE_RESET 200 698 699 /* used to keep track of the addresses yet to try to add/delete */ 700 TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr); 701 struct sctp_asconf_addr { 702 TAILQ_ENTRY(sctp_asconf_addr) next; 703 struct sctp_asconf_addr_param ap; 704 struct sctp_ifa *ifa; /* save the ifa for add/del ip */ 705 uint8_t sent; /* has this been sent yet? */ 706 uint8_t special_del; /* not to be used in lookup */ 707 }; 708 709 struct sctp_scoping { 710 uint8_t ipv4_addr_legal; 711 uint8_t ipv6_addr_legal; 712 #if defined(__Userspace__) 713 uint8_t conn_addr_legal; 714 #endif 715 uint8_t loopback_scope; 716 uint8_t ipv4_local_scope; 717 uint8_t local_scope; 718 uint8_t site_scope; 719 }; 720 721 #define SCTP_TSN_LOG_SIZE 40 722 723 struct sctp_tsn_log { 724 void *stcb; 725 uint32_t tsn; 726 uint32_t seq; 727 uint16_t strm; 728 uint16_t sz; 729 uint16_t flgs; 730 uint16_t in_pos; 731 uint16_t in_out; 732 uint16_t resv; 733 }; 734 735 #define SCTP_FS_SPEC_LOG_SIZE 200 736 struct sctp_fs_spec_log { 737 uint32_t sent; 738 uint32_t total_flight; 739 uint32_t tsn; 740 uint16_t book; 741 uint8_t incr; 742 uint8_t decr; 743 }; 744 745 /* 746 * JRS - Structure to hold function pointers to the functions responsible 747 * for congestion control. 748 */ 749 750 struct sctp_cc_functions { 751 void (*sctp_set_initial_cc_param)(struct sctp_tcb *stcb, struct sctp_nets *net); 752 void (*sctp_cwnd_update_after_sack)(struct sctp_tcb *stcb, 753 struct sctp_association *asoc, 754 int accum_moved ,int reneged_all, int will_exit); 755 void (*sctp_cwnd_update_exit_pf)(struct sctp_tcb *stcb, struct sctp_nets *net); 756 void (*sctp_cwnd_update_after_fr)(struct sctp_tcb *stcb, 757 struct sctp_association *asoc); 758 void (*sctp_cwnd_update_after_timeout)(struct sctp_tcb *stcb, 759 struct sctp_nets *net); 760 void (*sctp_cwnd_update_after_ecn_echo)(struct sctp_tcb *stcb, 761 struct sctp_nets *net, int in_window, int num_pkt_lost); 762 void (*sctp_cwnd_update_after_packet_dropped)(struct sctp_tcb *stcb, 763 struct sctp_nets *net, struct sctp_pktdrop_chunk *cp, 764 uint32_t *bottle_bw, uint32_t *on_queue); 765 void (*sctp_cwnd_update_after_output)(struct sctp_tcb *stcb, 766 struct sctp_nets *net, int burst_limit); 767 void (*sctp_cwnd_update_packet_transmitted)(struct sctp_tcb *stcb, 768 struct sctp_nets *net); 769 void (*sctp_cwnd_update_tsn_acknowledged)(struct sctp_nets *net, 770 struct sctp_tmit_chunk *); 771 void (*sctp_cwnd_new_transmission_begins)(struct sctp_tcb *stcb, 772 struct sctp_nets *net); 773 void (*sctp_cwnd_prepare_net_for_sack)(struct sctp_tcb *stcb, 774 struct sctp_nets *net); 775 int (*sctp_cwnd_socket_option)(struct sctp_tcb *stcb, int set, struct sctp_cc_option *); 776 void (*sctp_rtt_calculated)(struct sctp_tcb *, struct sctp_nets *, struct timeval *); 777 }; 778 779 /* 780 * RS - Structure to hold function pointers to the functions responsible 781 * for stream scheduling. 782 */ 783 struct sctp_ss_functions { 784 void (*sctp_ss_init)(struct sctp_tcb *stcb, struct sctp_association *asoc); 785 void (*sctp_ss_clear)(struct sctp_tcb *stcb, struct sctp_association *asoc, 786 bool clear_values); 787 void (*sctp_ss_init_stream)(struct sctp_tcb *stcb, struct sctp_stream_out *strq, struct sctp_stream_out *with_strq); 788 void (*sctp_ss_add_to_stream)(struct sctp_tcb *stcb, struct sctp_association *asoc, 789 struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp); 790 bool (*sctp_ss_is_empty)(struct sctp_tcb *stcb, struct sctp_association *asoc); 791 void (*sctp_ss_remove_from_stream)(struct sctp_tcb *stcb, struct sctp_association *asoc, 792 struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp); 793 struct sctp_stream_out* (*sctp_ss_select_stream)(struct sctp_tcb *stcb, 794 struct sctp_nets *net, struct sctp_association *asoc); 795 void (*sctp_ss_scheduled)(struct sctp_tcb *stcb, struct sctp_nets *net, 796 struct sctp_association *asoc, struct sctp_stream_out *strq, int moved_how_much); 797 void (*sctp_ss_packet_done)(struct sctp_tcb *stcb, struct sctp_nets *net, 798 struct sctp_association *asoc); 799 int (*sctp_ss_get_value)(struct sctp_tcb *stcb, struct sctp_association *asoc, 800 struct sctp_stream_out *strq, uint16_t *value); 801 int (*sctp_ss_set_value)(struct sctp_tcb *stcb, struct sctp_association *asoc, 802 struct sctp_stream_out *strq, uint16_t value); 803 bool (*sctp_ss_is_user_msgs_incomplete)(struct sctp_tcb *stcb, struct sctp_association *asoc); 804 }; 805 806 /* used to save ASCONF chunks for retransmission */ 807 TAILQ_HEAD(sctp_asconf_head, sctp_asconf); 808 struct sctp_asconf { 809 TAILQ_ENTRY(sctp_asconf) next; 810 uint32_t serial_number; 811 uint16_t snd_count; 812 struct mbuf *data; 813 uint16_t len; 814 }; 815 816 /* used to save ASCONF-ACK chunks for retransmission */ 817 TAILQ_HEAD(sctp_asconf_ackhead, sctp_asconf_ack); 818 struct sctp_asconf_ack { 819 TAILQ_ENTRY(sctp_asconf_ack) next; 820 uint32_t serial_number; 821 struct sctp_nets *last_sent_to; 822 struct mbuf *data; 823 uint16_t len; 824 }; 825 826 /* 827 * Here we have information about each individual association that we track. 828 * We probably in production would be more dynamic. But for ease of 829 * implementation we will have a fixed array that we hunt for in a linear 830 * fashion. 831 */ 832 struct sctp_association { 833 /* association state */ 834 int state; 835 836 /* queue of pending addrs to add/delete */ 837 struct sctp_asconf_addrhead asconf_queue; 838 839 struct timeval time_entered; /* time we entered state */ 840 struct timeval time_last_rcvd; 841 struct timeval time_last_sent; 842 struct timeval time_last_sat_advance; 843 struct sctp_nonpad_sndrcvinfo def_send; 844 845 /* timers and such */ 846 struct sctp_timer dack_timer; /* Delayed ack timer */ 847 struct sctp_timer asconf_timer; /* asconf */ 848 struct sctp_timer strreset_timer; /* stream reset */ 849 struct sctp_timer shut_guard_timer; /* shutdown guard */ 850 struct sctp_timer autoclose_timer; /* automatic close timer */ 851 struct sctp_timer delete_prim_timer; /* deleting primary dst */ 852 853 /* list of restricted local addresses */ 854 struct sctpladdr sctp_restricted_addrs; 855 856 /* last local address pending deletion (waiting for an address add) */ 857 struct sctp_ifa *asconf_addr_del_pending; 858 /* Deleted primary destination (used to stop timer) */ 859 struct sctp_nets *deleted_primary; 860 861 struct sctpnetlisthead nets; /* remote address list */ 862 863 /* Free chunk list */ 864 struct sctpchunk_listhead free_chunks; 865 866 /* Control chunk queue */ 867 struct sctpchunk_listhead control_send_queue; 868 869 /* ASCONF chunk queue */ 870 struct sctpchunk_listhead asconf_send_queue; 871 872 /* 873 * Once a TSN hits the wire it is moved to the sent_queue. We 874 * maintain two counts here (don't know if any but retran_cnt is 875 * needed). The idea is that the sent_queue_retran_cnt reflects how 876 * many chunks have been marked for retranmission by either T3-rxt 877 * or FR. 878 */ 879 struct sctpchunk_listhead sent_queue; 880 struct sctpchunk_listhead send_queue; 881 882 /* Scheduling queues */ 883 struct scheduling_data ss_data; 884 885 /* If an iterator is looking at me, this is it */ 886 struct sctp_iterator *stcb_starting_point_for_iterator; 887 888 /* ASCONF save the last ASCONF-ACK so we can resend it if necessary */ 889 struct sctp_asconf_ackhead asconf_ack_sent; 890 891 /* 892 * pointer to last stream reset queued to control queue by us with 893 * requests. 894 */ 895 struct sctp_tmit_chunk *str_reset; 896 /* 897 * if Source Address Selection happening, this will rotate through 898 * the link list. 899 */ 900 struct sctp_laddr *last_used_address; 901 902 /* stream arrays */ 903 struct sctp_stream_in *strmin; 904 struct sctp_stream_out *strmout; 905 uint8_t *mapping_array; 906 /* primary destination to use */ 907 struct sctp_nets *primary_destination; 908 struct sctp_nets *alternate; /* If primary is down or PF */ 909 /* For CMT */ 910 struct sctp_nets *last_net_cmt_send_started; 911 /* last place I got a data chunk from */ 912 struct sctp_nets *last_data_chunk_from; 913 /* last place I got a control from */ 914 struct sctp_nets *last_control_chunk_from; 915 916 /* 917 * wait to the point the cum-ack passes req->send_reset_at_tsn for 918 * any req on the list. 919 */ 920 struct sctp_resethead resetHead; 921 922 /* queue of chunks waiting to be sent into the local stack */ 923 struct sctp_readhead pending_reply_queue; 924 925 /* JRS - the congestion control functions are in this struct */ 926 struct sctp_cc_functions cc_functions; 927 /* JRS - value to store the currently loaded congestion control module */ 928 uint32_t congestion_control_module; 929 /* RS - the stream scheduling functions are in this struct */ 930 struct sctp_ss_functions ss_functions; 931 /* RS - value to store the currently loaded stream scheduling module */ 932 uint32_t stream_scheduling_module; 933 934 uint32_t vrf_id; 935 uint32_t cookie_preserve_req; 936 /* ASCONF next seq I am sending out, inits at init-tsn */ 937 uint32_t asconf_seq_out; 938 uint32_t asconf_seq_out_acked; 939 /* ASCONF last received ASCONF from peer, starts at peer's TSN-1 */ 940 uint32_t asconf_seq_in; 941 942 /* next seq I am sending in str reset messages */ 943 uint32_t str_reset_seq_out; 944 /* next seq I am expecting in str reset messages */ 945 uint32_t str_reset_seq_in; 946 947 /* various verification tag information */ 948 uint32_t my_vtag; /* The tag to be used. if assoc is re-initited 949 * by remote end, and I have unlocked this 950 * will be regenerated to a new random value. */ 951 uint32_t peer_vtag; /* The peers last tag */ 952 953 uint32_t my_vtag_nonce; 954 uint32_t peer_vtag_nonce; 955 956 uint32_t assoc_id; 957 958 /* This is the SCTP fragmentation threshold */ 959 uint32_t smallest_mtu; 960 961 /* 962 * Special hook for Fast retransmit, allows us to track the highest 963 * TSN that is NEW in this SACK if gap ack blocks are present. 964 */ 965 uint32_t this_sack_highest_gap; 966 967 /* 968 * The highest consecutive TSN that has been acked by peer on my 969 * sends 970 */ 971 uint32_t last_acked_seq; 972 973 /* The next TSN that I will use in sending. */ 974 uint32_t sending_seq; 975 976 /* Original seq number I used ??questionable to keep?? */ 977 uint32_t init_seq_number; 978 979 /* The Advanced Peer Ack Point, as required by the PR-SCTP */ 980 /* (A1 in Section 4.2) */ 981 uint32_t advanced_peer_ack_point; 982 983 /* 984 * The highest consequetive TSN at the bottom of the mapping array 985 * (for his sends). 986 */ 987 uint32_t cumulative_tsn; 988 /* 989 * Used to track the mapping array and its offset bits. This MAY be 990 * lower then cumulative_tsn. 991 */ 992 uint32_t mapping_array_base_tsn; 993 /* 994 * used to track highest TSN we have received and is listed in the 995 * mapping array. 996 */ 997 uint32_t highest_tsn_inside_map; 998 999 /* EY - new NR variables used for nr_sack based on mapping_array*/ 1000 uint8_t *nr_mapping_array; 1001 uint32_t highest_tsn_inside_nr_map; 1002 1003 uint32_t fast_recovery_tsn; 1004 uint32_t sat_t3_recovery_tsn; 1005 uint32_t tsn_last_delivered; 1006 uint32_t tsn_of_pdapi_last_delivered; 1007 uint32_t pdapi_ppid; 1008 uint32_t context; 1009 uint32_t last_reset_action[SCTP_MAX_RESET_PARAMS]; 1010 uint32_t last_sending_seq[SCTP_MAX_RESET_PARAMS]; 1011 uint32_t last_base_tsnsent[SCTP_MAX_RESET_PARAMS]; 1012 #ifdef SCTP_ASOCLOG_OF_TSNS 1013 /* 1014 * special log - This adds considerable size 1015 * to the asoc, but provides a log that you 1016 * can use to detect problems via kgdb. 1017 */ 1018 struct sctp_tsn_log in_tsnlog[SCTP_TSN_LOG_SIZE]; 1019 struct sctp_tsn_log out_tsnlog[SCTP_TSN_LOG_SIZE]; 1020 uint32_t cumack_log[SCTP_TSN_LOG_SIZE]; 1021 uint32_t cumack_logsnt[SCTP_TSN_LOG_SIZE]; 1022 uint16_t tsn_in_at; 1023 uint16_t tsn_out_at; 1024 uint16_t tsn_in_wrapped; 1025 uint16_t tsn_out_wrapped; 1026 uint16_t cumack_log_at; 1027 uint16_t cumack_log_atsnt; 1028 #endif /* SCTP_ASOCLOG_OF_TSNS */ 1029 #ifdef SCTP_FS_SPEC_LOG 1030 struct sctp_fs_spec_log fslog[SCTP_FS_SPEC_LOG_SIZE]; 1031 uint16_t fs_index; 1032 #endif 1033 1034 /* 1035 * window state information and smallest MTU that I use to bound 1036 * segmentation 1037 */ 1038 uint32_t peers_rwnd; 1039 uint32_t my_rwnd; 1040 uint32_t my_last_reported_rwnd; 1041 uint32_t sctp_frag_point; 1042 1043 uint32_t total_output_queue_size; 1044 1045 uint32_t sb_cc; /* shadow of sb_cc */ 1046 uint32_t sb_send_resv; /* amount reserved on a send */ 1047 uint32_t my_rwnd_control_len; /* shadow of sb_mbcnt used for rwnd control */ 1048 #ifdef INET6 1049 uint32_t default_flowlabel; 1050 #endif 1051 uint32_t pr_sctp_cnt; 1052 int ctrl_queue_cnt; /* could be removed REM - NO IT CAN'T!! RRS */ 1053 /* 1054 * All outbound datagrams queue into this list from the individual 1055 * stream queue. Here they get assigned a TSN and then await 1056 * sending. The stream seq comes when it is first put in the 1057 * individual str queue 1058 */ 1059 unsigned int stream_queue_cnt; 1060 unsigned int send_queue_cnt; 1061 unsigned int sent_queue_cnt; 1062 unsigned int sent_queue_cnt_removeable; 1063 /* 1064 * Number on sent queue that are marked for retran until this value 1065 * is 0 we only send one packet of retran'ed data. 1066 */ 1067 unsigned int sent_queue_retran_cnt; 1068 1069 unsigned int size_on_reasm_queue; 1070 unsigned int cnt_on_reasm_queue; 1071 unsigned int fwd_tsn_cnt; 1072 /* amount of data (bytes) currently in flight (on all destinations) */ 1073 unsigned int total_flight; 1074 /* Total book size in flight */ 1075 unsigned int total_flight_count; /* count of chunks used with 1076 * book total */ 1077 /* count of destinaton nets and list of destination nets */ 1078 unsigned int numnets; 1079 1080 /* Total error count on this association */ 1081 unsigned int overall_error_count; 1082 1083 unsigned int cnt_msg_on_sb; 1084 1085 /* All stream count of chunks for delivery */ 1086 unsigned int size_on_all_streams; 1087 unsigned int cnt_on_all_streams; 1088 1089 /* Heart Beat delay in ms */ 1090 uint32_t heart_beat_delay; 1091 1092 /* autoclose */ 1093 uint32_t sctp_autoclose_ticks; 1094 1095 /* how many preopen streams we have */ 1096 unsigned int pre_open_streams; 1097 1098 /* How many streams I support coming into me */ 1099 unsigned int max_inbound_streams; 1100 1101 /* the cookie life I award for any cookie, in seconds */ 1102 uint32_t cookie_life; 1103 /* time to delay acks for */ 1104 unsigned int delayed_ack; 1105 unsigned int old_delayed_ack; 1106 unsigned int sack_freq; 1107 unsigned int data_pkts_seen; 1108 1109 unsigned int numduptsns; 1110 int dup_tsns[SCTP_MAX_DUP_TSNS]; 1111 uint32_t initial_init_rto_max; /* initial RTO for INIT's */ 1112 uint32_t initial_rto; /* initial send RTO */ 1113 uint32_t minrto; /* per assoc RTO-MIN */ 1114 uint32_t maxrto; /* per assoc RTO-MAX */ 1115 1116 /* authentication fields */ 1117 sctp_auth_chklist_t *local_auth_chunks; 1118 sctp_auth_chklist_t *peer_auth_chunks; 1119 sctp_hmaclist_t *local_hmacs; /* local HMACs supported */ 1120 sctp_hmaclist_t *peer_hmacs; /* peer HMACs supported */ 1121 struct sctp_keyhead shared_keys; /* assoc's shared keys */ 1122 sctp_authinfo_t authinfo; /* randoms, cached keys */ 1123 /* 1124 * refcnt to block freeing when a sender or receiver is off coping 1125 * user data in. 1126 */ 1127 uint32_t refcnt; 1128 uint32_t chunks_on_out_queue; /* total chunks floating around, 1129 * locked by send socket buffer */ 1130 uint32_t peers_adaptation; 1131 uint32_t default_mtu; 1132 uint16_t peer_hmac_id; /* peer HMAC id to send */ 1133 1134 /* 1135 * Being that we have no bag to collect stale cookies, and that we 1136 * really would not want to anyway.. we will count them in this 1137 * counter. We of course feed them to the pigeons right away (I have 1138 * always thought of pigeons as flying rats). 1139 */ 1140 uint16_t stale_cookie_count; 1141 1142 /* 1143 * For the partial delivery API, if up, invoked this is what last 1144 * TSN I delivered 1145 */ 1146 uint16_t str_of_pdapi; 1147 uint16_t ssn_of_pdapi; 1148 1149 /* counts of actual built streams. Allocation may be more however */ 1150 /* could re-arrange to optimize space here. */ 1151 uint16_t streamincnt; 1152 uint16_t streamoutcnt; 1153 uint16_t strm_realoutsize; 1154 uint16_t strm_pending_add_size; 1155 /* my maximum number of retrans of INIT and SEND */ 1156 /* copied from SCTP but should be individually setable */ 1157 uint16_t max_init_times; 1158 uint16_t max_send_times; 1159 1160 uint16_t def_net_failure; 1161 1162 uint16_t def_net_pf_threshold; 1163 1164 /* 1165 * lock flag: 0 is ok to send, 1+ (duals as a retran count) is 1166 * awaiting ACK 1167 */ 1168 uint16_t mapping_array_size; 1169 1170 uint16_t last_strm_seq_delivered; 1171 uint16_t last_strm_no_delivered; 1172 1173 uint16_t last_revoke_count; 1174 int16_t num_send_timers_up; 1175 1176 uint16_t stream_locked_on; 1177 uint16_t ecn_echo_cnt_onq; 1178 1179 uint16_t free_chunk_cnt; 1180 uint8_t stream_locked; 1181 uint8_t authenticated; /* packet authenticated ok */ 1182 /* 1183 * This flag indicates that a SACK need to be sent. 1184 * Initially this is 1 to send the first sACK immediately. 1185 */ 1186 uint8_t send_sack; 1187 1188 /* max burst of new packets into the network */ 1189 uint32_t max_burst; 1190 /* max burst of fast retransmit packets */ 1191 uint32_t fr_max_burst; 1192 1193 uint8_t sat_network; /* RTT is in range of sat net or greater */ 1194 uint8_t sat_network_lockout; /* lockout code */ 1195 uint8_t burst_limit_applied; /* Burst limit in effect at last send? */ 1196 /* flag goes on when we are doing a partial delivery api */ 1197 uint8_t hb_random_values[4]; 1198 uint8_t fragmented_delivery_inprogress; 1199 uint8_t fragment_flags; 1200 uint8_t last_flags_delivered; 1201 uint8_t hb_ect_randombit; 1202 uint8_t hb_random_idx; 1203 uint8_t default_dscp; 1204 uint8_t asconf_del_pending; /* asconf delete last addr pending */ 1205 uint8_t trigger_reset; 1206 /* 1207 * This value, plus all other ack'd but above cum-ack is added 1208 * together to cross check against the bit that we have yet to 1209 * define (probably in the SACK). When the cum-ack is updated, this 1210 * sum is updated as well. 1211 */ 1212 1213 /* Flags whether an extension is supported or not */ 1214 uint8_t ecn_supported; 1215 uint8_t prsctp_supported; 1216 uint8_t auth_supported; 1217 uint8_t asconf_supported; 1218 uint8_t reconfig_supported; 1219 uint8_t nrsack_supported; 1220 uint8_t pktdrop_supported; 1221 uint8_t idata_supported; 1222 1223 /* Zero checksum supported information */ 1224 uint8_t rcv_edmid; 1225 uint8_t snd_edmid; 1226 1227 /* Did the peer make the stream config (add out) request */ 1228 uint8_t peer_req_out; 1229 1230 uint8_t local_strreset_support; 1231 uint8_t peer_supports_nat; 1232 1233 struct sctp_scoping scope; 1234 /* flags to handle send alternate net tracking */ 1235 uint8_t used_alt_asconfack; 1236 uint8_t fast_retran_loss_recovery; 1237 uint8_t sat_t3_loss_recovery; 1238 uint8_t dropped_special_cnt; 1239 uint8_t seen_a_sack_this_pkt; 1240 uint8_t stream_reset_outstanding; 1241 uint8_t stream_reset_out_is_outstanding; 1242 uint8_t delayed_connection; 1243 uint8_t ifp_had_enobuf; 1244 uint8_t saw_sack_with_frags; 1245 uint8_t saw_sack_with_nr_frags; 1246 uint8_t in_asocid_hash; 1247 uint8_t assoc_up_sent; 1248 uint8_t adaptation_needed; 1249 uint8_t adaptation_sent; 1250 /* CMT variables */ 1251 uint8_t cmt_dac_pkts_rcvd; 1252 uint8_t sctp_cmt_on_off; 1253 uint8_t iam_blocking; 1254 uint8_t cookie_how[8]; 1255 /* JRS 5/21/07 - CMT PF variable */ 1256 uint8_t sctp_cmt_pf; 1257 uint8_t use_precise_time; 1258 uint64_t sctp_features; 1259 uint32_t max_cwnd; 1260 uint16_t port; /* remote UDP encapsulation port */ 1261 /* 1262 * The mapping array is used to track out of order sequences above 1263 * last_acked_seq. 0 indicates packet missing 1 indicates packet 1264 * rec'd. We slide it up every time we raise last_acked_seq and 0 1265 * trailing locactions out. If I get a TSN above the array 1266 * mappingArraySz, I discard the datagram and let retransmit happen. 1267 */ 1268 uint32_t marked_retrans; 1269 uint32_t timoinit; 1270 uint32_t timodata; 1271 uint32_t timosack; 1272 uint32_t timoshutdown; 1273 uint32_t timoheartbeat; 1274 uint32_t timocookie; 1275 uint32_t timoshutdownack; 1276 struct timeval start_time; 1277 struct timeval discontinuity_time; 1278 uint64_t abandoned_unsent[SCTP_PR_SCTP_MAX + 1]; 1279 uint64_t abandoned_sent[SCTP_PR_SCTP_MAX + 1]; 1280 }; 1281 1282 #endif