xref: /csrg-svn/sys/netinet/in_proto.c (revision 23744)
1 /*
2  * Copyright (c) 1982 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)in_proto.c	6.9 (Berkeley) 06/24/85
7  */
8 
9 #include "param.h"
10 #include "socket.h"
11 #include "protosw.h"
12 #include "domain.h"
13 #include "mbuf.h"
14 
15 #include "in.h"
16 #include "in_systm.h"
17 
18 /*
19  * TCP/IP protocol family: IP, ICMP, UDP, TCP.
20  */
21 int	ip_output();
22 int	ip_init(),ip_slowtimo(),ip_drain();
23 int	icmp_input();
24 int	udp_input(),udp_ctlinput();
25 int	udp_usrreq();
26 int	udp_init();
27 int	tcp_input(),tcp_ctlinput();
28 int	tcp_usrreq();
29 int	tcp_init(),tcp_fasttimo(),tcp_slowtimo(),tcp_drain();
30 int	rip_input(),rip_output();
31 extern	int raw_usrreq();
32 /*
33  * IMP protocol family: raw interface.
34  * Using the raw interface entry to get the timer routine
35  * in is a kludge.
36  */
37 #include "imp.h"
38 #if NIMP > 0
39 int	rimp_output(), hostslowtimo();
40 #endif
41 
42 #ifdef NSIP
43 int	idpip_input();
44 #endif
45 
46 extern	struct domain inetdomain;
47 
48 struct protosw inetsw[] = {
49 { 0,		&inetdomain,	0,		0,
50   0,		ip_output,	0,		0,
51   0,
52   ip_init,	0,		ip_slowtimo,	ip_drain,
53 },
54 { SOCK_DGRAM,	&inetdomain,	IPPROTO_UDP,	PR_ATOMIC|PR_ADDR,
55   udp_input,	0,		udp_ctlinput,	0,
56   udp_usrreq,
57   udp_init,	0,		0,		0,
58 },
59 { SOCK_STREAM,	&inetdomain,	IPPROTO_TCP,	PR_CONNREQUIRED|PR_WANTRCVD,
60   tcp_input,	0,		tcp_ctlinput,	0,
61   tcp_usrreq,
62   tcp_init,	tcp_fasttimo,	tcp_slowtimo,	tcp_drain,
63 },
64 { SOCK_RAW,	&inetdomain,	IPPROTO_RAW,	PR_ATOMIC|PR_ADDR,
65   rip_input,	rip_output,	0,	0,
66   raw_usrreq,
67   0,		0,		0,		0,
68 },
69 { SOCK_RAW,	&inetdomain,	IPPROTO_ICMP,	PR_ATOMIC|PR_ADDR,
70   icmp_input,	rip_output,	0,		0,
71   raw_usrreq,
72   0,		0,		0,		0,
73 },
74 #ifdef NSIP
75 { SOCK_RAW,	&inetdomain,	IPPROTO_PUP,	PR_ATOMIC|PR_ADDR,
76   idpip_input,	rip_output,	0,		0,
77   raw_usrreq,
78   0,		0,		0,		0,
79 },
80 #endif
81 	/* raw wildcard */
82 { SOCK_RAW,	&inetdomain,	0,		PR_ATOMIC|PR_ADDR,
83   rip_input,	rip_output,	0,	0,
84   raw_usrreq,
85   0,		0,		0,		0,
86 },
87 };
88 
89 struct domain inetdomain =
90     { AF_INET, "internet", 0, 0, 0,
91       inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])] };
92 
93 #if NIMP > 0
94 extern	struct domain impdomain;
95 
96 struct protosw impsw[] = {
97 { SOCK_RAW,	&impdomain,	0,		PR_ATOMIC|PR_ADDR,
98   0,		rimp_output,	0,		0,
99   raw_usrreq,
100   0,		0,		hostslowtimo,	0,
101 },
102 };
103 
104 struct domain impdomain =
105     { AF_IMPLINK, "imp", 0, 0, 0,
106       impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] };
107 #endif
108 
109 #include "hy.h"
110 #if NHY > 0
111 /*
112  * HYPERchannel protocol family: raw interface.
113  */
114 int	rhy_output();
115 
116 struct protosw hysw[] = {
117 { SOCK_RAW,	PF_HYLINK,	0,		PR_ATOMIC|PR_ADDR,
118   0,		rhy_output,	0,		0,
119   raw_usrreq,
120   0,		0,		0,		0,
121 },
122 };
123 
124 struct domain hydomain =
125     { AF_HYLINK, "hy", hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] };
126 #endif
127