xref: /freebsd/sys/netinet/in_proto.c (revision df8bae1de4b67ccf57f4afebd4e2bf258c38910d)
1df8bae1dSRodney W. Grimes /*
2df8bae1dSRodney W. Grimes  * Copyright (c) 1982, 1986, 1993
3df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
4df8bae1dSRodney W. Grimes  *
5df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
6df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
7df8bae1dSRodney W. Grimes  * are met:
8df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
9df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
10df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
11df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
12df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
13df8bae1dSRodney W. Grimes  * 3. All advertising materials mentioning features or use of this software
14df8bae1dSRodney W. Grimes  *    must display the following acknowledgement:
15df8bae1dSRodney W. Grimes  *	This product includes software developed by the University of
16df8bae1dSRodney W. Grimes  *	California, Berkeley and its contributors.
17df8bae1dSRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
18df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
19df8bae1dSRodney W. Grimes  *    without specific prior written permission.
20df8bae1dSRodney W. Grimes  *
21df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
32df8bae1dSRodney W. Grimes  *
33df8bae1dSRodney W. Grimes  *	@(#)in_proto.c	8.1 (Berkeley) 6/10/93
34df8bae1dSRodney W. Grimes  */
35df8bae1dSRodney W. Grimes 
36df8bae1dSRodney W. Grimes #include <sys/param.h>
37df8bae1dSRodney W. Grimes #include <sys/socket.h>
38df8bae1dSRodney W. Grimes #include <sys/protosw.h>
39df8bae1dSRodney W. Grimes #include <sys/domain.h>
40df8bae1dSRodney W. Grimes #include <sys/mbuf.h>
41df8bae1dSRodney W. Grimes 
42df8bae1dSRodney W. Grimes #include <net/if.h>
43df8bae1dSRodney W. Grimes #include <net/radix.h>
44df8bae1dSRodney W. Grimes #include <net/route.h>
45df8bae1dSRodney W. Grimes 
46df8bae1dSRodney W. Grimes #include <netinet/in.h>
47df8bae1dSRodney W. Grimes #include <netinet/in_systm.h>
48df8bae1dSRodney W. Grimes #include <netinet/ip.h>
49df8bae1dSRodney W. Grimes #include <netinet/ip_var.h>
50df8bae1dSRodney W. Grimes #include <netinet/ip_icmp.h>
51df8bae1dSRodney W. Grimes #include <netinet/in_pcb.h>
52df8bae1dSRodney W. Grimes #include <netinet/igmp_var.h>
53df8bae1dSRodney W. Grimes #include <netinet/tcp.h>
54df8bae1dSRodney W. Grimes #include <netinet/tcp_fsm.h>
55df8bae1dSRodney W. Grimes #include <netinet/tcp_seq.h>
56df8bae1dSRodney W. Grimes #include <netinet/tcp_timer.h>
57df8bae1dSRodney W. Grimes #include <netinet/tcp_var.h>
58df8bae1dSRodney W. Grimes #include <netinet/tcpip.h>
59df8bae1dSRodney W. Grimes #include <netinet/tcp_debug.h>
60df8bae1dSRodney W. Grimes #include <netinet/udp.h>
61df8bae1dSRodney W. Grimes #include <netinet/udp_var.h>
62df8bae1dSRodney W. Grimes /*
63df8bae1dSRodney W. Grimes  * TCP/IP protocol family: IP, ICMP, UDP, TCP.
64df8bae1dSRodney W. Grimes  */
65df8bae1dSRodney W. Grimes 
66df8bae1dSRodney W. Grimes #ifdef NSIP
67df8bae1dSRodney W. Grimes void	idpip_input(), nsip_ctlinput();
68df8bae1dSRodney W. Grimes #endif
69df8bae1dSRodney W. Grimes 
70df8bae1dSRodney W. Grimes #ifdef TPIP
71df8bae1dSRodney W. Grimes void	tpip_input(), tpip_ctlinput(), tp_ctloutput();
72df8bae1dSRodney W. Grimes int	tp_init(), tp_slowtimo(), tp_drain(), tp_usrreq();
73df8bae1dSRodney W. Grimes #endif
74df8bae1dSRodney W. Grimes 
75df8bae1dSRodney W. Grimes #ifdef EON
76df8bae1dSRodney W. Grimes void	eoninput(), eonctlinput(), eonprotoinit();
77df8bae1dSRodney W. Grimes #endif /* EON */
78df8bae1dSRodney W. Grimes 
79df8bae1dSRodney W. Grimes extern	struct domain inetdomain;
80df8bae1dSRodney W. Grimes 
81df8bae1dSRodney W. Grimes struct protosw inetsw[] = {
82df8bae1dSRodney W. Grimes { 0,		&inetdomain,	0,		0,
83df8bae1dSRodney W. Grimes   0,		ip_output,	0,		0,
84df8bae1dSRodney W. Grimes   0,
85df8bae1dSRodney W. Grimes   ip_init,	0,		ip_slowtimo,	ip_drain,	ip_sysctl
86df8bae1dSRodney W. Grimes },
87df8bae1dSRodney W. Grimes { SOCK_DGRAM,	&inetdomain,	IPPROTO_UDP,	PR_ATOMIC|PR_ADDR,
88df8bae1dSRodney W. Grimes   udp_input,	0,		udp_ctlinput,	ip_ctloutput,
89df8bae1dSRodney W. Grimes   udp_usrreq,
90df8bae1dSRodney W. Grimes   udp_init,	0,		0,		0,		udp_sysctl
91df8bae1dSRodney W. Grimes },
92df8bae1dSRodney W. Grimes { SOCK_STREAM,	&inetdomain,	IPPROTO_TCP,	PR_CONNREQUIRED|PR_WANTRCVD,
93df8bae1dSRodney W. Grimes   tcp_input,	0,		tcp_ctlinput,	tcp_ctloutput,
94df8bae1dSRodney W. Grimes   tcp_usrreq,
95df8bae1dSRodney W. Grimes   tcp_init,	tcp_fasttimo,	tcp_slowtimo,	tcp_drain,
96df8bae1dSRodney W. Grimes },
97df8bae1dSRodney W. Grimes { SOCK_RAW,	&inetdomain,	IPPROTO_RAW,	PR_ATOMIC|PR_ADDR,
98df8bae1dSRodney W. Grimes   rip_input,	rip_output,	0,		rip_ctloutput,
99df8bae1dSRodney W. Grimes   rip_usrreq,
100df8bae1dSRodney W. Grimes   0,		0,		0,		0,
101df8bae1dSRodney W. Grimes },
102df8bae1dSRodney W. Grimes { SOCK_RAW,	&inetdomain,	IPPROTO_ICMP,	PR_ATOMIC|PR_ADDR,
103df8bae1dSRodney W. Grimes   icmp_input,	rip_output,	0,		rip_ctloutput,
104df8bae1dSRodney W. Grimes   rip_usrreq,
105df8bae1dSRodney W. Grimes   0,		0,		0,		0,		icmp_sysctl
106df8bae1dSRodney W. Grimes },
107df8bae1dSRodney W. Grimes { SOCK_RAW,	&inetdomain,	IPPROTO_IGMP,	PR_ATOMIC|PR_ADDR,
108df8bae1dSRodney W. Grimes   igmp_input,	rip_output,	0,		rip_ctloutput,
109df8bae1dSRodney W. Grimes   rip_usrreq,
110df8bae1dSRodney W. Grimes   igmp_init,	igmp_fasttimo,	0,		0,
111df8bae1dSRodney W. Grimes },
112df8bae1dSRodney W. Grimes #ifdef TPIP
113df8bae1dSRodney W. Grimes { SOCK_SEQPACKET,&inetdomain,	IPPROTO_TP,	PR_CONNREQUIRED|PR_WANTRCVD,
114df8bae1dSRodney W. Grimes   tpip_input,	0,		tpip_ctlinput,	tp_ctloutput,
115df8bae1dSRodney W. Grimes   tp_usrreq,
116df8bae1dSRodney W. Grimes   tp_init,	0,		tp_slowtimo,	tp_drain,
117df8bae1dSRodney W. Grimes },
118df8bae1dSRodney W. Grimes #endif
119df8bae1dSRodney W. Grimes /* EON (ISO CLNL over IP) */
120df8bae1dSRodney W. Grimes #ifdef EON
121df8bae1dSRodney W. Grimes { SOCK_RAW,	&inetdomain,	IPPROTO_EON,	0,
122df8bae1dSRodney W. Grimes   eoninput,	0,		eonctlinput,		0,
123df8bae1dSRodney W. Grimes   0,
124df8bae1dSRodney W. Grimes   eonprotoinit,	0,		0,		0,
125df8bae1dSRodney W. Grimes },
126df8bae1dSRodney W. Grimes #endif
127df8bae1dSRodney W. Grimes #ifdef NSIP
128df8bae1dSRodney W. Grimes { SOCK_RAW,	&inetdomain,	IPPROTO_IDP,	PR_ATOMIC|PR_ADDR,
129df8bae1dSRodney W. Grimes   idpip_input,	rip_output,	nsip_ctlinput,	0,
130df8bae1dSRodney W. Grimes   rip_usrreq,
131df8bae1dSRodney W. Grimes   0,		0,		0,		0,
132df8bae1dSRodney W. Grimes },
133df8bae1dSRodney W. Grimes #endif
134df8bae1dSRodney W. Grimes 	/* raw wildcard */
135df8bae1dSRodney W. Grimes { SOCK_RAW,	&inetdomain,	0,		PR_ATOMIC|PR_ADDR,
136df8bae1dSRodney W. Grimes   rip_input,	rip_output,	0,		rip_ctloutput,
137df8bae1dSRodney W. Grimes   rip_usrreq,
138df8bae1dSRodney W. Grimes   rip_init,	0,		0,		0,
139df8bae1dSRodney W. Grimes },
140df8bae1dSRodney W. Grimes };
141df8bae1dSRodney W. Grimes 
142df8bae1dSRodney W. Grimes struct domain inetdomain =
143df8bae1dSRodney W. Grimes     { AF_INET, "internet", 0, 0, 0,
144df8bae1dSRodney W. Grimes       inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0,
145df8bae1dSRodney W. Grimes       rn_inithead, 32, sizeof(struct sockaddr_in) };
146df8bae1dSRodney W. Grimes 
147df8bae1dSRodney W. Grimes #include "imp.h"
148df8bae1dSRodney W. Grimes #if NIMP > 0
149df8bae1dSRodney W. Grimes extern	struct domain impdomain;
150df8bae1dSRodney W. Grimes int	rimp_output(), hostslowtimo();
151df8bae1dSRodney W. Grimes 
152df8bae1dSRodney W. Grimes struct protosw impsw[] = {
153df8bae1dSRodney W. Grimes { SOCK_RAW,	&impdomain,	0,		PR_ATOMIC|PR_ADDR,
154df8bae1dSRodney W. Grimes   0,		rimp_output,	0,		0,
155df8bae1dSRodney W. Grimes   rip_usrreq,
156df8bae1dSRodney W. Grimes   0,		0,		hostslowtimo,	0,
157df8bae1dSRodney W. Grimes },
158df8bae1dSRodney W. Grimes };
159df8bae1dSRodney W. Grimes 
160df8bae1dSRodney W. Grimes struct domain impdomain =
161df8bae1dSRodney W. Grimes     { AF_IMPLINK, "imp", 0, 0, 0,
162df8bae1dSRodney W. Grimes       impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] };
163df8bae1dSRodney W. Grimes #endif
164df8bae1dSRodney W. Grimes 
165df8bae1dSRodney W. Grimes #include "hy.h"
166df8bae1dSRodney W. Grimes #if NHY > 0
167df8bae1dSRodney W. Grimes /*
168df8bae1dSRodney W. Grimes  * HYPERchannel protocol family: raw interface.
169df8bae1dSRodney W. Grimes  */
170df8bae1dSRodney W. Grimes int	rhy_output();
171df8bae1dSRodney W. Grimes extern	struct domain hydomain;
172df8bae1dSRodney W. Grimes 
173df8bae1dSRodney W. Grimes struct protosw hysw[] = {
174df8bae1dSRodney W. Grimes { SOCK_RAW,	&hydomain,	0,		PR_ATOMIC|PR_ADDR,
175df8bae1dSRodney W. Grimes   0,		rhy_output,	0,		0,
176df8bae1dSRodney W. Grimes   rip_usrreq,
177df8bae1dSRodney W. Grimes   0,		0,		0,		0,
178df8bae1dSRodney W. Grimes },
179df8bae1dSRodney W. Grimes };
180df8bae1dSRodney W. Grimes 
181df8bae1dSRodney W. Grimes struct domain hydomain =
182df8bae1dSRodney W. Grimes     { AF_HYLINK, "hy", 0, 0, 0, hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] };
183df8bae1dSRodney W. Grimes #endif
184