1 /* 2 $Log: rdp_fsm.c,v $ 3 * Revision 2.1 84/11/02 10:12:44 walsh 4 * Fixed to include RCS comments in checked out source. 5 * 6 * 7 * description: 8 * Transition table for RDP finite state machine. 9 * 10 * revision 1.5 11 * date: 84/07/22 19:44:39; author: walsh; state: Exp; lines added/del: 2/1 12 * Added a state transition function rdp_closew_rcv() to compensate for 13 * socket code's dropping of system priority level for a brief period of time. 14 * 15 * revision 1.4 16 * date: 84/07/18 18:50:34; author: walsh; state: Exp; lines added/del: 2/1 17 * Added provision for sending of NULL messages. These are sent on an idle 18 * connection to determine that the other side still exists. 19 * 20 * revision 1.3 21 * date: 84/07/09 14:17:34; author: walsh; state: Exp; lines added/del: 2/1 22 * Added ACK-delay timer to debugging printf arrays. 23 * 24 * revision 1.2 25 * date: 84/07/06 09:49:07; author: root; state: Exp; lines added/del: 1/1 26 * This version seems to run bug-free. 27 * 28 * revision 1.1 29 * date: 84/06/26 14:16:59; author: walsh; state: Exp; 30 * Initial revision 31 */ 32 33 34 #ifdef RDP 35 #include "../h/param.h" 36 #include "../h/dir.h" 37 #include "../h/user.h" 38 #include "../h/kernel.h" 39 #include "../h/inode.h" 40 #include "../h/mbuf.h" 41 #include "../h/socket.h" 42 #include "../h/socketvar.h" 43 44 #include "../net/if.h" 45 #include "../net/route.h" 46 47 #include "../bbnnet/in.h" 48 #include "../bbnnet/in_var.h" 49 #include "../bbnnet/net.h" 50 #include "../bbnnet/in_pcb.h" 51 #include "../bbnnet/ip.h" 52 #include "../bbnnet/rdp.h" 53 54 #ifdef RDPDEBUG 55 char *rdpstates[RDP_NSTATES] = 56 { 57 "RDP_sSAME", 58 "RDP_sUNOPENED", 59 "RDP_sLISTEN", 60 "RDP_sSYNSENT", 61 "RDP_sLSYNRCVD", 62 "RDP_sSYNRCVD", 63 "RDP_sESTAB", 64 "RDP_sCLOSEWAIT", 65 "RDP_sCLOSED" 66 } ; 67 68 char *rdpinputs[RDP_NINPUTS] = 69 { 70 "RDP_iCONNECT", 71 "RDP_iLISTEN", 72 "RDP_iNETR", 73 "RDP_iUCLOSE", 74 "RDP_iTIMER", 75 "RDP_iRCV", 76 "RDP_iSEND" 77 } ; 78 79 char *rdptimers[RDP_NTIMERS] = 80 { 81 "RDP_tCLOSEWAIT", 82 "RDP_tRTTL", 83 "RDP_tRXMIT", 84 "RDP_tACKDELAY", 85 "RDP_tNULL" 86 } ; 87 #endif 88 89 #ifdef KERNEL 90 extern int rdp_unop_connect(); /* RDP_sUNOPENED x RDP_iCONNECT */ 91 extern int rdp_unop_listen(); /* RDP_sUNOPENED x RDP_iLISTEN */ 92 extern int rdp_unop_netr(); /* RDP_sUNOPENED x RDP_iNETR */ 93 extern int rdp_unop_close(); /* RDP_sUNOPENED x RDP_iUCLOSE */ 94 95 extern int rdp_lis_listen(); /* RDP_sLISTEN x RDP_iLISTEN */ 96 extern int rdp_lis_netr(); /* RDP_sLISTEN x RDP_iNETR */ 97 extern int rdp_lis_close(); /* RDP_sLISTEN x RDP_iCLOSE */ 98 99 extern int rdp_synsent_netr(); /* RDP_sSYNSENT x RDP_iNETR */ 100 extern int rdp_synsent_close(); /* RDP_sSYNSENT x RDP_iUCLOSE */ 101 extern int rdp_synsent_timer(); /* RDP_sSYNSENT x RDP_iTIMER */ 102 103 extern int rdp_lsynrcvd_netr(); /* RDP_sLSYNRCVD x RDP_iNETR */ 104 extern int rdp_lsynrcvd_close(); /* RDP_sLSYNRCVD x RDP_iUCLOSE */ 105 extern int rdp_lsynrcvd_timer(); /* RDP_sLSYNRCVD x RDP_iTIMER */ 106 107 extern int rdp_synrcvd_netr(); /* RDP_sSYNRCVD x RDP_iNETR */ 108 extern int rdp_synrcvd_close(); /* RDP_sSYNRCVD x RDP_iUCLOSE */ 109 extern int rdp_synrcvd_timer(); /* RDP_sSYNRCVD x RDP_iTIMER */ 110 111 extern int rdp_estab_netr(); /* RDP_sESTAB x RDP_iNETR */ 112 extern int rdp_estab_close(); /* RDP_sESTAB x RDP_iUCLOSE */ 113 extern int rdp_estab_timer(); /* RDP_sESTAB x RDP_iTIMER */ 114 extern int rdp_estab_rcv(); /* RDP_sESTAB x RDP_iRCV */ 115 extern int rdp_estab_send(); /* RDP_sESTAB x RDP_iSEND */ 116 117 extern int rdp_closew_netr(); /* RDP_sCLOSEWAIT x RDP_iNETR */ 118 extern int rdp_closew_close(); /* RDP_sCLOSEWAIT x RDP_iUCLOSE */ 119 extern int rdp_closew_timer(); /* RDP_sCLOSEWAIT x RDP_iTIMER */ 120 extern int rdp_closew_rcv(); /* RDP_sCLOSEWAIT x RDP_iRCV */ 121 122 #define illegal 0 123 124 int (*rdp_action_table[RDP_NSTATES][RDP_NINPUTS])() = 125 { 126 { 127 illegal, /* to avoid off-by-1 error because SAME is 0 */ 128 illegal, 129 illegal, 130 illegal, 131 illegal, 132 illegal, 133 illegal 134 } 135 , 136 137 { 138 rdp_unop_connect, 139 rdp_unop_listen, 140 rdp_unop_netr, 141 rdp_unop_close, 142 illegal, 143 illegal, 144 illegal 145 } 146 , 147 148 { 149 illegal, 150 rdp_lis_listen, 151 rdp_lis_netr, 152 rdp_lis_close, 153 illegal, 154 illegal, 155 illegal 156 } 157 , 158 159 { 160 illegal, 161 illegal, 162 rdp_synsent_netr, 163 rdp_synsent_close, 164 rdp_synsent_timer, 165 illegal, 166 illegal 167 } 168 , 169 170 { 171 illegal, 172 illegal, 173 rdp_lsynrcvd_netr, 174 rdp_lsynrcvd_close, 175 rdp_lsynrcvd_timer, 176 illegal, 177 illegal 178 } 179 , 180 181 { 182 illegal, 183 illegal, 184 rdp_synrcvd_netr, 185 rdp_synrcvd_close, 186 rdp_synrcvd_timer, 187 illegal, 188 illegal 189 } 190 , 191 192 { 193 illegal, 194 illegal, 195 rdp_estab_netr, 196 rdp_estab_close, 197 rdp_estab_timer, 198 rdp_estab_rcv, 199 rdp_estab_send 200 } 201 , 202 203 { 204 illegal, 205 illegal, 206 rdp_closew_netr, 207 rdp_closew_close, 208 rdp_closew_timer, 209 rdp_closew_rcv, 210 illegal 211 } 212 } ; 213 #endif 214 #endif 215