xref: /titanic_51/usr/src/uts/common/netinet/tcp_var.h (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
1 /*
2  * Copyright (c) 1997-1998 by Sun Microsystems, Inc.
3  * All rights reserved.
4  */
5 
6 /*
7  * Copyright (c) 1982, 1986 Regents of the University of California.
8  * All rights reserved.  The Berkeley software License Agreement
9  * specifies the terms and conditions for redistribution.
10  */
11 
12 /*
13  * Kernel variables for tcp.
14  */
15 
16 #ifndef	_NETINET_TCP_VAR_H
17 #define	_NETINET_TCP_VAR_H
18 
19 #pragma ident	"%Z%%M%	%I%	%E% SMI"
20 /* tcp_var.h 1.11 88/08/19 SMI; from UCB 7.3 6/30/87	*/
21 
22 #ifdef	__cplusplus
23 extern "C" {
24 #endif
25 
26 /*
27  * Tcp control block, one per tcp; fields:
28  */
29 struct tcpcb {
30 	struct	tcpiphdr *seg_next;	/* sequencing queue */
31 	struct	tcpiphdr *seg_prev;
32 	short	t_state;		/* state of this connection */
33 	short	t_timer[TCPT_NTIMERS];	/* tcp timers */
34 	short	t_rxtshift;		/* log(2) of rexmt exp. backoff */
35 	short	t_rxtcur;		/* current retransmit value */
36 	short	t_dupacks;		/* consecutive dup acks recd */
37 	ushort_t t_maxseg;		/* maximum segment size */
38 	char	t_force;		/* 1 if forcing out a byte */
39 	uchar_t	t_flags;
40 #define	TF_ACKNOW	0x01		/* ack peer immediately */
41 #define	TF_DELACK	0x02		/* ack, but try to delay it */
42 #define	TF_NODELAY	0x04		/* don't delay packets to coalesce */
43 #define	TF_NOOPT	0x08		/* don't use tcp options */
44 #define	TF_SENTFIN	0x10		/* have sent FIN */
45 	struct	tcpiphdr *t_template;	/* skeletal packet for transmit */
46 	struct	inpcb *t_inpcb;		/* back pointer to internet pcb */
47 /*
48  * The following fields are used as in the protocol specification.
49  * See RFC783, Dec. 1981, page 21.
50  */
51 /* send sequence variables */
52 	tcp_seq	snd_una;		/* send unacknowledged */
53 	tcp_seq	snd_nxt;		/* send next */
54 	tcp_seq	snd_up;			/* send urgent pointer */
55 	tcp_seq	snd_wl1;		/* window update seg seq number */
56 	tcp_seq	snd_wl2;		/* window update seg ack number */
57 	tcp_seq	iss;			/* initial send sequence number */
58 	ushort_t snd_wnd;		/* send window */
59 /* receive sequence variables */
60 	ushort_t rcv_wnd;		/* receive window */
61 	tcp_seq	rcv_nxt;		/* receive next */
62 	tcp_seq	rcv_up;			/* receive urgent pointer */
63 	tcp_seq	irs;			/* initial receive sequence number */
64 /*
65  * Additional variables for this implementation.
66  */
67 /* receive variables */
68 	tcp_seq	rcv_adv;		/* advertised window */
69 /* retransmit variables */
70 	tcp_seq	snd_max;		/* highest sequence number sent */
71 					/* used to recognize retransmits */
72 
73 /* congestion control (for slow start, source quench, retransmit after loss) */
74 	ushort_t snd_cwnd;		/* congestion-controlled window */
75 	ushort_t snd_ssthresh;		/* snd_cwnd size threshhold for */
76 					/* for slow start exponential to */
77 /*
78  * transmit timing stuff.
79  * srtt and rttvar are stored as fixed point; for convenience in smoothing,
80  * srtt has 3 bits to the right of the binary point, rttvar has 2.
81  * "Variance" is actually smoothed difference.
82  */
83 	short	t_idle;			/* inactivity time */
84 	short	t_rtt;			/* round trip time */
85 	tcp_seq	t_rtseq;		/* sequence number being timed */
86 	short	t_srtt;			/* smoothed round-trip time */
87 	short	t_rttvar;		/* variance in round-trip time */
88 	ushort_t max_rcvd;		/* most peer has sent into window */
89 	ushort_t max_sndwnd;		/* largest window peer has offered */
90 /* out-of-band data */
91 	char	t_oobflags;		/* have some */
92 	char	t_iobc;			/* input character */
93 #define	TCPOOB_HAVEDATA	0x01
94 #define	TCPOOB_HADDATA	0x02
95 };
96 
97 #define	intotcpcb(ip)	((struct tcpcb *)(ip)->inp_ppcb)
98 #define	sototcpcb(so)	(intotcpcb(sotoinpcb(so)))
99 
100 /*
101  * TCP statistics.
102  * Many of these should be kept per connection,
103  * but that's inconvenient at the moment.
104  */
105 struct	tcpstat {
106 	uint_t	tcps_connattempt;	/* connections initiated */
107 	uint_t	tcps_accepts;		/* connections accepted */
108 	uint_t	tcps_connects;		/* connections established */
109 	uint_t	tcps_drops;		/* connections dropped */
110 	uint_t	tcps_conndrops;		/* embryonic connections dropped */
111 	uint_t	tcps_closed;		/* conn. closed (includes drops) */
112 	uint_t	tcps_segstimed;		/* segs where we tried to get rtt */
113 	uint_t	tcps_rttupdated;	/* times we succeeded */
114 	uint_t	tcps_delack;		/* delayed acks sent */
115 	uint_t	tcps_timeoutdrop;	/* conn. dropped in rxmt timeout */
116 	uint_t	tcps_rexmttimeo;	/* retransmit timeouts */
117 	uint_t	tcps_persisttimeo;	/* persist timeouts */
118 	uint_t	tcps_keeptimeo;		/* keepalive timeouts */
119 	uint_t	tcps_keepprobe;		/* keepalive probes sent */
120 	uint_t	tcps_keepdrops;		/* connections dropped in keepalive */
121 
122 	uint_t	tcps_sndtotal;		/* total packets sent */
123 	uint_t	tcps_sndpack;		/* data packets sent */
124 	uint_t	tcps_sndbyte;		/* data bytes sent */
125 	uint_t	tcps_sndrexmitpack;	/* data packets retransmitted */
126 	uint_t	tcps_sndrexmitbyte;	/* data bytes retransmitted */
127 	uint_t	tcps_sndacks;		/* ack-only packets sent */
128 	uint_t	tcps_sndprobe;		/* window probes sent */
129 	uint_t	tcps_sndurg;		/* packets sent with URG only */
130 	uint_t	tcps_sndwinup;		/* window update-only packets sent */
131 	uint_t	tcps_sndctrl;		/* control (SYN|FIN|RST) packets sent */
132 
133 	uint_t	tcps_rcvtotal;		/* total packets received */
134 	uint_t	tcps_rcvpack;		/* packets received in sequence */
135 	uint_t	tcps_rcvbyte;		/* bytes received in sequence */
136 	uint_t	tcps_rcvbadsum;		/* packets received with ccksum errs */
137 	uint_t	tcps_rcvbadoff;		/* packets received with bad offset */
138 	uint_t	tcps_rcvshort;		/* packets received too short */
139 	uint_t	tcps_rcvduppack;	/* duplicate-only packets received */
140 	uint_t	tcps_rcvdupbyte;	/* duplicate-only bytes received */
141 	uint_t	tcps_rcvpartduppack;	/* packets with some duplicate data */
142 	uint_t	tcps_rcvpartdupbyte;	/* dup. bytes in part-dup. packets */
143 	uint_t	tcps_rcvoopack;		/* out-of-order packets received */
144 	uint_t	tcps_rcvoobyte;		/* out-of-order bytes received */
145 	uint_t	tcps_rcvpackafterwin;	/* packets with data after window */
146 	uint_t	tcps_rcvbyteafterwin;	/* bytes rcvd after window */
147 	uint_t	tcps_rcvafterclose;	/* packets rcvd after "close" */
148 	uint_t	tcps_rcvwinprobe;	/* rcvd window probe packets */
149 	uint_t	tcps_rcvdupack;		/* rcvd duplicate acks */
150 	uint_t	tcps_rcvacktoomuch;	/* rcvd acks for unsent data */
151 	uint_t	tcps_rcvackpack;	/* rcvd ack packets */
152 	uint_t	tcps_rcvackbyte;	/* bytes acked by rcvd acks */
153 	uint_t	tcps_rcvwinupd;		/* rcvd window update packets */
154 };
155 
156 #define	TCP_COMPAT_42
157 
158 #ifdef	__cplusplus
159 }
160 #endif
161 
162 #endif	/* _NETINET_TCP_VAR_H */
163