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

Defined variables

Defined struct's

tcpcb defined in line 69; used 92 times
tcpstat defined in line 187; used 6 times

Defined macros

IP_MAXPACKET defined in line 37; used 4 times
MCLBYTES defined in line 49; used 8 times
SB_MAX defined in line 32; used 2 times
TF_NOOPT defined in line 83; used 1 times
TF_SENTFIN defined in line 84; used 3 times
in_localaddr defined in line 57; used 1 times
tcps_connattempt defined in line 147; used 3 times
tcps_conndrops defined in line 149; used 3 times
tcps_connects defined in line 148; used 4 times
tcps_keepdrops defined in line 152; used 3 times
tcps_keepprobe defined in line 151; used 3 times
tcps_keeptimeo defined in line 150; used 3 times
tcps_rcvackbyte defined in line 184; used 3 times
tcps_rcvackpack defined in line 183; used 3 times
tcps_rcvacktoomuch defined in line 182; used 3 times
tcps_rcvafterclose defined in line 179; used 3 times
tcps_rcvbadoff defined in line 169; used 3 times
tcps_rcvbadsum defined in line 168; used 3 times
tcps_rcvbyte defined in line 167; used 3 times
tcps_rcvbyteafterwin defined in line 178; used 5 times
tcps_rcvdupack defined in line 181; used 3 times
tcps_rcvdupbyte defined in line 172; used 4 times
tcps_rcvduppack defined in line 171; used 4 times
tcps_rcvoobyte defined in line 176; used 3 times
tcps_rcvoopack defined in line 175; used 3 times
tcps_rcvpack defined in line 166; used 3 times
tcps_rcvpackafterwin defined in line 177; used 4 times
tcps_rcvpartdupbyte defined in line 174; used 3 times
tcps_rcvpartduppack defined in line 173; used 3 times
tcps_rcvshort defined in line 170; used 4 times
tcps_rcvtotal defined in line 165; used 3 times
tcps_rcvwinprobe defined in line 180; used 3 times
tcps_rcvwinupd defined in line 185; used 3 times
tcps_sndacks defined in line 159; used 3 times
tcps_sndbyte defined in line 156; used 3 times
tcps_sndctrl defined in line 163; used 3 times
tcps_sndpack defined in line 155; used 3 times
tcps_sndprobe defined in line 160; used 3 times
tcps_sndrexmitbyte defined in line 158; used 3 times
tcps_sndrexmitpack defined in line 157; used 3 times
tcps_sndtotal defined in line 154; used 3 times
tcps_sndurg defined in line 161; used 3 times
tcps_sndwinup defined in line 162; used 3 times

Usage of this include

Last modified: 1992-12-24
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 5207
Valid CSS Valid XHTML 1.0 Strict