xref: /original-bsd/sys/netinet/in_proto.c (revision a4d3ae46)
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 this notice is preserved and that due credit is given
7  * to the University of California at Berkeley. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  *
12  *	@(#)in_proto.c	7.2 (Berkeley) 12/07/87
13  */
14 
15 #include "param.h"
16 #include "socket.h"
17 #include "protosw.h"
18 #include "domain.h"
19 #include "mbuf.h"
20 
21 #include "in.h"
22 #include "in_systm.h"
23 
24 /*
25  * TCP/IP protocol family: IP, ICMP, UDP, TCP.
26  */
27 int	ip_output(),ip_ctloutput();
28 int	ip_init(),ip_slowtimo(),ip_drain();
29 int	icmp_input();
30 int	udp_input(),udp_ctlinput();
31 int	udp_usrreq();
32 int	udp_init();
33 int	tcp_input(),tcp_ctlinput();
34 int	tcp_usrreq(),tcp_ctloutput();
35 int	tcp_init(),tcp_fasttimo(),tcp_slowtimo(),tcp_drain();
36 int	rip_input(),rip_output(),rip_ctloutput();
37 extern	int raw_usrreq();
38 /*
39  * IMP protocol family: raw interface.
40  * Using the raw interface entry to get the timer routine
41  * in is a kludge.
42  */
43 #include "imp.h"
44 #if NIMP > 0
45 int	rimp_output(), hostslowtimo();
46 #endif
47 
48 #ifdef NSIP
49 int	idpip_input(), nsip_ctlinput();
50 #endif
51 
52 extern	struct domain inetdomain;
53 
54 struct protosw inetsw[] = {
55 { 0,		&inetdomain,	0,		0,
56   0,		ip_output,	0,		0,
57   0,
58   ip_init,	0,		ip_slowtimo,	ip_drain,
59 },
60 { SOCK_DGRAM,	&inetdomain,	IPPROTO_UDP,	PR_ATOMIC|PR_ADDR,
61   udp_input,	0,		udp_ctlinput,	ip_ctloutput,
62   udp_usrreq,
63   udp_init,	0,		0,		0,
64 },
65 { SOCK_STREAM,	&inetdomain,	IPPROTO_TCP,	PR_CONNREQUIRED|PR_WANTRCVD,
66   tcp_input,	0,		tcp_ctlinput,	tcp_ctloutput,
67   tcp_usrreq,
68   tcp_init,	tcp_fasttimo,	tcp_slowtimo,	tcp_drain,
69 },
70 { SOCK_RAW,	&inetdomain,	IPPROTO_RAW,	PR_ATOMIC|PR_ADDR,
71   rip_input,	rip_output,	0,		rip_ctloutput,
72   raw_usrreq,
73   0,		0,		0,		0,
74 },
75 { SOCK_RAW,	&inetdomain,	IPPROTO_ICMP,	PR_ATOMIC|PR_ADDR,
76   icmp_input,	rip_output,	0,		rip_ctloutput,
77   raw_usrreq,
78   0,		0,		0,		0,
79 },
80 #ifdef NSIP
81 { SOCK_RAW,	&inetdomain,	IPPROTO_IDP,	PR_ATOMIC|PR_ADDR,
82   idpip_input,	rip_output,	nsip_ctlinput,	0,
83   raw_usrreq,
84   0,		0,		0,		0,
85 },
86 #endif
87 	/* raw wildcard */
88 { SOCK_RAW,	&inetdomain,	0,		PR_ATOMIC|PR_ADDR,
89   rip_input,	rip_output,	0,		rip_ctloutput,
90   raw_usrreq,
91   0,		0,		0,		0,
92 },
93 };
94 
95 struct domain inetdomain =
96     { AF_INET, "internet", 0, 0, 0,
97       inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])] };
98 
99 #if NIMP > 0
100 extern	struct domain impdomain;
101 
102 struct protosw impsw[] = {
103 { SOCK_RAW,	&impdomain,	0,		PR_ATOMIC|PR_ADDR,
104   0,		rimp_output,	0,		0,
105   raw_usrreq,
106   0,		0,		hostslowtimo,	0,
107 },
108 };
109 
110 struct domain impdomain =
111     { AF_IMPLINK, "imp", 0, 0, 0,
112       impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] };
113 #endif
114 
115 #include "hy.h"
116 #if NHY > 0
117 /*
118  * HYPERchannel protocol family: raw interface.
119  */
120 int	rhy_output();
121 extern	struct domain hydomain;
122 
123 struct protosw hysw[] = {
124 { SOCK_RAW,	&hydomain,	0,		PR_ATOMIC|PR_ADDR,
125   0,		rhy_output,	0,		0,
126   raw_usrreq,
127   0,		0,		0,		0,
128 },
129 };
130 
131 struct domain hydomain =
132     { AF_HYLINK, "hy", 0, 0, 0, hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] };
133 #endif
134