1 /*- 2 * Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. 9 * 10 * b) Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in 12 * the documentation and/or other materials provided with the distribution. 13 * 14 * c) Neither the name of Cisco Systems, Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 /* $KAME: sctp_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $ */ 32 33 #include <sys/cdefs.h> 34 __FBSDID("$FreeBSD$"); 35 36 #ifndef __sctp_structs_h__ 37 #define __sctp_structs_h__ 38 39 #include <sys/queue.h> 40 #include <sys/socket.h> 41 42 #ifdef IPSEC 43 #include <netinet6/ipsec.h> 44 #include <netkey/key.h> 45 #endif 46 47 #include <netinet/sctp_os.h> 48 #include <netinet/sctp_header.h> 49 #include <netinet/sctp_uio.h> 50 #include <netinet/sctp_auth.h> 51 52 struct sctp_timer { 53 sctp_os_timer_t timer; 54 55 int type; 56 /* 57 * Depending on the timer type these will be setup and cast with the 58 * appropriate entity. 59 */ 60 void *ep; 61 void *tcb; 62 void *net; 63 64 /* for sanity checking */ 65 void *self; 66 uint32_t ticks; 67 uint32_t stopped_from; 68 }; 69 70 struct sctp_nonpad_sndrcvinfo { 71 uint16_t sinfo_stream; 72 uint16_t sinfo_ssn; 73 uint16_t sinfo_flags; 74 uint32_t sinfo_ppid; 75 uint32_t sinfo_context; 76 uint32_t sinfo_timetolive; 77 uint32_t sinfo_tsn; 78 uint32_t sinfo_cumtsn; 79 sctp_assoc_t sinfo_assoc_id; 80 }; 81 82 struct sctp_foo_stuff { 83 struct sctp_inpcb *inp; 84 uint32_t lineno; 85 uint32_t ticks; 86 int updown; 87 }; 88 89 90 /* 91 * This is the information we track on each interface that we know about from 92 * the distant end. 93 */ 94 TAILQ_HEAD(sctpnetlisthead, sctp_nets); 95 96 struct sctp_stream_reset_list { 97 TAILQ_ENTRY(sctp_stream_reset_list) next_resp; 98 uint32_t tsn; 99 int number_entries; 100 struct sctp_stream_reset_out_request req; 101 }; 102 103 TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list); 104 105 /* 106 * Users of the iterator need to malloc a iterator with a call to 107 * sctp_initiate_iterator(inp_func, assoc_func, pcb_flags, pcb_features, 108 * asoc_state, void-ptr-arg, uint32-arg, end_func, inp); 109 * 110 * Use the following two defines if you don't care what pcb flags are on the EP 111 * and/or you don't care what state the association is in. 112 * 113 * Note that if you specify an INP as the last argument then ONLY each 114 * association of that single INP will be executed upon. Note that the pcb 115 * flags STILL apply so if the inp you specify has different pcb_flags then 116 * what you put in pcb_flags nothing will happen. use SCTP_PCB_ANY_FLAGS to 117 * assure the inp you specify gets treated. 118 */ 119 #define SCTP_PCB_ANY_FLAGS 0x00000000 120 #define SCTP_PCB_ANY_FEATURES 0x00000000 121 #define SCTP_ASOC_ANY_STATE 0x00000000 122 123 typedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr, 124 uint32_t val); 125 typedef void (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val); 126 typedef void (*end_func) (void *ptr, uint32_t val); 127 128 struct sctp_iterator { 129 LIST_ENTRY(sctp_iterator) sctp_nxt_itr; 130 struct sctp_timer tmr; 131 struct sctp_inpcb *inp; /* current endpoint */ 132 struct sctp_tcb *stcb; /* current* assoc */ 133 asoc_func function_assoc; /* per assoc function */ 134 inp_func function_inp; /* per endpoint function */ 135 end_func function_atend;/* iterator completion function */ 136 void *pointer; /* pointer for apply func to use */ 137 uint32_t val; /* value for apply func to use */ 138 uint32_t pcb_flags; /* endpoint flags being checked */ 139 uint32_t pcb_features; /* endpoint features being checked */ 140 uint32_t asoc_state; /* assoc state being checked */ 141 uint32_t iterator_flags; 142 uint8_t no_chunk_output; 143 }; 144 145 /* iterator_flags values */ 146 #define SCTP_ITERATOR_DO_ALL_INP 0x00000001 147 #define SCTP_ITERATOR_DO_SINGLE_INP 0x00000002 148 149 LIST_HEAD(sctpiterators, sctp_iterator); 150 151 struct sctp_copy_all { 152 struct sctp_inpcb *inp; /* ep */ 153 struct mbuf *m; 154 struct sctp_sndrcvinfo sndrcv; 155 int sndlen; 156 int cnt_sent; 157 int cnt_failed; 158 }; 159 160 struct sctp_nets { 161 TAILQ_ENTRY(sctp_nets) sctp_next; /* next link */ 162 163 /* 164 * Things on the top half may be able to be split into a common 165 * structure shared by all. 166 */ 167 struct sctp_timer pmtu_timer; 168 169 /* 170 * The following two in combination equate to a route entry for v6 171 * or v4. 172 */ 173 struct sctp_route { 174 struct rtentry *ro_rt; 175 union sctp_sockstore _l_addr; /* remote peer addr */ 176 union sctp_sockstore _s_addr; /* our selected src addr */ 177 } ro; 178 /* mtu discovered so far */ 179 uint32_t mtu; 180 uint32_t ssthresh; /* not sure about this one for split */ 181 182 /* smoothed average things for RTT and RTO itself */ 183 int lastsa; 184 int lastsv; 185 unsigned int RTO; 186 187 /* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */ 188 struct sctp_timer rxt_timer; 189 struct sctp_timer fr_timer; /* for early fr */ 190 191 /* last time in seconds I sent to it */ 192 struct timeval last_sent_time; 193 int ref_count; 194 195 /* Congestion stats per destination */ 196 /* 197 * flight size variables and such, sorry Vern, I could not avoid 198 * this if I wanted performance :> 199 */ 200 uint32_t flight_size; 201 uint32_t cwnd; /* actual cwnd */ 202 uint32_t prev_cwnd; /* cwnd before any processing */ 203 uint32_t partial_bytes_acked; /* in CA tracks when to incr a MTU */ 204 uint32_t rtt_variance; 205 uint32_t prev_rtt; 206 /* tracking variables to avoid the aloc/free in sack processing */ 207 unsigned int net_ack; 208 unsigned int net_ack2; 209 210 /* 211 * CMT variables (iyengar@cis.udel.edu) 212 */ 213 uint32_t this_sack_highest_newack; /* tracks highest TSN newly 214 * acked for a given dest in 215 * the current SACK. Used in 216 * SFR and HTNA algos */ 217 uint32_t pseudo_cumack; /* CMT CUC algorithm. Maintains next expected 218 * pseudo-cumack for this destination */ 219 uint32_t rtx_pseudo_cumack; /* CMT CUC algorithm. Maintains next 220 * expected pseudo-cumack for this 221 * destination */ 222 223 /* CMT fast recovery variables */ 224 uint32_t fast_recovery_tsn; 225 uint32_t heartbeat_random1; 226 uint32_t heartbeat_random2; 227 uint32_t tos_flowlabel; 228 229 /* if this guy is ok or not ... status */ 230 uint16_t dest_state; 231 /* number of transmit failures to down this guy */ 232 uint16_t failure_threshold; 233 /* error stats on destination */ 234 uint16_t error_count; 235 236 uint8_t fast_retran_loss_recovery; 237 uint8_t will_exit_fast_recovery; 238 /* Flags that probably can be combined into dest_state */ 239 uint8_t rto_variance_dir; /* increase = 1, decreasing = 0 */ 240 uint8_t rto_pending; /* is segment marked for RTO update ** if we 241 * split? */ 242 uint8_t fast_retran_ip; /* fast retransmit in progress */ 243 uint8_t hb_responded; 244 uint8_t saw_newack; /* CMT's SFR algorithm flag */ 245 uint8_t src_addr_selected; /* if we split we move */ 246 uint8_t indx_of_eligible_next_to_use; 247 uint8_t addr_is_local; /* its a local address (if known) could move 248 * in split */ 249 250 /* 251 * CMT variables (iyengar@cis.udel.edu) 252 */ 253 uint8_t find_pseudo_cumack; /* CMT CUC algorithm. Flag used to 254 * find a new pseudocumack. This flag 255 * is set after a new pseudo-cumack 256 * has been received and indicates 257 * that the sender should find the 258 * next pseudo-cumack expected for 259 * this destination */ 260 uint8_t find_rtx_pseudo_cumack; /* CMT CUCv2 algorithm. Flag used to 261 * find a new rtx-pseudocumack. This 262 * flag is set after a new 263 * rtx-pseudo-cumack has been received 264 * and indicates that the sender 265 * should find the next 266 * rtx-pseudo-cumack expected for this 267 * destination */ 268 uint8_t new_pseudo_cumack; /* CMT CUC algorithm. Flag used to 269 * indicate if a new pseudo-cumack or 270 * rtx-pseudo-cumack has been received */ 271 #ifdef SCTP_HIGH_SPEED 272 uint8_t last_hs_used; /* index into the last HS table entry we used */ 273 #endif 274 }; 275 276 277 struct sctp_data_chunkrec { 278 uint32_t TSN_seq; /* the TSN of this transmit */ 279 uint16_t stream_seq; /* the stream sequence number of this transmit */ 280 uint16_t stream_number; /* the stream number of this guy */ 281 uint32_t payloadtype; 282 uint32_t context; /* from send */ 283 284 /* ECN Nonce: Nonce Value for this chunk */ 285 uint8_t ect_nonce; 286 287 /* 288 * part of the Highest sacked algorithm to be able to stroke counts 289 * on ones that are FR'd. 290 */ 291 uint32_t fast_retran_tsn; /* sending_seq at the time of FR */ 292 struct timeval timetodrop; /* time we drop it from queue */ 293 uint8_t doing_fast_retransmit; 294 uint8_t rcv_flags; /* flags pulled from data chunk on inbound for 295 * outbound holds sending flags for PR-SCTP. */ 296 uint8_t state_flags; 297 uint8_t chunk_was_revoked; 298 }; 299 300 TAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk); 301 302 /* The lower byte is used to enumerate PR_SCTP policies */ 303 #define CHUNK_FLAGS_PR_SCTP_TTL SCTP_PR_SCTP_TTL 304 #define CHUNK_FLAGS_PR_SCTP_BUF SCTP_PR_SCTP_BUF 305 #define CHUNK_FLAGS_PR_SCTP_RTX SCTP_PR_SCTP_RTX 306 307 /* The upper byte is used a a bit mask */ 308 #define CHUNK_FLAGS_FRAGMENT_OK 0x0100 309 310 struct chk_id { 311 uint16_t id; 312 uint16_t can_take_data; 313 }; 314 315 316 struct sctp_tmit_chunk { 317 union { 318 struct sctp_data_chunkrec data; 319 struct chk_id chunk_id; 320 } rec; 321 struct sctp_association *asoc; /* bp to asoc this belongs to */ 322 struct timeval sent_rcv_time; /* filled in if RTT being calculated */ 323 struct mbuf *data; /* pointer to mbuf chain of data */ 324 struct mbuf *last_mbuf; /* pointer to last mbuf in chain */ 325 struct sctp_nets *whoTo; 326 TAILQ_ENTRY(sctp_tmit_chunk) sctp_next; /* next link */ 327 int32_t sent; /* the send status */ 328 uint16_t snd_count; /* number of times I sent */ 329 uint16_t flags; /* flags, such as FRAGMENT_OK */ 330 uint16_t send_size; 331 uint16_t book_size; 332 uint16_t mbcnt; 333 uint8_t pad_inplace; 334 uint8_t do_rtt; 335 uint8_t book_size_scale; 336 uint8_t addr_over; /* flag which is set if the dest address for 337 * this chunk is overridden by user. Used for 338 * CMT (iyengar@cis.udel.edu, 2005/06/21) */ 339 uint8_t no_fr_allowed; 340 uint8_t pr_sctp_on; 341 uint8_t copy_by_ref; 342 }; 343 344 /* 345 * The first part of this structure MUST be the entire sinfo structure. Maybe 346 * I should have made it a sub structure... we can circle back later and do 347 * that if we want. 348 */ 349 struct sctp_queued_to_read { /* sinfo structure Pluse more */ 350 uint16_t sinfo_stream; /* off the wire */ 351 uint16_t sinfo_ssn; /* off the wire */ 352 uint16_t sinfo_flags; /* SCTP_UNORDERED from wire use SCTP_EOF for 353 * EOR */ 354 uint32_t sinfo_ppid; /* off the wire */ 355 uint32_t sinfo_context; /* pick this up from assoc def context? */ 356 uint32_t sinfo_timetolive; /* not used by kernel */ 357 uint32_t sinfo_tsn; /* Use this in reassembly as first TSN */ 358 uint32_t sinfo_cumtsn; /* Use this in reassembly as last TSN */ 359 sctp_assoc_t sinfo_assoc_id; /* our assoc id */ 360 /* Non sinfo stuff */ 361 uint32_t length; /* length of data */ 362 uint32_t held_length; /* length held in sb */ 363 struct sctp_nets *whoFrom; /* where it came from */ 364 struct mbuf *data; /* front of the mbuf chain of data with 365 * PKT_HDR */ 366 struct mbuf *tail_mbuf; /* used for multi-part data */ 367 struct sctp_tcb *stcb; /* assoc, used for window update */ 368 TAILQ_ENTRY(sctp_queued_to_read) next; 369 uint16_t port_from; 370 uint16_t spec_flags; /* Flags to hold the notification field */ 371 uint8_t do_not_ref_stcb; 372 uint8_t end_added; 373 uint8_t pdapi_aborted; 374 uint8_t resv; 375 }; 376 377 /* This data structure will be on the outbound 378 * stream queues. Data will be pulled off from 379 * the front of the mbuf data and chunk-ified 380 * by the output routines. We will custom 381 * fit every chunk we pull to the send/sent 382 * queue to make up the next full packet 383 * if we can. An entry cannot be removed 384 * from the stream_out queue until 385 * the msg_is_complete flag is set. This 386 * means at times data/tail_mbuf MIGHT 387 * be NULL.. If that occurs it happens 388 * for one of two reasons. Either the user 389 * is blocked on a send() call and has not 390 * awoken to copy more data down... OR 391 * the user is in the explict MSG_EOR mode 392 * and wrote some data, but has not completed 393 * sending. 394 */ 395 struct sctp_stream_queue_pending { 396 struct mbuf *data; 397 struct mbuf *tail_mbuf; 398 struct timeval ts; 399 struct sctp_nets *net; 400 TAILQ_ENTRY(sctp_stream_queue_pending) next; 401 uint32_t length; 402 uint32_t timetolive; 403 uint32_t ppid; 404 uint32_t context; 405 uint16_t sinfo_flags; 406 uint16_t stream; 407 uint16_t strseq; 408 uint16_t act_flags; 409 uint8_t msg_is_complete; 410 uint8_t some_taken; 411 uint8_t addr_over; 412 uint8_t pr_sctp_on; 413 }; 414 415 /* 416 * this struct contains info that is used to track inbound stream data and 417 * help with ordering. 418 */ 419 TAILQ_HEAD(sctpwheelunrel_listhead, sctp_stream_in); 420 struct sctp_stream_in { 421 struct sctp_readhead inqueue; 422 TAILQ_ENTRY(sctp_stream_in) next_spoke; 423 uint16_t stream_no; 424 uint16_t last_sequence_delivered; /* used for re-order */ 425 }; 426 427 /* This struct is used to track the traffic on outbound streams */ 428 TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out); 429 struct sctp_stream_out { 430 struct sctp_streamhead outqueue; 431 TAILQ_ENTRY(sctp_stream_out) next_spoke; /* next link in wheel */ 432 uint16_t stream_no; 433 uint16_t next_sequence_sent; /* next one I expect to send out */ 434 uint8_t last_msg_incomplete; 435 }; 436 437 /* used to keep track of the addresses yet to try to add/delete */ 438 TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr); 439 struct sctp_asconf_addr { 440 TAILQ_ENTRY(sctp_asconf_addr) next; 441 struct sctp_asconf_addr_param ap; 442 struct ifaddr *ifa; /* save the ifa for add/del ip */ 443 uint8_t sent; /* has this been sent yet? */ 444 }; 445 446 struct sctp_scoping { 447 uint8_t ipv4_addr_legal; 448 uint8_t ipv6_addr_legal; 449 uint8_t loopback_scope; 450 uint8_t ipv4_local_scope; 451 uint8_t local_scope; 452 uint8_t site_scope; 453 }; 454 455 /* 456 * Here we have information about each individual association that we track. 457 * We probably in production would be more dynamic. But for ease of 458 * implementation we will have a fixed array that we hunt for in a linear 459 * fashion. 460 */ 461 struct sctp_association { 462 /* association state */ 463 int state; 464 /* queue of pending addrs to add/delete */ 465 struct sctp_asconf_addrhead asconf_queue; 466 struct timeval time_entered; /* time we entered state */ 467 struct timeval time_last_rcvd; 468 struct timeval time_last_sent; 469 struct timeval time_last_sat_advance; 470 struct sctp_sndrcvinfo def_send; /* default send parameters */ 471 472 /* timers and such */ 473 struct sctp_timer hb_timer; /* hb timer */ 474 struct sctp_timer dack_timer; /* Delayed ack timer */ 475 struct sctp_timer asconf_timer; /* Asconf */ 476 struct sctp_timer strreset_timer; /* stream reset */ 477 struct sctp_timer shut_guard_timer; /* guard */ 478 struct sctp_timer autoclose_timer; /* automatic close timer */ 479 struct sctp_timer delayed_event_timer; /* timer for delayed events */ 480 481 /* list of local addresses when add/del in progress */ 482 struct sctpladdr sctp_local_addr_list; 483 struct sctpnetlisthead nets; 484 485 /* Free chunk list */ 486 struct sctpchunk_listhead free_chunks; 487 488 /* Free stream output control list */ 489 struct sctp_streamhead free_strmoq; 490 491 /* Control chunk queue */ 492 struct sctpchunk_listhead control_send_queue; 493 494 /* 495 * Once a TSN hits the wire it is moved to the sent_queue. We 496 * maintain two counts here (don't know if any but retran_cnt is 497 * needed). The idea is that the sent_queue_retran_cnt reflects how 498 * many chunks have been marked for retranmission by either T3-rxt 499 * or FR. 500 */ 501 struct sctpchunk_listhead sent_queue; 502 struct sctpchunk_listhead send_queue; 503 504 505 /* re-assembly queue for fragmented chunks on the inbound path */ 506 struct sctpchunk_listhead reasmqueue; 507 508 /* 509 * this queue is used when we reach a condition that we can NOT put 510 * data into the socket buffer. We track the size of this queue and 511 * set our rwnd to the space in the socket minus also the 512 * size_on_delivery_queue. 513 */ 514 struct sctpwheel_listhead out_wheel; 515 516 /* 517 * This pointer will be set to NULL most of the time. But when we 518 * have a fragmented message, where we could not get out all of the 519 * message at the last send then this will point to the stream to go 520 * get data from. 521 */ 522 struct sctp_stream_out *locked_on_sending; 523 524 /* If an iterator is looking at me, this is it */ 525 struct sctp_iterator *stcb_starting_point_for_iterator; 526 527 /* ASCONF destination address last sent to */ 528 /* struct sctp_nets *asconf_last_sent_to;*/ 529 /* Peter, greppign for the above shows only on strange set 530 * I don't think we need it so I have commented it out. 531 */ 532 533 /* ASCONF save the last ASCONF-ACK so we can resend it if necessary */ 534 struct mbuf *last_asconf_ack_sent; 535 536 /* 537 * pointer to last stream reset queued to control queue by us with 538 * requests. 539 */ 540 struct sctp_tmit_chunk *str_reset; 541 /* 542 * if Source Address Selection happening, this will rotate through 543 * the link list. 544 */ 545 struct sctp_laddr *last_used_address; 546 547 /* stream arrays */ 548 struct sctp_stream_in *strmin; 549 struct sctp_stream_out *strmout; 550 uint8_t *mapping_array; 551 /* primary destination to use */ 552 struct sctp_nets *primary_destination; 553 /* For CMT */ 554 struct sctp_nets *last_net_data_came_from; 555 /* last place I got a data chunk from */ 556 struct sctp_nets *last_data_chunk_from; 557 /* last place I got a control from */ 558 struct sctp_nets *last_control_chunk_from; 559 560 /* circular looking for output selection */ 561 struct sctp_stream_out *last_out_stream; 562 563 /* 564 * wait to the point the cum-ack passes req->send_reset_at_tsn for 565 * any req on the list. 566 */ 567 struct sctp_resethead resetHead; 568 569 /* queue of chunks waiting to be sent into the local stack */ 570 struct sctp_readhead pending_reply_queue; 571 572 uint32_t cookie_preserve_req; 573 /* ASCONF next seq I am sending out, inits at init-tsn */ 574 uint32_t asconf_seq_out; 575 /* ASCONF last received ASCONF from peer, starts at peer's TSN-1 */ 576 uint32_t asconf_seq_in; 577 578 /* next seq I am sending in str reset messages */ 579 uint32_t str_reset_seq_out; 580 581 /* next seq I am expecting in str reset messages */ 582 uint32_t str_reset_seq_in; 583 584 585 /* various verification tag information */ 586 uint32_t my_vtag; /* The tag to be used. if assoc is re-initited 587 * by remote end, and I have unlocked this 588 * will be regenerated to a new random value. */ 589 uint32_t peer_vtag; /* The peers last tag */ 590 591 uint32_t my_vtag_nonce; 592 uint32_t peer_vtag_nonce; 593 594 uint32_t assoc_id; 595 596 /* This is the SCTP fragmentation threshold */ 597 uint32_t smallest_mtu; 598 599 /* 600 * Special hook for Fast retransmit, allows us to track the highest 601 * TSN that is NEW in this SACK if gap ack blocks are present. 602 */ 603 uint32_t this_sack_highest_gap; 604 605 /* 606 * The highest consecutive TSN that has been acked by peer on my 607 * sends 608 */ 609 uint32_t last_acked_seq; 610 611 /* The next TSN that I will use in sending. */ 612 uint32_t sending_seq; 613 614 /* Original seq number I used ??questionable to keep?? */ 615 uint32_t init_seq_number; 616 617 618 /* The Advanced Peer Ack Point, as required by the PR-SCTP */ 619 /* (A1 in Section 4.2) */ 620 uint32_t advanced_peer_ack_point; 621 622 /* 623 * The highest consequetive TSN at the bottom of the mapping array 624 * (for his sends). 625 */ 626 uint32_t cumulative_tsn; 627 /* 628 * Used to track the mapping array and its offset bits. This MAY be 629 * lower then cumulative_tsn. 630 */ 631 uint32_t mapping_array_base_tsn; 632 /* 633 * used to track highest TSN we have received and is listed in the 634 * mapping array. 635 */ 636 uint32_t highest_tsn_inside_map; 637 638 uint32_t last_echo_tsn; 639 uint32_t last_cwr_tsn; 640 uint32_t fast_recovery_tsn; 641 uint32_t sat_t3_recovery_tsn; 642 uint32_t tsn_last_delivered; 643 /* 644 * For the pd-api we should re-write this a bit more efficent. We 645 * could have multiple sctp_queued_to_read's that we are building at 646 * once. Now we only do this when we get ready to deliver to the 647 * socket buffer. Note that we depend on the fact that the struct is 648 * "stuck" on the read queue until we finish all the pd-api. 649 */ 650 struct sctp_queued_to_read *control_pdapi; 651 652 uint32_t tsn_of_pdapi_last_delivered; 653 uint32_t pdapi_ppid; 654 uint32_t context; 655 uint32_t last_reset_action[SCTP_MAX_RESET_PARAMS]; 656 uint32_t last_sending_seq[SCTP_MAX_RESET_PARAMS]; 657 uint32_t last_base_tsnsent[SCTP_MAX_RESET_PARAMS]; 658 /* 659 * window state information and smallest MTU that I use to bound 660 * segmentation 661 */ 662 uint32_t peers_rwnd; 663 uint32_t my_rwnd; 664 uint32_t my_last_reported_rwnd; 665 uint32_t my_rwnd_control_len; 666 667 uint32_t total_output_queue_size; 668 669 uint32_t sb_cc; /* shadow of sb_cc in one-2-one */ 670 uint32_t sb_mbcnt; /* shadow of sb_mbcnt in one-2-one */ 671 /* 32 bit nonce stuff */ 672 uint32_t nonce_resync_tsn; 673 uint32_t nonce_wait_tsn; 674 uint32_t default_flowlabel; 675 uint32_t pr_sctp_cnt; 676 int ctrl_queue_cnt; /* could be removed REM */ 677 /* 678 * All outbound datagrams queue into this list from the individual 679 * stream queue. Here they get assigned a TSN and then await 680 * sending. The stream seq comes when it is first put in the 681 * individual str queue 682 */ 683 unsigned int stream_queue_cnt; 684 unsigned int send_queue_cnt; 685 unsigned int sent_queue_cnt; 686 unsigned int sent_queue_cnt_removeable; 687 /* 688 * Number on sent queue that are marked for retran until this value 689 * is 0 we only send one packet of retran'ed data. 690 */ 691 unsigned int sent_queue_retran_cnt; 692 693 unsigned int size_on_reasm_queue; 694 unsigned int cnt_on_reasm_queue; 695 /* amount of data (bytes) currently in flight (on all destinations) */ 696 unsigned int total_flight; 697 /* Total book size in flight */ 698 unsigned int total_flight_count; /* count of chunks used with 699 * book total */ 700 /* count of destinaton nets and list of destination nets */ 701 unsigned int numnets; 702 703 /* Total error count on this association */ 704 unsigned int overall_error_count; 705 706 unsigned int cnt_msg_on_sb; 707 708 /* All stream count of chunks for delivery */ 709 unsigned int size_on_all_streams; 710 unsigned int cnt_on_all_streams; 711 712 /* Heart Beat delay in ticks */ 713 unsigned int heart_beat_delay; 714 715 /* autoclose */ 716 unsigned int sctp_autoclose_ticks; 717 718 /* how many preopen streams we have */ 719 unsigned int pre_open_streams; 720 721 /* How many streams I support coming into me */ 722 unsigned int max_inbound_streams; 723 724 /* the cookie life I award for any cookie, in seconds */ 725 unsigned int cookie_life; 726 /* time to delay acks for */ 727 unsigned int delayed_ack; 728 729 unsigned int numduptsns; 730 int dup_tsns[SCTP_MAX_DUP_TSNS]; 731 unsigned int initial_init_rto_max; /* initial RTO for INIT's */ 732 unsigned int initial_rto; /* initial send RTO */ 733 unsigned int minrto; /* per assoc RTO-MIN */ 734 unsigned int maxrto; /* per assoc RTO-MAX */ 735 736 /* authentication fields */ 737 sctp_auth_chklist_t *local_auth_chunks; 738 sctp_auth_chklist_t *peer_auth_chunks; 739 sctp_hmaclist_t *local_hmacs; /* local HMACs supported */ 740 sctp_hmaclist_t *peer_hmacs; /* peer HMACs supported */ 741 struct sctp_keyhead shared_keys; /* assoc's shared keys */ 742 sctp_authinfo_t authinfo; /* randoms, cached keys */ 743 /* 744 * refcnt to block freeing when a sender or receiver is off coping 745 * user data in. 746 */ 747 uint32_t refcnt; 748 uint32_t chunks_on_out_queue; /* total chunks floating around, 749 * locked by send socket buffer */ 750 751 uint16_t peer_hmac_id; /* peer HMAC id to send */ 752 753 /* 754 * Being that we have no bag to collect stale cookies, and that we 755 * really would not want to anyway.. we will count them in this 756 * counter. We of course feed them to the pigeons right away (I have 757 * always thought of pigeons as flying rats). 758 */ 759 uint16_t stale_cookie_count; 760 761 /* 762 * For the partial delivery API, if up, invoked this is what last 763 * TSN I delivered 764 */ 765 uint16_t str_of_pdapi; 766 uint16_t ssn_of_pdapi; 767 768 /* counts of actual built streams. Allocation may be more however */ 769 /* could re-arrange to optimize space here. */ 770 uint16_t streamincnt; 771 uint16_t streamoutcnt; 772 773 /* my maximum number of retrans of INIT and SEND */ 774 /* copied from SCTP but should be individually setable */ 775 uint16_t max_init_times; 776 uint16_t max_send_times; 777 778 uint16_t def_net_failure; 779 780 /* 781 * lock flag: 0 is ok to send, 1+ (duals as a retran count) is 782 * awaiting ACK 783 */ 784 uint16_t asconf_sent; /* possibly removable REM */ 785 uint16_t mapping_array_size; 786 787 uint16_t last_strm_seq_delivered; 788 uint16_t last_strm_no_delivered; 789 790 uint16_t last_revoke_count; 791 int16_t num_send_timers_up; 792 793 uint16_t stream_locked_on; 794 uint16_t ecn_echo_cnt_onq; 795 796 uint16_t free_chunk_cnt; 797 uint16_t free_strmoq_cnt; 798 799 uint8_t stream_locked; 800 uint8_t authenticated; /* packet authenticated ok */ 801 /* 802 * This flag indicates that we need to send the first SACK. If in 803 * place it says we have NOT yet sent a SACK and need to. 804 */ 805 uint8_t first_ack_sent; 806 807 /* max burst after fast retransmit completes */ 808 uint8_t max_burst; 809 810 uint8_t sat_network; /* RTT is in range of sat net or greater */ 811 uint8_t sat_network_lockout; /* lockout code */ 812 uint8_t burst_limit_applied; /* Burst limit in effect at last send? */ 813 /* flag goes on when we are doing a partial delivery api */ 814 uint8_t hb_random_values[4]; 815 uint8_t fragmented_delivery_inprogress; 816 uint8_t fragment_flags; 817 uint8_t last_flags_delivered; 818 uint8_t hb_ect_randombit; 819 uint8_t hb_random_idx; 820 uint8_t hb_is_disabled; /* is the hb disabled? */ 821 uint8_t default_tos; 822 823 /* ECN Nonce stuff */ 824 uint8_t receiver_nonce_sum; /* nonce I sum and put in my sack */ 825 uint8_t ecn_nonce_allowed; /* Tells us if ECN nonce is on */ 826 uint8_t nonce_sum_check;/* On off switch used during re-sync */ 827 uint8_t nonce_wait_for_ecne; /* flag when we expect a ECN */ 828 uint8_t peer_supports_ecn_nonce; 829 830 /* 831 * This value, plus all other ack'd but above cum-ack is added 832 * together to cross check against the bit that we have yet to 833 * define (probably in the SACK). When the cum-ack is updated, this 834 * sum is updated as well. 835 */ 836 uint8_t nonce_sum_expect_base; 837 /* Flag to tell if ECN is allowed */ 838 uint8_t ecn_allowed; 839 840 /* flag to indicate if peer can do asconf */ 841 uint8_t peer_supports_asconf; 842 /* pr-sctp support flag */ 843 uint8_t peer_supports_prsctp; 844 /* peer authentication support flag */ 845 uint8_t peer_supports_auth; 846 /* stream resets are supported by the peer */ 847 uint8_t peer_supports_strreset; 848 849 /* 850 * packet drop's are supported by the peer, we don't really care 851 * about this but we bookkeep it anyway. 852 */ 853 uint8_t peer_supports_pktdrop; 854 855 /* Do we allow V6/V4? */ 856 uint8_t ipv4_addr_legal; 857 uint8_t ipv6_addr_legal; 858 /* Address scoping flags */ 859 /* scope value for IPv4 */ 860 uint8_t ipv4_local_scope; 861 /* scope values for IPv6 */ 862 uint8_t local_scope; 863 uint8_t site_scope; 864 /* loopback scope */ 865 uint8_t loopback_scope; 866 /* flags to handle send alternate net tracking */ 867 uint8_t used_alt_onsack; 868 uint8_t used_alt_asconfack; 869 uint8_t fast_retran_loss_recovery; 870 uint8_t sat_t3_loss_recovery; 871 uint8_t dropped_special_cnt; 872 uint8_t seen_a_sack_this_pkt; 873 uint8_t stream_reset_outstanding; 874 uint8_t stream_reset_out_is_outstanding; 875 uint8_t delayed_connection; 876 uint8_t ifp_had_enobuf; 877 uint8_t saw_sack_with_frags; 878 uint8_t in_restart_hash; 879 uint8_t assoc_up_sent; 880 /* CMT variables */ 881 uint8_t cmt_dac_pkts_rcvd; 882 uint8_t sctp_cmt_on_off; 883 uint8_t iam_blocking; 884 /* 885 * The mapping array is used to track out of order sequences above 886 * last_acked_seq. 0 indicates packet missing 1 indicates packet 887 * rec'd. We slide it up every time we raise last_acked_seq and 0 888 * trailing locactions out. If I get a TSN above the array 889 * mappingArraySz, I discard the datagram and let retransmit happen. 890 */ 891 }; 892 893 #endif 894