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.5 (Berkeley) 06/28/90 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 /* 20 * TCP/IP protocol family: IP, ICMP, UDP, TCP. 21 */ 22 int ip_output(),ip_ctloutput(); 23 int ip_init(),ip_slowtimo(),ip_drain(); 24 int icmp_input(); 25 int udp_input(),udp_ctlinput(); 26 int udp_usrreq(); 27 int udp_init(); 28 int tcp_input(),tcp_ctlinput(); 29 int tcp_usrreq(),tcp_ctloutput(); 30 int tcp_init(),tcp_fasttimo(),tcp_slowtimo(),tcp_drain(); 31 int rip_input(),rip_output(),rip_ctloutput(), rip_usrreq(); 32 /* 33 * IMP protocol family: raw interface. 34 * Using the raw interface entry to get the timer routine 35 * in is a kludge. 36 */ 37 #include "imp.h" 38 #if NIMP > 0 39 int rimp_output(), hostslowtimo(); 40 #endif 41 42 #ifdef NSIP 43 int idpip_input(), nsip_ctlinput(); 44 #endif 45 46 #ifdef TPIP 47 int tpip_input(), tpip_ctlinput(), tp_ctloutput(), tp_usrreq(); 48 int tp_init(), tp_slowtimo(), tp_drain(); 49 #endif 50 51 #ifdef EON 52 int eoninput(), eonctlinput(), eonprotoinit(); 53 #endif EON 54 55 extern struct domain inetdomain; 56 57 struct protosw inetsw[] = { 58 { 0, &inetdomain, 0, 0, 59 0, ip_output, 0, 0, 60 0, 61 ip_init, 0, ip_slowtimo, ip_drain, 62 }, 63 { SOCK_DGRAM, &inetdomain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR, 64 udp_input, 0, udp_ctlinput, ip_ctloutput, 65 udp_usrreq, 66 udp_init, 0, 0, 0, 67 }, 68 { SOCK_STREAM, &inetdomain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD, 69 tcp_input, 0, tcp_ctlinput, tcp_ctloutput, 70 tcp_usrreq, 71 tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain, 72 }, 73 { SOCK_RAW, &inetdomain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR, 74 rip_input, rip_output, 0, rip_ctloutput, 75 rip_usrreq, 76 0, 0, 0, 0, 77 }, 78 { SOCK_RAW, &inetdomain, IPPROTO_ICMP, PR_ATOMIC|PR_ADDR, 79 icmp_input, rip_output, 0, rip_ctloutput, 80 rip_usrreq, 81 0, 0, 0, 0, 82 }, 83 #ifdef TPIP 84 { SOCK_SEQPACKET,&inetdomain, IPPROTO_TP, PR_CONNREQUIRED|PR_WANTRCVD, 85 tpip_input, 0, tpip_ctlinput, tp_ctloutput, 86 tp_usrreq, 87 tp_init, 0, tp_slowtimo, tp_drain, 88 }, 89 #endif 90 /* EON (ISO CLNL over IP) */ 91 #ifdef EON 92 { SOCK_RAW, &inetdomain, IPPROTO_EON, 0, 93 eoninput, 0, eonctlinput, 0, 94 0, 95 eonprotoinit, 0, 0, 0, 96 }, 97 #endif 98 #ifdef NSIP 99 { SOCK_RAW, &inetdomain, IPPROTO_IDP, PR_ATOMIC|PR_ADDR, 100 idpip_input, rip_output, nsip_ctlinput, 0, 101 rip_usrreq, 102 0, 0, 0, 0, 103 }, 104 #endif 105 /* raw wildcard */ 106 { SOCK_RAW, &inetdomain, 0, PR_ATOMIC|PR_ADDR, 107 rip_input, rip_output, 0, rip_ctloutput, 108 rip_usrreq, 109 0, 0, 0, 0, 110 }, 111 }; 112 113 struct domain inetdomain = 114 { AF_INET, "internet", 0, 0, 0, 115 inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])] }; 116 117 #if NIMP > 0 118 extern struct domain impdomain; 119 120 struct protosw impsw[] = { 121 { SOCK_RAW, &impdomain, 0, PR_ATOMIC|PR_ADDR, 122 0, rimp_output, 0, 0, 123 rip_usrreq, 124 0, 0, hostslowtimo, 0, 125 }, 126 }; 127 128 struct domain impdomain = 129 { AF_IMPLINK, "imp", 0, 0, 0, 130 impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] }; 131 #endif 132 133 #include "hy.h" 134 #if NHY > 0 135 /* 136 * HYPERchannel protocol family: raw interface. 137 */ 138 int rhy_output(); 139 extern struct domain hydomain; 140 141 struct protosw hysw[] = { 142 { SOCK_RAW, &hydomain, 0, PR_ATOMIC|PR_ADDR, 143 0, rhy_output, 0, 0, 144 rip_usrreq, 145 0, 0, 0, 0, 146 }, 147 }; 148 149 struct domain hydomain = 150 { AF_HYLINK, "hy", 0, 0, 0, hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] }; 151 #endif 152