1 /* fsm.h 1.4 81/10/29 */ 2 3 /* 4 * TCP FSM definitions. 5 */ 6 7 /* 8 * States 9 */ 10 #define TCP_NSTATES 14 11 12 #define EFAILEC -1 /* pseudo-state for internal use */ 13 #define SAME 0 14 #define LISTEN 1 15 #define SYN_SENT 2 16 #define SYN_RCVD 3 17 #define L_SYN_RCVD 4 18 #define ESTAB 5 19 #define FIN_W1 6 20 #define FIN_W2 7 21 #define TIME_WAIT 8 22 #define CLOSE_WAIT 9 23 #define CLOSING1 10 24 #define CLOSING2 11 25 #define RCV_WAIT 12 26 #define CLOSED 13 27 28 /* 29 * Inputs to fsm. 30 */ 31 #define TCP_NINPUTS 10 32 33 #define IUOPENA 1 34 #define INRECV 2 35 #define IUOPENR 3 36 #define IUCLOSE 4 37 #define ISTIMER 5 38 #define IURECV 6 39 #define IUSEND 7 40 #define IUABORT 8 41 #define INCLEAR 9 42 #define INSEND 10 43 44 /* 45 * Actions 46 */ 47 #define BAD 0 48 #define LIS_CLS 1 49 #define LIS_NETR 2 50 #define SYR_NETR 3 51 #define SYS_CLS 4 52 #define SYS_NETR 5 53 #define CLS_OPN 6 54 #define EST_NETR 7 55 #define CL2_CLW 8 56 #define TIMERS 9 57 #define CL1_NETR 10 58 #define CL2_NETR 11 59 #define CLS_RWT 12 60 #define RWT_NETR 13 61 #define FW1_SYR 14 62 #define FW1_NETR 15 63 #define FW2_NETR 16 64 #define CWT_NETR 17 65 #define SSS_SYN 18 66 #define SSS_SND 19 67 #define SSS_RCV 20 68 #define CLS_NSY 21 69 #define CLS_SYN 22 70 #define CLS_ACT 23 71 #define NOP 24 72 #define CLS_ERR 25 73 74 #ifdef KERNEL 75 int acounts[14][10]; 76 #endif 77 78 #ifdef TCPFSTAB 79 /* SHOULD FIGURE OUT HOW TO MAKE THIS READABLE! */ 80 char tcp_fstab[TCP_NSTATES][TCP_NINPUTS] = { 81 { 0, 1, 0, 4, 0, 24, 0, 0, 0, 24 }, /* CLOSED */ 82 { 0, 0, 2, 0, 6, 0, 0, 0, 21, 23 }, /* LISTEN */ 83 { 0, 0, 5, 0, 6, 9, 0, 0, 21, 23, }, /* SYN_SENT */ 84 { 0, 0, 3, 0, 14, 9, 0, 0, 21, 23, }, /* SYN_RCVD */ 85 { 0, 0, 3, 0, 14, 9, 0, 0, 21, 23, }, /* L_SYN_RCVD */ 86 { 0, 0, 7, 0, 14, 9, 20, 19, 22, 23, }, /* ESTAB */ 87 { 0, 0, 15, 0, 24, 9, 20, 25, 22, 23, }, /* FIN_WAIT_1 */ 88 { 0, 0, 16, 0, 24, 9, 20, 24, 22, 23, }, /* FIN_WAIT_2 */ 89 { 0, 0, 18, 0, 24, 9, 20, 25, 22, 23, }, /* TIME_WAIT */ 90 { 0, 0, 17, 0, 8, 9, 20, 19, 22, 23, }, /* CLOSE_WAIT */ 91 { 0, 0, 10, 0, 25, 9, 20, 25, 22, 23, }, /* CLOSING_1 */ 92 { 0, 0, 11, 0, 25, 9, 20, 25, 22, 23, }, /* CLOSING_2 */ 93 { 0, 0, 13, 0, 25, 9, 12, 25, 22, 23, }, /* RCV_WAIT */ 94 { 0, 1, 0, 4, 0, 24, 0, 0, 0, 24 } /* CLOSED */ 95 }; 96 #endif 97 #ifdef KERNEL 98 int acounts[TCP_NSTATES][TCP_NINPUTS]; 99 #endif 100 101 #ifdef TCPSTATES 102 char *tcpstates[] = { 103 "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", 104 "L_SYN_RCVD", "ESTAB", "FIN_W1", "FIN_W2", 105 "TIME_WAIT", "CLOSE_WAIT", "CLOSING1", "CLOSING2", 106 "RCV_WAIT", "CLOSED" 107 }; 108 char *tcpinputs[] = { 109 "BAD", "UOPENA", "NRECV", "UOPENR", 110 "UCLOSE", "STIMER", "URECV", "USEND", 111 "UABORT", "NCLEAR" 112 }; 113 char *tcptimers[] = { "", "INIT", "REXMT", "REXMTTL", "PERSIST", "FINACK" }; 114 #endif 115 116 #define TINIT 1 117 #define TREXMT 2 118 #define TREXMTTL 3 119 #define TPERSIST 4 120 #define TFINACK 5 121