1*49268Sbostic /*- 2*49268Sbostic * Copyright (c) 1991 The Regents of the University of California. 3*49268Sbostic * All rights reserved. 4*49268Sbostic * 5*49268Sbostic * %sccs.include.redist.c% 6*49268Sbostic * 7*49268Sbostic * @(#)iso_proto.c 7.8 (Berkeley) 05/06/91 8*49268Sbostic */ 9*49268Sbostic 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 4637469Ssklower #include "types.h" 4737469Ssklower #include "param.h" 4837469Ssklower #include "socket.h" 4937469Ssklower #include "protosw.h" 5037469Ssklower #include "domain.h" 5137469Ssklower #include "mbuf.h" 5236391Ssklower 5337469Ssklower #include "iso.h" 5436391Ssklower 5536391Ssklower int clnp_output(), clnp_init(),clnp_slowtimo(),clnp_drain(); 5636391Ssklower int rclnp_input(), rclnp_output(), rclnp_ctloutput(), raw_usrreq(); 5736391Ssklower int clnp_usrreq(); 5836391Ssklower 5936391Ssklower int tp_ctloutput(); 6036391Ssklower int tpclnp_ctlinput(); 6136391Ssklower int tpclnp_input(); 6236391Ssklower int tp_usrreq(); 6348745Ssklower int tp_init(), tp_slowtimo(), tp_drain(); 6448745Ssklower int cons_init(), tpcons_input(); 6536391Ssklower 6636391Ssklower int esis_input(), esis_ctlinput(), esis_init(), esis_usrreq(); 6739935Ssklower int cltp_input(), cltp_ctlinput(), cltp_init(), cltp_usrreq(), cltp_output(); 6843423Ssklower int isis_input(); 6936391Ssklower 7036391Ssklower struct protosw isosw[] = { 7136391Ssklower /* 7236391Ssklower * We need a datagram entry through which net mgmt programs can get 7336391Ssklower * to the iso_control procedure (iso ioctls). Thus, a minimal 7436391Ssklower * SOCK_DGRAM interface is provided here. 7536391Ssklower * THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call 7636391Ssklower * pffindtype, which gets the first entry that matches the type. 7736391Ssklower * sigh. 7836391Ssklower */ 7939935Ssklower { SOCK_DGRAM, &isodomain, ISOPROTO_CLTP, PR_ATOMIC|PR_ADDR, 8039935Ssklower 0, cltp_output, 0, 0, 8139935Ssklower cltp_usrreq, 8239935Ssklower cltp_init, 0, 0, 0 8336391Ssklower }, 8436391Ssklower 8536391Ssklower /* 8636391Ssklower * A datagram interface for clnp cannot co-exist with TP/CLNP 8736391Ssklower * because CLNP has no way to discriminate incoming TP packets from 8836391Ssklower * packets coming in for any other higher layer protocol. 8936391Ssklower * Old way: set it up so that pffindproto(... dgm, clnp) fails. 9036391Ssklower * New way: let pffindproto work (for x.25, thank you) but create 9136391Ssklower * a clnp_usrreq() that returns error on PRU_ATTACH. 9236391Ssklower */ 9336391Ssklower {SOCK_DGRAM, &isodomain, ISOPROTO_CLNP, 0, 9439935Ssklower 0, clnp_output, 0, 0, 9539935Ssklower clnp_usrreq, 9636391Ssklower clnp_init, 0, clnp_slowtimo, clnp_drain, 9736391Ssklower }, 9836391Ssklower 9936391Ssklower /* raw clnp */ 10036391Ssklower { SOCK_RAW, &isodomain, ISOPROTO_RAW, PR_ATOMIC|PR_ADDR, 10136391Ssklower rclnp_input, rclnp_output, 0, rclnp_ctloutput, 10241338Ssklower clnp_usrreq, 10336391Ssklower 0, 0, 0, 0 10436391Ssklower }, 10536391Ssklower 10636391Ssklower /* ES-IS protocol */ 10736391Ssklower { SOCK_DGRAM, &isodomain, ISOPROTO_ESIS, PR_ATOMIC|PR_ADDR, 10848745Ssklower esis_input, 0, esis_ctlinput, 0, 10936391Ssklower esis_usrreq, 11043423Ssklower esis_init, 0, 0, 0 11136391Ssklower }, 11236391Ssklower 11343423Ssklower /* ISOPROTO_INTRAISIS */ 11443423Ssklower { SOCK_DGRAM, &isodomain, ISOPROTO_INTRAISIS, PR_ATOMIC|PR_ADDR, 11543423Ssklower isis_input, 0, 0, 0, 11643423Ssklower esis_usrreq, 11743423Ssklower 0, 0, 0, 0 11843423Ssklower }, 11943423Ssklower 12036391Ssklower /* ISOPROTO_TP */ 12148745Ssklower { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP, PR_CONNREQUIRED|PR_WANTRCVD, 12236391Ssklower tpclnp_input, 0, tpclnp_ctlinput, tp_ctloutput, 12336391Ssklower tp_usrreq, 12448745Ssklower tp_init, 0, tp_slowtimo, tp_drain, 12536391Ssklower }, 12636391Ssklower 12748745Ssklower #ifdef TPCONS 12848745Ssklower /* ISOPROTO_TP */ 12948745Ssklower { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP0, PR_CONNREQUIRED|PR_WANTRCVD, 13048745Ssklower tpcons_input, 0, 0, tp_ctloutput, 13148745Ssklower tp_usrreq, 13248745Ssklower cons_init, 0, 0, 0, 13348745Ssklower }, 13448745Ssklower #endif 13548745Ssklower 13636391Ssklower }; 13736391Ssklower 13836391Ssklower int iso_init(); 13936391Ssklower 14036391Ssklower struct domain isodomain = { 14136391Ssklower AF_ISO, /* family */ 14236391Ssklower "iso-domain", /* name */ 14336391Ssklower iso_init, /* initialize routine */ 14436391Ssklower 0, /* externalize access rights */ 14536391Ssklower 0, /* dispose of internalized rights */ 14636391Ssklower isosw, /* protosw */ 14736391Ssklower &isosw[sizeof(isosw)/sizeof(isosw[0])] /* NPROTOSW */ 14836391Ssklower }; 14936391Ssklower #endif ISO 150