xref: /csrg-svn/sys/netinet/tcp_fsm.h (revision 4899)
1*4899Swnj /*	tcp_fsm.h	4.5	81/11/15	*/
24725Swnj 
34725Swnj /*
44725Swnj  * TCP FSM definitions.
54730Swnj  *
64730Swnj  * The TCP is conceptually a finite state machine with 13 states
74730Swnj  * and 9 inputs.  The states and inputs are defined here, as well
84730Swnj  * as an array which is used in network profiling to keep event
94730Swnj  * counters on the state transitions.  The actual state transitions
104730Swnj  * occur on input to the tcp machine (tcp_input.c) and when user
114730Swnj  * requests are made (tcp_states.c).
124730Swnj  *
134730Swnj  * This TCP machine has two more states than suggested in RFC 793,
144730Swnj  * the extra states being L_SYN_RCVD and RCV_WAIT.
154730Swnj  *
164730Swnj  * EXPLAIN THE EXTRA STATES!!!
174725Swnj  */
184725Swnj 
194725Swnj /*
204725Swnj  * States
214725Swnj  */
224725Swnj #define	TCP_NSTATES	14
234725Swnj 
244730Swnj #define	EFAILEC		-1		/* new state for failure, internally */
254730Swnj #define	SAME		0		/* no state change, internally */
264730Swnj #define	LISTEN		1		/* listening for connection */
274730Swnj #define	SYN_SENT	2		/* active, have sent syn */
284725Swnj #define	SYN_RCVD	3
294725Swnj #define	L_SYN_RCVD	4
304730Swnj #define	ESTAB		5		/* established */
314730Swnj #define	FIN_W1		6		/* have closed and sent fin */
324730Swnj #define	FIN_W2		7		/* have closed and rcvd ack of fin */
334730Swnj #define	TIME_WAIT	8		/* in 2*msl quiet wait after close */
344730Swnj #define	CLOSE_WAIT	9		/* rcvd fin, waiting for UCLOSE */
354730Swnj #define	CLOSING		10		/* closed xchd FIN; await FIN ACK */
364730Swnj #define	LAST_ACK	11		/* had fin and UCLOSE; await FIN ACK */
374730Swnj #define	RCV_WAIT	12		/* waiting for user to drain data */
384730Swnj #define	CLOSED		13		/* closed */
394725Swnj 
404730Swnj #ifdef KPROF
41*4899Swnj int	tcp_acounts[TCP_NSTATES][PRU_NREQ];
424725Swnj #endif
434725Swnj 
444725Swnj #ifdef TCPSTATES
454725Swnj char *tcpstates[] = {
464730Swnj 	"SAME",		"LISTEN",	"SYN_SENT",	"SYN_RCVD",
474725Swnj 	"L_SYN_RCVD",	"ESTAB",	"FIN_W1",	"FIN_W2",
484730Swnj 	"TIME_WAIT",	"CLOSE_WAIT",	"CLOSING",	"LAST_ACK",
494725Swnj 	"RCV_WAIT",	"CLOSED"
504725Swnj };
514730Swnj char *tcptimers[] = { "INIT", "REXMT", "REXMTTL", "PERSIST", "FINACK" };
524725Swnj #endif
53