1 /*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)iso_proto.c 8.2 (Berkeley) 02/09/95 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 <sys/param.h> 47 #include <sys/socket.h> 48 #include <sys/protosw.h> 49 #include <sys/domain.h> 50 #include <sys/mbuf.h> 51 52 #include <net/radix.h> 53 54 #include <netiso/iso.h> 55 56 void clnp_init(),clnp_slowtimo(),clnp_drain(); 57 int clnp_output(); 58 void rclnp_input(); 59 int rclnp_output(), rclnp_ctloutput(), raw_usrreq(); 60 int clnp_usrreq(); 61 62 int tp_ctloutput(), tp_usrreq(); 63 void tp_init(), tp_fasttimo(), tp_slowtimo(), tp_drain(); 64 void tpclnp_ctlinput(), tpclnp_input(); 65 void cons_init(), tpcons_input(); 66 67 void isis_input(); 68 void esis_init(), esis_input(), esis_ctlinput(); 69 int esis_usrreq(); 70 void idrp_init(), idrp_input(); 71 int idrp_usrreq(); 72 void cltp_init(), cltp_input(), cltp_ctlinput(); 73 int cltp_usrreq(), cltp_output(); 74 75 #ifdef TUBA 76 int tuba_usrreq(), tuba_ctloutput(); 77 void tuba_init(), tuba_slowtimo(), tuba_fasttimo(), tuba_tcpinput(); 78 #endif 79 80 struct protosw isosw[] = { 81 /* 82 * We need a datagram entry through which net mgmt programs can get 83 * to the iso_control procedure (iso ioctls). Thus, a minimal 84 * SOCK_DGRAM interface is provided here. 85 * THIS ONE MUST BE FIRST: Kludge city : socket() says if(!proto) call 86 * pffindtype, which gets the first entry that matches the type. 87 * sigh. 88 */ 89 { SOCK_DGRAM, &isodomain, ISOPROTO_CLTP, PR_ATOMIC|PR_ADDR, 90 0, cltp_output, 0, 0, 91 cltp_usrreq, 92 cltp_init, 0, 0, 0 93 }, 94 95 /* 96 * A datagram interface for clnp cannot co-exist with TP/CLNP 97 * because CLNP has no way to discriminate incoming TP packets from 98 * packets coming in for any other higher layer protocol. 99 * Old way: set it up so that pffindproto(... dgm, clnp) fails. 100 * New way: let pffindproto work (for x.25, thank you) but create 101 * a clnp_usrreq() that returns error on PRU_ATTACH. 102 */ 103 {SOCK_DGRAM, &isodomain, ISOPROTO_CLNP, 0, 104 0, clnp_output, 0, 0, 105 clnp_usrreq, 106 clnp_init, 0, clnp_slowtimo, clnp_drain, 107 }, 108 109 /* raw clnp */ 110 { SOCK_RAW, &isodomain, ISOPROTO_RAW, PR_ATOMIC|PR_ADDR, 111 rclnp_input, rclnp_output, 0, rclnp_ctloutput, 112 clnp_usrreq, 113 0, 0, 0, 0 114 }, 115 116 /* ES-IS protocol */ 117 { SOCK_DGRAM, &isodomain, ISOPROTO_ESIS, PR_ATOMIC|PR_ADDR, 118 esis_input, 0, esis_ctlinput, 0, 119 esis_usrreq, 120 esis_init, 0, 0, 0 121 }, 122 123 /* ISOPROTO_INTRAISIS */ 124 { SOCK_DGRAM, &isodomain, ISOPROTO_INTRAISIS, PR_ATOMIC|PR_ADDR, 125 isis_input, 0, 0, 0, 126 esis_usrreq, 127 0, 0, 0, 0 128 }, 129 130 /* ISOPROTO_IDRP */ 131 { SOCK_DGRAM, &isodomain, ISOPROTO_IDRP, PR_ATOMIC|PR_ADDR, 132 idrp_input, 0, 0, 0, 133 idrp_usrreq, 134 idrp_init, 0, 0, 0 135 }, 136 137 /* ISOPROTO_TP */ 138 { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP, PR_CONNREQUIRED|PR_WANTRCVD, 139 tpclnp_input, 0, tpclnp_ctlinput, tp_ctloutput, 140 tp_usrreq, 141 tp_init, tp_fasttimo, tp_slowtimo, tp_drain, 142 }, 143 144 #ifdef TUBA 145 { SOCK_STREAM, &isodomain, ISOPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD, 146 tuba_tcpinput, 0, 0, tuba_ctloutput, 147 tuba_usrreq, 148 tuba_init, tuba_fasttimo, tuba_fasttimo, 0 149 }, 150 #endif 151 152 #ifdef TPCONS 153 /* ISOPROTO_TP */ 154 { SOCK_SEQPACKET, &isodomain, ISOPROTO_TP0, PR_CONNREQUIRED|PR_WANTRCVD, 155 tpcons_input, 0, 0, tp_ctloutput, 156 tp_usrreq, 157 cons_init, 0, 0, 0, 158 }, 159 #endif 160 161 }; 162 163 164 struct domain isodomain = { 165 AF_ISO, /* family */ 166 "iso-domain", /* name */ 167 0, /* initialize routine */ 168 0, /* externalize access rights */ 169 0, /* dispose of internalized rights */ 170 isosw, /* protosw */ 171 &isosw[sizeof(isosw)/sizeof(isosw[0])], /* NPROTOSW */ 172 0, /* next */ 173 rn_inithead, /* rtattach */ 174 48, /* rtoffset */ 175 sizeof(struct sockaddr_iso) /* maxkeylen */ 176 }; 177 #endif /* ISO */ 178