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