149268Sbostic /*- 2*63222Sbostic * Copyright (c) 1991, 1993 3*63222Sbostic * The Regents of the University of California. All rights reserved. 449268Sbostic * 549268Sbostic * %sccs.include.redist.c% 649268Sbostic * 7*63222Sbostic * @(#)iso_proto.c 8.1 (Berkeley) 06/10/93 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 5636391Ssklower int clnp_output(), clnp_init(),clnp_slowtimo(),clnp_drain(); 5736391Ssklower int rclnp_input(), rclnp_output(), rclnp_ctloutput(), raw_usrreq(); 5836391Ssklower int clnp_usrreq(); 5936391Ssklower 6056914Ssklower int tp_ctloutput(), tpclnp_ctlinput(), tpclnp_input(), tp_usrreq(); 6151024Ssklower int tp_init(), tp_fasttimo(), tp_slowtimo(), tp_drain(); 6248745Ssklower int cons_init(), tpcons_input(); 6336391Ssklower 6456914Ssklower int isis_input(); 6536391Ssklower int esis_input(), esis_ctlinput(), esis_init(), esis_usrreq(); 6656914Ssklower int idrp_input(), idrp_init(), idrp_usrreq(); 6739935Ssklower int cltp_input(), cltp_ctlinput(), cltp_init(), cltp_usrreq(), cltp_output(); 6836391Ssklower 6956914Ssklower #ifdef TUBA 7056914Ssklower int tuba_usrreq(), tuba_ctloutput(), tuba_init(), tuba_tcpinput(); 7156914Ssklower int tuba_slowtimo(), tuba_fasttimo(); 7256914Ssklower #endif 7356914Ssklower 7436391Ssklower struct protosw isosw[] = { 7536391Ssklower /* 7636391Ssklower * We need a datagram entry through which net mgmt programs can get 7736391Ssklower * to the iso_control procedure (iso ioctls). Thus, a minimal 7836391Ssklower * SOCK_DGRAM interface is provided here. 7936391Ssklower * THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call 8036391Ssklower * pffindtype, which gets the first entry that matches the type. 8136391Ssklower * sigh. 8236391Ssklower */ 8339935Ssklower { SOCK_DGRAM, &isodomain, ISOPROTO_CLTP, PR_ATOMIC|PR_ADDR, 8439935Ssklower 0, cltp_output, 0, 0, 8539935Ssklower cltp_usrreq, 8639935Ssklower cltp_init, 0, 0, 0 8736391Ssklower }, 8836391Ssklower 8936391Ssklower /* 9036391Ssklower * A datagram interface for clnp cannot co-exist with TP/CLNP 9136391Ssklower * because CLNP has no way to discriminate incoming TP packets from 9236391Ssklower * packets coming in for any other higher layer protocol. 9336391Ssklower * Old way: set it up so that pffindproto(... dgm, clnp) fails. 9436391Ssklower * New way: let pffindproto work (for x.25, thank you) but create 9536391Ssklower * a clnp_usrreq() that returns error on PRU_ATTACH. 9636391Ssklower */ 9736391Ssklower {SOCK_DGRAM, &isodomain, ISOPROTO_CLNP, 0, 9839935Ssklower 0, clnp_output, 0, 0, 9939935Ssklower clnp_usrreq, 10036391Ssklower clnp_init, 0, clnp_slowtimo, clnp_drain, 10136391Ssklower }, 10236391Ssklower 10336391Ssklower /* raw clnp */ 10436391Ssklower { SOCK_RAW, &isodomain, ISOPROTO_RAW, PR_ATOMIC|PR_ADDR, 10536391Ssklower rclnp_input, rclnp_output, 0, rclnp_ctloutput, 10641338Ssklower clnp_usrreq, 10736391Ssklower 0, 0, 0, 0 10836391Ssklower }, 10936391Ssklower 11036391Ssklower /* ES-IS protocol */ 11136391Ssklower { SOCK_DGRAM, &isodomain, ISOPROTO_ESIS, PR_ATOMIC|PR_ADDR, 11248745Ssklower esis_input, 0, esis_ctlinput, 0, 11336391Ssklower esis_usrreq, 11443423Ssklower esis_init, 0, 0, 0 11536391Ssklower }, 11636391Ssklower 11743423Ssklower /* ISOPROTO_INTRAISIS */ 11843423Ssklower { SOCK_DGRAM, &isodomain, ISOPROTO_INTRAISIS, PR_ATOMIC|PR_ADDR, 11943423Ssklower isis_input, 0, 0, 0, 12043423Ssklower esis_usrreq, 12143423Ssklower 0, 0, 0, 0 12243423Ssklower }, 12343423Ssklower 12456914Ssklower /* ISOPROTO_IDRP */ 12556914Ssklower { SOCK_DGRAM, &isodomain, ISOPROTO_IDRP, PR_ATOMIC|PR_ADDR, 12656914Ssklower idrp_input, 0, 0, 0, 12756914Ssklower idrp_usrreq, 12856914Ssklower idrp_init, 0, 0, 0 12956914Ssklower }, 13056914Ssklower 13136391Ssklower /* ISOPROTO_TP */ 13248745Ssklower { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP, PR_CONNREQUIRED|PR_WANTRCVD, 13356914Ssklower tpclnp_input, 0, tpclnp_ctlinput, tp_ctloutput, 13436391Ssklower tp_usrreq, 13556914Ssklower tp_init, tp_fasttimo, tp_slowtimo, tp_drain, 13636391Ssklower }, 13736391Ssklower 13856914Ssklower #ifdef TUBA 13956914Ssklower { SOCK_STREAM, &isodomain, ISOPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD, 14056914Ssklower tuba_tcpinput, 0, 0, tuba_ctloutput, 14156914Ssklower tuba_usrreq, 14256914Ssklower tuba_init, tuba_fasttimo, tuba_fasttimo, 0 14356914Ssklower }, 14456914Ssklower #endif 14556914Ssklower 14648745Ssklower #ifdef TPCONS 14748745Ssklower /* ISOPROTO_TP */ 14848745Ssklower { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP0, PR_CONNREQUIRED|PR_WANTRCVD, 14948745Ssklower tpcons_input, 0, 0, tp_ctloutput, 15048745Ssklower tp_usrreq, 15148745Ssklower cons_init, 0, 0, 0, 15248745Ssklower }, 15348745Ssklower #endif 15448745Ssklower 15536391Ssklower }; 15636391Ssklower 15736391Ssklower 15836391Ssklower struct domain isodomain = { 15936391Ssklower AF_ISO, /* family */ 16036391Ssklower "iso-domain", /* name */ 16154823Ssklower 0, /* initialize routine */ 16236391Ssklower 0, /* externalize access rights */ 16336391Ssklower 0, /* dispose of internalized rights */ 16436391Ssklower isosw, /* protosw */ 16554823Ssklower &isosw[sizeof(isosw)/sizeof(isosw[0])], /* NPROTOSW */ 16654823Ssklower 0, /* next */ 16754823Ssklower rn_inithead, /* rtattach */ 16854823Ssklower 48, /* rtoffset */ 16954823Ssklower sizeof(struct sockaddr_iso) /* maxkeylen */ 17036391Ssklower }; 17161305Ssklower #endif /* ISO */ 172