From Bruce:
[unix-history] / sys / netiso / iso_proto.c
CommitLineData
15637ed4
RG
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * 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 * 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.
20 *
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 *
43371f85 33 * from: @(#)iso_proto.c 7.8 (Berkeley) 5/6/91
fde1aeb2 34 * $Id: iso_proto.c,v 1.2 1993/10/16 21:05:25 rgrimes Exp $
15637ed4
RG
35 */
36
37/***********************************************************
38 Copyright IBM Corporation 1987
39
40 All Rights Reserved
41
42Permission to use, copy, modify, and distribute this software and its
43documentation for any purpose and without fee is hereby granted,
44provided that the above copyright notice appear in all copies and that
45both that copyright notice and this permission notice appear in
46supporting documentation, and that the name of IBM not be
47used in advertising or publicity pertaining to distribution of the
48software without specific, written prior permission.
49
50IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
51ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
52IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
53ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
54WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
55ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
56SOFTWARE.
57
58******************************************************************/
59
60/*
61 * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
62 */
43371f85
RG
63
64/*
15637ed4
RG
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
71#ifdef ISO
15637ed4 72#include "param.h"
fde1aeb2 73#include "systm.h"
15637ed4
RG
74#include "socket.h"
75#include "protosw.h"
76#include "domain.h"
77#include "mbuf.h"
78
79#include "iso.h"
80
fde1aeb2
GW
81int clnp_output();
82void clnp_init(),clnp_slowtimo(),clnp_drain();
15637ed4
RG
83int rclnp_input(), rclnp_output(), rclnp_ctloutput(), raw_usrreq();
84int clnp_usrreq();
85
86int tp_ctloutput();
fde1aeb2 87void tpclnp_ctlinput();
15637ed4
RG
88int tpclnp_input();
89int tp_usrreq();
fde1aeb2
GW
90void tp_init(), tp_slowtimo(), tp_drain();
91void cons_init();
92int tpcons_input();
93
94int esis_input();
95void esis_ctlinput(), esis_init();
96int esis_usrreq();
97int cltp_input();
98void cltp_ctlinput(), cltp_init();
99int cltp_usrreq(), cltp_output();
15637ed4
RG
100int isis_input();
101
102struct protosw isosw[] = {
103/*
104 * We need a datagram entry through which net mgmt programs can get
105 * to the iso_control procedure (iso ioctls). Thus, a minimal
106 * SOCK_DGRAM interface is provided here.
107 * THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call
108 * pffindtype, which gets the first entry that matches the type.
109 * sigh.
110 */
fde1aeb2
GW
111{ SOCK_DGRAM, &isodomain, ISOPROTO_CLTP, PR_ATOMIC|PR_ADDR,
112 0, cltp_output, 0, 0,
113 cltp_usrreq, cltp_init, 0, 0,
114 0
15637ed4
RG
115},
116
117/*
118 * A datagram interface for clnp cannot co-exist with TP/CLNP
119 * because CLNP has no way to discriminate incoming TP packets from
120 * packets coming in for any other higher layer protocol.
121 * Old way: set it up so that pffindproto(... dgm, clnp) fails.
122 * New way: let pffindproto work (for x.25, thank you) but create
123 * a clnp_usrreq() that returns error on PRU_ATTACH.
124 */
125{SOCK_DGRAM, &isodomain, ISOPROTO_CLNP, 0,
126 0, clnp_output, 0, 0,
127 clnp_usrreq,
128 clnp_init, 0, clnp_slowtimo, clnp_drain,
129},
130
131/* raw clnp */
132{ SOCK_RAW, &isodomain, ISOPROTO_RAW, PR_ATOMIC|PR_ADDR,
133 rclnp_input, rclnp_output, 0, rclnp_ctloutput,
134 clnp_usrreq,
135 0, 0, 0, 0
136},
137
138/* ES-IS protocol */
139{ SOCK_DGRAM, &isodomain, ISOPROTO_ESIS, PR_ATOMIC|PR_ADDR,
140 esis_input, 0, esis_ctlinput, 0,
141 esis_usrreq,
142 esis_init, 0, 0, 0
143},
144
145/* ISOPROTO_INTRAISIS */
146{ SOCK_DGRAM, &isodomain, ISOPROTO_INTRAISIS, PR_ATOMIC|PR_ADDR,
147 isis_input, 0, 0, 0,
148 esis_usrreq,
149 0, 0, 0, 0
150},
151
152/* ISOPROTO_TP */
153{ SOCK_SEQPACKET, &isodomain, ISOPROTO_TP, PR_CONNREQUIRED|PR_WANTRCVD,
154 tpclnp_input, 0, tpclnp_ctlinput, tp_ctloutput,
155 tp_usrreq,
156 tp_init, 0, tp_slowtimo, tp_drain,
157},
158
159#ifdef TPCONS
160/* ISOPROTO_TP */
161{ SOCK_SEQPACKET, &isodomain, ISOPROTO_TP0, PR_CONNREQUIRED|PR_WANTRCVD,
162 tpcons_input, 0, 0, tp_ctloutput,
163 tp_usrreq,
164 cons_init, 0, 0, 0,
165},
166#endif
167
168};
169
170int iso_init();
171
172struct domain isodomain = {
173 AF_ISO, /* family */
174 "iso-domain", /* name */
175 iso_init, /* initialize routine */
176 0, /* externalize access rights */
177 0, /* dispose of internalized rights */
178 isosw, /* protosw */
179 &isosw[sizeof(isosw)/sizeof(isosw[0])] /* NPROTOSW */
180};
fde1aeb2 181#endif /* ISO */