xref: /csrg-svn/sys/netiso/iso_proto.c (revision 48745)
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*48745Ssklower  *	@(#)iso_proto.c	7.7 (Berkeley) 04/26/91 *
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();
59*48745Ssklower int	tp_init(), tp_slowtimo(), tp_drain();
60*48745Ssklower int	cons_init(), tpcons_input();
6136391Ssklower 
6236391Ssklower int	esis_input(), esis_ctlinput(), esis_init(), esis_usrreq();
6339935Ssklower int	cltp_input(), cltp_ctlinput(), cltp_init(), cltp_usrreq(), cltp_output();
6443423Ssklower int isis_input();
6536391Ssklower 
6636391Ssklower struct protosw isosw[] = {
6736391Ssklower /*
6836391Ssklower  *  We need a datagram entry through which net mgmt programs can get
6936391Ssklower  *	to the iso_control procedure (iso ioctls). Thus, a minimal
7036391Ssklower  *	SOCK_DGRAM interface is provided here.
7136391Ssklower  *  THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call
7236391Ssklower  *  pffindtype, which gets the first entry that matches the type.
7336391Ssklower  *  sigh.
7436391Ssklower  */
7539935Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_CLTP,		PR_ATOMIC|PR_ADDR,
7639935Ssklower 	0,			cltp_output,	0,					0,
7739935Ssklower 	cltp_usrreq,
7839935Ssklower 	cltp_init,	0, 				0,					0
7936391Ssklower },
8036391Ssklower 
8136391Ssklower /*
8236391Ssklower  *	A datagram interface for clnp cannot co-exist with TP/CLNP
8336391Ssklower  *  because CLNP has no way to discriminate incoming TP packets from
8436391Ssklower  *  packets coming in for any other higher layer protocol.
8536391Ssklower  *  Old way: set it up so that pffindproto(... dgm, clnp) fails.
8636391Ssklower  *  New way: let pffindproto work (for x.25, thank you) but create
8736391Ssklower  *  	a clnp_usrreq() that returns error on PRU_ATTACH.
8836391Ssklower  */
8936391Ssklower {SOCK_DGRAM,	&isodomain,		ISOPROTO_CLNP,		0,
9039935Ssklower  0,				clnp_output,	0,					0,
9139935Ssklower  clnp_usrreq,
9236391Ssklower  clnp_init,		0,				clnp_slowtimo, 		clnp_drain,
9336391Ssklower },
9436391Ssklower 
9536391Ssklower /* raw clnp */
9636391Ssklower { SOCK_RAW,		&isodomain,		ISOPROTO_RAW,		PR_ATOMIC|PR_ADDR,
9736391Ssklower   rclnp_input,	rclnp_output,	0,					rclnp_ctloutput,
9841338Ssklower   clnp_usrreq,
9936391Ssklower   0,			0,				0,					0
10036391Ssklower },
10136391Ssklower 
10236391Ssklower /* ES-IS protocol */
10336391Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_ESIS,		PR_ATOMIC|PR_ADDR,
104*48745Ssklower   esis_input,	0,				esis_ctlinput,		0,
10536391Ssklower   esis_usrreq,
10643423Ssklower   esis_init,	0,				0,					0
10736391Ssklower },
10836391Ssklower 
10943423Ssklower /* ISOPROTO_INTRAISIS */
11043423Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_INTRAISIS,	PR_ATOMIC|PR_ADDR,
11143423Ssklower   isis_input,	0,				0,					0,
11243423Ssklower   esis_usrreq,
11343423Ssklower   0,			0,				0,					0
11443423Ssklower },
11543423Ssklower 
11636391Ssklower /* ISOPROTO_TP */
117*48745Ssklower { SOCK_SEQPACKET,	&isodomain,	ISOPROTO_TP,		PR_CONNREQUIRED|PR_WANTRCVD,
11836391Ssklower   tpclnp_input,		0,			tpclnp_ctlinput,	tp_ctloutput,
11936391Ssklower   tp_usrreq,
120*48745Ssklower   tp_init,			0,			tp_slowtimo,		tp_drain,
12136391Ssklower },
12236391Ssklower 
123*48745Ssklower #ifdef TPCONS
124*48745Ssklower /* ISOPROTO_TP */
125*48745Ssklower { SOCK_SEQPACKET,	&isodomain,	ISOPROTO_TP0,		PR_CONNREQUIRED|PR_WANTRCVD,
126*48745Ssklower   tpcons_input,		0,			0,					tp_ctloutput,
127*48745Ssklower   tp_usrreq,
128*48745Ssklower   cons_init,		0,			0,					0,
129*48745Ssklower },
130*48745Ssklower #endif
131*48745Ssklower 
13236391Ssklower };
13336391Ssklower 
13436391Ssklower int	iso_init();
13536391Ssklower 
13636391Ssklower struct domain isodomain = {
13736391Ssklower     AF_ISO, 			/* family */
13836391Ssklower 	"iso-domain", 		/* name */
13936391Ssklower 	iso_init,			/* initialize routine */
14036391Ssklower 	0,					/* externalize access rights */
14136391Ssklower 	0,					/* dispose of internalized rights */
14236391Ssklower 	isosw,				/* protosw */
14336391Ssklower 	&isosw[sizeof(isosw)/sizeof(isosw[0])] /* NPROTOSW */
14436391Ssklower };
14536391Ssklower #endif	ISO
146