1 /*-
2 * Copyright (c) 1984, 1985, 1986, 1987, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 4. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * Copyright (c) 1995, Mike Mitchell
30 *
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
33 * are met:
34 * 1. Redistributions of source code must retain the above copyright
35 * notice, this list of conditions and the following disclaimer.
36 * 2. Redistributions in binary form must reproduce the above copyright
37 * notice, this list of conditions and the following disclaimer in the
38 * documentation and/or other materials provided with the distribution.
39 * 3. All advertising materials mentioning features or use of this software
40 * must display the following acknowledgement:
41 * This product includes software developed by the University of
42 * California, Berkeley and its contributors.
43 * 4. Neither the name of the University nor the names of its contributors
44 * may be used to endorse or promote products derived from this software
45 * without specific prior written permission.
46 *
47 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
48 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE.
58 *
59 * @(#)ipx_proto.c
60 */
61
62 #include <sys/cdefs.h>
63 __FBSDID("$FreeBSD$");
64
65 #include "opt_ipx.h"
66
67 #include <sys/param.h>
68 #include <sys/socket.h>
69 #include <sys/protosw.h>
70 #include <sys/domain.h>
71 #include <sys/kernel.h>
72 #include <sys/queue.h>
73 #include <sys/sysctl.h>
74
75 #include <net/radix.h>
76
77 #include <netipx/ipx.h>
78 #include <netipx/ipx_var.h>
79 #include <netipx/spx.h>
80
81 static struct pr_usrreqs nousrreqs;
82
83 /*
84 * IPX protocol family: IPX, ERR, PXP, SPX, ROUTE.
85 */
86
87 static struct domain ipxdomain;
88
89 static struct protosw ipxsw[] = {
90 {
91 .pr_domain = &ipxdomain,
92 .pr_init = ipx_init,
93 .pr_usrreqs = &nousrreqs
94 },
95 {
96 .pr_type = SOCK_DGRAM,
97 .pr_domain = &ipxdomain,
98 .pr_flags = PR_ATOMIC|PR_ADDR,
99 .pr_ctlinput = ipx_ctlinput,
100 .pr_ctloutput = ipx_ctloutput,
101 .pr_usrreqs = &ipx_usrreqs
102 },
103 {
104 .pr_type = SOCK_STREAM,
105 .pr_domain = &ipxdomain,
106 .pr_protocol = IPXPROTO_SPX,
107 .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD,
108 .pr_ctlinput = spx_ctlinput,
109 .pr_ctloutput = spx_ctloutput,
110 .pr_init = spx_init,
111 .pr_fasttimo = spx_fasttimo,
112 .pr_slowtimo = spx_slowtimo,
113 .pr_usrreqs = &spx_usrreqs
114 },
115 {
116 .pr_type = SOCK_SEQPACKET,
117 .pr_domain = &ipxdomain,
118 .pr_protocol = IPXPROTO_SPX,
119 .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_ATOMIC,
120 .pr_ctlinput = spx_ctlinput,
121 .pr_ctloutput = spx_ctloutput,
122 .pr_usrreqs = &spx_usrreq_sps
123 },
124 {
125 .pr_type = SOCK_RAW,
126 .pr_domain = &ipxdomain,
127 .pr_protocol = IPXPROTO_RAW,
128 .pr_flags = PR_ATOMIC|PR_ADDR,
129 .pr_ctloutput = ipx_ctloutput,
130 .pr_usrreqs = &ripx_usrreqs
131 },
132 };
133
134 static struct domain ipxdomain = {
135 .dom_family = AF_IPX,
136 .dom_name = "network systems",
137 .dom_protosw = ipxsw,
138 .dom_protoswNPROTOSW = &ipxsw[sizeof(ipxsw)/sizeof(ipxsw[0])],
139 .dom_rtattach = rn_inithead,
140 .dom_rtoffset = 16,
141 .dom_maxrtkey = sizeof(struct sockaddr_ipx)
142 };
143
144 DOMAIN_SET(ipx);
145 SYSCTL_NODE(_net, PF_IPX, ipx, CTLFLAG_RW, 0,
146 "IPX/SPX");
147
148 SYSCTL_NODE(_net_ipx, IPXPROTO_RAW, ipx, CTLFLAG_RW, 0, "IPX");
149 SYSCTL_NODE(_net_ipx, IPXPROTO_SPX, spx, CTLFLAG_RW, 0, "SPX");
Cache object: f57ba6b96bf21bf8bb54faf2257d2dd9
|