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