[DHCP]
[reactos.git] / reactos / base / services / dhcp / include / osdep.h
1 /* osdep.h
2
3 Operating system dependencies... */
4
5 /*
6 * Copyright (c) 1996, 1997, 1998, 1999 The Internet Software Consortium.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of The Internet Software Consortium nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
23 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
24 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
26 * THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
33 * OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 * This software was written for the Internet Software Consortium by Ted Lemon
36 * under a contract with Vixie Laboratories.
37 */
38
39 #include "site.h"
40
41 /* Porting::
42
43 If you add a new network API, you must add a check for it below: */
44
45 #if !defined (USE_SOCKETS) && \
46 !defined (USE_SOCKET_SEND) && \
47 !defined (USE_SOCKET_RECEIVE) && \
48 !defined (USE_RAW_SOCKETS) && \
49 !defined (USE_RAW_SEND) && \
50 !defined (USE_SOCKET_RECEIVE) && \
51 !defined (USE_BPF) && \
52 !defined (USE_BPF_SEND) && \
53 !defined (USE_BPF_RECEIVE) && \
54 !defined (USE_LPF) && \
55 !defined (USE_LPF_SEND) && \
56 !defined (USE_LPF_RECEIVE) && \
57 !defined (USE_NIT) && \
58 !defined (USE_NIT_SEND) && \
59 !defined (USE_NIT_RECEIVE) && \
60 !defined (USR_DLPI_SEND) && \
61 !defined (USE_DLPI_RECEIVE)
62 # define USE_DEFAULT_NETWORK
63 #endif
64
65
66 /* Porting::
67
68 If you add a new system configuration file, include it here: */
69
70 #if defined (sun)
71 # if defined (__svr4__) || defined (__SVR4)
72 # include "cf/sunos5-5.h"
73 # else
74 # include "cf/sunos4.h"
75 # endif
76 #endif
77
78 #ifdef aix
79 # include "cf/aix.h"
80 #endif
81
82 #ifdef bsdi
83 # include "cf/bsdos.h"
84 #endif
85
86 #ifdef __NetBSD__
87 # include "cf/netbsd.h"
88 #endif
89
90 #ifdef __FreeBSD__
91 # include "cf/freebsd.h"
92 #endif
93
94 #if defined (__osf__) && defined (__alpha)
95 # include "cf/alphaosf.h"
96 #endif
97
98 #ifdef ultrix
99 # include "cf/ultrix.h"
100 #endif
101
102 #ifdef linux
103 # include "cf/linux.h"
104 #endif
105
106 #ifdef SCO
107 # include "cf/sco.h"
108 #endif
109
110 #if defined (hpux) || defined (__hpux)
111 # include "cf/hpux.h"
112 #endif
113
114 #ifdef __QNX__
115 # include "cf/qnx.h"
116 #endif
117
118 #ifdef __CYGWIN32__
119 # include "cf/cygwin32.h"
120 #endif
121
122 #ifdef __APPLE__
123 # include "cf/rhapsody.h"
124 #else
125 # if defined (NeXT)
126 # include "cf/nextstep.h"
127 # endif
128 #endif
129
130 #if defined(IRIX) || defined(__sgi)
131 # include "cf/irix.h"
132 #endif
133
134 #if !defined (TIME_MAX)
135 # define TIME_MAX 2147483647
136 #endif
137
138 /* Porting::
139
140 If you add a new network API, and have it set up so that it can be
141 used for sending or receiving, but doesn't have to be used for both,
142 then set up an ifdef like the ones below: */
143
144 #ifdef USE_SOCKETS
145 # define USE_SOCKET_SEND
146 # define USE_SOCKET_RECEIVE
147 #endif
148
149 #ifdef USE_RAW_SOCKETS
150 # define USE_RAW_SEND
151 # define USE_SOCKET_RECEIVE
152 #endif
153
154 #ifdef USE_BPF
155 # define USE_BPF_SEND
156 # define USE_BPF_RECEIVE
157 #endif
158
159 #ifdef USE_LPF
160 # define USE_LPF_SEND
161 # define USE_LPF_RECEIVE
162 #endif
163
164 #ifdef USE_NIT
165 # define USE_NIT_SEND
166 # define USE_NIT_RECEIVE
167 #endif
168
169 #ifdef USE_DLPI
170 # define USE_DLPI_SEND
171 # define USE_DLPI_RECEIVE
172 #endif
173
174 #ifdef USE_UPF
175 # define USE_UPF_SEND
176 # define USE_UPF_RECEIVE
177 #endif
178
179 /* Porting::
180
181 If you add support for sending packets directly out an interface,
182 and your support does not do ARP or routing, you must use a fallback
183 mechanism to deal with packets that need to be sent to routers.
184 Currently, all low-level packet interfaces use BSD sockets as a
185 fallback. */
186
187 #if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \
188 defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || defined (USE_LPF_SEND)
189 # define USE_SOCKET_FALLBACK
190 # define USE_FALLBACK
191 #endif
192
193 /* Porting::
194
195 If you add support for sending packets directly out an interface
196 and need to be able to assemble packets, add the USE_XXX_SEND
197 definition for your interface to the list tested below. */
198
199 #if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \
200 defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \
201 defined (USE_DLPI_SEND) || defined (USE_LPF_SEND)
202 # define PACKET_ASSEMBLY
203 #endif
204
205 /* Porting::
206
207 If you add support for receiving packets directly from an interface
208 and need to be able to decode raw packets, add the USE_XXX_RECEIVE
209 definition for your interface to the list tested below. */
210
211 #if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \
212 defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \
213 defined (USE_DLPI_RECEIVE) || \
214 defined (USE_LPF_SEND) || \
215 (defined (USE_SOCKET_SEND) && defined (SO_BINDTODEVICE))
216 # define PACKET_DECODING
217 #endif
218
219 /* If we don't have a DLPI packet filter, we have to filter in userland.
220 Probably not worth doing, actually. */
221 #if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD)
222 # define USERLAND_FILTER
223 #endif
224
225 /* jmp_buf is assumed to be a struct unless otherwise defined in the
226 system header. */
227 #ifndef jbp_decl
228 # define jbp_decl(x) jmp_buf *x
229 #endif
230 #ifndef jref
231 # define jref(x) (&(x))
232 #endif
233 #ifndef jdref
234 # define jdref(x) (*(x))
235 #endif
236 #ifndef jrefproto
237 # define jrefproto jmp_buf *
238 #endif
239
240 #ifndef BPF_FORMAT
241 # define BPF_FORMAT "/dev/bpf%d"
242 #endif
243
244 #if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT)
245 # define HAVE_IFF_POINTOPOINT
246 #endif
247
248 #if defined (AF_LINK) && !defined (HAVE_AF_LINK)
249 # define HAVE_AF_LINK
250 #endif
251
252 #if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL)
253 # define HAVE_ARPHRD_TUNNEL
254 #endif
255
256 #if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK)
257 # define HAVE_ARPHRD_LOOPBACK
258 #endif
259
260 #if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE)
261 # define HAVE_ARPHRD_ROSE
262 #endif
263
264 #if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802)
265 # define HAVE_ARPHRD_IEEE802
266 #endif
267
268 #if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI)
269 # define HAVE_ARPHRD_FDDI
270 #endif
271
272 #if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25)
273 # define HAVE_ARPHRD_AX25
274 #endif
275
276 #if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM)
277 # define HAVE_ARPHRD_NETROM
278 #endif
279
280 #if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM)
281 # define HAVE_ARPHRD_METRICOM
282 #endif
283
284 #if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE)
285 # define HAVE_SO_BINDTODEVICE
286 #endif
287
288 #if defined (SIOCGIFHWADDR) && !defined (HAVE_SIOCGIFHWADDR)
289 # define HAVE_SIOCGIFHWADDR
290 #endif
291
292 #if defined (AF_LINK) && !defined (HAVE_AF_LINK)
293 # define HAVE_AF_LINK
294 #endif