1 /* tcp_fsm.h 4.5 81/11/15 */ 2 3 /* 4 * TCP FSM definitions. 5 * 6 * The TCP is conceptually a finite state machine with 13 states 7 * and 9 inputs. The states and inputs are defined here, as well 8 * as an array which is used in network profiling to keep event 9 * counters on the state transitions. The actual state transitions 10 * occur on input to the tcp machine (tcp_input.c) and when user 11 * requests are made (tcp_states.c). 12 * 13 * This TCP machine has two more states than suggested in RFC 793, 14 * the extra states being L_SYN_RCVD and RCV_WAIT. 15 * 16 * EXPLAIN THE EXTRA STATES!!! 17 */ 18 19 /* 20 * States 21 */ 22 #define TCP_NSTATES 14 23 24 #define EFAILEC -1 /* new state for failure, internally */ 25 #define SAME 0 /* no state change, internally */ 26 #define LISTEN 1 /* listening for connection */ 27 #define SYN_SENT 2 /* active, have sent syn */ 28 #define SYN_RCVD 3 29 #define L_SYN_RCVD 4 30 #define ESTAB 5 /* established */ 31 #define FIN_W1 6 /* have closed and sent fin */ 32 #define FIN_W2 7 /* have closed and rcvd ack of fin */ 33 #define TIME_WAIT 8 /* in 2*msl quiet wait after close */ 34 #define CLOSE_WAIT 9 /* rcvd fin, waiting for UCLOSE */ 35 #define CLOSING 10 /* closed xchd FIN; await FIN ACK */ 36 #define LAST_ACK 11 /* had fin and UCLOSE; await FIN ACK */ 37 #define RCV_WAIT 12 /* waiting for user to drain data */ 38 #define CLOSED 13 /* closed */ 39 40 #ifdef KPROF 41 int tcp_acounts[TCP_NSTATES][PRU_NREQ]; 42 #endif 43 44 #ifdef TCPSTATES 45 char *tcpstates[] = { 46 "SAME", "LISTEN", "SYN_SENT", "SYN_RCVD", 47 "L_SYN_RCVD", "ESTAB", "FIN_W1", "FIN_W2", 48 "TIME_WAIT", "CLOSE_WAIT", "CLOSING", "LAST_ACK", 49 "RCV_WAIT", "CLOSED" 50 }; 51 char *tcptimers[] = { "INIT", "REXMT", "REXMTTL", "PERSIST", "FINACK" }; 52 #endif 53