2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
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.
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.
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.
31 /* $KAME: sctp_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $ */
33 #include <sys/cdefs.h>
34 __FBSDID("$FreeBSD$");
36 #ifndef __sctp_structs_h__
37 #define __sctp_structs_h__
39 #include <netinet/sctp_os.h>
40 #include <netinet/sctp_header.h>
41 #include <netinet/sctp_auth.h>
44 sctp_os_timer_t timer;
48 * Depending on the timer type these will be setup and cast with the
56 /* for sanity checking */
59 uint32_t stopped_from;
63 struct sctp_foo_stuff {
64 struct sctp_inpcb *inp;
72 * This is the information we track on each interface that we know about from
75 TAILQ_HEAD(sctpnetlisthead, sctp_nets);
77 struct sctp_stream_reset_list {
78 TAILQ_ENTRY(sctp_stream_reset_list) next_resp;
81 struct sctp_stream_reset_out_request req;
84 TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list);
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);
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.
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.
100 #define SCTP_PCB_ANY_FLAGS 0x00000000
101 #define SCTP_PCB_ANY_FEATURES 0x00000000
102 #define SCTP_ASOC_ANY_STATE 0x00000000
104 typedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr,
106 typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val);
107 typedef void (*end_func) (void *ptr, uint32_t val);
109 struct sctp_iterator {
110 TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr;
112 struct sctp_timer tmr;
113 struct sctp_inpcb *inp; /* current endpoint */
114 struct sctp_tcb *stcb; /* current* assoc */
115 struct sctp_inpcb *next_inp; /* special hook to skip to */
116 asoc_func function_assoc; /* per assoc function */
117 inp_func function_inp; /* per endpoint function */
118 inp_func function_inp_end; /* end INP function */
119 end_func function_atend;/* iterator completion function */
120 void *pointer; /* pointer for apply func to use */
121 uint32_t val; /* value for apply func to use */
122 uint32_t pcb_flags; /* endpoint flags being checked */
123 uint32_t pcb_features; /* endpoint features being checked */
124 uint32_t asoc_state; /* assoc state being checked */
125 uint32_t iterator_flags;
126 uint8_t no_chunk_output;
127 uint8_t done_current_ep;
130 /* iterator_flags values */
131 #define SCTP_ITERATOR_DO_ALL_INP 0x00000001
132 #define SCTP_ITERATOR_DO_SINGLE_INP 0x00000002
135 TAILQ_HEAD(sctpiterators, sctp_iterator);
137 struct sctp_copy_all {
138 struct sctp_inpcb *inp; /* ep */
140 struct sctp_sndrcvinfo sndrcv;
146 struct sctp_asconf_iterator {
147 struct sctpladdr list_of_work;
151 struct iterator_control {
152 struct mtx ipi_iterator_wq_mtx;
154 SCTP_PROCESS_STRUCT thread_proc;
155 struct sctpiterators iteratorhead;
156 struct sctp_iterator *cur_it;
157 uint32_t iterator_running;
158 uint32_t iterator_flags;
161 #define SCTP_ITERATOR_MUST_EXIT 0x00000001
162 #define SCTP_ITERATOR_STOP_CUR_IT 0x00000002
163 #define SCTP_ITERATOR_STOP_CUR_INP 0x00000004
165 struct sctp_net_route {
166 sctp_rtentry_t *ro_rt;
168 union sctp_sockstore _l_addr; /* remote peer addr */
169 struct sctp_ifa *_s_addr; /* our selected src addr */
173 uint16_t alpha; /* Fixed point arith, << 7 */
174 uint8_t beta; /* Fixed point arith, << 7 */
175 uint8_t modeswitch; /* Delay modeswitch until we had at least one
176 * congestion event */
177 uint32_t last_cong; /* Time since last congestion event end */
178 uint32_t undo_last_cong;
179 uint16_t bytes_acked;
184 uint32_t undo_maxRTT;
185 uint32_t undo_old_maxB;
187 /* Bandwidth estimation */
197 TAILQ_ENTRY(sctp_nets) sctp_next; /* next link */
200 * Things on the top half may be able to be split into a common
201 * structure shared by all.
203 struct sctp_timer pmtu_timer;
206 * The following two in combination equate to a route entry for v6
209 struct sctp_net_route ro;
211 /* mtu discovered so far */
213 uint32_t ssthresh; /* not sure about this one for split */
215 /* smoothed average things for RTT and RTO itself */
218 int rtt; /* last measured rtt value in ms */
221 /* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */
222 struct sctp_timer rxt_timer;
223 struct sctp_timer fr_timer; /* for early fr */
225 /* last time in seconds I sent to it */
226 struct timeval last_sent_time;
229 /* Congestion stats per destination */
231 * flight size variables and such, sorry Vern, I could not avoid
232 * this if I wanted performance :>
234 uint32_t flight_size;
235 uint32_t cwnd; /* actual cwnd */
236 uint32_t prev_cwnd; /* cwnd before any processing */
237 uint32_t partial_bytes_acked; /* in CA tracks when to incr a MTU */
239 /* tracking variables to avoid the aloc/free in sack processing */
240 unsigned int net_ack;
241 unsigned int net_ack2;
244 * JRS - 5/8/07 - Variable to track last time a destination was
247 uint32_t last_active;
250 * CMT variables (iyengar@cis.udel.edu)
252 uint32_t this_sack_highest_newack; /* tracks highest TSN newly
253 * acked for a given dest in
254 * the current SACK. Used in
255 * SFR and HTNA algos */
256 uint32_t pseudo_cumack; /* CMT CUC algorithm. Maintains next expected
257 * pseudo-cumack for this destination */
258 uint32_t rtx_pseudo_cumack; /* CMT CUC algorithm. Maintains next
259 * expected pseudo-cumack for this
262 /* CMT fast recovery variables */
263 uint32_t fast_recovery_tsn;
264 uint32_t heartbeat_random1;
265 uint32_t heartbeat_random2;
266 uint32_t tos_flowlabel;
268 struct timeval start_time; /* time when this net was created */
270 uint32_t marked_retrans;/* number or DATA chunks marked for timer
271 * based retransmissions */
272 uint32_t marked_fastretrans;
274 /* if this guy is ok or not ... status */
276 /* number of transmit failures to down this guy */
277 uint16_t failure_threshold;
278 /* error stats on destination */
279 uint16_t error_count;
280 /* UDP port number in case of UDP tunneling */
283 uint8_t fast_retran_loss_recovery;
284 uint8_t will_exit_fast_recovery;
285 /* Flags that probably can be combined into dest_state */
286 uint8_t fast_retran_ip; /* fast retransmit in progress */
287 uint8_t hb_responded;
288 uint8_t saw_newack; /* CMT's SFR algorithm flag */
289 uint8_t src_addr_selected; /* if we split we move */
290 uint8_t indx_of_eligible_next_to_use;
291 uint8_t addr_is_local; /* its a local address (if known) could move
295 * CMT variables (iyengar@cis.udel.edu)
297 uint8_t find_pseudo_cumack; /* CMT CUC algorithm. Flag used to
298 * find a new pseudocumack. This flag
299 * is set after a new pseudo-cumack
300 * has been received and indicates
301 * that the sender should find the
302 * next pseudo-cumack expected for
303 * this destination */
304 uint8_t find_rtx_pseudo_cumack; /* CMT CUCv2 algorithm. Flag used to
305 * find a new rtx-pseudocumack. This
306 * flag is set after a new
307 * rtx-pseudo-cumack has been received
308 * and indicates that the sender
309 * should find the next
310 * rtx-pseudo-cumack expected for this
312 uint8_t new_pseudo_cumack; /* CMT CUC algorithm. Flag used to
313 * indicate if a new pseudo-cumack or
314 * rtx-pseudo-cumack has been received */
315 uint8_t window_probe; /* Doing a window probe? */
316 uint8_t RTO_measured; /* Have we done the first measure */
317 uint8_t last_hs_used; /* index into the last HS table entry we used */
318 /* JRS - struct used in HTCP algorithm */
323 struct sctp_data_chunkrec {
324 uint32_t TSN_seq; /* the TSN of this transmit */
325 uint16_t stream_seq; /* the stream sequence number of this transmit */
326 uint16_t stream_number; /* the stream number of this guy */
327 uint32_t payloadtype;
328 uint32_t context; /* from send */
330 /* ECN Nonce: Nonce Value for this chunk */
334 * part of the Highest sacked algorithm to be able to stroke counts
335 * on ones that are FR'd.
337 uint32_t fast_retran_tsn; /* sending_seq at the time of FR */
338 struct timeval timetodrop; /* time we drop it from queue */
339 uint8_t doing_fast_retransmit;
340 uint8_t rcv_flags; /* flags pulled from data chunk on inbound for
341 * outbound holds sending flags for PR-SCTP. */
343 uint8_t chunk_was_revoked;
346 TAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk);
348 /* The lower byte is used to enumerate PR_SCTP policies */
349 #define CHUNK_FLAGS_PR_SCTP_TTL SCTP_PR_SCTP_TTL
350 #define CHUNK_FLAGS_PR_SCTP_BUF SCTP_PR_SCTP_BUF
351 #define CHUNK_FLAGS_PR_SCTP_RTX SCTP_PR_SCTP_RTX
353 /* The upper byte is used a a bit mask */
354 #define CHUNK_FLAGS_FRAGMENT_OK 0x0100
358 uint16_t can_take_data;
362 struct sctp_tmit_chunk {
364 struct sctp_data_chunkrec data;
365 struct chk_id chunk_id;
367 struct sctp_association *asoc; /* bp to asoc this belongs to */
368 struct timeval sent_rcv_time; /* filled in if RTT being calculated */
369 struct mbuf *data; /* pointer to mbuf chain of data */
370 struct mbuf *last_mbuf; /* pointer to last mbuf in chain */
371 struct sctp_nets *whoTo;
372 TAILQ_ENTRY(sctp_tmit_chunk) sctp_next; /* next link */
373 int32_t sent; /* the send status */
374 uint16_t snd_count; /* number of times I sent */
375 uint16_t flags; /* flags, such as FRAGMENT_OK */
380 uint8_t holds_key_ref; /* flag if auth keyid refcount is held */
383 uint8_t book_size_scale;
384 uint8_t no_fr_allowed;
387 uint8_t window_probe;
391 * The first part of this structure MUST be the entire sinfo structure. Maybe
392 * I should have made it a sub structure... we can circle back later and do
395 struct sctp_queued_to_read { /* sinfo structure Pluse more */
396 uint16_t sinfo_stream; /* off the wire */
397 uint16_t sinfo_ssn; /* off the wire */
398 uint16_t sinfo_flags; /* SCTP_UNORDERED from wire use SCTP_EOF for
400 uint32_t sinfo_ppid; /* off the wire */
401 uint32_t sinfo_context; /* pick this up from assoc def context? */
402 uint32_t sinfo_timetolive; /* not used by kernel */
403 uint32_t sinfo_tsn; /* Use this in reassembly as first TSN */
404 uint32_t sinfo_cumtsn; /* Use this in reassembly as last TSN */
405 sctp_assoc_t sinfo_assoc_id; /* our assoc id */
406 /* Non sinfo stuff */
407 uint32_t length; /* length of data */
408 uint32_t held_length; /* length held in sb */
409 struct sctp_nets *whoFrom; /* where it came from */
410 struct mbuf *data; /* front of the mbuf chain of data with
412 struct mbuf *tail_mbuf; /* used for multi-part data */
413 struct mbuf *aux_data; /* used to hold/cache control if o/s does not
415 struct sctp_tcb *stcb; /* assoc, used for window update */
416 TAILQ_ENTRY(sctp_queued_to_read) next;
418 uint16_t spec_flags; /* Flags to hold the notification field */
419 uint8_t do_not_ref_stcb;
421 uint8_t pdapi_aborted;
425 /* This data structure will be on the outbound
426 * stream queues. Data will be pulled off from
427 * the front of the mbuf data and chunk-ified
428 * by the output routines. We will custom
429 * fit every chunk we pull to the send/sent
430 * queue to make up the next full packet
431 * if we can. An entry cannot be removed
432 * from the stream_out queue until
433 * the msg_is_complete flag is set. This
434 * means at times data/tail_mbuf MIGHT
435 * be NULL.. If that occurs it happens
436 * for one of two reasons. Either the user
437 * is blocked on a send() call and has not
438 * awoken to copy more data down... OR
439 * the user is in the explict MSG_EOR mode
440 * and wrote some data, but has not completed
443 struct sctp_stream_queue_pending {
445 struct mbuf *tail_mbuf;
447 struct sctp_nets *net;
448 TAILQ_ENTRY(sctp_stream_queue_pending) next;
453 uint16_t sinfo_flags;
458 uint8_t holds_key_ref;
459 uint8_t msg_is_complete;
462 uint8_t sender_all_done;
463 uint8_t put_last_out;
464 uint8_t discard_rest;
468 * this struct contains info that is used to track inbound stream data and
469 * help with ordering.
471 TAILQ_HEAD(sctpwheelunrel_listhead, sctp_stream_in);
472 struct sctp_stream_in {
473 struct sctp_readhead inqueue;
475 uint16_t last_sequence_delivered; /* used for re-order */
476 uint8_t delivery_started;
479 /* This struct is used to track the traffic on outbound streams */
480 TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out);
481 struct sctp_stream_out {
482 struct sctp_streamhead outqueue;
483 TAILQ_ENTRY(sctp_stream_out) next_spoke; /* next link in wheel */
485 uint16_t next_sequence_sent; /* next one I expect to send out */
486 uint8_t last_msg_incomplete;
489 /* used to keep track of the addresses yet to try to add/delete */
490 TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr);
491 struct sctp_asconf_addr {
492 TAILQ_ENTRY(sctp_asconf_addr) next;
493 struct sctp_asconf_addr_param ap;
494 struct sctp_ifa *ifa; /* save the ifa for add/del ip */
495 uint8_t sent; /* has this been sent yet? */
496 uint8_t special_del; /* not to be used in lookup */
499 struct sctp_scoping {
500 uint8_t ipv4_addr_legal;
501 uint8_t ipv6_addr_legal;
502 uint8_t loopback_scope;
503 uint8_t ipv4_local_scope;
508 #define SCTP_TSN_LOG_SIZE 40
510 struct sctp_tsn_log {
521 #define SCTP_FS_SPEC_LOG_SIZE 200
522 struct sctp_fs_spec_log {
524 uint32_t total_flight;
531 /* This struct is here to cut out the compatiabilty
532 * pad that bulks up both the inp and stcb. The non
533 * pad portion MUST stay in complete sync with
534 * sctp_sndrcvinfo... i.e. if sinfo_xxxx is added
535 * this must be done here too.
537 struct sctp_nonpad_sndrcvinfo {
538 uint16_t sinfo_stream;
540 uint16_t sinfo_flags;
542 uint32_t sinfo_context;
543 uint32_t sinfo_timetolive;
545 uint32_t sinfo_cumtsn;
546 sctp_assoc_t sinfo_assoc_id;
550 * JRS - Structure to hold function pointers to the functions responsible
551 * for congestion control.
554 struct sctp_cc_functions {
555 void (*sctp_set_initial_cc_param) (struct sctp_tcb *stcb, struct sctp_nets *net);
556 void (*sctp_cwnd_update_after_sack) (struct sctp_tcb *stcb,
557 struct sctp_association *asoc,
558 int accum_moved, int reneged_all, int will_exit);
559 void (*sctp_cwnd_update_after_fr) (struct sctp_tcb *stcb,
560 struct sctp_association *asoc);
561 void (*sctp_cwnd_update_after_timeout) (struct sctp_tcb *stcb,
562 struct sctp_nets *net);
563 void (*sctp_cwnd_update_after_ecn_echo) (struct sctp_tcb *stcb,
564 struct sctp_nets *net);
565 void (*sctp_cwnd_update_after_packet_dropped) (struct sctp_tcb *stcb,
566 struct sctp_nets *net, struct sctp_pktdrop_chunk *cp,
567 uint32_t * bottle_bw, uint32_t * on_queue);
568 void (*sctp_cwnd_update_after_output) (struct sctp_tcb *stcb,
569 struct sctp_nets *net, int burst_limit);
570 void (*sctp_cwnd_update_after_fr_timer) (struct sctp_inpcb *inp,
571 struct sctp_tcb *stcb, struct sctp_nets *net);
574 /* used to save ASCONF chunks for retransmission */
575 TAILQ_HEAD(sctp_asconf_head, sctp_asconf);
577 TAILQ_ENTRY(sctp_asconf) next;
578 uint32_t serial_number;
584 /* used to save ASCONF-ACK chunks for retransmission */
585 TAILQ_HEAD(sctp_asconf_ackhead, sctp_asconf_ack);
586 struct sctp_asconf_ack {
587 TAILQ_ENTRY(sctp_asconf_ack) next;
588 uint32_t serial_number;
589 struct sctp_nets *last_sent_to;
595 * Here we have information about each individual association that we track.
596 * We probably in production would be more dynamic. But for ease of
597 * implementation we will have a fixed array that we hunt for in a linear
600 struct sctp_association {
601 /* association state */
604 /* queue of pending addrs to add/delete */
605 struct sctp_asconf_addrhead asconf_queue;
607 struct timeval time_entered; /* time we entered state */
608 struct timeval time_last_rcvd;
609 struct timeval time_last_sent;
610 struct timeval time_last_sat_advance;
611 struct sctp_nonpad_sndrcvinfo def_send;
613 /* timers and such */
614 struct sctp_timer hb_timer; /* hb timer */
615 struct sctp_timer dack_timer; /* Delayed ack timer */
616 struct sctp_timer asconf_timer; /* asconf */
617 struct sctp_timer strreset_timer; /* stream reset */
618 struct sctp_timer shut_guard_timer; /* shutdown guard */
619 struct sctp_timer autoclose_timer; /* automatic close timer */
620 struct sctp_timer delayed_event_timer; /* timer for delayed events */
621 struct sctp_timer delete_prim_timer; /* deleting primary dst */
623 /* list of restricted local addresses */
624 struct sctpladdr sctp_restricted_addrs;
626 /* last local address pending deletion (waiting for an address add) */
627 struct sctp_ifa *asconf_addr_del_pending;
628 /* Deleted primary destination (used to stop timer) */
629 struct sctp_nets *deleted_primary;
631 struct sctpnetlisthead nets; /* remote address list */
633 /* Free chunk list */
634 struct sctpchunk_listhead free_chunks;
636 /* Control chunk queue */
637 struct sctpchunk_listhead control_send_queue;
639 /* ASCONF chunk queue */
640 struct sctpchunk_listhead asconf_send_queue;
643 * Once a TSN hits the wire it is moved to the sent_queue. We
644 * maintain two counts here (don't know if any but retran_cnt is
645 * needed). The idea is that the sent_queue_retran_cnt reflects how
646 * many chunks have been marked for retranmission by either T3-rxt
649 struct sctpchunk_listhead sent_queue;
650 struct sctpchunk_listhead send_queue;
652 /* re-assembly queue for fragmented chunks on the inbound path */
653 struct sctpchunk_listhead reasmqueue;
656 * this queue is used when we reach a condition that we can NOT put
657 * data into the socket buffer. We track the size of this queue and
658 * set our rwnd to the space in the socket minus also the
659 * size_on_delivery_queue.
661 struct sctpwheel_listhead out_wheel;
664 * This pointer will be set to NULL most of the time. But when we
665 * have a fragmented message, where we could not get out all of the
666 * message at the last send then this will point to the stream to go
669 struct sctp_stream_out *locked_on_sending;
671 /* If an iterator is looking at me, this is it */
672 struct sctp_iterator *stcb_starting_point_for_iterator;
674 /* ASCONF save the last ASCONF-ACK so we can resend it if necessary */
675 struct sctp_asconf_ackhead asconf_ack_sent;
678 * pointer to last stream reset queued to control queue by us with
681 struct sctp_tmit_chunk *str_reset;
683 * if Source Address Selection happening, this will rotate through
686 struct sctp_laddr *last_used_address;
689 struct sctp_stream_in *strmin;
690 struct sctp_stream_out *strmout;
691 uint8_t *mapping_array;
692 /* primary destination to use */
693 struct sctp_nets *primary_destination;
695 struct sctp_nets *last_net_cmt_send_started;
696 /* last place I got a data chunk from */
697 struct sctp_nets *last_data_chunk_from;
698 /* last place I got a control from */
699 struct sctp_nets *last_control_chunk_from;
701 /* circular looking for output selection */
702 struct sctp_stream_out *last_out_stream;
705 * wait to the point the cum-ack passes req->send_reset_at_tsn for
706 * any req on the list.
708 struct sctp_resethead resetHead;
710 /* queue of chunks waiting to be sent into the local stack */
711 struct sctp_readhead pending_reply_queue;
713 /* JRS - the congestion control functions are in this struct */
714 struct sctp_cc_functions cc_functions;
716 * JRS - value to store the currently loaded congestion control
719 uint32_t congestion_control_module;
723 uint32_t cookie_preserve_req;
724 /* ASCONF next seq I am sending out, inits at init-tsn */
725 uint32_t asconf_seq_out;
726 uint32_t asconf_seq_out_acked;
727 /* ASCONF last received ASCONF from peer, starts at peer's TSN-1 */
728 uint32_t asconf_seq_in;
730 /* next seq I am sending in str reset messages */
731 uint32_t str_reset_seq_out;
732 /* next seq I am expecting in str reset messages */
733 uint32_t str_reset_seq_in;
735 /* various verification tag information */
736 uint32_t my_vtag; /* The tag to be used. if assoc is re-initited
737 * by remote end, and I have unlocked this
738 * will be regenerated to a new random value. */
739 uint32_t peer_vtag; /* The peers last tag */
741 uint32_t my_vtag_nonce;
742 uint32_t peer_vtag_nonce;
746 /* This is the SCTP fragmentation threshold */
747 uint32_t smallest_mtu;
750 * Special hook for Fast retransmit, allows us to track the highest
751 * TSN that is NEW in this SACK if gap ack blocks are present.
753 uint32_t this_sack_highest_gap;
756 * The highest consecutive TSN that has been acked by peer on my
759 uint32_t last_acked_seq;
761 /* The next TSN that I will use in sending. */
762 uint32_t sending_seq;
764 /* Original seq number I used ??questionable to keep?? */
765 uint32_t init_seq_number;
768 /* The Advanced Peer Ack Point, as required by the PR-SCTP */
769 /* (A1 in Section 4.2) */
770 uint32_t advanced_peer_ack_point;
773 * The highest consequetive TSN at the bottom of the mapping array
776 uint32_t cumulative_tsn;
778 * Used to track the mapping array and its offset bits. This MAY be
779 * lower then cumulative_tsn.
781 uint32_t mapping_array_base_tsn;
783 * used to track highest TSN we have received and is listed in the
786 uint32_t highest_tsn_inside_map;
788 /* EY - new NR variables used for nr_sack based on mapping_array */
789 uint8_t *nr_mapping_array;
790 uint32_t highest_tsn_inside_nr_map;
792 uint32_t last_echo_tsn;
793 uint32_t last_cwr_tsn;
794 uint32_t fast_recovery_tsn;
795 uint32_t sat_t3_recovery_tsn;
796 uint32_t tsn_last_delivered;
798 * For the pd-api we should re-write this a bit more efficent. We
799 * could have multiple sctp_queued_to_read's that we are building at
800 * once. Now we only do this when we get ready to deliver to the
801 * socket buffer. Note that we depend on the fact that the struct is
802 * "stuck" on the read queue until we finish all the pd-api.
804 struct sctp_queued_to_read *control_pdapi;
806 uint32_t tsn_of_pdapi_last_delivered;
809 uint32_t last_reset_action[SCTP_MAX_RESET_PARAMS];
810 uint32_t last_sending_seq[SCTP_MAX_RESET_PARAMS];
811 uint32_t last_base_tsnsent[SCTP_MAX_RESET_PARAMS];
812 #ifdef SCTP_ASOCLOG_OF_TSNS
814 * special log - This adds considerable size to the asoc, but
815 * provides a log that you can use to detect problems via kgdb.
817 struct sctp_tsn_log in_tsnlog[SCTP_TSN_LOG_SIZE];
818 struct sctp_tsn_log out_tsnlog[SCTP_TSN_LOG_SIZE];
819 uint32_t cumack_log[SCTP_TSN_LOG_SIZE];
820 uint32_t cumack_logsnt[SCTP_TSN_LOG_SIZE];
823 uint16_t tsn_in_wrapped;
824 uint16_t tsn_out_wrapped;
825 uint16_t cumack_log_at;
826 uint16_t cumack_log_atsnt;
827 #endif /* SCTP_ASOCLOG_OF_TSNS */
828 #ifdef SCTP_FS_SPEC_LOG
829 struct sctp_fs_spec_log fslog[SCTP_FS_SPEC_LOG_SIZE];
834 * window state information and smallest MTU that I use to bound
839 uint32_t my_last_reported_rwnd;
840 uint32_t sctp_frag_point;
842 uint32_t total_output_queue_size;
844 uint32_t sb_cc; /* shadow of sb_cc */
845 uint32_t sb_send_resv; /* amount reserved on a send */
846 uint32_t my_rwnd_control_len; /* shadow of sb_mbcnt used for rwnd
848 /* 32 bit nonce stuff */
849 uint32_t nonce_resync_tsn;
850 uint32_t nonce_wait_tsn;
851 uint32_t default_flowlabel;
852 uint32_t pr_sctp_cnt;
853 int ctrl_queue_cnt; /* could be removed REM */
855 * All outbound datagrams queue into this list from the individual
856 * stream queue. Here they get assigned a TSN and then await
857 * sending. The stream seq comes when it is first put in the
858 * individual str queue
860 unsigned int stream_queue_cnt;
861 unsigned int send_queue_cnt;
862 unsigned int sent_queue_cnt;
863 unsigned int sent_queue_cnt_removeable;
865 * Number on sent queue that are marked for retran until this value
866 * is 0 we only send one packet of retran'ed data.
868 unsigned int sent_queue_retran_cnt;
870 unsigned int size_on_reasm_queue;
871 unsigned int cnt_on_reasm_queue;
872 /* amount of data (bytes) currently in flight (on all destinations) */
873 unsigned int total_flight;
874 /* Total book size in flight */
875 unsigned int total_flight_count; /* count of chunks used with
877 /* count of destinaton nets and list of destination nets */
878 unsigned int numnets;
880 /* Total error count on this association */
881 unsigned int overall_error_count;
883 unsigned int cnt_msg_on_sb;
885 /* All stream count of chunks for delivery */
886 unsigned int size_on_all_streams;
887 unsigned int cnt_on_all_streams;
889 /* Heart Beat delay in ticks */
890 unsigned int heart_beat_delay;
893 unsigned int sctp_autoclose_ticks;
895 /* how many preopen streams we have */
896 unsigned int pre_open_streams;
898 /* How many streams I support coming into me */
899 unsigned int max_inbound_streams;
901 /* the cookie life I award for any cookie, in seconds */
902 unsigned int cookie_life;
903 /* time to delay acks for */
904 unsigned int delayed_ack;
905 unsigned int old_delayed_ack;
906 unsigned int sack_freq;
907 unsigned int data_pkts_seen;
909 unsigned int numduptsns;
910 int dup_tsns[SCTP_MAX_DUP_TSNS];
911 unsigned int initial_init_rto_max; /* initial RTO for INIT's */
912 unsigned int initial_rto; /* initial send RTO */
913 unsigned int minrto; /* per assoc RTO-MIN */
914 unsigned int maxrto; /* per assoc RTO-MAX */
916 /* authentication fields */
917 sctp_auth_chklist_t *local_auth_chunks;
918 sctp_auth_chklist_t *peer_auth_chunks;
919 sctp_hmaclist_t *local_hmacs; /* local HMACs supported */
920 sctp_hmaclist_t *peer_hmacs; /* peer HMACs supported */
921 struct sctp_keyhead shared_keys; /* assoc's shared keys */
922 sctp_authinfo_t authinfo; /* randoms, cached keys */
924 * refcnt to block freeing when a sender or receiver is off coping
928 uint32_t chunks_on_out_queue; /* total chunks floating around,
929 * locked by send socket buffer */
930 uint32_t peers_adaptation;
931 uint16_t peer_hmac_id; /* peer HMAC id to send */
934 * Being that we have no bag to collect stale cookies, and that we
935 * really would not want to anyway.. we will count them in this
936 * counter. We of course feed them to the pigeons right away (I have
937 * always thought of pigeons as flying rats).
939 uint16_t stale_cookie_count;
942 * For the partial delivery API, if up, invoked this is what last
945 uint16_t str_of_pdapi;
946 uint16_t ssn_of_pdapi;
948 /* counts of actual built streams. Allocation may be more however */
949 /* could re-arrange to optimize space here. */
950 uint16_t streamincnt;
951 uint16_t streamoutcnt;
952 uint16_t strm_realoutsize;
953 /* my maximum number of retrans of INIT and SEND */
954 /* copied from SCTP but should be individually setable */
955 uint16_t max_init_times;
956 uint16_t max_send_times;
958 uint16_t def_net_failure;
961 * lock flag: 0 is ok to send, 1+ (duals as a retran count) is
964 uint16_t mapping_array_size;
966 uint16_t last_strm_seq_delivered;
967 uint16_t last_strm_no_delivered;
969 uint16_t last_revoke_count;
970 int16_t num_send_timers_up;
972 uint16_t stream_locked_on;
973 uint16_t ecn_echo_cnt_onq;
975 uint16_t free_chunk_cnt;
977 uint8_t stream_locked;
978 uint8_t authenticated; /* packet authenticated ok */
980 * This flag indicates that a SACK need to be sent. Initially this
981 * is 1 to send the first sACK immediately.
985 /* max burst after fast retransmit completes */
988 uint8_t sat_network; /* RTT is in range of sat net or greater */
989 uint8_t sat_network_lockout; /* lockout code */
990 uint8_t burst_limit_applied; /* Burst limit in effect at last send? */
991 /* flag goes on when we are doing a partial delivery api */
992 uint8_t hb_random_values[4];
993 uint8_t fragmented_delivery_inprogress;
994 uint8_t fragment_flags;
995 uint8_t last_flags_delivered;
996 uint8_t hb_ect_randombit;
997 uint8_t hb_random_idx;
998 uint8_t hb_is_disabled; /* is the hb disabled? */
1000 uint8_t asconf_del_pending; /* asconf delete last addr pending */
1002 /* ECN Nonce stuff */
1003 uint8_t receiver_nonce_sum; /* nonce I sum and put in my sack */
1004 uint8_t ecn_nonce_allowed; /* Tells us if ECN nonce is on */
1005 uint8_t nonce_sum_check;/* On off switch used during re-sync */
1006 uint8_t nonce_wait_for_ecne; /* flag when we expect a ECN */
1007 uint8_t peer_supports_ecn_nonce;
1010 * This value, plus all other ack'd but above cum-ack is added
1011 * together to cross check against the bit that we have yet to
1012 * define (probably in the SACK). When the cum-ack is updated, this
1013 * sum is updated as well.
1015 uint8_t nonce_sum_expect_base;
1016 /* Flag to tell if ECN is allowed */
1017 uint8_t ecn_allowed;
1019 /* flag to indicate if peer can do asconf */
1020 uint8_t peer_supports_asconf;
1021 /* EY - flag to indicate if peer can do nr_sack */
1022 uint8_t peer_supports_nr_sack;
1023 /* pr-sctp support flag */
1024 uint8_t peer_supports_prsctp;
1025 /* peer authentication support flag */
1026 uint8_t peer_supports_auth;
1027 /* stream resets are supported by the peer */
1028 uint8_t peer_supports_strreset;
1030 uint8_t peer_supports_nat;
1032 * packet drop's are supported by the peer, we don't really care
1033 * about this but we bookkeep it anyway.
1035 uint8_t peer_supports_pktdrop;
1037 /* Do we allow V6/V4? */
1038 uint8_t ipv4_addr_legal;
1039 uint8_t ipv6_addr_legal;
1040 /* Address scoping flags */
1041 /* scope value for IPv4 */
1042 uint8_t ipv4_local_scope;
1043 /* scope values for IPv6 */
1044 uint8_t local_scope;
1046 /* loopback scope */
1047 uint8_t loopback_scope;
1048 /* flags to handle send alternate net tracking */
1049 uint8_t used_alt_onsack;
1050 uint8_t used_alt_asconfack;
1051 uint8_t fast_retran_loss_recovery;
1052 uint8_t sat_t3_loss_recovery;
1053 uint8_t dropped_special_cnt;
1054 uint8_t seen_a_sack_this_pkt;
1055 uint8_t stream_reset_outstanding;
1056 uint8_t stream_reset_out_is_outstanding;
1057 uint8_t delayed_connection;
1058 uint8_t ifp_had_enobuf;
1059 uint8_t saw_sack_with_frags;
1060 uint8_t in_asocid_hash;
1061 uint8_t assoc_up_sent;
1062 uint8_t adaptation_needed;
1063 uint8_t adaptation_sent;
1065 uint8_t cmt_dac_pkts_rcvd;
1066 uint8_t sctp_cmt_on_off;
1067 uint8_t iam_blocking;
1068 uint8_t cookie_how[8];
1069 /* EY 05/05/08 - NR_SACK variable */
1070 uint8_t sctp_nr_sack_on_off;
1071 /* JRS 5/21/07 - CMT PF variable */
1072 uint8_t sctp_cmt_pf;
1074 * The mapping array is used to track out of order sequences above
1075 * last_acked_seq. 0 indicates packet missing 1 indicates packet
1076 * rec'd. We slide it up every time we raise last_acked_seq and 0
1077 * trailing locactions out. If I get a TSN above the array
1078 * mappingArraySz, I discard the datagram and let retransmit happen.
1080 uint32_t marked_retrans;
1084 uint32_t timoshutdown;
1085 uint32_t timoheartbeat;
1086 uint32_t timocookie;
1087 uint32_t timoshutdownack;
1088 struct timeval start_time;
1089 struct timeval discontinuity_time;