xref: /csrg-svn/sys/netinet/tcp_fsm.h (revision 5074)
1 /*	tcp_fsm.h	4.8	81/11/25	*/
2 
3 /*
4  * TCP FSM state definitions.
5  * Per RFC793, September, 1981.
6  */
7 
8 #define	TCP_NSTATES	11
9 
10 #define	TCPS_CLOSED		0	/* closed */
11 #define	TCPS_LISTEN		1	/* listening for connection */
12 #define	TCPS_SYN_SENT		2	/* active, have sent syn */
13 #define	TCPS_SYN_RCVD		3	/* have send and received syn */
14 /* states < TCPS_ESTABLISHED are those where connections not established */
15 #define	TCPS_ESTABLISHED	4	/* established */
16 #define	TCPS_CLOSE_WAIT		8	/* rcvd fin, waiting for close */
17 /* states > TCPS_CLOSE_WAIT are those where user has closed */
18 #define	TCPS_FIN_WAIT_1		5	/* have closed, sent fin */
19 #define	TCPS_FIN_WAIT_2		6	/* have closed, fin is acked */
20 #define	TCPS_TIME_WAIT		7	/* in 2*msl quiet wait after close */
21 #define	TCPS_CLOSING		9	/* closed xchd FIN; await FIN ACK */
22 #define	TCPS_LAST_ACK		10	/* had fin and close; await FIN ACK */
23 
24 #define	TCPS_HAVERCVDSYN(s)	((s) >= TCPS_SYN_RCVD)
25 #define	TCPS_HAVERCVDFIN(s)	((s) >= TCPS_TIME_WAIT)
26 
27 #ifdef KPROF
28 int	tcp_acounts[TCP_NSTATES][PRU_NREQ];
29 #endif
30 
31 #ifdef TCPSTATES
32 char *tcpstates[] = {
33 	"CLOSED",	"LISTEN",	"SYN_SENT",	"SYN_RCVD",
34 	"ESTABLISHED",	"FIN_WAIT1",	"FIN_WAIT2",	"TIME_WAIT",
35 	"CLOSE_WAIT",	"CLOSING",	"LAST_ACK",
36 };
37 #endif
38