1 2 #include "../h/param.h" 3 #include "../h/socket.h" 4 #include "../h/protosw.h" 5 #include "../h/domain.h" 6 #include "../h/mbuf.h" 7 8 #include "../net/route.h" 9 #include "../net/raw_cb.h" 10 11 #include "../bbnnet/in.h" 12 #include "../bbnnet/in_pcb.h" 13 14 /* 15 * Internet protocols 16 */ 17 18 int raw_init(), raw_usrreq(); 19 20 /* IP */ 21 int ip_init(),ip_timeo(),ip_drain(); 22 int ip_send(), ip_ctloutput(); 23 int raw_ip_input(), raw_ip_output(); 24 25 /* ICMP */ 26 int icmp(), ic_timeo(); 27 int raw_icmp_output(); 28 29 /* UDP */ 30 int udp_input(); 31 int udp_usrreq(), udp_init(), udp_ctlinput(); 32 int raw_udp_output(); 33 34 /* TCP */ 35 int tcp_input(); 36 int tcp_usrreq(), tcp_ctlinput(), tcp_ctloutput(); 37 int tcp_init(), tcp_timeo(), tcp_drain(); 38 int raw_tcp_output(); 39 40 /* RDP */ 41 #ifdef RDP 42 int rdp_input(), rdp_init(), rdp_timeo(), rdp_usrreq(); 43 int rdp_ctlinput(), rdp_ctloutput(); 44 int raw_rdp_output(); 45 #endif 46 47 /* HMP */ 48 #ifdef HMP 49 int hmp_input(), hmp_init(), hmp_usrreq(); 50 int hmp_ctlinput(), hmp_ctloutput(); 51 int raw_hmp_output(); 52 #endif 53 54 /* 55 * IMP protocol family: raw interface. 56 * Using the raw interface entry to get the timer routine 57 * in is a kludge. 58 */ 59 #include "imp.h" 60 #if NIMP > 0 61 int rimp_output(), hostslowtimo(); 62 #endif 63 64 #ifdef NSIP 65 int idpip_input(), rip_output(); 66 #endif 67 68 extern struct domain inetdomain; 69 70 struct protosw inetsw[] = { 71 { 0, &inetdomain, 0, 0, 72 0, ip_send, 0, ip_ctloutput, 73 0, 74 ip_init, 0, ip_timeo, ip_drain 75 }, 76 77 /* 78 * put frequently used protocols early. Table is beginning to get large.. 79 */ 80 81 /* UDP */ 82 { SOCK_DGRAM, &inetdomain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR, 83 udp_input, 0, udp_ctlinput, ip_ctloutput, 84 udp_usrreq, 85 udp_init, 0, 0, 0 86 }, 87 88 /* TCP */ 89 { SOCK_STREAM, &inetdomain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD, 90 tcp_input, 0, tcp_ctlinput, tcp_ctloutput, 91 tcp_usrreq, 92 tcp_init, 0, tcp_timeo, tcp_drain 93 }, 94 95 /* RDP */ 96 #ifdef RDP 97 { SOCK_SEQPACKET, &inetdomain, IPPROTO_RDP, PR_CONNREQUIRED|PR_WANTRCVD, 98 rdp_input, 0, rdp_ctlinput, rdp_ctloutput, 99 rdp_usrreq, 100 rdp_init, 0, rdp_timeo, 0 101 }, 102 #endif 103 104 /* HMP */ 105 #ifdef HMP 106 { SOCK_DGRAM, &inetdomain, IPPROTO_HMP, PR_ATOMIC|PR_ADDR, 107 hmp_input, 0, hmp_ctlinput, hmp_ctloutput, 108 hmp_usrreq, 109 hmp_init, 0, 0, 0 110 }, 111 #endif 112 113 #ifdef NSIP 114 { SOCK_RAW, &inetdomain, IPPROTO_IDP, PR_ATOMIC|PR_ADDR, 115 idpip_input, rip_output, 0, 0, 116 raw_usrreq, 117 0, 0, 0, 0 118 }, 119 #endif 120 121 /* 122 * to get all incoming IP packets: 123 * socket(AF_INET,SOCK_RAW,0) 124 */ 125 { SOCK_RAW, &inetdomain, 0, PR_ATOMIC|PR_ADDR, 126 raw_ip_input, raw_ip_output, 0, 0, 127 raw_usrreq, 128 raw_init, 0, 0, 0 129 }, 130 131 /* 132 * to get all incoming ICMP packets: 133 * socket(AF_INET,SOCK_RAW, IPPROTO_ICMP) 134 */ 135 { SOCK_RAW, &inetdomain, IPPROTO_ICMP, PR_ATOMIC|PR_ADDR, 136 raw_ip_input, raw_icmp_output,0, 0, 137 raw_usrreq, 138 0, 0, ic_timeo, 0 139 }, 140 141 #ifdef RDP 142 /* 143 * to get all incoming RDP packets: 144 * socket(AF_INET,SOCK_RAW, IPPROTO_RDP) 145 */ 146 { SOCK_RAW, &inetdomain, IPPROTO_RDP, PR_ATOMIC|PR_ADDR, 147 raw_ip_input, raw_rdp_output, 0, 0, 148 raw_usrreq, 149 0, 0, 0, 0 150 }, 151 #endif 152 153 /* 154 * to get all incoming UDP packets: 155 * socket(AF_INET, SOCK_RAW, IPPROTO_UDP); 156 */ 157 { SOCK_RAW, &inetdomain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR, 158 raw_ip_input, raw_udp_output, 0, 0, 159 raw_usrreq, 160 0, 0, 0, 0 161 }, 162 163 #ifdef HMP 164 /* 165 * to get all incoming HMP packets: 166 * socket(AF_INET,SOCK_RAW, IPPROTO_HMP); 167 */ 168 { SOCK_RAW, &inetdomain, IPPROTO_HMP, PR_ATOMIC|PR_ADDR, 169 raw_ip_input, raw_hmp_output, 0, 0, 170 raw_usrreq, 171 0, 0, 0, 0 172 }, 173 #endif 174 175 /* 176 * to get all TCP packets: 177 * socket(AF_INET, SOCK_RAW, IPPROTO_TCP); 178 */ 179 { SOCK_RAW, &inetdomain, IPPROTO_TCP, PR_ATOMIC|PR_ADDR, 180 raw_ip_input, raw_tcp_output, 0, 0, 181 raw_usrreq, 182 0, 0, 0, 0 183 }, 184 }; 185 186 struct domain inetdomain = 187 { AF_INET, "internet", 0, 0, 0, 188 inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])] }; 189 190 #if NIMP > 0 191 extern struct domain impdomain; 192 193 struct protosw impsw[] = { 194 { SOCK_RAW, &impdomain, 0, PR_ATOMIC|PR_ADDR, 195 0, rimp_output, 0, 0, 196 raw_usrreq, 197 0, 0, hostslowtimo, 0 198 }, 199 }; 200 201 struct domain impdomain = 202 { AF_IMPLINK, "imp", 0, 0, 0, 203 impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] }; 204 #endif 205 206 #include "hy.h" 207 #if NHY > 0 208 /* 209 * HYPERchannel protocol family: raw interface. 210 */ 211 int rhy_output(); 212 213 struct protosw hysw[] = { 214 { SOCK_RAW, PF_HYLINK, 0, PR_ATOMIC|PR_ADDR, 215 0, rhy_output, 0, 0, 216 raw_usrreq, 217 0, 0, 0, 0 218 }, 219 }; 220 221 struct domain hydomain = 222 { AF_HYLINK, "hy", hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] }; 223 #endif 224 225 #define N_ELEMENTS(x) (sizeof(x)/sizeof((x)[0])) 226 227 #ifdef AF_RDPDEBUG 228 struct protosw rdpdebugsw[] = { 229 { SOCK_RAW, PF_RDPDEBUG, 0, PR_ATOMIC|PR_ADDR, 230 0,0,0,0, 231 raw_usrreq, 232 0,0,0,0} 233 }; 234 struct domain rdpdebugdomain = 235 { AF_RDPDEBUG, "rdpdebug", rdpdebugsw, &rdpdebugsw[N_ELEMENTS(rdpdebugsw)] }; 236 #endif 237 238 #ifdef AF_TCPDEBUG 239 struct protosw tcpdebugsw[] = { 240 { SOCK_RAW, PF_TCPDEBUG, 0, PR_ATOMIC|PR_ADDR, 241 0,0,0,0, 242 raw_usrreq, 243 0,0,0,0} 244 }; 245 struct domain tcpdebugdomain = 246 { AF_TCPDEBUG, "tcpdebug", tcpdebugsw, &tcpdebugsw[N_ELEMENTS(tcpdebugsw)] }; 247 #endif 248