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