xref: /original-bsd/sys/netiso/iso_proto.c (revision 42b80877)
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  *
30  * iso_proto.c : protocol switch tables in the ISO domain
31  *
32  * ISO protocol family includes TP, CLTP, CLNP, 8208
33  * TP and CLNP are implemented here.
34  */
35 
36 #ifndef lint
37 static char *rcsid = "$Header: iso_proto.c,v 4.4 88/09/08 08:38:42 hagens Exp $";
38 #endif
39 
40 #ifdef	ISO
41 #include "types.h"
42 #include "param.h"
43 #include "socket.h"
44 #include "protosw.h"
45 #include "domain.h"
46 #include "mbuf.h"
47 
48 #include "iso.h"
49 
50 int clnp_output(), clnp_init(),clnp_slowtimo(),clnp_drain();
51 int rclnp_input(), rclnp_output(), rclnp_ctloutput(), raw_usrreq();
52 int	clnp_usrreq();
53 int	iso_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 
61 int	esis_input(), esis_ctlinput(), esis_init(), esis_usrreq();
62 
63 struct protosw isosw[] = {
64 /*
65  *  We need a datagram entry through which net mgmt programs can get
66  *	to the iso_control procedure (iso ioctls). Thus, a minimal
67  *	SOCK_DGRAM interface is provided here.
68  *  THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call
69  *  pffindtype, which gets the first entry that matches the type.
70  *  sigh.
71  */
72 { SOCK_DGRAM,	&isodomain,		0,					PR_ATOMIC|PR_ADDR,
73 	0,			0,				0,					0,
74 	iso_usrreq,
75 	0,			0, 				0,					0
76 },
77 
78 /*
79  *	A datagram interface for clnp cannot co-exist with TP/CLNP
80  *  because CLNP has no way to discriminate incoming TP packets from
81  *  packets coming in for any other higher layer protocol.
82  *  Old way: set it up so that pffindproto(... dgm, clnp) fails.
83  *  New way: let pffindproto work (for x.25, thank you) but create
84  *  	a clnp_usrreq() that returns error on PRU_ATTACH.
85  */
86 {SOCK_DGRAM,	&isodomain,		ISOPROTO_CLNP,		0,
87  clnp_usrreq,	clnp_output,	0,					0,
88  0,
89  clnp_init,		0,				clnp_slowtimo, 		clnp_drain,
90 },
91 
92 /* raw clnp */
93 { SOCK_RAW,		&isodomain,		ISOPROTO_RAW,		PR_ATOMIC|PR_ADDR,
94   rclnp_input,	rclnp_output,	0,					rclnp_ctloutput,
95   raw_usrreq,
96   0,			0,				0,					0
97 },
98 
99 /* ES-IS protocol */
100 { SOCK_DGRAM,	&isodomain,		ISOPROTO_ESIS,		PR_ATOMIC|PR_ADDR,
101   esis_input,	0,				esis_ctlinput,				0,
102   esis_usrreq,
103   esis_init,			0,				0,					0
104 },
105 
106 /* ISOPROTO_TP */
107 { SOCK_SEQPACKET,	&isodomain,	ISOPROTO_TP,	PR_CONNREQUIRED|PR_WANTRCVD,
108   tpclnp_input,		0,			tpclnp_ctlinput,	tp_ctloutput,
109   tp_usrreq,
110   tp_init,			0,			tp_slowtimo,	tp_drain,
111 },
112 
113 };
114 
115 int	iso_init();
116 
117 struct domain isodomain = {
118     AF_ISO, 			/* family */
119 	"iso-domain", 		/* name */
120 	iso_init,			/* initialize routine */
121 	0,					/* externalize access rights */
122 	0,					/* dispose of internalized rights */
123 	isosw,				/* protosw */
124 	&isosw[sizeof(isosw)/sizeof(isosw[0])] /* NPROTOSW */
125 };
126 #endif	ISO
127