xref: /csrg-svn/sys/netinet/tcp_fsm.h (revision 5074)
1*5074Swnj /*	tcp_fsm.h	4.8	81/11/25	*/
24725Swnj 
34725Swnj /*
44924Swnj  * TCP FSM state definitions.
55065Swnj  * Per RFC793, September, 1981.
64725Swnj  */
74725Swnj 
85065Swnj #define	TCP_NSTATES	11
94725Swnj 
105065Swnj #define	TCPS_CLOSED		0	/* closed */
115065Swnj #define	TCPS_LISTEN		1	/* listening for connection */
125065Swnj #define	TCPS_SYN_SENT		2	/* active, have sent syn */
135065Swnj #define	TCPS_SYN_RCVD		3	/* have send and received syn */
14*5074Swnj /* states < TCPS_ESTABLISHED are those where connections not established */
155065Swnj #define	TCPS_ESTABLISHED	4	/* established */
16*5074Swnj #define	TCPS_CLOSE_WAIT		8	/* rcvd fin, waiting for close */
17*5074Swnj /* states > TCPS_CLOSE_WAIT are those where user has closed */
185065Swnj #define	TCPS_FIN_WAIT_1		5	/* have closed, sent fin */
195065Swnj #define	TCPS_FIN_WAIT_2		6	/* have closed, fin is acked */
205065Swnj #define	TCPS_TIME_WAIT		7	/* in 2*msl quiet wait after close */
215065Swnj #define	TCPS_CLOSING		9	/* closed xchd FIN; await FIN ACK */
225065Swnj #define	TCPS_LAST_ACK		10	/* had fin and close; await FIN ACK */
234725Swnj 
245065Swnj #define	TCPS_HAVERCVDSYN(s)	((s) >= TCPS_SYN_RCVD)
255065Swnj #define	TCPS_HAVERCVDFIN(s)	((s) >= TCPS_TIME_WAIT)
265065Swnj 
274730Swnj #ifdef KPROF
284899Swnj int	tcp_acounts[TCP_NSTATES][PRU_NREQ];
294725Swnj #endif
304725Swnj 
314725Swnj #ifdef TCPSTATES
324725Swnj char *tcpstates[] = {
335065Swnj 	"CLOSED",	"LISTEN",	"SYN_SENT",	"SYN_RCVD",
345065Swnj 	"ESTABLISHED",	"FIN_WAIT1",	"FIN_WAIT2",	"TIME_WAIT",
355065Swnj 	"CLOSE_WAIT",	"CLOSING",	"LAST_ACK",
364725Swnj };
374725Swnj #endif
38