xref: /csrg-svn/sys/netiso/iso_proto.c (revision 43423)
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*43423Ssklower  *	@(#)iso_proto.c	7.6 (Berkeley) 06/22/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();
6239935Ssklower int	cltp_input(), cltp_ctlinput(), cltp_init(), cltp_usrreq(), cltp_output();
63*43423Ssklower int isis_input();
6436391Ssklower 
6536391Ssklower struct protosw isosw[] = {
6636391Ssklower /*
6736391Ssklower  *  We need a datagram entry through which net mgmt programs can get
6836391Ssklower  *	to the iso_control procedure (iso ioctls). Thus, a minimal
6936391Ssklower  *	SOCK_DGRAM interface is provided here.
7036391Ssklower  *  THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call
7136391Ssklower  *  pffindtype, which gets the first entry that matches the type.
7236391Ssklower  *  sigh.
7336391Ssklower  */
7439935Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_CLTP,		PR_ATOMIC|PR_ADDR,
7539935Ssklower 	0,			cltp_output,	0,					0,
7639935Ssklower 	cltp_usrreq,
7739935Ssklower 	cltp_init,	0, 				0,					0
7836391Ssklower },
7936391Ssklower 
8036391Ssklower /*
8136391Ssklower  *	A datagram interface for clnp cannot co-exist with TP/CLNP
8236391Ssklower  *  because CLNP has no way to discriminate incoming TP packets from
8336391Ssklower  *  packets coming in for any other higher layer protocol.
8436391Ssklower  *  Old way: set it up so that pffindproto(... dgm, clnp) fails.
8536391Ssklower  *  New way: let pffindproto work (for x.25, thank you) but create
8636391Ssklower  *  	a clnp_usrreq() that returns error on PRU_ATTACH.
8736391Ssklower  */
8836391Ssklower {SOCK_DGRAM,	&isodomain,		ISOPROTO_CLNP,		0,
8939935Ssklower  0,				clnp_output,	0,					0,
9039935Ssklower  clnp_usrreq,
9136391Ssklower  clnp_init,		0,				clnp_slowtimo, 		clnp_drain,
9236391Ssklower },
9336391Ssklower 
9436391Ssklower /* raw clnp */
9536391Ssklower { SOCK_RAW,		&isodomain,		ISOPROTO_RAW,		PR_ATOMIC|PR_ADDR,
9636391Ssklower   rclnp_input,	rclnp_output,	0,					rclnp_ctloutput,
9741338Ssklower   clnp_usrreq,
9836391Ssklower   0,			0,				0,					0
9936391Ssklower },
10036391Ssklower 
10136391Ssklower /* ES-IS protocol */
10236391Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_ESIS,		PR_ATOMIC|PR_ADDR,
10336391Ssklower   esis_input,	0,				esis_ctlinput,				0,
10436391Ssklower   esis_usrreq,
105*43423Ssklower   esis_init,	0,				0,					0
10636391Ssklower },
10736391Ssklower 
108*43423Ssklower /* ISOPROTO_INTRAISIS */
109*43423Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_INTRAISIS,	PR_ATOMIC|PR_ADDR,
110*43423Ssklower   isis_input,	0,				0,					0,
111*43423Ssklower   esis_usrreq,
112*43423Ssklower   0,			0,				0,					0
113*43423Ssklower },
114*43423Ssklower 
11536391Ssklower /* ISOPROTO_TP */
11636391Ssklower { SOCK_SEQPACKET,	&isodomain,	ISOPROTO_TP,	PR_CONNREQUIRED|PR_WANTRCVD,
11736391Ssklower   tpclnp_input,		0,			tpclnp_ctlinput,	tp_ctloutput,
11836391Ssklower   tp_usrreq,
11936391Ssklower   tp_init,			0,			tp_slowtimo,	tp_drain,
12036391Ssklower },
12136391Ssklower 
12236391Ssklower };
12336391Ssklower 
12436391Ssklower int	iso_init();
12536391Ssklower 
12636391Ssklower struct domain isodomain = {
12736391Ssklower     AF_ISO, 			/* family */
12836391Ssklower 	"iso-domain", 		/* name */
12936391Ssklower 	iso_init,			/* initialize routine */
13036391Ssklower 	0,					/* externalize access rights */
13136391Ssklower 	0,					/* dispose of internalized rights */
13236391Ssklower 	isosw,				/* protosw */
13336391Ssklower 	&isosw[sizeof(isosw)/sizeof(isosw[0])] /* NPROTOSW */
13436391Ssklower };
13536391Ssklower #endif	ISO
136