2 * Copyright (c) 1984, 1985, 1986, 1987, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 4. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Copyright (c) 1995, Mike Mitchell
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
34 * 1. Redistributions of source code must retain the above copyright
35 * notice, this list of conditions and the following disclaimer.
36 * 2. Redistributions in binary form must reproduce the above copyright
37 * notice, this list of conditions and the following disclaimer in the
38 * documentation and/or other materials provided with the distribution.
39 * 3. All advertising materials mentioning features or use of this software
40 * must display the following acknowledgement:
41 * This product includes software developed by the University of
42 * California, Berkeley and its contributors.
43 * 4. Neither the name of the University nor the names of its contributors
44 * may be used to endorse or promote products derived from this software
45 * without specific prior written permission.
47 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
48 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 #ifndef _NETIPX_IPX_H_
65 #define _NETIPX_IPX_H_
68 * Constants and Structures
74 #define IPXPROTO_UNKWN 0 /* Unknown */
75 #define IPXPROTO_RI 1 /* RIP Routing Information */
76 #define IPXPROTO_PXP 4 /* IPX Packet Exchange Protocol */
77 #define IPXPROTO_SPX 5 /* SPX Sequenced Packet */
78 #define IPXPROTO_NCP 17 /* NCP NetWare Core */
79 #define IPXPROTO_NETBIOS 20 /* Propagated Packet */
80 #define IPXPROTO_RAW 255 /* Placemarker*/
81 #define IPXPROTO_MAX 256 /* Placemarker*/
84 * Port/Socket numbers: network standard functions
87 #define IPXPORT_RI 1 /* NS RIP Routing Information */
88 #define IPXPORT_ECHO 2 /* NS Echo */
89 #define IPXPORT_RE 3 /* NS Router Error */
90 #define IPXPORT_NCP 0x0451 /* NW NCP Core Protocol */
91 #define IPXPORT_SAP 0x0452 /* NW SAP Service Advertising */
92 #define IPXPORT_RIP 0x0453 /* NW RIP Routing Information */
93 #define IPXPORT_NETBIOS 0x0455 /* NW NetBIOS */
94 #define IPXPORT_DIAGS 0x0456 /* NW Diagnostics */
96 * Ports < IPXPORT_RESERVED are reserved for privileged
98 #define IPXPORT_RESERVED 0x4000
100 * Ports > IPXPORT_WELLKNOWN are reserved for privileged
101 * processes (e.g. root).
103 #define IPXPORT_WELLKNOWN 0x6000
105 /* flags passed to ipx_outputfl as last parameter */
107 #define IPX_FORWARDING 0x1 /* most of ipx header exists */
108 #define IPX_ROUTETOIF 0x10 /* same as SO_DONTROUTE */
109 #define IPX_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
111 #define IPX_MAXHOPS 15
113 /* flags passed to get/set socket option */
114 #define SO_HEADERS_ON_INPUT 1
115 #define SO_HEADERS_ON_OUTPUT 2
116 #define SO_DEFAULT_HEADERS 3
117 #define SO_LAST_HEADER 4
118 #define SO_IPXIP_ROUTE 5 /* No longer implemented. */
120 #define SO_ALL_PACKETS 7
122 #define SO_IPXTUN_ROUTE 9
123 #define SO_IPX_CHECKSUM 10
145 union ipx_host x_host;
152 struct sockaddr_ipx {
155 struct ipx_addr sipx_addr;
158 #define sipx_port sipx_addr.x_port
161 * Definitions for IPX Internetwork Packet Exchange Protocol
164 u_short ipx_sum; /* Checksum */
165 u_short ipx_len; /* Length, in bytes, including header */
166 u_char ipx_tc; /* Transport Control (i.e. hop count) */
167 u_char ipx_pt; /* Packet Type (i.e. level 2 protocol) */
168 struct ipx_addr ipx_dna; /* Destination Network Address */
169 struct ipx_addr ipx_sna; /* Source Network Address */
172 #define ipx_neteqnn(a,b) \
173 (((a).s_net[0] == (b).s_net[0]) && ((a).s_net[1] == (b).s_net[1]))
174 #define ipx_neteq(a,b) ipx_neteqnn((a).x_net, (b).x_net)
175 #define satoipx_addr(sa) (((struct sockaddr_ipx *)&(sa))->sipx_addr)
176 #define ipx_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \
177 (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])
178 #define ipx_hosteq(s,t) (ipx_hosteqnh((s).x_host,(t).x_host))
179 #define ipx_nullnet(x) (((x).x_net.s_net[0]==0) && ((x).x_net.s_net[1]==0))
180 #define ipx_nullhost(x) (((x).x_host.s_host[0] == 0) && \
181 ((x).x_host.s_host[1] == 0) && ((x).x_host.s_host[2] == 0))
182 #define ipx_wildnet(x) (((x).x_net.s_net[0] == 0xffff) && \
183 ((x).x_net.s_net[1] == 0xffff))
184 #define ipx_wildhost(x) (((x).x_host.s_host[0] == 0xffff) && \
185 ((x).x_host.s_host[1] == 0xffff) && ((x).x_host.s_host[2] == 0xffff))
187 #include <sys/cdefs.h>
190 struct ipx_addr ipx_addr(const char *);
191 char *ipx_ntoa(struct ipx_addr);
194 #endif /* !_NETIPX_IPX_H_ */