Annotation of 43BSDTahoe/sys/netinet/tcp_var.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1982, 1986 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted
                      6:  * provided that the above copyright notice and this paragraph are
                      7:  * duplicated in all such forms and that any documentation,
                      8:  * advertising materials, and other materials related to such
                      9:  * distribution and use acknowledge that the software was developed
                     10:  * by the University of California, Berkeley.  The name of the
                     11:  * University may not be used to endorse or promote products derived
                     12:  * from this software without specific prior written permission.
                     13:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     14:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     15:  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     16:  *
                     17:  *     @(#)tcp_var.h   7.8 (Berkeley) 6/29/88
                     18:  */
                     19: 
                     20: /*
                     21:  * TCP configuration:  This is a half-assed attempt to make TCP
                     22:  * self-configure for a few varieties of 4.2 and 4.3-based unixes.
                     23:  * If you don't have a) a 4.3bsd vax or b) a 3.x Sun (x<6), check
                     24:  * this carefully (it's probably not right).  Please send me mail
                     25:  * if you run into configuration problems.
                     26:  *  - Van Jacobson ([email protected])
                     27:  */
                     28: 
                     29: #ifndef BSD
                     30: #define BSD 42 /* if we're not 4.3, pretend we're 4.2 */
                     31: #define OLDSTAT        /* set if we have to use old netstat binaries */
                     32: #endif
                     33: 
                     34: /* #define OLDSTAT     /* set if we have to use old netstat binaries */
                     35: 
                     36: #if sun || BSD < 43
                     37: #define TCP_COMPAT_42  /* set if we have to interop w/4.2 systems */
                     38: #endif
                     39: 
                     40: #ifndef SB_MAX
                     41: #ifdef SB_MAXCOUNT
                     42: #define        SB_MAX  SB_MAXCOUNT     /* Sun has to be a little bit different... */
                     43: #else
                     44: #define SB_MAX 32767           /* XXX */
                     45: #endif SB_MAXCOUNT
                     46: #endif SB_MAX
                     47: 
                     48: #ifndef IP_MAXPACKET
                     49: #define        IP_MAXPACKET    65535           /* maximum packet size */
                     50: #endif
                     51: 
                     52: /*
                     53:  * Bill Nowicki pointed out that the page size (CLBYTES) has
                     54:  * nothing to do with the mbuf cluster size.  So, we followed
                     55:  * Sun's lead and made the new define MCLBYTES stand for the mbuf
                     56:  * cluster size.  The following define makes up backwards compatible
                     57:  * with 4.3 and 4.2.  If CLBYTES is >1024 on your machine, check
                     58:  * this against the mbuf cluster definitions in /usr/include/sys/mbuf.h.
                     59:  */
                     60: #ifndef MCLBYTES
                     61: #define        MCLBYTES CLBYTES        /* XXX */
                     62: #endif
                     63: 
                     64: /*
                     65:  * The routine in_localaddr is broken in Sun's 3.4.  We redefine ours
                     66:  * (in tcp_input.c) so we use can it but won't have a name conflict.
                     67:  */
                     68: #ifdef sun
                     69: #define in_localaddr tcp_in_localaddr
                     70: #endif
                     71: 
                     72: /* --------------- end of TCP config ---------------- */
                     73: 
                     74: /*
                     75:  * Kernel variables for tcp.
                     76:  */
                     77: 
                     78: /*
                     79:  * Tcp control block, one per tcp; fields:
                     80:  */
                     81: struct tcpcb {
                     82:        struct  tcpiphdr *seg_next;     /* sequencing queue */
                     83:        struct  tcpiphdr *seg_prev;
                     84:        short   t_state;                /* state of this connection */
                     85:        short   t_timer[TCPT_NTIMERS];  /* tcp timers */
                     86:        short   t_rxtshift;             /* log(2) of rexmt exp. backoff */
                     87:        short   t_rxtcur;               /* current retransmit value */
                     88:        short   t_dupacks;              /* consecutive dup acks recd */
                     89:        u_short t_maxseg;               /* maximum segment size */
                     90:        char    t_force;                /* 1 if forcing out a byte */
                     91:        u_char  t_flags;
                     92: #define        TF_ACKNOW       0x01            /* ack peer immediately */
                     93: #define        TF_DELACK       0x02            /* ack, but try to delay it */
                     94: #define        TF_NODELAY      0x04            /* don't delay packets to coalesce */
                     95: #define        TF_NOOPT        0x08            /* don't use tcp options */
                     96: #define        TF_SENTFIN      0x10            /* have sent FIN */
                     97:        struct  tcpiphdr *t_template;   /* skeletal packet for transmit */
                     98:        struct  inpcb *t_inpcb;         /* back pointer to internet pcb */
                     99: /*
                    100:  * The following fields are used as in the protocol specification.
                    101:  * See RFC783, Dec. 1981, page 21.
                    102:  */
                    103: /* send sequence variables */
                    104:        tcp_seq snd_una;                /* send unacknowledged */
                    105:        tcp_seq snd_nxt;                /* send next */
                    106:        tcp_seq snd_up;                 /* send urgent pointer */
                    107:        tcp_seq snd_wl1;                /* window update seg seq number */
                    108:        tcp_seq snd_wl2;                /* window update seg ack number */
                    109:        tcp_seq iss;                    /* initial send sequence number */
                    110:        u_short snd_wnd;                /* send window */
                    111: /* receive sequence variables */
                    112:        u_short rcv_wnd;                /* receive window */
                    113:        tcp_seq rcv_nxt;                /* receive next */
                    114:        tcp_seq rcv_up;                 /* receive urgent pointer */
                    115:        tcp_seq irs;                    /* initial receive sequence number */
                    116: /*
                    117:  * Additional variables for this implementation.
                    118:  */
                    119: /* receive variables */
                    120:        tcp_seq rcv_adv;                /* advertised window */
                    121: /* retransmit variables */
                    122:        tcp_seq snd_max;                /* highest sequence number sent
                    123:                                         * used to recognize retransmits
                    124:                                         */
                    125: /* congestion control (for slow start, source quench, retransmit after loss) */
                    126:        u_short snd_cwnd;               /* congestion-controlled window */
                    127:        u_short snd_ssthresh;           /* snd_cwnd size threshhold for
                    128:                                         * for slow start exponential to
                    129:                                         * linear switch */
                    130: /*
                    131:  * transmit timing stuff.
                    132:  * srtt and rttvar are stored as fixed point; for convenience in smoothing,
                    133:  * srtt has 3 bits to the right of the binary point, rttvar has 2.
                    134:  * "Variance" is actually smoothed difference.
                    135:  */
                    136:        short   t_idle;                 /* inactivity time */
                    137:        short   t_rtt;                  /* round trip time */
                    138:        tcp_seq t_rtseq;                /* sequence number being timed */
                    139:        short   t_srtt;                 /* smoothed round-trip time */
                    140:        short   t_rttvar;               /* variance in round-trip time */
                    141:        u_short max_rcvd;               /* most peer has sent into window */
                    142:        u_short max_sndwnd;             /* largest window peer has offered */
                    143: /* out-of-band data */
                    144:        char    t_oobflags;             /* have some */
                    145:        char    t_iobc;                 /* input character */
                    146: #define        TCPOOB_HAVEDATA 0x01
                    147: #define        TCPOOB_HADDATA  0x02
                    148: };
                    149: 
                    150: #define        intotcpcb(ip)   ((struct tcpcb *)(ip)->inp_ppcb)
                    151: #define        sototcpcb(so)   (intotcpcb(sotoinpcb(so)))
                    152: 
                    153: /*
                    154:  * TCP statistics.
                    155:  * Many of these should be kept per connection,
                    156:  * but that's inconvenient at the moment.
                    157:  */
                    158: struct tcpstat {
                    159: #ifdef OLDSTAT
                    160:        /*
                    161:         * Declare statistics the same as in 4.3
                    162:         * at the start of tcpstat (same size and
                    163:         * position) for netstat.
                    164:         */
                    165:        int     tcps_rcvbadsum;
                    166:        int     tcps_rcvbadoff;
                    167:        int     tcps_rcvshort;
                    168:        int     tcps_badsegs;
                    169:        int     tcps_unack;
                    170: #define        tcps_badsum     tcps_rcvbadsum
                    171: #define        tcps_badoff     tcps_rcvbadoff
                    172: #define        tcps_hdrops     tcps_rcvshort
                    173: 
                    174: #endif OLDSTAT
                    175:        u_long  tcps_connattempt;       /* connections initiated */
                    176:        u_long  tcps_accepts;           /* connections accepted */
                    177:        u_long  tcps_connects;          /* connections established */
                    178:        u_long  tcps_drops;             /* connections dropped */
                    179:        u_long  tcps_conndrops;         /* embryonic connections dropped */
                    180:        u_long  tcps_closed;            /* conn. closed (includes drops) */
                    181:        u_long  tcps_segstimed;         /* segs where we tried to get rtt */
                    182:        u_long  tcps_rttupdated;        /* times we succeeded */
                    183:        u_long  tcps_delack;            /* delayed acks sent */
                    184:        u_long  tcps_timeoutdrop;       /* conn. dropped in rxmt timeout */
                    185:        u_long  tcps_rexmttimeo;        /* retransmit timeouts */
                    186:        u_long  tcps_persisttimeo;      /* persist timeouts */
                    187:        u_long  tcps_keeptimeo;         /* keepalive timeouts */
                    188:        u_long  tcps_keepprobe;         /* keepalive probes sent */
                    189:        u_long  tcps_keepdrops;         /* connections dropped in keepalive */
                    190: 
                    191:        u_long  tcps_sndtotal;          /* total packets sent */
                    192:        u_long  tcps_sndpack;           /* data packets sent */
                    193:        u_long  tcps_sndbyte;           /* data bytes sent */
                    194:        u_long  tcps_sndrexmitpack;     /* data packets retransmitted */
                    195:        u_long  tcps_sndrexmitbyte;     /* data bytes retransmitted */
                    196:        u_long  tcps_sndacks;           /* ack-only packets sent */
                    197:        u_long  tcps_sndprobe;          /* window probes sent */
                    198:        u_long  tcps_sndurg;            /* packets sent with URG only */
                    199:        u_long  tcps_sndwinup;          /* window update-only packets sent */
                    200:        u_long  tcps_sndctrl;           /* control (SYN|FIN|RST) packets sent */
                    201: 
                    202:        u_long  tcps_rcvtotal;          /* total packets received */
                    203:        u_long  tcps_rcvpack;           /* packets received in sequence */
                    204:        u_long  tcps_rcvbyte;           /* bytes received in sequence */
                    205: #ifndef OLDSTAT
                    206:        u_long  tcps_rcvbadsum;         /* packets received with ccksum errs */
                    207:        u_long  tcps_rcvbadoff;         /* packets received with bad offset */
                    208:        u_long  tcps_rcvshort;          /* packets received too short */
                    209: #endif
                    210:        u_long  tcps_rcvduppack;        /* duplicate-only packets received */
                    211:        u_long  tcps_rcvdupbyte;        /* duplicate-only bytes received */
                    212:        u_long  tcps_rcvpartduppack;    /* packets with some duplicate data */
                    213:        u_long  tcps_rcvpartdupbyte;    /* dup. bytes in part-dup. packets */
                    214:        u_long  tcps_rcvoopack;         /* out-of-order packets received */
                    215:        u_long  tcps_rcvoobyte;         /* out-of-order bytes received */
                    216:        u_long  tcps_rcvpackafterwin;   /* packets with data after window */
                    217:        u_long  tcps_rcvbyteafterwin;   /* bytes rcvd after window */
                    218:        u_long  tcps_rcvafterclose;     /* packets rcvd after "close" */
                    219:        u_long  tcps_rcvwinprobe;       /* rcvd window probe packets */
                    220:        u_long  tcps_rcvdupack;         /* rcvd duplicate acks */
                    221:        u_long  tcps_rcvacktoomuch;     /* rcvd acks for unsent data */
                    222:        u_long  tcps_rcvackpack;        /* rcvd ack packets */
                    223:        u_long  tcps_rcvackbyte;        /* bytes acked by rcvd acks */
                    224:        u_long  tcps_rcvwinupd;         /* rcvd window update packets */
                    225: };
                    226: 
                    227: #ifdef KERNEL
                    228: struct inpcb tcb;              /* head of queue of active tcpcb's */
                    229: struct tcpstat tcpstat;        /* tcp statistics */
                    230: struct tcpiphdr *tcp_template();
                    231: struct tcpcb *tcp_close(), *tcp_drop();
                    232: struct tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed();
                    233: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.