1 /* $NetBSD: iso_proto.c,v 1.14 2003/08/07 16:33:37 agc Exp $ */
2
3 /*-
4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)iso_proto.c 8.2 (Berkeley) 2/9/95
32 */
33
34 /***********************************************************
35 Copyright IBM Corporation 1987
36
37 All Rights Reserved
38
39 Permission to use, copy, modify, and distribute this software and its
40 documentation for any purpose and without fee is hereby granted,
41 provided that the above copyright notice appear in all copies and that
42 both that copyright notice and this permission notice appear in
43 supporting documentation, and that the name of IBM not be
44 used in advertising or publicity pertaining to distribution of the
45 software without specific, written prior permission.
46
47 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
48 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
49 IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
50 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
51 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
52 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
53 SOFTWARE.
54
55 ******************************************************************/
56
57 /*
58 * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
59 */
60 /*
61 * iso_proto.c : protocol switch tables in the ISO domain
62 *
63 * ISO protocol family includes TP, CLTP, CLNP, 8208
64 * TP and CLNP are implemented here.
65 */
66
67 #include <sys/cdefs.h>
68 __KERNEL_RCSID(0, "$NetBSD: iso_proto.c,v 1.14 2003/08/07 16:33:37 agc Exp $");
69
70 #include "opt_iso.h"
71
72 #ifdef ISO
73 #include <sys/param.h>
74 #include <sys/socket.h>
75 #include <sys/protosw.h>
76 #include <sys/domain.h>
77 #include <sys/mbuf.h>
78
79 #include <net/radix.h>
80
81 #include <netiso/iso.h>
82
83 #include <netiso/clnp.h>
84 #include <netiso/tp_param.h>
85 #include <netiso/tp_var.h>
86 #include <netiso/esis.h>
87 #include <netiso/idrp_var.h>
88 #include <netiso/iso_pcb.h>
89 #include <netiso/cltp_var.h>
90
91 struct protosw isosw[] = {
92 /*
93 * We need a datagram entry through which net mgmt programs can get
94 * to the iso_control procedure (iso ioctls). Thus, a minimal
95 * SOCK_DGRAM interface is provided here.
96 * THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call
97 * pffindtype, which gets the first entry that matches the type.
98 * sigh.
99 */
100 {SOCK_DGRAM, &isodomain, ISOPROTO_CLTP, PR_ATOMIC | PR_ADDR,
101 0, cltp_output, 0, 0,
102 cltp_usrreq,
103 cltp_init, 0, 0, 0
104 },
105
106 /*
107 * A datagram interface for clnp cannot co-exist with TP/CLNP
108 * because CLNP has no way to discriminate incoming TP packets from
109 * packets coming in for any other higher layer protocol.
110 * Old way: set it up so that pffindproto(... dgm, clnp) fails.
111 * New way: let pffindproto work (for x.25, thank you) but create
112 * a clnp_usrreq() that returns error on PRU_ATTACH.
113 */
114 {SOCK_DGRAM, &isodomain, ISOPROTO_CLNP, 0,
115 0, clnp_output, 0, 0,
116 clnp_usrreq,
117 clnp_init, 0, clnp_slowtimo, clnp_drain,
118 },
119
120 /* raw clnp */
121 {SOCK_RAW, &isodomain, ISOPROTO_RAW, PR_ATOMIC | PR_ADDR,
122 rclnp_input, rclnp_output, 0, rclnp_ctloutput,
123 clnp_usrreq,
124 0, 0, 0, 0
125 },
126
127 /* ES-IS protocol */
128 {SOCK_DGRAM, &isodomain, ISOPROTO_ESIS, PR_ATOMIC | PR_ADDR,
129 esis_input, 0, esis_ctlinput, 0,
130 esis_usrreq,
131 esis_init, 0, 0, 0
132 },
133
134 /* ISOPROTO_INTRAISIS */
135 {SOCK_DGRAM, &isodomain, ISOPROTO_INTRAISIS, PR_ATOMIC | PR_ADDR,
136 isis_input, 0, 0, 0,
137 esis_usrreq,
138 0, 0, 0, 0
139 },
140
141 /* ISOPROTO_IDRP */
142 {SOCK_DGRAM, &isodomain, ISOPROTO_IDRP, PR_ATOMIC | PR_ADDR,
143 idrp_input, 0, 0, 0,
144 idrp_usrreq,
145 idrp_init, 0, 0, 0
146 },
147
148 /* ISOPROTO_TP */
149 {SOCK_SEQPACKET, &isodomain, ISOPROTO_TP, PR_CONNREQUIRED | PR_WANTRCVD | PR_LISTEN | PR_ABRTACPTDIS,
150 tpclnp_input, 0, tpclnp_ctlinput, tp_ctloutput,
151 tp_usrreq,
152 tp_init, tp_fasttimo, tp_slowtimo, tp_drain,
153 },
154
155 #ifdef TPCONS
156 /* ISOPROTO_TP */
157 {SOCK_SEQPACKET, &isodomain, ISOPROTO_TP0, PR_CONNREQUIRED | PR_WANTRCVD | PR_LISTEN | PR_ABRTACPTDIS,
158 tpcons_input, 0, 0, tp_ctloutput,
159 tp_usrreq,
160 cons_init, 0, 0, 0,
161 },
162 #endif
163 };
164
165
166 struct domain isodomain = {
167 PF_ISO, /* family */
168 "iso-domain", /* name */
169 0, /* initialize routine */
170 0, /* externalize access rights */
171 0, /* dispose of internalized rights */
172 isosw, /* protosw */
173 &isosw[sizeof(isosw) / sizeof(isosw[0])], /* NPROTOSW */
174 0, /* next */
175 rn_inithead, /* rtattach */
176 48, /* rtoffset */
177 sizeof(struct sockaddr_iso) /* maxkeylen */
178 };
179 #endif /* ISO */
Cache object: e329602c61ed6fb657a7b1e7bac26ee1
|