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