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