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