xref: /freebsd/sys/netinet/sctp_structs.h (revision 830d754d52dd67ff5faaae2ed2034e92ea490715)
1f8829a4aSRandall Stewart /*-
2830d754dSRandall Stewart  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
3f8829a4aSRandall Stewart  *
4f8829a4aSRandall Stewart  * Redistribution and use in source and binary forms, with or without
5f8829a4aSRandall Stewart  * modification, are permitted provided that the following conditions are met:
6f8829a4aSRandall Stewart  *
7f8829a4aSRandall Stewart  * a) Redistributions of source code must retain the above copyright notice,
8f8829a4aSRandall Stewart  *   this list of conditions and the following disclaimer.
9f8829a4aSRandall Stewart  *
10f8829a4aSRandall Stewart  * b) Redistributions in binary form must reproduce the above copyright
11f8829a4aSRandall Stewart  *    notice, this list of conditions and the following disclaimer in
12f8829a4aSRandall Stewart  *   the documentation and/or other materials provided with the distribution.
13f8829a4aSRandall Stewart  *
14f8829a4aSRandall Stewart  * c) Neither the name of Cisco Systems, Inc. nor the names of its
15f8829a4aSRandall Stewart  *    contributors may be used to endorse or promote products derived
16f8829a4aSRandall Stewart  *    from this software without specific prior written permission.
17f8829a4aSRandall Stewart  *
18f8829a4aSRandall Stewart  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19f8829a4aSRandall Stewart  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20f8829a4aSRandall Stewart  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21f8829a4aSRandall Stewart  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22f8829a4aSRandall Stewart  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23f8829a4aSRandall Stewart  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24f8829a4aSRandall Stewart  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25f8829a4aSRandall Stewart  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26f8829a4aSRandall Stewart  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27f8829a4aSRandall Stewart  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28f8829a4aSRandall Stewart  * THE POSSIBILITY OF SUCH DAMAGE.
29f8829a4aSRandall Stewart  */
30f8829a4aSRandall Stewart 
31f8829a4aSRandall Stewart /* $KAME: sctp_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $	 */
32f8829a4aSRandall Stewart 
33f8829a4aSRandall Stewart #include <sys/cdefs.h>
34f8829a4aSRandall Stewart __FBSDID("$FreeBSD$");
35f8829a4aSRandall Stewart 
36f8829a4aSRandall Stewart #ifndef __sctp_structs_h__
37f8829a4aSRandall Stewart #define __sctp_structs_h__
38f8829a4aSRandall Stewart 
39139bc87fSRandall Stewart #include <netinet/sctp_os.h>
40f8829a4aSRandall Stewart #include <netinet/sctp_header.h>
41f8829a4aSRandall Stewart #include <netinet/sctp_auth.h>
42f8829a4aSRandall Stewart 
43f8829a4aSRandall Stewart struct sctp_timer {
44139bc87fSRandall Stewart 	sctp_os_timer_t timer;
45139bc87fSRandall Stewart 
46f8829a4aSRandall Stewart 	int type;
47f8829a4aSRandall Stewart 	/*
48f8829a4aSRandall Stewart 	 * Depending on the timer type these will be setup and cast with the
49f8829a4aSRandall Stewart 	 * appropriate entity.
50f8829a4aSRandall Stewart 	 */
51f8829a4aSRandall Stewart 	void *ep;
52f8829a4aSRandall Stewart 	void *tcb;
53f8829a4aSRandall Stewart 	void *net;
54f8829a4aSRandall Stewart 
55f8829a4aSRandall Stewart 	/* for sanity checking */
56f8829a4aSRandall Stewart 	void *self;
57f8829a4aSRandall Stewart 	uint32_t ticks;
58a5d547adSRandall Stewart 	uint32_t stopped_from;
59f8829a4aSRandall Stewart };
60f8829a4aSRandall Stewart 
61f8829a4aSRandall Stewart 
62a5d547adSRandall Stewart struct sctp_foo_stuff {
63a5d547adSRandall Stewart 	struct sctp_inpcb *inp;
64a5d547adSRandall Stewart 	uint32_t lineno;
65a5d547adSRandall Stewart 	uint32_t ticks;
66a5d547adSRandall Stewart 	int updown;
67a5d547adSRandall Stewart };
68a5d547adSRandall Stewart 
69f8829a4aSRandall Stewart 
70f8829a4aSRandall Stewart /*
71f8829a4aSRandall Stewart  * This is the information we track on each interface that we know about from
72f8829a4aSRandall Stewart  * the distant end.
73f8829a4aSRandall Stewart  */
74f8829a4aSRandall Stewart TAILQ_HEAD(sctpnetlisthead, sctp_nets);
75f8829a4aSRandall Stewart 
76f8829a4aSRandall Stewart struct sctp_stream_reset_list {
77f8829a4aSRandall Stewart 	TAILQ_ENTRY(sctp_stream_reset_list) next_resp;
78f8829a4aSRandall Stewart 	uint32_t tsn;
79f8829a4aSRandall Stewart 	int number_entries;
80f8829a4aSRandall Stewart 	struct sctp_stream_reset_out_request req;
81f8829a4aSRandall Stewart };
82f8829a4aSRandall Stewart 
83f8829a4aSRandall Stewart TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list);
84f8829a4aSRandall Stewart 
85f8829a4aSRandall Stewart /*
86f8829a4aSRandall Stewart  * Users of the iterator need to malloc a iterator with a call to
8742551e99SRandall Stewart  * sctp_initiate_iterator(inp_func, assoc_func, inp_func,  pcb_flags, pcb_features,
88f8829a4aSRandall Stewart  *     asoc_state, void-ptr-arg, uint32-arg, end_func, inp);
89f8829a4aSRandall Stewart  *
90f8829a4aSRandall Stewart  * Use the following two defines if you don't care what pcb flags are on the EP
91f8829a4aSRandall Stewart  * and/or you don't care what state the association is in.
92f8829a4aSRandall Stewart  *
93f8829a4aSRandall Stewart  * Note that if you specify an INP as the last argument then ONLY each
94f8829a4aSRandall Stewart  * association of that single INP will be executed upon. Note that the pcb
95f8829a4aSRandall Stewart  * flags STILL apply so if the inp you specify has different pcb_flags then
96f8829a4aSRandall Stewart  * what you put in pcb_flags nothing will happen. use SCTP_PCB_ANY_FLAGS to
97f8829a4aSRandall Stewart  * assure the inp you specify gets treated.
98f8829a4aSRandall Stewart  */
99f8829a4aSRandall Stewart #define SCTP_PCB_ANY_FLAGS	0x00000000
100f8829a4aSRandall Stewart #define SCTP_PCB_ANY_FEATURES	0x00000000
101f8829a4aSRandall Stewart #define SCTP_ASOC_ANY_STATE	0x00000000
102f8829a4aSRandall Stewart 
103f8829a4aSRandall Stewart typedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr,
104f8829a4aSRandall Stewart          uint32_t val);
10542551e99SRandall Stewart typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val);
106f8829a4aSRandall Stewart typedef void (*end_func) (void *ptr, uint32_t val);
107f8829a4aSRandall Stewart 
108f8829a4aSRandall Stewart struct sctp_iterator {
10942551e99SRandall Stewart 	TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr;
110f8829a4aSRandall Stewart 	struct sctp_timer tmr;
111f8829a4aSRandall Stewart 	struct sctp_inpcb *inp;	/* current endpoint */
112f8829a4aSRandall Stewart 	struct sctp_tcb *stcb;	/* current* assoc */
113f8829a4aSRandall Stewart 	asoc_func function_assoc;	/* per assoc function */
114f8829a4aSRandall Stewart 	inp_func function_inp;	/* per endpoint function */
11542551e99SRandall Stewart 	inp_func function_inp_end;	/* end INP function */
116f8829a4aSRandall Stewart 	end_func function_atend;/* iterator completion function */
117f8829a4aSRandall Stewart 	void *pointer;		/* pointer for apply func to use */
118f8829a4aSRandall Stewart 	uint32_t val;		/* value for apply func to use */
119f8829a4aSRandall Stewart 	uint32_t pcb_flags;	/* endpoint flags being checked */
120f8829a4aSRandall Stewart 	uint32_t pcb_features;	/* endpoint features being checked */
121f8829a4aSRandall Stewart 	uint32_t asoc_state;	/* assoc state being checked */
122f8829a4aSRandall Stewart 	uint32_t iterator_flags;
123f8829a4aSRandall Stewart 	uint8_t no_chunk_output;
12442551e99SRandall Stewart 	uint8_t done_current_ep;
125f8829a4aSRandall Stewart };
126f8829a4aSRandall Stewart 
127f8829a4aSRandall Stewart /* iterator_flags values */
128f8829a4aSRandall Stewart #define SCTP_ITERATOR_DO_ALL_INP	0x00000001
129f8829a4aSRandall Stewart #define SCTP_ITERATOR_DO_SINGLE_INP	0x00000002
130f8829a4aSRandall Stewart 
13142551e99SRandall Stewart TAILQ_HEAD(sctpiterators, sctp_iterator);
132f8829a4aSRandall Stewart 
133f8829a4aSRandall Stewart struct sctp_copy_all {
134f8829a4aSRandall Stewart 	struct sctp_inpcb *inp;	/* ep */
135f8829a4aSRandall Stewart 	struct mbuf *m;
136f8829a4aSRandall Stewart 	struct sctp_sndrcvinfo sndrcv;
137f8829a4aSRandall Stewart 	int sndlen;
138f8829a4aSRandall Stewart 	int cnt_sent;
139f8829a4aSRandall Stewart 	int cnt_failed;
140f8829a4aSRandall Stewart };
141f8829a4aSRandall Stewart 
14242551e99SRandall Stewart struct sctp_asconf_iterator {
14342551e99SRandall Stewart 	struct sctpladdr list_of_work;
14442551e99SRandall Stewart 	int cnt;
14542551e99SRandall Stewart };
14642551e99SRandall Stewart 
14717205eccSRandall Stewart struct sctp_net_route {
14817205eccSRandall Stewart 	sctp_rtentry_t *ro_rt;
14917205eccSRandall Stewart 	union sctp_sockstore _l_addr;	/* remote peer addr */
15017205eccSRandall Stewart 	struct sctp_ifa *_s_addr;	/* our selected src addr */
15117205eccSRandall Stewart };
15217205eccSRandall Stewart 
153b54d3a6cSRandall Stewart struct htcp {
154b54d3a6cSRandall Stewart 	uint16_t alpha;		/* Fixed point arith, << 7 */
155b54d3a6cSRandall Stewart 	uint8_t beta;		/* Fixed point arith, << 7 */
156b54d3a6cSRandall Stewart 	uint8_t modeswitch;	/* Delay modeswitch until we had at least one
157b54d3a6cSRandall Stewart 				 * congestion event */
158b54d3a6cSRandall Stewart 	uint32_t last_cong;	/* Time since last congestion event end */
159b54d3a6cSRandall Stewart 	uint32_t undo_last_cong;
160b54d3a6cSRandall Stewart 	uint16_t bytes_acked;
161b54d3a6cSRandall Stewart 	uint32_t bytecount;
162b54d3a6cSRandall Stewart 	uint32_t minRTT;
163b54d3a6cSRandall Stewart 	uint32_t maxRTT;
164b54d3a6cSRandall Stewart 
165b54d3a6cSRandall Stewart 	uint32_t undo_maxRTT;
166b54d3a6cSRandall Stewart 	uint32_t undo_old_maxB;
167b54d3a6cSRandall Stewart 
168b54d3a6cSRandall Stewart 	/* Bandwidth estimation */
169b54d3a6cSRandall Stewart 	uint32_t minB;
170b54d3a6cSRandall Stewart 	uint32_t maxB;
171b54d3a6cSRandall Stewart 	uint32_t old_maxB;
172b54d3a6cSRandall Stewart 	uint32_t Bi;
173b54d3a6cSRandall Stewart 	uint32_t lasttime;
174b54d3a6cSRandall Stewart };
175b54d3a6cSRandall Stewart 
176b54d3a6cSRandall Stewart 
177f8829a4aSRandall Stewart struct sctp_nets {
178f8829a4aSRandall Stewart 	TAILQ_ENTRY(sctp_nets) sctp_next;	/* next link */
179f8829a4aSRandall Stewart 
180f8829a4aSRandall Stewart 	/*
181f8829a4aSRandall Stewart 	 * Things on the top half may be able to be split into a common
182f8829a4aSRandall Stewart 	 * structure shared by all.
183f8829a4aSRandall Stewart 	 */
184f8829a4aSRandall Stewart 	struct sctp_timer pmtu_timer;
185f8829a4aSRandall Stewart 
186f8829a4aSRandall Stewart 	/*
187f8829a4aSRandall Stewart 	 * The following two in combination equate to a route entry for v6
188f8829a4aSRandall Stewart 	 * or v4.
189f8829a4aSRandall Stewart 	 */
19017205eccSRandall Stewart 	struct sctp_net_route ro;
19117205eccSRandall Stewart 
192f8829a4aSRandall Stewart 	/* mtu discovered so far */
193f8829a4aSRandall Stewart 	uint32_t mtu;
194f8829a4aSRandall Stewart 	uint32_t ssthresh;	/* not sure about this one for split */
195f8829a4aSRandall Stewart 
196f8829a4aSRandall Stewart 	/* smoothed average things for RTT and RTO itself */
197f8829a4aSRandall Stewart 	int lastsa;
198f8829a4aSRandall Stewart 	int lastsv;
199f8829a4aSRandall Stewart 	unsigned int RTO;
200f8829a4aSRandall Stewart 
201f8829a4aSRandall Stewart 	/* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */
202f8829a4aSRandall Stewart 	struct sctp_timer rxt_timer;
203f8829a4aSRandall Stewart 	struct sctp_timer fr_timer;	/* for early fr */
204f8829a4aSRandall Stewart 
205f8829a4aSRandall Stewart 	/* last time in seconds I sent to it */
206f8829a4aSRandall Stewart 	struct timeval last_sent_time;
207f8829a4aSRandall Stewart 	int ref_count;
208f8829a4aSRandall Stewart 
209f8829a4aSRandall Stewart 	/* Congestion stats per destination */
210f8829a4aSRandall Stewart 	/*
211f8829a4aSRandall Stewart 	 * flight size variables and such, sorry Vern, I could not avoid
212f8829a4aSRandall Stewart 	 * this if I wanted performance :>
213f8829a4aSRandall Stewart 	 */
214f8829a4aSRandall Stewart 	uint32_t flight_size;
215f8829a4aSRandall Stewart 	uint32_t cwnd;		/* actual cwnd */
216f8829a4aSRandall Stewart 	uint32_t prev_cwnd;	/* cwnd before any processing */
217f8829a4aSRandall Stewart 	uint32_t partial_bytes_acked;	/* in CA tracks when to incr a MTU */
218f8829a4aSRandall Stewart 	uint32_t prev_rtt;
219f8829a4aSRandall Stewart 	/* tracking variables to avoid the aloc/free in sack processing */
220f8829a4aSRandall Stewart 	unsigned int net_ack;
221f8829a4aSRandall Stewart 	unsigned int net_ack2;
222f8829a4aSRandall Stewart 
223f8829a4aSRandall Stewart 	/*
224b54d3a6cSRandall Stewart 	 * JRS - 5/8/07 - Variable to track last time a destination was
225b54d3a6cSRandall Stewart 	 * active for CMT PF
226b54d3a6cSRandall Stewart 	 */
227b54d3a6cSRandall Stewart 	uint32_t last_active;
228b54d3a6cSRandall Stewart 
229b54d3a6cSRandall Stewart 	/*
230f8829a4aSRandall Stewart 	 * CMT variables (iyengar@cis.udel.edu)
231f8829a4aSRandall Stewart 	 */
232f8829a4aSRandall Stewart 	uint32_t this_sack_highest_newack;	/* tracks highest TSN newly
233f8829a4aSRandall Stewart 						 * acked for a given dest in
234f8829a4aSRandall Stewart 						 * the current SACK. Used in
235f8829a4aSRandall Stewart 						 * SFR and HTNA algos */
236f8829a4aSRandall Stewart 	uint32_t pseudo_cumack;	/* CMT CUC algorithm. Maintains next expected
237f8829a4aSRandall Stewart 				 * pseudo-cumack for this destination */
238f8829a4aSRandall Stewart 	uint32_t rtx_pseudo_cumack;	/* CMT CUC algorithm. Maintains next
239f8829a4aSRandall Stewart 					 * expected pseudo-cumack for this
240f8829a4aSRandall Stewart 					 * destination */
241f8829a4aSRandall Stewart 
242f8829a4aSRandall Stewart 	/* CMT fast recovery variables */
243f8829a4aSRandall Stewart 	uint32_t fast_recovery_tsn;
244f8829a4aSRandall Stewart 	uint32_t heartbeat_random1;
245f8829a4aSRandall Stewart 	uint32_t heartbeat_random2;
246f8829a4aSRandall Stewart 	uint32_t tos_flowlabel;
247f8829a4aSRandall Stewart 
2485e54f665SRandall Stewart 	struct timeval start_time;	/* time when this net was created */
2495e54f665SRandall Stewart 
2505e54f665SRandall Stewart 	uint32_t marked_retrans;/* number or DATA chunks marked for timer
2515e54f665SRandall Stewart 				 * based retransmissions */
2525e54f665SRandall Stewart 	uint32_t marked_fastretrans;
2535e54f665SRandall Stewart 
254f8829a4aSRandall Stewart 	/* if this guy is ok or not ... status */
255f8829a4aSRandall Stewart 	uint16_t dest_state;
256f8829a4aSRandall Stewart 	/* number of transmit failures to down this guy */
257f8829a4aSRandall Stewart 	uint16_t failure_threshold;
258f8829a4aSRandall Stewart 	/* error stats on destination */
259f8829a4aSRandall Stewart 	uint16_t error_count;
260c54a18d2SRandall Stewart 	/* UDP port number in case of UDP tunneling */
261c54a18d2SRandall Stewart 	uint16_t port;
262f8829a4aSRandall Stewart 
263f8829a4aSRandall Stewart 	uint8_t fast_retran_loss_recovery;
264f8829a4aSRandall Stewart 	uint8_t will_exit_fast_recovery;
265f8829a4aSRandall Stewart 	/* Flags that probably can be combined into dest_state */
266f8829a4aSRandall Stewart 	uint8_t fast_retran_ip;	/* fast retransmit in progress */
267f8829a4aSRandall Stewart 	uint8_t hb_responded;
268f8829a4aSRandall Stewart 	uint8_t saw_newack;	/* CMT's SFR algorithm flag */
269f8829a4aSRandall Stewart 	uint8_t src_addr_selected;	/* if we split we move */
270f8829a4aSRandall Stewart 	uint8_t indx_of_eligible_next_to_use;
271f8829a4aSRandall Stewart 	uint8_t addr_is_local;	/* its a local address (if known) could move
272f8829a4aSRandall Stewart 				 * in split */
273f8829a4aSRandall Stewart 
274f8829a4aSRandall Stewart 	/*
275f8829a4aSRandall Stewart 	 * CMT variables (iyengar@cis.udel.edu)
276f8829a4aSRandall Stewart 	 */
277f8829a4aSRandall Stewart 	uint8_t find_pseudo_cumack;	/* CMT CUC algorithm. Flag used to
278f8829a4aSRandall Stewart 					 * find a new pseudocumack. This flag
279f8829a4aSRandall Stewart 					 * is set after a new pseudo-cumack
280f8829a4aSRandall Stewart 					 * has been received and indicates
281f8829a4aSRandall Stewart 					 * that the sender should find the
282f8829a4aSRandall Stewart 					 * next pseudo-cumack expected for
283f8829a4aSRandall Stewart 					 * this destination */
284f8829a4aSRandall Stewart 	uint8_t find_rtx_pseudo_cumack;	/* CMT CUCv2 algorithm. Flag used to
285f8829a4aSRandall Stewart 					 * find a new rtx-pseudocumack. This
286f8829a4aSRandall Stewart 					 * flag is set after a new
287f8829a4aSRandall Stewart 					 * rtx-pseudo-cumack has been received
288f8829a4aSRandall Stewart 					 * and indicates that the sender
289f8829a4aSRandall Stewart 					 * should find the next
290f8829a4aSRandall Stewart 					 * rtx-pseudo-cumack expected for this
291f8829a4aSRandall Stewart 					 * destination */
292f8829a4aSRandall Stewart 	uint8_t new_pseudo_cumack;	/* CMT CUC algorithm. Flag used to
293f8829a4aSRandall Stewart 					 * indicate if a new pseudo-cumack or
294f8829a4aSRandall Stewart 					 * rtx-pseudo-cumack has been received */
2955e54f665SRandall Stewart 	uint8_t window_probe;	/* Doing a window probe? */
2969a972525SRandall Stewart 	uint8_t RTO_measured;	/* Have we done the first measure */
297f8829a4aSRandall Stewart 	uint8_t last_hs_used;	/* index into the last HS table entry we used */
298b54d3a6cSRandall Stewart 	/* JRS - struct used in HTCP algorithm */
299b54d3a6cSRandall Stewart 	struct htcp htcp_ca;
300f8829a4aSRandall Stewart };
301f8829a4aSRandall Stewart 
302f8829a4aSRandall Stewart 
303f8829a4aSRandall Stewart struct sctp_data_chunkrec {
304f8829a4aSRandall Stewart 	uint32_t TSN_seq;	/* the TSN of this transmit */
305f8829a4aSRandall Stewart 	uint16_t stream_seq;	/* the stream sequence number of this transmit */
306f8829a4aSRandall Stewart 	uint16_t stream_number;	/* the stream number of this guy */
307f8829a4aSRandall Stewart 	uint32_t payloadtype;
308f8829a4aSRandall Stewart 	uint32_t context;	/* from send */
309f8829a4aSRandall Stewart 
310f8829a4aSRandall Stewart 	/* ECN Nonce: Nonce Value for this chunk */
311f8829a4aSRandall Stewart 	uint8_t ect_nonce;
312f8829a4aSRandall Stewart 
313f8829a4aSRandall Stewart 	/*
314f8829a4aSRandall Stewart 	 * part of the Highest sacked algorithm to be able to stroke counts
315f8829a4aSRandall Stewart 	 * on ones that are FR'd.
316f8829a4aSRandall Stewart 	 */
317f8829a4aSRandall Stewart 	uint32_t fast_retran_tsn;	/* sending_seq at the time of FR */
318f8829a4aSRandall Stewart 	struct timeval timetodrop;	/* time we drop it from queue */
319f8829a4aSRandall Stewart 	uint8_t doing_fast_retransmit;
320f8829a4aSRandall Stewart 	uint8_t rcv_flags;	/* flags pulled from data chunk on inbound for
321a5d547adSRandall Stewart 				 * outbound holds sending flags for PR-SCTP. */
322f8829a4aSRandall Stewart 	uint8_t state_flags;
323f8829a4aSRandall Stewart 	uint8_t chunk_was_revoked;
324f8829a4aSRandall Stewart };
325f8829a4aSRandall Stewart 
326f8829a4aSRandall Stewart TAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk);
327f8829a4aSRandall Stewart 
328f8829a4aSRandall Stewart /* The lower byte is used to enumerate PR_SCTP policies */
329f8829a4aSRandall Stewart #define CHUNK_FLAGS_PR_SCTP_TTL	        SCTP_PR_SCTP_TTL
330f8829a4aSRandall Stewart #define CHUNK_FLAGS_PR_SCTP_BUF	        SCTP_PR_SCTP_BUF
331f8829a4aSRandall Stewart #define CHUNK_FLAGS_PR_SCTP_RTX         SCTP_PR_SCTP_RTX
332f8829a4aSRandall Stewart 
333f8829a4aSRandall Stewart /* The upper byte is used a a bit mask */
334f8829a4aSRandall Stewart #define CHUNK_FLAGS_FRAGMENT_OK	        0x0100
335f8829a4aSRandall Stewart 
336f8829a4aSRandall Stewart struct chk_id {
337f8829a4aSRandall Stewart 	uint16_t id;
338f8829a4aSRandall Stewart 	uint16_t can_take_data;
339f8829a4aSRandall Stewart };
340f8829a4aSRandall Stewart 
341f8829a4aSRandall Stewart 
342f8829a4aSRandall Stewart struct sctp_tmit_chunk {
343f8829a4aSRandall Stewart 	union {
344f8829a4aSRandall Stewart 		struct sctp_data_chunkrec data;
345f8829a4aSRandall Stewart 		struct chk_id chunk_id;
346f8829a4aSRandall Stewart 	}     rec;
347f8829a4aSRandall Stewart 	struct sctp_association *asoc;	/* bp to asoc this belongs to */
348f8829a4aSRandall Stewart 	struct timeval sent_rcv_time;	/* filled in if RTT being calculated */
349f8829a4aSRandall Stewart 	struct mbuf *data;	/* pointer to mbuf chain of data */
350f8829a4aSRandall Stewart 	struct mbuf *last_mbuf;	/* pointer to last mbuf in chain */
351f8829a4aSRandall Stewart 	struct sctp_nets *whoTo;
352f8829a4aSRandall Stewart 	          TAILQ_ENTRY(sctp_tmit_chunk) sctp_next;	/* next link */
353f8829a4aSRandall Stewart 	int32_t sent;		/* the send status */
354f8829a4aSRandall Stewart 	uint16_t snd_count;	/* number of times I sent */
355f8829a4aSRandall Stewart 	uint16_t flags;		/* flags, such as FRAGMENT_OK */
356f8829a4aSRandall Stewart 	uint16_t send_size;
357f8829a4aSRandall Stewart 	uint16_t book_size;
358f8829a4aSRandall Stewart 	uint16_t mbcnt;
359830d754dSRandall Stewart 	uint16_t auth_keyid;
360830d754dSRandall Stewart 	uint8_t holds_key_ref;	/* flag if auth keyid refcount is held */
361f8829a4aSRandall Stewart 	uint8_t pad_inplace;
362f8829a4aSRandall Stewart 	uint8_t do_rtt;
363f8829a4aSRandall Stewart 	uint8_t book_size_scale;
364f8829a4aSRandall Stewart 	uint8_t addr_over;	/* flag which is set if the dest address for
365f8829a4aSRandall Stewart 				 * this chunk is overridden by user. Used for
366f8829a4aSRandall Stewart 				 * CMT (iyengar@cis.udel.edu, 2005/06/21) */
367f8829a4aSRandall Stewart 	uint8_t no_fr_allowed;
368f8829a4aSRandall Stewart 	uint8_t pr_sctp_on;
369f8829a4aSRandall Stewart 	uint8_t copy_by_ref;
3705e54f665SRandall Stewart 	uint8_t window_probe;
371f8829a4aSRandall Stewart };
372f8829a4aSRandall Stewart 
373f8829a4aSRandall Stewart /*
374f8829a4aSRandall Stewart  * The first part of this structure MUST be the entire sinfo structure. Maybe
375f8829a4aSRandall Stewart  * I should have made it a sub structure... we can circle back later and do
376f8829a4aSRandall Stewart  * that if we want.
377f8829a4aSRandall Stewart  */
378f8829a4aSRandall Stewart struct sctp_queued_to_read {	/* sinfo structure Pluse more */
379f8829a4aSRandall Stewart 	uint16_t sinfo_stream;	/* off the wire */
380f8829a4aSRandall Stewart 	uint16_t sinfo_ssn;	/* off the wire */
381f8829a4aSRandall Stewart 	uint16_t sinfo_flags;	/* SCTP_UNORDERED from wire use SCTP_EOF for
382f8829a4aSRandall Stewart 				 * EOR */
383f8829a4aSRandall Stewart 	uint32_t sinfo_ppid;	/* off the wire */
384f8829a4aSRandall Stewart 	uint32_t sinfo_context;	/* pick this up from assoc def context? */
385f8829a4aSRandall Stewart 	uint32_t sinfo_timetolive;	/* not used by kernel */
386f8829a4aSRandall Stewart 	uint32_t sinfo_tsn;	/* Use this in reassembly as first TSN */
387f8829a4aSRandall Stewart 	uint32_t sinfo_cumtsn;	/* Use this in reassembly as last TSN */
388f8829a4aSRandall Stewart 	sctp_assoc_t sinfo_assoc_id;	/* our assoc id */
389f8829a4aSRandall Stewart 	/* Non sinfo stuff */
390f8829a4aSRandall Stewart 	uint32_t length;	/* length of data */
391f8829a4aSRandall Stewart 	uint32_t held_length;	/* length held in sb */
392f8829a4aSRandall Stewart 	struct sctp_nets *whoFrom;	/* where it came from */
393f8829a4aSRandall Stewart 	struct mbuf *data;	/* front of the mbuf chain of data with
394f8829a4aSRandall Stewart 				 * PKT_HDR */
395f8829a4aSRandall Stewart 	struct mbuf *tail_mbuf;	/* used for multi-part data */
39617205eccSRandall Stewart 	struct mbuf *aux_data;	/* used to hold/cache  control if o/s does not
39717205eccSRandall Stewart 				 * take it from us */
398f8829a4aSRandall Stewart 	struct sctp_tcb *stcb;	/* assoc, used for window update */
399f8829a4aSRandall Stewart 	         TAILQ_ENTRY(sctp_queued_to_read) next;
400f8829a4aSRandall Stewart 	uint16_t port_from;
401139bc87fSRandall Stewart 	uint16_t spec_flags;	/* Flags to hold the notification field */
402f8829a4aSRandall Stewart 	uint8_t do_not_ref_stcb;
403f8829a4aSRandall Stewart 	uint8_t end_added;
40403b0b021SRandall Stewart 	uint8_t pdapi_aborted;
4059a6142d8SRandall Stewart 	uint8_t some_taken;
406f8829a4aSRandall Stewart };
407f8829a4aSRandall Stewart 
408f8829a4aSRandall Stewart /* This data structure will be on the outbound
409f8829a4aSRandall Stewart  * stream queues. Data will be pulled off from
410f8829a4aSRandall Stewart  * the front of the mbuf data and chunk-ified
411f8829a4aSRandall Stewart  * by the output routines. We will custom
412f8829a4aSRandall Stewart  * fit every chunk we pull to the send/sent
413f8829a4aSRandall Stewart  * queue to make up the next full packet
414f8829a4aSRandall Stewart  * if we can. An entry cannot be removed
415f8829a4aSRandall Stewart  * from the stream_out queue until
416f8829a4aSRandall Stewart  * the msg_is_complete flag is set. This
417f8829a4aSRandall Stewart  * means at times data/tail_mbuf MIGHT
418f8829a4aSRandall Stewart  * be NULL.. If that occurs it happens
419f8829a4aSRandall Stewart  * for one of two reasons. Either the user
420f8829a4aSRandall Stewart  * is blocked on a send() call and has not
421f8829a4aSRandall Stewart  * awoken to copy more data down... OR
422f8829a4aSRandall Stewart  * the user is in the explict MSG_EOR mode
423f8829a4aSRandall Stewart  * and wrote some data, but has not completed
424f8829a4aSRandall Stewart  * sending.
425f8829a4aSRandall Stewart  */
426f8829a4aSRandall Stewart struct sctp_stream_queue_pending {
427f8829a4aSRandall Stewart 	struct mbuf *data;
428f8829a4aSRandall Stewart 	struct mbuf *tail_mbuf;
429f8829a4aSRandall Stewart 	struct timeval ts;
430f8829a4aSRandall Stewart 	struct sctp_nets *net;
431f8829a4aSRandall Stewart 	          TAILQ_ENTRY(sctp_stream_queue_pending) next;
432f8829a4aSRandall Stewart 	uint32_t length;
433f8829a4aSRandall Stewart 	uint32_t timetolive;
434f8829a4aSRandall Stewart 	uint32_t ppid;
435f8829a4aSRandall Stewart 	uint32_t context;
436f8829a4aSRandall Stewart 	uint16_t sinfo_flags;
437f8829a4aSRandall Stewart 	uint16_t stream;
438f8829a4aSRandall Stewart 	uint16_t strseq;
439a5d547adSRandall Stewart 	uint16_t act_flags;
440830d754dSRandall Stewart 	uint16_t auth_keyid;
441830d754dSRandall Stewart 	uint8_t holds_key_ref;
442f8829a4aSRandall Stewart 	uint8_t msg_is_complete;
443f8829a4aSRandall Stewart 	uint8_t some_taken;
444f8829a4aSRandall Stewart 	uint8_t addr_over;
445f8829a4aSRandall Stewart 	uint8_t pr_sctp_on;
446478d3f09SRandall Stewart 	uint8_t sender_all_done;
447f1f73e57SRandall Stewart 	uint8_t put_last_out;
448f8829a4aSRandall Stewart };
449f8829a4aSRandall Stewart 
450f8829a4aSRandall Stewart /*
451f8829a4aSRandall Stewart  * this struct contains info that is used to track inbound stream data and
452f8829a4aSRandall Stewart  * help with ordering.
453f8829a4aSRandall Stewart  */
454f8829a4aSRandall Stewart TAILQ_HEAD(sctpwheelunrel_listhead, sctp_stream_in);
455f8829a4aSRandall Stewart struct sctp_stream_in {
456f8829a4aSRandall Stewart 	struct sctp_readhead inqueue;
457f8829a4aSRandall Stewart 	uint16_t stream_no;
458f8829a4aSRandall Stewart 	uint16_t last_sequence_delivered;	/* used for re-order */
4599a6142d8SRandall Stewart 	uint8_t delivery_started;
460f8829a4aSRandall Stewart };
461f8829a4aSRandall Stewart 
462f8829a4aSRandall Stewart /* This struct is used to track the traffic on outbound streams */
463f8829a4aSRandall Stewart TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out);
464f8829a4aSRandall Stewart struct sctp_stream_out {
465f8829a4aSRandall Stewart 	struct sctp_streamhead outqueue;
466f8829a4aSRandall Stewart 	                TAILQ_ENTRY(sctp_stream_out) next_spoke;	/* next link in wheel */
467f8829a4aSRandall Stewart 	uint16_t stream_no;
468f8829a4aSRandall Stewart 	uint16_t next_sequence_sent;	/* next one I expect to send out */
469f8829a4aSRandall Stewart 	uint8_t last_msg_incomplete;
470f8829a4aSRandall Stewart };
471f8829a4aSRandall Stewart 
472f8829a4aSRandall Stewart /* used to keep track of the addresses yet to try to add/delete */
473f8829a4aSRandall Stewart TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr);
474f8829a4aSRandall Stewart struct sctp_asconf_addr {
475f8829a4aSRandall Stewart 	TAILQ_ENTRY(sctp_asconf_addr) next;
476f8829a4aSRandall Stewart 	struct sctp_asconf_addr_param ap;
47742551e99SRandall Stewart 	struct sctp_ifa *ifa;	/* save the ifa for add/del ip */
478f8829a4aSRandall Stewart 	uint8_t sent;		/* has this been sent yet? */
479830d754dSRandall Stewart 	uint8_t special_del;	/* not to be used in lookup */
480830d754dSRandall Stewart 
481f8829a4aSRandall Stewart };
482f8829a4aSRandall Stewart 
483f8829a4aSRandall Stewart struct sctp_scoping {
484f8829a4aSRandall Stewart 	uint8_t ipv4_addr_legal;
485f8829a4aSRandall Stewart 	uint8_t ipv6_addr_legal;
486f8829a4aSRandall Stewart 	uint8_t loopback_scope;
487f8829a4aSRandall Stewart 	uint8_t ipv4_local_scope;
488f8829a4aSRandall Stewart 	uint8_t local_scope;
489f8829a4aSRandall Stewart 	uint8_t site_scope;
490f8829a4aSRandall Stewart };
491f8829a4aSRandall Stewart 
492f42a358aSRandall Stewart #define SCTP_TSN_LOG_SIZE 40
493f42a358aSRandall Stewart 
494f42a358aSRandall Stewart struct sctp_tsn_log {
49518e198d3SRandall Stewart 	void *stcb;
496f42a358aSRandall Stewart 	uint32_t tsn;
497f42a358aSRandall Stewart 	uint16_t strm;
498f42a358aSRandall Stewart 	uint16_t seq;
499f1f73e57SRandall Stewart 	uint16_t sz;
500f1f73e57SRandall Stewart 	uint16_t flgs;
50118e198d3SRandall Stewart 	uint16_t in_pos;
50218e198d3SRandall Stewart 	uint16_t in_out;
503f42a358aSRandall Stewart };
504f42a358aSRandall Stewart 
505b54d3a6cSRandall Stewart #define SCTP_FS_SPEC_LOG_SIZE 200
506b54d3a6cSRandall Stewart struct sctp_fs_spec_log {
507b54d3a6cSRandall Stewart 	uint32_t sent;
508b54d3a6cSRandall Stewart 	uint32_t total_flight;
509b54d3a6cSRandall Stewart 	uint32_t tsn;
510b54d3a6cSRandall Stewart 	uint16_t book;
511b54d3a6cSRandall Stewart 	uint8_t incr;
512b54d3a6cSRandall Stewart 	uint8_t decr;
513b54d3a6cSRandall Stewart };
514d61a0ae0SRandall Stewart 
515d61a0ae0SRandall Stewart /* This struct is here to cut out the compatiabilty
516d61a0ae0SRandall Stewart  * pad that bulks up both the inp and stcb. The non
517d61a0ae0SRandall Stewart  * pad portion MUST stay in complete sync with
518d61a0ae0SRandall Stewart  * sctp_sndrcvinfo... i.e. if sinfo_xxxx is added
519d61a0ae0SRandall Stewart  * this must be done here too.
520d61a0ae0SRandall Stewart  */
521d61a0ae0SRandall Stewart struct sctp_nonpad_sndrcvinfo {
522d61a0ae0SRandall Stewart 	uint16_t sinfo_stream;
523d61a0ae0SRandall Stewart 	uint16_t sinfo_ssn;
524d61a0ae0SRandall Stewart 	uint16_t sinfo_flags;
525d61a0ae0SRandall Stewart 	uint32_t sinfo_ppid;
526d61a0ae0SRandall Stewart 	uint32_t sinfo_context;
527d61a0ae0SRandall Stewart 	uint32_t sinfo_timetolive;
528d61a0ae0SRandall Stewart 	uint32_t sinfo_tsn;
529d61a0ae0SRandall Stewart 	uint32_t sinfo_cumtsn;
530d61a0ae0SRandall Stewart 	sctp_assoc_t sinfo_assoc_id;
531d61a0ae0SRandall Stewart };
532d61a0ae0SRandall Stewart 
533f8829a4aSRandall Stewart /*
534b54d3a6cSRandall Stewart  * JRS - Structure to hold function pointers to the functions responsible
535b54d3a6cSRandall Stewart  * for congestion control.
536b54d3a6cSRandall Stewart  */
537b54d3a6cSRandall Stewart 
538b54d3a6cSRandall Stewart struct sctp_cc_functions {
539b54d3a6cSRandall Stewart 	void (*sctp_set_initial_cc_param) (struct sctp_tcb *stcb, struct sctp_nets *net);
540b54d3a6cSRandall Stewart 	void (*sctp_cwnd_update_after_sack) (struct sctp_tcb *stcb,
541b54d3a6cSRandall Stewart 	         struct sctp_association *asoc,
542b54d3a6cSRandall Stewart 	         int accum_moved, int reneged_all, int will_exit);
543b54d3a6cSRandall Stewart 	void (*sctp_cwnd_update_after_fr) (struct sctp_tcb *stcb,
544b54d3a6cSRandall Stewart 	         struct sctp_association *asoc);
545b54d3a6cSRandall Stewart 	void (*sctp_cwnd_update_after_timeout) (struct sctp_tcb *stcb,
546b54d3a6cSRandall Stewart 	         struct sctp_nets *net);
547b54d3a6cSRandall Stewart 	void (*sctp_cwnd_update_after_ecn_echo) (struct sctp_tcb *stcb,
548b54d3a6cSRandall Stewart 	         struct sctp_nets *net);
549b54d3a6cSRandall Stewart 	void (*sctp_cwnd_update_after_packet_dropped) (struct sctp_tcb *stcb,
550b54d3a6cSRandall Stewart 	         struct sctp_nets *net, struct sctp_pktdrop_chunk *cp,
551b54d3a6cSRandall Stewart 	         uint32_t * bottle_bw, uint32_t * on_queue);
552b54d3a6cSRandall Stewart 	void (*sctp_cwnd_update_after_output) (struct sctp_tcb *stcb,
553b54d3a6cSRandall Stewart 	         struct sctp_nets *net, int burst_limit);
554b54d3a6cSRandall Stewart 	void (*sctp_cwnd_update_after_fr_timer) (struct sctp_inpcb *inp,
555b54d3a6cSRandall Stewart 	         struct sctp_tcb *stcb, struct sctp_nets *net);
556b54d3a6cSRandall Stewart };
557b54d3a6cSRandall Stewart 
558c54a18d2SRandall Stewart /* used to save ASCONF chunks for retransmission */
559c54a18d2SRandall Stewart TAILQ_HEAD(sctp_asconf_head, sctp_asconf);
560c54a18d2SRandall Stewart struct sctp_asconf {
561c54a18d2SRandall Stewart 	TAILQ_ENTRY(sctp_asconf) next;
562c54a18d2SRandall Stewart 	uint32_t serial_number;
563c54a18d2SRandall Stewart 	uint16_t snd_count;
564c54a18d2SRandall Stewart 	struct mbuf *data;
565c54a18d2SRandall Stewart 	uint16_t len;
566c54a18d2SRandall Stewart };
567c54a18d2SRandall Stewart 
5682afb3e84SRandall Stewart /* used to save ASCONF-ACK chunks for retransmission */
5692afb3e84SRandall Stewart TAILQ_HEAD(sctp_asconf_ackhead, sctp_asconf_ack);
5702afb3e84SRandall Stewart struct sctp_asconf_ack {
5712afb3e84SRandall Stewart 	TAILQ_ENTRY(sctp_asconf_ack) next;
5722afb3e84SRandall Stewart 	uint32_t serial_number;
5732afb3e84SRandall Stewart 	struct sctp_nets *last_sent_to;
5742afb3e84SRandall Stewart 	struct mbuf *data;
5752afb3e84SRandall Stewart 	uint16_t len;
5762afb3e84SRandall Stewart };
5772afb3e84SRandall Stewart 
578b54d3a6cSRandall Stewart /*
579f8829a4aSRandall Stewart  * Here we have information about each individual association that we track.
580f8829a4aSRandall Stewart  * We probably in production would be more dynamic. But for ease of
581f8829a4aSRandall Stewart  * implementation we will have a fixed array that we hunt for in a linear
582f8829a4aSRandall Stewart  * fashion.
583f8829a4aSRandall Stewart  */
584f8829a4aSRandall Stewart struct sctp_association {
585f8829a4aSRandall Stewart 	/* association state */
586f8829a4aSRandall Stewart 	int state;
5871b649582SRandall Stewart 
588f8829a4aSRandall Stewart 	/* queue of pending addrs to add/delete */
589f8829a4aSRandall Stewart 	struct sctp_asconf_addrhead asconf_queue;
5901b649582SRandall Stewart 
591f8829a4aSRandall Stewart 	struct timeval time_entered;	/* time we entered state */
592f8829a4aSRandall Stewart 	struct timeval time_last_rcvd;
593f8829a4aSRandall Stewart 	struct timeval time_last_sent;
594f8829a4aSRandall Stewart 	struct timeval time_last_sat_advance;
595d61a0ae0SRandall Stewart 	struct sctp_nonpad_sndrcvinfo def_send;
596f8829a4aSRandall Stewart 
597f8829a4aSRandall Stewart 	/* timers and such */
598f8829a4aSRandall Stewart 	struct sctp_timer hb_timer;	/* hb timer */
599f8829a4aSRandall Stewart 	struct sctp_timer dack_timer;	/* Delayed ack timer */
6001b649582SRandall Stewart 	struct sctp_timer asconf_timer;	/* asconf */
601f8829a4aSRandall Stewart 	struct sctp_timer strreset_timer;	/* stream reset */
6021b649582SRandall Stewart 	struct sctp_timer shut_guard_timer;	/* shutdown guard */
603f8829a4aSRandall Stewart 	struct sctp_timer autoclose_timer;	/* automatic close timer */
604f8829a4aSRandall Stewart 	struct sctp_timer delayed_event_timer;	/* timer for delayed events */
605851b7298SRandall Stewart 	struct sctp_timer delete_prim_timer;	/* deleting primary dst */
606f8829a4aSRandall Stewart 
6071b649582SRandall Stewart 	/* list of restricted local addresses */
60842551e99SRandall Stewart 	struct sctpladdr sctp_restricted_addrs;
60942551e99SRandall Stewart 
6101b649582SRandall Stewart 	/* last local address pending deletion (waiting for an address add) */
6111b649582SRandall Stewart 	struct sctp_ifa *asconf_addr_del_pending;
612851b7298SRandall Stewart 	/* Deleted primary destination (used to stop timer) */
613851b7298SRandall Stewart 	struct sctp_nets *deleted_primary;
6141b649582SRandall Stewart 
6151b649582SRandall Stewart 	struct sctpnetlisthead nets;	/* remote address list */
616f8829a4aSRandall Stewart 
617f8829a4aSRandall Stewart 	/* Free chunk list */
618f8829a4aSRandall Stewart 	struct sctpchunk_listhead free_chunks;
619f8829a4aSRandall Stewart 
620f8829a4aSRandall Stewart 	/* Control chunk queue */
621f8829a4aSRandall Stewart 	struct sctpchunk_listhead control_send_queue;
622f8829a4aSRandall Stewart 
623c54a18d2SRandall Stewart 	/* ASCONF chunk queue */
624c54a18d2SRandall Stewart 	struct sctpchunk_listhead asconf_send_queue;
625c54a18d2SRandall Stewart 
626f8829a4aSRandall Stewart 	/*
627f8829a4aSRandall Stewart 	 * Once a TSN hits the wire it is moved to the sent_queue. We
628f8829a4aSRandall Stewart 	 * maintain two counts here (don't know if any but retran_cnt is
629f8829a4aSRandall Stewart 	 * needed). The idea is that the sent_queue_retran_cnt reflects how
630f8829a4aSRandall Stewart 	 * many chunks have been marked for retranmission by either T3-rxt
631f8829a4aSRandall Stewart 	 * or FR.
632f8829a4aSRandall Stewart 	 */
633f8829a4aSRandall Stewart 	struct sctpchunk_listhead sent_queue;
634f8829a4aSRandall Stewart 	struct sctpchunk_listhead send_queue;
635f8829a4aSRandall Stewart 
636f8829a4aSRandall Stewart 	/* re-assembly queue for fragmented chunks on the inbound path */
637f8829a4aSRandall Stewart 	struct sctpchunk_listhead reasmqueue;
638f8829a4aSRandall Stewart 
639f8829a4aSRandall Stewart 	/*
640f8829a4aSRandall Stewart 	 * this queue is used when we reach a condition that we can NOT put
641f8829a4aSRandall Stewart 	 * data into the socket buffer. We track the size of this queue and
642f8829a4aSRandall Stewart 	 * set our rwnd to the space in the socket minus also the
643f8829a4aSRandall Stewart 	 * size_on_delivery_queue.
644f8829a4aSRandall Stewart 	 */
645f8829a4aSRandall Stewart 	struct sctpwheel_listhead out_wheel;
646f8829a4aSRandall Stewart 
647f8829a4aSRandall Stewart 	/*
648f8829a4aSRandall Stewart 	 * This pointer will be set to NULL most of the time. But when we
649f8829a4aSRandall Stewart 	 * have a fragmented message, where we could not get out all of the
650f8829a4aSRandall Stewart 	 * message at the last send then this will point to the stream to go
651f8829a4aSRandall Stewart 	 * get data from.
652f8829a4aSRandall Stewart 	 */
653f8829a4aSRandall Stewart 	struct sctp_stream_out *locked_on_sending;
654f8829a4aSRandall Stewart 
655f8829a4aSRandall Stewart 	/* If an iterator is looking at me, this is it */
656f8829a4aSRandall Stewart 	struct sctp_iterator *stcb_starting_point_for_iterator;
657f8829a4aSRandall Stewart 
658f8829a4aSRandall Stewart 	/* ASCONF save the last ASCONF-ACK so we can resend it if necessary */
6592afb3e84SRandall Stewart 	struct sctp_asconf_ackhead asconf_ack_sent;
660f8829a4aSRandall Stewart 
661f8829a4aSRandall Stewart 	/*
662f8829a4aSRandall Stewart 	 * pointer to last stream reset queued to control queue by us with
663f8829a4aSRandall Stewart 	 * requests.
664f8829a4aSRandall Stewart 	 */
665f8829a4aSRandall Stewart 	struct sctp_tmit_chunk *str_reset;
666f8829a4aSRandall Stewart 	/*
667f8829a4aSRandall Stewart 	 * if Source Address Selection happening, this will rotate through
668f8829a4aSRandall Stewart 	 * the link list.
669f8829a4aSRandall Stewart 	 */
670f8829a4aSRandall Stewart 	struct sctp_laddr *last_used_address;
671f8829a4aSRandall Stewart 
672f8829a4aSRandall Stewart 	/* stream arrays */
673f8829a4aSRandall Stewart 	struct sctp_stream_in *strmin;
674f8829a4aSRandall Stewart 	struct sctp_stream_out *strmout;
675f8829a4aSRandall Stewart 	uint8_t *mapping_array;
676f8829a4aSRandall Stewart 	/* primary destination to use */
677f8829a4aSRandall Stewart 	struct sctp_nets *primary_destination;
678f8829a4aSRandall Stewart 	/* For CMT */
679f8829a4aSRandall Stewart 	struct sctp_nets *last_net_data_came_from;
680f8829a4aSRandall Stewart 	/* last place I got a data chunk from */
681f8829a4aSRandall Stewart 	struct sctp_nets *last_data_chunk_from;
682f8829a4aSRandall Stewart 	/* last place I got a control from */
683f8829a4aSRandall Stewart 	struct sctp_nets *last_control_chunk_from;
684f8829a4aSRandall Stewart 
685f8829a4aSRandall Stewart 	/* circular looking for output selection */
686f8829a4aSRandall Stewart 	struct sctp_stream_out *last_out_stream;
687f8829a4aSRandall Stewart 
688f8829a4aSRandall Stewart 	/*
689f8829a4aSRandall Stewart 	 * wait to the point the cum-ack passes req->send_reset_at_tsn for
690f8829a4aSRandall Stewart 	 * any req on the list.
691f8829a4aSRandall Stewart 	 */
692f8829a4aSRandall Stewart 	struct sctp_resethead resetHead;
693f8829a4aSRandall Stewart 
694f8829a4aSRandall Stewart 	/* queue of chunks waiting to be sent into the local stack */
695f8829a4aSRandall Stewart 	struct sctp_readhead pending_reply_queue;
696f8829a4aSRandall Stewart 
697b54d3a6cSRandall Stewart 	/* JRS - the congestion control functions are in this struct */
698b54d3a6cSRandall Stewart 	struct sctp_cc_functions cc_functions;
699b54d3a6cSRandall Stewart 	/*
700b54d3a6cSRandall Stewart 	 * JRS - value to store the currently loaded congestion control
701b54d3a6cSRandall Stewart 	 * module
702b54d3a6cSRandall Stewart 	 */
703b54d3a6cSRandall Stewart 	uint32_t congestion_control_module;
704b54d3a6cSRandall Stewart 
70542551e99SRandall Stewart 	uint32_t vrf_id;
70642551e99SRandall Stewart 
707f8829a4aSRandall Stewart 	uint32_t cookie_preserve_req;
708f8829a4aSRandall Stewart 	/* ASCONF next seq I am sending out, inits at init-tsn */
709f8829a4aSRandall Stewart 	uint32_t asconf_seq_out;
710c54a18d2SRandall Stewart 	uint32_t asconf_seq_out_acked;
711f8829a4aSRandall Stewart 	/* ASCONF last received ASCONF from peer, starts at peer's TSN-1 */
712f8829a4aSRandall Stewart 	uint32_t asconf_seq_in;
713f8829a4aSRandall Stewart 
714f8829a4aSRandall Stewart 	/* next seq I am sending in str reset messages */
715f8829a4aSRandall Stewart 	uint32_t str_reset_seq_out;
716f8829a4aSRandall Stewart 	/* next seq I am expecting in str reset messages */
717f8829a4aSRandall Stewart 	uint32_t str_reset_seq_in;
718f8829a4aSRandall Stewart 
719f8829a4aSRandall Stewart 	/* various verification tag information */
720f8829a4aSRandall Stewart 	uint32_t my_vtag;	/* The tag to be used. if assoc is re-initited
721f8829a4aSRandall Stewart 				 * by remote end, and I have unlocked this
722f8829a4aSRandall Stewart 				 * will be regenerated to a new random value. */
723f8829a4aSRandall Stewart 	uint32_t peer_vtag;	/* The peers last tag */
724f8829a4aSRandall Stewart 
725f8829a4aSRandall Stewart 	uint32_t my_vtag_nonce;
726f8829a4aSRandall Stewart 	uint32_t peer_vtag_nonce;
727f8829a4aSRandall Stewart 
728f8829a4aSRandall Stewart 	uint32_t assoc_id;
729f8829a4aSRandall Stewart 
730f8829a4aSRandall Stewart 	/* This is the SCTP fragmentation threshold */
731f8829a4aSRandall Stewart 	uint32_t smallest_mtu;
732f8829a4aSRandall Stewart 
733f8829a4aSRandall Stewart 	/*
734f8829a4aSRandall Stewart 	 * Special hook for Fast retransmit, allows us to track the highest
735f8829a4aSRandall Stewart 	 * TSN that is NEW in this SACK if gap ack blocks are present.
736f8829a4aSRandall Stewart 	 */
737f8829a4aSRandall Stewart 	uint32_t this_sack_highest_gap;
738f8829a4aSRandall Stewart 
739f8829a4aSRandall Stewart 	/*
740f8829a4aSRandall Stewart 	 * The highest consecutive TSN that has been acked by peer on my
741f8829a4aSRandall Stewart 	 * sends
742f8829a4aSRandall Stewart 	 */
743f8829a4aSRandall Stewart 	uint32_t last_acked_seq;
744f8829a4aSRandall Stewart 
745f8829a4aSRandall Stewart 	/* The next TSN that I will use in sending. */
746f8829a4aSRandall Stewart 	uint32_t sending_seq;
747f8829a4aSRandall Stewart 
748f8829a4aSRandall Stewart 	/* Original seq number I used ??questionable to keep?? */
749f8829a4aSRandall Stewart 	uint32_t init_seq_number;
750f8829a4aSRandall Stewart 
751f8829a4aSRandall Stewart 
752f8829a4aSRandall Stewart 	/* The Advanced Peer Ack Point, as required by the PR-SCTP */
753f8829a4aSRandall Stewart 	/* (A1 in Section 4.2) */
754f8829a4aSRandall Stewart 	uint32_t advanced_peer_ack_point;
755f8829a4aSRandall Stewart 
756f8829a4aSRandall Stewart 	/*
757f8829a4aSRandall Stewart 	 * The highest consequetive TSN at the bottom of the mapping array
758f8829a4aSRandall Stewart 	 * (for his sends).
759f8829a4aSRandall Stewart 	 */
760f8829a4aSRandall Stewart 	uint32_t cumulative_tsn;
761f8829a4aSRandall Stewart 	/*
762f8829a4aSRandall Stewart 	 * Used to track the mapping array and its offset bits. This MAY be
763f8829a4aSRandall Stewart 	 * lower then cumulative_tsn.
764f8829a4aSRandall Stewart 	 */
765f8829a4aSRandall Stewart 	uint32_t mapping_array_base_tsn;
766f8829a4aSRandall Stewart 	/*
767f8829a4aSRandall Stewart 	 * used to track highest TSN we have received and is listed in the
768f8829a4aSRandall Stewart 	 * mapping array.
769f8829a4aSRandall Stewart 	 */
770f8829a4aSRandall Stewart 	uint32_t highest_tsn_inside_map;
771f8829a4aSRandall Stewart 
772830d754dSRandall Stewart 	/* EY - new NR variables used for nr_sack based on mapping_array */
773830d754dSRandall Stewart 	uint8_t *nr_mapping_array;
774830d754dSRandall Stewart 	uint32_t nr_mapping_array_base_tsn;
775830d754dSRandall Stewart 	uint32_t highest_tsn_inside_nr_map;
776830d754dSRandall Stewart 	uint16_t nr_mapping_array_size;
777830d754dSRandall Stewart 
778f8829a4aSRandall Stewart 	uint32_t last_echo_tsn;
779f8829a4aSRandall Stewart 	uint32_t last_cwr_tsn;
780f8829a4aSRandall Stewart 	uint32_t fast_recovery_tsn;
781f8829a4aSRandall Stewart 	uint32_t sat_t3_recovery_tsn;
782f8829a4aSRandall Stewart 	uint32_t tsn_last_delivered;
783f8829a4aSRandall Stewart 	/*
784f8829a4aSRandall Stewart 	 * For the pd-api we should re-write this a bit more efficent. We
785f8829a4aSRandall Stewart 	 * could have multiple sctp_queued_to_read's that we are building at
786f8829a4aSRandall Stewart 	 * once. Now we only do this when we get ready to deliver to the
787f8829a4aSRandall Stewart 	 * socket buffer. Note that we depend on the fact that the struct is
788f8829a4aSRandall Stewart 	 * "stuck" on the read queue until we finish all the pd-api.
789f8829a4aSRandall Stewart 	 */
790f8829a4aSRandall Stewart 	struct sctp_queued_to_read *control_pdapi;
791f8829a4aSRandall Stewart 
792f8829a4aSRandall Stewart 	uint32_t tsn_of_pdapi_last_delivered;
793f8829a4aSRandall Stewart 	uint32_t pdapi_ppid;
794f8829a4aSRandall Stewart 	uint32_t context;
795f8829a4aSRandall Stewart 	uint32_t last_reset_action[SCTP_MAX_RESET_PARAMS];
796f8829a4aSRandall Stewart 	uint32_t last_sending_seq[SCTP_MAX_RESET_PARAMS];
797f8829a4aSRandall Stewart 	uint32_t last_base_tsnsent[SCTP_MAX_RESET_PARAMS];
798f42a358aSRandall Stewart #ifdef SCTP_ASOCLOG_OF_TSNS
799f42a358aSRandall Stewart 	/*
800f42a358aSRandall Stewart 	 * special log  - This adds considerable size to the asoc, but
801f42a358aSRandall Stewart 	 * provides a log that you can use to detect problems via kgdb.
802f42a358aSRandall Stewart 	 */
803f42a358aSRandall Stewart 	struct sctp_tsn_log in_tsnlog[SCTP_TSN_LOG_SIZE];
804f42a358aSRandall Stewart 	struct sctp_tsn_log out_tsnlog[SCTP_TSN_LOG_SIZE];
80518e198d3SRandall Stewart 	uint32_t cumack_log[SCTP_TSN_LOG_SIZE];
806b201f536SRandall Stewart 	uint32_t cumack_logsnt[SCTP_TSN_LOG_SIZE];
807f42a358aSRandall Stewart 	uint16_t tsn_in_at;
808f42a358aSRandall Stewart 	uint16_t tsn_out_at;
809f1f73e57SRandall Stewart 	uint16_t tsn_in_wrapped;
810f1f73e57SRandall Stewart 	uint16_t tsn_out_wrapped;
81118e198d3SRandall Stewart 	uint16_t cumack_log_at;
812b201f536SRandall Stewart 	uint16_t cumack_log_atsnt;
813f42a358aSRandall Stewart #endif				/* SCTP_ASOCLOG_OF_TSNS */
814b54d3a6cSRandall Stewart #ifdef SCTP_FS_SPEC_LOG
815b54d3a6cSRandall Stewart 	struct sctp_fs_spec_log fslog[SCTP_FS_SPEC_LOG_SIZE];
816b54d3a6cSRandall Stewart 	uint16_t fs_index;
817b54d3a6cSRandall Stewart #endif
818b54d3a6cSRandall Stewart 
819f8829a4aSRandall Stewart 	/*
820f8829a4aSRandall Stewart 	 * window state information and smallest MTU that I use to bound
821f8829a4aSRandall Stewart 	 * segmentation
822f8829a4aSRandall Stewart 	 */
823f8829a4aSRandall Stewart 	uint32_t peers_rwnd;
824f8829a4aSRandall Stewart 	uint32_t my_rwnd;
825f8829a4aSRandall Stewart 	uint32_t my_last_reported_rwnd;
826d61a0ae0SRandall Stewart 	uint32_t sctp_frag_point;
827f8829a4aSRandall Stewart 
828f8829a4aSRandall Stewart 	uint32_t total_output_queue_size;
829f8829a4aSRandall Stewart 
830c4739e2fSRandall Stewart 	uint32_t sb_cc;		/* shadow of sb_cc */
8319f22f500SRandall Stewart 	uint32_t sb_send_resv;	/* amount reserved on a send */
832c4739e2fSRandall Stewart 	uint32_t my_rwnd_control_len;	/* shadow of sb_mbcnt used for rwnd
833c4739e2fSRandall Stewart 					 * control */
834f8829a4aSRandall Stewart 	/* 32 bit nonce stuff */
835f8829a4aSRandall Stewart 	uint32_t nonce_resync_tsn;
836f8829a4aSRandall Stewart 	uint32_t nonce_wait_tsn;
837f8829a4aSRandall Stewart 	uint32_t default_flowlabel;
838f8829a4aSRandall Stewart 	uint32_t pr_sctp_cnt;
839f8829a4aSRandall Stewart 	int ctrl_queue_cnt;	/* could be removed  REM */
840f8829a4aSRandall Stewart 	/*
841f8829a4aSRandall Stewart 	 * All outbound datagrams queue into this list from the individual
842f8829a4aSRandall Stewart 	 * stream queue. Here they get assigned a TSN and then await
843f8829a4aSRandall Stewart 	 * sending. The stream seq comes when it is first put in the
844f8829a4aSRandall Stewart 	 * individual str queue
845f8829a4aSRandall Stewart 	 */
846f8829a4aSRandall Stewart 	unsigned int stream_queue_cnt;
847f8829a4aSRandall Stewart 	unsigned int send_queue_cnt;
848f8829a4aSRandall Stewart 	unsigned int sent_queue_cnt;
849f8829a4aSRandall Stewart 	unsigned int sent_queue_cnt_removeable;
850f8829a4aSRandall Stewart 	/*
851f8829a4aSRandall Stewart 	 * Number on sent queue that are marked for retran until this value
852f8829a4aSRandall Stewart 	 * is 0 we only send one packet of retran'ed data.
853f8829a4aSRandall Stewart 	 */
854f8829a4aSRandall Stewart 	unsigned int sent_queue_retran_cnt;
855f8829a4aSRandall Stewart 
856f8829a4aSRandall Stewart 	unsigned int size_on_reasm_queue;
857f8829a4aSRandall Stewart 	unsigned int cnt_on_reasm_queue;
858f8829a4aSRandall Stewart 	/* amount of data (bytes) currently in flight (on all destinations) */
859f8829a4aSRandall Stewart 	unsigned int total_flight;
860f8829a4aSRandall Stewart 	/* Total book size in flight */
861f8829a4aSRandall Stewart 	unsigned int total_flight_count;	/* count of chunks used with
862f8829a4aSRandall Stewart 						 * book total */
863f8829a4aSRandall Stewart 	/* count of destinaton nets and list of destination nets */
864f8829a4aSRandall Stewart 	unsigned int numnets;
865f8829a4aSRandall Stewart 
866f8829a4aSRandall Stewart 	/* Total error count on this association */
867f8829a4aSRandall Stewart 	unsigned int overall_error_count;
868f8829a4aSRandall Stewart 
869f8829a4aSRandall Stewart 	unsigned int cnt_msg_on_sb;
870f8829a4aSRandall Stewart 
871f8829a4aSRandall Stewart 	/* All stream count of chunks for delivery */
872f8829a4aSRandall Stewart 	unsigned int size_on_all_streams;
873f8829a4aSRandall Stewart 	unsigned int cnt_on_all_streams;
874f8829a4aSRandall Stewart 
875f8829a4aSRandall Stewart 	/* Heart Beat delay in ticks */
876f8829a4aSRandall Stewart 	unsigned int heart_beat_delay;
877f8829a4aSRandall Stewart 
878f8829a4aSRandall Stewart 	/* autoclose */
879f8829a4aSRandall Stewart 	unsigned int sctp_autoclose_ticks;
880f8829a4aSRandall Stewart 
881f8829a4aSRandall Stewart 	/* how many preopen streams we have */
882f8829a4aSRandall Stewart 	unsigned int pre_open_streams;
883f8829a4aSRandall Stewart 
884f8829a4aSRandall Stewart 	/* How many streams I support coming into me */
885f8829a4aSRandall Stewart 	unsigned int max_inbound_streams;
886f8829a4aSRandall Stewart 
887f8829a4aSRandall Stewart 	/* the cookie life I award for any cookie, in seconds */
888f8829a4aSRandall Stewart 	unsigned int cookie_life;
889f8829a4aSRandall Stewart 	/* time to delay acks for */
890f8829a4aSRandall Stewart 	unsigned int delayed_ack;
89142551e99SRandall Stewart 	unsigned int old_delayed_ack;
89242551e99SRandall Stewart 	unsigned int sack_freq;
89342551e99SRandall Stewart 	unsigned int data_pkts_seen;
894f8829a4aSRandall Stewart 
895f8829a4aSRandall Stewart 	unsigned int numduptsns;
896f8829a4aSRandall Stewart 	int dup_tsns[SCTP_MAX_DUP_TSNS];
897f8829a4aSRandall Stewart 	unsigned int initial_init_rto_max;	/* initial RTO for INIT's */
898f8829a4aSRandall Stewart 	unsigned int initial_rto;	/* initial send RTO */
899f8829a4aSRandall Stewart 	unsigned int minrto;	/* per assoc RTO-MIN */
900f8829a4aSRandall Stewart 	unsigned int maxrto;	/* per assoc RTO-MAX */
901f8829a4aSRandall Stewart 
902f8829a4aSRandall Stewart 	/* authentication fields */
903f8829a4aSRandall Stewart 	sctp_auth_chklist_t *local_auth_chunks;
904f8829a4aSRandall Stewart 	sctp_auth_chklist_t *peer_auth_chunks;
905f8829a4aSRandall Stewart 	sctp_hmaclist_t *local_hmacs;	/* local HMACs supported */
906f8829a4aSRandall Stewart 	sctp_hmaclist_t *peer_hmacs;	/* peer HMACs supported */
907f8829a4aSRandall Stewart 	struct sctp_keyhead shared_keys;	/* assoc's shared keys */
908f8829a4aSRandall Stewart 	sctp_authinfo_t authinfo;	/* randoms, cached keys */
909f8829a4aSRandall Stewart 	/*
910f8829a4aSRandall Stewart 	 * refcnt to block freeing when a sender or receiver is off coping
911f8829a4aSRandall Stewart 	 * user data in.
912f8829a4aSRandall Stewart 	 */
91350cec919SRandall Stewart 	uint32_t refcnt;
91450cec919SRandall Stewart 	uint32_t chunks_on_out_queue;	/* total chunks floating around,
91550cec919SRandall Stewart 					 * locked by send socket buffer */
9162afb3e84SRandall Stewart 	uint32_t peers_adaptation;
91750cec919SRandall Stewart 	uint16_t peer_hmac_id;	/* peer HMAC id to send */
918f8829a4aSRandall Stewart 
919f8829a4aSRandall Stewart 	/*
920f8829a4aSRandall Stewart 	 * Being that we have no bag to collect stale cookies, and that we
921f8829a4aSRandall Stewart 	 * really would not want to anyway.. we will count them in this
922f8829a4aSRandall Stewart 	 * counter. We of course feed them to the pigeons right away (I have
923f8829a4aSRandall Stewart 	 * always thought of pigeons as flying rats).
924f8829a4aSRandall Stewart 	 */
925f8829a4aSRandall Stewart 	uint16_t stale_cookie_count;
926f8829a4aSRandall Stewart 
927f8829a4aSRandall Stewart 	/*
928f8829a4aSRandall Stewart 	 * For the partial delivery API, if up, invoked this is what last
929f8829a4aSRandall Stewart 	 * TSN I delivered
930f8829a4aSRandall Stewart 	 */
931f8829a4aSRandall Stewart 	uint16_t str_of_pdapi;
932f8829a4aSRandall Stewart 	uint16_t ssn_of_pdapi;
933f8829a4aSRandall Stewart 
934f8829a4aSRandall Stewart 	/* counts of actual built streams. Allocation may be more however */
935f8829a4aSRandall Stewart 	/* could re-arrange to optimize space here. */
936f8829a4aSRandall Stewart 	uint16_t streamincnt;
937f8829a4aSRandall Stewart 	uint16_t streamoutcnt;
938f8829a4aSRandall Stewart 
939f8829a4aSRandall Stewart 	/* my maximum number of retrans of INIT and SEND */
940f8829a4aSRandall Stewart 	/* copied from SCTP but should be individually setable */
941f8829a4aSRandall Stewart 	uint16_t max_init_times;
942f8829a4aSRandall Stewart 	uint16_t max_send_times;
943f8829a4aSRandall Stewart 
944f8829a4aSRandall Stewart 	uint16_t def_net_failure;
945f8829a4aSRandall Stewart 
946f8829a4aSRandall Stewart 	/*
947f8829a4aSRandall Stewart 	 * lock flag: 0 is ok to send, 1+ (duals as a retran count) is
948f8829a4aSRandall Stewart 	 * awaiting ACK
949f8829a4aSRandall Stewart 	 */
950f8829a4aSRandall Stewart 	uint16_t mapping_array_size;
951f8829a4aSRandall Stewart 
952f8829a4aSRandall Stewart 	uint16_t last_strm_seq_delivered;
953f8829a4aSRandall Stewart 	uint16_t last_strm_no_delivered;
954f8829a4aSRandall Stewart 
955f8829a4aSRandall Stewart 	uint16_t last_revoke_count;
956f8829a4aSRandall Stewart 	int16_t num_send_timers_up;
957f8829a4aSRandall Stewart 
958f8829a4aSRandall Stewart 	uint16_t stream_locked_on;
959f8829a4aSRandall Stewart 	uint16_t ecn_echo_cnt_onq;
960f8829a4aSRandall Stewart 
961f8829a4aSRandall Stewart 	uint16_t free_chunk_cnt;
962f8829a4aSRandall Stewart 
963f8829a4aSRandall Stewart 	uint8_t stream_locked;
964f8829a4aSRandall Stewart 	uint8_t authenticated;	/* packet authenticated ok */
965f8829a4aSRandall Stewart 	/*
96642551e99SRandall Stewart 	 * This flag indicates that a SACK need to be sent. Initially this
96742551e99SRandall Stewart 	 * is 1 to send the first sACK immediately.
968f8829a4aSRandall Stewart 	 */
96942551e99SRandall Stewart 	uint8_t send_sack;
970f8829a4aSRandall Stewart 
971f8829a4aSRandall Stewart 	/* max burst after fast retransmit completes */
972f8829a4aSRandall Stewart 	uint8_t max_burst;
973f8829a4aSRandall Stewart 
974f8829a4aSRandall Stewart 	uint8_t sat_network;	/* RTT is in range of sat net or greater */
975f8829a4aSRandall Stewart 	uint8_t sat_network_lockout;	/* lockout code */
976f8829a4aSRandall Stewart 	uint8_t burst_limit_applied;	/* Burst limit in effect at last send? */
977f8829a4aSRandall Stewart 	/* flag goes on when we are doing a partial delivery api */
978f8829a4aSRandall Stewart 	uint8_t hb_random_values[4];
979f8829a4aSRandall Stewart 	uint8_t fragmented_delivery_inprogress;
980f8829a4aSRandall Stewart 	uint8_t fragment_flags;
981f8829a4aSRandall Stewart 	uint8_t last_flags_delivered;
982f8829a4aSRandall Stewart 	uint8_t hb_ect_randombit;
983f8829a4aSRandall Stewart 	uint8_t hb_random_idx;
984f8829a4aSRandall Stewart 	uint8_t hb_is_disabled;	/* is the hb disabled? */
985f8829a4aSRandall Stewart 	uint8_t default_tos;
9861b649582SRandall Stewart 	uint8_t asconf_del_pending;	/* asconf delete last addr pending */
987f8829a4aSRandall Stewart 
988f8829a4aSRandall Stewart 	/* ECN Nonce stuff */
989f8829a4aSRandall Stewart 	uint8_t receiver_nonce_sum;	/* nonce I sum and put in my sack */
990f8829a4aSRandall Stewart 	uint8_t ecn_nonce_allowed;	/* Tells us if ECN nonce is on */
991f8829a4aSRandall Stewart 	uint8_t nonce_sum_check;/* On off switch used during re-sync */
992f8829a4aSRandall Stewart 	uint8_t nonce_wait_for_ecne;	/* flag when we expect a ECN */
993f8829a4aSRandall Stewart 	uint8_t peer_supports_ecn_nonce;
994f8829a4aSRandall Stewart 
995f8829a4aSRandall Stewart 	/*
996f8829a4aSRandall Stewart 	 * This value, plus all other ack'd but above cum-ack is added
997f8829a4aSRandall Stewart 	 * together to cross check against the bit that we have yet to
998f8829a4aSRandall Stewart 	 * define (probably in the SACK). When the cum-ack is updated, this
999f8829a4aSRandall Stewart 	 * sum is updated as well.
1000f8829a4aSRandall Stewart 	 */
1001f8829a4aSRandall Stewart 	uint8_t nonce_sum_expect_base;
1002f8829a4aSRandall Stewart 	/* Flag to tell if ECN is allowed */
1003f8829a4aSRandall Stewart 	uint8_t ecn_allowed;
1004f8829a4aSRandall Stewart 
1005f8829a4aSRandall Stewart 	/* flag to indicate if peer can do asconf */
1006f8829a4aSRandall Stewart 	uint8_t peer_supports_asconf;
1007830d754dSRandall Stewart 	/* EY - flag to indicate if peer can do nr_sack */
1008830d754dSRandall Stewart 	uint8_t peer_supports_nr_sack;
1009f8829a4aSRandall Stewart 	/* pr-sctp support flag */
1010f8829a4aSRandall Stewart 	uint8_t peer_supports_prsctp;
1011f8829a4aSRandall Stewart 	/* peer authentication support flag */
1012f8829a4aSRandall Stewart 	uint8_t peer_supports_auth;
1013f8829a4aSRandall Stewart 	/* stream resets are supported by the peer */
1014f8829a4aSRandall Stewart 	uint8_t peer_supports_strreset;
1015f8829a4aSRandall Stewart 
1016830d754dSRandall Stewart 	uint8_t peer_supports_nat;
1017f8829a4aSRandall Stewart 	/*
1018f8829a4aSRandall Stewart 	 * packet drop's are supported by the peer, we don't really care
1019f8829a4aSRandall Stewart 	 * about this but we bookkeep it anyway.
1020f8829a4aSRandall Stewart 	 */
1021f8829a4aSRandall Stewart 	uint8_t peer_supports_pktdrop;
1022f8829a4aSRandall Stewart 
1023f8829a4aSRandall Stewart 	/* Do we allow V6/V4? */
1024f8829a4aSRandall Stewart 	uint8_t ipv4_addr_legal;
1025f8829a4aSRandall Stewart 	uint8_t ipv6_addr_legal;
1026f8829a4aSRandall Stewart 	/* Address scoping flags */
1027f8829a4aSRandall Stewart 	/* scope value for IPv4 */
1028f8829a4aSRandall Stewart 	uint8_t ipv4_local_scope;
1029f8829a4aSRandall Stewart 	/* scope values for IPv6 */
1030f8829a4aSRandall Stewart 	uint8_t local_scope;
1031f8829a4aSRandall Stewart 	uint8_t site_scope;
1032f8829a4aSRandall Stewart 	/* loopback scope */
1033f8829a4aSRandall Stewart 	uint8_t loopback_scope;
1034f8829a4aSRandall Stewart 	/* flags to handle send alternate net tracking */
1035f8829a4aSRandall Stewart 	uint8_t used_alt_onsack;
1036f8829a4aSRandall Stewart 	uint8_t used_alt_asconfack;
1037f8829a4aSRandall Stewart 	uint8_t fast_retran_loss_recovery;
1038f8829a4aSRandall Stewart 	uint8_t sat_t3_loss_recovery;
1039f8829a4aSRandall Stewart 	uint8_t dropped_special_cnt;
1040f8829a4aSRandall Stewart 	uint8_t seen_a_sack_this_pkt;
1041f8829a4aSRandall Stewart 	uint8_t stream_reset_outstanding;
1042f8829a4aSRandall Stewart 	uint8_t stream_reset_out_is_outstanding;
1043f8829a4aSRandall Stewart 	uint8_t delayed_connection;
1044f8829a4aSRandall Stewart 	uint8_t ifp_had_enobuf;
1045f8829a4aSRandall Stewart 	uint8_t saw_sack_with_frags;
1046830d754dSRandall Stewart 	/* EY */
1047830d754dSRandall Stewart 	uint8_t saw_sack_with_nr_frags;
1048830d754dSRandall Stewart 	uint8_t in_asocid_hash;
1049f8829a4aSRandall Stewart 	uint8_t assoc_up_sent;
10502afb3e84SRandall Stewart 	uint8_t adaptation_needed;
10512afb3e84SRandall Stewart 	uint8_t adaptation_sent;
1052f8829a4aSRandall Stewart 	/* CMT variables */
1053f8829a4aSRandall Stewart 	uint8_t cmt_dac_pkts_rcvd;
1054f8829a4aSRandall Stewart 	uint8_t sctp_cmt_on_off;
1055f8829a4aSRandall Stewart 	uint8_t iam_blocking;
105644b7479bSRandall Stewart 	uint8_t cookie_how[8];
1057830d754dSRandall Stewart 	/* EY 05/05/08 - NR_SACK variable */
1058830d754dSRandall Stewart 	uint8_t sctp_nr_sack_on_off;
1059b54d3a6cSRandall Stewart 	/* JRS 5/21/07 - CMT PF variable */
1060b54d3a6cSRandall Stewart 	uint8_t sctp_cmt_pf;
1061f8829a4aSRandall Stewart 	/*
1062f8829a4aSRandall Stewart 	 * The mapping array is used to track out of order sequences above
1063f8829a4aSRandall Stewart 	 * last_acked_seq. 0 indicates packet missing 1 indicates packet
1064f8829a4aSRandall Stewart 	 * rec'd. We slide it up every time we raise last_acked_seq and 0
1065f8829a4aSRandall Stewart 	 * trailing locactions out.  If I get a TSN above the array
1066f8829a4aSRandall Stewart 	 * mappingArraySz, I discard the datagram and let retransmit happen.
1067f8829a4aSRandall Stewart 	 */
1068f42a358aSRandall Stewart 	uint32_t marked_retrans;
1069f42a358aSRandall Stewart 	uint32_t timoinit;
1070f42a358aSRandall Stewart 	uint32_t timodata;
1071f42a358aSRandall Stewart 	uint32_t timosack;
1072f42a358aSRandall Stewart 	uint32_t timoshutdown;
1073f42a358aSRandall Stewart 	uint32_t timoheartbeat;
1074f42a358aSRandall Stewart 	uint32_t timocookie;
1075f42a358aSRandall Stewart 	uint32_t timoshutdownack;
1076f42a358aSRandall Stewart 	struct timeval start_time;
1077f42a358aSRandall Stewart 	struct timeval discontinuity_time;
1078f8829a4aSRandall Stewart };
1079f8829a4aSRandall Stewart 
1080f8829a4aSRandall Stewart #endif
1081