Home | History | Annotate | Line # | Download | only in netinet
tcp_var.h revision 1.150.20.2
      1  1.150.20.2  rmind /*	$NetBSD: tcp_var.h,v 1.150.20.2 2007/08/02 02:42:43 rmind Exp $	*/
      2  1.150.20.2  rmind 
      3  1.150.20.2  rmind /*
      4  1.150.20.2  rmind  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
      5  1.150.20.2  rmind  * All rights reserved.
      6  1.150.20.2  rmind  *
      7  1.150.20.2  rmind  * Redistribution and use in source and binary forms, with or without
      8  1.150.20.2  rmind  * modification, are permitted provided that the following conditions
      9  1.150.20.2  rmind  * are met:
     10  1.150.20.2  rmind  * 1. Redistributions of source code must retain the above copyright
     11  1.150.20.2  rmind  *    notice, this list of conditions and the following disclaimer.
     12  1.150.20.2  rmind  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.150.20.2  rmind  *    notice, this list of conditions and the following disclaimer in the
     14  1.150.20.2  rmind  *    documentation and/or other materials provided with the distribution.
     15  1.150.20.2  rmind  * 3. Neither the name of the project nor the names of its contributors
     16  1.150.20.2  rmind  *    may be used to endorse or promote products derived from this software
     17  1.150.20.2  rmind  *    without specific prior written permission.
     18  1.150.20.2  rmind  *
     19  1.150.20.2  rmind  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
     20  1.150.20.2  rmind  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  1.150.20.2  rmind  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  1.150.20.2  rmind  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
     23  1.150.20.2  rmind  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  1.150.20.2  rmind  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  1.150.20.2  rmind  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  1.150.20.2  rmind  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  1.150.20.2  rmind  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  1.150.20.2  rmind  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  1.150.20.2  rmind  * SUCH DAMAGE.
     30  1.150.20.2  rmind  */
     31  1.150.20.2  rmind 
     32  1.150.20.2  rmind /*
     33  1.150.20.2  rmind  *      @(#)COPYRIGHT   1.1 (NRL) 17 January 1995
     34  1.150.20.2  rmind  *
     35  1.150.20.2  rmind  * NRL grants permission for redistribution and use in source and binary
     36  1.150.20.2  rmind  * forms, with or without modification, of the software and documentation
     37  1.150.20.2  rmind  * created at NRL provided that the following conditions are met:
     38  1.150.20.2  rmind  *
     39  1.150.20.2  rmind  * 1. Redistributions of source code must retain the above copyright
     40  1.150.20.2  rmind  *    notice, this list of conditions and the following disclaimer.
     41  1.150.20.2  rmind  * 2. Redistributions in binary form must reproduce the above copyright
     42  1.150.20.2  rmind  *    notice, this list of conditions and the following disclaimer in the
     43  1.150.20.2  rmind  *    documentation and/or other materials provided with the distribution.
     44  1.150.20.2  rmind  * 3. All advertising materials mentioning features or use of this software
     45  1.150.20.2  rmind  *    must display the following acknowledgements:
     46  1.150.20.2  rmind  *      This product includes software developed by the University of
     47  1.150.20.2  rmind  *      California, Berkeley and its contributors.
     48  1.150.20.2  rmind  *      This product includes software developed at the Information
     49  1.150.20.2  rmind  *      Technology Division, US Naval Research Laboratory.
     50  1.150.20.2  rmind  * 4. Neither the name of the NRL nor the names of its contributors
     51  1.150.20.2  rmind  *    may be used to endorse or promote products derived from this software
     52  1.150.20.2  rmind  *    without specific prior written permission.
     53  1.150.20.2  rmind  *
     54  1.150.20.2  rmind  * THE SOFTWARE PROVIDED BY NRL IS PROVIDED BY NRL AND CONTRIBUTORS ``AS
     55  1.150.20.2  rmind  * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     56  1.150.20.2  rmind  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     57  1.150.20.2  rmind  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL NRL OR
     58  1.150.20.2  rmind  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     59  1.150.20.2  rmind  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     60  1.150.20.2  rmind  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     61  1.150.20.2  rmind  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     62  1.150.20.2  rmind  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     63  1.150.20.2  rmind  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     64  1.150.20.2  rmind  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     65  1.150.20.2  rmind  *
     66  1.150.20.2  rmind  * The views and conclusions contained in the software and documentation
     67  1.150.20.2  rmind  * are those of the authors and should not be interpreted as representing
     68  1.150.20.2  rmind  * official policies, either expressed or implied, of the US Naval
     69  1.150.20.2  rmind  * Research Laboratory (NRL).
     70  1.150.20.2  rmind  */
     71  1.150.20.2  rmind 
     72  1.150.20.2  rmind /*-
     73  1.150.20.2  rmind  * Copyright (c) 1997, 1998, 1999, 2001, 2005 The NetBSD Foundation, Inc.
     74  1.150.20.2  rmind  * All rights reserved.
     75  1.150.20.2  rmind  *
     76  1.150.20.2  rmind  * This code is derived from software contributed to The NetBSD Foundation
     77  1.150.20.2  rmind  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
     78  1.150.20.2  rmind  * NASA Ames Research Center.
     79  1.150.20.2  rmind  * This code is derived from software contributed to The NetBSD Foundation
     80  1.150.20.2  rmind  * by Charles M. Hannum.
     81  1.150.20.2  rmind  *
     82  1.150.20.2  rmind  * Redistribution and use in source and binary forms, with or without
     83  1.150.20.2  rmind  * modification, are permitted provided that the following conditions
     84  1.150.20.2  rmind  * are met:
     85  1.150.20.2  rmind  * 1. Redistributions of source code must retain the above copyright
     86  1.150.20.2  rmind  *    notice, this list of conditions and the following disclaimer.
     87  1.150.20.2  rmind  * 2. Redistributions in binary form must reproduce the above copyright
     88  1.150.20.2  rmind  *    notice, this list of conditions and the following disclaimer in the
     89  1.150.20.2  rmind  *    documentation and/or other materials provided with the distribution.
     90  1.150.20.2  rmind  * 3. All advertising materials mentioning features or use of this software
     91  1.150.20.2  rmind  *    must display the following acknowledgement:
     92  1.150.20.2  rmind  *	This product includes software developed by the NetBSD
     93  1.150.20.2  rmind  *	Foundation, Inc. and its contributors.
     94  1.150.20.2  rmind  * 4. Neither the name of The NetBSD Foundation nor the names of its
     95  1.150.20.2  rmind  *    contributors may be used to endorse or promote products derived
     96  1.150.20.2  rmind  *    from this software without specific prior written permission.
     97  1.150.20.2  rmind  *
     98  1.150.20.2  rmind  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     99  1.150.20.2  rmind  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    100  1.150.20.2  rmind  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    101  1.150.20.2  rmind  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    102  1.150.20.2  rmind  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    103  1.150.20.2  rmind  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    104  1.150.20.2  rmind  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    105  1.150.20.2  rmind  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    106  1.150.20.2  rmind  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    107  1.150.20.2  rmind  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    108  1.150.20.2  rmind  * POSSIBILITY OF SUCH DAMAGE.
    109  1.150.20.2  rmind  */
    110  1.150.20.2  rmind 
    111  1.150.20.2  rmind /*
    112  1.150.20.2  rmind  * Copyright (c) 1982, 1986, 1993, 1994, 1995
    113  1.150.20.2  rmind  *	The Regents of the University of California.  All rights reserved.
    114  1.150.20.2  rmind  *
    115  1.150.20.2  rmind  * Redistribution and use in source and binary forms, with or without
    116  1.150.20.2  rmind  * modification, are permitted provided that the following conditions
    117  1.150.20.2  rmind  * are met:
    118  1.150.20.2  rmind  * 1. Redistributions of source code must retain the above copyright
    119  1.150.20.2  rmind  *    notice, this list of conditions and the following disclaimer.
    120  1.150.20.2  rmind  * 2. Redistributions in binary form must reproduce the above copyright
    121  1.150.20.2  rmind  *    notice, this list of conditions and the following disclaimer in the
    122  1.150.20.2  rmind  *    documentation and/or other materials provided with the distribution.
    123  1.150.20.2  rmind  * 3. Neither the name of the University nor the names of its contributors
    124  1.150.20.2  rmind  *    may be used to endorse or promote products derived from this software
    125  1.150.20.2  rmind  *    without specific prior written permission.
    126  1.150.20.2  rmind  *
    127  1.150.20.2  rmind  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    128  1.150.20.2  rmind  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    129  1.150.20.2  rmind  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    130  1.150.20.2  rmind  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    131  1.150.20.2  rmind  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    132  1.150.20.2  rmind  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    133  1.150.20.2  rmind  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    134  1.150.20.2  rmind  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    135  1.150.20.2  rmind  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    136  1.150.20.2  rmind  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    137  1.150.20.2  rmind  * SUCH DAMAGE.
    138  1.150.20.2  rmind  *
    139  1.150.20.2  rmind  *	@(#)tcp_var.h	8.4 (Berkeley) 5/24/95
    140  1.150.20.2  rmind  */
    141  1.150.20.2  rmind 
    142  1.150.20.2  rmind #ifndef _NETINET_TCP_VAR_H_
    143  1.150.20.2  rmind #define _NETINET_TCP_VAR_H_
    144  1.150.20.2  rmind 
    145  1.150.20.2  rmind #if defined(_KERNEL_OPT)
    146  1.150.20.2  rmind #include "opt_inet.h"
    147  1.150.20.2  rmind #include "opt_mbuftrace.h"
    148  1.150.20.2  rmind #include "rnd.h"
    149  1.150.20.2  rmind #endif
    150  1.150.20.2  rmind 
    151  1.150.20.2  rmind /*
    152  1.150.20.2  rmind  * Kernel variables for tcp.
    153  1.150.20.2  rmind  */
    154  1.150.20.2  rmind 
    155  1.150.20.2  rmind #include <sys/callout.h>
    156  1.150.20.2  rmind 
    157  1.150.20.2  rmind #ifdef TCP_SIGNATURE
    158  1.150.20.2  rmind /*
    159  1.150.20.2  rmind  * Defines which are needed by the xform_tcp module and tcp_[in|out]put
    160  1.150.20.2  rmind  * for SADB verification and lookup.
    161  1.150.20.2  rmind  */
    162  1.150.20.2  rmind #define	TCP_SIGLEN	16	/* length of computed digest in bytes */
    163  1.150.20.2  rmind #define	TCP_KEYLEN_MIN	1	/* minimum length of TCP-MD5 key */
    164  1.150.20.2  rmind #define	TCP_KEYLEN_MAX	80	/* maximum length of TCP-MD5 key */
    165  1.150.20.2  rmind /*
    166  1.150.20.2  rmind  * Only a single SA per host may be specified at this time. An SPI is
    167  1.150.20.2  rmind  * needed in order for the KEY_ALLOCSA() lookup to work.
    168  1.150.20.2  rmind  */
    169  1.150.20.2  rmind #define	TCP_SIG_SPI	0x1000
    170  1.150.20.2  rmind #endif /* TCP_SIGNATURE */
    171  1.150.20.2  rmind 
    172  1.150.20.2  rmind /*
    173  1.150.20.2  rmind  * SACK option block.
    174  1.150.20.2  rmind  */
    175  1.150.20.2  rmind struct sackblk {
    176  1.150.20.2  rmind 	tcp_seq left;		/* Left edge of sack block. */
    177  1.150.20.2  rmind 	tcp_seq right;		/* Right edge of sack block. */
    178  1.150.20.2  rmind };
    179  1.150.20.2  rmind 
    180  1.150.20.2  rmind TAILQ_HEAD(sackhead, sackhole);
    181  1.150.20.2  rmind struct sackhole {
    182  1.150.20.2  rmind 	tcp_seq start;
    183  1.150.20.2  rmind 	tcp_seq end;
    184  1.150.20.2  rmind 	tcp_seq rxmit;
    185  1.150.20.2  rmind 
    186  1.150.20.2  rmind 	TAILQ_ENTRY(sackhole) sackhole_q;
    187  1.150.20.2  rmind };
    188  1.150.20.2  rmind 
    189  1.150.20.2  rmind /*
    190  1.150.20.2  rmind  * Tcp control block, one per tcp; fields:
    191  1.150.20.2  rmind  */
    192  1.150.20.2  rmind struct tcpcb {
    193  1.150.20.2  rmind 	int	t_family;		/* address family on the wire */
    194  1.150.20.2  rmind 	struct ipqehead segq;		/* sequencing queue */
    195  1.150.20.2  rmind 	int	t_segqlen;		/* length of the above */
    196  1.150.20.2  rmind 	callout_t t_timer[TCPT_NTIMERS];/* tcp timers */
    197  1.150.20.2  rmind 	short	t_state;		/* state of this connection */
    198  1.150.20.2  rmind 	short	t_rxtshift;		/* log(2) of rexmt exp. backoff */
    199  1.150.20.2  rmind 	uint32_t t_rxtcur;		/* current retransmit value */
    200  1.150.20.2  rmind 	short	t_dupacks;		/* consecutive dup acks recd */
    201  1.150.20.2  rmind 	short	t_partialacks;		/* partials acks during fast rexmit */
    202  1.150.20.2  rmind 	u_short	t_peermss;		/* peer's maximum segment size */
    203  1.150.20.2  rmind 	u_short	t_ourmss;		/* our's maximum segment size */
    204  1.150.20.2  rmind 	u_short t_segsz;		/* current segment size in use */
    205  1.150.20.2  rmind 	char	t_force;		/* 1 if forcing out a byte */
    206  1.150.20.2  rmind 	u_int	t_flags;
    207  1.150.20.2  rmind #define	TF_ACKNOW	0x0001		/* ack peer immediately */
    208  1.150.20.2  rmind #define	TF_DELACK	0x0002		/* ack, but try to delay it */
    209  1.150.20.2  rmind #define	TF_NODELAY	0x0004		/* don't delay packets to coalesce */
    210  1.150.20.2  rmind #define	TF_NOOPT	0x0008		/* don't use tcp options */
    211  1.150.20.2  rmind #define	TF_REQ_SCALE	0x0020		/* have/will request window scaling */
    212  1.150.20.2  rmind #define	TF_RCVD_SCALE	0x0040		/* other side has requested scaling */
    213  1.150.20.2  rmind #define	TF_REQ_TSTMP	0x0080		/* have/will request timestamps */
    214  1.150.20.2  rmind #define	TF_RCVD_TSTMP	0x0100		/* a timestamp was received in SYN */
    215  1.150.20.2  rmind #define	TF_SACK_PERMIT	0x0200		/* other side said I could SACK */
    216  1.150.20.2  rmind #define	TF_SYN_REXMT	0x0400		/* rexmit timer fired on SYN */
    217  1.150.20.2  rmind #define	TF_WILL_SACK	0x0800		/* try to use SACK */
    218  1.150.20.2  rmind #define	TF_REASSEMBLING	0x1000		/* we're busy reassembling */
    219  1.150.20.2  rmind #define	TF_DEAD		0x2000		/* dead and to-be-released */
    220  1.150.20.2  rmind #define	TF_PMTUD_PEND	0x4000		/* Path MTU Discovery pending */
    221  1.150.20.2  rmind #define	TF_ECN_PERMIT	0x10000		/* other side said is ECN-ready */
    222  1.150.20.2  rmind #define	TF_ECN_SND_CWR	0x20000		/* ECN CWR in queue */
    223  1.150.20.2  rmind #define	TF_ECN_SND_ECE	0x40000		/* ECN ECE in queue */
    224  1.150.20.2  rmind #define	TF_SIGNATURE	0x400000	/* require MD5 digests (RFC2385) */
    225  1.150.20.2  rmind 
    226  1.150.20.2  rmind 
    227  1.150.20.2  rmind 	struct	mbuf *t_template;	/* skeletal packet for transmit */
    228  1.150.20.2  rmind 	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
    229  1.150.20.2  rmind 	struct	in6pcb *t_in6pcb;	/* back pointer to internet pcb */
    230  1.150.20.2  rmind 	callout_t t_delack_ch;		/* delayed ACK callout */
    231  1.150.20.2  rmind /*
    232  1.150.20.2  rmind  * The following fields are used as in the protocol specification.
    233  1.150.20.2  rmind  * See RFC793, Dec. 1981, page 21.
    234  1.150.20.2  rmind  */
    235  1.150.20.2  rmind /* send sequence variables */
    236  1.150.20.2  rmind 	tcp_seq	snd_una;		/* send unacknowledged */
    237  1.150.20.2  rmind 	tcp_seq	snd_nxt;		/* send next */
    238  1.150.20.2  rmind 	tcp_seq	snd_up;			/* send urgent pointer */
    239  1.150.20.2  rmind 	tcp_seq	snd_wl1;		/* window update seg seq number */
    240  1.150.20.2  rmind 	tcp_seq	snd_wl2;		/* window update seg ack number */
    241  1.150.20.2  rmind 	tcp_seq	iss;			/* initial send sequence number */
    242  1.150.20.2  rmind 	u_long	snd_wnd;		/* send window */
    243  1.150.20.2  rmind 	tcp_seq snd_recover;		/* for use in fast recovery */
    244  1.150.20.2  rmind 	tcp_seq	snd_high;		/* NewReno false fast rexmit seq */
    245  1.150.20.2  rmind /* receive sequence variables */
    246  1.150.20.2  rmind 	u_long	rcv_wnd;		/* receive window */
    247  1.150.20.2  rmind 	tcp_seq	rcv_nxt;		/* receive next */
    248  1.150.20.2  rmind 	tcp_seq	rcv_up;			/* receive urgent pointer */
    249  1.150.20.2  rmind 	tcp_seq	irs;			/* initial receive sequence number */
    250  1.150.20.2  rmind /*
    251  1.150.20.2  rmind  * Additional variables for this implementation.
    252  1.150.20.2  rmind  */
    253  1.150.20.2  rmind /* receive variables */
    254  1.150.20.2  rmind 	tcp_seq	rcv_adv;		/* advertised window */
    255  1.150.20.2  rmind /* retransmit variables */
    256  1.150.20.2  rmind 	tcp_seq	snd_max;		/* highest sequence number sent;
    257  1.150.20.2  rmind 					 * used to recognize retransmits
    258  1.150.20.2  rmind 					 */
    259  1.150.20.2  rmind /* congestion control (for slow start, source quench, retransmit after loss) */
    260  1.150.20.2  rmind 	u_long	snd_cwnd;		/* congestion-controlled window */
    261  1.150.20.2  rmind 	u_long	snd_ssthresh;		/* snd_cwnd size threshhold for
    262  1.150.20.2  rmind 					 * for slow start exponential to
    263  1.150.20.2  rmind 					 * linear switch
    264  1.150.20.2  rmind 					 */
    265  1.150.20.2  rmind /* auto-sizing variables */
    266  1.150.20.2  rmind 	u_int rfbuf_cnt;		/* recv buffer autoscaling byte count */
    267  1.150.20.2  rmind 	uint32_t rfbuf_ts;		/* recv buffer autoscaling timestamp */
    268  1.150.20.2  rmind 
    269  1.150.20.2  rmind /*
    270  1.150.20.2  rmind  * transmit timing stuff.  See below for scale of srtt and rttvar.
    271  1.150.20.2  rmind  * "Variance" is actually smoothed difference.
    272  1.150.20.2  rmind  */
    273  1.150.20.2  rmind 	uint32_t t_rcvtime;		/* time last segment received */
    274  1.150.20.2  rmind 	uint32_t t_rtttime;		/* time we started measuring rtt */
    275  1.150.20.2  rmind 	tcp_seq	t_rtseq;		/* sequence number being timed */
    276  1.150.20.2  rmind 	int32_t	t_srtt;			/* smoothed round-trip time */
    277  1.150.20.2  rmind 	int32_t	t_rttvar;		/* variance in round-trip time */
    278  1.150.20.2  rmind 	uint32_t t_rttmin;		/* minimum rtt allowed */
    279  1.150.20.2  rmind 	u_long	max_sndwnd;		/* largest window peer has offered */
    280  1.150.20.2  rmind 
    281  1.150.20.2  rmind /* out-of-band data */
    282  1.150.20.2  rmind 	char	t_oobflags;		/* have some */
    283  1.150.20.2  rmind 	char	t_iobc;			/* input character */
    284  1.150.20.2  rmind #define	TCPOOB_HAVEDATA	0x01
    285  1.150.20.2  rmind #define	TCPOOB_HADDATA	0x02
    286  1.150.20.2  rmind 	short	t_softerror;		/* possible error not yet reported */
    287  1.150.20.2  rmind 
    288  1.150.20.2  rmind /* RFC 1323 variables */
    289  1.150.20.2  rmind 	u_char	snd_scale;		/* window scaling for send window */
    290  1.150.20.2  rmind 	u_char	rcv_scale;		/* window scaling for recv window */
    291  1.150.20.2  rmind 	u_char	request_r_scale;	/* pending window scaling */
    292  1.150.20.2  rmind 	u_char	requested_s_scale;
    293  1.150.20.2  rmind 	u_int32_t ts_recent;		/* timestamp echo data */
    294  1.150.20.2  rmind 	u_int32_t ts_recent_age;	/* when last updated */
    295  1.150.20.2  rmind 	u_int32_t ts_timebase;		/* our timebase */
    296  1.150.20.2  rmind 	tcp_seq	last_ack_sent;
    297  1.150.20.2  rmind 
    298  1.150.20.2  rmind /* RFC 3465 variables */
    299  1.150.20.2  rmind 	u_long	t_bytes_acked;		/* ABC "bytes_acked" parameter */
    300  1.150.20.2  rmind 
    301  1.150.20.2  rmind /* SACK stuff */
    302  1.150.20.2  rmind #define TCP_SACK_MAX 3
    303  1.150.20.2  rmind #define TCPSACK_NONE 0
    304  1.150.20.2  rmind #define TCPSACK_HAVED 1
    305  1.150.20.2  rmind 	u_char rcv_sack_flags;		/* SACK flags. */
    306  1.150.20.2  rmind 	struct sackblk rcv_dsack_block;	/* RX D-SACK block. */
    307  1.150.20.2  rmind 	struct ipqehead timeq;		/* time sequenced queue. */
    308  1.150.20.2  rmind 	struct sackhead snd_holes;	/* TX SACK holes. */
    309  1.150.20.2  rmind 	int	snd_numholes;		/* Number of TX SACK holes. */
    310  1.150.20.2  rmind 	tcp_seq rcv_lastsack;		/* last seq number(+1) sack'd by rcv'r*/
    311  1.150.20.2  rmind 	tcp_seq sack_newdata;		/* New data xmitted in this recovery
    312  1.150.20.2  rmind 					   episode starts at this seq number*/
    313  1.150.20.2  rmind 	tcp_seq snd_fack;		/* FACK TCP.  Forward-most data held by
    314  1.150.20.2  rmind 					   peer. */
    315  1.150.20.2  rmind 
    316  1.150.20.2  rmind /* pointer for syn cache entries*/
    317  1.150.20.2  rmind 	LIST_HEAD(, syn_cache) t_sc;	/* list of entries by this tcb */
    318  1.150.20.2  rmind 
    319  1.150.20.2  rmind /* prediction of next mbuf when using large window sizes */
    320  1.150.20.2  rmind 	struct	mbuf *t_lastm;		/* last mbuf that data was sent from */
    321  1.150.20.2  rmind 	int	t_inoff;		/* data offset in previous mbuf */
    322  1.150.20.2  rmind 	int	t_lastoff;		/* last data address in mbuf chain */
    323  1.150.20.2  rmind 	int	t_lastlen;		/* last length read from mbuf chain */
    324  1.150.20.2  rmind 
    325  1.150.20.2  rmind /* Path-MTU discovery blackhole detection */
    326  1.150.20.2  rmind 	int t_mtudisc;			/* perform mtudisc for this tcb */
    327  1.150.20.2  rmind /* Path-MTU Discovery Information */
    328  1.150.20.2  rmind 	u_int	t_pmtud_mss_acked;	/* MSS acked, lower bound for MTU */
    329  1.150.20.2  rmind 	u_int	t_pmtud_mtu_sent;	/* MTU used, upper bound for MTU */
    330  1.150.20.2  rmind 	tcp_seq	t_pmtud_th_seq;		/* TCP SEQ from ICMP payload */
    331  1.150.20.2  rmind 	u_int	t_pmtud_nextmtu;	/* Advertised Next-Hop MTU from ICMP */
    332  1.150.20.2  rmind 	u_short	t_pmtud_ip_len;		/* IP length from ICMP payload */
    333  1.150.20.2  rmind 	u_short	t_pmtud_ip_hl;		/* IP header length from ICMP payload */
    334  1.150.20.2  rmind 
    335  1.150.20.2  rmind 	uint8_t t_ecn_retries;		/* # of ECN setup retries */
    336  1.150.20.2  rmind 
    337  1.150.20.2  rmind 	struct tcp_congctl *t_congctl;	/* per TCB congctl algorithm */
    338  1.150.20.2  rmind 
    339  1.150.20.2  rmind 	/* Keepalive per socket */
    340  1.150.20.2  rmind 	u_int	t_keepinit;
    341  1.150.20.2  rmind 	u_int	t_keepidle;
    342  1.150.20.2  rmind 	u_int	t_keepintvl;
    343  1.150.20.2  rmind 	u_int	t_keepcnt;
    344  1.150.20.2  rmind 	u_int	t_maxidle;		/* t_keepcnt * t_keepintvl */
    345  1.150.20.2  rmind 
    346  1.150.20.2  rmind };
    347  1.150.20.2  rmind 
    348  1.150.20.2  rmind /*
    349  1.150.20.2  rmind  * Macros to aid ECN TCP.
    350  1.150.20.2  rmind  */
    351  1.150.20.2  rmind #define TCP_ECN_ALLOWED(tp)	(tp->t_flags & TF_ECN_PERMIT)
    352  1.150.20.2  rmind 
    353  1.150.20.2  rmind /*
    354  1.150.20.2  rmind  * Macros to aid SACK/FACK TCP.
    355  1.150.20.2  rmind  */
    356  1.150.20.2  rmind #define TCP_SACK_ENABLED(tp)	(tp->t_flags & TF_WILL_SACK)
    357  1.150.20.2  rmind #define TCP_FACK_FASTRECOV(tp)	\
    358  1.150.20.2  rmind 	(TCP_SACK_ENABLED(tp) && \
    359  1.150.20.2  rmind 	(SEQ_GT(tp->snd_fack, tp->snd_una + tcprexmtthresh * tp->t_segsz)))
    360  1.150.20.2  rmind 
    361  1.150.20.2  rmind #ifdef _KERNEL
    362  1.150.20.2  rmind /*
    363  1.150.20.2  rmind  * TCP reassembly queue locks.
    364  1.150.20.2  rmind  */
    365  1.150.20.2  rmind static __inline int tcp_reass_lock_try (struct tcpcb *)
    366  1.150.20.2  rmind 	__attribute__((__unused__));
    367  1.150.20.2  rmind static __inline void tcp_reass_unlock (struct tcpcb *)
    368  1.150.20.2  rmind 	__attribute__((__unused__));
    369  1.150.20.2  rmind 
    370  1.150.20.2  rmind static __inline int
    371  1.150.20.2  rmind tcp_reass_lock_try(tp)
    372  1.150.20.2  rmind 	struct tcpcb *tp;
    373  1.150.20.2  rmind {
    374  1.150.20.2  rmind 	int s;
    375  1.150.20.2  rmind 
    376  1.150.20.2  rmind 	/*
    377  1.150.20.2  rmind 	 * Use splvm() -- we're blocking things that would cause
    378  1.150.20.2  rmind 	 * mbuf allocation.
    379  1.150.20.2  rmind 	 */
    380  1.150.20.2  rmind 	s = splvm();
    381  1.150.20.2  rmind 	if (tp->t_flags & TF_REASSEMBLING) {
    382  1.150.20.2  rmind 		splx(s);
    383  1.150.20.2  rmind 		return (0);
    384  1.150.20.2  rmind 	}
    385  1.150.20.2  rmind 	tp->t_flags |= TF_REASSEMBLING;
    386  1.150.20.2  rmind 	splx(s);
    387  1.150.20.2  rmind 	return (1);
    388  1.150.20.2  rmind }
    389  1.150.20.2  rmind 
    390  1.150.20.2  rmind static __inline void
    391  1.150.20.2  rmind tcp_reass_unlock(tp)
    392  1.150.20.2  rmind 	struct tcpcb *tp;
    393  1.150.20.2  rmind {
    394  1.150.20.2  rmind 	int s;
    395  1.150.20.2  rmind 
    396  1.150.20.2  rmind 	s = splvm();
    397  1.150.20.2  rmind 	tp->t_flags &= ~TF_REASSEMBLING;
    398  1.150.20.2  rmind 	splx(s);
    399  1.150.20.2  rmind }
    400  1.150.20.2  rmind 
    401  1.150.20.2  rmind #ifdef DIAGNOSTIC
    402  1.150.20.2  rmind #define	TCP_REASS_LOCK(tp)						\
    403  1.150.20.2  rmind do {									\
    404  1.150.20.2  rmind 	if (tcp_reass_lock_try(tp) == 0) {				\
    405  1.150.20.2  rmind 		printf("%s:%d: tcpcb %p reass already locked\n",	\
    406  1.150.20.2  rmind 		    __FILE__, __LINE__, tp);				\
    407  1.150.20.2  rmind 		panic("tcp_reass_lock");				\
    408  1.150.20.2  rmind 	}								\
    409  1.150.20.2  rmind } while (/*CONSTCOND*/ 0)
    410  1.150.20.2  rmind #define	TCP_REASS_LOCK_CHECK(tp)					\
    411  1.150.20.2  rmind do {									\
    412  1.150.20.2  rmind 	if (((tp)->t_flags & TF_REASSEMBLING) == 0) {			\
    413  1.150.20.2  rmind 		printf("%s:%d: tcpcb %p reass lock not held\n",		\
    414  1.150.20.2  rmind 		    __FILE__, __LINE__, tp);				\
    415  1.150.20.2  rmind 		panic("tcp reass lock check");				\
    416  1.150.20.2  rmind 	}								\
    417  1.150.20.2  rmind } while (/*CONSTCOND*/ 0)
    418  1.150.20.2  rmind #else
    419  1.150.20.2  rmind #define	TCP_REASS_LOCK(tp)	(void) tcp_reass_lock_try((tp))
    420  1.150.20.2  rmind #define	TCP_REASS_LOCK_CHECK(tp) /* nothing */
    421  1.150.20.2  rmind #endif
    422  1.150.20.2  rmind 
    423  1.150.20.2  rmind #define	TCP_REASS_UNLOCK(tp)	tcp_reass_unlock((tp))
    424  1.150.20.2  rmind #endif /* _KERNEL */
    425  1.150.20.2  rmind 
    426  1.150.20.2  rmind /*
    427  1.150.20.2  rmind  * Queue for delayed ACK processing.
    428  1.150.20.2  rmind  */
    429  1.150.20.2  rmind #ifdef _KERNEL
    430  1.150.20.2  rmind extern int tcp_delack_ticks;
    431  1.150.20.2  rmind void	tcp_delack(void *);
    432  1.150.20.2  rmind 
    433  1.150.20.2  rmind #define TCP_RESTART_DELACK(tp)						\
    434  1.150.20.2  rmind 	callout_reset(&(tp)->t_delack_ch, tcp_delack_ticks,		\
    435  1.150.20.2  rmind 	    tcp_delack, tp)
    436  1.150.20.2  rmind 
    437  1.150.20.2  rmind #define	TCP_SET_DELACK(tp)						\
    438  1.150.20.2  rmind do {									\
    439  1.150.20.2  rmind 	if (((tp)->t_flags & TF_DELACK) == 0) {				\
    440  1.150.20.2  rmind 		(tp)->t_flags |= TF_DELACK;				\
    441  1.150.20.2  rmind 		TCP_RESTART_DELACK(tp);					\
    442  1.150.20.2  rmind 	}								\
    443  1.150.20.2  rmind } while (/*CONSTCOND*/0)
    444  1.150.20.2  rmind 
    445  1.150.20.2  rmind #define	TCP_CLEAR_DELACK(tp)						\
    446  1.150.20.2  rmind do {									\
    447  1.150.20.2  rmind 	if ((tp)->t_flags & TF_DELACK) {				\
    448  1.150.20.2  rmind 		(tp)->t_flags &= ~TF_DELACK;				\
    449  1.150.20.2  rmind 		callout_stop(&(tp)->t_delack_ch);			\
    450  1.150.20.2  rmind 	}								\
    451  1.150.20.2  rmind } while (/*CONSTCOND*/0)
    452  1.150.20.2  rmind #endif /* _KERNEL */
    453  1.150.20.2  rmind 
    454  1.150.20.2  rmind /*
    455  1.150.20.2  rmind  * Compute the current timestamp for a connection.
    456  1.150.20.2  rmind  */
    457  1.150.20.2  rmind #define	TCP_TIMESTAMP(tp)	(tcp_now - (tp)->ts_timebase)
    458  1.150.20.2  rmind 
    459  1.150.20.2  rmind /*
    460  1.150.20.2  rmind  * Handy way of passing around TCP option info.
    461  1.150.20.2  rmind  */
    462  1.150.20.2  rmind struct tcp_opt_info {
    463  1.150.20.2  rmind 	int		ts_present;
    464  1.150.20.2  rmind 	u_int32_t	ts_val;
    465  1.150.20.2  rmind 	u_int32_t	ts_ecr;
    466  1.150.20.2  rmind 	u_int16_t	maxseg;
    467  1.150.20.2  rmind };
    468  1.150.20.2  rmind 
    469  1.150.20.2  rmind #define	TOF_SIGNATURE	0x0040		/* signature option present */
    470  1.150.20.2  rmind #define	TOF_SIGLEN	0x0080		/* sigature length valid (RFC2385) */
    471  1.150.20.2  rmind 
    472  1.150.20.2  rmind /*
    473  1.150.20.2  rmind  * Data for the TCP compressed state engine.
    474  1.150.20.2  rmind  */
    475  1.150.20.2  rmind union syn_cache_sa {
    476  1.150.20.2  rmind 	struct sockaddr sa;
    477  1.150.20.2  rmind 	struct sockaddr_in sin;
    478  1.150.20.2  rmind #if 1 /*def INET6*/
    479  1.150.20.2  rmind 	struct sockaddr_in6 sin6;
    480  1.150.20.2  rmind #endif
    481  1.150.20.2  rmind };
    482  1.150.20.2  rmind 
    483  1.150.20.2  rmind struct syn_cache {
    484  1.150.20.2  rmind 	TAILQ_ENTRY(syn_cache) sc_bucketq;	/* link on bucket list */
    485  1.150.20.2  rmind 	callout_t sc_timer;			/* rexmt timer */
    486  1.150.20.2  rmind 	struct route sc_route;
    487  1.150.20.2  rmind 	long sc_win;				/* advertised window */
    488  1.150.20.2  rmind 	int sc_bucketidx;			/* our bucket index */
    489  1.150.20.2  rmind 	u_int32_t sc_hash;
    490  1.150.20.2  rmind 	u_int32_t sc_timestamp;			/* timestamp from SYN */
    491  1.150.20.2  rmind 	u_int32_t sc_timebase;			/* our local timebase */
    492  1.150.20.2  rmind 	union syn_cache_sa sc_src;
    493  1.150.20.2  rmind 	union syn_cache_sa sc_dst;
    494  1.150.20.2  rmind 	tcp_seq sc_irs;
    495  1.150.20.2  rmind 	tcp_seq sc_iss;
    496  1.150.20.2  rmind 	u_int sc_rxtcur;			/* current rxt timeout */
    497  1.150.20.2  rmind 	u_int sc_rxttot;			/* total time spend on queues */
    498  1.150.20.2  rmind 	u_short sc_rxtshift;			/* for computing backoff */
    499  1.150.20.2  rmind 	u_short sc_flags;
    500  1.150.20.2  rmind 
    501  1.150.20.2  rmind #define	SCF_UNREACH		0x0001		/* we've had an unreach error */
    502  1.150.20.2  rmind #define	SCF_TIMESTAMP		0x0002		/* peer will do timestamps */
    503  1.150.20.2  rmind #define	SCF_DEAD		0x0004		/* this entry to be released */
    504  1.150.20.2  rmind #define SCF_SACK_PERMIT		0x0008		/* peer will do SACK */
    505  1.150.20.2  rmind #define SCF_ECN_PERMIT		0x0010		/* peer will do ECN */
    506  1.150.20.2  rmind #define SCF_SIGNATURE	0x40			/* send MD5 digests */
    507  1.150.20.2  rmind 
    508  1.150.20.2  rmind 	struct mbuf *sc_ipopts;			/* IP options */
    509  1.150.20.2  rmind 	u_int16_t sc_peermaxseg;
    510  1.150.20.2  rmind 	u_int16_t sc_ourmaxseg;
    511  1.150.20.2  rmind 	u_int8_t sc_request_r_scale	: 4,
    512  1.150.20.2  rmind 		 sc_requested_s_scale	: 4;
    513  1.150.20.2  rmind 
    514  1.150.20.2  rmind 	struct tcpcb *sc_tp;			/* tcb for listening socket */
    515  1.150.20.2  rmind 	LIST_ENTRY(syn_cache) sc_tpq;		/* list of entries by same tp */
    516  1.150.20.2  rmind };
    517  1.150.20.2  rmind 
    518  1.150.20.2  rmind struct syn_cache_head {
    519  1.150.20.2  rmind 	TAILQ_HEAD(, syn_cache) sch_bucket;	/* bucket entries */
    520  1.150.20.2  rmind 	u_short sch_length;			/* # entries in bucket */
    521  1.150.20.2  rmind };
    522  1.150.20.2  rmind 
    523  1.150.20.2  rmind #define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
    524  1.150.20.2  rmind #ifdef INET6
    525  1.150.20.2  rmind #define	in6totcpcb(ip)	((struct tcpcb *)(ip)->in6p_ppcb)
    526  1.150.20.2  rmind #endif
    527  1.150.20.2  rmind #ifndef INET6
    528  1.150.20.2  rmind #define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
    529  1.150.20.2  rmind #else
    530  1.150.20.2  rmind #define	sototcpcb(so)	(((so)->so_proto->pr_domain->dom_family == AF_INET) \
    531  1.150.20.2  rmind 				? intotcpcb(sotoinpcb(so)) \
    532  1.150.20.2  rmind 				: in6totcpcb(sotoin6pcb(so)))
    533  1.150.20.2  rmind #endif
    534  1.150.20.2  rmind 
    535  1.150.20.2  rmind /*
    536  1.150.20.2  rmind  * The smoothed round-trip time and estimated variance
    537  1.150.20.2  rmind  * are stored as fixed point numbers scaled by the values below.
    538  1.150.20.2  rmind  * For convenience, these scales are also used in smoothing the average
    539  1.150.20.2  rmind  * (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed).
    540  1.150.20.2  rmind  * With these scales, srtt has 3 bits to the right of the binary point,
    541  1.150.20.2  rmind  * and thus an "ALPHA" of 0.875.  rttvar has 2 bits to the right of the
    542  1.150.20.2  rmind  * binary point, and is smoothed with an ALPHA of 0.75.
    543  1.150.20.2  rmind  */
    544  1.150.20.2  rmind #define	TCP_RTT_SHIFT		3	/* shift for srtt; 3 bits frac. */
    545  1.150.20.2  rmind #define	TCP_RTTVAR_SHIFT	2	/* multiplier for rttvar; 2 bits */
    546  1.150.20.2  rmind 
    547  1.150.20.2  rmind /*
    548  1.150.20.2  rmind  * The initial retransmission should happen at rtt + 4 * rttvar.
    549  1.150.20.2  rmind  * Because of the way we do the smoothing, srtt and rttvar
    550  1.150.20.2  rmind  * will each average +1/2 tick of bias.  When we compute
    551  1.150.20.2  rmind  * the retransmit timer, we want 1/2 tick of rounding and
    552  1.150.20.2  rmind  * 1 extra tick because of +-1/2 tick uncertainty in the
    553  1.150.20.2  rmind  * firing of the timer.  The bias will give us exactly the
    554  1.150.20.2  rmind  * 1.5 tick we need.  But, because the bias is
    555  1.150.20.2  rmind  * statistical, we have to test that we don't drop below
    556  1.150.20.2  rmind  * the minimum feasible timer (which is 2 ticks).
    557  1.150.20.2  rmind  * This macro assumes that the value of 1<<TCP_RTTVAR_SHIFT
    558  1.150.20.2  rmind  * is the same as the multiplier for rttvar.
    559  1.150.20.2  rmind  */
    560  1.150.20.2  rmind #define	TCP_REXMTVAL(tp) \
    561  1.150.20.2  rmind 	((((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) >> 2)
    562  1.150.20.2  rmind 
    563  1.150.20.2  rmind /*
    564  1.150.20.2  rmind  * Compute the initial window for slow start.
    565  1.150.20.2  rmind  */
    566  1.150.20.2  rmind #define	TCP_INITIAL_WINDOW(iw, segsz) \
    567  1.150.20.2  rmind 	(((iw) == 0) ? (min(4 * (segsz), max(2 * (segsz), 4380))) : \
    568  1.150.20.2  rmind 	 ((segsz) * (iw)))
    569  1.150.20.2  rmind 
    570  1.150.20.2  rmind /*
    571  1.150.20.2  rmind  * TCP statistics.
    572  1.150.20.2  rmind  * Many of these should be kept per connection,
    573  1.150.20.2  rmind  * but that's inconvenient at the moment.
    574  1.150.20.2  rmind  */
    575  1.150.20.2  rmind struct	tcpstat {
    576  1.150.20.2  rmind 	u_quad_t tcps_connattempt;	/* connections initiated */
    577  1.150.20.2  rmind 	u_quad_t tcps_accepts;		/* connections accepted */
    578  1.150.20.2  rmind 	u_quad_t tcps_connects;		/* connections established */
    579  1.150.20.2  rmind 	u_quad_t tcps_drops;		/* connections dropped */
    580  1.150.20.2  rmind 	u_quad_t tcps_conndrops;	/* embryonic connections dropped */
    581  1.150.20.2  rmind 	u_quad_t tcps_closed;		/* conn. closed (includes drops) */
    582  1.150.20.2  rmind 	u_quad_t tcps_segstimed;	/* segs where we tried to get rtt */
    583  1.150.20.2  rmind 	u_quad_t tcps_rttupdated;	/* times we succeeded */
    584  1.150.20.2  rmind 	u_quad_t tcps_delack;		/* delayed acks sent */
    585  1.150.20.2  rmind 	u_quad_t tcps_timeoutdrop;	/* conn. dropped in rxmt timeout */
    586  1.150.20.2  rmind 	u_quad_t tcps_rexmttimeo;	/* retransmit timeouts */
    587  1.150.20.2  rmind 	u_quad_t tcps_persisttimeo;	/* persist timeouts */
    588  1.150.20.2  rmind 	u_quad_t tcps_keeptimeo;	/* keepalive timeouts */
    589  1.150.20.2  rmind 	u_quad_t tcps_keepprobe;	/* keepalive probes sent */
    590  1.150.20.2  rmind 	u_quad_t tcps_keepdrops;	/* connections dropped in keepalive */
    591  1.150.20.2  rmind 	u_quad_t tcps_persistdrops;	/* connections dropped in persist */
    592  1.150.20.2  rmind 	u_quad_t tcps_connsdrained;	/* connections drained due to memory
    593  1.150.20.2  rmind 					   shortage */
    594  1.150.20.2  rmind 	u_quad_t tcps_pmtublackhole;	/* PMTUD blackhole detected */
    595  1.150.20.2  rmind 
    596  1.150.20.2  rmind 	u_quad_t tcps_sndtotal;		/* total packets sent */
    597  1.150.20.2  rmind 	u_quad_t tcps_sndpack;		/* data packets sent */
    598  1.150.20.2  rmind 	u_quad_t tcps_sndbyte;		/* data bytes sent */
    599  1.150.20.2  rmind 	u_quad_t tcps_sndrexmitpack;	/* data packets retransmitted */
    600  1.150.20.2  rmind 	u_quad_t tcps_sndrexmitbyte;	/* data bytes retransmitted */
    601  1.150.20.2  rmind 	u_quad_t tcps_sndacks;		/* ack-only packets sent */
    602  1.150.20.2  rmind 	u_quad_t tcps_sndprobe;		/* window probes sent */
    603  1.150.20.2  rmind 	u_quad_t tcps_sndurg;		/* packets sent with URG only */
    604  1.150.20.2  rmind 	u_quad_t tcps_sndwinup;		/* window update-only packets sent */
    605  1.150.20.2  rmind 	u_quad_t tcps_sndctrl;		/* control (SYN|FIN|RST) packets sent */
    606  1.150.20.2  rmind 
    607  1.150.20.2  rmind 	u_quad_t tcps_rcvtotal;		/* total packets received */
    608  1.150.20.2  rmind 	u_quad_t tcps_rcvpack;		/* packets received in sequence */
    609  1.150.20.2  rmind 	u_quad_t tcps_rcvbyte;		/* bytes received in sequence */
    610  1.150.20.2  rmind 	u_quad_t tcps_rcvbadsum;	/* packets received with ccksum errs */
    611  1.150.20.2  rmind 	u_quad_t tcps_rcvbadoff;	/* packets received with bad offset */
    612  1.150.20.2  rmind 	u_quad_t tcps_rcvmemdrop;	/* packets dropped for lack of memory */
    613  1.150.20.2  rmind 	u_quad_t tcps_rcvshort;		/* packets received too short */
    614  1.150.20.2  rmind 	u_quad_t tcps_rcvduppack;	/* duplicate-only packets received */
    615  1.150.20.2  rmind 	u_quad_t tcps_rcvdupbyte;	/* duplicate-only bytes received */
    616  1.150.20.2  rmind 	u_quad_t tcps_rcvpartduppack;	/* packets with some duplicate data */
    617  1.150.20.2  rmind 	u_quad_t tcps_rcvpartdupbyte;	/* dup. bytes in part-dup. packets */
    618  1.150.20.2  rmind 	u_quad_t tcps_rcvoopack;	/* out-of-order packets received */
    619  1.150.20.2  rmind 	u_quad_t tcps_rcvoobyte;	/* out-of-order bytes received */
    620  1.150.20.2  rmind 	u_quad_t tcps_rcvpackafterwin;	/* packets with data after window */
    621  1.150.20.2  rmind 	u_quad_t tcps_rcvbyteafterwin;	/* bytes rcvd after window */
    622  1.150.20.2  rmind 	u_quad_t tcps_rcvafterclose;	/* packets rcvd after "close" */
    623  1.150.20.2  rmind 	u_quad_t tcps_rcvwinprobe;	/* rcvd window probe packets */
    624  1.150.20.2  rmind 	u_quad_t tcps_rcvdupack;	/* rcvd duplicate acks */
    625  1.150.20.2  rmind 	u_quad_t tcps_rcvacktoomuch;	/* rcvd acks for unsent data */
    626  1.150.20.2  rmind 	u_quad_t tcps_rcvackpack;	/* rcvd ack packets */
    627  1.150.20.2  rmind 	u_quad_t tcps_rcvackbyte;	/* bytes acked by rcvd acks */
    628  1.150.20.2  rmind 	u_quad_t tcps_rcvwinupd;	/* rcvd window update packets */
    629  1.150.20.2  rmind 	u_quad_t tcps_pawsdrop;		/* segments dropped due to PAWS */
    630  1.150.20.2  rmind 	u_quad_t tcps_predack;		/* times hdr predict ok for acks */
    631  1.150.20.2  rmind 	u_quad_t tcps_preddat;		/* times hdr predict ok for data pkts */
    632  1.150.20.2  rmind 
    633  1.150.20.2  rmind 	u_quad_t tcps_pcbhashmiss;	/* input packets missing pcb hash */
    634  1.150.20.2  rmind 	u_quad_t tcps_noport;		/* no socket on port */
    635  1.150.20.2  rmind 	u_quad_t tcps_badsyn;		/* received ack for which we have
    636  1.150.20.2  rmind 					   no SYN in compressed state */
    637  1.150.20.2  rmind 	u_quad_t tcps_delayed_free;	/* delayed pool_put() of tcpcb */
    638  1.150.20.2  rmind 
    639  1.150.20.2  rmind 	/* These statistics deal with the SYN cache. */
    640  1.150.20.2  rmind 	u_quad_t tcps_sc_added;		/* # of entries added */
    641  1.150.20.2  rmind 	u_quad_t tcps_sc_completed;	/* # of connections completed */
    642  1.150.20.2  rmind 	u_quad_t tcps_sc_timed_out;	/* # of entries timed out */
    643  1.150.20.2  rmind 	u_quad_t tcps_sc_overflowed;	/* # dropped due to overflow */
    644  1.150.20.2  rmind 	u_quad_t tcps_sc_reset;		/* # dropped due to RST */
    645  1.150.20.2  rmind 	u_quad_t tcps_sc_unreach;	/* # dropped due to ICMP unreach */
    646  1.150.20.2  rmind 	u_quad_t tcps_sc_bucketoverflow;/* # dropped due to bucket overflow */
    647  1.150.20.2  rmind 	u_quad_t tcps_sc_aborted;	/* # of entries aborted (no mem) */
    648  1.150.20.2  rmind 	u_quad_t tcps_sc_dupesyn;	/* # of duplicate SYNs received */
    649  1.150.20.2  rmind 	u_quad_t tcps_sc_dropped;	/* # of SYNs dropped (no route/mem) */
    650  1.150.20.2  rmind 	u_quad_t tcps_sc_collisions;	/* # of hash collisions */
    651  1.150.20.2  rmind 	u_quad_t tcps_sc_retransmitted;	/* # of retransmissions */
    652  1.150.20.2  rmind 	u_quad_t tcps_sc_delayed_free;	/* # of delayed pool_put()s */
    653  1.150.20.2  rmind 
    654  1.150.20.2  rmind 	u_quad_t tcps_selfquench;	/* # of ENOBUFS we get on output */
    655  1.150.20.2  rmind 	u_quad_t tcps_badsig;		/* # of drops due to bad signature */
    656  1.150.20.2  rmind 	u_quad_t tcps_goodsig;		/* # of packets with good signature */
    657  1.150.20.2  rmind 
    658  1.150.20.2  rmind 	u_quad_t tcps_ecn_shs;		/* # of sucessful ECN handshakes */
    659  1.150.20.2  rmind 	u_quad_t tcps_ecn_ce;		/* # of packets with CE bit */
    660  1.150.20.2  rmind 	u_quad_t tcps_ecn_ect;		/* # of packets with ECT(0) bit */
    661  1.150.20.2  rmind };
    662  1.150.20.2  rmind 
    663  1.150.20.2  rmind /*
    664  1.150.20.2  rmind  * Names for TCP sysctl objects.
    665  1.150.20.2  rmind  */
    666  1.150.20.2  rmind #define	TCPCTL_RFC1323		1	/* RFC1323 timestamps/scaling */
    667  1.150.20.2  rmind #define	TCPCTL_SENDSPACE	2	/* default send buffer */
    668  1.150.20.2  rmind #define	TCPCTL_RECVSPACE	3	/* default recv buffer */
    669  1.150.20.2  rmind #define	TCPCTL_MSSDFLT		4	/* default seg size */
    670  1.150.20.2  rmind #define	TCPCTL_SYN_CACHE_LIMIT	5	/* max size of comp. state engine */
    671  1.150.20.2  rmind #define	TCPCTL_SYN_BUCKET_LIMIT	6	/* max size of hash bucket */
    672  1.150.20.2  rmind #if 0	/*obsoleted*/
    673  1.150.20.2  rmind #define	TCPCTL_SYN_CACHE_INTER	7	/* interval of comp. state timer */
    674  1.150.20.2  rmind #endif
    675  1.150.20.2  rmind #define	TCPCTL_INIT_WIN		8	/* initial window */
    676  1.150.20.2  rmind #define	TCPCTL_MSS_IFMTU	9	/* mss from interface, not in_maxmtu */
    677  1.150.20.2  rmind #define	TCPCTL_SACK		10	/* RFC2018 selective acknowledgement */
    678  1.150.20.2  rmind #define	TCPCTL_WSCALE		11	/* RFC1323 window scaling */
    679  1.150.20.2  rmind #define	TCPCTL_TSTAMP		12	/* RFC1323 timestamps */
    680  1.150.20.2  rmind #define	TCPCTL_COMPAT_42	13	/* 4.2BSD TCP bug work-arounds */
    681  1.150.20.2  rmind #define	TCPCTL_CWM		14	/* Congestion Window Monitoring */
    682  1.150.20.2  rmind #define	TCPCTL_CWM_BURSTSIZE	15	/* burst size allowed by CWM */
    683  1.150.20.2  rmind #define	TCPCTL_ACK_ON_PUSH	16	/* ACK immediately on PUSH */
    684  1.150.20.2  rmind #define	TCPCTL_KEEPIDLE		17	/* keepalive idle time */
    685  1.150.20.2  rmind #define	TCPCTL_KEEPINTVL	18	/* keepalive probe interval */
    686  1.150.20.2  rmind #define	TCPCTL_KEEPCNT		19	/* keepalive count */
    687  1.150.20.2  rmind #define	TCPCTL_SLOWHZ		20	/* PR_SLOWHZ (read-only) */
    688  1.150.20.2  rmind #define	TCPCTL_NEWRENO		21	/* NewReno Congestion Control */
    689  1.150.20.2  rmind #define TCPCTL_LOG_REFUSED	22	/* Log refused connections */
    690  1.150.20.2  rmind #if 0	/*obsoleted*/
    691  1.150.20.2  rmind #define	TCPCTL_RSTRATELIMIT	23	/* RST rate limit */
    692  1.150.20.2  rmind #endif
    693  1.150.20.2  rmind #define	TCPCTL_RSTPPSLIMIT	24	/* RST pps limit */
    694  1.150.20.2  rmind #define	TCPCTL_DELACK_TICKS	25	/* # ticks to delay ACK */
    695  1.150.20.2  rmind #define	TCPCTL_INIT_WIN_LOCAL	26	/* initial window for local nets */
    696  1.150.20.2  rmind #define	TCPCTL_IDENT		27	/* rfc 931 identd */
    697  1.150.20.2  rmind #define	TCPCTL_ACKDROPRATELIMIT	28	/* SYN/RST -> ACK rate limit */
    698  1.150.20.2  rmind #define	TCPCTL_LOOPBACKCKSUM	29	/* do TCP checksum on loopback */
    699  1.150.20.2  rmind #define	TCPCTL_STATS		30	/* TCP statistics */
    700  1.150.20.2  rmind #define	TCPCTL_DEBUG		31	/* TCP debug sockets */
    701  1.150.20.2  rmind #define	TCPCTL_DEBX		32	/* # of tcp debug sockets */
    702  1.150.20.2  rmind #define	TCPCTL_DROP		33	/* drop tcp connection */
    703  1.150.20.2  rmind #define	TCPCTL_MAXID		34
    704  1.150.20.2  rmind 
    705  1.150.20.2  rmind #define	TCPCTL_NAMES { \
    706  1.150.20.2  rmind 	{ 0, 0 }, \
    707  1.150.20.2  rmind 	{ "rfc1323",	CTLTYPE_INT }, \
    708  1.150.20.2  rmind 	{ "sendspace",	CTLTYPE_INT }, \
    709  1.150.20.2  rmind 	{ "recvspace",	CTLTYPE_INT }, \
    710  1.150.20.2  rmind 	{ "mssdflt",	CTLTYPE_INT }, \
    711  1.150.20.2  rmind 	{ "syn_cache_limit", CTLTYPE_INT }, \
    712  1.150.20.2  rmind 	{ "syn_bucket_limit", CTLTYPE_INT }, \
    713  1.150.20.2  rmind 	{ 0, 0 },\
    714  1.150.20.2  rmind 	{ "init_win", CTLTYPE_INT }, \
    715  1.150.20.2  rmind 	{ "mss_ifmtu", CTLTYPE_INT }, \
    716  1.150.20.2  rmind 	{ "sack", CTLTYPE_INT }, \
    717  1.150.20.2  rmind 	{ "win_scale", CTLTYPE_INT }, \
    718  1.150.20.2  rmind 	{ "timestamps", CTLTYPE_INT }, \
    719  1.150.20.2  rmind 	{ "compat_42", CTLTYPE_INT }, \
    720  1.150.20.2  rmind 	{ "cwm", CTLTYPE_INT }, \
    721  1.150.20.2  rmind 	{ "cwm_burstsize", CTLTYPE_INT }, \
    722  1.150.20.2  rmind 	{ "ack_on_push", CTLTYPE_INT }, \
    723  1.150.20.2  rmind 	{ "keepidle",	CTLTYPE_INT }, \
    724  1.150.20.2  rmind 	{ "keepintvl",	CTLTYPE_INT }, \
    725  1.150.20.2  rmind 	{ "keepcnt",	CTLTYPE_INT }, \
    726  1.150.20.2  rmind 	{ "slowhz",	CTLTYPE_INT }, \
    727  1.150.20.2  rmind 	{ 0, 0 }, \
    728  1.150.20.2  rmind 	{ "log_refused",CTLTYPE_INT }, \
    729  1.150.20.2  rmind 	{ 0, 0 }, \
    730  1.150.20.2  rmind 	{ "rstppslimit", CTLTYPE_INT }, \
    731  1.150.20.2  rmind 	{ "delack_ticks", CTLTYPE_INT }, \
    732  1.150.20.2  rmind 	{ "init_win_local", CTLTYPE_INT }, \
    733  1.150.20.2  rmind 	{ "ident", CTLTYPE_STRUCT }, \
    734  1.150.20.2  rmind 	{ "ackdropppslimit", CTLTYPE_INT }, \
    735  1.150.20.2  rmind 	{ "do_loopback_cksum", CTLTYPE_INT }, \
    736  1.150.20.2  rmind 	{ "stats", CTLTYPE_STRUCT }, \
    737  1.150.20.2  rmind 	{ "debug", CTLTYPE_STRUCT }, \
    738  1.150.20.2  rmind 	{ "debx", CTLTYPE_INT }, \
    739  1.150.20.2  rmind 	{ "drop", CTLTYPE_STRUCT }, \
    740  1.150.20.2  rmind }
    741  1.150.20.2  rmind 
    742  1.150.20.2  rmind #ifdef _KERNEL
    743  1.150.20.2  rmind extern	struct inpcbtable tcbtable;	/* head of queue of active tcpcb's */
    744  1.150.20.2  rmind extern	struct tcpstat tcpstat;	/* tcp statistics */
    745  1.150.20.2  rmind extern	u_int32_t tcp_now;	/* for RFC 1323 timestamps */
    746  1.150.20.2  rmind extern	int tcp_do_rfc1323;	/* enabled/disabled? */
    747  1.150.20.2  rmind extern	int tcp_do_sack;	/* SACK enabled/disabled? */
    748  1.150.20.2  rmind extern	int tcp_do_win_scale;	/* RFC1323 window scaling enabled/disabled? */
    749  1.150.20.2  rmind extern	int tcp_do_timestamps;	/* RFC1323 timestamps enabled/disabled? */
    750  1.150.20.2  rmind extern	int tcp_mssdflt;	/* default seg size */
    751  1.150.20.2  rmind extern	int tcp_minmss;		/* minimal seg size */
    752  1.150.20.2  rmind extern	int tcp_init_win;	/* initial window */
    753  1.150.20.2  rmind extern	int tcp_init_win_local;	/* initial window for local nets */
    754  1.150.20.2  rmind extern	int tcp_mss_ifmtu;	/* take MSS from interface, not in_maxmtu */
    755  1.150.20.2  rmind extern	int tcp_compat_42;	/* work around ancient broken TCP peers */
    756  1.150.20.2  rmind extern	int tcp_cwm;		/* enable Congestion Window Monitoring */
    757  1.150.20.2  rmind extern	int tcp_cwm_burstsize;	/* burst size allowed by CWM */
    758  1.150.20.2  rmind extern	int tcp_ack_on_push;	/* ACK immediately on PUSH */
    759  1.150.20.2  rmind extern	int tcp_syn_cache_limit; /* max entries for compressed state engine */
    760  1.150.20.2  rmind extern	int tcp_syn_bucket_limit;/* max entries per hash bucket */
    761  1.150.20.2  rmind extern	int tcp_log_refused;	/* log refused connections */
    762  1.150.20.2  rmind extern	int tcp_do_ecn;		/* TCP ECN enabled/disabled? */
    763  1.150.20.2  rmind extern	int tcp_ecn_maxretries;	/* Max ECN setup retries */
    764  1.150.20.2  rmind #if NRND > 0
    765  1.150.20.2  rmind extern	int tcp_do_rfc1948;	/* ISS by cryptographic hash */
    766  1.150.20.2  rmind #endif
    767  1.150.20.2  rmind extern int tcp_sack_tp_maxholes;	/* Max holes per connection. */
    768  1.150.20.2  rmind extern int tcp_sack_globalmaxholes;	/* Max holes per system. */
    769  1.150.20.2  rmind extern int tcp_sack_globalholes;	/* Number of holes present. */
    770  1.150.20.2  rmind extern int tcp_do_abc;			/* RFC3465 ABC enabled/disabled? */
    771  1.150.20.2  rmind extern int tcp_abc_aggressive;		/* 1: L=2*SMSS  0: L=1*SMSS */
    772  1.150.20.2  rmind 
    773  1.150.20.2  rmind extern	int tcp_rst_ppslim;
    774  1.150.20.2  rmind extern	int tcp_ackdrop_ppslim;
    775  1.150.20.2  rmind 
    776  1.150.20.2  rmind extern	int tcp_syn_cache_size;
    777  1.150.20.2  rmind extern	struct syn_cache_head tcp_syn_cache[];
    778  1.150.20.2  rmind extern	u_long syn_cache_count;
    779  1.150.20.2  rmind 
    780  1.150.20.2  rmind #ifdef MBUFTRACE
    781  1.150.20.2  rmind extern	struct mowner tcp_rx_mowner;
    782  1.150.20.2  rmind extern	struct mowner tcp_tx_mowner;
    783  1.150.20.2  rmind extern	struct mowner tcp_reass_mowner;
    784  1.150.20.2  rmind extern	struct mowner tcp_sock_mowner;
    785  1.150.20.2  rmind extern	struct mowner tcp_sock_rx_mowner;
    786  1.150.20.2  rmind extern	struct mowner tcp_sock_tx_mowner;
    787  1.150.20.2  rmind extern	struct mowner tcp_mowner;
    788  1.150.20.2  rmind #endif
    789  1.150.20.2  rmind 
    790  1.150.20.2  rmind extern int tcp_do_autorcvbuf;
    791  1.150.20.2  rmind extern int tcp_autorcvbuf_inc;
    792  1.150.20.2  rmind extern int tcp_autorcvbuf_max;
    793  1.150.20.2  rmind extern int tcp_do_autosndbuf;
    794  1.150.20.2  rmind extern int tcp_autosndbuf_inc;
    795  1.150.20.2  rmind extern int tcp_autosndbuf_max;
    796  1.150.20.2  rmind 
    797  1.150.20.2  rmind 
    798  1.150.20.2  rmind #define	TCPCTL_VARIABLES { \
    799  1.150.20.2  rmind 	{ 0 },					\
    800  1.150.20.2  rmind 	{ 1, 0, &tcp_do_rfc1323 },		\
    801  1.150.20.2  rmind 	{ 1, 0, &tcp_sendspace },		\
    802  1.150.20.2  rmind 	{ 1, 0, &tcp_recvspace },		\
    803  1.150.20.2  rmind 	{ 1, 0, &tcp_mssdflt },			\
    804  1.150.20.2  rmind 	{ 1, 0, &tcp_syn_cache_limit },		\
    805  1.150.20.2  rmind 	{ 1, 0, &tcp_syn_bucket_limit },	\
    806  1.150.20.2  rmind 	{ 0 },					\
    807  1.150.20.2  rmind 	{ 1, 0, &tcp_init_win },		\
    808  1.150.20.2  rmind 	{ 1, 0, &tcp_mss_ifmtu },		\
    809  1.150.20.2  rmind 	{ 1, 0, &tcp_do_sack },			\
    810  1.150.20.2  rmind 	{ 1, 0, &tcp_do_win_scale },		\
    811  1.150.20.2  rmind 	{ 1, 0, &tcp_do_timestamps },		\
    812  1.150.20.2  rmind 	{ 1, 0, &tcp_compat_42 },		\
    813  1.150.20.2  rmind 	{ 1, 0, &tcp_cwm },			\
    814  1.150.20.2  rmind 	{ 1, 0, &tcp_cwm_burstsize },		\
    815  1.150.20.2  rmind 	{ 1, 0, &tcp_ack_on_push },		\
    816  1.150.20.2  rmind 	{ 1, 0, &tcp_keepidle },		\
    817  1.150.20.2  rmind 	{ 1, 0, &tcp_keepintvl },		\
    818  1.150.20.2  rmind 	{ 1, 0, &tcp_keepcnt },			\
    819  1.150.20.2  rmind 	{ 1, 1, 0, PR_SLOWHZ },			\
    820  1.150.20.2  rmind 	{ 0 },					\
    821  1.150.20.2  rmind 	{ 1, 0, &tcp_log_refused },		\
    822  1.150.20.2  rmind 	{ 0 },					\
    823  1.150.20.2  rmind 	{ 1, 0, &tcp_rst_ppslim },		\
    824  1.150.20.2  rmind 	{ 1, 0, &tcp_delack_ticks },		\
    825  1.150.20.2  rmind 	{ 1, 0, &tcp_init_win_local },		\
    826  1.150.20.2  rmind 	{ 1, 0, &tcp_ackdrop_ppslim },		\
    827  1.150.20.2  rmind }
    828  1.150.20.2  rmind 
    829  1.150.20.2  rmind #ifdef __NO_STRICT_ALIGNMENT
    830  1.150.20.2  rmind #define	TCP_HDR_ALIGNED_P(th)	1
    831  1.150.20.2  rmind #else
    832  1.150.20.2  rmind #define	TCP_HDR_ALIGNED_P(th)	((((vaddr_t)(th)) & 3) == 0)
    833  1.150.20.2  rmind #endif
    834  1.150.20.2  rmind 
    835  1.150.20.2  rmind struct secasvar;
    836  1.150.20.2  rmind 
    837  1.150.20.2  rmind int	 tcp_attach(struct socket *);
    838  1.150.20.2  rmind void	 tcp_canceltimers(struct tcpcb *);
    839  1.150.20.2  rmind int	 tcp_timers_invoking(struct tcpcb*);
    840  1.150.20.2  rmind struct tcpcb *
    841  1.150.20.2  rmind 	 tcp_close(struct tcpcb *);
    842  1.150.20.2  rmind int	 tcp_isdead(struct tcpcb *);
    843  1.150.20.2  rmind #ifdef INET6
    844  1.150.20.2  rmind void	 tcp6_ctlinput(int, const struct sockaddr *, void *);
    845  1.150.20.2  rmind #endif
    846  1.150.20.2  rmind void	 *tcp_ctlinput(int, const struct sockaddr *, void *);
    847  1.150.20.2  rmind int	 tcp_ctloutput(int, struct socket *, int, int, struct mbuf **);
    848  1.150.20.2  rmind struct tcpcb *
    849  1.150.20.2  rmind 	 tcp_disconnect(struct tcpcb *);
    850  1.150.20.2  rmind struct tcpcb *
    851  1.150.20.2  rmind 	 tcp_drop(struct tcpcb *, int);
    852  1.150.20.2  rmind #ifdef TCP_SIGNATURE
    853  1.150.20.2  rmind int	 tcp_signature_apply(void *, void *, u_int);
    854  1.150.20.2  rmind struct secasvar *tcp_signature_getsav(struct mbuf *, struct tcphdr *);
    855  1.150.20.2  rmind int	 tcp_signature(struct mbuf *, struct tcphdr *, int, struct secasvar *,
    856  1.150.20.2  rmind 	    char *);
    857  1.150.20.2  rmind #endif
    858  1.150.20.2  rmind void	 tcp_drain(void);
    859  1.150.20.2  rmind void	 tcp_established(struct tcpcb *);
    860  1.150.20.2  rmind void	 tcp_init(void);
    861  1.150.20.2  rmind #ifdef INET6
    862  1.150.20.2  rmind int	 tcp6_input(struct mbuf **, int *, int);
    863  1.150.20.2  rmind #endif
    864  1.150.20.2  rmind void	 tcp_input(struct mbuf *, ...);
    865  1.150.20.2  rmind u_int	 tcp_hdrsz(struct tcpcb *);
    866  1.150.20.2  rmind u_long	 tcp_mss_to_advertise(const struct ifnet *, int);
    867  1.150.20.2  rmind void	 tcp_mss_from_peer(struct tcpcb *, int);
    868  1.150.20.2  rmind void	 tcp_tcpcb_template(void);
    869  1.150.20.2  rmind struct tcpcb *
    870  1.150.20.2  rmind 	 tcp_newtcpcb(int, void *);
    871  1.150.20.2  rmind void	 tcp_notify(struct inpcb *, int);
    872  1.150.20.2  rmind #ifdef INET6
    873  1.150.20.2  rmind void	 tcp6_notify(struct in6pcb *, int);
    874  1.150.20.2  rmind #endif
    875  1.150.20.2  rmind u_int	 tcp_optlen(struct tcpcb *);
    876  1.150.20.2  rmind int	 tcp_output(struct tcpcb *);
    877  1.150.20.2  rmind void	 tcp_pulloutofband(struct socket *,
    878  1.150.20.2  rmind 	    struct tcphdr *, struct mbuf *, int);
    879  1.150.20.2  rmind void	 tcp_quench(struct inpcb *, int);
    880  1.150.20.2  rmind #ifdef INET6
    881  1.150.20.2  rmind void	 tcp6_quench(struct in6pcb *, int);
    882  1.150.20.2  rmind #endif
    883  1.150.20.2  rmind void	 tcp_mtudisc(struct inpcb *, int);
    884  1.150.20.2  rmind 
    885  1.150.20.2  rmind struct ipqent *tcpipqent_alloc(void);
    886  1.150.20.2  rmind void	 tcpipqent_free(struct ipqent *);
    887  1.150.20.2  rmind 
    888  1.150.20.2  rmind int	 tcp_respond(struct tcpcb *, struct mbuf *, struct mbuf *,
    889  1.150.20.2  rmind 	    struct tcphdr *, tcp_seq, tcp_seq, int);
    890  1.150.20.2  rmind void	 tcp_rmx_rtt(struct tcpcb *);
    891  1.150.20.2  rmind void	 tcp_setpersist(struct tcpcb *);
    892  1.150.20.2  rmind #ifdef TCP_SIGNATURE
    893  1.150.20.2  rmind int	 tcp_signature_compute(struct mbuf *, struct tcphdr *, int, int,
    894  1.150.20.2  rmind 	    int, u_char *, u_int);
    895  1.150.20.2  rmind #endif
    896  1.150.20.2  rmind void	 tcp_slowtimo(void);
    897  1.150.20.2  rmind struct mbuf *
    898  1.150.20.2  rmind 	 tcp_template(struct tcpcb *);
    899  1.150.20.2  rmind void	 tcp_trace(short, short, struct tcpcb *, struct mbuf *, int);
    900  1.150.20.2  rmind struct tcpcb *
    901  1.150.20.2  rmind 	 tcp_usrclosed(struct tcpcb *);
    902  1.150.20.2  rmind int	 tcp_usrreq(struct socket *,
    903  1.150.20.2  rmind 	    int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *);
    904  1.150.20.2  rmind void	 tcp_xmit_timer(struct tcpcb *, uint32_t);
    905  1.150.20.2  rmind tcp_seq	 tcp_new_iss(struct tcpcb *, tcp_seq);
    906  1.150.20.2  rmind tcp_seq  tcp_new_iss1(void *, void *, u_int16_t, u_int16_t, size_t,
    907  1.150.20.2  rmind 	    tcp_seq);
    908  1.150.20.2  rmind 
    909  1.150.20.2  rmind void	 tcp_new_dsack(struct tcpcb *, tcp_seq, u_int32_t);
    910  1.150.20.2  rmind void	 tcp_sack_option(struct tcpcb *, const struct tcphdr *,
    911  1.150.20.2  rmind 	    const u_char *, int);
    912  1.150.20.2  rmind void	 tcp_del_sackholes(struct tcpcb *, const struct tcphdr *);
    913  1.150.20.2  rmind void	 tcp_free_sackholes(struct tcpcb *);
    914  1.150.20.2  rmind void	 tcp_sack_adjust(struct tcpcb *tp);
    915  1.150.20.2  rmind struct sackhole *tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt);
    916  1.150.20.2  rmind void	 tcp_sack_newack(struct tcpcb *, const struct tcphdr *);
    917  1.150.20.2  rmind int	 tcp_sack_numblks(const struct tcpcb *);
    918  1.150.20.2  rmind #define	TCP_SACK_OPTLEN(nblks)	((nblks) * 8 + 2 + 2)
    919  1.150.20.2  rmind 
    920  1.150.20.2  rmind int	 syn_cache_add(struct sockaddr *, struct sockaddr *,
    921  1.150.20.2  rmind 		struct tcphdr *, unsigned int, struct socket *,
    922  1.150.20.2  rmind 		struct mbuf *, u_char *, int, struct tcp_opt_info *);
    923  1.150.20.2  rmind void	 syn_cache_unreach(const struct sockaddr *, const struct sockaddr *,
    924  1.150.20.2  rmind 	   struct tcphdr *);
    925  1.150.20.2  rmind struct socket *syn_cache_get(struct sockaddr *, struct sockaddr *,
    926  1.150.20.2  rmind 		struct tcphdr *, unsigned int, unsigned int,
    927  1.150.20.2  rmind 		struct socket *so, struct mbuf *);
    928  1.150.20.2  rmind void	 syn_cache_init(void);
    929  1.150.20.2  rmind void	 syn_cache_insert(struct syn_cache *, struct tcpcb *);
    930  1.150.20.2  rmind struct syn_cache *syn_cache_lookup(const struct sockaddr *, const struct sockaddr *,
    931  1.150.20.2  rmind 		struct syn_cache_head **);
    932  1.150.20.2  rmind void	 syn_cache_reset(struct sockaddr *, struct sockaddr *,
    933  1.150.20.2  rmind 		struct tcphdr *);
    934  1.150.20.2  rmind int	 syn_cache_respond(struct syn_cache *, struct mbuf *);
    935  1.150.20.2  rmind void	 syn_cache_timer(void *);
    936  1.150.20.2  rmind void	 syn_cache_cleanup(struct tcpcb *);
    937  1.150.20.2  rmind 
    938  1.150.20.2  rmind int	 tcp_input_checksum(int, struct mbuf *, const struct tcphdr *, int, int,
    939  1.150.20.2  rmind     int);
    940  1.150.20.2  rmind #endif
    941  1.150.20.2  rmind 
    942  1.150.20.2  rmind #endif /* !_NETINET_TCP_VAR_H_ */
    943