sctp_structs.h revision 1.3 1 1.1 rjs /* $KAME: sctp_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $ */
2 1.3 msaitoh /* $NetBSD: sctp_structs.h,v 1.3 2023/06/24 05:35:00 msaitoh Exp $ */
3 1.1 rjs
4 1.1 rjs #ifndef __SCTP_STRUCTS_H__
5 1.1 rjs #define __SCTP_STRUCTS_H__
6 1.1 rjs
7 1.1 rjs /*
8 1.1 rjs * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
9 1.1 rjs * All rights reserved.
10 1.1 rjs *
11 1.1 rjs * Redistribution and use in source and binary forms, with or without
12 1.1 rjs * modification, are permitted provided that the following conditions
13 1.1 rjs * are met:
14 1.1 rjs * 1. Redistributions of source code must retain the above copyright
15 1.1 rjs * notice, this list of conditions and the following disclaimer.
16 1.1 rjs * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 rjs * notice, this list of conditions and the following disclaimer in the
18 1.1 rjs * documentation and/or other materials provided with the distribution.
19 1.1 rjs * 3. All advertising materials mentioning features or use of this software
20 1.1 rjs * must display the following acknowledgement:
21 1.1 rjs * This product includes software developed by Cisco Systems, Inc.
22 1.1 rjs * 4. Neither the name of the project nor the names of its contributors
23 1.1 rjs * may be used to endorse or promote products derived from this software
24 1.1 rjs * without specific prior written permission.
25 1.1 rjs *
26 1.1 rjs * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
27 1.1 rjs * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 1.1 rjs * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 1.1 rjs * ARE DISCLAIMED. IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
30 1.1 rjs * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 1.1 rjs * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 1.1 rjs * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.1 rjs * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.1 rjs * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.1 rjs * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.1 rjs * SUCH DAMAGE.
37 1.1 rjs */
38 1.1 rjs #include <sys/queue.h>
39 1.1 rjs
40 1.1 rjs #include <sys/callout.h>
41 1.1 rjs
42 1.1 rjs #ifdef IPSEC
43 1.2 rjs #include <netipsec/ipsec.h>
44 1.2 rjs #include <netipsec/key.h>
45 1.1 rjs #endif
46 1.1 rjs
47 1.1 rjs #include <netinet/sctp_header.h>
48 1.1 rjs #include <netinet/sctp_uio.h>
49 1.1 rjs
50 1.1 rjs struct sctp_timer {
51 1.1 rjs struct callout timer;
52 1.1 rjs int type;
53 1.1 rjs /*
54 1.1 rjs * Depending on the timer type these will be setup and cast with
55 1.1 rjs * the appropriate entity.
56 1.1 rjs */
57 1.1 rjs void *ep;
58 1.1 rjs void *tcb;
59 1.1 rjs void *net;
60 1.1 rjs };
61 1.1 rjs
62 1.1 rjs /*
63 1.1 rjs * This is the information we track on each interface that we know about * from the distant end.
64 1.1 rjs */
65 1.1 rjs TAILQ_HEAD(sctpnetlisthead, sctp_nets);
66 1.1 rjs
67 1.1 rjs /*
68 1.1 rjs * Users of the iterator need to malloc a iterator with a call to
69 1.1 rjs * sctp_initiate_iterator(func, pcb_flags, asoc_state, void-ptr-arg, u_int32_t,
70 1.1 rjs * u_int32-arg, end_func, inp);
71 1.1 rjs *
72 1.1 rjs * Use the following two defines if you don't care what pcb flags are on the
73 1.1 rjs * EP and/or you don't care what state the association is in.
74 1.1 rjs *
75 1.1 rjs * Note that if you specify an INP as the last argument then ONLY each
76 1.1 rjs * association of that single INP will be executed upon. Note that the
77 1.1 rjs * pcb flags STILL apply so if the inp you specify has different pcb_flags
78 1.1 rjs * then what you put in pcb_flags nothing will happen. use SCTP_PCB_ANY_FLAGS
79 1.1 rjs * to assure the inp you specify gets treated.
80 1.1 rjs */
81 1.1 rjs #define SCTP_PCB_ANY_FLAGS 0x00000000
82 1.1 rjs #define SCTP_ASOC_ANY_STATE 0x00000000
83 1.1 rjs
84 1.1 rjs typedef void (*asoc_func)(struct sctp_inpcb *, struct sctp_tcb *, void *ptr,
85 1.1 rjs u_int32_t val);
86 1.1 rjs typedef void (*end_func)(void *ptr, u_int32_t val);
87 1.1 rjs
88 1.1 rjs #define SCTP_ITERATOR_DO_ALL_INP 0x00000001
89 1.1 rjs #define SCTP_ITERATOR_DO_SINGLE_INP 0x00000002
90 1.1 rjs
91 1.1 rjs struct sctp_iterator {
92 1.1 rjs LIST_ENTRY(sctp_iterator) sctp_nxt_itr;
93 1.1 rjs struct sctp_timer tmr;
94 1.1 rjs struct sctp_inpcb *inp; /* ep */
95 1.1 rjs struct sctp_tcb *stcb; /* assoc */
96 1.1 rjs asoc_func function_toapply;
97 1.1 rjs end_func function_atend;
98 1.1 rjs void *pointer; /* pointer for apply func to use */
99 1.1 rjs u_int32_t val; /* value for apply func to use */
100 1.1 rjs u_int32_t pcb_flags;
101 1.1 rjs u_int32_t asoc_state;
102 1.1 rjs u_int32_t iterator_flags;
103 1.1 rjs };
104 1.1 rjs
105 1.1 rjs LIST_HEAD(sctpiterators, sctp_iterator);
106 1.1 rjs
107 1.1 rjs struct sctp_copy_all {
108 1.1 rjs struct sctp_inpcb *inp; /* ep */
109 1.1 rjs struct mbuf *m;
110 1.1 rjs struct sctp_sndrcvinfo sndrcv;
111 1.1 rjs int sndlen;
112 1.1 rjs int cnt_sent;
113 1.1 rjs int cnt_failed;
114 1.1 rjs };
115 1.1 rjs
116 1.1 rjs union sctp_sockstore {
117 1.1 rjs #ifdef AF_INET
118 1.1 rjs struct sockaddr_in sin;
119 1.1 rjs #endif
120 1.1 rjs #ifdef AF_INET6
121 1.1 rjs struct sockaddr_in6 sin6;
122 1.1 rjs #endif
123 1.1 rjs struct sockaddr sa;
124 1.1 rjs };
125 1.1 rjs
126 1.1 rjs struct sctp_nets {
127 1.1 rjs TAILQ_ENTRY(sctp_nets) sctp_next; /* next link */
128 1.1 rjs
129 1.1 rjs /* Things on the top half may be able to be split
130 1.1 rjs * into a common structure shared by all.
131 1.1 rjs */
132 1.1 rjs struct sctp_timer pmtu_timer;
133 1.1 rjs
134 1.1 rjs /*
135 1.1 rjs * The following two in combination equate to a route entry for
136 1.1 rjs * v6 or v4.
137 1.1 rjs */
138 1.1 rjs #if 0
139 1.1 rjs struct sctp_route {
140 1.1 rjs struct rtentry *ro_rt;
141 1.1 rjs union sctp_sockstore _l_addr; /* remote peer addr */
142 1.1 rjs union sctp_sockstore _s_addr; /* our selected src addr */
143 1.1 rjs } ro;
144 1.1 rjs #endif
145 1.1 rjs struct route ro;
146 1.1 rjs /* union sctp_sockstore _l_addr; */
147 1.1 rjs union sctp_sockstore _s_addr;
148 1.1 rjs /* mtu discovered so far */
149 1.1 rjs u_int32_t mtu;
150 1.1 rjs u_int32_t ssthresh; /* not sure about this one for split */
151 1.1 rjs
152 1.1 rjs /* smoothed average things for RTT and RTO itself */
153 1.1 rjs int lastsa;
154 1.1 rjs int lastsv;
155 1.1 rjs unsigned int RTO;
156 1.1 rjs
157 1.1 rjs /* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */
158 1.1 rjs struct sctp_timer rxt_timer;
159 1.1 rjs
160 1.1 rjs /* last time in seconds I sent to it */
161 1.1 rjs struct timeval last_sent_time;
162 1.1 rjs int ref_count;
163 1.1 rjs
164 1.1 rjs /* Congestion stats per destination */
165 1.1 rjs /*
166 1.1 rjs * flight size variables and such, sorry Vern, I could not avoid
167 1.1 rjs * this if I wanted performance :>
168 1.1 rjs */
169 1.1 rjs u_int32_t flight_size;
170 1.1 rjs u_int32_t cwnd; /* actual cwnd */
171 1.1 rjs u_int32_t prev_cwnd; /* cwnd before any processing */
172 1.1 rjs u_int32_t partial_bytes_acked; /* in CA tracks when to incr a MTU */
173 1.1 rjs
174 1.1 rjs /* tracking variables to avoid the aloc/free in sack processing */
175 1.1 rjs unsigned int net_ack;
176 1.1 rjs unsigned int net_ack2;
177 1.1 rjs /*
178 1.1 rjs * These only are valid if the primary dest_sstate holds the
179 1.1 rjs * SCTP_ADDR_SWITCH_PRIMARY flag
180 1.1 rjs */
181 1.1 rjs u_int32_t next_tsn_at_change;
182 1.1 rjs u_int32_t heartbeat_random1;
183 1.1 rjs u_int32_t heartbeat_random2;
184 1.1 rjs
185 1.1 rjs /* if this guy is ok or not ... status */
186 1.1 rjs u_int16_t dest_state;
187 1.1 rjs /* number of transmit failures to down this guy */
188 1.1 rjs u_int16_t failure_threshold;
189 1.1 rjs /* error stats on destination */
190 1.1 rjs u_int16_t error_count;
191 1.1 rjs
192 1.1 rjs /* Flags that probably can be combined into dest_state */
193 1.1 rjs u_int8_t rto_pending; /* is segment marked for RTO update ** if we split?*/
194 1.1 rjs u_int8_t fast_retran_ip; /* fast retransmit in progress */
195 1.1 rjs u_int8_t hb_responded;
196 1.1 rjs u_int8_t cacc_saw_newack; /* CACC algorithm flag */
197 1.1 rjs u_int8_t src_addr_selected; /* if we split we move */
198 1.1 rjs u_int8_t indx_of_eligible_next_to_use;
199 1.1 rjs u_int8_t addr_is_local; /* its a local address (if known) could move in split */
200 1.1 rjs #ifdef SCTP_HIGH_SPEED
201 1.1 rjs u_int8_t last_hs_used; /* index into the last HS table entry we used */
202 1.1 rjs #endif
203 1.1 rjs };
204 1.1 rjs
205 1.1 rjs
206 1.1 rjs struct sctp_data_chunkrec {
207 1.1 rjs u_int32_t TSN_seq; /* the TSN of this transmit */
208 1.1 rjs u_int16_t stream_seq; /* the stream sequence number of this transmit */
209 1.1 rjs u_int16_t stream_number; /* the stream number of this guy */
210 1.1 rjs u_int32_t payloadtype;
211 1.1 rjs u_int32_t context; /* from send */
212 1.1 rjs
213 1.1 rjs /* ECN Nonce: Nonce Value for this chunk */
214 1.1 rjs u_int8_t ect_nonce;
215 1.1 rjs
216 1.1 rjs /* part of the Highest sacked algorithm to be able to
217 1.1 rjs * stroke counts on ones that are FR'd.
218 1.1 rjs */
219 1.1 rjs u_int32_t fast_retran_tsn; /* sending_seq at the time of FR */
220 1.1 rjs struct timeval timetodrop; /* time we drop it from queue */
221 1.1 rjs u_int8_t doing_fast_retransmit;
222 1.1 rjs u_int8_t rcv_flags; /* flags pulled from data chunk on inbound
223 1.1 rjs * for outbound holds sending flags.
224 1.1 rjs */
225 1.1 rjs u_int8_t state_flags;
226 1.1 rjs };
227 1.1 rjs
228 1.1 rjs TAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk);
229 1.1 rjs
230 1.1 rjs #define CHUNK_FLAGS_FRAGMENT_OK 0x0001
231 1.1 rjs
232 1.1 rjs struct sctp_tmit_chunk {
233 1.1 rjs union {
234 1.1 rjs struct sctp_data_chunkrec data;
235 1.1 rjs int chunk_id;
236 1.1 rjs } rec;
237 1.1 rjs int32_t sent; /* the send status */
238 1.1 rjs int32_t snd_count; /* number of times I sent */
239 1.1 rjs u_int32_t flags; /* flags, such as FRAGMENT_OK */
240 1.1 rjs u_int32_t send_size;
241 1.1 rjs u_int32_t book_size;
242 1.1 rjs u_int32_t mbcnt;
243 1.1 rjs struct sctp_association *asoc; /* bp to asoc this belongs to */
244 1.1 rjs struct timeval sent_rcv_time; /* filled in if RTT being calculated */
245 1.1 rjs struct mbuf *data; /* pointer to mbuf chain of data */
246 1.1 rjs struct sctp_nets *whoTo;
247 1.1 rjs TAILQ_ENTRY(sctp_tmit_chunk) sctp_next; /* next link */
248 1.1 rjs uint8_t do_rtt;
249 1.1 rjs };
250 1.1 rjs
251 1.1 rjs
252 1.1 rjs /*
253 1.1 rjs * this struct contains info that is used to track inbound stream data
254 1.1 rjs * and help with ordering.
255 1.1 rjs */
256 1.1 rjs TAILQ_HEAD(sctpwheelunrel_listhead, sctp_stream_in);
257 1.1 rjs struct sctp_stream_in {
258 1.1 rjs struct sctpchunk_listhead inqueue;
259 1.1 rjs TAILQ_ENTRY(sctp_stream_in) next_spoke;
260 1.1 rjs uint16_t stream_no;
261 1.1 rjs uint16_t last_sequence_delivered; /* used for re-order */
262 1.1 rjs };
263 1.1 rjs
264 1.1 rjs /* This struct is used to track the traffic on outbound streams */
265 1.1 rjs TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out);
266 1.1 rjs struct sctp_stream_out {
267 1.1 rjs struct sctpchunk_listhead outqueue;
268 1.1 rjs TAILQ_ENTRY(sctp_stream_out) next_spoke; /* next link in wheel */
269 1.1 rjs uint16_t stream_no;
270 1.1 rjs uint16_t next_sequence_sent; /* next one I expect to send out */
271 1.1 rjs };
272 1.1 rjs
273 1.1 rjs /* used to keep track of the addresses yet to try to add/delete */
274 1.1 rjs TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr);
275 1.1 rjs struct sctp_asconf_addr {
276 1.1 rjs TAILQ_ENTRY(sctp_asconf_addr) next;
277 1.1 rjs struct sctp_asconf_addr_param ap;
278 1.1 rjs struct ifaddr *ifa; /* save the ifa for add/del ip */
279 1.1 rjs uint8_t sent; /* has this been sent yet? */
280 1.1 rjs };
281 1.1 rjs
282 1.1 rjs
283 1.1 rjs /*
284 1.1 rjs * Here we have information about each individual association that we
285 1.1 rjs * track. We probably in production would be more dynamic. But for ease
286 1.1 rjs * of implementation we will have a fixed array that we hunt for in a
287 1.1 rjs * linear fashion.
288 1.1 rjs */
289 1.1 rjs struct sctp_association {
290 1.1 rjs /* association state */
291 1.1 rjs int state;
292 1.1 rjs /* queue of pending addrs to add/delete */
293 1.1 rjs struct sctp_asconf_addrhead asconf_queue;
294 1.1 rjs struct timeval time_entered; /* time we entered state */
295 1.1 rjs struct timeval time_last_rcvd;
296 1.1 rjs struct timeval time_last_sent;
297 1.1 rjs struct timeval time_last_sat_advance;
298 1.1 rjs struct sctp_sndrcvinfo def_send; /* default send parameters */
299 1.1 rjs
300 1.1 rjs /* timers and such */
301 1.1 rjs struct sctp_timer hb_timer; /* hb timer */
302 1.1 rjs struct sctp_timer dack_timer; /* Delayed ack timer */
303 1.1 rjs struct sctp_timer asconf_timer; /* Asconf */
304 1.1 rjs struct sctp_timer strreset_timer; /* stream reset */
305 1.1 rjs struct sctp_timer shut_guard_timer; /* guard */
306 1.1 rjs struct sctp_timer autoclose_timer; /* automatic close timer */
307 1.1 rjs struct sctp_timer delayed_event_timer; /* timer for delayed events */
308 1.1 rjs
309 1.1 rjs /* list of local addresses when add/del in progress */
310 1.1 rjs struct sctpladdr sctp_local_addr_list;
311 1.1 rjs struct sctpnetlisthead nets;
312 1.1 rjs
313 1.1 rjs /* Control chunk queue */
314 1.1 rjs struct sctpchunk_listhead control_send_queue;
315 1.1 rjs
316 1.1 rjs /* Once a TSN hits the wire it is moved to the sent_queue. We
317 1.1 rjs * maintain two counts here (don't know if any but retran_cnt
318 1.1 rjs * is needed). The idea is that the sent_queue_retran_cnt
319 1.1 rjs * reflects how many chunks have been marked for retranmission
320 1.1 rjs * by either T3-rxt or FR.
321 1.1 rjs */
322 1.1 rjs struct sctpchunk_listhead sent_queue;
323 1.1 rjs struct sctpchunk_listhead send_queue;
324 1.1 rjs
325 1.1 rjs
326 1.1 rjs /* re-assembly queue for fragmented chunks on the inbound path */
327 1.1 rjs struct sctpchunk_listhead reasmqueue;
328 1.1 rjs
329 1.1 rjs /*
330 1.1 rjs * this queue is used when we reach a condition that we can NOT
331 1.1 rjs * put data into the socket buffer. We track the size of this
332 1.1 rjs * queue and set our rwnd to the space in the socket minus also
333 1.1 rjs * the size_on_delivery_queue.
334 1.1 rjs */
335 1.1 rjs struct sctpchunk_listhead delivery_queue;
336 1.1 rjs
337 1.1 rjs struct sctpwheel_listhead out_wheel;
338 1.1 rjs
339 1.1 rjs /* If an iterator is looking at me, this is it */
340 1.1 rjs struct sctp_iterator *stcb_starting_point_for_iterator;
341 1.1 rjs
342 1.1 rjs /* ASCONF destination address last sent to */
343 1.1 rjs struct sctp_nets *asconf_last_sent_to;
344 1.1 rjs
345 1.1 rjs /* ASCONF save the last ASCONF-ACK so we can resend it if necessary */
346 1.1 rjs struct mbuf *last_asconf_ack_sent;
347 1.1 rjs
348 1.1 rjs /*
349 1.1 rjs * if Source Address Selection happening, this will rotate through
350 1.1 rjs * the link list.
351 1.1 rjs */
352 1.1 rjs struct sctp_laddr *last_used_address;
353 1.1 rjs
354 1.1 rjs /* stream arrays */
355 1.1 rjs struct sctp_stream_in *strmin;
356 1.1 rjs struct sctp_stream_out *strmout;
357 1.1 rjs u_int8_t *mapping_array;
358 1.1 rjs /* primary destination to use */
359 1.1 rjs struct sctp_nets *primary_destination;
360 1.1 rjs
361 1.1 rjs /* last place I got a data chunk from */
362 1.1 rjs struct sctp_nets *last_data_chunk_from;
363 1.1 rjs /* last place I got a control from */
364 1.1 rjs struct sctp_nets *last_control_chunk_from;
365 1.1 rjs
366 1.1 rjs /* circular looking for output selection */
367 1.1 rjs struct sctp_stream_out *last_out_stream;
368 1.1 rjs
369 1.1 rjs /* wait to the point the cum-ack passes
370 1.1 rjs * pending_reply->sr_resp.reset_at_tsn.
371 1.1 rjs */
372 1.1 rjs struct sctp_stream_reset_response *pending_reply;
373 1.1 rjs struct sctpchunk_listhead pending_reply_queue;
374 1.1 rjs
375 1.1 rjs u_int32_t cookie_preserve_req;
376 1.1 rjs /* ASCONF next seq I am sending out, inits at init-tsn */
377 1.1 rjs uint32_t asconf_seq_out;
378 1.1 rjs /* ASCONF last received ASCONF from peer, starts at peer's TSN-1 */
379 1.1 rjs uint32_t asconf_seq_in;
380 1.1 rjs
381 1.1 rjs /* next seq I am sending in str reset messages */
382 1.1 rjs uint32_t str_reset_seq_out;
383 1.1 rjs
384 1.1 rjs /* next seq I am expecting in str reset messages */
385 1.1 rjs uint32_t str_reset_seq_in;
386 1.1 rjs u_int32_t str_reset_sending_seq;
387 1.1 rjs
388 1.1 rjs /* various verification tag information */
389 1.1 rjs u_int32_t my_vtag; /*
390 1.1 rjs * The tag to be used. if assoc is
391 1.1 rjs * re-initited by remote end, and
392 1.1 rjs * I have unlocked this will be
393 1.3 msaitoh * regenerated to a new random value.
394 1.1 rjs */
395 1.1 rjs u_int32_t peer_vtag; /* The peers last tag */
396 1.1 rjs
397 1.1 rjs u_int32_t my_vtag_nonce;
398 1.1 rjs u_int32_t peer_vtag_nonce;
399 1.1 rjs
400 1.1 rjs
401 1.1 rjs /* This is the SCTP fragmentation threshold */
402 1.1 rjs u_int32_t smallest_mtu;
403 1.1 rjs
404 1.1 rjs /*
405 1.1 rjs * Special hook for Fast retransmit, allows us to track the highest
406 1.1 rjs * TSN that is NEW in this SACK if gap ack blocks are present.
407 1.1 rjs */
408 1.1 rjs u_int32_t this_sack_highest_gap;
409 1.1 rjs
410 1.1 rjs /*
411 1.1 rjs * The highest consecutive TSN that has been acked by peer on my
412 1.1 rjs * sends
413 1.1 rjs */
414 1.1 rjs u_int32_t last_acked_seq;
415 1.1 rjs
416 1.1 rjs /* The next TSN that I will use in sending. */
417 1.1 rjs u_int32_t sending_seq;
418 1.1 rjs
419 1.1 rjs /* Original seq number I used ??questionable to keep?? */
420 1.1 rjs u_int32_t init_seq_number;
421 1.1 rjs
422 1.1 rjs /*
423 1.1 rjs * We use this value to know if FR's are allowed, i.e. did the
424 1.1 rjs * cum-ack pass this point or equal it so FR's are now allowed.
425 1.1 rjs */
426 1.1 rjs u_int32_t t3timeout_highest_marked;
427 1.1 rjs
428 1.1 rjs /* The Advanced Peer Ack Point, as required by the PR-SCTP */
429 1.1 rjs /* (A1 in Section 4.2) */
430 1.1 rjs u_int32_t advanced_peer_ack_point;
431 1.1 rjs
432 1.1 rjs /*
433 1.1 rjs * The highest consequetive TSN at the bottom of the mapping
434 1.1 rjs * array (for his sends).
435 1.1 rjs */
436 1.1 rjs u_int32_t cumulative_tsn;
437 1.1 rjs /*
438 1.1 rjs * Used to track the mapping array and its offset bits. This
439 1.1 rjs * MAY be lower then cumulative_tsn.
440 1.1 rjs */
441 1.1 rjs u_int32_t mapping_array_base_tsn;
442 1.1 rjs /*
443 1.1 rjs * used to track highest TSN we have received and is listed in
444 1.1 rjs * the mapping array.
445 1.1 rjs */
446 1.1 rjs u_int32_t highest_tsn_inside_map;
447 1.1 rjs
448 1.1 rjs u_int32_t last_echo_tsn;
449 1.1 rjs u_int32_t last_cwr_tsn;
450 1.1 rjs u_int32_t fast_recovery_tsn;
451 1.1 rjs u_int32_t sat_t3_recovery_tsn;
452 1.1 rjs
453 1.1 rjs u_int32_t tsn_last_delivered;
454 1.1 rjs
455 1.1 rjs /*
456 1.1 rjs * window state information and smallest MTU that I use to bound
457 1.1 rjs * segmentation
458 1.1 rjs */
459 1.1 rjs u_int32_t peers_rwnd;
460 1.1 rjs u_int32_t my_rwnd;
461 1.1 rjs u_int32_t my_last_reported_rwnd;
462 1.1 rjs u_int32_t my_rwnd_control_len;
463 1.1 rjs
464 1.1 rjs u_int32_t total_output_queue_size;
465 1.1 rjs u_int32_t total_output_mbuf_queue_size;
466 1.1 rjs
467 1.1 rjs /* 32 bit nonce stuff */
468 1.1 rjs u_int32_t nonce_resync_tsn;
469 1.1 rjs u_int32_t nonce_wait_tsn;
470 1.1 rjs
471 1.1 rjs int ctrl_queue_cnt; /* could be removed REM */
472 1.1 rjs /*
473 1.1 rjs * All outbound datagrams queue into this list from the
474 1.1 rjs * individual stream queue. Here they get assigned a TSN
475 1.1 rjs * and then await sending. The stream seq comes when it
476 1.1 rjs * is first put in the individual str queue
477 1.1 rjs */
478 1.1 rjs unsigned int stream_queue_cnt;
479 1.1 rjs unsigned int send_queue_cnt;
480 1.1 rjs unsigned int sent_queue_cnt;
481 1.1 rjs unsigned int sent_queue_cnt_removeable;
482 1.1 rjs /*
483 1.1 rjs * Number on sent queue that are marked for retran until this
484 1.1 rjs * value is 0 we only send one packet of retran'ed data.
485 1.1 rjs */
486 1.1 rjs unsigned int sent_queue_retran_cnt;
487 1.1 rjs
488 1.1 rjs unsigned int size_on_reasm_queue;
489 1.1 rjs unsigned int cnt_on_reasm_queue;
490 1.1 rjs /* amount of data (bytes) currently in flight (on all destinations) */
491 1.1 rjs unsigned int total_flight;
492 1.1 rjs /* Total book size in flight */
493 1.1 rjs unsigned int total_flight_count; /* count of chunks used with book total */
494 1.1 rjs /* count of destinaton nets and list of destination nets */
495 1.1 rjs unsigned int numnets;
496 1.1 rjs
497 1.1 rjs /* Total error count on this association */
498 1.1 rjs unsigned int overall_error_count;
499 1.1 rjs
500 1.1 rjs unsigned int size_on_delivery_queue;
501 1.1 rjs unsigned int cnt_on_delivery_queue;
502 1.1 rjs
503 1.1 rjs unsigned int cnt_msg_on_sb;
504 1.1 rjs
505 1.1 rjs /* All stream count of chunks for delivery */
506 1.1 rjs unsigned int size_on_all_streams;
507 1.1 rjs unsigned int cnt_on_all_streams;
508 1.1 rjs
509 1.1 rjs /* Heart Beat delay in ticks */
510 1.1 rjs unsigned int heart_beat_delay;
511 1.1 rjs
512 1.1 rjs /* autoclose */
513 1.1 rjs unsigned int sctp_autoclose_ticks;
514 1.1 rjs
515 1.1 rjs /* how many preopen streams we have */
516 1.1 rjs unsigned int pre_open_streams;
517 1.1 rjs
518 1.1 rjs /* How many streams I support coming into me */
519 1.1 rjs unsigned int max_inbound_streams;
520 1.1 rjs
521 1.1 rjs /* the cookie life I award for any cookie, in seconds */
522 1.1 rjs unsigned int cookie_life;
523 1.1 rjs
524 1.1 rjs unsigned int numduptsns;
525 1.1 rjs int dup_tsns[SCTP_MAX_DUP_TSNS];
526 1.1 rjs unsigned int initial_init_rto_max; /* initial RTO for INIT's */
527 1.1 rjs unsigned int initial_rto; /* initial send RTO */
528 1.1 rjs unsigned int minrto; /* per assoc RTO-MIN */
529 1.1 rjs unsigned int maxrto; /* per assoc RTO-MAX */
530 1.1 rjs /* Being that we have no bag to collect stale cookies, and
531 1.1 rjs * that we really would not want to anyway.. we will count
532 1.1 rjs * them in this counter. We of course feed them to the
533 1.1 rjs * pigeons right away (I have always thought of pigeons
534 1.1 rjs * as flying rats).
535 1.1 rjs */
536 1.1 rjs u_int16_t stale_cookie_count;
537 1.1 rjs
538 1.1 rjs /* For the partial delivery API, if up, invoked
539 1.1 rjs * this is what last TSN I delivered
540 1.1 rjs */
541 1.1 rjs u_int16_t str_of_pdapi;
542 1.1 rjs u_int16_t ssn_of_pdapi;
543 1.1 rjs
544 1.1 rjs
545 1.1 rjs /* counts of actual built streams. Allocation may be more however */
546 1.1 rjs /* could re-arrange to optimize space here. */
547 1.1 rjs u_int16_t streamincnt;
548 1.1 rjs u_int16_t streamoutcnt;
549 1.1 rjs
550 1.1 rjs /* my maximum number of retrans of INIT and SEND */
551 1.1 rjs /* copied from SCTP but should be individually setable */
552 1.1 rjs u_int16_t max_init_times;
553 1.1 rjs u_int16_t max_send_times;
554 1.1 rjs
555 1.1 rjs u_int16_t def_net_failure;
556 1.1 rjs
557 1.1 rjs /*
558 1.1 rjs * lock flag: 0 is ok to send, 1+ (duals as a retran count) is
559 1.1 rjs * awaiting ACK
560 1.1 rjs */
561 1.1 rjs u_int16_t asconf_sent; /* possibly removable REM */
562 1.1 rjs u_int16_t mapping_array_size;
563 1.1 rjs
564 1.1 rjs u_int16_t chunks_on_out_queue; /* total chunks floating around */
565 1.1 rjs int16_t num_send_timers_up;
566 1.1 rjs /*
567 1.1 rjs * This flag indicates that we need to send the first SACK. If
568 1.1 rjs * in place it says we have NOT yet sent a SACK and need to.
569 1.1 rjs */
570 1.1 rjs u_int8_t first_ack_sent;
571 1.1 rjs
572 1.1 rjs /* max burst after fast retransmit completes */
573 1.1 rjs u_int8_t max_burst;
574 1.1 rjs
575 1.1 rjs u_int8_t sat_network; /* RTT is in range of sat net or greater */
576 1.1 rjs u_int8_t sat_network_lockout;/* lockout code */
577 1.1 rjs u_int8_t burst_limit_applied; /* Burst limit in effect at last send? */
578 1.1 rjs /* flag goes on when we are doing a partial delivery api */
579 1.1 rjs u_int8_t hb_random_values[4];
580 1.1 rjs u_int8_t fragmented_delivery_inprogress;
581 1.1 rjs u_int8_t fragment_flags;
582 1.1 rjs u_int8_t hb_ect_randombit;
583 1.1 rjs u_int8_t hb_random_idx;
584 1.1 rjs
585 1.1 rjs /* ECN Nonce stuff */
586 1.1 rjs u_int8_t receiver_nonce_sum; /* nonce I sum and put in my sack */
587 1.1 rjs u_int8_t ecn_nonce_allowed; /* Tells us if ECN nonce is on */
588 1.1 rjs u_int8_t nonce_sum_check; /* On off switch used during re-sync */
589 1.1 rjs u_int8_t nonce_wait_for_ecne;/* flag when we expect a ECN */
590 1.1 rjs u_int8_t peer_supports_ecn_nonce;
591 1.1 rjs
592 1.1 rjs /*
593 1.1 rjs * This value, plus all other ack'd but above cum-ack is added
594 1.1 rjs * together to cross check against the bit that we have yet to
595 1.1 rjs * define (probably in the SACK).
596 1.1 rjs * When the cum-ack is updated, this sum is updated as well.
597 1.1 rjs */
598 1.1 rjs u_int8_t nonce_sum_expect_base;
599 1.1 rjs /* Flag to tell if ECN is allowed */
600 1.1 rjs u_int8_t ecn_allowed;
601 1.1 rjs
602 1.1 rjs /* flag to indicate if peer can do asconf */
603 1.1 rjs uint8_t peer_supports_asconf;
604 1.1 rjs uint8_t peer_supports_asconf_setprim; /* possibly removable REM */
605 1.1 rjs /* pr-sctp support flag */
606 1.1 rjs uint8_t peer_supports_prsctp;
607 1.1 rjs
608 1.1 rjs /* stream resets are supported by the peer */
609 1.1 rjs uint8_t peer_supports_strreset;
610 1.1 rjs
611 1.1 rjs /*
612 1.1 rjs * packet drop's are supported by the peer, we don't really care
613 1.1 rjs * about this but we bookkeep it anyway.
614 1.1 rjs */
615 1.1 rjs uint8_t peer_supports_pktdrop;
616 1.1 rjs
617 1.1 rjs /* Do we allow V6/V4? */
618 1.1 rjs u_int8_t ipv4_addr_legal;
619 1.1 rjs u_int8_t ipv6_addr_legal;
620 1.1 rjs /* Address scoping flags */
621 1.1 rjs /* scope value for IPv4 */
622 1.1 rjs u_int8_t ipv4_local_scope;
623 1.1 rjs /* scope values for IPv6 */
624 1.1 rjs u_int8_t local_scope;
625 1.1 rjs u_int8_t site_scope;
626 1.1 rjs /* loopback scope */
627 1.1 rjs u_int8_t loopback_scope;
628 1.1 rjs /* flags to handle send alternate net tracking */
629 1.1 rjs u_int8_t used_alt_onsack;
630 1.1 rjs u_int8_t used_alt_asconfack;
631 1.1 rjs u_int8_t fast_retran_loss_recovery;
632 1.1 rjs u_int8_t sat_t3_loss_recovery;
633 1.1 rjs u_int8_t dropped_special_cnt;
634 1.1 rjs u_int8_t seen_a_sack_this_pkt;
635 1.1 rjs u_int8_t stream_reset_outstanding;
636 1.1 rjs u_int8_t delayed_connection;
637 1.1 rjs u_int8_t ifp_had_enobuf;
638 1.1 rjs u_int8_t saw_sack_with_frags;
639 1.1 rjs /*
640 1.1 rjs * The mapping array is used to track out of order sequences above
641 1.1 rjs * last_acked_seq. 0 indicates packet missing 1 indicates packet
642 1.1 rjs * rec'd. We slide it up every time we raise last_acked_seq and 0
643 1.1 rjs * trailing locactions out. If I get a TSN above the array
644 1.1 rjs * mappingArraySz, I discard the datagram and let retransmit happen.
645 1.1 rjs */
646 1.1 rjs };
647 1.1 rjs
648 1.1 rjs #endif
649