1139823Simp/*- 211819Sjulian * Copyright (c) 1984, 1985, 1986, 1987, 1993 311819Sjulian * The Regents of the University of California. All rights reserved. 411819Sjulian * 511819Sjulian * Redistribution and use in source and binary forms, with or without 611819Sjulian * modification, are permitted provided that the following conditions 711819Sjulian * are met: 811819Sjulian * 1. Redistributions of source code must retain the above copyright 911819Sjulian * notice, this list of conditions and the following disclaimer. 1011819Sjulian * 2. Redistributions in binary form must reproduce the above copyright 1111819Sjulian * notice, this list of conditions and the following disclaimer in the 1211819Sjulian * documentation and/or other materials provided with the distribution. 13165899Srwatson * 4. Neither the name of the University nor the names of its contributors 14165899Srwatson * may be used to endorse or promote products derived from this software 15165899Srwatson * without specific prior written permission. 16165899Srwatson * 17165899Srwatson * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18165899Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19165899Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20165899Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21165899Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22165899Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23165899Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24165899Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25165899Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26165899Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27165899Srwatson * SUCH DAMAGE. 28165899Srwatson * 29165899Srwatson * Copyright (c) 1995, Mike Mitchell 30165899Srwatson * 31165899Srwatson * Redistribution and use in source and binary forms, with or without 32165899Srwatson * modification, are permitted provided that the following conditions 33165899Srwatson * are met: 34165899Srwatson * 1. Redistributions of source code must retain the above copyright 35165899Srwatson * notice, this list of conditions and the following disclaimer. 36165899Srwatson * 2. Redistributions in binary form must reproduce the above copyright 37165899Srwatson * notice, this list of conditions and the following disclaimer in the 38165899Srwatson * documentation and/or other materials provided with the distribution. 3911819Sjulian * 3. All advertising materials mentioning features or use of this software 4011819Sjulian * must display the following acknowledgement: 4111819Sjulian * This product includes software developed by the University of 4211819Sjulian * California, Berkeley and its contributors. 4311819Sjulian * 4. Neither the name of the University nor the names of its contributors 4411819Sjulian * may be used to endorse or promote products derived from this software 4511819Sjulian * without specific prior written permission. 4611819Sjulian * 4711819Sjulian * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 4811819Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4911819Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 5011819Sjulian * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 5111819Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 5211819Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 5311819Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 5411819Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 5511819Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 5611819Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5711819Sjulian * SUCH DAMAGE. 5811819Sjulian * 5912057Sjulian * @(#)ipx_proto.c 6011819Sjulian */ 6111819Sjulian 62116189Sobrien#include <sys/cdefs.h> 63116189Sobrien__FBSDID("$FreeBSD$"); 64116189Sobrien 6531742Seivind#include "opt_ipx.h" 6631742Seivind 6711819Sjulian#include <sys/param.h> 6811819Sjulian#include <sys/socket.h> 6911819Sjulian#include <sys/protosw.h> 7011819Sjulian#include <sys/domain.h> 7111819Sjulian#include <sys/kernel.h> 7244078Sdfr#include <sys/queue.h> 7313266Swollman#include <sys/sysctl.h> 7411819Sjulian 7511819Sjulian#include <net/radix.h> 7611819Sjulian 7711819Sjulian#include <netipx/ipx.h> 7825652Sjhay#include <netipx/ipx_var.h> 7911819Sjulian#include <netipx/spx.h> 8011819Sjulian 8125652Sjhaystatic struct pr_usrreqs nousrreqs; 8225347Sjhay 8311819Sjulian/* 8411819Sjulian * IPX protocol family: IPX, ERR, PXP, SPX, ROUTE. 8511819Sjulian */ 8611819Sjulian 87149848Sobrienstatic struct domain ipxdomain; 88149848Sobrien 8926965Sjhaystatic struct protosw ipxsw[] = { 90152242Sru{ 91152242Sru .pr_domain = &ipxdomain, 92152242Sru .pr_init = ipx_init, 93152242Sru .pr_usrreqs = &nousrreqs 9411819Sjulian}, 95152242Sru{ 96152242Sru .pr_type = SOCK_DGRAM, 97152242Sru .pr_domain = &ipxdomain, 98152242Sru .pr_flags = PR_ATOMIC|PR_ADDR, 99152242Sru .pr_ctlinput = ipx_ctlinput, 100152242Sru .pr_ctloutput = ipx_ctloutput, 101152242Sru .pr_usrreqs = &ipx_usrreqs 10211819Sjulian}, 103152242Sru{ 104152242Sru .pr_type = SOCK_STREAM, 105152242Sru .pr_domain = &ipxdomain, 106152242Sru .pr_protocol = IPXPROTO_SPX, 107152242Sru .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD, 108152242Sru .pr_ctlinput = spx_ctlinput, 109152242Sru .pr_ctloutput = spx_ctloutput, 110152242Sru .pr_init = spx_init, 111152242Sru .pr_fasttimo = spx_fasttimo, 112152242Sru .pr_slowtimo = spx_slowtimo, 113152242Sru .pr_usrreqs = &spx_usrreqs 11411819Sjulian}, 115152242Sru{ 116152242Sru .pr_type = SOCK_SEQPACKET, 117152242Sru .pr_domain = &ipxdomain, 118152242Sru .pr_protocol = IPXPROTO_SPX, 119152242Sru .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_ATOMIC, 120152242Sru .pr_ctlinput = spx_ctlinput, 121152242Sru .pr_ctloutput = spx_ctloutput, 122152242Sru .pr_usrreqs = &spx_usrreq_sps 12311819Sjulian}, 124152242Sru{ 125152242Sru .pr_type = SOCK_RAW, 126152242Sru .pr_domain = &ipxdomain, 127152242Sru .pr_protocol = IPXPROTO_RAW, 128152242Sru .pr_flags = PR_ATOMIC|PR_ADDR, 129152242Sru .pr_ctloutput = ipx_ctloutput, 130152242Sru .pr_usrreqs = &ripx_usrreqs 13111819Sjulian}, 13211819Sjulian}; 13311819Sjulian 134178888Sjulianextern int ipx_inithead(void **, int); 135178888Sjulian 136152242Srustatic struct domain ipxdomain = { 137152242Sru .dom_family = AF_IPX, 138152242Sru .dom_name = "network systems", 139152242Sru .dom_protosw = ipxsw, 140152242Sru .dom_protoswNPROTOSW = &ipxsw[sizeof(ipxsw)/sizeof(ipxsw[0])], 141178888Sjulian .dom_rtattach = ipx_inithead, 142152242Sru .dom_rtoffset = 16, 143152242Sru .dom_maxrtkey = sizeof(struct sockaddr_ipx) 144152242Sru}; 14511819Sjulian 146178888Sjulian 147178888Sjulian/* shim to adapt arguments */ 148178888Sjulianint 149178888Sjulianipx_inithead(void **head, int offset) 150178888Sjulian{ 151178888Sjulian return rn_inithead(head, offset); 152178888Sjulian} 153178888Sjulian 15411819SjulianDOMAIN_SET(ipx); 15513266SwollmanSYSCTL_NODE(_net, PF_IPX, ipx, CTLFLAG_RW, 0, 15613266Swollman "IPX/SPX"); 15713266Swollman 15813266SwollmanSYSCTL_NODE(_net_ipx, IPXPROTO_RAW, ipx, CTLFLAG_RW, 0, "IPX"); 159227309Sedstatic SYSCTL_NODE(_net_ipx, IPXPROTO_SPX, spx, CTLFLAG_RW, 0, "SPX"); 160