xref: /csrg-svn/sys/netiso/iso_proto.c (revision 39935)
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 $
29*39935Ssklower  *	@(#)iso_proto.c	7.4 (Berkeley) 01/17/90 *
3036391Ssklower  *
3136391Ssklower  * iso_proto.c : protocol switch tables in the ISO domain
3236391Ssklower  *
3336391Ssklower  * ISO protocol family includes TP, CLTP, CLNP, 8208
3436391Ssklower  * TP and CLNP are implemented here.
3536391Ssklower  */
3636391Ssklower 
3736391Ssklower #ifndef lint
3836391Ssklower static char *rcsid = "$Header: iso_proto.c,v 4.4 88/09/08 08:38:42 hagens Exp $";
3936391Ssklower #endif
4036391Ssklower 
4136391Ssklower #ifdef	ISO
4237469Ssklower #include "types.h"
4337469Ssklower #include "param.h"
4437469Ssklower #include "socket.h"
4537469Ssklower #include "protosw.h"
4637469Ssklower #include "domain.h"
4737469Ssklower #include "mbuf.h"
4836391Ssklower 
4937469Ssklower #include "iso.h"
5036391Ssklower 
5136391Ssklower int clnp_output(), clnp_init(),clnp_slowtimo(),clnp_drain();
5236391Ssklower int rclnp_input(), rclnp_output(), rclnp_ctloutput(), raw_usrreq();
5336391Ssklower int	clnp_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();
62*39935Ssklower int	cltp_input(), cltp_ctlinput(), cltp_init(), cltp_usrreq(), cltp_output();
6336391Ssklower 
6436391Ssklower struct protosw isosw[] = {
6536391Ssklower /*
6636391Ssklower  *  We need a datagram entry through which net mgmt programs can get
6736391Ssklower  *	to the iso_control procedure (iso ioctls). Thus, a minimal
6836391Ssklower  *	SOCK_DGRAM interface is provided here.
6936391Ssklower  *  THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call
7036391Ssklower  *  pffindtype, which gets the first entry that matches the type.
7136391Ssklower  *  sigh.
7236391Ssklower  */
73*39935Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_CLTP,		PR_ATOMIC|PR_ADDR,
74*39935Ssklower 	0,			cltp_output,	0,					0,
75*39935Ssklower 	cltp_usrreq,
76*39935Ssklower 	cltp_init,	0, 				0,					0
7736391Ssklower },
7836391Ssklower 
7936391Ssklower /*
8036391Ssklower  *	A datagram interface for clnp cannot co-exist with TP/CLNP
8136391Ssklower  *  because CLNP has no way to discriminate incoming TP packets from
8236391Ssklower  *  packets coming in for any other higher layer protocol.
8336391Ssklower  *  Old way: set it up so that pffindproto(... dgm, clnp) fails.
8436391Ssklower  *  New way: let pffindproto work (for x.25, thank you) but create
8536391Ssklower  *  	a clnp_usrreq() that returns error on PRU_ATTACH.
8636391Ssklower  */
8736391Ssklower {SOCK_DGRAM,	&isodomain,		ISOPROTO_CLNP,		0,
88*39935Ssklower  0,				clnp_output,	0,					0,
89*39935Ssklower  clnp_usrreq,
9036391Ssklower  clnp_init,		0,				clnp_slowtimo, 		clnp_drain,
9136391Ssklower },
9236391Ssklower 
9336391Ssklower /* raw clnp */
9436391Ssklower { SOCK_RAW,		&isodomain,		ISOPROTO_RAW,		PR_ATOMIC|PR_ADDR,
9536391Ssklower   rclnp_input,	rclnp_output,	0,					rclnp_ctloutput,
9636391Ssklower   raw_usrreq,
9736391Ssklower   0,			0,				0,					0
9836391Ssklower },
9936391Ssklower 
10036391Ssklower /* ES-IS protocol */
10136391Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_ESIS,		PR_ATOMIC|PR_ADDR,
10236391Ssklower   esis_input,	0,				esis_ctlinput,				0,
10336391Ssklower   esis_usrreq,
10436391Ssklower   esis_init,			0,				0,					0
10536391Ssklower },
10636391Ssklower 
10736391Ssklower /* ISOPROTO_TP */
10836391Ssklower { SOCK_SEQPACKET,	&isodomain,	ISOPROTO_TP,	PR_CONNREQUIRED|PR_WANTRCVD,
10936391Ssklower   tpclnp_input,		0,			tpclnp_ctlinput,	tp_ctloutput,
11036391Ssklower   tp_usrreq,
11136391Ssklower   tp_init,			0,			tp_slowtimo,	tp_drain,
11236391Ssklower },
11336391Ssklower 
11436391Ssklower };
11536391Ssklower 
11636391Ssklower int	iso_init();
11736391Ssklower 
11836391Ssklower struct domain isodomain = {
11936391Ssklower     AF_ISO, 			/* family */
12036391Ssklower 	"iso-domain", 		/* name */
12136391Ssklower 	iso_init,			/* initialize routine */
12236391Ssklower 	0,					/* externalize access rights */
12336391Ssklower 	0,					/* dispose of internalized rights */
12436391Ssklower 	isosw,				/* protosw */
12536391Ssklower 	&isosw[sizeof(isosw)/sizeof(isosw[0])] /* NPROTOSW */
12636391Ssklower };
12736391Ssklower #endif	ISO
128