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