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