The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netinet/sctp_structs.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

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

Cache object: af406bc7f6a00af2295c801755c5cc9c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.