1 /*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)iso_proto.c 7.9 (Berkeley) 09/06/91 8 */ 9 10 /*********************************************************** 11 Copyright IBM Corporation 1987 12 13 All Rights Reserved 14 15 Permission to use, copy, modify, and distribute this software and its 16 documentation for any purpose and without fee is hereby granted, 17 provided that the above copyright notice appear in all copies and that 18 both that copyright notice and this permission notice appear in 19 supporting documentation, and that the name of IBM not be 20 used in advertising or publicity pertaining to distribution of the 21 software without specific, written prior permission. 22 23 IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 24 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 25 IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 26 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 27 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 28 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 29 SOFTWARE. 30 31 ******************************************************************/ 32 33 /* 34 * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison 35 */ 36 /* $Header: iso_proto.c,v 4.4 88/09/08 08:38:42 hagens Exp $ 37 * $Source: /usr/argo/sys/netiso/RCS/iso_proto.c,v $ 38 * 39 * iso_proto.c : protocol switch tables in the ISO domain 40 * 41 * ISO protocol family includes TP, CLTP, CLNP, 8208 42 * TP and CLNP are implemented here. 43 */ 44 45 #ifdef ISO 46 #include "types.h" 47 #include "param.h" 48 #include "socket.h" 49 #include "protosw.h" 50 #include "domain.h" 51 #include "mbuf.h" 52 53 #include "iso.h" 54 55 int clnp_output(), clnp_init(),clnp_slowtimo(),clnp_drain(); 56 int rclnp_input(), rclnp_output(), rclnp_ctloutput(), raw_usrreq(); 57 int clnp_usrreq(); 58 59 int tp_ctloutput(); 60 int tpclnp_ctlinput(); 61 int tpclnp_input(); 62 int tp_usrreq(); 63 int tp_init(), tp_fasttimo(), tp_slowtimo(), tp_drain(); 64 int cons_init(), tpcons_input(); 65 66 int esis_input(), esis_ctlinput(), esis_init(), esis_usrreq(); 67 int cltp_input(), cltp_ctlinput(), cltp_init(), cltp_usrreq(), cltp_output(); 68 int isis_input(); 69 70 struct protosw isosw[] = { 71 /* 72 * We need a datagram entry through which net mgmt programs can get 73 * to the iso_control procedure (iso ioctls). Thus, a minimal 74 * SOCK_DGRAM interface is provided here. 75 * THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call 76 * pffindtype, which gets the first entry that matches the type. 77 * sigh. 78 */ 79 { SOCK_DGRAM, &isodomain, ISOPROTO_CLTP, PR_ATOMIC|PR_ADDR, 80 0, cltp_output, 0, 0, 81 cltp_usrreq, 82 cltp_init, 0, 0, 0 83 }, 84 85 /* 86 * A datagram interface for clnp cannot co-exist with TP/CLNP 87 * because CLNP has no way to discriminate incoming TP packets from 88 * packets coming in for any other higher layer protocol. 89 * Old way: set it up so that pffindproto(... dgm, clnp) fails. 90 * New way: let pffindproto work (for x.25, thank you) but create 91 * a clnp_usrreq() that returns error on PRU_ATTACH. 92 */ 93 {SOCK_DGRAM, &isodomain, ISOPROTO_CLNP, 0, 94 0, clnp_output, 0, 0, 95 clnp_usrreq, 96 clnp_init, 0, clnp_slowtimo, clnp_drain, 97 }, 98 99 /* raw clnp */ 100 { SOCK_RAW, &isodomain, ISOPROTO_RAW, PR_ATOMIC|PR_ADDR, 101 rclnp_input, rclnp_output, 0, rclnp_ctloutput, 102 clnp_usrreq, 103 0, 0, 0, 0 104 }, 105 106 /* ES-IS protocol */ 107 { SOCK_DGRAM, &isodomain, ISOPROTO_ESIS, PR_ATOMIC|PR_ADDR, 108 esis_input, 0, esis_ctlinput, 0, 109 esis_usrreq, 110 esis_init, 0, 0, 0 111 }, 112 113 /* ISOPROTO_INTRAISIS */ 114 { SOCK_DGRAM, &isodomain, ISOPROTO_INTRAISIS, PR_ATOMIC|PR_ADDR, 115 isis_input, 0, 0, 0, 116 esis_usrreq, 117 0, 0, 0, 0 118 }, 119 120 /* ISOPROTO_TP */ 121 { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP, PR_CONNREQUIRED|PR_WANTRCVD, 122 tpclnp_input, 0, tpclnp_ctlinput, tp_ctloutput, 123 tp_usrreq, 124 tp_init, tp_fasttimo, tp_slowtimo, tp_drain, 125 }, 126 127 #ifdef TPCONS 128 /* ISOPROTO_TP */ 129 { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP0, PR_CONNREQUIRED|PR_WANTRCVD, 130 tpcons_input, 0, 0, tp_ctloutput, 131 tp_usrreq, 132 cons_init, 0, 0, 0, 133 }, 134 #endif 135 136 }; 137 138 int iso_init(); 139 140 struct domain isodomain = { 141 AF_ISO, /* family */ 142 "iso-domain", /* name */ 143 iso_init, /* initialize routine */ 144 0, /* externalize access rights */ 145 0, /* dispose of internalized rights */ 146 isosw, /* protosw */ 147 &isosw[sizeof(isosw)/sizeof(isosw[0])] /* NPROTOSW */ 148 }; 149 #endif ISO 150