1 /* 2 * Copyright (c) 1982, 1986 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that the above copyright notice and this paragraph are 7 * duplicated in all such forms and that any documentation, 8 * advertising materials, and other materials related to such 9 * distribution and use acknowledge that the software was developed 10 * by the University of California, Berkeley. The name of the 11 * University may not be used to endorse or promote products derived 12 * from this software without specific prior written permission. 13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 * 17 * @(#)in_proto.c 7.3 (Berkeley) 06/29/88 18 */ 19 20 #include "param.h" 21 #include "socket.h" 22 #include "protosw.h" 23 #include "domain.h" 24 #include "mbuf.h" 25 26 #include "in.h" 27 #include "in_systm.h" 28 29 /* 30 * TCP/IP protocol family: IP, ICMP, UDP, TCP. 31 */ 32 int ip_output(),ip_ctloutput(); 33 int ip_init(),ip_slowtimo(),ip_drain(); 34 int icmp_input(); 35 int udp_input(),udp_ctlinput(); 36 int udp_usrreq(); 37 int udp_init(); 38 int tcp_input(),tcp_ctlinput(); 39 int tcp_usrreq(),tcp_ctloutput(); 40 int tcp_init(),tcp_fasttimo(),tcp_slowtimo(),tcp_drain(); 41 int rip_input(),rip_output(),rip_ctloutput(); 42 extern int raw_usrreq(); 43 /* 44 * IMP protocol family: raw interface. 45 * Using the raw interface entry to get the timer routine 46 * in is a kludge. 47 */ 48 #include "imp.h" 49 #if NIMP > 0 50 int rimp_output(), hostslowtimo(); 51 #endif 52 53 #ifdef NSIP 54 int idpip_input(), nsip_ctlinput(); 55 #endif 56 57 extern struct domain inetdomain; 58 59 struct protosw inetsw[] = { 60 { 0, &inetdomain, 0, 0, 61 0, ip_output, 0, 0, 62 0, 63 ip_init, 0, ip_slowtimo, ip_drain, 64 }, 65 { SOCK_DGRAM, &inetdomain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR, 66 udp_input, 0, udp_ctlinput, ip_ctloutput, 67 udp_usrreq, 68 udp_init, 0, 0, 0, 69 }, 70 { SOCK_STREAM, &inetdomain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD, 71 tcp_input, 0, tcp_ctlinput, tcp_ctloutput, 72 tcp_usrreq, 73 tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain, 74 }, 75 { SOCK_RAW, &inetdomain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR, 76 rip_input, rip_output, 0, rip_ctloutput, 77 raw_usrreq, 78 0, 0, 0, 0, 79 }, 80 { SOCK_RAW, &inetdomain, IPPROTO_ICMP, PR_ATOMIC|PR_ADDR, 81 icmp_input, rip_output, 0, rip_ctloutput, 82 raw_usrreq, 83 0, 0, 0, 0, 84 }, 85 #ifdef NSIP 86 { SOCK_RAW, &inetdomain, IPPROTO_IDP, PR_ATOMIC|PR_ADDR, 87 idpip_input, rip_output, nsip_ctlinput, 0, 88 raw_usrreq, 89 0, 0, 0, 0, 90 }, 91 #endif 92 /* raw wildcard */ 93 { SOCK_RAW, &inetdomain, 0, PR_ATOMIC|PR_ADDR, 94 rip_input, rip_output, 0, rip_ctloutput, 95 raw_usrreq, 96 0, 0, 0, 0, 97 }, 98 }; 99 100 struct domain inetdomain = 101 { AF_INET, "internet", 0, 0, 0, 102 inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])] }; 103 104 #if NIMP > 0 105 extern struct domain impdomain; 106 107 struct protosw impsw[] = { 108 { SOCK_RAW, &impdomain, 0, PR_ATOMIC|PR_ADDR, 109 0, rimp_output, 0, 0, 110 raw_usrreq, 111 0, 0, hostslowtimo, 0, 112 }, 113 }; 114 115 struct domain impdomain = 116 { AF_IMPLINK, "imp", 0, 0, 0, 117 impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] }; 118 #endif 119 120 #include "hy.h" 121 #if NHY > 0 122 /* 123 * HYPERchannel protocol family: raw interface. 124 */ 125 int rhy_output(); 126 extern struct domain hydomain; 127 128 struct protosw hysw[] = { 129 { SOCK_RAW, &hydomain, 0, PR_ATOMIC|PR_ADDR, 130 0, rhy_output, 0, 0, 131 raw_usrreq, 132 0, 0, 0, 0, 133 }, 134 }; 135 136 struct domain hydomain = 137 { AF_HYLINK, "hy", 0, 0, 0, hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] }; 138 #endif 139