149268Sbostic /*- 249268Sbostic * Copyright (c) 1991 The Regents of the University of California. 349268Sbostic * All rights reserved. 449268Sbostic * 549268Sbostic * %sccs.include.redist.c% 649268Sbostic * 7*56533Sbostic * @(#)iso_proto.c 7.11 (Berkeley) 10/11/92 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 46*56533Sbostic #include <sys/param.h> 47*56533Sbostic #include <sys/socket.h> 48*56533Sbostic #include <sys/protosw.h> 49*56533Sbostic #include <sys/domain.h> 50*56533Sbostic #include <sys/mbuf.h> 5136391Ssklower 52*56533Sbostic #include <net/radix.h> 5336391Ssklower 54*56533Sbostic #include <netiso/iso.h> 55*56533Sbostic 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 6036391Ssklower int tp_ctloutput(); 6136391Ssklower int tpclnp_ctlinput(); 6236391Ssklower int tpclnp_input(); 6336391Ssklower int tp_usrreq(); 6451024Ssklower int tp_init(), tp_fasttimo(), tp_slowtimo(), tp_drain(); 6548745Ssklower int cons_init(), tpcons_input(); 6636391Ssklower 6736391Ssklower int esis_input(), esis_ctlinput(), esis_init(), esis_usrreq(); 6839935Ssklower int cltp_input(), cltp_ctlinput(), cltp_init(), cltp_usrreq(), cltp_output(); 6943423Ssklower int isis_input(); 7036391Ssklower 7136391Ssklower struct protosw isosw[] = { 7236391Ssklower /* 7336391Ssklower * We need a datagram entry through which net mgmt programs can get 7436391Ssklower * to the iso_control procedure (iso ioctls). Thus, a minimal 7536391Ssklower * SOCK_DGRAM interface is provided here. 7636391Ssklower * THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call 7736391Ssklower * pffindtype, which gets the first entry that matches the type. 7836391Ssklower * sigh. 7936391Ssklower */ 8039935Ssklower { SOCK_DGRAM, &isodomain, ISOPROTO_CLTP, PR_ATOMIC|PR_ADDR, 8139935Ssklower 0, cltp_output, 0, 0, 8239935Ssklower cltp_usrreq, 8339935Ssklower cltp_init, 0, 0, 0 8436391Ssklower }, 8536391Ssklower 8636391Ssklower /* 8736391Ssklower * A datagram interface for clnp cannot co-exist with TP/CLNP 8836391Ssklower * because CLNP has no way to discriminate incoming TP packets from 8936391Ssklower * packets coming in for any other higher layer protocol. 9036391Ssklower * Old way: set it up so that pffindproto(... dgm, clnp) fails. 9136391Ssklower * New way: let pffindproto work (for x.25, thank you) but create 9236391Ssklower * a clnp_usrreq() that returns error on PRU_ATTACH. 9336391Ssklower */ 9436391Ssklower {SOCK_DGRAM, &isodomain, ISOPROTO_CLNP, 0, 9539935Ssklower 0, clnp_output, 0, 0, 9639935Ssklower clnp_usrreq, 9736391Ssklower clnp_init, 0, clnp_slowtimo, clnp_drain, 9836391Ssklower }, 9936391Ssklower 10036391Ssklower /* raw clnp */ 10136391Ssklower { SOCK_RAW, &isodomain, ISOPROTO_RAW, PR_ATOMIC|PR_ADDR, 10236391Ssklower rclnp_input, rclnp_output, 0, rclnp_ctloutput, 10341338Ssklower clnp_usrreq, 10436391Ssklower 0, 0, 0, 0 10536391Ssklower }, 10636391Ssklower 10736391Ssklower /* ES-IS protocol */ 10836391Ssklower { SOCK_DGRAM, &isodomain, ISOPROTO_ESIS, PR_ATOMIC|PR_ADDR, 10948745Ssklower esis_input, 0, esis_ctlinput, 0, 11036391Ssklower esis_usrreq, 11143423Ssklower esis_init, 0, 0, 0 11236391Ssklower }, 11336391Ssklower 11443423Ssklower /* ISOPROTO_INTRAISIS */ 11543423Ssklower { SOCK_DGRAM, &isodomain, ISOPROTO_INTRAISIS, PR_ATOMIC|PR_ADDR, 11643423Ssklower isis_input, 0, 0, 0, 11743423Ssklower esis_usrreq, 11843423Ssklower 0, 0, 0, 0 11943423Ssklower }, 12043423Ssklower 12136391Ssklower /* ISOPROTO_TP */ 12248745Ssklower { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP, PR_CONNREQUIRED|PR_WANTRCVD, 12336391Ssklower tpclnp_input, 0, tpclnp_ctlinput, tp_ctloutput, 12436391Ssklower tp_usrreq, 12551024Ssklower tp_init, tp_fasttimo, tp_slowtimo, tp_drain, 12636391Ssklower }, 12736391Ssklower 12848745Ssklower #ifdef TPCONS 12948745Ssklower /* ISOPROTO_TP */ 13048745Ssklower { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP0, PR_CONNREQUIRED|PR_WANTRCVD, 13148745Ssklower tpcons_input, 0, 0, tp_ctloutput, 13248745Ssklower tp_usrreq, 13348745Ssklower cons_init, 0, 0, 0, 13448745Ssklower }, 13548745Ssklower #endif 13648745Ssklower 13736391Ssklower }; 13836391Ssklower 13936391Ssklower 14036391Ssklower struct domain isodomain = { 14136391Ssklower AF_ISO, /* family */ 14236391Ssklower "iso-domain", /* name */ 14354823Ssklower 0, /* initialize routine */ 14436391Ssklower 0, /* externalize access rights */ 14536391Ssklower 0, /* dispose of internalized rights */ 14636391Ssklower isosw, /* protosw */ 14754823Ssklower &isosw[sizeof(isosw)/sizeof(isosw[0])], /* NPROTOSW */ 14854823Ssklower 0, /* next */ 14954823Ssklower rn_inithead, /* rtattach */ 15054823Ssklower 48, /* rtoffset */ 15154823Ssklower sizeof(struct sockaddr_iso) /* maxkeylen */ 15236391Ssklower }; 15336391Ssklower #endif ISO 154