1/* 2 * Copyright (c) 1995, Mike Mitchell 3 * Copyright (c) 1984, 1985, 1986, 1987, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the following acknowledgement: 16 * This product includes software developed by the University of 17 * California, Berkeley and its contributors. 18 * 4. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)ipx.h 35 */ 36 37#ifndef _NETIPX_IPX_H_ 38#define _NETIPX_IPX_H_ 39 40/* 41 * Constants and Structures 42 */ 43 44/* 45 * Protocols 46 */ 47#define IPXPROTO_UNKWN 0 /* Unknown */ 48#define IPXPROTO_RI 1 /* RIP Routing Information */ 49#define IPXPROTO_ECHO 2 /* Echo Protocol */ 50#define IPXPROTO_ERROR 3 /* Error Protocol */ 51#define IPXPROTO_PXP 4 /* PXP Packet Exchange */ 52#define IPXPROTO_SPX 5 /* SPX Sequenced Packet */ 53#define IPXPROTO_NCP 17 /* NCP NetWare Core */ 54#define IPXPROTO_RAW 255 /* Placemarker*/ 55#define IPXPROTO_MAX 256 /* Placemarker*/ 56 57/* 58 * Port/Socket numbers: network standard functions 59 */ 60 61#define IPXPORT_RI 1 /* NS RIP Routing Information */ 62#define IPXPORT_ECHO 2 /* NS Echo */ 63#define IPXPORT_RE 3 /* NS Router Error */ 64#define IPXPORT_FSP 0x0451 /* NW FSP File Service */ 65#define IPXPORT_SAP 0x0452 /* NW SAP Service Advertising */ 66#define IPXPORT_RIP 0x0453 /* NW RIP Routing Information */ 67#define IPXPORT_NETBIOS 0x0455 /* NW NetBIOS */ 68#define IPXPORT_DIAGS 0x0456 /* NW Diagnostics */ 69#define IPXPORT_WDOG 0x4001 /* NW Watchdog Packets */ 70#define IPXPORT_SHELL 0x4003 /* NW Shell Socket */ 71#define IPXPORT_MAX 0x8000 /* Maximum User Addressable Port */ 72 73/* flags passed to ipx_outputfl as last parameter */ 74 75#define IPX_FORWARDING 0x1 /* most of ipx header exists */ 76#define IPX_ROUTETOIF 0x10 /* same as SO_DONTROUTE */ 77#define IPX_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ 78 79#define IPX_MAXHOPS 15 80 81/* flags passed to get/set socket option */ 82#define SO_HEADERS_ON_INPUT 1 83#define SO_HEADERS_ON_OUTPUT 2 84#define SO_DEFAULT_HEADERS 3 85#define SO_LAST_HEADER 4 86#define SO_IPXIP_ROUTE 5 87#define SO_SEQNO 6 88#define SO_ALL_PACKETS 7 89#define SO_MTU 8 90#define SO_IPXTUN_ROUTE 9 91 92/* 93 * IPX addressing 94 */ 95union ipx_host { 96 u_char c_host[6]; 97 u_short s_host[3]; 98}; 99 100union ipx_net { 101 u_char c_net[4]; 102 u_short s_net[2]; 103}; 104 105union ipx_net_u { 106 union ipx_net net_e; 107 u_long long_e; 108}; 109 110struct ipx_addr { 111 union ipx_net x_net; 112 union ipx_host x_host; 113 u_short x_port; 114}; 115 116/* 117 * Socket address 118 */ 119struct sockaddr_ipx { 120 u_char sipx_len; 121 u_char sipx_family; 122 struct ipx_addr sipx_addr; 123 char sipx_zero[2]; 124}; 125#define sipx_port sipx_addr.x_port 126 127/* 128 * Definitions for IPX Internet Datagram Protocol 129 */ 130struct ipx { 131 u_short ipx_sum; /* Checksum */ 132 u_short ipx_len; /* Length, in bytes, including header */ 133 u_char ipx_tc; /* Transport Crontrol (i.e. hop count) */ 134 u_char ipx_pt; /* Packet Type (i.e. level 2 protocol) */ 135 struct ipx_addr ipx_dna; /* Destination Network Address */ 136 struct ipx_addr ipx_sna; /* Source Network Address */ 137}; 138 139#ifdef vax 140#define ipx_netof(a) (*(long *) & ((a).x_net)) /* XXX - not needed */ 141#endif 142#define ipx_neteqnn(a,b) \ 143 (((a).s_net[0]==(b).s_net[0]) && ((a).s_net[1]==(b).s_net[1])) 144#define ipx_neteq(a,b) ipx_neteqnn((a).x_net, (b).x_net) 145#define satoipx_addr(sa) (((struct sockaddr_ipx *)&(sa))->sipx_addr) 146#define ipx_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \ 147 (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2]) 148#define ipx_hosteq(s,t) (ipx_hosteqnh((s).x_host,(t).x_host)) 149#define ipx_nullnet(x) (((x).x_net.s_net[0]==0) && ((x).x_net.s_net[1]==0)) 150#define ipx_nullhost(x) (((x).x_host.s_host[0]==0) && \ 151 ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0)) 152#define ipx_wildnet(x) (((x).x_net.s_net[0]==0xffff) && \ 153 ((x).x_net.s_net[1]==0xffff)) 154#define ipx_wildhost(x) (((x).x_host.s_host[0]==0xffff) && \ 155 ((x).x_host.s_host[1]==0xffff) && ((x).x_host.s_host[2]==0xffff)) 156 157#ifdef KERNEL 158
| 1/* 2 * Copyright (c) 1995, Mike Mitchell 3 * Copyright (c) 1984, 1985, 1986, 1987, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the following acknowledgement: 16 * This product includes software developed by the University of 17 * California, Berkeley and its contributors. 18 * 4. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)ipx.h 35 */ 36 37#ifndef _NETIPX_IPX_H_ 38#define _NETIPX_IPX_H_ 39 40/* 41 * Constants and Structures 42 */ 43 44/* 45 * Protocols 46 */ 47#define IPXPROTO_UNKWN 0 /* Unknown */ 48#define IPXPROTO_RI 1 /* RIP Routing Information */ 49#define IPXPROTO_ECHO 2 /* Echo Protocol */ 50#define IPXPROTO_ERROR 3 /* Error Protocol */ 51#define IPXPROTO_PXP 4 /* PXP Packet Exchange */ 52#define IPXPROTO_SPX 5 /* SPX Sequenced Packet */ 53#define IPXPROTO_NCP 17 /* NCP NetWare Core */ 54#define IPXPROTO_RAW 255 /* Placemarker*/ 55#define IPXPROTO_MAX 256 /* Placemarker*/ 56 57/* 58 * Port/Socket numbers: network standard functions 59 */ 60 61#define IPXPORT_RI 1 /* NS RIP Routing Information */ 62#define IPXPORT_ECHO 2 /* NS Echo */ 63#define IPXPORT_RE 3 /* NS Router Error */ 64#define IPXPORT_FSP 0x0451 /* NW FSP File Service */ 65#define IPXPORT_SAP 0x0452 /* NW SAP Service Advertising */ 66#define IPXPORT_RIP 0x0453 /* NW RIP Routing Information */ 67#define IPXPORT_NETBIOS 0x0455 /* NW NetBIOS */ 68#define IPXPORT_DIAGS 0x0456 /* NW Diagnostics */ 69#define IPXPORT_WDOG 0x4001 /* NW Watchdog Packets */ 70#define IPXPORT_SHELL 0x4003 /* NW Shell Socket */ 71#define IPXPORT_MAX 0x8000 /* Maximum User Addressable Port */ 72 73/* flags passed to ipx_outputfl as last parameter */ 74 75#define IPX_FORWARDING 0x1 /* most of ipx header exists */ 76#define IPX_ROUTETOIF 0x10 /* same as SO_DONTROUTE */ 77#define IPX_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ 78 79#define IPX_MAXHOPS 15 80 81/* flags passed to get/set socket option */ 82#define SO_HEADERS_ON_INPUT 1 83#define SO_HEADERS_ON_OUTPUT 2 84#define SO_DEFAULT_HEADERS 3 85#define SO_LAST_HEADER 4 86#define SO_IPXIP_ROUTE 5 87#define SO_SEQNO 6 88#define SO_ALL_PACKETS 7 89#define SO_MTU 8 90#define SO_IPXTUN_ROUTE 9 91 92/* 93 * IPX addressing 94 */ 95union ipx_host { 96 u_char c_host[6]; 97 u_short s_host[3]; 98}; 99 100union ipx_net { 101 u_char c_net[4]; 102 u_short s_net[2]; 103}; 104 105union ipx_net_u { 106 union ipx_net net_e; 107 u_long long_e; 108}; 109 110struct ipx_addr { 111 union ipx_net x_net; 112 union ipx_host x_host; 113 u_short x_port; 114}; 115 116/* 117 * Socket address 118 */ 119struct sockaddr_ipx { 120 u_char sipx_len; 121 u_char sipx_family; 122 struct ipx_addr sipx_addr; 123 char sipx_zero[2]; 124}; 125#define sipx_port sipx_addr.x_port 126 127/* 128 * Definitions for IPX Internet Datagram Protocol 129 */ 130struct ipx { 131 u_short ipx_sum; /* Checksum */ 132 u_short ipx_len; /* Length, in bytes, including header */ 133 u_char ipx_tc; /* Transport Crontrol (i.e. hop count) */ 134 u_char ipx_pt; /* Packet Type (i.e. level 2 protocol) */ 135 struct ipx_addr ipx_dna; /* Destination Network Address */ 136 struct ipx_addr ipx_sna; /* Source Network Address */ 137}; 138 139#ifdef vax 140#define ipx_netof(a) (*(long *) & ((a).x_net)) /* XXX - not needed */ 141#endif 142#define ipx_neteqnn(a,b) \ 143 (((a).s_net[0]==(b).s_net[0]) && ((a).s_net[1]==(b).s_net[1])) 144#define ipx_neteq(a,b) ipx_neteqnn((a).x_net, (b).x_net) 145#define satoipx_addr(sa) (((struct sockaddr_ipx *)&(sa))->sipx_addr) 146#define ipx_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \ 147 (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2]) 148#define ipx_hosteq(s,t) (ipx_hosteqnh((s).x_host,(t).x_host)) 149#define ipx_nullnet(x) (((x).x_net.s_net[0]==0) && ((x).x_net.s_net[1]==0)) 150#define ipx_nullhost(x) (((x).x_host.s_host[0]==0) && \ 151 ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0)) 152#define ipx_wildnet(x) (((x).x_net.s_net[0]==0xffff) && \ 153 ((x).x_net.s_net[1]==0xffff)) 154#define ipx_wildhost(x) (((x).x_host.s_host[0]==0xffff) && \ 155 ((x).x_host.s_host[1]==0xffff) && ((x).x_host.s_host[2]==0xffff)) 156 157#ifdef KERNEL 158
|
175u_short ipx_cksum(); 176void ipx_input(), ipx_abort(), ipx_drop(); 177int ipx_output(), ipx_ctloutput(), ipx_usrreq(); 178int ipx_raw_usrreq(), ipx_control(), ipx_do_route(); 179void ipx_init(), ipxintr(), ipx_ctlinput(), ipx_forward(); 180void ipx_undo_route(), ipx_watch_output(); 181int ipx_outputfl();
| 178__BEGIN_DECLS 179u_short ipx_cksum __P((struct mbuf *m, int len)); 180void ipx_input __P((struct mbuf *m, struct ipxpcb *ipxp)); 181void ipx_abort __P((struct ipxpcb *ipxp)); 182void ipx_drop __P((struct ipxpcb *ipxp, int errno)); 183int ipx_output __P((struct ipxpcb *ipxp, struct mbuf *m0)); 184int ipx_ctloutput __P((int req, struct socket *so, int level, int name, struct mbuf **value)); 185int ipx_usrreq __P((struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control)); 186int ipx_raw_usrreq __P((struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control)); 187int ipx_control __P((struct socket *so, int cmd, caddr_t data, struct ifnet *ifp)); 188void ipx_init __P((void)); 189void ipxintr __P((void)); 190void ipx_ctlinput __P((int cmd, caddr_t arg)); 191void ipx_forward __P((struct mbuf *m)); 192void ipx_watch_output __P((struct mbuf *m, struct ifnet *ifp)); 193int ipx_do_route __P((struct ipx_addr *src, struct route *ro)); 194void ipx_undo_route __P((struct route *ro)); 195int ipx_outputfl __P((struct mbuf *m0, struct route *ro, int flags)); 196__END_DECLS
|