xref: /original-bsd/sys/netiso/iso_proto.c (revision 04218a6a)
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.5 (Berkeley) 05/03/90 *
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 
61 int	esis_input(), esis_ctlinput(), esis_init(), esis_usrreq();
62 int	cltp_input(), cltp_ctlinput(), cltp_init(), cltp_usrreq(), cltp_output();
63 
64 struct protosw isosw[] = {
65 /*
66  *  We need a datagram entry through which net mgmt programs can get
67  *	to the iso_control procedure (iso ioctls). Thus, a minimal
68  *	SOCK_DGRAM interface is provided here.
69  *  THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call
70  *  pffindtype, which gets the first entry that matches the type.
71  *  sigh.
72  */
73 { SOCK_DGRAM,	&isodomain,		ISOPROTO_CLTP,		PR_ATOMIC|PR_ADDR,
74 	0,			cltp_output,	0,					0,
75 	cltp_usrreq,
76 	cltp_init,	0, 				0,					0
77 },
78 
79 /*
80  *	A datagram interface for clnp cannot co-exist with TP/CLNP
81  *  because CLNP has no way to discriminate incoming TP packets from
82  *  packets coming in for any other higher layer protocol.
83  *  Old way: set it up so that pffindproto(... dgm, clnp) fails.
84  *  New way: let pffindproto work (for x.25, thank you) but create
85  *  	a clnp_usrreq() that returns error on PRU_ATTACH.
86  */
87 {SOCK_DGRAM,	&isodomain,		ISOPROTO_CLNP,		0,
88  0,				clnp_output,	0,					0,
89  clnp_usrreq,
90  clnp_init,		0,				clnp_slowtimo, 		clnp_drain,
91 },
92 
93 /* raw clnp */
94 { SOCK_RAW,		&isodomain,		ISOPROTO_RAW,		PR_ATOMIC|PR_ADDR,
95   rclnp_input,	rclnp_output,	0,					rclnp_ctloutput,
96   clnp_usrreq,
97   0,			0,				0,					0
98 },
99 
100 /* ES-IS protocol */
101 { SOCK_DGRAM,	&isodomain,		ISOPROTO_ESIS,		PR_ATOMIC|PR_ADDR,
102   esis_input,	0,				esis_ctlinput,				0,
103   esis_usrreq,
104   esis_init,			0,				0,					0
105 },
106 
107 /* ISOPROTO_TP */
108 { SOCK_SEQPACKET,	&isodomain,	ISOPROTO_TP,	PR_CONNREQUIRED|PR_WANTRCVD,
109   tpclnp_input,		0,			tpclnp_ctlinput,	tp_ctloutput,
110   tp_usrreq,
111   tp_init,			0,			tp_slowtimo,	tp_drain,
112 },
113 
114 };
115 
116 int	iso_init();
117 
118 struct domain isodomain = {
119     AF_ISO, 			/* family */
120 	"iso-domain", 		/* name */
121 	iso_init,			/* initialize routine */
122 	0,					/* externalize access rights */
123 	0,					/* dispose of internalized rights */
124 	isosw,				/* protosw */
125 	&isosw[sizeof(isosw)/sizeof(isosw[0])] /* NPROTOSW */
126 };
127 #endif	ISO
128