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
tcb
defined in line
239; used 13 times
tcpstat
defined in line
240; used 76 times
- in /usr/src/new/crash/inet.c line
183-198(13)
- in /usr/src/sys/netinet/tcp_input.c line
62-63(2),
106-107(2),
116-117(2),
195,
206,
226,
239,
247,
427,
465,
507-508(2),
534-535(2),
557-558(2),
578,
588-590(2),
613-617(2),
656,
696,
722,
776-781(3),
791,
957
- in /usr/src/sys/netinet/tcp_output.c line
221-227(5),
233-239(4),
357,
407
- in /usr/src/sys/netinet/tcp_subr.c line
211-213(2),
246
- in /usr/src/sys/netinet/tcp_timer.c line
59,
163-167(2),
231,
243,
262,
279
- in /usr/src/sys/netinet/tcp_usrreq.c line
170
- in /usr/src/ucb/netstat/inet.c line
150,
156-159(8)
Defined struct's
tcpcb
defined in line
69; used 92 times
- in line 242-243(4)
- in /usr/src/new/crash/dispnet.c line
535(2)
- in /usr/src/new/crash/inet.c line
61(2),
116(2),
123-124(4)
- in /usr/src/sys/netinet/tcp_debug.c line
56(2)
- in /usr/src/sys/netinet/tcp_input.c line
46(2),
71(2),
186(2),
1167(2),
1223(2),
1256(2)
- in /usr/src/sys/netinet/tcp_output.c line
49(2),
424(2)
- in /usr/src/sys/netinet/tcp_subr.c line
58(2),
106(2),
166-175(8),
201-203(4),
224-226(4),
247(2),
253(2),
317(2)
- in /usr/src/sys/netinet/tcp_timer.c line
49(2),
55(2),
73(2),
118(2),
132-134(4)
- in /usr/src/sys/netinet/tcp_usrreq.c line
45(2),
59(2),
329(2),
390(2),
422-424(4),
452-454(4)
- in /usr/src/ucb/PORT/systat/netstat.c line
125(2)
- in /usr/src/ucb/netstat/inet.c line
50(2)
- in /usr/src/usr.sbin/trpt/trpt.c line
237(2)
Defined macros
Usage of this include