xref: /csrg-svn/sys/netiso/iso_proto.c (revision 68260)
149268Sbostic /*-
263222Sbostic  * Copyright (c) 1991, 1993
363222Sbostic  *	The Regents of the University of California.  All rights reserved.
449268Sbostic  *
549268Sbostic  * %sccs.include.redist.c%
649268Sbostic  *
7*68260Scgd  *	@(#)iso_proto.c	8.2 (Berkeley) 02/09/95
849268Sbostic  */
949268Sbostic 
1036391Ssklower /***********************************************************
1136391Ssklower 		Copyright IBM Corporation 1987
1236391Ssklower 
1336391Ssklower                       All Rights Reserved
1436391Ssklower 
1536391Ssklower Permission to use, copy, modify, and distribute this software and its
1636391Ssklower documentation for any purpose and without fee is hereby granted,
1736391Ssklower provided that the above copyright notice appear in all copies and that
1836391Ssklower both that copyright notice and this permission notice appear in
1936391Ssklower supporting documentation, and that the name of IBM not be
2036391Ssklower used in advertising or publicity pertaining to distribution of the
2136391Ssklower software without specific, written prior permission.
2236391Ssklower 
2336391Ssklower IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
2436391Ssklower ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
2536391Ssklower IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
2636391Ssklower ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
2736391Ssklower WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
2836391Ssklower ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
2936391Ssklower SOFTWARE.
3036391Ssklower 
3136391Ssklower ******************************************************************/
3236391Ssklower 
3336391Ssklower /*
3436391Ssklower  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
3536391Ssklower  */
3636391Ssklower /* $Header: iso_proto.c,v 4.4 88/09/08 08:38:42 hagens Exp $
3736391Ssklower  * $Source: /usr/argo/sys/netiso/RCS/iso_proto.c,v $
3836391Ssklower  *
3936391Ssklower  * iso_proto.c : protocol switch tables in the ISO domain
4036391Ssklower  *
4136391Ssklower  * ISO protocol family includes TP, CLTP, CLNP, 8208
4236391Ssklower  * TP and CLNP are implemented here.
4336391Ssklower  */
4436391Ssklower 
4536391Ssklower #ifdef	ISO
4656533Sbostic #include <sys/param.h>
4756533Sbostic #include <sys/socket.h>
4856533Sbostic #include <sys/protosw.h>
4956533Sbostic #include <sys/domain.h>
5056533Sbostic #include <sys/mbuf.h>
5136391Ssklower 
5256533Sbostic #include <net/radix.h>
5336391Ssklower 
5456533Sbostic #include <netiso/iso.h>
5556533Sbostic 
56*68260Scgd void	clnp_init(),clnp_slowtimo(),clnp_drain();
57*68260Scgd int	clnp_output();
58*68260Scgd void	rclnp_input();
59*68260Scgd int	rclnp_output(), rclnp_ctloutput(), raw_usrreq();
6036391Ssklower int	clnp_usrreq();
6136391Ssklower 
62*68260Scgd int	tp_ctloutput(), tp_usrreq();
63*68260Scgd void	tp_init(), tp_fasttimo(), tp_slowtimo(), tp_drain();
64*68260Scgd void	tpclnp_ctlinput(), tpclnp_input();
65*68260Scgd void	cons_init(), tpcons_input();
6636391Ssklower 
67*68260Scgd void	isis_input();
68*68260Scgd void	esis_init(), esis_input(), esis_ctlinput();
69*68260Scgd int	esis_usrreq();
70*68260Scgd void	idrp_init(), idrp_input();
71*68260Scgd int	idrp_usrreq();
72*68260Scgd void	cltp_init(), cltp_input(), cltp_ctlinput();
73*68260Scgd int	cltp_usrreq(), cltp_output();
7436391Ssklower 
7556914Ssklower #ifdef TUBA
76*68260Scgd int	tuba_usrreq(), tuba_ctloutput();
77*68260Scgd void	tuba_init(), tuba_slowtimo(), tuba_fasttimo(), tuba_tcpinput();
7856914Ssklower #endif
7956914Ssklower 
8036391Ssklower struct protosw isosw[] = {
8136391Ssklower /*
8236391Ssklower  *  We need a datagram entry through which net mgmt programs can get
8336391Ssklower  *	to the iso_control procedure (iso ioctls). Thus, a minimal
8436391Ssklower  *	SOCK_DGRAM interface is provided here.
8536391Ssklower  *  THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call
8636391Ssklower  *  pffindtype, which gets the first entry that matches the type.
8736391Ssklower  *  sigh.
8836391Ssklower  */
8939935Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_CLTP,		PR_ATOMIC|PR_ADDR,
9039935Ssklower 	0,			cltp_output,	0,					0,
9139935Ssklower 	cltp_usrreq,
9239935Ssklower 	cltp_init,	0, 				0,					0
9336391Ssklower },
9436391Ssklower 
9536391Ssklower /*
9636391Ssklower  *	A datagram interface for clnp cannot co-exist with TP/CLNP
9736391Ssklower  *  because CLNP has no way to discriminate incoming TP packets from
9836391Ssklower  *  packets coming in for any other higher layer protocol.
9936391Ssklower  *  Old way: set it up so that pffindproto(... dgm, clnp) fails.
10036391Ssklower  *  New way: let pffindproto work (for x.25, thank you) but create
10136391Ssklower  *  	a clnp_usrreq() that returns error on PRU_ATTACH.
10236391Ssklower  */
10336391Ssklower {SOCK_DGRAM,	&isodomain,		ISOPROTO_CLNP,		0,
10439935Ssklower  0,				clnp_output,	0,					0,
10539935Ssklower  clnp_usrreq,
10636391Ssklower  clnp_init,		0,				clnp_slowtimo, 		clnp_drain,
10736391Ssklower },
10836391Ssklower 
10936391Ssklower /* raw clnp */
11036391Ssklower { SOCK_RAW,		&isodomain,		ISOPROTO_RAW,		PR_ATOMIC|PR_ADDR,
11136391Ssklower   rclnp_input,	rclnp_output,	0,					rclnp_ctloutput,
11241338Ssklower   clnp_usrreq,
11336391Ssklower   0,			0,				0,					0
11436391Ssklower },
11536391Ssklower 
11636391Ssklower /* ES-IS protocol */
11736391Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_ESIS,		PR_ATOMIC|PR_ADDR,
11848745Ssklower   esis_input,	0,				esis_ctlinput,		0,
11936391Ssklower   esis_usrreq,
12043423Ssklower   esis_init,	0,				0,					0
12136391Ssklower },
12236391Ssklower 
12343423Ssklower /* ISOPROTO_INTRAISIS */
12443423Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_INTRAISIS,	PR_ATOMIC|PR_ADDR,
12543423Ssklower   isis_input,	0,				0,					0,
12643423Ssklower   esis_usrreq,
12743423Ssklower   0,			0,				0,					0
12843423Ssklower },
12943423Ssklower 
13056914Ssklower /* ISOPROTO_IDRP */
13156914Ssklower { SOCK_DGRAM,	&isodomain,		ISOPROTO_IDRP,		PR_ATOMIC|PR_ADDR,
13256914Ssklower   idrp_input,	0,				0,					0,
13356914Ssklower   idrp_usrreq,
13456914Ssklower   idrp_init,	0,				0,					0
13556914Ssklower },
13656914Ssklower 
13736391Ssklower /* ISOPROTO_TP */
13848745Ssklower { SOCK_SEQPACKET,	&isodomain,	ISOPROTO_TP,		PR_CONNREQUIRED|PR_WANTRCVD,
13956914Ssklower   tpclnp_input,	0,				tpclnp_ctlinput,	tp_ctloutput,
14036391Ssklower   tp_usrreq,
14156914Ssklower   tp_init,		tp_fasttimo,	tp_slowtimo,		tp_drain,
14236391Ssklower },
14336391Ssklower 
14456914Ssklower #ifdef TUBA
14556914Ssklower { SOCK_STREAM,	&isodomain,		ISOPROTO_TCP,		PR_CONNREQUIRED|PR_WANTRCVD,
14656914Ssklower   tuba_tcpinput,	0,			0,					tuba_ctloutput,
14756914Ssklower   tuba_usrreq,
14856914Ssklower   tuba_init,	tuba_fasttimo,	tuba_fasttimo,		0
14956914Ssklower },
15056914Ssklower #endif
15156914Ssklower 
15248745Ssklower #ifdef TPCONS
15348745Ssklower /* ISOPROTO_TP */
15448745Ssklower { SOCK_SEQPACKET,	&isodomain,	ISOPROTO_TP0,		PR_CONNREQUIRED|PR_WANTRCVD,
15548745Ssklower   tpcons_input,		0,			0,					tp_ctloutput,
15648745Ssklower   tp_usrreq,
15748745Ssklower   cons_init,		0,			0,					0,
15848745Ssklower },
15948745Ssklower #endif
16048745Ssklower 
16136391Ssklower };
16236391Ssklower 
16336391Ssklower 
16436391Ssklower struct domain isodomain = {
16536391Ssklower     AF_ISO, 			/* family */
16636391Ssklower 	"iso-domain", 		/* name */
16754823Ssklower 	0,					/* initialize routine */
16836391Ssklower 	0,					/* externalize access rights */
16936391Ssklower 	0,					/* dispose of internalized rights */
17036391Ssklower 	isosw,				/* protosw */
17154823Ssklower 	&isosw[sizeof(isosw)/sizeof(isosw[0])], /* NPROTOSW */
17254823Ssklower 	0,					/* next */
17354823Ssklower 	rn_inithead,		/* rtattach */
17454823Ssklower 	48,					/* rtoffset */
17554823Ssklower 	sizeof(struct sockaddr_iso) /* maxkeylen */
17636391Ssklower };
17761305Ssklower #endif	/* ISO */
178