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