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