1 /* 2 * Copyright (c) 1982, 1986 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)in_proto.c 7.7 (Berkeley) 07/09/92 8 */ 9 10 #include "param.h" 11 #include "socket.h" 12 #include "protosw.h" 13 #include "domain.h" 14 #include "mbuf.h" 15 16 #include "in.h" 17 #include "in_systm.h" 18 19 #include "net/radix.h" 20 21 /* 22 * TCP/IP protocol family: IP, ICMP, UDP, TCP. 23 */ 24 int ip_output(),ip_ctloutput(); 25 int ip_init(),ip_slowtimo(),ip_drain(); 26 int icmp_input(); 27 #ifdef MULTICAST 28 int igmp_init(),igmp_input(),igmp_fasttimo(); 29 #endif 30 int udp_input(),udp_ctlinput(); 31 int udp_usrreq(); 32 int udp_init(); 33 int tcp_input(),tcp_ctlinput(); 34 int tcp_usrreq(),tcp_ctloutput(); 35 int tcp_init(),tcp_fasttimo(),tcp_slowtimo(),tcp_drain(); 36 int rip_init(),rip_input(),rip_output(),rip_ctloutput(), rip_usrreq(); 37 /* 38 * IMP protocol family: raw interface. 39 * Using the raw interface entry to get the timer routine 40 * in is a kludge. 41 */ 42 #include "imp.h" 43 #if NIMP > 0 44 int rimp_output(), hostslowtimo(); 45 #endif 46 47 #ifdef NSIP 48 int idpip_input(), nsip_ctlinput(); 49 #endif 50 51 #ifdef TPIP 52 int tpip_input(), tpip_ctlinput(), tp_ctloutput(), tp_usrreq(); 53 int tp_init(), tp_slowtimo(), tp_drain(); 54 #endif 55 56 #ifdef EON 57 int eoninput(), eonctlinput(), eonprotoinit(); 58 #endif EON 59 60 extern struct domain inetdomain; 61 62 struct protosw inetsw[] = { 63 { 0, &inetdomain, 0, 0, 64 0, ip_output, 0, 0, 65 0, 66 ip_init, 0, ip_slowtimo, ip_drain, 67 }, 68 { SOCK_DGRAM, &inetdomain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR, 69 udp_input, 0, udp_ctlinput, ip_ctloutput, 70 udp_usrreq, 71 udp_init, 0, 0, 0, 72 }, 73 { SOCK_STREAM, &inetdomain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD, 74 tcp_input, 0, tcp_ctlinput, tcp_ctloutput, 75 tcp_usrreq, 76 tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain, 77 }, 78 { SOCK_RAW, &inetdomain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR, 79 rip_input, rip_output, 0, rip_ctloutput, 80 rip_usrreq, 81 0, 0, 0, 0, 82 }, 83 { SOCK_RAW, &inetdomain, IPPROTO_ICMP, PR_ATOMIC|PR_ADDR, 84 icmp_input, rip_output, 0, rip_ctloutput, 85 rip_usrreq, 86 0, 0, 0, 0, 87 }, 88 #ifdef TPIP 89 { SOCK_SEQPACKET,&inetdomain, IPPROTO_TP, PR_CONNREQUIRED|PR_WANTRCVD, 90 tpip_input, 0, tpip_ctlinput, tp_ctloutput, 91 tp_usrreq, 92 tp_init, 0, tp_slowtimo, tp_drain, 93 }, 94 #endif 95 /* EON (ISO CLNL over IP) */ 96 #ifdef EON 97 { SOCK_RAW, &inetdomain, IPPROTO_EON, 0, 98 eoninput, 0, eonctlinput, 0, 99 0, 100 eonprotoinit, 0, 0, 0, 101 }, 102 #endif 103 #ifdef MULTICAST 104 { SOCK_RAW, &inetdomain, IPPROTO_IGMP, PR_ATOMIC|PR_ADDR, 105 igmp_input, rip_output, 0, rip_ctloutput, 106 rip_usrreq, 107 igmp_init, igmp_fasttimo, 0, 0, 108 }, 109 #endif 110 #ifdef NSIP 111 { SOCK_RAW, &inetdomain, IPPROTO_IDP, PR_ATOMIC|PR_ADDR, 112 idpip_input, rip_output, nsip_ctlinput, 0, 113 rip_usrreq, 114 0, 0, 0, 0, 115 }, 116 #endif 117 /* raw wildcard */ 118 { SOCK_RAW, &inetdomain, 0, PR_ATOMIC|PR_ADDR, 119 rip_input, rip_output, 0, rip_ctloutput, 120 rip_usrreq, 121 rip_init, 0, 0, 0, 122 }, 123 }; 124 125 struct domain inetdomain = 126 { AF_INET, "internet", 0, 0, 0, 127 inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0, 128 rn_inithead, 32, sizeof(struct sockaddr_in) }; 129 130 #if NIMP > 0 131 extern struct domain impdomain; 132 133 struct protosw impsw[] = { 134 { SOCK_RAW, &impdomain, 0, PR_ATOMIC|PR_ADDR, 135 0, rimp_output, 0, 0, 136 rip_usrreq, 137 0, 0, hostslowtimo, 0, 138 }, 139 }; 140 141 struct domain impdomain = 142 { AF_IMPLINK, "imp", 0, 0, 0, 143 impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] }; 144 #endif 145 146 #include "hy.h" 147 #if NHY > 0 148 /* 149 * HYPERchannel protocol family: raw interface. 150 */ 151 int rhy_output(); 152 extern struct domain hydomain; 153 154 struct protosw hysw[] = { 155 { SOCK_RAW, &hydomain, 0, PR_ATOMIC|PR_ADDR, 156 0, rhy_output, 0, 0, 157 rip_usrreq, 158 0, 0, 0, 0, 159 }, 160 }; 161 162 struct domain hydomain = 163 { AF_HYLINK, "hy", 0, 0, 0, hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] }; 164 #endif 165