xref: /csrg-svn/sys/netiso/iso_proto.c (revision 37469)
136391Ssklower /***********************************************************
236391Ssklower 		Copyright IBM Corporation 1987
336391Ssklower 
436391Ssklower                       All Rights Reserved
536391Ssklower 
636391Ssklower Permission to use, copy, modify, and distribute this software and its
736391Ssklower documentation for any purpose and without fee is hereby granted,
836391Ssklower provided that the above copyright notice appear in all copies and that
936391Ssklower both that copyright notice and this permission notice appear in
1036391Ssklower supporting documentation, and that the name of IBM not be
1136391Ssklower used in advertising or publicity pertaining to distribution of the
1236391Ssklower software without specific, written prior permission.
1336391Ssklower 
1436391Ssklower IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
1536391Ssklower ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
1636391Ssklower IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
1736391Ssklower ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
1836391Ssklower WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1936391Ssklower ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
2036391Ssklower SOFTWARE.
2136391Ssklower 
2236391Ssklower ******************************************************************/
2336391Ssklower 
2436391Ssklower /*
2536391Ssklower  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
2636391Ssklower  */
2736391Ssklower /* $Header: iso_proto.c,v 4.4 88/09/08 08:38:42 hagens Exp $
2836391Ssklower  * $Source: /usr/argo/sys/netiso/RCS/iso_proto.c,v $
2936391Ssklower  *
3036391Ssklower  * iso_proto.c : protocol switch tables in the ISO domain
3136391Ssklower  *
3236391Ssklower  * ISO protocol family includes TP, CLTP, CLNP, 8208
3336391Ssklower  * TP and CLNP are implemented here.
3436391Ssklower  */
3536391Ssklower 
3636391Ssklower #ifndef lint
3736391Ssklower static char *rcsid = "$Header: iso_proto.c,v 4.4 88/09/08 08:38:42 hagens Exp $";
3836391Ssklower #endif
3936391Ssklower 
4036391Ssklower #ifdef	ISO
41*37469Ssklower #include "types.h"
42*37469Ssklower #include "param.h"
43*37469Ssklower #include "socket.h"
44*37469Ssklower #include "protosw.h"
45*37469Ssklower #include "domain.h"
46*37469Ssklower #include "mbuf.h"
4736391Ssklower 
48*37469Ssklower #include "iso.h"
4936391Ssklower 
5036391Ssklower int clnp_output(), clnp_init(),clnp_slowtimo(),clnp_drain();
5136391Ssklower int rclnp_input(), rclnp_output(), rclnp_ctloutput(), raw_usrreq();
5236391Ssklower int	clnp_usrreq();
5336391Ssklower int	iso_usrreq();
5436391Ssklower 
5536391Ssklower int	tp_ctloutput();
5636391Ssklower int	tpclnp_ctlinput();
5736391Ssklower int	tpclnp_input();
5836391Ssklower int	tp_usrreq();
5936391Ssklower int	tp_init(),tp_slowtimo(),tp_drain();
6036391Ssklower 
6136391Ssklower int	esis_input(), esis_ctlinput(), esis_init(), esis_usrreq();
6236391Ssklower 
6336391Ssklower struct protosw isosw[] = {
6436391Ssklower /*
6536391Ssklower  *  We need a datagram entry through which net mgmt programs can get
6636391Ssklower  *	to the iso_control procedure (iso ioctls). Thus, a minimal
6736391Ssklower  *	SOCK_DGRAM interface is provided here.
6836391Ssklower  *  THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call
6936391Ssklower  *  pffindtype, which gets the first entry that matches the type.
7036391Ssklower  *  sigh.
7136391Ssklower  */
7236391Ssklower { SOCK_DGRAM,	&isodomain,		0,					PR_ATOMIC|PR_ADDR,
7336391Ssklower 	0,			0,				0,					0,
7436391Ssklower 	iso_usrreq,
7536391Ssklower 	0,			0, 				0,					0
7636391Ssklower },
7736391Ssklower 
7836391Ssklower /*
7936391Ssklower  *	A datagram interface for clnp cannot co-exist with TP/CLNP
8036391Ssklower  *  because CLNP has no way to discriminate incoming TP packets from
8136391Ssklower  *  packets coming in for any other higher layer protocol.
8236391Ssklower  *  Old way: set it up so that pffindproto(... dgm, clnp) fails.
8336391Ssklower  *  New way: let pffindproto work (for x.25, thank you) but create
8436391Ssklower  *  	a clnp_usrreq() that returns error on PRU_ATTACH.
8536391Ssklower  */
8636391Ssklower {SOCK_DGRAM,	&isodomain,		ISOPROTO_CLNP,		0,
8736391Ssklower  clnp_usrreq,	clnp_output,	0,					0,
8836391Ssklower  0,
8936391Ssklower  clnp_init,		0,				clnp_slowtimo, 		clnp_drain,
9036391Ssklower },
9136391Ssklower 
9236391Ssklower /* raw clnp */
9336391Ssklower { SOCK_RAW,		&isodomain,		ISOPROTO_RAW,		PR_ATOMIC|PR_ADDR,
9436391Ssklower   rclnp_input,	rclnp_output,	0,					rclnp_ctloutput,
9536391Ssklower   raw_usrreq,
9636391Ssklower   0,			0,				0,					0
9736391Ssklower },
9836391Ssklower 
9936391Ssklower /* ES-IS protocol */
10036391Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_ESIS,		PR_ATOMIC|PR_ADDR,
10136391Ssklower   esis_input,	0,				esis_ctlinput,				0,
10236391Ssklower   esis_usrreq,
10336391Ssklower   esis_init,			0,				0,					0
10436391Ssklower },
10536391Ssklower 
10636391Ssklower /* ISOPROTO_TP */
10736391Ssklower { SOCK_SEQPACKET,	&isodomain,	ISOPROTO_TP,	PR_CONNREQUIRED|PR_WANTRCVD,
10836391Ssklower   tpclnp_input,		0,			tpclnp_ctlinput,	tp_ctloutput,
10936391Ssklower   tp_usrreq,
11036391Ssklower   tp_init,			0,			tp_slowtimo,	tp_drain,
11136391Ssklower },
11236391Ssklower 
11336391Ssklower };
11436391Ssklower 
11536391Ssklower int	iso_init();
11636391Ssklower 
11736391Ssklower struct domain isodomain = {
11836391Ssklower     AF_ISO, 			/* family */
11936391Ssklower 	"iso-domain", 		/* name */
12036391Ssklower 	iso_init,			/* initialize routine */
12136391Ssklower 	0,					/* externalize access rights */
12236391Ssklower 	0,					/* dispose of internalized rights */
12336391Ssklower 	isosw,				/* protosw */
12436391Ssklower 	&isosw[sizeof(isosw)/sizeof(isosw[0])] /* NPROTOSW */
12536391Ssklower };
12636391Ssklower #endif	ISO
127