Commit | Line | Data |
---|---|---|
7bcd1bb8 KB |
1 | /*- |
2 | * Copyright (c) 1991 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
6 | * | |
5548a02f | 7 | * @(#)iso_proto.c 7.11 (Berkeley) %G% |
7bcd1bb8 KB |
8 | */ |
9 | ||
5d0aaf88 KS |
10 | /*********************************************************** |
11 | Copyright IBM Corporation 1987 | |
12 | ||
13 | All Rights Reserved | |
14 | ||
15 | Permission to use, copy, modify, and distribute this software and its | |
16 | documentation for any purpose and without fee is hereby granted, | |
17 | provided that the above copyright notice appear in all copies and that | |
18 | both that copyright notice and this permission notice appear in | |
19 | supporting documentation, and that the name of IBM not be | |
20 | used in advertising or publicity pertaining to distribution of the | |
21 | software without specific, written prior permission. | |
22 | ||
23 | IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | |
24 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | |
25 | IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | |
26 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
27 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
28 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
29 | SOFTWARE. | |
30 | ||
31 | ******************************************************************/ | |
32 | ||
33 | /* | |
34 | * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison | |
35 | */ | |
36 | /* $Header: iso_proto.c,v 4.4 88/09/08 08:38:42 hagens Exp $ | |
37 | * $Source: /usr/argo/sys/netiso/RCS/iso_proto.c,v $ | |
38 | * | |
39 | * iso_proto.c : protocol switch tables in the ISO domain | |
40 | * | |
41 | * ISO protocol family includes TP, CLTP, CLNP, 8208 | |
42 | * TP and CLNP are implemented here. | |
43 | */ | |
44 | ||
5d0aaf88 | 45 | #ifdef ISO |
5548a02f KB |
46 | #include <sys/param.h> |
47 | #include <sys/socket.h> | |
48 | #include <sys/protosw.h> | |
49 | #include <sys/domain.h> | |
50 | #include <sys/mbuf.h> | |
a50e2bc0 | 51 | |
5548a02f KB |
52 | #include <net/radix.h> |
53 | ||
54 | #include <netiso/iso.h> | |
5d0aaf88 KS |
55 | |
56 | int clnp_output(), clnp_init(),clnp_slowtimo(),clnp_drain(); | |
57 | int rclnp_input(), rclnp_output(), rclnp_ctloutput(), raw_usrreq(); | |
58 | int clnp_usrreq(); | |
5d0aaf88 KS |
59 | |
60 | int tp_ctloutput(); | |
61 | int tpclnp_ctlinput(); | |
62 | int tpclnp_input(); | |
63 | int tp_usrreq(); | |
13cdf5ec | 64 | int tp_init(), tp_fasttimo(), tp_slowtimo(), tp_drain(); |
0f6310eb | 65 | int cons_init(), tpcons_input(); |
5d0aaf88 KS |
66 | |
67 | int esis_input(), esis_ctlinput(), esis_init(), esis_usrreq(); | |
bace31da | 68 | int cltp_input(), cltp_ctlinput(), cltp_init(), cltp_usrreq(), cltp_output(); |
d12b96b5 | 69 | int isis_input(); |
5d0aaf88 KS |
70 | |
71 | struct protosw isosw[] = { | |
72 | /* | |
73 | * We need a datagram entry through which net mgmt programs can get | |
74 | * to the iso_control procedure (iso ioctls). Thus, a minimal | |
75 | * SOCK_DGRAM interface is provided here. | |
76 | * THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call | |
77 | * pffindtype, which gets the first entry that matches the type. | |
78 | * sigh. | |
79 | */ | |
bace31da KS |
80 | { SOCK_DGRAM, &isodomain, ISOPROTO_CLTP, PR_ATOMIC|PR_ADDR, |
81 | 0, cltp_output, 0, 0, | |
82 | cltp_usrreq, | |
83 | cltp_init, 0, 0, 0 | |
5d0aaf88 KS |
84 | }, |
85 | ||
86 | /* | |
87 | * A datagram interface for clnp cannot co-exist with TP/CLNP | |
88 | * because CLNP has no way to discriminate incoming TP packets from | |
89 | * packets coming in for any other higher layer protocol. | |
90 | * Old way: set it up so that pffindproto(... dgm, clnp) fails. | |
91 | * New way: let pffindproto work (for x.25, thank you) but create | |
92 | * a clnp_usrreq() that returns error on PRU_ATTACH. | |
93 | */ | |
94 | {SOCK_DGRAM, &isodomain, ISOPROTO_CLNP, 0, | |
bace31da KS |
95 | 0, clnp_output, 0, 0, |
96 | clnp_usrreq, | |
5d0aaf88 KS |
97 | clnp_init, 0, clnp_slowtimo, clnp_drain, |
98 | }, | |
99 | ||
100 | /* raw clnp */ | |
101 | { SOCK_RAW, &isodomain, ISOPROTO_RAW, PR_ATOMIC|PR_ADDR, | |
102 | rclnp_input, rclnp_output, 0, rclnp_ctloutput, | |
bec1b7dc | 103 | clnp_usrreq, |
5d0aaf88 KS |
104 | 0, 0, 0, 0 |
105 | }, | |
106 | ||
107 | /* ES-IS protocol */ | |
108 | { SOCK_DGRAM, &isodomain, ISOPROTO_ESIS, PR_ATOMIC|PR_ADDR, | |
0f6310eb | 109 | esis_input, 0, esis_ctlinput, 0, |
5d0aaf88 | 110 | esis_usrreq, |
d12b96b5 KS |
111 | esis_init, 0, 0, 0 |
112 | }, | |
113 | ||
114 | /* ISOPROTO_INTRAISIS */ | |
115 | { SOCK_DGRAM, &isodomain, ISOPROTO_INTRAISIS, PR_ATOMIC|PR_ADDR, | |
116 | isis_input, 0, 0, 0, | |
117 | esis_usrreq, | |
118 | 0, 0, 0, 0 | |
5d0aaf88 KS |
119 | }, |
120 | ||
121 | /* ISOPROTO_TP */ | |
0f6310eb | 122 | { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP, PR_CONNREQUIRED|PR_WANTRCVD, |
5d0aaf88 KS |
123 | tpclnp_input, 0, tpclnp_ctlinput, tp_ctloutput, |
124 | tp_usrreq, | |
13cdf5ec | 125 | tp_init, tp_fasttimo, tp_slowtimo, tp_drain, |
5d0aaf88 KS |
126 | }, |
127 | ||
0f6310eb KS |
128 | #ifdef TPCONS |
129 | /* ISOPROTO_TP */ | |
130 | { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP0, PR_CONNREQUIRED|PR_WANTRCVD, | |
131 | tpcons_input, 0, 0, tp_ctloutput, | |
132 | tp_usrreq, | |
133 | cons_init, 0, 0, 0, | |
134 | }, | |
135 | #endif | |
136 | ||
5d0aaf88 KS |
137 | }; |
138 | ||
5d0aaf88 KS |
139 | |
140 | struct domain isodomain = { | |
141 | AF_ISO, /* family */ | |
142 | "iso-domain", /* name */ | |
5c48f39f | 143 | 0, /* initialize routine */ |
5d0aaf88 KS |
144 | 0, /* externalize access rights */ |
145 | 0, /* dispose of internalized rights */ | |
146 | isosw, /* protosw */ | |
5c48f39f KS |
147 | &isosw[sizeof(isosw)/sizeof(isosw[0])], /* NPROTOSW */ |
148 | 0, /* next */ | |
149 | rn_inithead, /* rtattach */ | |
150 | 48, /* rtoffset */ | |
151 | sizeof(struct sockaddr_iso) /* maxkeylen */ | |
5d0aaf88 KS |
152 | }; |
153 | #endif ISO |